()
| 36 | let memCache: ResultCache | null = null |
| 37 | |
| 38 | async function loadCache(): Promise<ResultCache> { |
| 39 | if (memCache) return memCache |
| 40 | try { |
| 41 | const raw = await readFile(getCachePath(), 'utf-8') |
| 42 | const cache = JSON.parse(raw) as ResultCache |
| 43 | if (cache.version === CODEX_CACHE_VERSION && cache.files && typeof cache.files === 'object') { |
| 44 | memCache = cache |
| 45 | return cache |
| 46 | } |
| 47 | } catch {} |
| 48 | memCache = { version: CODEX_CACHE_VERSION, files: {} } |
| 49 | return memCache |
| 50 | } |
| 51 | |
| 52 | function getEntry(cache: ResultCache, filePath: string, fp: FileFingerprint): FileEntry | null { |
| 53 | if (!Object.hasOwn(cache.files, filePath)) return null |
no test coverage detected