Back to Explore

guybedford/es-module-lexer

GitHub
2 updates · last 90 days1 watchersOpen source

Last release:

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, with the most recent upstream push on 2026-07-02 and recent tagged updates (2.2.0 on 2026-06-29, 2.1.0 on 2026-04-25).
  • Apparent update cadence is moderately frequent in 2026 (about 2 months between 2.1.0 and 2.2.0), suggesting an ongoing evolution rather than maintenance-only.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • 2.2.0

    Release 2.2.0 adds the new `ss` export-specifier field, representing the start position of the export statement. It also improves dynamic import handling for no-substitution template literals, fixes misclassification of methods named `import`, and improves coverage for exported bindings in `export var/let/const` declarations.

    Features
  • 2.1.0

    Release 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.

    Breaking
  • 2.0.0

    Release 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`.

    BreakingFeatures
  • 1.7.0

    Release 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.

    Features
  • 1.6.0

    Release 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.

    Features
  • 1.5.4

    Release 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

    Release 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

    Release 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

    Release 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

    Version 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.

    Features
  • 1.4.2

    Release 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.