New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

subdeps

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

subdeps

trace the dependency graph of a javascript file

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

subdeps

Trace the dependency graph of a javascript file using detective and resolve.

build status

examples

tree.js

var subdeps = require('../');
var deps = subdeps.sync(__dirname + '/tree/start.js');
console.dir(deps);

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 = require('../');
var deps = subdeps.sync('/a.js', { sources : {
    '/a.js' : "var b = require('./b');",
    '/b.js' : "var c = require('f')",
    '/c.js' : "var d = require('./lib/d.js')",
    '/lib/d.js' : "var e = require('e');",
    '/node_modules/e/index.js' : '55',
    '/node_modules/f/beep.js' : '"boop"',
    '/node_modules/f/package.json' : JSON.stringify({ main : "beep.js" })
} });
console.dir(deps);

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

Keywords

FAQs

Package last updated on 27 May 2012

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc