GitXplorerGitXplorer
m

es6-import-list

public
7 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
6d64a1b85baf36fe6eee194e2f8b900dc95de309

Release 0.2.1

mmarcelometal committed 6 years ago
Unverified
edeb9dd641fc52facbd829c4353376aa5a1cc0aa

README: Fixed examples

mmarcelometal committed 6 years ago
Unverified
13b9a8ad0d646c0c34c53ab5dfe6d31f73dd4380

Release 0.2.0

mmarcelometal committed 6 years ago
Unverified
cced20c085d68cce6a0384c9c0bc8589399af7ff

Making default excludes less intrusive (#1)

vvierno committed 6 years ago
Unverified
df5e4c939f0b26bc4d3d58a061fe16a4b649a06c

Release 0.1.1

vvierno committed 7 years ago
Unverified
4e1c65a66e7a3112e4efdee06beb71888673316a

Update yarn.lock

vvierno committed 7 years ago

README

The README file for this repository.

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);
});