Back to Explore

nodejs/cjs-module-lexer

GitHub
1 updates · last 90 days1 watchersOpen source

Last release:

A fast JavaScript lexer that analyzes CommonJS module source code to detect the most likely named exports (for example, assignments like `exports.name = ...` and `Object.defineProperty(exports, 'name', ...)`) and possible reexports via `module.exports = require(...)`. It is used in Node.js core to infer named exports when importing CommonJS into ESM, and it focuses on comprehensive CommonJS syntax handling while staying small and fast.

Project status

  • Actively maintained, the upstream repo has recent updates (last push on 2026-08-13, with an immediate subsequent update 2.2.1 on 2026-08-13), indicating ongoing maintenance rather than dormancy.
  • Update cadence looks fairly regular, with updates on 2026-08-13, 2026-01-02, 2025-11-07, and 2025-02-20, suggesting an evolving project with a few-month rhythm at least through the last year.

AI summary generated

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

Recent updates

  • 2.2.1

    Release 2.2.1 is primarily a packaging fix related to missing type definitions. The release notes state that lexer.d.mts was not being published, and the package manifest/outputs were adjusted accordingly.

  • 2.2.0

    Release 2.2.0 replaces the lexer’s use of indirect eval for decoding string literals with a custom string-literal scanner that parses escapes without executing code. The release notes only mention the removal of eval and the switch to internal parsing, but the diff shows additional behavior, testing, and tooling changes around string decoding.

    Security
  • 2.1.1

    Version 2.1.1 contains two targeted lexer fixes related to parsing of `__exportStar` patterns. The code changes focus on correcting an off-by-one style cursor advancement around the `r` character, and on ensuring a local variable is declared properly during parsing.

  • 2.1.0

    Release 2.1.0 primarily updates developer/maintainer documentation by adding a section on how to create and publish a GitHub release. The actual diff also refactors the WASM build command in build/Makefile and bumps the package version, but does not show any application/source changes related to the release notes mention of restoring configuration via environment variables.

    Features
  • 2.0.0

    Release 2.0.0 is documented as including CI workflow updates (Ubuntu 22) and enabling/altering the WASM build via a shared wasm-builder. However, the provided code diff only shows version number bumps in package.json and package-lock.json, with no other implementation changes visible.

  • 1.4.2

    Release 1.4.2 updates the project build pipeline. It adds a shared WebAssembly build step and changes the GitHub Actions runner to Ubuntu 22, which primarily affects maintainers and release artifact generation rather than documented runtime APIs.

    Features