Skip to content

pantoken / packages/plugin-kit/src / validatePlugin

Function: validatePlugin()

validatePlugin(plugin): void

Beta

Assert that a plugin has a valid structure: non-empty name, all hooks are functions, and no hook key falls outside the recognised stage set.

Called automatically by definePlugin. Export it so hand-authored plugins can be validated before passing them to a stage runner.

Parameters

plugin

PantokenPlugin

Returns

void

Throws

When the plugin fails structural validation.

Example

Validate a hand-authored plugin

ts
import { validatePlugin } from "@pantoken/plugin-kit";

validatePlugin({ name: "brand", css: () => ({}) }); // ok
validatePlugin({ name: "", css: () => ({}) });      // throws