detective-es6

5.0.0 • Public • Published

detective-es6

CI npm version npm downloads

Get the dependencies of an ES6 module

npm install detective-es6

Usage

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

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

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

You may also (optionally) configure the detective via a second object argument detective(src, options) that supports the following options:

  • skipTypeImports: (Boolean) whether or not to omit type imports (import type {foo} from "mylib";) in the list of extracted dependencies.
  • skipAsyncImports: (Boolean) whether or not to omit async imports (import('foo')) in the list of extracted dependencies.

License

MIT

Package Sidebar

Install

npm i detective-es6

Weekly Downloads

1,127,183

Version

5.0.0

License

MIT

Unpacked Size

5.39 kB

Total Files

4

Last publish

Collaborators

  • pahen
  • xhmikosr
  • mrjoelkemp