nodent-transform

raw JSON →
3.2.9 verified Fri May 01 auth: no javascript maintenance

AST transform and basic tools for nodent and nodent-compiler. Version 3.2.9 is the current stable release. This package provides core parsing and transformation utilities used internally by nodent to convert async/await to generator-based code for older JavaScript environments. It handles AST traversal, node manipulation, and source map generation. Unlike Babel's async-to-generator plugin, nodent-transform is designed specifically as a building block for the nodent ecosystem and is not intended for direct use by most developers. Release cadence is low, with the last release in 2019.

error Cannot find module 'nodent-transform'
cause Package not installed or deprecated name
fix
npm install nodent-transform@3.2.9
error export 'default' (imported as 'nodent') was not found in 'nodent-transform'
cause Default export removed in v3
fix
Use named imports: import { transform, parse, generate } from 'nodent-transform'
error SyntaxError: Unexpected token: punc ())
cause Incompatible acorn version or malformed input
fix
Ensure acorn version is >=5.x and code is valid JavaScript
deprecated nodent-transform is deprecated; use @nodent/transform instead
fix Migrate to @nodent/transform package
gotcha ESM-only package; does not support require() in older Node versions
fix Use Node >=12 or enable --experimental-modules; for CJS, use dynamic import()
breaking Removed legacy default export in v3; only named exports available
fix Switch from default import to named imports
npm install nodent-transform
yarn add nodent-transform
pnpm add nodent-transform

Parses async/await code, applies nodent transform, and generates output.

import { transform, parse, generate } from 'nodent-transform';
const code = `async function foo() { await bar(); }`;
const ast = parse(code);
const transformedAst = transform(ast, {});
const output = generate(transformedAst).code;
console.log(output);