* 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)
| 270 | * read/parse) while a single config file is in force, shared across every field. |
| 271 | */ |
| 272 | function loadParsedConfig(rootDir: string): ParsedConfig { |
| 273 | const file = path.join(rootDir, PROJECT_CONFIG_FILENAME); |
| 274 | |
| 275 | let mtimeMs: number; |
| 276 | try { |
| 277 | mtimeMs = fs.statSync(file).mtimeMs; |
| 278 | } catch { |
| 279 | // No config file — drop any stale cache entry and return the default. |
| 280 | cache.delete(rootDir); |
| 281 | return EMPTY_CONFIG; |
| 282 | } |
| 283 | |
| 284 | const entry = cache.get(rootDir); |
| 285 | if (entry && entry.mtimeMs === mtimeMs) return entry.config; |
| 286 | |
| 287 | const config = parseConfig(file); |
| 288 | cache.set(rootDir, { mtimeMs, config }); |
| 289 | return config; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Load the validated extension overrides for a project, mtime-cached. |
no test coverage detected