(dir: string, depth: number)
| 426 | const max = opts.max ?? 64; |
| 427 | const out: string[] = []; |
| 428 | const walk = (dir: string, depth: number): void => { |
| 429 | if (out.length >= max || depth > maxDepth) return; |
| 430 | let entries: fs.Dirent[]; |
| 431 | try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; } |
| 432 | for (const e of entries) { |
| 433 | if (out.length >= max) return; |
| 434 | if (!e.isDirectory()) continue; |
| 435 | if (e.name.startsWith('.') || SUBPROJECT_SCAN_SKIP.has(e.name)) continue; |
| 436 | const child = path.join(dir, e.name); |
| 437 | if (isInitialized(child)) { out.push(child); continue; } // don't descend into an indexed project |
| 438 | walk(child, depth + 1); |
| 439 | } |
| 440 | }; |
| 441 | walk(root, 1); |
| 442 | return out; |
| 443 | } |
no test coverage detected