(stored: string | null)
| 312 | |
| 313 | /** A stored snapshot's files (see `getModuleConfigSnapshot`); an index without one, or one an older engine wrote, has none. */ |
| 314 | export function parseModuleConfigSnapshot(stored: string | null): ModuleConfigSnapshot { |
| 315 | if (!stored) return {}; |
| 316 | try { |
| 317 | const parsed = JSON.parse(stored) as unknown; |
| 318 | if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {}; |
| 319 | return Object.fromEntries(Object.entries(parsed as Record<string, unknown>).filter(([, v]) => typeof v === 'string')) as ModuleConfigSnapshot; |
| 320 | } catch { |
| 321 | return {}; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | /** Each of `files` (absolute) as the project sees it now, keyed by its project-relative path. */ |
| 326 | function moduleConfigSnapshot(projectRoot: string, files: Iterable<string>, previous: ModuleConfigSnapshot): ModuleConfigSnapshot { |
no test coverage detected