{"id":26388,"library":"shopify-decaf","title":"Decaf JS","description":"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.","status":"deprecated","version":"0.4.18","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/Shopify/decaf","tags":["javascript"],"install":[{"cmd":"npm install shopify-decaf","lang":"bash","label":"npm"},{"cmd":"yarn add shopify-decaf","lang":"bash","label":"yarn"},{"cmd":"pnpm add shopify-decaf","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to parse CoffeeScript syntax trees","package":"coffeescript","optional":false},{"reason":"Used to build ESprima-compatible AST","package":"ast-types","optional":false},{"reason":"Used for printing generated JavaScript","package":"recast","optional":false},{"reason":"Used for code optimization","package":"jscodeshift","optional":true}],"imports":[{"note":"Package is CommonJS-only; default export via require is correct. ESM import may fail.","wrong":"const decaf = require('decafjs')","symbol":"decaf","correct":"import decaf from 'decafjs'"},{"note":"Named export only accessible via require; ESM named import not supported.","wrong":"import { compile } from 'decafjs'","symbol":"compile","correct":"const { compile } = require('decafjs')"},{"note":"Direct property access is fine, but destructuring is also valid.","wrong":"const compile = require('decafjs').compile","symbol":"transform","correct":"const decaf = require('decafjs'); decaf.compile(code)"}],"quickstart":{"code":"const decaf = require('decafjs');\nconst coffee = `-> alert \"hello world\"`;\nconst js = decaf.compile(coffee);\nconsole.log(js);","lang":"javascript","description":"Shows basic usage of decaf to transpile a CoffeeScript function to ES6."},"warnings":[{"fix":"Check the test suite for supported features; manually review transpiled output.","message":"Decaf may not support all CoffeeScript syntax; unsupported features fall back to original CoffeeScript output.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider using an alternative like decaffeinate or manually rewriting code.","message":"The project is no longer actively maintained; last release was 2016.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Install using `npm install decafjs`.","message":"The npm package name is 'decafjs', not 'decaf' or 'shopify-decaf'.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use `require()` or set up a transpilation step.","message":"The package is CommonJS-only; ESM imports or TypeScript types are not available.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Refer to recast documentation for valid options.","message":"The 'compile' function's second argument is passed to recast; options may affect output formatting.","severity":"gotcha","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 decafjs` and import with `require('decafjs')`.","cause":"Package not installed; incorrect package name used.","error":"Module not found: Can't resolve 'decafjs'"},{"fix":"Use `const decaf = require('decafjs')` instead of `import decaf from 'decafjs'`.","cause":"Importing the default export incorrectly with ESM syntax.","error":"TypeError: decaf.compile is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}