fix(lib/plugins): prepend API plugins last

This commit is contained in:
PalmDevs 2026-04-07 22:34:34 +07:00
parent 5c892bb8a1
commit 7b651154a2
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -1,4 +1,5 @@
import { getInternalPluginMeta, getPluginDependencies } from '../_internal'
import { pApis } from './decorators'
import type { AnyPlugin } from '../_internal'
/// PLUGIN DEPENDENCY GRAPHING
@ -25,7 +26,14 @@ export const pPending = new Set<AnyPlugin>()
export function computePendingNodes() {
for (const plugin of pPending) resolvePluginGraph(plugin)
for (const plugin of pLeafOrSingleNodes) pListOrdered.unshift(plugin)
const apis: AnyPlugin[] = []
for (const plugin of pLeafOrSingleNodes) {
if (pApis.has(plugin)) apis.push(plugin)
else pListOrdered.unshift(plugin)
}
for (const plugin of apis) pListOrdered.unshift(plugin)
const stack = [...pRootNodes]
while (stack.length) {