Registry / serialization / shift.js

shift.js

JSON →
library0.1.1jsnpmunverified

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.

npm install shift.js
INSTALL
IMPORT
SIG · SHIFT.JS
S
shift.js
serializationjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import shift from 'shift-js'
✗ const shift = require('shift-js')
Package may not export ESM; CommonJS require is typical but may fail.
transpile
✓ import { transpile } from 'shift-js'
Main API function for transpiling Swift code.
Lexer
✓ import Lexer from 'shift-js/transpiler/lexer'
✗ const Lexer = require('shift-js').Lexer
Internal module; direct import path may vary.
Parser
✓ import Parser from 'shift-js/transpiler/parser'
✗ const Parser = require('shift-js').Parser
Internal module; not exported from main entry.

Transpile a simple Swift function to JavaScript using Shift.js API.

const shift = require('shift-js'); const swiftCode = ` func greet(name: String) -> String { return "Hello, " + name + "!" } let result = greet(name: "World") print(result) `; shift.transpile(swiftCode).then(js => { console.log(js); }).catch(err => { console.error(err); });
shift.js --version
Debug
Known issues
deprecatedProject is in early development and likely abandoned; no updates since 2015.
fix
Consider using other transpilers like Swiftify or manual migration.
affects: >=0.0.0
breakingRequires Node 4.0.0+; may not work with modern Node versions due to deprecated APIs.
fix
Use Node 4.x or a compatible runtime; upgrade not recommended.
affects: >=0.1.0
gotchaOnly supports a subset of Swift; complex features like generics or protocols may fail.
fix
Stick to basic Swift constructs or transpile manually.
affects: >=0.0.0
deprecatedDependencies include Bluebird and Commander.js; these may be outdated with security vulnerabilities.
fix
Audit dependencies or use isolated environment.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'shift-js'
Package not installed globally or locally.
fix
Run 'npm install shift-js' or install globally with 'npm install -g shift.js' (note the dot).
shift.transpile is not a function
Incorrect import; default export may be an object or class.
fix
Use 'const shift = require('shift-js'); const result = shift.transpile(code);'
Unexpected token :
Transpiler does not support Swift type annotations.
fix
Remove type annotations from Swift code before transpiling.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
shift.js — npm install shift.js · libregistry