* 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)
| 312 | * read/parse) while a single config file is in force, shared across every field. |
| 313 | */ |
| 314 | function loadParsedConfig(rootDir: string): ParsedConfig { |
| 315 | const file = path.join(rootDir, PROJECT_CONFIG_FILENAME); |
| 316 | |
| 317 | let mtimeMs: number; |
| 318 | try { |
| 319 | mtimeMs = fs.statSync(file).mtimeMs; |
| 320 | } catch { |
| 321 | // No config file — drop any stale cache entry and return the default. |
| 322 | cache.delete(rootDir); |
| 323 | return EMPTY_CONFIG; |
| 324 | } |
| 325 | |
| 326 | const entry = cache.get(rootDir); |
| 327 | if (entry && entry.mtimeMs === mtimeMs) return entry.config; |
| 328 | |
| 329 | const config = parseConfig(file); |
| 330 | cache.set(rootDir, { mtimeMs, config }); |
| 331 | return config; |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * Load the validated extension overrides for a project, mtime-cached. |
no test coverage detected