Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-import-list

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-import-list

List all es6 imports

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
4
Weekly downloads
 
Created
Source

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: [/^\./],
  excludeDir: ['dist', 'lib', 'node_modules'],
}

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: ['node_modules'],
};

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

Keywords

FAQs

Package last updated on 10 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc