`readFile` through the LRU content cache (null = read failed, also cached).
(filePath: string)
| 412 | |
| 413 | /** `readFile` through the LRU content cache (null = read failed, also cached). */ |
| 414 | private readFileCached(filePath: string): string | null { |
| 415 | if (this.fileCache.has(filePath)) { |
| 416 | return this.fileCache.get(filePath)!; |
| 417 | } |
| 418 | const fullPath = path.join(this.projectRoot, filePath); |
| 419 | try { |
| 420 | const content = fs.readFileSync(fullPath, 'utf-8'); |
| 421 | this.fileCache.set(filePath, content); |
| 422 | return content; |
| 423 | } catch (error) { |
| 424 | logDebug('Failed to read file for resolution', { filePath, error: String(error) }); |
| 425 | this.fileCache.set(filePath, null); |
| 426 | return null; |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | /** |
| 431 | * Create the resolution context |