diff --git a/.changeset/modern-bulldogs-cross.md b/.changeset/modern-bulldogs-cross.md new file mode 100644 index 000000000000..90efd3c1e10d --- /dev/null +++ b/.changeset/modern-bulldogs-cross.md @@ -0,0 +1,7 @@ +--- +'@modern-js/plugin-v2': patch +--- + +feat: support isPluginExists for plugin manager + +feat: 插件支持 isPluginExists 方法 diff --git a/packages/toolkit/plugin-v2/src/manager.ts b/packages/toolkit/plugin-v2/src/manager.ts index 46258ba90f9f..22a10a76d1e5 100644 --- a/packages/toolkit/plugin-v2/src/manager.ts +++ b/packages/toolkit/plugin-v2/src/manager.ts @@ -171,5 +171,6 @@ export function createPluginManager(): PluginManager { getPlugins, addPlugins, clear, + isPluginExists: (name: string) => plugins.has(name), }; } diff --git a/packages/toolkit/plugin-v2/src/types/plugin.ts b/packages/toolkit/plugin-v2/src/types/plugin.ts index 6c7ebd1bc908..2b1ca2675ed2 100644 --- a/packages/toolkit/plugin-v2/src/types/plugin.ts +++ b/packages/toolkit/plugin-v2/src/types/plugin.ts @@ -48,4 +48,5 @@ export type PluginManager = { getPlugins: () => Plugin[]; addPlugins: (plugins: Array) => void; clear: () => void; + isPluginExist: (name: string) => boolean; };