Skip to content

Get the dependencies of an ES6 module by traversing its AST

Notifications You must be signed in to change notification settings

nicolas6422/node-detective-es6

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

detective-es6 npm npm

Get the dependencies of an ES6 module

npm install detective-es6

Usage

var detective = require('detective-es6');

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

// Pass in a file's content or an AST
var 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

About

Get the dependencies of an ES6 module by traversing its AST

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%