Walk a require tree for a cached module.
npm install --save cache-walk
Requiring one file typically adds more than one file to the require cache, since that file (probably) requires other files, which potentially require other files. This module let's you walk through the entire require tree of a particular module as it is in the cache.
cache-walk exports three functions for interacting with a require tree:
.get returns a list of module ids (absolute file paths),
.walk calls a function for each module encountered, and
.delete deletes an entire require tree from the cache.
var foo = ;var cache = ;// requiredModules will contain ./foo// plus everything required by ./foo and it's childrenvar requiredModules = cache;
var foo = ;var cache = ;// The callback will be called first with the ./foo module id// and then with everything required by ./foo and it's childrencache;
var foo = ;var cache = ;// Delete ./foo from the cache along with it's children etc.cache;
These examples use relative paths, but absolute ones work as well.
Please see the contribution guidelines.