cjs-module-lexer
npmv2.2.1TypeScriptLexes 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.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
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 detectionDependencies
Declared by cjs-module-lexer v2.2.1. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (7)
Used by
Popular packages that depend on cjs-module-lexer.
Relationship graph
Dependencies (left) and dependents (right) of cjs-module-lexer.
Frequently installed together
Native-ESM powered web dev build tool
Seamless REST/GraphQL API mocking library for browser and Node.js.
Lexes ES modules returning their import/export metadata
Lightweight Jest compatible spy implementation
TypeScript definitions for estree
This packages is a collection of utilities and helper functions
No description provided.
ECMAScript (ESTree) AST walker
This package contains shared types of Jest's packages.
A drop-in replacement for fs, making various improvements.
Modify strings, generate sourcemaps
TypeScript definitions for node
Release history
7 releases in the last two years, typically about 29 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 2.2.1latest | 27 days ago | 137 KB | MIT |
| 2.2.0 | 8 months ago | 137 KB | MIT |
| 2.1.1 | 10 months ago | 131 KB | MIT |
| 2.1.0 | 1 year ago | 131 KB | MIT |
| 2.0.0 | 1 year ago | 130 KB | MIT |
| 1.4.3 | 1 year ago | 134 KB | MIT |
| 1.4.2 | 1 year ago | 130 KB | MIT |
| 1.4.1 | 2 years ago | 142 KB | MIT |
| 1.4.0 | 2 years ago | 142 KB | MIT |
| 1.3.1 | 2 years ago | 136 KB | MIT |
| 1.3.0 | 2 years ago | 136 KB | MIT |
| 1.2.3 | 3 years ago | 136 KB | MIT |
| 1.2.2 | 5 years ago | 135 KB | MIT |
| 1.2.1 | 5 years ago | 135 KB | MIT |
| 1.2.0 | 5 years ago | 134 KB | MIT |
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.