Discover the variable names chosen for each of a file's top-level required modules
Discover the variable names chosen for each of a file's top-level required modules.
Won't pick up nested requires in if/for statements or inside functions, but is intended for detecting the names of variables to replace e.g. when creating inlining transforms such as brfs.
Accepts an esprima-like
Returns an object whose keys represent the variable names used to require a module, and whose values are the required module strings detected.
var esprima =var walkers =var files =var src = filesvar ast = esprima// Walk the generated ASTvar result =console// Or you can try it this way:var result =console
Which should give you back something like this:
esprima: 'esprima'walkers: 'astw'files: 'fs'
MIT. See LICENSE.md for details.