UNPKG

every-plugin

Version:
55 lines (53 loc) 1.59 kB
import { createPluginRuntime } from "../runtime/index.mjs"; //#region src/testing/index.ts /** * Converts old pluginMap format to new registry format */ function convertPluginMapToRegistry(oldRegistry, pluginMap) { const registry = {}; for (const [pluginId, ctor] of Object.entries(pluginMap)) { const oldEntry = oldRegistry[pluginId]; registry[pluginId] = { module: ctor, remote: oldEntry?.remoteUrl, version: oldEntry?.version, description: oldEntry?.description }; } return registry; } /** * Creates a plugin runtime for locally available plugins (non-remote). * Automatically infers type bindings from the plugin map, eliminating * the need for manual RegistryBindings definitions. * * @deprecated Use `createPluginRuntime` with module entries directly instead. * @example * ```ts * // Old API (deprecated) * const runtime = createLocalPluginRuntime( * { registry: { "my-plugin": { remoteUrl: "..." } }, secrets }, * { "my-plugin": MyPlugin } * ); * * // New API (recommended) * const runtime = createPluginRuntime({ * registry: { "my-plugin": { module: MyPlugin } }, * secrets * }); * ``` */ function createLocalPluginRuntime(config, pluginMap) { return createPluginRuntime({ registry: convertPluginMapToRegistry(config.registry, pluginMap), secrets: config.secrets, options: config.options }); } /** * @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead. */ const createTestPluginRuntime = createLocalPluginRuntime; //#endregion export { createLocalPluginRuntime, createTestPluginRuntime }; //# sourceMappingURL=index.mjs.map