MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / parseModuleConfigSnapshot

Function parseModuleConfigSnapshot

src/resolution/index.ts:319–328  ·  view source on GitHub ↗
(stored: string | null)

Source from the content-addressed store, hash-verified

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

Callers 2

syncMethod · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected