{"id":25009,"library":"bouk-decafjs","title":"Decaf JS","description":"Decaf JS is a CoffeeScript-to-ES.next transpiler that leverages the CoffeeScript compiler to build a syntax tree and then outputs modern JavaScript. The current stable version is 0.1.0, with infrequent releases. Its key differentiator is the ability to fall back to the CoffeeScript compiler output for unsupported syntax, aiming to cover the full CoffeeScript language. It can be used as a CLI tool or integrated as a code transform with tools like jscodeshift. It uses ast-types for building an esprima-compatible AST and recast for printing JavaScript.","status":"maintenance","version":"0.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/juliankrispel/decaf","tags":["javascript"],"install":[{"cmd":"npm install bouk-decafjs","lang":"bash","label":"npm"},{"cmd":"yarn add bouk-decafjs","lang":"bash","label":"yarn"},{"cmd":"pnpm add bouk-decafjs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used under the hood to parse CoffeeScript and build the syntax tree.","package":"coffeescript","optional":false},{"reason":"Used to print the JavaScript output with customizable options.","package":"recast","optional":false},{"reason":"Used to build an esprima-compatible abstract syntax tree.","package":"ast-types","optional":false}],"imports":[{"note":"ESM default import or CommonJS require both work; the package is not strict ESM.","wrong":"var decaf = require('decafjs')","symbol":"decaf","correct":"import decaf from 'decafjs'"},{"note":"The compile function is attached to the default export when using require or import.","symbol":"compile","correct":"decaf.compile(code, options)"},{"note":"CommonJS require works; the module exports a single function/object with compile method.","symbol":"default","correct":"const decaf = require('decafjs')"}],"quickstart":{"code":"const decaf = require('decafjs');\nconst coffee = 'square = (x) -> x * x';\nconst js = decaf.compile(coffee, { tabWidth: 2 });\nconsole.log(js);","lang":"javascript","description":"Shows how to compile a simple CoffeeScript arrow function to JavaScript using decaf with recast options."},"warnings":[{"fix":"Check the test suite for supported features; contribute or submit issues for unsupported syntax.","message":"Decaf may not support all CoffeeScript syntax and falls back to CoffeeScript compiler output for unsupported patterns, which may produce ES5 instead of ES6.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider alternatives like CoffeeScript's own --transpile flag with Babel for production use.","message":"The package has seen infrequent updates and may be considered in maintenance mode.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Use 'npm install decafjs -g' to install globally, or run via 'npx decafjs'.","message":"When using the CLI globally, ensure you have installed decaf globally; local installs may not expose the command.","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 -g decafjs' or use 'npx decafjs'.","cause":"Decaf is not installed globally or not in PATH.","error":"decaf: command not found"},{"fix":"Run 'npm install decafjs' in your project directory.","cause":"Package not installed in the current project.","error":"Cannot find module 'decafjs'"},{"fix":"Ensure you require/import the default export: const decaf = require('decafjs');","cause":"Incorrect import pattern or version mismatch.","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}