(input: {
api: Api
config: TuiConfig.Resolved & TuiConfig.HostMetadata
runtime: PluginRuntime
dispose?: () => void
disposeTimeoutMs?: number
})
| 1049 | } |
| 1050 | |
| 1051 | async function load(input: { |
| 1052 | api: Api |
| 1053 | config: TuiConfig.Resolved & TuiConfig.HostMetadata |
| 1054 | runtime: PluginRuntime |
| 1055 | dispose?: () => void |
| 1056 | disposeTimeoutMs?: number |
| 1057 | }) { |
| 1058 | const { api, config } = input |
| 1059 | const cwd = process.cwd() |
| 1060 | const slots = input.runtime.setupSlots(api) |
| 1061 | const next: RuntimeState = { |
| 1062 | directory: cwd, |
| 1063 | api, |
| 1064 | view: input.runtime, |
| 1065 | dispose: input.dispose, |
| 1066 | slots, |
| 1067 | plugins: [], |
| 1068 | plugins_by_id: new Map(), |
| 1069 | pending: new Map(), |
| 1070 | dispose_timeout_ms: input.disposeTimeoutMs ?? DISPOSE_TIMEOUT_MS, |
| 1071 | } |
| 1072 | runtime = next |
| 1073 | next.view.update({ |
| 1074 | commands: { |
| 1075 | activate: activatePlugin, |
| 1076 | deactivate: deactivatePlugin, |
| 1077 | add: addPlugin, |
| 1078 | install: installPlugin, |
| 1079 | }, |
| 1080 | status: listPluginStatus(next), |
| 1081 | }) |
| 1082 | try { |
| 1083 | const flags = await Effect.runPromise( |
| 1084 | Effect.gen(function* () { |
| 1085 | return yield* RuntimeFlags.Service |
| 1086 | }).pipe(Effect.provide(AppNodeBuilder.build(RuntimeFlags.node))), |
| 1087 | ) |
| 1088 | const pluginOrigins = config.plugin_origins ?? (await TuiConfig.pluginOrigins()) |
| 1089 | const records = Flag.OPENCODE_PURE ? [] : pluginOrigins |
| 1090 | if (Flag.OPENCODE_PURE && pluginOrigins.length) { |
| 1091 | } |
| 1092 | |
| 1093 | for (const item of internalTuiPlugins(flags)) { |
| 1094 | const entry = loadInternalPlugin(item) |
| 1095 | const meta = createMeta(entry.source, entry.spec, entry.target, undefined, entry.id) |
| 1096 | addPluginEntry(next, { |
| 1097 | id: entry.id, |
| 1098 | load: entry, |
| 1099 | meta, |
| 1100 | themes: {}, |
| 1101 | plugin: entry.module.tui, |
| 1102 | enabled: item.enabled ?? true, |
| 1103 | }) |
| 1104 | } |
| 1105 | |
| 1106 | const ready = await resolveExternalPlugins(records, () => TuiConfig.waitForDependencies()) |
| 1107 | await addExternalPluginEntries(next, ready) |
| 1108 |
no test coverage detected