# es6-import-list

> List all es6 imports

Latest version **0.2.1** (published 2018-10-10) · AGPLv3+ license · 0 weekly downloads

## Install

```sh
npm install es6-import-list
pnpm add es6-import-list
yarn add es6-import-list
bun add es6-import-list
```

Provides the command `es6-import-list`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2018-10-10 |
| First published | 2017-12-11 |
| Weekly downloads | 0 |
| License | AGPLv3+ |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.5.0 |
| Dependencies | 4 |
| Unpacked size | 50.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Marcelo Jorge Vieira |
| Maintainers | dnsaoki, metal, ricobl, vierno |
| Keywords | es6, imports |

## Links

- npm: https://www.npmjs.com/package/es6-import-list
- Repository: https://github.com/marcelometal/es6-import-list
- Homepage: https://github.com/marcelometal/es6-import-list#readme
- Issues: https://github.com/marcelometal/es6-import-list/issues
- npm.io page: https://npm.io/package/es6-import-list

## Dependencies (4)

- [yargs](https://npm.io/package/yargs.md) ^10.0.3
- [node-dir](https://npm.io/package/node-dir.md) ^0.1.17
- [cli-table](https://npm.io/package/cli-table.md) ^0.3.1
- [shift-parser](https://npm.io/package/shift-parser.md) ^5.2.3

## Recent versions

- 0.2.1 (latest) — 2018-10-10
- 0.2.0 — 2018-10-10
- 0.1.1 — 2017-12-15
- 0.1.0 — 2017-12-11

## README

# es6-import-list [![Build Status](https://secure.travis-ci.org/marcelometal/es6-import-list.png?branch=master)](https://travis-ci.org/marcelometal/es6-import-list) [![npm version](https://img.shields.io/npm/v/es6-import-list.svg?style=flat)](https://www.npmjs.com/package/es6-import-list)

Utility for obtaining the dependency list from ES6 modules.
This module only analyzes imports declared using the ES module syntax.

## Installation

```sh
npm install -g es6-import-list
```

## CLI

```sh
$ 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

```sh
$ 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

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

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

Default options:

```js
const options = {
  match: /.js$/,
  exclude: [/^\./],
}
```

es6-import-list uses [node-dir][node-dir], so you can pass additional options
parameter to match or ignore files, for example.

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

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

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

[node-dir]: https://github.com/fshost/node-dir

---
_Source: https://npm.io/package/es6-import-list · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
