( graph: DependencyGraph, name: string, visited: Set<WorkspacePackage>, path: string[] )
| 162 | } |
| 163 | |
| 164 | function visitDependents( |
| 165 | graph: DependencyGraph, |
| 166 | name: string, |
| 167 | visited: Set<WorkspacePackage>, |
| 168 | path: string[] |
| 169 | ) { |
| 170 | if (path.includes(name)) { |
| 171 | throw new Error( |
| 172 | `found cycle in dependency graph: ${path.join(' -> ')} -> ${name}` |
| 173 | ) |
| 174 | } |
| 175 | |
| 176 | const node = graph.get(name) |
| 177 | if (!node) { |
| 178 | return |
| 179 | } |
| 180 | |
| 181 | const nextPath = path.concat(name) |
| 182 | for (const depName of node.deps) { |
| 183 | visitDependents(graph, depName, visited, nextPath) |
| 184 | } |
| 185 | visited.add(node.value) |
| 186 | } |
| 187 | |
| 188 | export function dependentPackageOrder( |
| 189 | graph: DependencyGraph, |
no test coverage detected