modules-graph

0.1.1 • Public • Published

Node modules graph Build Status

Small library to get module dependencies info during runtime.

Installation

npm install modules-graph

Usage

When you instantiate ModulesGraph object it will hook into node.js require function and will log all require calls remembering which module required which.

var modulesGraph = new ModulesGraph();

After that you can call methods on modulesGraph object to get dependencies and dependant modules for any module. All methods accept filepath parameter that should be the absolute path to module.

result = modulesGraph.getImmediateDependencies(filepath);
result = modulesGraph.getImmediateDependants(filepath);
result = modulesGraph.getDependencies(filepath);
result = modulesGraph.getDependants(filepath);

To stop logging dependencies call restore method.

modulesGraph.restore()

Tests

npm test

Readme

Keywords

Package Sidebar

Install

npm i modules-graph

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • dettier