(projectName, visited, ancestors, callback)
| 456 | } |
| 457 | |
| 458 | async _traverseDepthFirst(projectName, visited, ancestors, callback) { |
| 459 | this._checkCycle(ancestors, projectName); |
| 460 | |
| 461 | if (visited[projectName]) { |
| 462 | return visited[projectName]; |
| 463 | } |
| 464 | return visited[projectName] = (async () => { |
| 465 | const newAncestors = [...ancestors, projectName]; |
| 466 | const dependencies = this.getDependencies(projectName); |
| 467 | await Promise.all(dependencies.map((depName) => { |
| 468 | return this._traverseDepthFirst(depName, visited, newAncestors, callback); |
| 469 | })); |
| 470 | |
| 471 | await callback({ |
| 472 | project: this.getProject(projectName), |
| 473 | dependencies |
| 474 | }); |
| 475 | })(); |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Join another project graph into this one. |
no test coverage detected