Skip to main content

Module node_modules

Module node_modules 

Source
Expand description

Node.js node_modules directory traversal.

Discovers every npm package directory reachable from the project root by following Node’s module resolution algorithm: walk up the directory tree collecting node_modules/ entries, descend into each package directory (including scoped @scope/pkg packages), and avoid revisiting the same canonical URL twice.

Functions§

build_node_module_import_paths
Build all ancestor directory URLs from the main module URL, to be used as starting points for node_modules scanning. Mirrors ModuleStateBuilder.buildNodeModuleImportPaths.
build_node_module_paths
Discover all node module paths starting from the given import URLs. Mirrors ModuleStateBuilder.buildNodeModulePaths.