Registry / shopify-decaf

shopify-decaf

JSON →
library0.4.18jsnpmunverified

A CoffeeScript to ES.Next transpiler that converts CoffeeScript code to modern JavaScript (ES6+). Current version 0.4.18 is released as a young project with limited feature coverage; uses the CoffeeScript compiler under the hood for parsing. Key differentiators: falls back to CoffeeScript output when ES6 transpilation is not supported, integrates with jscodeshift for code optimization. Alternative to manual refactoring or other transpilers like decaffeinate.

npm install shopify-decaf
INSTALL
IMPORT
SIG · SHOPIFY-DECAF
S
shopify-decaf
javascriptv0.4.18
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.

decaf
import decaf from 'decafjs'
const decaf = require('decafjs')
Package is CommonJS-only; default export via require is correct. ESM import may fail.
compile
const { compile } = require('decafjs')
import { compile } from 'decafjs'
Named export only accessible via require; ESM named import not supported.
transform
const decaf = require('decafjs'); decaf.compile(code)
const compile = require('decafjs').compile
Direct property access is fine, but destructuring is also valid.

Shows basic usage of decaf to transpile a CoffeeScript function to ES6.

const decaf = require('decafjs'); const coffee = `-> alert "hello world"`; const js = decaf.compile(coffee); console.log(js);
shopify-decaf --version
Debug
Known issues
gotchaDecaf may not support all CoffeeScript syntax; unsupported features fall back to original CoffeeScript output.
fix
Check the test suite for supported features; manually review transpiled output.
affects: >=0.1.0
deprecatedThe project is no longer actively maintained; last release was 2016.
fix
Consider using an alternative like decaffeinate or manually rewriting code.
affects: >=0.4.0
gotchaThe npm package name is 'decafjs', not 'decaf' or 'shopify-decaf'.
fix
Install using `npm install decafjs`.
affects: >=0.1.0
gotchaThe package is CommonJS-only; ESM imports or TypeScript types are not available.
fix
Use `require()` or set up a transpilation step.
affects: >=0.1.0
gotchaThe 'compile' function's second argument is passed to recast; options may affect output formatting.
fix
Refer to recast documentation for valid options.
affects: >=0.1.0
Errors
Common errors & fixes
Module not found: Can't resolve 'decafjs'
Package not installed; incorrect package name used.
fix
Run `npm install decafjs` and import with `require('decafjs')`.
TypeError: decaf.compile is not a function
Importing the default export incorrectly with ESM syntax.
fix
Use `const decaf = require('decafjs')` instead of `import decaf from 'decafjs'`.
Upgrade
Version history
0.4.18latest on npm
Audit
Dependencies
coffeescriptrequiredUsed to parse CoffeeScript syntax trees
ast-typesrequiredUsed to build ESprima-compatible AST
recastrequiredUsed for printing generated JavaScript
jscodeshiftoptionalUsed for code optimization
Agent activity
4 hits · last 30 days
node
4
Resources
shopify-decaf — npm install shopify-decaf · libregistry