(stored: string | null)
| 265 | |
| 266 | /** A stored snapshot's files (see `getModuleConfigSnapshot`); an index without one, or one an older engine wrote, has none. */ |
| 267 | export function parseModuleConfigSnapshot(stored: string | null): ModuleConfigSnapshot { |
| 268 | if (!stored) return {}; |
| 269 | try { |
| 270 | const parsed = JSON.parse(stored) as unknown; |
| 271 | if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {}; |
| 272 | return Object.fromEntries(Object.entries(parsed as Record<string, unknown>).filter(([, v]) => typeof v === 'string')) as ModuleConfigSnapshot; |
| 273 | } catch { |
| 274 | return {}; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /** Each of `files` (absolute) as the project sees it now, keyed by its project-relative path. */ |
| 279 | function moduleConfigSnapshot(projectRoot: string, files: Iterable<string>, previous: ModuleConfigSnapshot): ModuleConfigSnapshot { |
no test coverage detected