@@ -642,7 +642,7 @@ export default class Package {
642642 return this . npm . api . getOutdatedDependencies ( { all } ) ;
643643 }
644644
645- async updateDependencies ( { all, outdated, linked, missing , install, reinstall, commit, quiet, confirmInstall, outdatedDependencies, cache = { } } = { } ) {
645+ async updateDependencies ( { all, outdated, linked, install, reinstall, commit, quiet, confirmInstall, outdatedDependencies, cache = { } } = { } ) {
646646 if ( ! this . dependencies . hasDependencies ) return result ( 200 ) ;
647647
648648 var res ;
@@ -657,8 +657,8 @@ export default class Package {
657657
658658 outdatedDependencies ||= { } ;
659659
660- // add linked deps
661- if ( linked ) {
660+ // add missed / linked deps
661+ {
662662 const linkedDependencies = await this . #getLinkedDependencies( ) ;
663663
664664 for ( const dependency of linkedDependencies . values ( ) ) {
@@ -669,10 +669,15 @@ export default class Package {
669669 outdatedDependencies [ dependency . name ] = [ outdatedDependencies [ dependency . name ] ] ;
670670 }
671671
672- outdatedDependencies [ dependency . name ] . push ( {
673- "location" : "-" ,
674- "linked" : dependency . link || true ,
675- } ) ;
672+ if ( dependency . missed || ( linked && dependency . link ) ) {
673+ outdatedDependencies [ dependency . name ] . push ( {
674+
675+ // XXX location
676+ "location" : "-" ,
677+ "missed" : dependency . missed ,
678+ "linked" : dependency . link ,
679+ } ) ;
680+ }
676681 }
677682 }
678683
@@ -690,13 +695,12 @@ export default class Package {
690695 specs = [ outdatedDependencies [ name ] ] ;
691696 }
692697
693- const index = { } ,
694- locations = { } ;
698+ const index = { } ;
695699
696700 for ( const spec of specs ) {
697701
698702 // group specs by id
699- const id = ` ${ spec . location } / ${ spec . current } / ${ spec . wanted } / ${ spec . latest } ` ;
703+ const id = spec . location ;
700704
701705 index [ id ] ??= {
702706 name,
@@ -705,19 +709,12 @@ export default class Package {
705709 "latest" : spec . latest ,
706710 "location" : spec . location ,
707711 "dependent" : new Set ( ) ,
712+ "missed" : spec . missed ,
708713 "linked" : spec . linked ,
709714 "topLevel" : this . dependencies . has ( name ) && spec . location === path . join ( this . root , "node_modules" , name ) ,
710715 } ;
711716
712717 index [ id ] . dependent . add ( spec . dependent ) ;
713-
714- // detect updatable by location
715- if ( spec . current === spec . wanted ) {
716- locations [ spec . location ] = false ;
717- }
718- else if ( locations [ spec . location ] !== false ) {
719- locations [ spec . location ] = true ;
720- }
721718 }
722719
723720 specs = Object . values ( index ) . map ( spec => {
@@ -734,20 +731,25 @@ export default class Package {
734731 // include installed, updatable deps by default
735732 let include ;
736733
734+ // linked
737735 if ( spec . linked ) {
738- spec . updatable = true ;
739736
740- include = true ;
737+ // XXX
738+ if ( linked ) {
739+ spec . updatable = true ;
740+
741+ include = true ;
742+ }
741743 }
742744 else {
743- spec . updatable = locations [ spec . location ] ;
745+ spec . updatable = spec . current !== spec . wanted ;
744746
745747 if ( spec . updatable && spec . current ) {
746748 include = true ;
747749 }
748750 }
749751
750- // include outdated deps
752+ // include top-level outdated deps
751753 if ( outdated && spec . outdated && spec . topLevel ) {
752754 include = true ;
753755 }
@@ -757,8 +759,8 @@ export default class Package {
757759 include = true ;
758760 }
759761
760- // include misseing deps
761- if ( missing && ! spec . current ) {
762+ // include missed deps
763+ if ( spec . missed ) {
762764 include = true ;
763765 }
764766
@@ -841,7 +843,7 @@ export default class Package {
841843 "format" : ( value , row ) => {
842844 if ( ! value ) {
843845 if ( row . linked === true ) {
844- return ansi . error ( " MISSING " ) ;
846+ return ansi . error ( " MISSED " ) ;
845847 }
846848 else if ( row . linked ) {
847849 return ansi . error ( " LINKED " ) ;
@@ -1565,7 +1567,7 @@ export default class Package {
15651567 dependencies . set ( name , {
15661568 name,
15671569 location,
1568- "link " : null ,
1570+ "missed " : true ,
15691571 } ) ;
15701572 }
15711573
0 commit comments