import { createEmptyPluginRegistry } from "./registry-empty.js"; import type { PluginRegistry } from "./registry-types.js"; import {
PLUGIN_REGISTRY_STATE,
type RegistryState,
type RegistrySurfaceState,
} from "./runtime-state.js";
function asPluginRegistry(registry: RegistryState["activeRegistry"]): PluginRegistry | null { return registry;
}
/** Pin the channel registry so that subsequent `setActivePluginRegistry` calls *donotreplacethechannelsnapshotusedby`getChannelPlugin`.Callat *gatewaystartupaftertheinitialpluginloadsothatconfig-schemareads
* and other non-primary registry loads cannot evict channel plugins. */
export function pinActivePluginChannelRegistry(registry: PluginRegistry) {
installSurfaceRegistry(state.channel, registry, true);
}
export function releasePinnedPluginChannelRegistry(registry?: PluginRegistry) { if (registry && state.channel.registry !== registry) { return;
}
installSurfaceRegistry(state.channel, state.activeRegistry, false);
}
/** Return the registry that should be used for channel plugin resolution. *Whenpinned,thisreturnsthestartupregistryregardlessofsubsequent
* `setActivePluginRegistry` calls. */
export function getActivePluginChannelRegistry(): PluginRegistry | null { return asPluginRegistry(state.channel.registry ?? state.activeRegistry);
}
export function getActivePluginChannelRegistryVersion(): number { return state.channel.registry ? state.channel.version : state.activeVersion;
}
export function requireActivePluginChannelRegistry(): PluginRegistry { const existing = getActivePluginChannelRegistry(); if (existing) { return existing;
} const created = requireActivePluginRegistry();
installSurfaceRegistry(state.channel, created, false); return created;
}
export function getActivePluginRegistryKey(): string | null { return state.key;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.