(plugins: LoadedPlugin[])
| 3282 | * Called after loadAllPlugins resolves. |
| 3283 | */ |
| 3284 | export function cachePluginSettings(plugins: LoadedPlugin[]): void { |
| 3285 | const settings = mergePluginSettings(plugins) |
| 3286 | setPluginSettingsBase(settings) |
| 3287 | // Only bust the session settings cache if there are actually plugin settings |
| 3288 | // to merge. In the common case (no plugins, or plugins without settings) the |
| 3289 | // base layer is empty and loadSettingsFromDisk would produce the same result |
| 3290 | // anyway — resetting here would waste ~17ms on startup re-reading and |
| 3291 | // re-validating every settings file on the next getSettingsWithErrors() call. |
| 3292 | if (settings && Object.keys(settings).length > 0) { |
| 3293 | resetSettingsCache() |
| 3294 | logForDebugging( |
| 3295 | `Cached plugin settings with keys: ${Object.keys(settings).join(', ')}`, |
| 3296 | ) |
| 3297 | } |
| 3298 | } |
| 3299 | |
| 3300 | /** |
| 3301 | * Type predicate: check if a value is a non-null, non-array object (i.e., a record). |
no test coverage detected