{"name":"amdetective","version":"0.0.2","description":"Like node-detective, but for AMD/r.js files. Finds all calls to `require()` in AMD modules by walking the AST.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["require","source","analyze","ast","amd","detective"],"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.2.2"},"bugs":{"url":"https://github.com/mixu/amdetective/issues"},"_id":"amdetective@0.0.2","dist":{"shasum":"260777ab35a6b9ba6edd1b8d7280d3a8ef4859b0","tarball":"http://registry-npm.ywwl.com/amdetective/download/amdetective-0.0.2.tgz","integrity":"sha512-M5//S7XayunfjrRqTCHEh8CRek4zpcZHTEwExEdSd4T0h/9gWW+NYw955V2qmMbN20tTwoHLL/RKe8TZyFUglw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAPQrMSkC66IqR+ZPSX/GDFPDT+OHFFExlkVt00Zy2oHAiAKoSncxqdWppwoV03qKgij7qoyJCf2FuLDsq8lZ4M4OA=="}],"size":11355,"noattachment":false,"key":"/amdetective/-/amdetective-0.0.2.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":1403562640158,"_cnpm_publish_time":1403562640158,"dist-tags":{"latest":"0.3.0"}}