JSPM

  • Created
  • Published
  • Downloads 1929024
  • Score
    100M100P100Q221640F
  • License MIT

Utilities for interacting with the dependency tree of a module

Package Exports

  • dependency-tree

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dependency-tree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dependency-tree

Utilities for interacting with the dependency tree of a module

npm install -g dependency-tree

  • You only need the global flag for the shell scripts

Usage

var treeUtils = require('dependency-tree');

Supported Utilities

treeAsList

Returns a promise that resolves with the entire dependency tree as a flat list of files for a given module. Basically, all files visited during traversal of the dependency-tree are collected in a list that's returned.

var getTreeAslist = require('dependency-tree').getTreeAsList;

getTreeAsList(filename, root).then(function(treeList) {
  console.log(treeList);
});

Prints:

[
  '/a.js',
  '/b.js'
]

Shell version (assuming npm install -g dependency-tree):

tree-as-list filename root

Prints

/a.js
/b.js