# module-deps **Repository Path**: mirrors_defunctzombie/module-deps ## Basic Information - **Project Name**: module-deps - **Description**: walk the dependency graph to generate a stream of json output - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-03-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # module-deps walk the dependency graph to generate json output that can be fed into [browser-pack](https://github.com/substack/browser-pack) [![build status](https://secure.travis-ci.org/substack/module-deps.png)](http://travis-ci.org/substack/module-deps) # example ``` js var mdeps = require('module-deps'); var JSONStream = require('JSONStream'); var stringify = JSONStream.stringify(); stringify.pipe(process.stdout); var file = __dirname + '/files/main.js'; mdeps(file).pipe(stringify); ``` output: ``` $ node example/deps.js [ {"id":"/home/substack/projects/module-deps/example/files/main.js","source":"var foo = require('./foo');\nconsole.log('main: ' + foo(5));\n","entry":true,"deps":{"./foo":"/home/substack/projects/module-deps/example/files/foo.js"}} , {"id":"/home/substack/projects/module-deps/example/files/foo.js","source":"var bar = require('./bar');\n\nmodule.exports = function (n) {\n return n * 111 + bar(n);\n};\n","deps":{"./bar":"/home/substack/projects/module-deps/example/files/bar.js"}} , {"id":"/home/substack/projects/module-deps/example/files/bar.js","source":"module.exports = function (n) {\n return n * 100;\n};\n","deps":{}} ] ``` and you can feed this json data into [browser-pack](https://github.com/substack/browser-pack): ``` $ node example/deps.js | browser-pack | node main: 1055 ``` # usage ``` usage: module-deps [files] generate json output from each entry file ``` # methods ``` js var mdeps = require('module-deps') ``` ## mdeps(files, opts={}) Return a readable stream of javascript objects from an array of filenames `files`. Optionally pass in `opts` that will be fed through into the underlying [required](https://github.com/shtylman/node-required) module. # install With [npm](http://npmjs.org), to get the module do: ``` npm install module-deps ``` and to get the `module-deps` command do: ``` npm install -g module-deps ``` # license MIT