Registry / devops / am-compiler

am-compiler

JSON →
library1.0.31jsnpmunverified

am-compiler is a CoffeeScript-based build tool that compiles multiple targets (electron, node, browser) from CoffeeScript source files. As of version 1.0.31, it appears to be a niche package with minimal documentation and no recent updates. It relies on fs-extra for reading JSON and child_process for executing commands. Key differentiators include a custom class extending a base compiler and targeted entry points for electron, node, and browser builds. However, it lacks comprehensive documentation and may be considered experimental or specific to certain workflows.

npm install am-compiler
INSTALL
IMPORT
SIG · AM-COMPILER
A
am-compiler
devopsjavascriptv1.0.31
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.

Compiler
const Compiler = require('am-compiler')
import Compiler from 'am-compiler'
This package is CommonJS only; ESM import will fail.
AmCompiler
const AmCompiler = require('am-compiler')
import { AmCompiler } from 'am-compiler'
Named import not supported; use default require.
Class extension
class MyCompiler extends Compiler { ... }
class MyCompiler extends require('am-compiler').Compiler { ... }
Direct extension of the required module works; .Compiler is unnecessary.

Shows how to extend the Compiler class, set entry points for electron, node, and browser, and override callback.

const fse = require('fs-extra'); const Compiler = require('am-compiler'); class AmCompiler extends Compiler { constructor() { super(); this.checkNum = 0; } electronStart() { const cmd = fse.readJsonSync('package.json').scripts.electron; require('child_process').exec(cmd); } callback(err, stats) { super.callback(err, stats); if (err) { console.log(err); return; } this.checkNum++; if (this.checkNum === 3) { this.electronStart(); } } start() { this.electronOption.entry = { 'electron/.build/start': './electron/test/start.coffee', 'app/.build/preload': './app/test/preload.coffee', 'app/.build/electron': './app/test/electron.coffee' }; this.nodeOption.entry = { 'app/.build/server': './app/test/server.coffee' }; this.browserOption.entry = { 'web/.build/client': './web/test/client.coffee' }; super.start(); } } const compiler = new AmCompiler(); compiler.start();
Debug
Known issues
gotchaThe start method must be called after instantiation; it is not automatically called.
fix
Create an instance and call .start() explicitly.
affects: *
gotchacallback expects super.callback(err, stats) to be called; failing to do so may break chain.
fix
Always call super.callback(err, stats) in overridden callback.
affects: *
breakingIn versions prior to 1.0.25, the class name was AmCompilerExport and the module exported differently.
fix
Use const Compiler = require('am-compiler') for all versions >=1.0.25.
affects: <1.0.25
deprecatedThe package is no longer actively maintained and may break with newer Node.js versions.
fix
Consider migrating to a more modern build tool like Webpack or Rollup.
affects: *
Errors
Common errors & fixes
TypeError: Compiler is not a constructor
Importing the module incorrectly or using an older version where export was different.
fix
Ensure you are using version >=1.0.25 and use const Compiler = require('am-compiler').
Cannot find module 'am-compiler'
Package not installed or not in node_modules.
fix
Run npm install am-compiler --save
fse.readJsonSync is not a function
fs-extra not installed or not required.
fix
Install fs-extra: npm install fs-extra --save and require it: const fse = require('fs-extra');
Upgrade
Version history
1.0.31latest on npm
Audit
Dependencies
fs-extrarequiredUsed for reading package.json via fse.readJsonSync
Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources
am-compiler — npm install am-compiler · libregistry