Files
openidea/src/platform/libraries.ts
T
l0ng-ai 3407195dc0 fix(libraries): discover dependencies across project modules (#2022)
Fixes #1977. External Libraries only inspected the project root and cached incomplete results, so ecosystems in nested modules/workspace members (e.g. a pnpm frontend under a Cargo + Maven repo) and dependencies installed after the first listing never appeared. Providers now discover module/workspace roots (package.json workspaces, pnpm-workspace.yaml, Cargo members, nested manifests), follow pnpm symlinks, include local Cargo path dependencies, stream groups to the Project view as each provider finishes so a slow cargo metadata doesn't hide the others, log failures instead of dropping them, and don't cache cancelled or failed results.
2026-11-08 00:05:41 +08:00

18 lines
632 B
TypeScript

import type { LibraryGroup } from "@/bindings";
/** Merge shared SDKs and package groups without losing different module roots. */
export function mergeLibraryGroups(groups: readonly LibraryGroup[]): LibraryGroup[] {
const merged: LibraryGroup[] = [];
for (const group of groups) {
const existing = merged.find((g) => g.kind === group.kind && g.name === group.name);
if (!existing) {
merged.push({ ...group, roots: [...group.roots] });
continue;
}
for (const root of group.roots) {
if (!existing.roots.some((r) => r.path === root.path)) existing.roots.push(root);
}
}
return merged;
}