{"version":3,"file":"index.mjs","names":[],"sources":["../../src/testing/index.ts"],"sourcesContent":["import type { LoadedPluginWithBinding } from \"../plugin\";\nimport { createPluginRuntime } from \"../runtime\";\nimport type { AnyPluginConstructor, PluginRegistryEntry, PluginRuntimeConfig } from \"../types\";\n\nexport type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;\n\n/**\n * Simplified type inference for local plugin maps.\n * Just use the constructor types directly.\n *\n * @example\n * ```ts\n * const pluginMap = { \"my-plugin\": MyPlugin } as const;\n * type MyBindings = InferBindingsFromMap<typeof pluginMap>;\n * ```\n */\nexport type InferBindingsFromMap<T extends PluginMap> = {\n  [K in keyof T]: T[K];\n};\n\n/**\n * Converts old pluginMap format to new registry format\n */\nfunction convertPluginMapToRegistry<T extends PluginMap>(\n  oldRegistry: Record<string, { remoteUrl: string; version?: string; description?: string }>,\n  pluginMap: T,\n): Record<keyof T, PluginRegistryEntry> {\n  const registry: Record<string, PluginRegistryEntry> = {};\n\n  for (const [pluginId, ctor] of Object.entries(pluginMap)) {\n    const oldEntry = oldRegistry[pluginId];\n    registry[pluginId] = {\n      module: ctor as AnyPluginConstructor,\n      remote: oldEntry?.remoteUrl,\n      version: oldEntry?.version,\n      description: oldEntry?.description,\n    };\n  }\n\n  return registry as Record<keyof T, PluginRegistryEntry>;\n}\n\n/**\n * Creates a plugin runtime for locally available plugins (non-remote).\n * Automatically infers type bindings from the plugin map, eliminating\n * the need for manual RegistryBindings definitions.\n *\n * @deprecated Use `createPluginRuntime` with module entries directly instead.\n * @example\n * ```ts\n * // Old API (deprecated)\n * const runtime = createLocalPluginRuntime(\n *   { registry: { \"my-plugin\": { remoteUrl: \"...\" } }, secrets },\n *   { \"my-plugin\": MyPlugin }\n * );\n *\n * // New API (recommended)\n * const runtime = createPluginRuntime({\n *   registry: { \"my-plugin\": { module: MyPlugin } },\n *   secrets\n * });\n * ```\n */\nexport function createLocalPluginRuntime<TMap extends PluginMap>(\n  config: {\n    registry: Record<string, { remoteUrl: string; version?: string; description?: string }>;\n    secrets?: Record<string, string>;\n    options?: any;\n  },\n  pluginMap: TMap,\n) {\n  const newRegistry = convertPluginMapToRegistry(config.registry, pluginMap);\n\n  return createPluginRuntime({\n    registry: newRegistry,\n    secrets: config.secrets,\n    options: config.options,\n  });\n}\n\n/**\n * @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead.\n */\nexport const createTestPluginRuntime = createLocalPluginRuntime;\n\nexport type { EveryPlugin, PluginRegistry, RegisteredPlugins } from \"../types\";\nexport type { PluginRuntimeConfig };\n"],"mappings":";;;;;;AAuBA,SAAS,2BACP,aACA,WACsC;CACtC,MAAM,WAAgD,EAAE;AAExD,MAAK,MAAM,CAAC,UAAU,SAAS,OAAO,QAAQ,UAAU,EAAE;EACxD,MAAM,WAAW,YAAY;AAC7B,WAAS,YAAY;GACnB,QAAQ;GACR,QAAQ,UAAU;GAClB,SAAS,UAAU;GACnB,aAAa,UAAU;GACxB;;AAGH,QAAO;;;;;;;;;;;;;;;;;;;;;;;AAwBT,SAAgB,yBACd,QAKA,WACA;AAGA,QAAO,oBAAoB;EACzB,UAHkB,2BAA2B,OAAO,UAAU,UAGzC;EACrB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB,CAAC;;;;;AAMJ,MAAa,0BAA0B"}