(path: string, data: T)
| 58 | } |
| 59 | |
| 60 | function writeCache<T>(path: string, data: T): void { |
| 61 | try { |
| 62 | mkdirSync(dirname(path), { recursive: true }); |
| 63 | const entry: CacheEntry<T> = { fetchedAt: Date.now(), data }; |
| 64 | writeFileSync(path, JSON.stringify(entry), "utf-8"); |
| 65 | } catch { |
| 66 | // Cache writes are opportunistic. A read-only home directory or sandboxed |
| 67 | // environment should not make the registry appear unreachable. |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | // ── Fetchers ──────────────────────────────────────────────────────────────── |
| 72 |
no test coverage detected