refactor(sbom): use one ordered dependency set (#17424)

This commit is contained in:
Vincent Koc
2026-12-06 14:55:14 +08:00
committed by GitHub
parent 3a05b5347a
commit bfbfd4316d
+3 -8
View File
@@ -178,14 +178,9 @@ const bomRefsFor = (purls: readonly string[]): string[] => {
/** First-seen bom-refs, including a recorded self-edge. */
const uniqueRefs = (refs: readonly (string | undefined)[]): string[] => {
const seen = new Set<string>();
const selected: string[] = [];
for (const ref of refs) {
if (ref === undefined || seen.has(ref)) continue;
seen.add(ref);
selected.push(ref);
}
return selected;
const selected = new Set<string>();
for (const ref of refs) if (ref !== undefined) selected.add(ref);
return [...selected];
};
/** An empty, `.` or `..` segment: empty, rooted, relative or trailing-slash paths. */