1.4.1 • Published 2 years ago

jscodeshift-build-import-list v1.4.1

Weekly downloads
109
License
MIT
Repository
github
Last release
2 years ago

jscodeshift-build-import-list

CircleCI Coverage Status semantic-release Commitizen friendly npm version

build a list of all files and dependencies transitively imported by starting file(s)

Installation

npm install --save-dev jscodeshift-build-import-list

Limitations

Requires Node >= 8.

Dynamic require() and import() paths are not supported; an Error will be thrown if dynamic path is encountered (unless you have a leading comment containing @jscodeshift-build-import-list ignore).

However, calls to require-glob with a string literal argument are supported.

API

buildImportList(files)

Builds a list of all files and npm packages imported from the given files, the files imported by them, and sort forth.

files (string | string[])

The file(s) to start from.

Returns (Promise<{files: Set<string>, dependencies: Set<string>}>)

A Promise that will resolve to an object with two properties:

files

A Set of local files transitively imported by the starting file(s)

dependencies

A Set of npm packages transitively imported by the starting file(s)

Ignoring requires/imports

Add a leading comment containing @jscodeshift-build-import-list ignore, for example:

// @jscodeshift-build-import-list ignore
import foo from 'foo'
const bar = /* @jscodeshift-build-import-list ignore */ require(getBarPath())
1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

3 years ago

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago