Skip to main content

Module npm_crawler

Module npm_crawler 

Source

Structs§

NpmCrawler
NPM ecosystem crawler for discovering packages in node_modules.

Functions§

build_npm_purl
Build a PURL string for an npm package.
get_bun_global_prefix
Get the bun global node_modules path via bun pm bin -g.
get_bun_global_prefix_with
Version of get_bun_global_prefix that accepts an injected CommandRunner. See get_npm_global_prefix_with.
get_npm_global_prefix
Get the npm global node_modules path via npm root -g.
get_npm_global_prefix_with
Version of get_npm_global_prefix that accepts an injected CommandRunner. Tests use this with a MockCommandRunner to exercise the success arm (binary present, stdout parsed) without requiring npm on the host’s PATH.
get_pnpm_global_prefix
Get the pnpm global node_modules path via pnpm root -g.
get_pnpm_global_prefix_with
Version of get_pnpm_global_prefix that accepts an injected CommandRunner. See get_npm_global_prefix_with.
get_yarn_global_prefix
Get the yarn global node_modules path via yarn global dir.
get_yarn_global_prefix_with
Version of get_yarn_global_prefix that accepts an injected CommandRunner. See get_npm_global_prefix_with.
parse_bun_bin_output
Pure parser for bun pm bin -g stdout. Extracted so the derive-the-global-node_modules-path logic is unit-testable without shelling out.
parse_npm_root_output
Pure parser for npm root -g stdout. Returns the trimmed path or None on empty input. Extracted so the helper logic is unit- testable without shelling out.
parse_package_name
Parse a full npm package name into optional namespace and bare name.
parse_pnpm_root_output
Pure parser for pnpm root -g stdout. Returns the trimmed path or None on empty input.
parse_yarn_dir_output
Pure parser for yarn global dir stdout. Returns <dir>/node_modules or None on empty input. Extracted so the path-derivation logic is unit-testable without shelling out.
read_package_json
Read and parse a package.json file, returning (name, version) if valid.