fix: prefer bundled channel plugins over npm duplicates (#40094)

* fix: prefer bundled channel plugins over npm duplicates

* fix: tighten bundled plugin review follow-ups

* fix: address check gate follow-ups

* docs: add changelog for bundled plugin install fix

* fix: align lifecycle test formatting with CI oxfmt
This commit is contained in:
Tak Hoffman
2026-03-08 13:00:24 -05:00
committed by GitHub
parent 6c9b49a10b
commit 74624e619d
9 changed files with 343 additions and 50 deletions

View File

@@ -12,6 +12,36 @@ function isBareNpmPackageName(spec: string): boolean {
return /^[a-z0-9][a-z0-9-._~]*$/.test(trimmed);
}
export function resolveBundledInstallPlanForCatalogEntry(params: {
pluginId: string;
npmSpec: string;
findBundledSource: BundledLookup;
}): { bundledSource: BundledPluginSource } | null {
const pluginId = params.pluginId.trim();
const npmSpec = params.npmSpec.trim();
if (!pluginId || !npmSpec) {
return null;
}
const bundledById = params.findBundledSource({
kind: "pluginId",
value: pluginId,
});
if (bundledById?.pluginId === pluginId) {
return { bundledSource: bundledById };
}
const bundledBySpec = params.findBundledSource({
kind: "npmSpec",
value: npmSpec,
});
if (bundledBySpec?.pluginId === pluginId) {
return { bundledSource: bundledBySpec };
}
return null;
}
export function resolveBundledInstallPlanBeforeNpm(params: {
rawSpec: string;
findBundledSource: BundledLookup;