{"id":26387,"library":"shift.js","title":"Shift.js","description":"A Swift to JavaScript transpiler written in JavaScript, version 0.1.1 (early development). It supports basic Swift data types, collection types, operators, control flow, and functions. The project provides a CLI tool and API, using Escodegen for code generation. It is in active development with limited language coverage and no recent updates.","status":"deprecated","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/shift-js/shift-js","tags":["javascript","swift","js","transpiler","compiler"],"install":[{"cmd":"npm install shift.js","lang":"bash","label":"npm"},{"cmd":"yarn add shift.js","lang":"bash","label":"yarn"},{"cmd":"pnpm add shift.js","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package may not export ESM; CommonJS require is typical but may fail.","wrong":"const shift = require('shift-js')","symbol":"default","correct":"import shift from 'shift-js'"},{"note":"Main API function for transpiling Swift code.","wrong":null,"symbol":"transpile","correct":"import { transpile } from 'shift-js'"},{"note":"Internal module; direct import path may vary.","wrong":"const Lexer = require('shift-js').Lexer","symbol":"Lexer","correct":"import Lexer from 'shift-js/transpiler/lexer'"},{"note":"Internal module; not exported from main entry.","wrong":"const Parser = require('shift-js').Parser","symbol":"Parser","correct":"import Parser from 'shift-js/transpiler/parser'"}],"quickstart":{"code":"const shift = require('shift-js');\nconst swiftCode = `\nfunc greet(name: String) -> String {\n    return \"Hello, \" + name + \"!\"\n}\nlet result = greet(name: \"World\")\nprint(result)\n`;\nshift.transpile(swiftCode).then(js => {\n    console.log(js);\n}).catch(err => {\n    console.error(err);\n});","lang":"javascript","description":"Transpile a simple Swift function to JavaScript using Shift.js API."},"warnings":[{"fix":"Consider using other transpilers like Swiftify or manual migration.","message":"Project is in early development and likely abandoned; no updates since 2015.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Use Node 4.x or a compatible runtime; upgrade not recommended.","message":"Requires Node 4.0.0+; may not work with modern Node versions due to deprecated APIs.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Stick to basic Swift constructs or transpile manually.","message":"Only supports a subset of Swift; complex features like generics or protocols may fail.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Audit dependencies or use isolated environment.","message":"Dependencies include Bluebird and Commander.js; these may be outdated with security vulnerabilities.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.1':11 'activ':43 'api':34 'basic':16 'cli':31 'code':38 'collect':20 'compil':57 'control':23 'coverag':48 'data':18 'develop':13,44 'earli':12 'escodegen':36 'flow':24 'function':26 'generat':39 'javascript':5,9,53 'js':55 'languag':47 'limit':46 'oper':22 'project':28 'provid':29 'recent':51 'shift.js':1 'support':15 'swift':3,17,54 'tool':32 'transpil':6,56 'type':19,21 'updat':52 'use':35 'version':10 'written':7","created_at":"2026-05-01T13:49:42.656672+00:00","updated_at":"2026-05-01T13:49:42.656672+00:00","problems":[{"fix":"Run 'npm install shift-js' or install globally with 'npm install -g shift.js' (note the dot).","cause":"Package not installed globally or locally.","error":"Cannot find module 'shift-js'"},{"fix":"Use 'const shift = require('shift-js'); const result = shift.transpile(code);'","cause":"Incorrect import; default export may be an object or class.","error":"shift.transpile is not a function"},{"fix":"Remove type annotations from Swift code before transpiling.","cause":"Transpiler does not support Swift type annotations.","error":"Unexpected token :"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"shift.js","cli_version":null,"type":"library","homepage":"https://shiftjs.com","github":"https://github.com/shift-js/shift-js","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/shift.js","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}