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

Function moduleConfigEntry

src/resolution/index.ts:343–352  ·  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

341 * crate.
342 */
343function moduleConfigEntry(abs: string, previous: string | undefined, projectRoot: string): string {
344 let stat: fs.Stats | undefined;
345 try {
346 stat = fs.statSync(abs, { throwIfNoEntry: false });
347 } catch { /* a file that can't be looked at is not there */ }
348 // (A FIFO under one of these names would park the read.)
349 if (!stat?.isFile()) return 'absent';
350 const stamp = `${stat.mtimeMs}:${stat.size}`;
351 return previous?.endsWith(`@${stamp}`) ? previous : `${moduleConfigDigest(abs, projectRoot)}@${stamp}`;
352}
353
354/**
355 * 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