(name)
| 194 | const order = []; |
| 195 | |
| 196 | function visit(name) { |
| 197 | if (!dependencies || !dependencies[name]) { |
| 198 | const chain = [...visiting, name].join(' -> '); |
| 199 | throw new Error(`Unknown library dependency '${name}' while resolving ${chain}`); |
| 200 | } |
| 201 | if (visiting.includes(name)) { |
| 202 | const cycleStart = visiting.indexOf(name); |
| 203 | const cycle = [...visiting.slice(cycleStart), name].join(' -> '); |
| 204 | throw new Error(`Dependency cycle detected: ${cycle}`); |
| 205 | } |
| 206 | if (visited.has(name)) return; |
| 207 | |
| 208 | visiting.push(name); |
| 209 | for (const dependency of dependencies[name].direct_dependencies || []) { |
| 210 | visit(dependency); |
| 211 | } |
| 212 | visiting.pop(); |
| 213 | |
| 214 | visited.add(name); |
| 215 | order.push(name); |
| 216 | } |
| 217 | |
| 218 | visit(libraryName); |
| 219 |
no test coverage detected