@npmcli/arborist 5.4.0 → 5.5.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.
@@ -115,6 +115,7 @@ module.exports = cls => class ActualLoader extends cls {
115
115
  root = null,
116
116
  transplantFilter = () => true,
117
117
  ignoreMissing = false,
118
+ forceActual = false,
118
119
  } = options
119
120
  this[_filter] = filter
120
121
  this[_transplantFilter] = transplantFilter
@@ -141,26 +142,30 @@ module.exports = cls => class ActualLoader extends cls {
141
142
 
142
143
  this[_actualTree].assertRootOverrides()
143
144
 
144
- // Note: hidden lockfile will be rejected if it's not the latest thing
145
- // in the folder, or if any of the entries in the hidden lockfile are
146
- // missing.
147
- const meta = await Shrinkwrap.load({
148
- path: this[_actualTree].path,
149
- hiddenLockfile: true,
150
- resolveOptions: this.options,
151
- })
152
- if (meta.loadedFromDisk) {
153
- this[_actualTree].meta = meta
154
- return this[_loadActualVirtually]({ root })
155
- } else {
145
+ // if forceActual is set, don't even try the hidden lockfile
146
+ if (!forceActual) {
147
+ // Note: hidden lockfile will be rejected if it's not the latest thing
148
+ // in the folder, or if any of the entries in the hidden lockfile are
149
+ // missing.
156
150
  const meta = await Shrinkwrap.load({
157
151
  path: this[_actualTree].path,
158
- lockfileVersion: this.options.lockfileVersion,
152
+ hiddenLockfile: true,
159
153
  resolveOptions: this.options,
160
154
  })
161
- this[_actualTree].meta = meta
162
- return this[_loadActualActually]({ root, ignoreMissing })
155
+
156
+ if (meta.loadedFromDisk) {
157
+ this[_actualTree].meta = meta
158
+ return this[_loadActualVirtually]({ root })
159
+ }
163
160
  }
161
+
162
+ const meta = await Shrinkwrap.load({
163
+ path: this[_actualTree].path,
164
+ lockfileVersion: this.options.lockfileVersion,
165
+ resolveOptions: this.options,
166
+ })
167
+ this[_actualTree].meta = meta
168
+ return this[_loadActualActually]({ root, ignoreMissing })
164
169
  }
165
170
 
166
171
  async [_loadActualVirtually] ({ root }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
@@ -21,7 +21,7 @@
21
21
  "minimatch": "^5.1.0",
22
22
  "mkdirp": "^1.0.4",
23
23
  "mkdirp-infer-owner": "^2.0.0",
24
- "nopt": "^5.0.0",
24
+ "nopt": "^6.0.0",
25
25
  "npm-install-checks": "^5.0.0",
26
26
  "npm-package-arg": "^9.0.0",
27
27
  "npm-pick-manifest": "^7.0.0",