From 831636f14c074cf59216fb84793f0e50c21049be Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Mon, 21 Jul 2025 21:27:17 +0700 Subject: [PATCH] fix(lib/plugins): fix depedency graphing logic --- lib/plugins/src/_internal/dependency-graph.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/plugins/src/_internal/dependency-graph.ts b/lib/plugins/src/_internal/dependency-graph.ts index cefaef1..64dcd00 100644 --- a/lib/plugins/src/_internal/dependency-graph.ts +++ b/lib/plugins/src/_internal/dependency-graph.ts @@ -33,15 +33,18 @@ export function computePendingNodes() { pRootNodes.clear() while (stack.length) { - const plugin = stack.pop()! - if (visited.has(plugin)) continue + const plugin = stack.shift()! - if (plugin.manifest.dependencies?.length) - for (const dep of getPluginDependencies(plugin)) stack.push(dep) - else { + if (visited.has(plugin)) { pListOrdered.push(plugin) - visited.add(plugin) + continue } + + if (plugin.manifest.dependencies?.length) { + for (const dep of getPluginDependencies(plugin)) stack.push(dep) + stack.push(plugin) + visited.add(plugin) + } else pListOrdered.push(plugin) } }