shift-parser is an ECMAScript parser that generates an Abstract Syntax Tree (AST) conforming to the Shift format. Currently at version 8.0.0, the library provides distinct functions for parsing ECMAScript scripts and modules, offering capabilities for static analysis and code transformation. Although its README suggests support for ECMA-262, version 6 (ES2015), the underlying Shift AST Specification, which `shift-parser` implements, states support for ECMAScript 2019. This indicates the parser likely handles features up to ES2019. The package is generally stable, with major versions released periodically rather than on a strict cadence. A key differentiator is its adherence to the machine-readable Shift AST format, which promotes consistency across various JavaScript tooling. It also offers an extended interface for capturing detailed location and comment information using `WeakMap`.
No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This is the default export for generic parsing, which infers script or module mode. Since v8, ESM imports are preferred.
Explicitly parse code as a script or a module. For modern Node.js and browser environments, ESM `import` is standard.
These functions return the AST along with a `WeakMap` of location data for each node and an array of comments. Preferred for tooling requiring source mapping.
Demonstrates parsing an ECMAScript module, accessing the AST, retrieving location data for nodes, and extracting comments.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.
No traffic data recorded yet.