guybedford/es-module-lexer
Last release: 1 month ago
ES Module Lexer is a small, fast JavaScript lexer for parsing ES module syntax, designed for quick analysis. It outputs lists of imports (including import specifier locations, dynamic imports, import meta, and import attributes) and exports, and it supports newer module features like import attributes and source phase imports. It is useful in tooling that needs fast ES module parsing, such as es-module-shims.
Project status
- Actively maintained: The upstream repo shows recent activity (latest push on 2026-04-25) and a new version update (2.1.0) was published on the same day, indicating ongoing maintenance.
- Update cadence: Updates appear to be released on a roughly multi-month schedule (for example, 1.7.0 on 2025-04-22, 2.0.0 on 2025-12-07, and 2.1.0 on 2026-04-25), suggesting an evolving but not rapid cadence.
AI summary generated Today
Recent updates
2.1.0
1 month agoRelease 2.1.0 updates the lexer’s parsing logic, focusing on dynamic import attribute range handling and disambiguating new “for (...) of /regex/” conflict cases. The changes primarily affect how the parser computes ranges (start/end indices) for dynamic imports and how it decides whether a slash starts a regex in for-of contexts.
Breaking2.0.0
6 months agoRelease 2.0.0 introduces parsing of import attributes in the new `with { ... }` form, including parsing each attribute key/value item. It also removes support for legacy import assertions (`assert { ... }`). A small fix updates the asm.js/WASM global reference to prefer `globalThis`.
BreakingFeatures1.7.0
4/22/2025Release 1.7.0 adds lexer support for the new `import defer` syntax, including both static (keyword form) and dynamic (function form) variants. The core change is in the import-statement parsing logic, plus additions to the `ImportType` enum to represent the new “defer phase” import types.
Features1.6.0
4/22/2025Release 1.6.0 adds a new synchronous initialization API, initSync, alongside existing async initialization. It also updates package exports/type exposure for the asm.js build and adjusts README documentation to point to the new type location.
Features1.5.4
6/24/2024Release 1.5.4 contains a targeted lexer fix to ensure the 'of' keyword is treated as context-sensitive only in the proper 'for (...)' construct. The code change adjusts how the lexer verifies the preceding keyword around parenthesis parsing, and it updates the generated asm lexer artifacts and adds a regression test.
1.5.3
5/17/2024Release 1.5.3 contains a fix for handling the `of` keyword. The change is implemented in the lexer core and is accompanied by an added unit test covering the problematic `of` cases.
1.5.2
4/27/2024Release 1.5.2 contains a targeted fix related to how the lexer classifies import types. The only documented change is a correction to the import type definitions, and the code diff shows this affects the `import_ty` value stored in the native lexer and surfaced to callers.
1.5.1
4/27/2024Release 1.5.1 updates es-module-lexer to fix a specific parsing issue involving the token "of" when it appears with a regex literal. In practice, the lexer keyword-detection logic was adjusted and the generated asm.js/emcc builds were regenerated accordingly.
1.5.0
3/25/2024Version 1.5.0 extends es-module-lexer to recognize source phase imports (for example, `import source ... from '...'` and `import.source('...')`) and return their positions as part of the import metadata. The implementation also introduces a new import classification field, `t`, that categorizes imports beyond the previous static vs dynamic distinction.
Features1.4.2
3/19/2024Release 1.4.2 makes a targeted lexer fix so that `export default /.../` is correctly interpreted as a regular expression default export rather than being misclassified as division. The change is implemented in both the C source lexer and the generated JS/WASM/ASM outputs, with a new unit test covering several `export default /regex/` comment and newline edge cases.