@npmcli/arborist 9.6.0 → 10.0.0-pre.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,7 +60,7 @@ arb.loadActual().then(tree => {
60
60
  // tree is also stored at arb.virtualTree
61
61
  })
62
62
 
63
- // read just what the package-lock.json/npm-shrinkwrap says
63
+ // read just what the package-lock.json says
64
64
  // This *also* loads the yarn.lock file, but that's only relevant
65
65
  // when building the ideal tree.
66
66
  arb.loadVirtual().then(tree => {
@@ -301,7 +301,7 @@ pruning nodes from the tree.
301
301
  that the dep is brought in by a peer dep at some point, rather than a
302
302
  normal non-peer dependency.
303
303
 
304
- Note: `devOptional` is only set in the shrinkwrap/package-lock file if
304
+ Note: `devOptional` is only set in the package-lock file if
305
305
  _neither_ `dev` nor `optional` are set, as it would be redundant.
306
306
 
307
307
  ## BIN
package/bin/index.js CHANGED
@@ -20,8 +20,7 @@ ${message && '\n' + message + '\n'}
20
20
  * prune: prune the ideal tree and reify (like npm prune)
21
21
  * ideal: generate and print the ideal tree
22
22
  * actual: read and print the actual tree in node_modules
23
- * virtual: read and print the virtual tree in the local shrinkwrap file
24
- * shrinkwrap: load a local shrinkwrap and print its data
23
+ * virtual: read and print the virtual tree in the local package-lock.json
25
24
  * audit: perform a security audit on project dependencies
26
25
  * funding: query funding information in the local package tree. A second
27
26
  positional argument after the path name can limit to a package name.
@@ -711,7 +711,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
711
711
  for (const node of this.idealTree.inventory.values()) {
712
712
  // XXX add any invalid edgesOut to the queue
713
713
  if (this[_updateNames].includes(node.name) &&
714
- !node.isTop && !node.inDepBundle && !node.inShrinkwrap) {
714
+ !node.isTop && !node.inDepBundle) {
715
715
  for (const edge of node.edgesIn) {
716
716
  this.addTracker('idealTree', edge.from.name, edge.from.location)
717
717
  this.#depsQueue.push(edge.from)
@@ -834,15 +834,11 @@ This is a one-time fix-up, please be patient...
834
834
  const node = this.#depsQueue.pop()
835
835
  const bd = node.package.bundleDependencies
836
836
  const hasBundle = bd && Array.isArray(bd) && bd.length
837
- const { hasShrinkwrap } = node
838
837
 
839
838
  // if the node was already visited, or has since been removed from the
840
- // tree, skip over it and process the rest of the queue. If a node has
841
- // a shrinkwrap, also skip it, because it's going to get its deps
842
- // satisfied by whatever's in that file anyway.
839
+ // tree, skip over it and process the rest of the queue.
843
840
  if (this.#depsSeen.has(node) ||
844
- node.root !== this.idealTree ||
845
- hasShrinkwrap && !this.#complete) {
841
+ node.root !== this.idealTree) {
846
842
  return this.#buildDepStep()
847
843
  }
848
844
 
@@ -852,15 +848,15 @@ This is a one-time fix-up, please be patient...
852
848
 
853
849
  // if we're loading a _complete_ ideal tree, for a --package-lock-only
854
850
  // installation for example, we have to crack open the tarball and
855
- // look inside if it has bundle deps or shrinkwraps. note that this is
851
+ // look inside if it has bundle deps. note that this is
856
852
  // not necessary during a reification, because we just update the
857
- // ideal tree by reading bundles/shrinkwraps in place.
853
+ // ideal tree by reading bundles in place.
858
854
  // Don't bother if the node is from the actual tree and hasn't
859
855
  // been resolved, because we can't fetch it anyway, could be anything!
860
856
  const crackOpen = this.#complete &&
861
857
  node !== this.idealTree &&
862
858
  node.resolved &&
863
- (hasBundle || hasShrinkwrap) &&
859
+ hasBundle &&
864
860
  !node.inert
865
861
  if (crackOpen) {
866
862
  const Arborist = this.constructor
@@ -873,15 +869,8 @@ This is a one-time fix-up, please be patient...
873
869
  integrity: node.integrity,
874
870
  })
875
871
 
876
- if (hasShrinkwrap) {
877
- await new Arborist({ ...this.options, path })
878
- .loadVirtual({ root: node })
879
- }
880
-
881
- if (hasBundle) {
882
- await new Arborist({ ...this.options, path })
883
- .loadActual({ root: node, ignoreMissing: true })
884
- }
872
+ await new Arborist({ ...this.options, path })
873
+ .loadActual({ root: node, ignoreMissing: true })
885
874
  })
886
875
  }
887
876
 
@@ -1228,11 +1217,6 @@ This is a one-time fix-up, please be patient...
1228
1217
  continue
1229
1218
  }
