File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -24864,9 +24864,15 @@ function getParentPath(node, parentMap) {
2486424864 if (!parentMap) {
2486524865 return parentPath;
2486624866 }
24867+ const seen = /* @__PURE__ */ new WeakSet();
2486724868 let currentParent = parentMap.get(node);
2486824869 while (currentParent) {
2486924870 parentPath.push(`${currentParent.name}@${currentParent.version}`);
24871+ if (seen.has(currentParent)) {
24872+ parentPath.push("(circular)");
24873+ break;
24874+ }
24875+ seen.add(currentParent);
2487024876 currentParent = parentMap.get(currentParent);
2487124877 }
2487224878 return parentPath;
Original file line number Diff line number Diff line change @@ -27,9 +27,15 @@ function getParentPath(
2727 if ( ! parentMap ) {
2828 return parentPath ;
2929 }
30+ const seen = new WeakSet < ParsedDependency > ( ) ;
3031 let currentParent = parentMap . get ( node ) ;
3132 while ( currentParent ) {
3233 parentPath . push ( `${ currentParent . name } @${ currentParent . version } ` ) ;
34+ if ( seen . has ( currentParent ) ) {
35+ parentPath . push ( '(circular)' ) ;
36+ break ;
37+ }
38+ seen . add ( currentParent ) ;
3339 currentParent = parentMap . get ( currentParent ) ;
3440 }
3541 return parentPath ;
@@ -104,7 +110,6 @@ export function scanForDuplicates(
104110 }
105111 const versions = Array . from ( versionSet ) . sort ( ) ;
106112
107- // Build collapsible details showing where each version comes from
108113 const detailsLines : string [ ] = [ ] ;
109114 for ( const version of versions ) {
110115 const pathKey = `${ name } @${ version } ` ;
You can’t perform that action at this time.
0 commit comments