{"name":"amdetective","version":"0.2.1","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":"mocha -R spec ./test/test.js"},"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":"~2.7.0"},"gitHead":"baa5d9f7f20d4f72ed398edcf04325e4a1fa11b0","bugs":{"url":"https://github.com/mixu/amdetective/issues"},"homepage":"https://github.com/mixu/amdetective#readme","_id":"amdetective@0.2.1","_shasum":"bd96fcb67e5dfd51dafd4afecff46269efa7dca9","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"dist":{"shasum":"bd96fcb67e5dfd51dafd4afecff46269efa7dca9","tarball":"http://registry-npm.ywwl.com/amdetective/download/amdetective-0.2.1.tgz","integrity":"sha512-7qZoaV3oAnWTLru0t+sa75DNiM/Q5wEXU+ikV5nnr4G947MBTB/Cov3K5VYv29P2Gm1cHv5KXPf+KM5FIxukXA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+YgaMLOfTFMIJPrks6ui1LRU3vDY94wSQACH79REhvAiAe/f4sL2cC/rsFgTFo1S74KnkGdxftyuChoYwu3WN/5A=="}],"size":12437,"noattachment":false,"key":"/amdetective/-/amdetective-0.2.1.tgz"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/amdetective-0.2.1.tgz_1460699210365_0.33011368848383427"},"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":1460699212462,"_cnpm_publish_time":1460699212462,"dist-tags":{"latest":"0.3.0"}}