Registry / serialization / nodent-compiler

nodent-compiler

JSON →
library3.2.13jsnpmunverified

nodent-compiler is a core compiler for transforming ES7 async/await syntax into ES5-compatible code. Version 3.2.13 is the latest stable release, with a slow release cadence. It supports multiple compilation modes including ES7, Promises, generators, and engine, with options for sourcemaps, lazy thenables, and ES6 target. Compared to Babel or TypeScript, nodent specifically targets Node.js environments and offers fine-grained control over async transformation without additional syntax extensions. It requires nodent-runtime for certain modes and Promises availability.

npm install nodent-compiler
INSTALL
IMPORT
SIG · NODENT-COMPILER
N
nodent-compiler
serializationjavascriptv3.2.13
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.

NodentCompiler
const NodentCompiler = require('nodent-compiler'); const compiler = new NodentCompiler();
import NodentCompiler from 'nodent-compiler';
nodent-compiler is CommonJS only; no ESM export exists. Use require().
NodentCompiler constructor
new NodentCompiler()
NodentCompiler()
NodentCompiler must be instantiated with new; calling without new will cause errors.
compiler.compile
compiler.compile(sourceCode, filename, options)
compiler.compile({sourceCode, filename, options})
compile expects three separate arguments: sourceCode (string), filename (string or null), and options (object).

Demonstrates instantiation of NodentCompiler and compilation of a simple async/await function to ES5 using promises mode without runtime.

const NodentCompiler = require('nodent-compiler'); const compiler = new NodentCompiler(); const sourceCode = `async function fetchData() { return await Promise.resolve(42); }`; const result = compiler.compile(sourceCode, 'test.js', { promises: true, noRuntime: true, sourcemap: false }); console.log(result.code);
nodent-compiler --version
Debug
Known issues
breakingVersion 3.0.0 changed the compile method signature: second argument is now filename, not options.
fix
Update calls from compiler.compile(sourceCode, options) to compiler.compile(sourceCode, filename, options).
affects: >=3.0.0
gotchanodent-compiler does not have TypeScript type definitions; using with TypeScript requires custom .d.ts or any.
fix
Declare module or use require: const NodentCompiler = require('nodent-compiler');
affects: >=0.0.0
gotchaWhen using es7 or generators mode, nodent-runtime must be installed and accessible at runtime.
fix
Run npm install nodent-runtime or set promises:true and noRuntime:true to avoid runtime dependency.
affects: >=0.0.0
deprecatedThe 'es7' mode is deprecated in favor of 'promises' mode.
fix
Use promises: true instead of es7: true.
affects: >=3.0.0
gotchaThe compiler does not support const/let or arrow functions unless es6target: true is set.
fix
Enable es6target: true to allow ES6 syntax in source code.
affects: <3.1.0
Errors
Common errors & fixes
Cannot find module 'nodent-runtime'
Compiled code requires nodent-runtime at runtime when using es7 or generators mode without noRuntime.
fix
Install nodent-runtime: npm install nodent-runtime, or set options promises:true and noRuntime:true to avoid the dependency.
TypeError: NodentCompiler is not a constructor
NodentCompiler was imported incorrectly (e.g., using default import in ESM) or called without new.
fix
Use const NodentCompiler = require('nodent-compiler'); then new NodentCompiler();
Cannot read property 'code' of undefined
compiler.compile() was called with wrong number of arguments or missing required options.
fix
Ensure call signature is compiler.compile(sourceCode, filename, options) where filename can be null but must be present.
Unexpected token: keyword «await»
Source code contains await outside async function or without proper options enabled.
fix
Ensure the function is declared async and that the compiler options include promises: true or appropriate mode.
Upgrade
Version history
3.2.13latest on npm
Audit
Dependencies
nodent-runtimeoptionalRequired at runtime if compiling in es7 or generators mode, or if noRuntime is false.
Agent activity
2 hits · last 30 days
node
2
Resources
nodent-compiler — npm install nodent-compiler · libregistry