feat(repository-plugin): load trusted package code
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
// Generated by dsh-plugin-prepare. Do not edit.
|
||||
const manifest = {"name":"headless-repository-fixture","skills":["dsh-plugin-assets/skills/0"]}
|
||||
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 ctx.plugin(runtime, { baseUrl: import.meta.url, manifest })
|
||||
await mount(ctx, runtime, 'repository Plugin runtime', { baseUrl: import.meta.url, manifest })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user