include-all
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -258,7 +258,21 @@ /** | ||
// If `force: true` was set, wipe out the previous contents from | ||
// this spot in the require cache before proceeding. | ||
// If `force: true` was set, remove the module from the require() | ||
// cache, along with any modules that the module `required()` | ||
if (options.force) { | ||
var resolved = require.resolve(filepath); | ||
if (require.cache[resolved]) { delete require.cache[resolved]; } | ||
// First, see if the item is actually cached. | ||
if (require.cache[resolved]) { | ||
// If so, add it to a stack of modules to remove. | ||
var modulesToRemove = [require.cache[resolved]]; | ||
// While there are items in the stack... | ||
while (modulesToRemove.length) { | ||
// Pop a module off the stack. | ||
var moduleToRemove = modulesToRemove.pop(); | ||
// Add its children to the stack. | ||
var children = (require.cache[moduleToRemove.id] && require.cache[moduleToRemove.id].children) || []; | ||
modulesToRemove = modulesToRemove.concat(children); | ||
// Delete the module from the cache. | ||
delete require.cache[moduleToRemove.id]; | ||
} | ||
} | ||
} | ||
@@ -265,0 +279,0 @@ |
{ | ||
"name": "include-all", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "An easy way to include all node.js modules within a directory.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29844
7
437
1