method IKernelApplication.unregister
Since 0.6.0
IKernelApplication.unregister(name: string): boolean

Removes a pending plugin by name before the application starts.

Plugins do not run until start(), so removing one here means its register() — and any eager side effect inside it, such as a database adapter's connect() — never happens at all. That is the one thing overriding a capability cannot do: an override replaces what consumers resolve, after the real plugin has already run.

Removing a plugin another plugin declares in dependencies is not refused here; start() reports it — naming the dependent plugin and the unsatisfied capability, though not the removed plugin's own name when the two differ (database-plugin provides database).

Removes every pending plugin carrying the name, not the first. Two may share one — the kernel refuses duplicates at start(), not at register() — and dropping one would leave the other running while the caller was told the name was gone.

Examples

Example 1

const app = createApp();            // the project's own composition root
app.unregister('database');         // the real adapter never connects
await app.start();

Parameters

name: string

The plugin's name, as declared on IPlugin

Return Type

boolean

true when at least one plugin was removed, false when none carried that name

Throws

Error

If startup has begun — including after a start() that FAILED, since the plugins that ran before the failure cannot be un-run

Usage

import { type IKernelApplication } from "kernel/src/index.ts";