From 1f1a735ef56efba5693d1be2deb87af61335ff6e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 19:48:36 +0100 Subject: [PATCH] perf(plugins): avoid gateway method spread merge --- src/plugins/loader.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/loader.ts b/src/plugins/loader.ts index c36c84eeca9..1c9e3625203 100644 --- a/src/plugins/loader.ts +++ b/src/plugins/loader.ts @@ -758,6 +758,14 @@ function hasExplicitCompatibilityInputs(options: PluginLoadOptions): boolean { ); } +function resolveCoreGatewayMethodNames(options: PluginLoadOptions): string[] { + const names = new Set(options.coreGatewayMethodNames ?? []); + for (const name of Object.keys(options.coreGatewayHandlers ?? {})) { + names.add(name); + } + return Array.from(names).toSorted(); +} + function pluginLoadOptionsMatchCacheKey( options: PluginLoadOptions, expectedCacheKey: string, @@ -890,12 +898,7 @@ function resolvePluginLoadCacheContext(options: PluginLoadOptions = {}) { const preferSetupRuntimeForChannelPlugins = options.preferSetupRuntimeForChannelPlugins === true; const shouldInstallBundledRuntimeDeps = options.installBundledRuntimeDeps !== false; const runtimeSubagentMode = resolveRuntimeSubagentMode(options.runtimeOptions); - const coreGatewayMethodNames = Array.from( - new Set([ - ...(options.coreGatewayMethodNames ?? []), - ...Object.keys(options.coreGatewayHandlers ?? {}), - ]), - ).toSorted(); + const coreGatewayMethodNames = resolveCoreGatewayMethodNames(options); const installRecords = { ...loadInstalledPluginIndexInstallRecordsSync({ env }), ...cfg.plugins?.installs,