Coffee-Compiler
raw JSON → 0.3.2 verified Fri May 01 auth: no javascript abandoned
A lightweight wrapper for the CoffeeScript compiler providing a unified API (fromSource/fromFile) across compiler libraries. Current version 0.3.2. The package has not been updated since 2014 and relies on an outdated peer dependency coffee-script >=1.6.2. It offers simple callback-based compilation with source maps and bare mode options.
Common errors
error Error: Cannot find module 'coffee-script' ↓
cause Missing peer dependency coffee-script.
fix
Run 'npm install coffee-script' in your project.
error TypeError: coffee.fromSource is not a function ↓
cause Using incorrect import pattern (e.g., destructuring or ES import).
fix
Use 'var coffee = require('coffee-compiler');' then call coffee.fromSource().
error Error: require() of ES Module not supported ↓
cause Attempting to require coffee-compiler from an ES module environment.
fix
Use dynamic import() or switch to an ESM-compatible compiler.
Warnings
gotcha Package has been abandoned since 2014; no updates for CoffeeScript 2.x or modern Node.js versions. ↓
fix Use coffee-script directly or switch to an actively maintained compiler like decaffeinate or coffeescript@next.
gotcha Peer dependency coffee-script must be installed separately; npm@3+ does not auto-install peers. ↓
fix Run 'npm install coffee-script' alongside coffee-compiler.
deprecated Callback-based API; no promise/async support. Promises are not available. ↓
fix Promisify manually or use coffee-script's own compile method.
gotcha Options object may be mutated; not documented but internal behavior could cause side effects. ↓
fix Clone options before passing: coffee.fromSource(src, Object.assign({}, opts), cb);
Install
npm install coffee-compiler yarn add coffee-compiler pnpm add coffee-compiler Imports
- default wrong
import coffee from 'coffee-compiler';correctvar coffee = require('coffee-compiler'); - fromSource wrong
const { fromSource } = require('coffee-compiler');correctvar coffee = require('coffee-compiler'); coffee.fromSource('...', opts, cb); - fromFile wrong
import { fromFile } from 'coffee-compiler';correctvar coffee = require('coffee-compiler'); coffee.fromFile('./file.coffee', opts, cb);
Quickstart
var coffee = require('coffee-compiler');
coffee.fromSource('console.log "hello world!"', { sourceMap: true, bare: true }, function(err, js) {
if (err) throw err;
console.log(js);
});