npm / es-module-lexer
es-module-lexer
What changed in es-module-lexer 2 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.
11 breaking2 security8 new APIs and options6 performance3 behavior and defaults1 tooling20 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inites-module-lexer 334 changes
Breaking changes 10
init is now a function, changing how developers use the API.
This entry point is the asm.js build; the unmaintained pure-JS port is removed.
New entry point with the v2-shaped API: parse returns only imports and exports, at is dropped, and re-exported imported names are reported in ln/ls/le.
export default interface Foo now reports Foo as its local name.
Reexports resolve to their originating import regardless of statement order; export * is represented as reexport-all and its import as reexport-star.
Full-build records now use tagged unions discriminated by type, with descriptive fields replacing the terse v2 names and numeric type tags.
ImportType is now a type-only union of named numeric literal aliases; no runtime enum is exported.
initSync is no longer exported; parse initializes on first use.
Node.js 18 or later is required.
Invalid escape sequences now throw a parse error instead of yielding undefined.
Security 2
Module strings decode without eval, improving one-import parse speed and allowing Wasm builds under --disallow-code-generation-from-strings.
Nesting past 1024 brackets or 512 dynamic imports now produces a parse error instead of memory corruption.
New APIs and options 6
A glob flag is added on dynamic imports.
A specifier is added on import.meta.
typeOnly is added on import.meta.
Dynamic import attributes are typed null; attributesStart locates the options argument.
Dynamic imports carry a best-effort probablyTypeOnly field in full builds.
Full builds lex TypeScript type-only imports, exports, aliases, interfaces, and ambient declarations; type-only edges carry typeOnly.
Performance 3
Reduces TypeScript lookahead work, improving lexer performance.
Parser wrapper overhead was reduced.
The full Wasm build uses SIMD scanning for long line comments and templates; the minimal build stays Wasm MVP.
Behavior and default changes 2
The minimal build enforces Wasm MVP and uses no post-MVP features.
parse initializes Wasm synchronously on first call; await init is only required on browser main threads, and all four entry points share the parse/init API.
Fixes and other changes 11
Preserves complete import attribute metadata in parser results.
Lexes
/after a postfix non-null assertion as division.Fixes handling of ASI and repeated non-null assertions in TypeScript export bindings.
Handles TypeScript generic commas in exported bindings.
Minimal build reexports report no local name.
Unannotated declare let/var no longer erases the following statement.
Shorthand declare module no longer erases the following statement.
A dynamic import with a single template-literal argument reports a glob specifier with each interpolation collapsed to *.
Typed export binding lists now collect every declarator.
export { type as } and type as as now follow TypeScript's specifier table.
U+00A0 is treated as whitespace around import/export names.
es-module-lexer 217 changes
Breaking changes 1
Import assertions have been removed.
New APIs and options 2
A minimal build variant is available for es-module-shims.
The export statement start position is exposed as ss.
Performance 3
The lexer skips identifier and number runs, improving lexer performance.
The lexer gates keywordStart on the next byte for i/c tokens.
Node uses a fast native UTF-16 source copy into Wasm memory.
Behavior and default changes 1
Parsing now supports import attribute items.
Tooling 1
Adds side-effects metadata to package.json, which can inform bundler behavior.
Fixes and other changes 9
The asm.js integer return type annotation is fixed.
The sourcename is now forwarded through the pre-init parse path.
WebAssembly memory can grow for sources over ~4MB, including in the minimal build.
A method named import with two or more arguments is no longer treated as a dynamic import.
Export var, let, and const declarations now detect every binding.
The n field is now reported for dynamic imports using no-substitution template literals.
Dynamic import attributes are always excluded from the specifier range.
Handles new
ofconflict cases.A global reference issue has been fixed.