From 0a494e32be2a516ecc07914a615155bd784685c7 Mon Sep 17 00:00:00 2001 From: caohuilin Date: Tue, 7 Jan 2025 10:24:51 +0800 Subject: [PATCH] feat: support isPluginExists for plugin manager --- .changeset/modern-bulldogs-cross.md | 7 +++++++ packages/toolkit/plugin-v2/src/manager.ts | 1 + packages/toolkit/plugin-v2/src/types/plugin.ts | 1 + 3 files changed, 9 insertions(+) create mode 100644 .changeset/modern-bulldogs-cross.md 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; };