requires-walk
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

requires-walk

Find require() calls using babel parser.

Install

npm i requires-walk

Usage

source.js

const moduleA = require('./module-a.js');
const moduleB = require('./module-b.js');
const moduleC = require('./module-c.js');

program.js

const requiresWalk = require('requires-walk');
const fs = require('fs');
const source = fs.readFileSync('source.js', 'utf8');

requiresWalk(source); // <= ['./module-a.js', './module-b.js', './module-c.js']

API

requiresWalk(src, options?)

Looks for require() calls.

src

Type: String
Source, where require() calls will be looked for.

options

Type: Object
Options are the same as babel parser options.

License

MIT 💖

Dependents (0)

Package Sidebar

Install

npm i requires-walk

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

6.56 kB

Total Files

7

Last publish

Collaborators

  • mrozio