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

Function moduleConfigEntry

src/resolution/index.ts:348–357  ·  view source on GitHub ↗

* One file's snapshot entry. Every sync looks at these files, so one whose * modified time and size haven't moved keeps the digest it has and isn't read: * a compile database runs to megabytes, and a Cargo workspace to a manifest per * crate.

(abs: string, previous: string | undefined, projectRoot: string)

Source from the content-addressed store, hash-verified

346 * crate.
347 */
348function moduleConfigEntry(abs: string, previous: string | undefined, projectRoot: string): string {
349 let stat: fs.Stats | undefined;
350 try {
351 stat = fs.statSync(abs, { throwIfNoEntry: false });
352 } catch { /* a file that can't be looked at is not there */ }
353 // (A FIFO under one of these names would park the read.)
354 if (!stat?.isFile()) return 'absent';
355 const stamp = `${stat.mtimeMs}:${stat.size}`;
356 return previous?.endsWith(`@${stamp}`) ? previous : `${moduleConfigDigest(abs, projectRoot)}@${stamp}`;
357}
358
359/**
360 * A digest of what resolution reads from one config file: a go.mod's module

Callers 1

moduleConfigSnapshotFunction · 0.85

Calls 1

moduleConfigDigestFunction · 0.85

Tested by

no test coverage detected