0.1.1 • Published 5 years ago

walk-package-graph v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

walk-package-graph

npm Build Status Coverage Status

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.