JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2934786
  • Score
    100M100P100Q213375F
  • License MIT

Get the dependencies of an es6 module

Package Exports

  • detective-es6

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (detective-es6) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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