(hash, stack)
| 356 | * @param {Set<string>} stack stack of hashes |
| 357 | */ |
| 358 | const add = (hash, stack) => { |
| 359 | const deps = getDependencies(hash); |
| 360 | if (!deps) return; |
| 361 | stack.add(hash); |
| 362 | for (const dep of deps) { |
| 363 | if (hashesInOrder.has(dep)) continue; |
| 364 | if (stack.has(dep)) { |
| 365 | throw new Error( |
| 366 | `Circular hash dependency ${Array.from( |
| 367 | stack, |
| 368 | hashInfo |
| 369 | ).join(class="st">" -> ")} -> ${hashInfo(dep)}` |
| 370 | ); |
| 371 | } |
| 372 | add(dep, stack); |
| 373 | } |
| 374 | hashesInOrder.add(hash); |
| 375 | stack.delete(hash); |
| 376 | }; |
| 377 | if (hashesInOrder.has(hash)) continue; |
| 378 | add(hash, new Set()); |
| 379 | } |
no test coverage detected