* Flattens the module dependency graph and makes its entries unique. This * serves as the input on which all rules are tested. * * @param {!ModuleDef} entryPoints * @return {!ModuleDef}
(entryPoints)
| 229 | * @return {!ModuleDef} |
| 230 | */ |
| 231 | function flattenGraph(entryPoints) { |
| 232 | return flatten(entryPoints.deps).reduce((acc, cur) => { |
| 233 | const {name} = cur; |
| 234 | if (!acc[name]) { |
| 235 | acc[name] = Object.values(cur.deps); |
| 236 | } |
| 237 | return acc; |
| 238 | }, Object.create(null)); |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Run Module dependency graph against the rules. |