page wrnexusplugin { seo { title = "@wrnexus/plugin" description = "Plugin contracts, lifecycle hooks, composition, and framework integration." } view {
W WRNexusJS
Core · Package reference

@wrnexus/plugin

Plugin contracts, lifecycle hooks, composition, and framework integration.

v0.5.13Private registryCore

Install the package

After WorkRoot approves private registry access, install the release-aligned package:

bun add @wrnexus/plugin@0.5.13

Request preview access. Never put registry tokens in source control.

Deterministic WRNexusJS plugin contracts for configuration, AST/code transforms, diagnostics, development servers, production builds, and DevToolbar extensions.

Use definePlugin() and declare enforce, before, or after when ordering matters. Duplicate names and dependency cycles are rejected.

Complete TypeScript API

Generated from the exact installed package declarations.

export { PageAst, WrnDiagnostic } from '@wrnexus/syntax';
import { WrnexusPlugin, PluginInput, PluginContext, PluginRunner } from './types.js';
export { ClientRuntimeDefinition, ClientRuntimeInject, ClientRuntimeLoad, ClientRuntimeType, PackageAssetDefinition, PackageMigrationDefinition, PackagePluginManifest, PackageRouteDefinition, PackageStyleDefinition, PluginCommand, PluginContributions, PluginDevToolbarPanel, PluginOrder, TransformContext, WrnexusPackageManifest } from './types.js';
export { assertContributionId, contentTypeForPath, defaultClientRuntimePath, defaultPackageAssetPath, definePackageManifest, normalizeClientRuntime, normalizePackageAsset, validateStyleIds } from './manifest.js';
export { DiscoverPluginOptions, discoverPlugins } from './discovery.js';

declare function definePlugin(plugin: WrnexusPlugin): WrnexusPlugin;
declare function flattenPlugins(input: PluginInput, output?: WrnexusPlugin[]): WrnexusPlugin[];

/** Resolve plugin order deterministically and reject duplicates/cycles. */
declare function resolvePlugins(input: PluginInput): WrnexusPlugin[];
declare function createPluginRunner(input: PluginInput, context: PluginContext): PluginRunner;

export { PluginContext, PluginInput, PluginRunner, WrnexusPlugin, createPluginRunner, definePlugin, flattenPlugins, resolvePlugins };

Examples

Copy-ready examples from the installed package documentation.

Define an ordered plugin

import { definePlugin } from "@wrnexus/plugin";

export default definePlugin({
  name: "analytics",
  enforce: "post",
});

Resolve plugin execution order

import { resolvePlugins } from "@wrnexus/plugin";

const ordered = resolvePlugins([corePlugin, analyticsPlugin]);
} }