{ "name": "module-deps", "version": "0.8.0", "description": "walk the dependency graph to generate json output that can be fed into browser-pack", "main": "index.js", "bin": { "module-deps": "cmd.js" }, "dependencies": { "through": "~2.3.2", "JSONStream": "~0.4.3", "browser-resolve": "~0.1.0", "resolve": "~0.3.0", "detective": "~2.1.1", "concat-stream": "~0.1.1" }, "devDependencies": { "tap": "~0.4.0", "browser-pack": "~0.0.0" }, "scripts": { "test": "tap test/*.js" }, "repository": { "type": "git", "url": "git://github.com/substack/module-deps.git" }, "homepage": "https://github.com/substack/module-deps", "keywords": [ "dependency", "graph", "browser", "require", "module", "exports", "json" ], "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "license": "MIT", "readme": "# module-deps\n\nwalk the dependency graph to generate json output that can be fed into\n[browser-pack](https://github.com/substack/browser-pack)\n\n[![build status](https://secure.travis-ci.org/substack/module-deps.png)](http://travis-ci.org/substack/module-deps)\n\n# example\n\n``` js\nvar mdeps = require('module-deps');\nvar JSONStream = require('JSONStream');\n\nvar stringify = JSONStream.stringify();\nstringify.pipe(process.stdout);\n\nvar file = __dirname + '/files/main.js';\nmdeps(file).pipe(stringify);\n```\n\noutput:\n\n```\n$ node example/deps.js\n[\n{\"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\"}}\n,\n{\"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\"}}\n,\n{\"id\":\"/home/substack/projects/module-deps/example/files/bar.js\",\"source\":\"module.exports = function (n) {\\n return n * 100;\\n};\\n\",\"deps\":{}}\n]\n```\n\nand you can feed this json data into\n[browser-pack](https://github.com/substack/browser-pack):\n\n```\n$ node example/deps.js | browser-pack | node\nmain: 1055\n```\n\n# usage\n\n```\nusage: module-deps [files]\n\n generate json output from each entry file\n\n```\n\n# methods\n\n``` js\nvar mdeps = require('module-deps')\n```\n\n## mdeps(files, opts={})\n\nReturn a readable stream of javascript objects from an array of filenames\n`files`.\n\nOptionally pass in some `opts`:\n\n* opts.transform - a string or array of string transforms (see below)\n\n* opts.transformKey - an array path of strings showing where to look in the\npackage.json for source transformations. If falsy, don't look at the\npackage.json at all.\n\n* opts.resolve - custom resolve function using the\n`opts.resolve(id, parent, cb)` signature that\n[browser-resolve](https://github.com/shtylman/node-browser-resolve) has\n\n* opts.filter - a function (id) to skip resolution of some module `id` strings.\nIf defined, `opts.filter(id)` should return truthy for all the ids to include\nand falsey for all the ids to skip.\n\n* opts.packageFilter - transform the parsed package.json contents before using\nthe values. `opts.packageFilter(pkg)` should return the new `pkg` object to use.\n\n* opts.noParse - an array of absolute paths to not parse for dependencies. Use\nthis for large dependencies like jquery or threejs which take forever to parse.\n\n# transforms\n\nmodule-deps can be configured to run source transformations on files before\nparsing them for `require()` calls. These transforms are useful if you want to\ncompile a language like [coffeescript](http://coffeescript.org/) on the fly or\nif you want to load static assets into your bundle by parsing the AST for\n`fs.readFileSync()` calls.\n\nIf the transform is a function, it should take the `file` name as an argument\nand return a through stream that will be written file contents and should output\nthe new transformed file contents.\n\nIf the transform is a string, it is treated as a module name that will resolve\nto a module that is expected to follow this format:\n\n``` js\nvar through = require('through');\nmodule.exports = function (file) { return through() };\n```\n\nYou don't necessarily need to use the\n[through](https://github.com/dominictarr/through) module to create a\nreadable/writable filter stream for transforming file contents, but this is an\neasy way to do it.\n\nWhen you call `mdeps()` with an `opts.transform`, the transformations you\nspecify will not be run for any files in node_modules/. This is because modules\nyou include should be self-contained and not need to worry about guarding\nthemselves against transformations that may happen upstream.\n\nModules can apply their own transformations by setting a transformation pipeline\nin their package.json at the `opts.transformKey` path. These transformations\nonly apply to the files directly in the module itself, not to the module's\ndependants nor to its dependencies.\n\n# install\n\nWith [npm](http://npmjs.org), to get the module do:\n\n```\nnpm install module-deps\n```\n\nand to get the `module-deps` command do:\n\n```\nnpm install -g module-deps\n```\n\n# license\n\nMIT\n", "readmeFilename": "readme.markdown", "bugs": { "url": "https://github.com/substack/module-deps/issues" }, "_id": "module-deps@0.8.0", "dist": { "shasum": "6e50ca6c9fb5a2afc0009eda9309f4a12b027515" }, "_from": "module-deps@~0.8.0", "_resolved": "https://registry.npmjs.org/module-deps/-/module-deps-0.8.0.tgz" }