build a list of all files and dependencies transitively imported by starting file(s)
npm install --save-dev jscodeshift-build-import-list
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.
Builds a list of all files and npm packages imported from the given files
,
the files imported by them, and sort forth.
The file(s) to start from.
A Promise
that will resolve to an object with two properties:
A Set
of local files transitively imported by the starting file(s)
A Set
of npm packages transitively imported by the starting file(s)
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())