node-compiler
raw JSON → 0.1.2 verified Fri May 01 auth: no javascript
A web compile tool (v0.1.2) for building pipelines of compilation tasks. It provides a plugin-based architecture where processing steps (e.g., transpilation, minification) are chained in a pipeline. Unlike monolithic build tools, it focuses solely on orchestrating compilers. Released as a minimal Node.js package with no stable release cadence; current version is pre-1.0. It differentiates by being lightweight and extensible via custom plugins.
Common errors
error TypeError: compiler.use is not a function ↓
cause Using default import incorrectly (CommonJS require instead of default import).
fix
Use import Compiler from 'compiler' or const Compiler = require('compiler').default;
error Error: Plugin must be a function ↓
cause Passing non-function to .use().
fix
Ensure each argument to .use() is a function that takes input and returns output.
Warnings
gotcha Plugin order matters; plugins are executed in the order they are added. ↓
fix Ensure .use() calls are in the desired sequence.
breaking In v0.1.0, the plugin signature changed from (input, next) to (input) only, breaking existing custom plugins. ↓
fix Update plugins to accept only input and return transformed string.
Install
npm install compiler yarn add compiler pnpm add compiler Imports
- Compiler wrong
const Compiler = require('compiler')correctimport Compiler from 'compiler' - createCompiler wrong
import createCompiler from 'compiler'correctimport { createCompiler } from 'compiler' - Plugin wrong
import { Plugin } from 'compiler'correctimport type { Plugin } from 'compiler'
Quickstart
import Compiler from 'compiler';
const compiler = new Compiler();
compiler.use(input => input.toUpperCase());
compiler.use(input => input + '!');
const result = compiler.run('hello');
console.log(result); // 'HELLO!'