20 lines
1017 B
JavaScript
20 lines
1017 B
JavaScript
// Generated by dsh-plugin-prepare. Do not edit.
|
|
const manifest = {"name":"headless-repository-fixture","skills":["dsh-plugin-assets/skills/0"]}
|
|
// Value mirror: Cordis const enum FiberState.ACTIVE; keep aligned with dsh-repository-plugin source.ts.
|
|
const FIBER_ACTIVE = 2
|
|
export const name = "headless-repository-fixture"
|
|
export const inject = ["loader","skills"]
|
|
async function mount(ctx, plugin, label, config) {
|
|
const fiber = ctx.plugin(plugin, config)
|
|
await fiber
|
|
if (fiber.state !== FIBER_ACTIVE) {
|
|
const missing = Object.keys(fiber.inject).filter(service => fiber.ctx.get(service) === undefined)
|
|
throw new Error(`${label} did not activate (waiting for services: ${missing.join(', ') || 'unknown'})`)
|
|
}
|
|
}
|
|
export async function apply(ctx) {
|
|
const runtime = ctx.loader.builtins["dsh-repository-plugin"]
|
|
if (runtime === undefined) throw new Error("missing Cordis builtin dsh-repository-plugin")
|
|
await mount(ctx, runtime, 'repository Plugin runtime', { baseUrl: import.meta.url, manifest })
|
|
}
|