</>PackageGraphPackageGraph

cjs-module-lexer

npmv2.2.1TypeScript

Lexes CommonJS modules, returning their named exports metadata

Safe to adopt

Yes — cjs-module-lexer scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 27 days ago. 7 releases in the last 2 years.

  • ?Adoption: grade ?, Not reported by this registry.

    No download data reported for this package yet.

  • AMaintenance: grade A, Excellent.

    Last published 27 days ago. 7 releases in the last 2 years.

  • AWeight: grade A, Excellent.

    Zero runtime dependencies, about 137 KB installed.

  • ASupply chain: grade A, Excellent.

    No install scripts, 3 maintainers, and a contained dependency surface.

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding cjs-module-lexer to a project.

0
Direct dependencies

Runtime packages this one declares itself.

0
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

137 KB
Install size

Unpacked size of this package plus its entire runtime tree.

Tree depth

Longest resolved dependency chain below this package.

Compatibility

Node.js
No constraint declared
Module format
CommonJS only
TypeScript
Types included
Install scripts
None

Quick start

A usage example from the cjs-module-lexer README.

const { parse } = require('cjs-module-lexer');

// `init` return a promise for parity with the ESM API, but you do not have to call it

const { exports, reexports } = parse(`
  // named exports detection
  module.exports.a = 'a';
  (function () {
    exports.b = 'b';
  })();
  Object.defineProperty(exports, 'c', { value: 'c' });
  /* exports.d = 'not detected'; */

  // reexports detection
Example truncated — see the full README.

Dependencies

Declared by cjs-module-lexer v2.2.1. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (7)

@babel/cli ^7.5.5@babel/core ^7.5.5@babel/plugin-transform-modules-commonjs ^7.5.0cross-env ^7.0.3kleur ^2.0.2mocha ^11.8.0terser ^4.1.4

Used by

Popular packages that depend on cjs-module-lexer.

Relationship graph

Dependencies (left) and dependents (right) of cjs-module-lexer.

@vitest/mockerjest-runtimecjs-module-lexer
cjs-module-lexer dependencies dependents

Frequently installed together

Release history

7 releases in the last two years, typically about 29 days apart.

Recent versions of cjs-module-lexer
VersionPublishedSizeLicense
2.2.1latest27 days ago137 KBMIT
2.2.08 months ago137 KBMIT
2.1.110 months ago131 KBMIT
2.1.01 year ago131 KBMIT
2.0.01 year ago130 KBMIT
1.4.31 year ago134 KBMIT
1.4.21 year ago130 KBMIT
1.4.12 years ago142 KBMIT
1.4.02 years ago142 KBMIT
1.3.12 years ago136 KBMIT
1.3.02 years ago136 KBMIT
1.2.33 years ago136 KBMIT
1.2.25 years ago135 KBMIT
1.2.15 years ago135 KBMIT
1.2.05 years ago134 KBMIT

Overview

cjs-module-lexer is an npm package that lexes CommonJS modules, returning their named exports metadata. It has 2 known dependents in the graph. The latest version is 2.2.1, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need lexes CommonJS modules, returning their named exports metadata and value a focused solution.

When not to use it

Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.

Pros

  • Ships TypeScript type definitions.
  • Clear open-source license (MIT).

Cons

  • No significant drawbacks detected from available metadata.

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Frequently asked questions

Should I use cjs-module-lexer?

Yes — cjs-module-lexer scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 27 days ago. 7 releases in the last 2 years.

How do I install cjs-module-lexer?

Run `npm install cjs-module-lexer` to add cjs-module-lexer to your npm project.

What license is cjs-module-lexer released under?

cjs-module-lexer is distributed under the MIT license.

How popular is cjs-module-lexer?

npm does not publish download counts. Within PackageGraph's crawl, 2 known packages depend on cjs-module-lexer.

Is cjs-module-lexer still maintained?

The most recent release of cjs-module-lexer (v2.2.1) was published 27 days ago.

Does cjs-module-lexer run install scripts?

No. cjs-module-lexer does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.