MCPcopy Index your code
hub / github.com/anomalyco/opencode / load

Function load

packages/opencode/src/plugin/loader.ts:136–145  ·  view source on GitHub ↗
(row: Resolved)

Source from the content-addressed store, hash-verified

134
135 // Import the resolved module only after all earlier validation has succeeded.
136 export async function load(row: Resolved): Promise<{ ok: true; value: Loaded } | { ok: false; error: unknown }> {
137 let mod
138 try {
139 mod = await import(row.entry)
140 } catch (error) {
141 return { ok: false, error }
142 }
143 if (!mod) return { ok: false, error: new Error(`Plugin ${row.spec} module is empty`) }
144 return { ok: true, value: { ...row, mod } }
145 }
146
147 // Run one candidate through the full pipeline: resolve, optionally surface a missing entry,
148 // import the module, and finally let the caller transform the loaded plugin into any result type.

Callers 1

attemptFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected