(graph: DependencyGraph)
| 146 | } |
| 147 | |
| 148 | function invertGraph(graph: DependencyGraph): DependencyGraph { |
| 149 | const dependentGraph: DependencyGraph = new Map() |
| 150 | for (const [name, node] of graph) { |
| 151 | dependentGraph.set(name, { |
| 152 | deps: [], |
| 153 | value: node.value, |
| 154 | }) |
| 155 | } |
| 156 | for (const [name, node] of graph) { |
| 157 | for (const depName of node.deps) { |
| 158 | dependentGraph.get(depName)?.deps.push(name) |
| 159 | } |
| 160 | } |
| 161 | return dependentGraph |
| 162 | } |
| 163 | |
| 164 | function visitDependents( |
| 165 | graph: DependencyGraph, |
no test coverage detected