{"name":"amdetective","version":"0.0.1","description":"Like node-detective, but for AMD/r.js files","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mixu/amdetective.git"},"author":{"name":"Mikito Takada","email":"mikito.takada@gmail.com","url":"http://mixu.net/"},"license":"BSD","dependencies":{"esprima":"~1.0.4"},"bugs":{"url":"https://github.com/mixu/amdetective/issues"},"_id":"amdetective@0.0.1","dist":{"shasum":"d3f5af931f4156d4390221254c0a9a16ab961d8b","tarball":"http://registry-npm.ywwl.com/amdetective/download/amdetective-0.0.1.tgz","integrity":"sha512-z8+f9qhA7k3GTHUPbWOnOQyUaUBzgsI6EspAEQ0Iow/89pGCPPPnYjIe2JKH0ZMCJVkXqx8OT2d2js1ABuYCqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8JEv/KXBWJ4VuKFyux9CsVokBYU8Swwbk8DbbOqYaJAiBtv5WANC1E8tmIyGcrATYlVfMgyqzqFzSEtSBt6QiSrg=="}],"size":10112,"noattachment":false,"key":"/amdetective/-/amdetective-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"directories":{},"readme":"# amdetective\n\nFind all calls to `require()` in AMD modules by walking the AST.\n\nThis module uses code extracted from [r.js](https://github.com/jrburke/r.js) rather than trying to write it's own version of r.js parsing. It depends on esprima (but not r.js).\n\n# Install\n\n```\nnpm install amdetective\n```\n\n# example\n\nFirst, create `detect.js` which is just a four line CLI wrapper around `amdetective`:\n\n````js\nvar fs = require('fs'),\n    amdetective = require('amdetective');\n\nconsole.log('Reading file from first argument: ' + process.argv[2]);\nconsole.log(amdetective(fs.readFileSync(process.argv[2]).toString()));\n````\n\nNow, let's run it on a bunch of examples to see some output. You can also run this command on your own files to get more realistic examples.\n\n## Definition Functions with Dependencies (simple.js)\n\n````js\nrequire(['module1', 'path/to/module2'], function(a, b){\n  // ...\n});\n````\n\nRunning `node detect.js simple.js` produces:\n\n````\nReading file from first argument: simple.js\n[ 'module1', 'path/to/module2' ]\n````\n\n## Simplified CommonJS Wrapper (simple2.js)\n\n````js\ndefine(function(require) {\n  var a = require('some/file'),\n      b = require('json!foo/bar');\n  // ...\n});\n````\n\nRunning `node detect.js simple2.js` produces:\n\n````\nReading file from first argument: simple2.js\n[ 'require', 'some/file', 'json!foo/bar' ]\n````\n\n## Named module (named.js)\n\n````js\ndefine(\"foo/title\",\n    [\"my/cart\", \"my/inventory\"],\n    function(cart, inventory) {\n   }\n);\n````\n\nRunning `node detect.js simple2.js` produces:\n\n````\nReading file from first argument: named.js\n[ { name: 'foo/title', deps: [ 'my/cart', 'my/inventory' ] } ]\n````\n\nNote how named modules are treated differently - this is just something that the underlying resolution code does so be prepared to deal with it.\n\n# Methods\n\n## amdetective(src, opts)\n\nGiven some source body `src`, return an array of all the `require()` call arguments detected by AMD/r.js.\n\nThe options parameter `opts` is passed along to `parse.recurse()` in [lib/parse.js](https://github.com/mixu/amdetective/blob/master/lib/parse.js#L196). This is normally the build config options if it is passed.\n\n# License\n\nBSD\n","publish_time":1389917538571,"_cnpm_publish_time":1389917538571,"dist-tags":{"latest":"0.3.0"}}