mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 18:50:20 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user