walk-package-graph
v0.1.1
Published
High speed Node.js package dependency graph walker based on Node.js module resolution algorithm
Downloads
7
Maintainers
Readme
walk-package-graph
walk-package-graph
traverses a Node.js package's dependency graph using Node.js module resolution algorithm
Performances
Traverses 1,633 packages within average 130ms with a core-i5 8GB ram machine.
npm run test
Installation
npm install walk-package-graph
Usages
import { walkPackageGraph } from 'walk-package-graph';
walkPackageGraph('/path/to/start', {
onEnd(rootNode) {
console.info('onEnd', rootNode.path);
},
onError(error) {
console.error('onError', error.path, error.message);
},
onResolve(node) {
console.info('onResolve', node.id, node.path, node.dependencies);
},
onUnresolve(node, unresolvedNames) {
console.error('onUnresolve', node.path, unresolvedNames);
},
onVisit(node) {
console.info('onVisit', node.path);
}
});
API
License
This project is licensed under MIT license.