es6-import-list
List all es6 imports
Last updated 2 years ago by metal .
AGPLv3+ · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install es6-import-list 
SYNC missed versions from official npm registry.

es6-import-list Build Status npm version

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:

{
  "megadraft": [
    "MegadraftEditor",
    "MegadraftIcons",
    "editorStateFromRaw"
  ],
  "react": [
    "Component",
    "React"
  ],
  "react-dom": [
    "render"
  ]
}

Try es6-import-list --help for more information.

API

getImports(dir, [options], callback)

Examples

const getImports = require('es6-import-list');

getImports('my-directory', importsList => {
  console.log(importsList);
});

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 = require('es6-import-list');

const options = {
  match: /.js$/,
  exclude: [/^\./],
  excludeDir: ['dist', 'lib', 'node_modules'],
};

getImports('my-directory', options, importList => {
  console.log(importList);
});

Current Tags

  • 0.2.1                                ...           latest (2 years ago)

4 Versions

  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (14)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |