* 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)
| 360 | * every one. |
| 361 | */ |
| 362 | function moduleConfigDigest(abs: string, projectRoot: string): string { |
| 363 | const file = path.basename(abs); |
| 364 | // A codegraph.json counts for its `webRoot` alone, which places a PHP |
| 365 | // include of `$_SERVER['DOCUMENT_ROOT'] . '/x.php'` (#3298). One that sets |
| 366 | // none reads as no file, so writing one to `exclude` a folder, or a snapshot |
| 367 | // from before it counted, re-opens nothing. |
| 368 | if (file === PROJECT_CONFIG_FILENAME) { |
| 369 | const webRoot = loadWebRoot(path.dirname(abs)); |
| 370 | return webRoot === null ? 'absent' : createHash('sha256').update(`webRoot=${webRoot}`).digest('hex').slice(0, 16); |
| 371 | } |
| 372 | const read = file === 'go.mod' ? loadGoModule(path.dirname(abs))?.modulePath ?? '' |
| 373 | : file === 'Cargo.toml' ? cargoManifestDigestText(abs) |
| 374 | : file === 'compile_commands.json' ? (readCompileDbIncludeDirs(abs, projectRoot) ?? []).join('\n') |
| 375 | : file === 'package.json' ? packageJsonMainOf(abs) |
| 376 | : aliasConfigFields(abs) ?? ''; |
| 377 | return createHash('sha256').update(read).digest('hex').slice(0, 16); |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * A package.json as an object, read past a byte order mark; null when it is |
no test coverage detected