Skip to content

pantoken-root / packages/plugin-kit/src / mergePlugin

函数: mergePlugin() ​

mergePlugin(...plugins): PantokenPlugin

Beta

将多个插件合并为一个,使用 extendPlugin 从左到右折叠。

参数 ​

plugins ​

...PantokenPlugin[]

要合并的插件(至少一个)。

返回值 ​

PantokenPlugin

单个带品牌的插件。

示例 ​

将同级插件合并为一个

ts
import { capabilitiesOf, definePlugin, mergePlugin } from "@pantoken/plugin-kit";

const brand = definePlugin({ name: "brand", tokens: (c) => c.tokens });
const glyphs = definePlugin({ name: "glyphs", icons: () => [{ name: "star" }] });

const combined = mergePlugin(brand, glyphs);
capabilitiesOf(combined); // → ["tokens", "icons"]