1230
1219
 
1231
- // If it's shrinkwrapped, we use what the shrinkwap wants.
1232
- if (edge.to && edge.to.inShrinkwrap) {
1233
- continue
1234
- }
1235
-
1236
1220
  // If the edge has no destination, that's a problem, unless
1237
1221
  // if it's peerOptional and not explicitly requested.
1238
1222
  if (!edge.to) {
@@ -1,5 +1,3 @@
1
- const { mkdirSync } = require('node:fs')
2
- const pacote = require('pacote')
3
1
  const { join } = require('node:path')
4
2
  const { depth } = require('treeverse')
5
3
  const crypto = require('node:crypto')
@@ -149,50 +147,14 @@ module.exports = cls => class IsolatedReifier extends cls {
149
147
  const result = {}
150
148
  // XXX this goes recursive if we don't set here because assignCommonProperties also calls this.#externalProxy
151
149
  this.#externalProxies.set(node, result)
152
- await this.#assignCommonProperties(node, result, !node.hasShrinkwrap)
153
- if (node.hasShrinkwrap) {
154
- const dir = join(
155
- node.root.path,
156
- 'node_modules',
157
- '.store',
158
- `${node.packageName}@${node.version}`
159
- )
160
- mkdirSync(dir, { recursive: true })
161
- // TODO this approach feels wrong and shouldn't be necessary for shrinkwraps
162
- await pacote.extract(node.resolved, dir, {
163
- ...this.options,
164
- resolved: node.resolved,
165
- integrity: node.integrity,
166
- // TODO _isRoot
167
- })
168
- const Arborist = this.constructor
169
- const arb = new Arborist({ ...this.options, path: dir })
170
- // Make sure that the ideal tree is build as the rest of the algorithm depends on it.
171
- await arb.buildIdealTree({
172
- complete: false,
173
- dev: false,
174
- })
175
- await arb.makeIdealGraph()
176
- this.idealGraph.external.push(...arb.idealGraph.external)
177
- for (const edge of arb.idealGraph.external) {
178
- edge.root = this.idealGraph
179
- edge.id = `${node.id}=>${edge.id}`
180
- }
181
- result.localDependencies = []
182
- result.externalDependencies = arb.idealGraph.externalDependencies
183
- result.externalOptionalDependencies = arb.idealGraph.externalOptionalDependencies
184
- result.dependencies = [
185
- ...result.externalDependencies,
186
- ...result.externalOptionalDependencies,
187
- ]
188
- }
150
+ await this.#assignCommonProperties(node, result)
189
151
  result.optional = node.optional
190
152
  result.resolved = node.resolved
191
153
  result.version = node.version
192
154
  return result
193
155
  }
194
156
 
195
- async #assignCommonProperties (node, result, populateDeps = true) {
157
+ async #assignCommonProperties (node, result) {
196
158
  result.root = this.idealGraph
197
159
  // XXX does anything need this?
198
160
  result.id = this.counter++
@@ -202,10 +164,6 @@ module.exports = cls => class IsolatedReifier extends cls {
202
164
  result.package = { ...node.package }
203
165
  result.package.bundleDependencies = undefined
204
166
 
205
- if (!populateDeps) {
206
- return
207
- }
208
-
209
167
  let edges = [...node.edgesOut.values()].filter(edge =>
210
168
  edge.to?.target &&
211
169
  !(node.package.bundledDependencies || node.package.bundleDependencies)?.includes(edge.to.name)
@@ -39,7 +39,7 @@ module.exports = cls => class VirtualLoader extends cls {
39
39
  resolveOptions: this.options,
40
40
  })
41
41
  if (!s.loadedFromDisk && !options.root) {
42
- const er = new Error('loadVirtual requires existing shrinkwrap file')
42
+ const er = new Error('loadVirtual requires existing package-lock.json file')
43
43
  throw Object.assign(er, { code: 'ENOLOCK' })
44
44
  }
45
45
 
@@ -244,7 +244,6 @@ To fix:
244
244
  integrity: sw.integrity,
245
245
  resolved: consistentResolve(sw.resolved, this.path, path),
246
246
  pkg: sw,
247
- hasShrinkwrap: sw.hasShrinkwrap,
248
247
  loadOverrides,
249
248
  // cast to boolean because they're undefined in the lock file when false
250
249
  extraneous: !!sw.extraneous,
@@ -48,7 +48,6 @@ const _checkBins = Symbol.for('checkBins')
48
48
  // TODO tests should not be this deep into internals
49
49
  const _diffTrees = Symbol.for('diffTrees')
50
50
  const _createSparseTree = Symbol.for('createSparseTree')
51
- const _loadShrinkwrapsAndUpdateTrees = Symbol.for('loadShrinkwrapsAndUpdateTrees')
52
51
  const _reifyNode = Symbol.for('reifyNode')
53
52
  const _updateAll = Symbol.for('updateAll')
54
53
  const _updateNames = Symbol.for('updateNames')
@@ -73,7 +72,6 @@ module.exports = cls => class Reifier extends cls {
73
72
  #omit
74
73
  #retiredPaths = {}
75
74
  #retiredUnchanged = {}
76
- #shrinkwrapInflated = new Set()
77
75
  #sparseTreeDirs = new Set()
78
76
  #sparseTreeRoots = new Set()
79
77
  #linkedActualForDiff = null
@@ -306,7 +304,6 @@ module.exports = cls => class Reifier extends cls {
306
304
  ]],
307
305
  [_rollbackCreateSparseTree, [
308
306
  _createSparseTree,
309
- _loadShrinkwrapsAndUpdateTrees,
310
307
  _loadBundlesAndUpdateTrees,
311
308
  _submitQuickAudit,
312
309
  _unpackNewModules,
@@ -466,7 +463,6 @@ module.exports = cls => class Reifier extends cls {
466
463
  // and ideal trees.
467
464
  this.diff = Diff.calculate({
468
465
  omit: this.#omit,
469
- shrinkwrapInflated: this.#shrinkwrapInflated,
470
466
  filterNodes,
471
467
  actual: this.#linkedActualForDiff || this.actualTree,
472
468
  ideal: this.idealTree,
@@ -617,39 +613,6 @@ module.exports = cls => class Reifier extends cls {
617
613
  .then(() => this[_rollbackRetireShallowNodes](er))
618
614
  }
619
615
 
620
- // shrinkwrap nodes define their dependency branches with a file, so
621
- // we need to unpack them, read that shrinkwrap file, and then update
622
- // the tree by calling loadVirtual with the node as the root.
623
- [_loadShrinkwrapsAndUpdateTrees] () {
624
- const seen = this.#shrinkwrapInflated
625
- const shrinkwraps = this.diff.leaves
626
- .filter(d => (d.action === 'CHANGE' || d.action === 'ADD' || !d.action) &&
627
- d.ideal.hasShrinkwrap && !seen.has(d.ideal) &&
628
- !this[_trashList].has(d.ideal.path))
629
-
630
- if (!shrinkwraps.length) {
631
- return
632
- }
633
-
634
- const timeEnd = time.start('reify:loadShrinkwraps')
635
-
636
- const Arborist = this.constructor
637
- return promiseAllRejectLate(shrinkwraps.map(diff => {
638
- const node = diff.ideal
639
- seen.add(node)
640
- return diff.action ? this[_reifyNode](node) : node
641
- }))
642
- .then(nodes => promiseAllRejectLate(nodes.map(node => new Arborist({
643
- ...this.options,
644
- path: node.path,
645
- }).loadVirtual({ root: node }))))
646
- // reload the diff and sparse tree because the ideal tree changed
647
- .then(() => this[_diffTrees]())
648
- .then(() => this[_createSparseTree]())
649
- .then(() => this[_loadShrinkwrapsAndUpdateTrees]())
650
- .then(timeEnd)
651
- }
652
-
653
616
  // create a symlink for Links, extract for Nodes
654
617
  // return the node object, since we usually want that
655
618
  // handle optional dep failures here
@@ -1176,7 +1139,6 @@ module.exports = cls => class Reifier extends cls {
1176
1139
 
1177
1140
  const node = diff.ideal
1178
1141
  const bd = this.#bundleUnpacked.has(node)
1179
- const sw = this.#shrinkwrapInflated.has(node)
1180
1142
  const bundleMissing = this.#bundleMissing.has(node)
1181
1143
 
1182
1144
  // check whether we still need to unpack this one.
@@ -1186,8 +1148,6 @@ module.exports = cls => class Reifier extends cls {
1186
1148
  !node.isRoot &&
1187
1149
  // already unpacked to read bundle
1188
1150
  !bd &&
1189
- // already unpacked to read sw
1190
- !sw &&
1191
1151
  // already unpacked by another dep's bundle
1192
1152
  (bundleMissing || !node.inDepBundle)
1193
1153
 
package/lib/diff.js CHANGED
@@ -11,10 +11,9 @@ const { existsSync } = require('node:fs')
11
11
  const ssri = require('ssri')
12
12
 
13
13
  class Diff {
14
- constructor ({ actual, ideal, filterSet, shrinkwrapInflated, omit }) {
14
+ constructor ({ actual, ideal, filterSet, omit }) {
15
15
  this.omit = omit
16
16
  this.filterSet = filterSet
17
- this.shrinkwrapInflated = shrinkwrapInflated
18
17
  this.children = []
19
18
  this.actual = actual
20
19
  this.ideal = ideal
@@ -36,7 +35,6 @@ class Diff {
36
35
  actual,
37
36
  ideal,
38
37
  filterNodes = [],
39
- shrinkwrapInflated = new Set(),
40
38
  omit = new Set(),
41
39
  }) {
42
40
  // if there's a filterNode, then:
@@ -102,7 +100,7 @@ class Diff {
102
100
  }
103
101
 
104
102
  return depth({
105
- tree: new Diff({ actual, ideal, filterSet, shrinkwrapInflated, omit }),
103
+ tree: new Diff({ actual, ideal, filterSet, omit }),
106
104
  getChildren,
107
105
  leave,
108
106
  })
@@ -191,26 +189,16 @@ const getChildren = diff => {
191
189
  unchanged,
192
190
  removed,
193
191
  filterSet,
194
- shrinkwrapInflated,
195
192
  omit,
196
193
  } = diff
197
194
 
198
195
  // Note: we DON'T diff fsChildren themselves, because they are either
199
- // included in the package contents, or part of some other project, and
200
- // will never appear in legacy shrinkwraps anyway. but we _do_ include the
201
- // child nodes of fsChildren, because those are nodes that we are typically
202
- // responsible for installing.
196
+ // included in the package contents, or part of some other project.
197
+ // But we _do_ include the child nodes of fsChildren, because those are
198
+ // nodes that we are typically responsible for installing.
203
199
  const actualKids = allChildren(actual)
204
200
  const idealKids = allChildren(ideal)
205
201
 
206
- if (ideal && ideal.hasShrinkwrap && !shrinkwrapInflated.has(ideal)) {
207
- // Guaranteed to get a diff.leaves here, because we always
208
- // be called with a proper Diff object when ideal has a shrinkwrap
209
- // that has not been inflated.
210
- diff.leaves.push(diff)
211
- return children
212
- }
213
-
214
202
  const paths = new Set([...actualKids.keys(), ...idealKids.keys()])
215
203
  for (const path of paths) {
216
204
  const actual = actualKids.get(path)
@@ -222,7 +210,6 @@ const getChildren = diff => {
222
210
  unchanged,
223
211
  removed,
224
212
  filterSet,
225
- shrinkwrapInflated,
226
213
  omit,
227
214
  })
228
215
  }
@@ -241,7 +228,6 @@ const diffNode = ({
241
228
  unchanged,
242
229
  removed,
243
230
  filterSet,
244
- shrinkwrapInflated,
245
231
  omit,
246
232
  }) => {
247
233
  if (filterSet.size && !(filterSet.has(ideal) || filterSet.has(actual))) {
@@ -264,11 +250,11 @@ const diffNode = ({
264
250
 
265
251
  // if it's a match, then get its children
266
252
  // otherwise, this is the child diff node
267
- if (action || (!shrinkwrapInflated.has(ideal) && ideal.hasShrinkwrap)) {
253
+ if (action) {
268
254
  if (action === 'REMOVE') {
269
255
  removed.push(actual)
270
256
  }
271
- children.push(new Diff({ actual, ideal, filterSet, shrinkwrapInflated, omit }))
257
+ children.push(new Diff({ actual, ideal, filterSet, omit }))
272
258
  } else {
273
259
  unchanged.push(ideal)
274
260
  // !*! Weird dirty hack warning !*!
@@ -307,7 +293,6 @@ const diffNode = ({
307
293
  unchanged,
308
294
  removed,
309
295
  filterSet,
310
- shrinkwrapInflated,
311
296
  omit,
312
297
  }))
313
298
  }
package/lib/edge.js CHANGED
@@ -109,8 +109,8 @@ class Edge {
109
109
  }
110
110
 
111
111
  // NOTE: this condition means we explicitly do not support overriding
112
- // bundled or shrinkwrapped dependencies
113
- if (node.hasShrinkwrap || node.inShrinkwrap || node.inBundle) {
112
+ // bundled dependencies
113
+ if (node.inDepBundle) {
114
114
  return depValid(node, this.rawSpec, this.#accept, this.#from)
115
115
  }
116
116
 
@@ -16,7 +16,6 @@ class IsolatedNode {
16
16
  edgesIn = new Set()
17
17
  edgesOut = new CaseInsensitiveMap()
18
18
  fsChildren = new Set()
19
- hasShrinkwrap = false
20
19
  integrity = null
21
20
  inventory = new IsolatedInventory()
22
21
  isInStore = false
package/lib/node.js CHANGED
@@ -82,7 +82,6 @@ class Node {
82
82
  fsChildren,
83
83
  fsParent,
84
84
  global = false,
85
- hasShrinkwrap,
86
85
  inert = false,
87
86
  installLinks = false,
88
87
  integrity,
@@ -170,7 +169,6 @@ class Node {
170
169
  }
171
170
  }
172
171
  this.integrity = integrity || this.package._integrity || null
173
- this.hasShrinkwrap = hasShrinkwrap || this.package._hasShrinkwrap || false
174
172
  this.installLinks = installLinks
175
173
  this.legacyPeerDeps = legacyPeerDeps
176
174
 
@@ -1101,8 +1099,8 @@ class Node {
1101
1099
  // is depending on it would be fine with the thing that they would resolve
1102
1100
  // to if it was removed, or nothing is depending on it in the first place.
1103
1101
  canDedupe (preferDedupe = false, explicitRequest = false) {
1104
- // not allowed to mess with shrinkwraps or bundles
1105
- if (this.inDepBundle || this.inShrinkwrap) {
1102
+ // not allowed to mess with bundles
1103
+ if (this.inDepBundle) {
1106
1104
  return false
1107
1105
  }
1108
1106
 
@@ -1249,11 +1247,6 @@ class Node {
1249
1247
  treeCheck(this)
1250
1248
  }
1251
1249
 
1252
- get inShrinkwrap () {
1253
- return this.parent &&
1254
- (this.parent.hasShrinkwrap || this.parent.inShrinkwrap)
1255
- }
1256
-
1257
1250
  get parent () {
1258
1251
  // setter prevents _parent from being this
1259
1252
  return this[_parent]
package/lib/printable.js CHANGED
@@ -52,11 +52,6 @@ class ArboristNode {
52
52
  if (bd && bd.length) {
53
53
  this.bundleDependencies = bd
54
54
  }
55
- if (tree.inShrinkwrap) {
56
- this.inShrinkwrap = true
57
- } else if (tree.hasShrinkwrap) {
58
- this.hasShrinkwrap = true
59
- }
60
55
  if (tree.error) {
61
56
  this.error = treeError(tree.error)
62
57
  }
package/lib/shrinkwrap.js CHANGED
@@ -1,5 +1,4 @@
1
- // a module that manages a shrinkwrap file (npm-shrinkwrap.json or
2
- // package-lock.json).
1
+ // a module that manages a lockfile (package-lock.json).
3
2
 
4
3
  // Increment whenever the lockfile version updates
5
4
  // v1 - npm <=6
@@ -98,7 +97,6 @@ const pkgMetaKeys = [
98
97
  'libc',
99
98
  '_integrity',
100
99
  'license',
101
- '_hasShrinkwrap',
102
100
  'hasInstallScript',
103
101
  'bin',
104
102
  'deprecated',
@@ -108,7 +106,6 @@ const pkgMetaKeys = [
108
106
  const nodeMetaKeys = [
109
107
  'integrity',
110
108
  'inBundle',
111
- 'hasShrinkwrap',
112
109
  'hasInstallScript',
113
110
  ]
114
111
 
@@ -199,17 +196,14 @@ class Shrinkwrap {
199
196
  const s = new Shrinkwrap(options)
200
197
  s.reset()
201
198
 
202
- const [sw, lock] = await s.resetFiles
199
+ const [lock] = await s.resetFiles
203
200
 
204
- // XXX this is duplicated in this.load(), but using loadFiles instead of resetFiles
205
201
  if (s.hiddenLockfile) {
206
202
  s.filename = resolve(s.path, 'node_modules/.package-lock.json')
207
- } else if (s.shrinkwrapOnly || sw) {
208
- s.filename = resolve(s.path, 'npm-shrinkwrap.json')
209
203
  } else {
210
204
  s.filename = resolve(s.path, 'package-lock.json')
211
205
  }
212
- s.loadedFromDisk = !!(sw || lock)
206
+ s.loadedFromDisk = !!lock
213
207
  // TODO what uses this?
214
208
  s.type = basename(s.filename)
215
209
 
@@ -286,7 +280,6 @@ class Shrinkwrap {
286
280
  path,
287
281
  indent = 2,
288
282
  newline = '\n',
289
- shrinkwrapOnly = false,
290
283
  hiddenLockfile = false,
291
284
  lockfileVersion,
292
285
  resolveOptions = {},
@@ -312,8 +305,6 @@ class Shrinkwrap {
312
305
  this.hiddenLockfile = hiddenLockfile
313
306
  this.loadingError = null
314
307
  this.resolveOptions = resolveOptions
315
- // only load npm-shrinkwrap.json in dep trees, not package-lock
316
- this.shrinkwrapOnly = shrinkwrapOnly
317
308
  }
318
309
 
319
310
  // check to see if a spec is present in the yarn.lock file, and if so,
@@ -369,14 +360,10 @@ class Shrinkwrap {
369
360
 
370
361
  // files to potentially read from and write to, in order of priority
371
362
  get #filenameSet () {
372
- if (this.shrinkwrapOnly) {
373
- return [`${this.path}/npm-shrinkwrap.json`]
374
- }
375
363
  if (this.hiddenLockfile) {
376
364
  return [`${this.path}/node_modules/.package-lock.json`]
377
365
  }
378
366
  return [
379
- `${this.path}/npm-shrinkwrap.json`,
380
367
  `${this.path}/package-lock.json`,
381
368
  `${this.path}/yarn.lock`,
382
369
  ]
@@ -396,9 +383,9 @@ class Shrinkwrap {
396
383
  }
397
384
 
398
385
  get resetFiles () {
399
- // slice out yarn, we only care about lock or shrinkwrap when checking
386
+ // slice out yarn, we only care about the package-lock when checking
400
387
  // this way, since we're not actually loading the full lock metadata
401
- return Promise.all(this.#filenameSet.slice(0, 2)
388
+ return Promise.all(this.#filenameSet.slice(0, 1)
402
389
  .map(file => file && stat(file).then(st => st.isFile(), er => {
403
390
  /* istanbul ignore else - can't test without breaking module itself */
404
391
  if (er.code === 'ENOENT') {
@@ -425,25 +412,18 @@ class Shrinkwrap {
425
412
  }
426
413
 
427
414
  async load () {
428
- // we don't need to load package-lock.json except for top of tree nodes,
429
- // only npm-shrinkwrap.json.
430
415
  let data
431
416
  try {
432
- const [sw, lock, yarn] = await this.loadFiles
433
- data = sw || lock || '{}'
417
+ const [lock, yarn] = await this.loadFiles
418
+ data = lock || '{}'
434
419
 
435
- // use shrinkwrap only for deps; otherwise, prefer package-lock
436
- // and ignore npm-shrinkwrap if both are present.
437
- // TODO: emit a warning here or something if both are present.
438
420
  if (this.hiddenLockfile) {
439
421
  this.filename = resolve(this.path, 'node_modules/.package-lock.json')
440
- } else if (this.shrinkwrapOnly || sw) {
441
- this.filename = resolve(this.path, 'npm-shrinkwrap.json')
442
422
  } else {
443
423
  this.filename = resolve(this.path, 'package-lock.json')
444
424
  }
445
425
  this.type = basename(this.filename)
446
- this.loadedFromDisk = Boolean(sw || lock)
426
+ this.loadedFromDisk = Boolean(lock)
447
427
 
448
428
  if (yarn) {
449
429
  this.yarnLock = new YarnLock()
@@ -809,7 +789,6 @@ class Shrinkwrap {
809
789
  const {
810
790
  resolved,
811
791
  integrity,
812
- hasShrinkwrap,
813
792
  version,
814
793
  } = this.get(node.path)
815
794
 
@@ -836,17 +815,14 @@ class Shrinkwrap {
836
815
  if (allOk) {
837
816
  node.resolved = node.resolved || pathFixed || null
838
817
  node.integrity = node.integrity || integrity || null
839
- node.hasShrinkwrap = node.hasShrinkwrap || hasShrinkwrap || false
840
818
  } else {
841
819
  // try to read off the package or node itself
842
820
  const {
843
821
  resolved,
844
822
  integrity,
845
- hasShrinkwrap,
846
823
  } = Shrinkwrap.metaFromNode(node, this.path, this.resolveOptions)
847
824
  node.resolved = node.resolved || resolved || null
848
825
  node.integrity = node.integrity || integrity || null
849
- node.hasShrinkwrap = node.hasShrinkwrap || hasShrinkwrap || false
850
826
  }
851
827
  }
852
828
  this.#awaitingUpdate.set(loc, node)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "9.6.0",
3
+ "version": "10.0.0-pre.0.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@gar/promise-retry": "^1.0.0",
package/bin/shrinkwrap.js DELETED
@@ -1,7 +0,0 @@
1
- const Shrinkwrap = require('../lib/shrinkwrap.js')
2
-
3
- module.exports = (options, time) => Shrinkwrap
4
- .load(options)
5
- .then((s) => s.commit())
6
- .then(time)
7
- .then(({ result: s }) => JSON.stringify(s, 0, 2))