Socket
Book a DemoInstallSign in
Socket

dependency-tree

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-tree

Utilities for interacting with the dependency tree of a module

Source
npmnpm
Version
1.3.4
Version published
Weekly downloads
2.2M
-4.82%
Maintainers
1
Weekly downloads
 
Created
Source

dependency-tree npm npm

Utilities for interacting with the dependency tree of a module

npm install dependency-tree

Usage

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

Supported Utilities

getTreeAsList

Returns the entire dependency tree as a flat list of filepaths for a given module. Basically, all files visited during traversal of the dependency-tree are returned.

  • All core Node modules (assert, path, fs, etc) are removed from the dependency list by default
  • Works for AMD, CommonJS, ES6 modules and SASS files.
var getTreeAslist = require('dependency-tree').getTreeAsList;

getTreeAsList(filename, root, function(treeList) {
  console.log(treeList);
});
  • filename: The file whose dependency tree to traverse
  • root: The path to all of your JS files

Prints:

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

Optional

  • cache: 4th argument that's an empty object (or shared across multiple runs of this module) used for avoiding redundant subtree generations.

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

tree-as-list filename root

Prints

/a.js
/b.js

Keywords

AMD

FAQs

Package last updated on 24 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts