esprima
npmv4.0.1ECMAScript parsing infrastructure for multipurpose analysis
Not recommended for new projects
No — esprima should not be adopted for new projects. Last published 2980 days ago.
- AAdoption: grade A, Excellent.
77.6M downloads per week and 5 known dependents.
- FMaintenance: grade F, Failing.
Last published 2980 days ago.
- AWeight: grade A, Excellent.
Zero runtime dependencies, about 307 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
BSD-2-Clause — 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 esprima 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
- node >=4
- Module format
- CommonJS only
- TypeScript
- No bundled types
- Install scripts
- None
Quick start
A usage example from the esprima README.
> var esprima = require('esprima');
> var program = 'const answer = 42';
> esprima.tokenize(program);
[ { type: 'Keyword', value: 'const' },
{ type: 'Identifier', value: 'answer' },
{ type: 'Punctuator', value: '=' },
{ type: 'Numeric', value: '42' } ]
> esprima.parseScript(program);
{ type: 'Program',
body:
[ { type: 'VariableDeclaration',
declarations: [Object],esprima vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| esprimathis page | 77.6M | 5 | BSD-2-Clause | 8 years ago |
| espree | 0 | 4 | BSD-2-Clause | 1 day ago |
| eslint | 138.4M | 279 | MIT | 1 day ago |
| esquery | 0 | 1 | BSD-3-Clause | 1 day ago |
| @babel/parser | 0 | 23 | MIT | 1 day ago |
| @webassemblyjs/wasm-parser | 0 | 5 | MIT | 1 day ago |
Dependencies
Declared by esprima v4.0.1. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (26)
Used by
Popular packages that depend on esprima.
An AST-based pattern checker for JavaScript.
Compiles sync functions into async generator functions
A query library for ECMAScript AST using a CSS selector like query language.
ECMAScript AST recursive visitor
ECMAScript code generator
Relationship graph
Dependencies (left) and dependents (right) of esprima.
Frequently installed together
Runtime typescript and ESM support for Node.js
BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
An AST-based pattern checker for JavaScript.
The semantic version parser used by npm.
TypeScript definitions for node
utility box for ECMAScript language tools
option parsing and help generation
Constants and utilities about visitor keys to traverse AST.
Escape RegExp special characters
TypeScript definitions for estree
Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet
A lightweight cache for file metadata, ideal for processes that work on a specific set of files and only need to reprocess files that have changed since the last run
Release history
No releases in the last two years, typically about 31 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 4.0.1latest | 8 years ago | 307 KB | BSD-2-Clause |
| 4.0.0 | 9 years ago | — | BSD-2-Clause |
| 3.1.3 | 9 years ago | — | BSD-2-Clause |
| 3.1.2 | 9 years ago | — | BSD-2-Clause |
| 3.1.1 | 10 years ago | — | BSD-2-Clause |
| 3.1.0 | 10 years ago | — | BSD-2-Clause |
| 3.0.0 | 10 years ago | — | BSD-2-Clause |
| 2.7.3 | 10 years ago | — | BSD-2-Clause |
| 2.7.2 | 10 years ago | — | BSD-2-Clause |
| 2.7.1 | 10 years ago | — | BSD-2-Clause |
| 2.7.0 | 11 years ago | — | BSD-2-Clause |
| 2.6.0 | 11 years ago | — | BSD-2-Clause |
| 2.5.0 | 11 years ago | — | BSD-2-Clause |
| 2.4.1 | 11 years ago | — | BSD-2-Clause |
| 2.4.0 | 11 years ago | — | BSD-2-Clause |
Overview
esprima is an npm package that eCMAScript parsing infrastructure for multipurpose analysis. It is extremely widely used, with about 77.6M downloads per week and 5 known dependents in the graph. The latest version is 4.0.1, released under the BSD-2-Clause license.
Who should use it
Teams working in the npm ecosystem who need eCMAScript parsing infrastructure for multipurpose analysis and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to minimize your dependency tree, have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (77.6M weekly downloads).
- Clear open-source license (BSD-2-Clause).
Cons
- Large dependency tree (26 direct dependencies) increases install size and audit surface.
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use esprima?
No — esprima should not be adopted for new projects. Last published 2980 days ago.
How do I install esprima?
Run `npm install esprima` to add esprima to your npm project.
What license is esprima released under?
esprima is distributed under the BSD-2-Clause license.
How popular is esprima?
esprima has approximately 77,553,420 downloads per week and 5 known dependent packages.
Is esprima still maintained?
The most recent release of esprima (v4.0.1) was published 8 years ago.
Does esprima run install scripts?
No. esprima does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.