Next generation JavaScript and TypeScript complexity reporting module powered by the Babel parser. Version 0.1.0 is current, but this project appears to be in an early/alpha state with active development. It computes cyclomatic complexity, Halstead metrics, maintainability index, and dependency analysis. Unlike older complexity tools (e.g., escomplex), this uses the full Babel parser with all plugins enabled, supporting modern JS and TS syntax out of the box. The library is designed as a modular shim; separate sub-packages handle AST processing independently. Note that breaking report format changes occurred in 0.1.0.
npm install typhonjs-escomplexVerified import paths — ran on the pinned version, not inferred.
Analyze a JavaScript file for complexity metrics including cyclomatic, Halstead, and maintainability index.
Review the 0.1.0 update guide at https://github.com/typhonjs-node-escomplex/typhonjs-escomplex/wiki/0.1.0-update-guide and adjust any consumers that parse the report structure.
If you need fine-grained control, use @babel/parser + typhonjs-escomplex-* modules directly.
Use fs.readFileSync to read the file content before passing it.
Use a bundler like webpack or rollup if you need to run in the browser.
Use `import escomplex from 'typhonjs-escomplex'` or `const escomplex = require('typhonjs-escomplex')`.Read the file content first: `const source = fs.readFileSync(filePath, 'utf8');` then pass `source`.
Run `npm install @babel/parser` (or yarn add) to install the peer dependency.