Skip to content

High speed Node.js package dependency graph walker based on Node.js module resolution algorithm

License

Notifications You must be signed in to change notification settings

ajaxlab/walk-package-graph

Repository files navigation

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.

About

High speed Node.js package dependency graph walker based on Node.js module resolution algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published