{"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,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","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,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}