* Resolve a single lazy artifact into files. Idempotent: once resolved * the entry moves to `files` and the loader is dropped. A loader that returns * null (no data) leaves nothing behind, so the path reads as "not found".
(path: string)
| 444 | * null (no data) leaves nothing behind, so the path reads as "not found". |
| 445 | */ |
| 446 | private async resolveLazyPath(path: string): Promise<string | null> { |
| 447 | const existing = this.files.get(path) |
| 448 | if (existing !== undefined) return existing |
| 449 | const loader = this.lazy.get(path) |
| 450 | if (!loader) return null |
| 451 | this.lazy.delete(path) |
| 452 | let content: string | null = null |
| 453 | try { |
| 454 | content = await loader() |
| 455 | } catch (err) { |
| 456 | logger.warn('Failed to resolve lazy VFS artifact', { |
| 457 | workspaceId: this._workspaceId, |
| 458 | path, |
| 459 | error: toError(err).message, |
| 460 | }) |
| 461 | content = null |
| 462 | } |
| 463 | if (content !== null) this.files.set(path, content) |
| 464 | return content |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * Resolve every lazy artifact a grep over `scope` will scan, in parallel. An |