detective-cjs

6.0.0 • Public • Published

detective-cjs

CI npm version npm downloads

Get the dependencies of a CommonJS module by traversing its AST

npm install detective-cjs

But dude, substack already built this: node-detective. Yes, but I needed the capability to reuse an AST and this was unlikely to be merged timely. I can also support jsx and other syntactic constructs faster.

Usage

const fs = require('fs');
const detective = require('detective-cjs');

const mySourceCode = fs.readFileSync('myfile.js', 'utf8');

// Pass in a file's content or an AST
const dependencies = detective(mySourceCode);

License

MIT

/detective-cjs/

    Package Sidebar

    Install

    npm i detective-cjs

    Weekly Downloads

    881,827

    Version

    6.0.0

    License

    MIT

    Unpacked Size

    5.17 kB

    Total Files

    4

    Last publish

    Collaborators

    • pahen
    • xhmikosr
    • mrjoelkemp