Skip to content

Commit 5424f3e

Browse files
committed
remove ideallyInert from hidden lockfile
1 parent 73820c6 commit 5424f3e

File tree

16 files changed

+79
-1471
lines changed

16 files changed

+79
-1471
lines changed

package-lock.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5249,6 +5249,21 @@
52495249
"dev": true,
52505250
"license": "ISC"
52515251
},
5252+
"node_modules/fsevents": {
5253+
"version": "2.3.3",
5254+
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
5255+
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
5256+
"dev": true,
5257+
"hasInstallScript": true,
5258+
"license": "MIT",
5259+
"optional": true,
5260+
"os": [
5261+
"darwin"
5262+
],
5263+
"engines": {
5264+
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
5265+
}
5266+
},
52525267
"node_modules/function-bind": {
52535268
"version": "1.1.2",
52545269
"dev": true,

workspaces/arborist/lib/arborist/build-ideal-tree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
337337
})
338338

339339
.then(tree => {
340-
// search the virtual tree for invalid edges, if any are found add their source to
340+
// search the virtual tree for missing/invalid edges, if any are found add their source to
341341
// the depsQueue so that we'll fix it later
342342
depth({
343343
tree,
@@ -351,7 +351,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
351351
filter: node => node,
352352
visit: node => {
353353
for (const edge of node.edgesOut.values()) {
354-
if (!edge.valid) {
354+
if (!edge.to || !edge.valid) {
355355
this.#depsQueue.push(node)
356356
break // no need to continue the loop after the first hit
357357
}

workspaces/arborist/lib/arborist/load-virtual.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ To fix:
269269
integrity: sw.integrity,
270270
resolved: consistentResolve(sw.resolved, this.path, path),
271271
pkg: sw,
272-
ideallyInert: sw.ideallyInert,
273272
hasShrinkwrap: sw.hasShrinkwrap,
274273
dev,
275274
optional,

workspaces/arborist/lib/arborist/reify.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,17 @@ module.exports = cls => class Reifier extends cls {
135135
for (const node of this.#omitted) {
136136
node.parent = null
137137
}
138+
// clean inert
139+
for (const node of this.idealTree.inventory.values()) {
140+
if (node.ideallyInert) {
141+
node.parent = null
142+
}
143+
}
138144
// clean up any trash that is still in the tree
139145
for (const path of this[_trashList]) {
140146
const loc = relpath(this.idealTree.realpath, path)
141147
const node = this.idealTree.inventory.get(loc)
142-
if (node && node.root === this.idealTree && !node.ideallyInert) {
148+
if (node && node.root === this.idealTree) {
143149
node.parent = null
144150
}
145151
}

workspaces/arborist/lib/diff.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ const diffNode = ({
258258
}
259259

260260
// Treat inert nodes as undefined for the purposes of diffing.
261-
if (actual?.ideallyInert) {
262-
actual = undefined
263-
}
264261
if (ideal?.ideallyInert) {
265262
ideal = undefined
266263
}

workspaces/arborist/lib/shrinkwrap.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ const nodeMetaKeys = [
109109
'inBundle',
110110
'hasShrinkwrap',
111111
'hasInstallScript',
112-
'ideallyInert',
113112
]
114113

115114
const metaFieldFromPkg = (pkg, key) => {
@@ -136,10 +135,6 @@ const assertNoNewer = async (path, data, lockTime, dir, seen) => {
136135

137136
const parent = isParent ? dir : resolve(dir, 'node_modules')
138137
const rel = relpath(path, dir)
139-
const inert = data.packages[rel]?.ideallyInert
140-
if (inert) {
141-
return
142-
}
143138
seen.add(rel)
144139
let entries
145140
if (dir === path) {
@@ -178,7 +173,7 @@ const assertNoNewer = async (path, data, lockTime, dir, seen) => {
178173

179174
// assert that all the entries in the lockfile were seen
180175
for (const loc in data.packages) {
181-
if (!seen.has(loc) && !data.packages[loc].ideallyInert) {
176+
if (!seen.has(loc)) {
182177
throw new Error(`missing from node_modules: ${loc}`)
183178
}
184179
}
@@ -788,10 +783,6 @@ class Shrinkwrap {
788783
// ok, I did my best! good luck!
789784
}
790785

791-
if (lock.ideallyInert) {
792-
meta.ideallyInert = true
793-
}
794-
795786
if (lock.bundled) {
796787
meta.inBundle = true
797788
}
@@ -962,12 +953,6 @@ class Shrinkwrap {
962953
this.#buildLegacyLockfile(this.tree, this.data)
963954
}
964955

965-
if (!this.hiddenLockfile) {
966-
for (const node of Object.values(this.data.packages)) {
967-
delete node.ideallyInert
968-
}
969-
}
970-
971956
// lf version 1 = dependencies only
972957
// lf version 2 = dependencies and packages
973958
// lf version 3 = packages only

workspaces/arborist/tap-snapshots/test/arborist/load-virtual.js.test.cjs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13344,12 +13344,6 @@ ArboristNode {
1334413344
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
1334513345
"version": "1.1.1",
1334613346
},
13347-
"acorn-jsx" => ArboristNode {
13348-
"location": "node_modules/acorn-jsx",
13349-
"name": "acorn-jsx",
13350-
"path": "{CWD}/test/fixtures/install-types/node_modules/acorn-jsx",
13351-
"version": "5.3.1",
13352-
},
1335313347
"balanced-match" => ArboristNode {
1335413348
"edgesIn": Set {
1335513349
EdgeIn {
@@ -14039,12 +14033,6 @@ ArboristNode {
1403914033
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
1404014034
"version": "1.1.1",
1404114035
},
14042-
"acorn-jsx" => ArboristNode {
14043-
"location": "node_modules/acorn-jsx",
14044-
"name": "acorn-jsx",
14045-
"path": "{CWD}/test/fixtures/install-types/node_modules/acorn-jsx",
14046-
"version": "5.3.1",
14047-
},
1404814036
"balanced-match" => ArboristNode {
1404914037
"edgesIn": Set {
1405014038
EdgeIn {
@@ -14734,12 +14722,6 @@ ArboristNode {
1473414722
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
1473514723
"version": "1.1.1",
1473614724
},
14737-
"acorn-jsx" => ArboristNode {
14738-
"location": "node_modules/acorn-jsx",
14739-
"name": "acorn-jsx",
14740-
"path": "{CWD}/test/arborist/tap-testdir-load-virtual-load-from-npm-shrinkwrap.json/node_modules/acorn-jsx",
14741-
"version": "5.3.1",
14742-
},
1474314725
"balanced-match" => ArboristNode {
1474414726
"edgesIn": Set {
1474514727
EdgeIn {

0 commit comments

Comments
 (0)