CodeVetter · Repo Unpack · System map
istanbuljs/nyc
The npm package contains a reusable NYC class, a CLI coordinator, child bootstrap modules, and four command handlers. Instrumentation, coverage merging, source-map transformation, reporting, and process indexing use separate Istanbul libraries. Runtime boundaries follow parent and child processes, with configuration propagated through environment variables and coverage exchanged through files. Packaging and CI describe an npm CLI distribution with generated self-coverage used during development.
- package.json publishes NYC through index.js and the nyc executable through bin/nyc.js; its files allowlist contains index.js, bin JavaScript, and lib JavaScript.
- bin/nyc.js main() coordinates normal command execution, while report, check-coverage, instrument, and merge are registered as yargs command modules.
- NYC owns configuration, exclusions, extension transforms, cache state, SourceMaps, and ProcessInfo; it dynamically loads the selected instrumenter module.
- Child collection supports node-preload plus process-on-spawn environment propagation, or spawn-wrap with bin/wrap.js calling runMain().
- Coverage persistence uses UUID-named JSON files beneath the configured temporary directory and a processinfo subdirectory; ProcessDB writes an index and renders process trees.
- Instrumentation delegates to istanbul-lib-instrument, while coverage maps, source-map stores, report contexts, and report factories come from distinct Istanbul packages.
- The npm lifecycle runs Standard lint, cleanup, and self-instrumentation before TAP tests, then generates text and lcov self-coverage reports afterward.
- The engine range is Node 20 or >=22; CI specifies Ubuntu Node 20 and 24 plus Windows lts/*, and release-please runs on main only for istanbuljs/nyc.