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

Function moduleConfigDigest

src/resolution/index.ts:315–322  ·  view source on GitHub ↗

* A digest of what resolution reads from one config file: a go.mod's module * path, a tsconfig / jsconfig's `extends`, `baseUrl` and `paths`, what a Cargo * manifest declares (see `cargoManifestFields`), the include directories a * compile database names. Not of its bytes: a dependency bump, a `s

(abs: string, projectRoot: string)

Source from the content-addressed store, hash-verified

313 * every one.
314 */
315function moduleConfigDigest(abs: string, projectRoot: string): string {
316 const file = path.basename(abs);
317 const read = file === 'go.mod' ? loadGoModule(path.dirname(abs))?.modulePath ?? ''
318 : file === 'Cargo.toml' ? cargoManifestDigestText(abs)
319 : file === 'compile_commands.json' ? (readCompileDbIncludeDirs(abs, projectRoot) ?? []).join('\n')
320 : aliasConfigFields(abs) ?? '';
321 return createHash('sha256').update(read).digest('hex').slice(0, 16);
322}
323
324function cargoManifestDigestText(abs: string): string {
325 try {

Callers 1

moduleConfigEntryFunction · 0.85

Calls 6

loadGoModuleFunction · 0.90
readCompileDbIncludeDirsFunction · 0.90
aliasConfigFieldsFunction · 0.90
cargoManifestDigestTextFunction · 0.85
updateMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected