{"name":"amdetective","version":"0.3.0","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-3-Clause","dependencies":{"esprima":"3.1.0"},"devDependencies":{"mocha":"^3.1.2"},"gitHead":"91e160dd3b67db26c0cb24767d6b81c4ca06572b","bugs":{"url":"https://github.com/mixu/amdetective/issues"},"homepage":"https://github.com/mixu/amdetective#readme","_id":"amdetective@0.3.0","_shasum":"59694a196f84732b1ab002f9d192e1efb4fa3de3","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"mixu","email":"mixu@mixu.net"},"dist":{"shasum":"59694a196f84732b1ab002f9d192e1efb4fa3de3","tarball":"http://registry-npm.ywwl.com/amdetective/download/amdetective-0.3.0.tgz","integrity":"sha512-arWh9k1UxWKtr0ZQ5Wb67sYyauCZmGnpBZ4S1dG6EIX2sjdYfL1r8qAx59vY1SaMFyPn6se2ZHP8Fy+JclNVfg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDPuhzdF/wQdZ2nW7M18i7hbXBPqmHrCBjbacSdspQvcAiEA0zcfnpZVSeEL0w388kjNZJGxV5Y+lUqzMqvTdt0AzCo="}],"size":14223,"noattachment":false,"key":"/amdetective/-/amdetective-0.3.0.tgz"},"maintainers":[{"name":"mixu","email":"mixu@mixu.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/amdetective-0.3.0.tgz_1483584457481_0.4161730476189405"},"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":1483584457724,"_cnpm_publish_time":1483584457724,"dist-tags":{"latest":"0.3.0"}}