| 602 | const excluded = new Set<string>() |
| 603 | const visited = new Set<string>() |
| 604 | const visit = (refs: readonly { path: string }[] | undefined) => { |
| 605 | if (!refs?.length) return |
| 606 | for (const { path } of refs) { |
| 607 | const refConfig = |
| 608 | /\.json$/i.test(path) ? path : join(path, "tsconfig.json") |
| 609 | const key = canonical(refConfig) |
| 610 | if (visited.has(key)) continue |
| 611 | visited.add(key) |
| 612 | try { |
| 613 | const refParsed = api.parseConfigFile(refConfig) |
| 614 | for (const fileName of refParsed.fileNames) |
| 615 | excluded.add(canonical(fileName)) |
| 616 | visit(refParsed.projectReferences) |
| 617 | } catch { |
| 618 | // unreadable reference is reported by the checker itself |
| 619 | } |
| 620 | } |
| 621 | } |
| 622 | visit(references) |
| 623 | return excluded |
| 624 | } |