Created
July 17, 2018 23:10
-
-
Save adamisntdead/74f432b3a8eacf5c68c3eda86d6c0651 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function getModules(entry) { | |
const rootModule = createModuleObject(entry) | |
const modules = [rootModule] | |
// Iterate over the modules, even when new | |
// ones are being added | |
for (const module of modules) { | |
module.map = {} // Where we will keep the module maps | |
module.requires.forEach(dependency => { | |
const basedir = path.dirname(module.filepath) | |
const dependencyPath = resolve(dependency, { basedir }) | |
const dependencyObject = createModuleObject(dependencyPath) | |
module.map[dependency] = dependencyObject.id | |
modules.push(dependencyObject) | |
}) | |
} | |
return modules | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment