(dir: string, depth: number)
| 217 | const max = opts.max ?? 64; |
| 218 | const out: string[] = []; |
| 219 | const walk = (dir: string, depth: number): void => { |
| 220 | if (out.length >= max || depth > maxDepth) return; |
| 221 | let entries: fs.Dirent[]; |
| 222 | try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; } |
| 223 | for (const e of entries) { |
| 224 | if (out.length >= max) return; |
| 225 | if (!e.isDirectory()) continue; |
| 226 | if (e.name.startsWith('.') || SUBPROJECT_SCAN_SKIP.has(e.name)) continue; |
| 227 | const child = path.join(dir, e.name); |
| 228 | if (isInitialized(child)) { out.push(child); continue; } // don't descend into an indexed project |
| 229 | walk(child, depth + 1); |
| 230 | } |
| 231 | }; |
| 232 | walk(root, 1); |
| 233 | return out; |
| 234 | } |
no test coverage detected