-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,14 +54,20 @@ require.searchCache = function (moduleName, callback) { | |
|
||
// Check if the module has been resolved and found within | ||
// the cache no else so #ignore else http://git.io/vtgMI | ||
/* istanbul ignore else */ | ||
/* istanbul ignore else */ | ||
if (mod && ((mod = require.cache[mod]) !== undefined)) { | ||
// Recursively go over the results | ||
(function run(mod) { | ||
// Go over each of the module's children and | ||
// run over it | ||
mod.children.forEach(function (child) { | ||
run(child); | ||
// Prevent infinite recursion | ||
/* istanbul ignore next */ | ||
if (child.parent === mod) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jupiter
Author
Contributor
|
||
return; | ||
} else { | ||
run(child); | ||
} | ||
}); | ||
|
||
// Call the specified callback providing the | ||
|
this change makes little sense, it will be true for direct dependences. It "solves" the infinite loop issue by not doing recursive search.
I would propose something more verbose: