perf(plugins): avoid gateway method spread merge

This commit is contained in:
Peter Steinberger
2026-05-01 19:48:36 +01:00
parent 186ce4fe70
commit 1f1a735ef5

View File

@@ -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,