Skip to main content

Module scripts

Module scripts 

Source
Expand description

Lightweight shell command parser for package.json scripts.

Extracts:

  • Binary names → mapped to npm package names for dependency usage detection
  • --config arguments → file paths for entry point discovery
  • Positional file arguments → file paths for entry point discovery

Handles env var prefixes (cross-env, dotenv, KEY=value), package manager runners (npx, pnpm exec, yarn dlx), and Node.js runners (node, tsx, ts-node). Shell operators (&&, ||, ;, |, &) are split correctly.

Structs§

ScriptAnalysis
Result of analyzing all package.json scripts.
ScriptCommand
A parsed command segment from a script value.

Functions§

analyze_scripts
Analyze all scripts from a package.json scripts field.
filter_production_scripts
Filter scripts to only production-relevant ones (start, build, and their pre/post hooks).
parse_script
Parse a single script value into one or more commands.
resolve_binary_to_package
Resolve a binary name to its npm package name.