mr-dep-walk
This library extracts dependent files from both ES6 module syntax, and AMD module syntax;
Usage
yarn add mr-dep-walk
const depFilesFromFile depsFromFile depsFromSource depsFromAST } = ;
For depFilesFromFile
given an entry file, it will produce a list of all dependent files (recursively):
// file.js; // y.js
; // => 'y.js';
For depsFromFile
given a file, it will produce a list of its immediate dependent moduleNames;
// file.js; // y.js
; // => 'y';
For depsFromSource
given the raw source, it will produce a list of its immediate dependent moduleNames;
; // => 'y'
For depsFromAST
given the AST, it will produce a list of its immediate dependent moduleNames;
; // => 'y'
Custom Parse Step
By default mr-dep-walk will use:
acorn
But some methods (depFilesFromFile
, depsFromFile
, depsFromSource
) support
an alt-parser, example:
;