Utility for obtaining the dependency list from ES6 modules. This module only analyzes imports declared using the ES module syntax.
Installation
npm install -g es6-import-list
CLI
$ es6-import-list -d src/ // Output: ┌────────────────────────┬─────────────────────────┐│ Modules │ Import List │├────────────────────────┼─────────────────────────┤│ megadraft │ MegadraftEditor ││ │ MegadraftIcons ││ │ editorStateFromRaw │├────────────────────────┼─────────────────────────┤│ react │ Component ││ │ React │├────────────────────────┼─────────────────────────┤│ react-dom │ render │└────────────────────────┴─────────────────────────┘
Generate a JSON output with all the dependency information
$ es6-import-list -d src/ --json // Output:
Try es6-import-list --help
for more information.
API
getImports(dir, [options], callback)
Examples
const getImports = ; ;
Default options:
const options = match: /.js$/ exclude: /^\./
es6-import-list uses node-dir, so you can pass additional options parameter to match or ignore files, for example.
const getImports = ; const options = match: /.js$/ exclude: /^\./ excludeDir: 'dist' 'lib' 'node_modules'; ;