subdeps
Trace the dependency graph of a javascript file using detective and resolve.
examples
tree.js
var subdeps = ;var deps = subdeps;consoledirdeps;
output:
substack : node-subdeps $ node example/tree.js
[ '/home/substack/projects/node-subdeps/example/tree/start.js',
'/home/substack/projects/node-subdeps/node_modules/detective/index.js',
'/home/substack/projects/node-subdeps/node_modules/detective/node_modules/burrito/index.js',
'/home/substack/projects/node-subdeps/node_modules/detective/node_modules/burrito/node_modules/uglify-js/uglify-js.js',
'/home/substack/projects/node-subdeps/node_modules/detective/node_modules/burrito/node_modules/uglify-js/lib/parse-js.js',
'/home/substack/projects/node-subdeps/node_modules/detective/node_modules/burrito/node_modules/uglify-js/lib/process.js',
'/home/substack/projects/node-subdeps/node_modules/detective/node_modules/burrito/node_modules/uglify-js/lib/squeeze-more.js',
'/home/substack/projects/node-subdeps/node_modules/detective/node_modules/burrito/node_modules/traverse/index.js',
'/home/substack/projects/node-subdeps/example/tree/lib/util.js',
'/home/substack/projects/node-subdeps/example/tree/x.js' ]
substack : node-subdeps $
memory.js
var subdeps = ;var deps = subdeps;consoledirdeps;
output:
[ '/a.js', '/b.js', '/node_modules/f/beep.js' ]
methods
var subdeps = require('subdeps');
subdeps.sync(filename, opts)
Return an array of dependencies starting from the file filename
and expanding
out recursively and synchronously.
Overload resolve's normal behavior with:
- opts.isFile
- opts.readFileSync
If you have an object mapping filenames to string contents, pass it in as
opts.sources
and the file will be used for dependency analysis entirely
in-memory.
install
With npm do:
npm install subdeps
and for the CLI tool do:
npm install -g subdeps
licence
MIT/X11