* 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)
| 220 | * read/parse) while a single config file is in force, shared across every field. |
| 221 | */ |
| 222 | function loadParsedConfig(rootDir: string): ParsedConfig { |
| 223 | const file = path.join(rootDir, PROJECT_CONFIG_FILENAME); |
| 224 | |
| 225 | let mtimeMs: number; |
| 226 | try { |
| 227 | mtimeMs = fs.statSync(file).mtimeMs; |
| 228 | } catch { |
| 229 | // No config file — drop any stale cache entry and return the default. |
| 230 | cache.delete(rootDir); |
| 231 | return EMPTY_CONFIG; |
| 232 | } |
| 233 | |
| 234 | const entry = cache.get(rootDir); |
| 235 | if (entry && entry.mtimeMs === mtimeMs) return entry.config; |
| 236 | |
| 237 | const config = parseConfig(file); |
| 238 | cache.set(rootDir, { mtimeMs, config }); |
| 239 | return config; |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Load the validated extension overrides for a project, mtime-cached. |
no test coverage detected