Skip to content

Commit 02b88a4

Browse files
authored
fix: updated pruning of v3 parser (#245)
1 parent 219993a commit 02b88a4

File tree

16 files changed

+5521
-4819
lines changed

16 files changed

+5521
-4819
lines changed

lib/nuget-parser/parsers/dotnet-core-v3-parser.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ function recursivelyPopulateNodes(
2121
allPackagesForFramework: Record<string, Target>,
2222
parentID: string,
2323
dependencies: Record<string, string>,
24-
visited: Set<string>,
2524
overrides: Overrides,
25+
visited?: Set<string>,
2626
) {
2727
if (!dependencies) {
2828
return;
2929
}
30+
const visitedCopy = new Set(visited);
3031
for (const [childName, childResolvedVersion] of Object.entries(
3132
dependencies,
3233
)) {
33-
const localVisited = visited || new Set<string>();
34+
const localVisited = visitedCopy || new Set<string>();
3435
// Ignore packages with specific prefixes, which for one reason or the other are no interesting and pollutes the
3536
// graph. Refer to comments on the individual elements in the ignore list for more information.
3637
if (
@@ -91,8 +92,8 @@ function recursivelyPopulateNodes(
9192
allPackagesForFramework,
9293
childID,
9394
childPkgEntry.dependencies,
94-
localVisited,
9595
overrides,
96+
localVisited,
9697
);
9798
}
9899
}
@@ -148,15 +149,12 @@ function buildDepGraph(
148149
return depGraphBuilder.build();
149150
}
150151

151-
const visited = new Set<string>();
152-
153152
// Start recursive population from direct dependencies
154153
recursivelyPopulateNodes(
155154
depGraphBuilder,
156155
allPackagesForFramework,
157156
'root-node',
158157
directDependencies, // Pass the direct dependencies object
159-
visited,
160158
overrides,
161159
);
162160

0 commit comments

Comments
 (0)