fix(config): properly pass ts-based options to plugins

This commit is contained in:
saberzero1
2026-04-17 22:14:36 +02:00
parent cab4b523df
commit f370898c56
3 changed files with 94 additions and 18 deletions
+12
View File
@@ -19,6 +19,7 @@ export interface RegisteredComponent {
class ComponentRegistry {
private components = new Map<string, RegisteredComponent>()
private instanceCache = new Map<string, QuartzComponent>()
private optionOverrides = new Map<string, Record<string, unknown>>()
register(
name: string,
@@ -41,6 +42,17 @@ class ComponentRegistry {
return new Map(this.components)
}
/** Store option overrides for a plugin, keyed by plugin directory name. */
setOptionOverrides(pluginName: string, opts?: Record<string, unknown>): void {
if (!opts || Object.keys(opts).length === 0) return
this.optionOverrides.set(pluginName, { ...this.optionOverrides.get(pluginName), ...opts })
this.instanceCache.clear()
}
getOptionOverrides(pluginName: string): Record<string, unknown> | undefined {
return this.optionOverrides.get(pluginName)
}
/**
* Instantiate a component constructor with options, returning a cached instance
* if the same constructor was already called with equivalent options.