refactor(plugins): remove dead contribution owner wrappers (#105224)

This commit is contained in:
Vincent Koc
2026-07-12 17:17:54 +08:00
committed by GitHub
parent e580275464
commit 25f00f9881
2 changed files with 42 additions and 64 deletions
@@ -70,18 +70,6 @@ export type ResolveProviderOwnersParams = PluginRegistryContributionOptions & {
providerId: string;
};
export type ResolveChannelOwnersParams = PluginRegistryContributionOptions & {
channelId: string;
};
export type ResolveCliBackendOwnersParams = PluginRegistryContributionOptions & {
cliBackendId: string;
};
export type ResolveSetupProviderOwnersParams = PluginRegistryContributionOptions & {
setupProviderId: string;
};
export type ResolveManifestContractPluginIdsParams = LoadPluginRegistryParams & {
contract: PluginManifestContractListKey;
origin?: PluginOrigin;
@@ -412,44 +400,6 @@ export function resolveProviderOwners(params: ResolveProviderOwnersParams): read
});
}
export function resolveChannelOwners(params: ResolveChannelOwnersParams): readonly string[] {
const channelId = normalizeContributionId(params.channelId);
if (!channelId) {
return [];
}
return resolvePluginContributionOwners({
...params,
contribution: "channels",
matches: channelId,
});
}
export function resolveCliBackendOwners(params: ResolveCliBackendOwnersParams): readonly string[] {
const cliBackendId = normalizeContributionId(params.cliBackendId);
if (!cliBackendId) {
return [];
}
return resolvePluginContributionOwners({
...params,
contribution: "cliBackends",
matches: cliBackendId,
});
}
export function resolveSetupProviderOwners(
params: ResolveSetupProviderOwnersParams,
): readonly string[] {
const setupProviderId = normalizeContributionId(params.setupProviderId);
if (!setupProviderId) {
return [];
}
return resolvePluginContributionOwners({
...params,
contribution: "setupProviders",
matches: setupProviderId,
});
}
export function resolveManifestContractPluginIds(
params: ResolveManifestContractPluginIdsParams,
): string[] {
+42 -14
View File
@@ -30,14 +30,11 @@ import {
loadPluginRegistrySnapshotWithMetadata,
normalizePluginsConfigWithRegistry,
refreshPluginRegistry,
resolveChannelOwners,
resolveCliBackendOwners,
resolveManifestContractOwnerPluginId,
resolveManifestContractPluginIds,
resolveManifestContractPluginIdsByCompatibilityRuntimePath,
resolvePluginContributionOwners,
resolveProviderOwners,
resolveSetupProviderOwners,
} from "./plugin-registry.js";
import { resolvePluginPath } from "./registry.js";
import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js";
@@ -261,8 +258,20 @@ describe("plugin registry facade", () => {
matches: "demo-alias",
}),
).toEqual(["demo"]);
expect(resolveChannelOwners({ index, channelId: "demo-chat" })).toEqual(["demo"]);
expect(resolveCliBackendOwners({ index, cliBackendId: "demo-cli" })).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
index,
contribution: "channels",
matches: "demo-chat",
}),
).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
index,
contribution: "cliBackends",
matches: "demo-cli",
}),
).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
index,
@@ -270,7 +279,13 @@ describe("plugin registry facade", () => {
matches: (contributionId) => contributionId === "demo-cli",
}),
).toEqual(["demo"]);
expect(resolveSetupProviderOwners({ index, setupProviderId: "demo-setup" })).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
index,
contribution: "setupProviders",
matches: "demo-setup",
}),
).toEqual(["demo"]);
expect(resolveManifestContractPluginIds({ index, contract: "webSearchProviders" })).toEqual([
"demo",
]);
@@ -346,14 +361,27 @@ describe("plugin registry facade", () => {
expect(listPluginContributionIds({ lookUpTable, contribution: "providers" })).toEqual(["demo"]);
expect(resolveProviderOwners({ lookUpTable, providerId: "DEMO" })).toEqual(["demo"]);
expect(resolveChannelOwners({ lookUpTable, channelId: "demo-chat" })).toEqual(["demo"]);
expect(resolveCliBackendOwners({ lookUpTable, cliBackendId: "demo-cli" })).toEqual(["demo"]);
expect(resolveCliBackendOwners({ lookUpTable, cliBackendId: "demo-setup-cli" })).toEqual([
"demo",
]);
expect(resolveSetupProviderOwners({ lookUpTable, setupProviderId: "demo-setup" })).toEqual([
"demo",
]);
expect(
resolvePluginContributionOwners({
lookUpTable,
contribution: "channels",
matches: "demo-chat",
}),
).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
lookUpTable,
contribution: "cliBackends",
matches: "demo-cli",
}),
).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
lookUpTable,
contribution: "setupProviders",
matches: "demo-setup",
}),
).toEqual(["demo"]);
expect(
resolvePluginContributionOwners({
lookUpTable,