pantoken / packages/plugin-kit/src / checkPlugins
Function: checkPlugins()
checkPlugins(
plugins,stage):PantokenPlugin[]
Beta
Filter a plugin list to those that participate in stage, warning about the rest.
Parameters
plugins
readonly PantokenPlugin[]
The registered plugins.
stage
The stage being run.
Returns
The plugins that have a hook for stage.
Example
Keep only the plugins that participate in a stage
ts
import { checkPlugins, definePlugin } from "@pantoken/plugin-kit";
const tokensOnly = definePlugin({ name: "tok", tokens: (c) => c.tokens });
const cssOnly = definePlugin({ name: "styles", css: () => ({ append: "" }) });
// Warns that "tok" has no css hook, then returns just the css plugin.
checkPlugins([tokensOnly, cssOnly], "css"); // → [cssOnly]