UNPKG

every-plugin

Version:
57 lines (55 loc) 1.75 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const require_runtime_index = require('../runtime/index.cjs'); //#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 require_runtime_index.createPluginRuntime({ registry: convertPluginMapToRegistry(config.registry, pluginMap), secrets: config.secrets, options: config.options }); } /** * @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead. */ const createTestPluginRuntime = createLocalPluginRuntime; //#endregion exports.createLocalPluginRuntime = createLocalPluginRuntime; exports.createTestPluginRuntime = createTestPluginRuntime; //# sourceMappingURL=index.cjs.map