@@ -7,7 +7,6 @@ const pacote = require('pacote')
77const promiseAllRejectLate = require ( 'promise-all-reject-late' )
88const runScript = require ( '@npmcli/run-script' )
99const { callLimit : promiseCallLimit } = require ( 'promise-call-limit' )
10- const { checkEngine, checkPlatform } = require ( 'npm-install-checks' )
1110const { depth : dfwalk } = require ( 'treeverse' )
1211const { dirname, resolve, relative, join } = require ( 'node:path' )
1312const { log, time } = require ( 'proc-log' )
@@ -74,7 +73,6 @@ module.exports = cls => class Reifier extends cls {
7473 #dryRun
7574 #nmValidated = new Set ( )
7675 #omit
77- #omitted
7876 #retiredPaths = { }
7977 #retiredUnchanged = { }
8078 #savePrefix
@@ -99,7 +97,6 @@ module.exports = cls => class Reifier extends cls {
9997 }
10098
10199 this . #omit = new Set ( options . omit )
102- this . #omitted = new Set ( )
103100
104101 // start tracker block
105102 this . addTracker ( 'reify' )
@@ -132,15 +129,17 @@ module.exports = cls => class Reifier extends cls {
132129 this . idealTree = oldTree
133130 }
134131 await this [ _saveIdealTree ] ( options )
135- // clean omitted
136- for ( const node of this . #omitted) {
137- node . parent = null
132+ // clean inert
133+ for ( const node of this . idealTree . inventory . values ( ) ) {
134+ if ( node . inert ) {
135+ node . parent = null
136+ }
138137 }
139138 // clean up any trash that is still in the tree
140139 for ( const path of this [ _trashList ] ) {
141140 const loc = relpath ( this . idealTree . realpath , path )
142141 const node = this . idealTree . inventory . get ( loc )
143- if ( node && node . root === this . idealTree && ! node . ideallyInert ) {
142+ if ( node && node . root === this . idealTree ) {
144143 node . parent = null
145144 }
146145 }
@@ -228,18 +227,6 @@ module.exports = cls => class Reifier extends cls {
228227 this . idealTree . meta . hiddenLockfile = true
229228 this . idealTree . meta . lockfileVersion = defaultLockfileVersion
230229
231- // Preserve inertness for failed stuff.
232- if ( this . actualTree ) {
233- for ( const [ loc , actual ] of this . actualTree . inventory . entries ( ) ) {
234- if ( actual . ideallyInert ) {
235- const ideal = this . idealTree . inventory . get ( loc )
236- if ( ideal ) {
237- ideal . ideallyInert = true
238- }
239- }
240- }
241- }
242-
243230 this . actualTree = this . idealTree
244231 this . idealTree = null
245232
@@ -465,7 +452,6 @@ module.exports = cls => class Reifier extends cls {
465452 // and ideal trees.
466453 this . diff = Diff . calculate ( {
467454 omit : this . #omit,
468- omitted : this . #omitted,
469455 shrinkwrapInflated : this . #shrinkwrapInflated,
470456 filterNodes,
471457 actual : this . actualTree ,
@@ -566,9 +552,6 @@ module.exports = cls => class Reifier extends cls {
566552 // retire the same path at the same time.
567553 const dirsChecked = new Set ( )
568554 return promiseAllRejectLate ( leaves . map ( async node => {
569- if ( node . ideallyInert ) {
570- return
571- }
572555 for ( const d of walkUp ( node . path ) ) {
573556 if ( d === node . top . path ) {
574557 break
@@ -662,18 +645,7 @@ module.exports = cls => class Reifier extends cls {
662645 const timeEnd = time . start ( `reifyNode:${ node . location } ` )
663646 this . addTracker ( 'reify' , node . name , node . location )
664647
665- const { npmVersion, nodeVersion, cpu, os, libc } = this . options
666648 const p = Promise . resolve ( ) . then ( async ( ) => {
667- // when we reify an optional node, check the engine and platform
668- // first. be sure to ignore the --force and --engine-strict flags,
669- // since we always want to skip any optional packages we can't install.
670- // these checks throwing will result in a rollback and removal
671- // of the mismatches
672- // eslint-disable-next-line promise/always-return
673- if ( node . optional ) {
674- checkEngine ( node . package , npmVersion , nodeVersion , false )
675- checkPlatform ( node . package , false , { cpu, os, libc } )
676- }
677649 await this [ _checkBins ] ( node )
678650 await this . #extractOrLink( node )
679651 const { _id, deprecated } = node . package
@@ -707,10 +679,6 @@ module.exports = cls => class Reifier extends cls {
707679 }
708680
709681 async #extractOrLink ( node ) {
710- if ( node . ideallyInert ) {
711- return
712- }
713-
714682 const nm = resolve ( node . parent . path , 'node_modules' )
715683 await this . #validateNodeModules( nm )
716684
@@ -791,9 +759,9 @@ module.exports = cls => class Reifier extends cls {
791759 [ _handleOptionalFailure ] ( node , p ) {
792760 return ( node . optional ? p . catch ( ( ) => {
793761 const set = optionalSet ( node )
794- for ( node of set ) {
762+ for ( const node of set ) {
795763 log . verbose ( 'reify' , 'failed optional dependency' , node . path )
796- node . ideallyInert = true
764+ node . inert = true
797765 this [ _addNodeToTrashList ] ( node )
798766 }
799767 } ) : p ) . then ( ( ) => node )
@@ -1165,9 +1133,6 @@ module.exports = cls => class Reifier extends cls {
11651133
11661134 this . #retiredUnchanged[ retireFolder ] = [ ]
11671135 return promiseAllRejectLate ( diff . unchanged . map ( node => {
1168- if ( node . ideallyInert ) {
1169- return
1170- }
11711136 // no need to roll back links, since we'll just delete them anyway
11721137 if ( node . isLink ) {
11731138 return mkdir ( dirname ( node . path ) , { recursive : true , force : true } )
@@ -1247,7 +1212,7 @@ module.exports = cls => class Reifier extends cls {
12471212 // skip links that only live within node_modules as they are most
12481213 // likely managed by packages we installed, we only want to rebuild
12491214 // unchanged links we directly manage
1250- const linkedFromRoot = ( node . parent === tree && ! node . ideallyInert ) || node . target . fsTop === tree
1215+ const linkedFromRoot = ( node . parent === tree && ! node . inert ) || node . target . fsTop === tree
12511216 if ( node . isLink && linkedFromRoot ) {
12521217 nodes . push ( node )
12531218 }
0 commit comments