imports-walk
v1.0.1
Published
Find 'import' and 're-export' statements using babel parser.
Downloads
1
Maintainers
Readme
imports-walk
Find
import
andre-export
statements using babel parser.
Install
npm i imports-walk
Usage
source.js
import moduleA from './module-a.js';
import moduleB from './module-b.js';
export * from './module-c.js';
program.js
import importsWalk from 'imports-walk';
import fs from 'fs';
const source = fs.readFileSync('source.js', 'utf8');
importsWalk(source); // <= ['./module-a.js', './module-b.js', './module-c.js']
API
importsWalk(src, options?)
Looks for import
and re-export
statements.
src
Type: String
Source, where import
and re-export
statements will be looked for.
options
Type: Object
Options are the same as babel parser options.
License
MIT 💖