1.0.1 • Published 7 months ago

imports-walk v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

imports-walk

Find import and re-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 💖

1.0.1

7 months ago

1.0.0

7 months ago