From 5d7ac417babf44ff8bead59b863355c0464e49c1 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Fri, 25 Jul 2025 20:10:33 +0700 Subject: [PATCH] fix(lib/plugins): some plugins with dependents being duplicated in ordered plugin list --- lib/plugins/src/_internal/dependency-graph.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/plugins/src/_internal/dependency-graph.ts b/lib/plugins/src/_internal/dependency-graph.ts index 64dcd00..d24f286 100644 --- a/lib/plugins/src/_internal/dependency-graph.ts +++ b/lib/plugins/src/_internal/dependency-graph.ts @@ -24,14 +24,10 @@ export const pPending = new Set() export function computePendingNodes() { for (const plugin of pPending) resolvePluginGraph(plugin) - pPending.clear() for (const plugin of pLeafOrSingleNodes) pListOrdered.unshift(plugin) - pLeafOrSingleNodes.clear() const stack = [...pRootNodes] - pRootNodes.clear() - while (stack.length) { const plugin = stack.shift()! @@ -41,11 +37,17 @@ export function computePendingNodes() { } if (plugin.manifest.dependencies?.length) { - for (const dep of getPluginDependencies(plugin)) stack.push(dep) + for (const dep of getPluginDependencies(plugin)) + if (!pLeafOrSingleNodes.has(dep)) stack.push(dep) + stack.push(plugin) visited.add(plugin) } else pListOrdered.push(plugin) } + + pPending.clear() + pLeafOrSingleNodes.clear() + pRootNodes.clear() } export function resolvePluginGraph(plugin: AnyPlugin) {