* Load the parsed `codegraph.json` for a project, mtime-cached. A missing or * malformed file yields the zero-config default. One `stat` (and at most one * read/parse) while a single config file is in force, shared across every field.
(rootDir: string)
| 359 | * read/parse) while a single config file is in force, shared across every field. |
| 360 | */ |
| 361 | function loadParsedConfig(rootDir: string): ParsedConfig { |
| 362 | const file = path.join(rootDir, PROJECT_CONFIG_FILENAME); |
| 363 | |
| 364 | let mtimeMs: number; |
| 365 | try { |
| 366 | mtimeMs = fs.statSync(file).mtimeMs; |
| 367 | } catch { |
| 368 | // No config file — drop any stale cache entry and return the default. |
| 369 | cache.delete(rootDir); |
| 370 | return EMPTY_CONFIG; |
| 371 | } |
| 372 | |
| 373 | const entry = cache.get(rootDir); |
| 374 | if (entry && entry.mtimeMs === mtimeMs) return entry.config; |
| 375 | |
| 376 | const config = parseConfig(file); |
| 377 | cache.set(rootDir, { mtimeMs, config }); |
| 378 | return config; |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Load the validated extension overrides for a project, mtime-cached. |
no test coverage detected