{"id":26008,"library":"nodent-compiler","title":"nodent-compiler","description":"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.","status":"maintenance","version":"3.2.13","language":"javascript","source_language":"en","source_url":"https://github.com/MatAtBread/nodent-compiler","tags":["javascript","Javascript","ES7","async","await","language","extensions","Node","callback"],"install":[{"cmd":"npm install nodent-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add nodent-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add nodent-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required at runtime if compiling in es7 or generators mode, or if noRuntime is false.","package":"nodent-runtime","optional":true}],"imports":[{"note":"nodent-compiler is CommonJS only; no ESM export exists. Use require().","wrong":"import NodentCompiler from 'nodent-compiler';","symbol":"NodentCompiler","correct":"const NodentCompiler = require('nodent-compiler');\nconst compiler = new NodentCompiler();"},{"note":"NodentCompiler must be instantiated with new; calling without new will cause errors.","wrong":"NodentCompiler()","symbol":"NodentCompiler constructor","correct":"new NodentCompiler()"},{"note":"compile expects three separate arguments: sourceCode (string), filename (string or null), and options (object).","wrong":"compiler.compile({sourceCode, filename, options})","symbol":"compiler.compile","correct":"compiler.compile(sourceCode, filename, options)"}],"quickstart":{"code":"const NodentCompiler = require('nodent-compiler');\nconst compiler = new NodentCompiler();\nconst sourceCode = `async function fetchData() { return await Promise.resolve(42); }`;\nconst result = compiler.compile(sourceCode, 'test.js', { promises: true, noRuntime: true, sourcemap: false });\nconsole.log(result.code);","lang":"javascript","description":"Demonstrates instantiation of NodentCompiler and compilation of a simple async/await function to ES5 using promises mode without runtime."},"warnings":[{"fix":"Update calls from compiler.compile(sourceCode, options) to compiler.compile(sourceCode, filename, options).","message":"Version 3.0.0 changed the compile method signature: second argument is now filename, not options.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Declare module or use require: const NodentCompiler = require('nodent-compiler');","message":"nodent-compiler does not have TypeScript type definitions; using with TypeScript requires custom .d.ts or any.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Run npm install nodent-runtime or set promises:true and noRuntime:true to avoid runtime dependency.","message":"When using es7 or generators mode, nodent-runtime must be installed and accessible at runtime.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use promises: true instead of es7: true.","message":"The 'es7' mode is deprecated in favor of 'promises' mode.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Enable es6target: true to allow ES6 syntax in source code.","message":"The compiler does not support const/let or arrow functions unless es6target: true is set.","severity":"gotcha","affected_versions":"<3.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install nodent-runtime: npm install nodent-runtime, or set options promises:true and noRuntime:true to avoid the dependency.","cause":"Compiled code requires nodent-runtime at runtime when using es7 or generators mode without noRuntime.","error":"Cannot find module 'nodent-runtime'"},{"fix":"Use const NodentCompiler = require('nodent-compiler'); then new NodentCompiler();","cause":"NodentCompiler was imported incorrectly (e.g., using default import in ESM) or called without new.","error":"TypeError: NodentCompiler is not a constructor"},{"fix":"Ensure call signature is compiler.compile(sourceCode, filename, options) where filename can be null but must be present.","cause":"compiler.compile() was called with wrong number of arguments or missing required options.","error":"Cannot read property 'code' of undefined"},{"fix":"Ensure the function is declared async and that the compiler options include promises: true or appropriate mode.","cause":"Source code contains await outside async function or without proper options enabled.","error":"Unexpected token: keyword «await»"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}