walk-package-graph
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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.

Package Sidebar

Install

npm i walk-package-graph

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

554 kB

Total Files

61

Last publish

Collaborators

  • ajaxlab