(name: string, path: string[])
| 340 | tasks.map(task => [task.name, "white"]) |
| 341 | ); |
| 342 | const visit = (name: string, path: string[]): void => { |
| 343 | const current = color.get(name); |
| 344 | if (current === "gray") { |
| 345 | const cycle = [...path.slice(path.indexOf(name)), name]; |
| 346 | ctx.addIssue({ |
| 347 | code: z.ZodIssueCode.custom, |
| 348 | path: ["tasks"], |
| 349 | message: `dependsOn cycle: ${cycle.join(" -> ")}`, |
| 350 | }); |
| 351 | return; |
| 352 | } |
| 353 | if (current === "black") return; |
| 354 | color.set(name, "gray"); |
| 355 | const task = byName.get(name); |
| 356 | if (task) { |
| 357 | for (const dep of normalizedDependsOn(task)) { |
| 358 | if (byName.has(dep)) visit(dep, [...path, name]); |
| 359 | } |
| 360 | } |
| 361 | color.set(name, "black"); |
| 362 | }; |
| 363 | for (const task of tasks) visit(task.name, []); |
| 364 | }); |
| 365 |
no test coverage detected