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

Function moduleConfigEntry

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

294 * crate.
295 */
296function moduleConfigEntry(abs: string, previous: string | undefined, projectRoot: string): string {
297 let stat: fs.Stats | undefined;
298 try {
299 stat = fs.statSync(abs, { throwIfNoEntry: false });
300 } catch { /* a file that can't be looked at is not there */ }
301 // (A FIFO under one of these names would park the read.)
302 if (!stat?.isFile()) return 'absent';
303 const stamp = `${stat.mtimeMs}:${stat.size}`;
304 return previous?.endsWith(`@${stamp}`) ? previous : `${moduleConfigDigest(abs, projectRoot)}@${stamp}`;
305}
306
307/**
308 * 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