@@ -144,10 +144,10 @@ class LS extends ArboristWorkspaceCmd {
144
144
} ,
145
145
visit ( node ) {
146
146
// add to seenNodes as soon as we visit and not when the children are calculated in previous call
147
- if ( ! seenNodes . has ( node . path ) ) {
148
- seenNodes . set ( node . path , node )
149
- } else {
147
+ if ( seenNodes . has ( node . path ) ) {
150
148
node [ _dedupe ] = ! node [ _missing ]
149
+ } else {
150
+ seenNodes . set ( node . path , node )
151
151
}
152
152
153
153
node [ _problems ] = getProblems ( node , { global } )
@@ -507,33 +507,8 @@ const augmentNodesWithMetadata = ({
507
507
args,
508
508
currentDepth,
509
509
nodeResult,
510
- seenNodes,
511
510
} ) => ( node ) => {
512
- // if the original edge was a deduped dep, treeverse will fail to
513
- // revisit that node in tree traversal logic, so we make it so that
514
- // we have a diff obj for deduped nodes:
515
- if ( seenNodes . has ( node . path ) ) {
516
- node = {
517
- name : node . name ,
518
- version : node . version ,
519
- pkgid : node . pkgid ,
520
- target : node . target ,
521
- edgesOut : node . edgesOut ,
522
- children : node . children ,
523
- package : node . package ,
524
- path : node . path ,
525
- isLink : node . isLink ,
526
- realpath : node . realpath ,
527
- targetLocation : node . targetLocation ,
528
- [ _type ] : node [ _type ] ,
529
- [ _invalid ] : node [ _invalid ] ,
530
- [ _missing ] : node [ _missing ] ,
531
- // if it's missing, it's not deduped, it's just missing
532
- [ _dedupe ] : ! node [ _missing ] ,
533
- }
534
- }
535
-
536
- // _parent is going to be a ref to a treeverse-visited node (returned from
511
+ // _parent is going to be a ref to a traversed node (returned from
537
512
// getHumanOutputItem, getJsonOutputItem, etc) so that we have an easy
538
513
// shortcut to place new nodes in their right place during tree traversal
539
514
node [ _parent ] = nodeResult
@@ -542,11 +517,7 @@ const augmentNodesWithMetadata = ({
542
517
// _filteredBy is used to apply extra color info to the item that
543
518
// was used in args in order to filter
544
519
node [ _filteredBy ] = node [ _include ] =
545
- filterByPositionalArgs ( args , {
546
- node : seenNodes . has ( node . path )
547
- ? seenNodes . get ( node . path )
548
- : node ,
549
- } )
520
+ filterByPositionalArgs ( args , { node } )
550
521
// _depth keeps track of how many levels deep tree traversal currently is
551
522
// so that we can `npm ls --depth=1`
552
523
node [ _depth ] = currentDepth + 1
0 commit comments