@npmcli/arborist 6.0.0-pre.4 → 6.0.0-pre.5
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/bin/lib/logging.js +1 -2
- package/lib/add-rm-pkg-deps.js +2 -2
- package/lib/arborist/build-ideal-tree.js +8 -15
- package/lib/arborist/index.js +1 -0
- package/lib/arborist/reify.js +21 -21
- package/lib/consistent-resolve.js +17 -11
- package/lib/edge.js +1 -1
- package/lib/override-set.js +4 -7
- package/lib/place-dep.js +6 -9
- package/lib/query-selector-all.js +4 -4
- package/lib/realpath.js +1 -4
- package/lib/shrinkwrap.js +9 -25
- package/package.json +26 -29
package/bin/lib/logging.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const log = require('proc-log')
|
|
2
|
-
const mkdirp = require('mkdirp')
|
|
3
2
|
const fs = require('fs')
|
|
4
3
|
const { dirname } = require('path')
|
|
5
4
|
const os = require('os')
|
|
@@ -70,7 +69,7 @@ if (options.loglevel !== 'silent') {
|
|
|
70
69
|
|
|
71
70
|
if (options.logfile) {
|
|
72
71
|
log.silly('logfile', options.logfile)
|
|
73
|
-
|
|
72
|
+
fs.mkdirSync(dirname(options.logfile), { recursive: true })
|
|
74
73
|
const fd = fs.openSync(options.logfile, 'a')
|
|
75
74
|
addLogListener((str) => fs.writeSync(fd, str))
|
|
76
75
|
}
|
package/lib/add-rm-pkg-deps.js
CHANGED
|
@@ -35,8 +35,8 @@ const add = ({ pkg, add, saveBundle, saveType }) => {
|
|
|
35
35
|
const depType = saveTypeMap.get(addSaveType)
|
|
36
36
|
|
|
37
37
|
pkg[depType] = pkg[depType] || {}
|
|
38
|
-
if (rawSpec !== '' || pkg[depType][name] === undefined) {
|
|
39
|
-
pkg[depType][name] = rawSpec
|
|
38
|
+
if (rawSpec !== '*' || pkg[depType][name] === undefined) {
|
|
39
|
+
pkg[depType][name] = rawSpec
|
|
40
40
|
}
|
|
41
41
|
if (addSaveType === 'optional') {
|
|
42
42
|
// Affordance for previous npm versions that require this behaviour
|
|
@@ -10,9 +10,7 @@ const { resolve, dirname } = require('path')
|
|
|
10
10
|
const { promisify } = require('util')
|
|
11
11
|
const treeCheck = require('../tree-check.js')
|
|
12
12
|
const readdir = promisify(require('readdir-scoped-modules'))
|
|
13
|
-
const
|
|
14
|
-
const lstat = promisify(fs.lstat)
|
|
15
|
-
const readlink = promisify(fs.readlink)
|
|
13
|
+
const { lstat, readlink } = require('fs/promises')
|
|
16
14
|
const { depth } = require('treeverse')
|
|
17
15
|
const log = require('proc-log')
|
|
18
16
|
|
|
@@ -48,7 +46,6 @@ const _flagsSuspect = Symbol.for('flagsSuspect')
|
|
|
48
46
|
const _workspaces = Symbol.for('workspaces')
|
|
49
47
|
const _prune = Symbol('prune')
|
|
50
48
|
const _preferDedupe = Symbol('preferDedupe')
|
|
51
|
-
const _legacyBundling = Symbol('legacyBundling')
|
|
52
49
|
const _parseSettings = Symbol('parseSettings')
|
|
53
50
|
const _initTree = Symbol('initTree')
|
|
54
51
|
const _applyUserRequests = Symbol('applyUserRequests')
|
|
@@ -79,7 +76,7 @@ const _loadFailures = Symbol('loadFailures')
|
|
|
79
76
|
const _pruneFailedOptional = Symbol('pruneFailedOptional')
|
|
80
77
|
const _linkNodes = Symbol('linkNodes')
|
|
81
78
|
const _follow = Symbol('follow')
|
|
82
|
-
const
|
|
79
|
+
const _installStrategy = Symbol('installStrategy')
|
|
83
80
|
const _globalRootNode = Symbol('globalRootNode')
|
|
84
81
|
const _usePackageLock = Symbol.for('usePackageLock')
|
|
85
82
|
const _rpcache = Symbol.for('realpathCache')
|
|
@@ -114,7 +111,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
|
|
|
114
111
|
follow = false,
|
|
115
112
|
force = false,
|
|
116
113
|
global = false,
|
|
117
|
-
|
|
114
|
+
installStrategy = 'hoisted',
|
|
118
115
|
idealTree = null,
|
|
119
116
|
includeWorkspaceRoot = false,
|
|
120
117
|
installLinks = false,
|
|
@@ -134,7 +131,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
|
|
|
134
131
|
|
|
135
132
|
this[_usePackageLock] = packageLock
|
|
136
133
|
this[_global] = !!global
|
|
137
|
-
this[
|
|
134
|
+
this[_installStrategy] = global ? 'shallow' : installStrategy
|
|
138
135
|
this[_follow] = !!follow
|
|
139
136
|
|
|
140
137
|
if (this[_workspaces].length && this[_global]) {
|
|
@@ -143,7 +140,6 @@ module.exports = cls => class IdealTreeBuilder extends cls {
|
|
|
143
140
|
|
|
144
141
|
this[_explicitRequests] = new Set()
|
|
145
142
|
this[_preferDedupe] = false
|
|
146
|
-
this[_legacyBundling] = false
|
|
147
143
|
this[_depsSeen] = new Set()
|
|
148
144
|
this[_depsQueue] = []
|
|
149
145
|
this[_currentDep] = null
|
|
@@ -252,20 +248,18 @@ module.exports = cls => class IdealTreeBuilder extends cls {
|
|
|
252
248
|
|
|
253
249
|
this[_complete] = !!options.complete
|
|
254
250
|
this[_preferDedupe] = !!options.preferDedupe
|
|
255
|
-
this[_legacyBundling] = !!options.legacyBundling
|
|
256
251
|
|
|
257
252
|
// validates list of update names, they must
|
|
258
253
|
// be dep names only, no semver ranges are supported
|
|
259
254
|
for (const name of update.names) {
|
|
260
255
|
const spec = npa(name)
|
|
261
256
|
const validationError =
|
|
262
|
-
new TypeError(`Update arguments must
|
|
263
|
-
|
|
264
|
-
Try using the package name instead, e.g:
|
|
257
|
+
new TypeError(`Update arguments must only contain package names, eg:
|
|
265
258
|
npm update ${spec.name}`)
|
|
266
259
|
validationError.code = 'EUPDATEARGS'
|
|
267
260
|
|
|
268
|
-
|
|
261
|
+
// If they gave us anything other than a bare package name
|
|
262
|
+
if (spec.raw !== spec.name) {
|
|
269
263
|
throw validationError
|
|
270
264
|
}
|
|
271
265
|
}
|
|
@@ -952,11 +946,10 @@ This is a one-time fix-up, please be patient...
|
|
|
952
946
|
auditReport: this.auditReport,
|
|
953
947
|
force: this[_force],
|
|
954
948
|
preferDedupe: this[_preferDedupe],
|
|
955
|
-
legacyBundling: this[_legacyBundling],
|
|
956
949
|
strictPeerDeps: this[_strictPeerDeps],
|
|
957
950
|
installLinks: this.installLinks,
|
|
958
951
|
legacyPeerDeps: this.legacyPeerDeps,
|
|
959
|
-
|
|
952
|
+
installStrategy: this[_installStrategy],
|
|
960
953
|
}))
|
|
961
954
|
|
|
962
955
|
const promises = []
|
package/lib/arborist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ class Arborist extends Base {
|
|
|
76
76
|
workspacesEnabled: options.workspacesEnabled !== false,
|
|
77
77
|
replaceRegistryHost: options.replaceRegistryHost,
|
|
78
78
|
lockfileVersion: lockfileVersion(options.lockfileVersion),
|
|
79
|
+
installStrategy: options.global ? 'shallow' : (options.installStrategy ? options.installStrategy : 'hoisted'),
|
|
79
80
|
}
|
|
80
81
|
this.replaceRegistryHost = this.options.replaceRegistryHost =
|
|
81
82
|
(!this.options.replaceRegistryHost || this.options.replaceRegistryHost === 'npmjs') ?
|
package/lib/arborist/reify.js
CHANGED
|
@@ -12,14 +12,13 @@ const log = require('proc-log')
|
|
|
12
12
|
|
|
13
13
|
const { dirname, resolve, relative } = require('path')
|
|
14
14
|
const { depth: dfwalk } = require('treeverse')
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const {
|
|
16
|
+
lstat,
|
|
17
|
+
mkdir,
|
|
18
|
+
rm,
|
|
19
|
+
symlink,
|
|
20
|
+
} = require('fs/promises')
|
|
21
21
|
const moveFile = require('@npmcli/move-file')
|
|
22
|
-
const rimraf = promisify(require('rimraf'))
|
|
23
22
|
const PackageJson = require('@npmcli/package-json')
|
|
24
23
|
const packageContents = require('@npmcli/installed-package-contents')
|
|
25
24
|
const runScript = require('@npmcli/run-script')
|
|
@@ -175,7 +174,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
175
174
|
// we do NOT want to set ownership on this folder, especially
|
|
176
175
|
// recursively, because it can have other side effects to do that
|
|
177
176
|
// in a project directory. We just want to make it if it's missing.
|
|
178
|
-
await
|
|
177
|
+
await mkdir(resolve(this.path), { recursive: true })
|
|
179
178
|
|
|
180
179
|
// do not allow the top-level node_modules to be a symlink
|
|
181
180
|
await this[_validateNodeModules](resolve(this.path, 'node_modules'))
|
|
@@ -433,10 +432,10 @@ module.exports = cls => class Reifier extends cls {
|
|
|
433
432
|
// handled the most common cause of ENOENT (dir doesn't exist yet),
|
|
434
433
|
// then just ignore any ENOENT.
|
|
435
434
|
if (er.code === 'ENOENT') {
|
|
436
|
-
return didMkdirp ? null :
|
|
435
|
+
return didMkdirp ? null : mkdir(dirname(to), { recursive: true }).then(() =>
|
|
437
436
|
this[_renamePath](from, to, true))
|
|
438
437
|
} else if (er.code === 'EEXIST') {
|
|
439
|
-
return
|
|
438
|
+
return rm(to, { recursive: true, force: true }).then(() => moveFile(from, to))
|
|
440
439
|
} else {
|
|
441
440
|
throw er
|
|
442
441
|
}
|
|
@@ -518,7 +517,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
518
517
|
await this[_renamePath](d, retired)
|
|
519
518
|
}
|
|
520
519
|
}
|
|
521
|
-
const made = await
|
|
520
|
+
const made = await mkdir(node.path, { recursive: true })
|
|
522
521
|
this[_sparseTreeDirs].add(node.path)
|
|
523
522
|
this[_sparseTreeRoots].add(made)
|
|
524
523
|
}))
|
|
@@ -533,7 +532,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
533
532
|
const failures = []
|
|
534
533
|
const targets = [...roots, ...Object.keys(this[_retiredPaths])]
|
|
535
534
|
const unlinks = targets
|
|
536
|
-
.map(path =>
|
|
535
|
+
.map(path => rm(path, { recursive: true, force: true }).catch(er => failures.push([path, er])))
|
|
537
536
|
return promiseAllRejectLate(unlinks).then(() => {
|
|
538
537
|
// eslint-disable-next-line promise/always-return
|
|
539
538
|
if (failures.length) {
|
|
@@ -630,7 +629,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
630
629
|
return
|
|
631
630
|
}
|
|
632
631
|
log.warn('reify', 'Removing non-directory', nm)
|
|
633
|
-
await
|
|
632
|
+
await rm(nm, { recursive: true, force: true })
|
|
634
633
|
}
|
|
635
634
|
|
|
636
635
|
async [_extractOrLink] (node) {
|
|
@@ -664,7 +663,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
664
663
|
await this[_validateNodeModules](nm)
|
|
665
664
|
|
|
666
665
|
if (node.isLink) {
|
|
667
|
-
await
|
|
666
|
+
await rm(node.path, { recursive: true, force: true })
|
|
668
667
|
await this[_symlink](node)
|
|
669
668
|
} else {
|
|
670
669
|
await debug(async () => {
|
|
@@ -690,7 +689,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
690
689
|
const dir = dirname(node.path)
|
|
691
690
|
const target = node.realpath
|
|
692
691
|
const rel = relative(dir, target)
|
|
693
|
-
await
|
|
692
|
+
await mkdir(dir, { recursive: true })
|
|
694
693
|
return symlink(rel, node.path, 'junction')
|
|
695
694
|
}
|
|
696
695
|
|
|
@@ -953,7 +952,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
953
952
|
|
|
954
953
|
// ok! actually unpack stuff into their target locations!
|
|
955
954
|
// The sparse tree has already been created, so we walk the diff
|
|
956
|
-
// kicking off each unpack job. If any fail, we
|
|
955
|
+
// kicking off each unpack job. If any fail, we rm the sparse
|
|
957
956
|
// tree entirely and try to put everything back where it was.
|
|
958
957
|
[_unpackNewModules] () {
|
|
959
958
|
process.emit('time', 'reify:unpack')
|
|
@@ -1034,7 +1033,8 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1034
1033
|
return promiseAllRejectLate(diff.unchanged.map(node => {
|
|
1035
1034
|
// no need to roll back links, since we'll just delete them anyway
|
|
1036
1035
|
if (node.isLink) {
|
|
1037
|
-
return
|
|
1036
|
+
return mkdir(dirname(node.path), { recursive: true, force: true })
|
|
1037
|
+
.then(() => this[_reifyNode](node))
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
1040
1040
|
// will have been moved/unpacked along with bundler
|
|
@@ -1050,7 +1050,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1050
1050
|
// skip it.
|
|
1051
1051
|
const bd = node.package.bundleDependencies
|
|
1052
1052
|
const dir = bd && bd.length ? node.path + '/node_modules' : node.path
|
|
1053
|
-
return
|
|
1053
|
+
return mkdir(dir, { recursive: true }).then(() => this[_moveContents](node, fromPath))
|
|
1054
1054
|
}))
|
|
1055
1055
|
}))
|
|
1056
1056
|
.then(() => process.emit('timeEnd', 'reify:unretire'))
|
|
@@ -1124,15 +1124,15 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1124
1124
|
// the tree is pretty much built now, so it's cleanup time.
|
|
1125
1125
|
// remove the retired folders, and any deleted nodes
|
|
1126
1126
|
// If this fails, there isn't much we can do but tell the user about it.
|
|
1127
|
-
// Thankfully, it's pretty unlikely that it'll fail, since
|
|
1127
|
+
// Thankfully, it's pretty unlikely that it'll fail, since rm is a node builtin.
|
|
1128
1128
|
async [_removeTrash] () {
|
|
1129
1129
|
process.emit('time', 'reify:trash')
|
|
1130
1130
|
const promises = []
|
|
1131
1131
|
const failures = []
|
|
1132
|
-
const
|
|
1132
|
+
const _rm = path => rm(path, { recursive: true, force: true }).catch(er => failures.push([path, er]))
|
|
1133
1133
|
|
|
1134
1134
|
for (const path of this[_trashList]) {
|
|
1135
|
-
promises.push(
|
|
1135
|
+
promises.push(_rm(path))
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
1138
|
await promiseAllRejectLate(promises)
|
|
@@ -19,17 +19,23 @@ const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
|
|
|
19
19
|
rawSpec,
|
|
20
20
|
raw,
|
|
21
21
|
} = npa(resolved, fromPath)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
if (type === 'file' || type === 'directory') {
|
|
23
|
+
const cleanFetchSpec = fetchSpec.replace(/#/g, '%23')
|
|
24
|
+
if (relPaths && toPath) {
|
|
25
|
+
return `file:${relpath(toPath, cleanFetchSpec)}`
|
|
26
|
+
}
|
|
27
|
+
return `file:${cleanFetchSpec}`
|
|
28
|
+
}
|
|
29
|
+
if (hosted) {
|
|
30
|
+
return `git+${hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)}`
|
|
31
|
+
}
|
|
32
|
+
if (type === 'git') {
|
|
33
|
+
return saveSpec
|
|
34
|
+
}
|
|
35
|
+
if (rawSpec === '*') {
|
|
36
|
+
return raw
|
|
37
|
+
}
|
|
38
|
+
return rawSpec
|
|
33
39
|
} catch (_) {
|
|
34
40
|
// whatever we passed in was not acceptable to npa.
|
|
35
41
|
// leave it 100% untouched.
|
package/lib/edge.js
CHANGED
|
@@ -166,7 +166,7 @@ class Edge {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
get spec () {
|
|
169
|
-
if (this.overrides && this.overrides.value && this.overrides.name === this.name) {
|
|
169
|
+
if (this.overrides?.value && this.overrides.value !== '*' && this.overrides.name === this.name) {
|
|
170
170
|
if (this.overrides.value.startsWith('$')) {
|
|
171
171
|
const ref = this.overrides.value.slice(1)
|
|
172
172
|
// we may be a virtual root, if we are we want to resolve reference overrides
|
package/lib/override-set.js
CHANGED
|
@@ -25,7 +25,7 @@ class OverrideSet {
|
|
|
25
25
|
this.name = spec.name
|
|
26
26
|
spec.name = ''
|
|
27
27
|
this.key = key
|
|
28
|
-
this.keySpec = spec.
|
|
28
|
+
this.keySpec = spec.toString()
|
|
29
29
|
this.value = overrides['.'] || this.keySpec
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -50,8 +50,7 @@ class OverrideSet {
|
|
|
50
50
|
continue
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if (rule.keySpec
|
|
54
|
-
semver.intersects(edge.spec, rule.keySpec)) {
|
|
53
|
+
if (semver.intersects(edge.spec, rule.keySpec)) {
|
|
55
54
|
return rule
|
|
56
55
|
}
|
|
57
56
|
}
|
|
@@ -65,8 +64,7 @@ class OverrideSet {
|
|
|
65
64
|
continue
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
if (rule.keySpec
|
|
69
|
-
semver.satisfies(node.version, rule.keySpec) ||
|
|
67
|
+
if (semver.satisfies(node.version, rule.keySpec) ||
|
|
70
68
|
semver.satisfies(node.version, rule.value)) {
|
|
71
69
|
return rule
|
|
72
70
|
}
|
|
@@ -81,8 +79,7 @@ class OverrideSet {
|
|
|
81
79
|
continue
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
if (rule.keySpec
|
|
85
|
-
semver.satisfies(node.version, rule.keySpec) ||
|
|
82
|
+
if (semver.satisfies(node.version, rule.keySpec) ||
|
|
86
83
|
semver.satisfies(node.version, rule.value)) {
|
|
87
84
|
return rule
|
|
88
85
|
}
|
package/lib/place-dep.js
CHANGED
|
@@ -43,11 +43,10 @@ class PlaceDep {
|
|
|
43
43
|
explicitRequest,
|
|
44
44
|
updateNames,
|
|
45
45
|
auditReport,
|
|
46
|
-
legacyBundling,
|
|
47
46
|
strictPeerDeps,
|
|
48
47
|
installLinks,
|
|
49
48
|
legacyPeerDeps,
|
|
50
|
-
|
|
49
|
+
installStrategy,
|
|
51
50
|
} = parent || options
|
|
52
51
|
Object.assign(this, {
|
|
53
52
|
preferDedupe,
|
|
@@ -55,11 +54,10 @@ class PlaceDep {
|
|
|
55
54
|
explicitRequest,
|
|
56
55
|
updateNames,
|
|
57
56
|
auditReport,
|
|
58
|
-
legacyBundling,
|
|
59
57
|
strictPeerDeps,
|
|
60
58
|
installLinks,
|
|
59
|
+
installStrategy,
|
|
61
60
|
legacyPeerDeps,
|
|
62
|
-
globalStyle,
|
|
63
61
|
})
|
|
64
62
|
|
|
65
63
|
this.children = []
|
|
@@ -78,10 +76,9 @@ class PlaceDep {
|
|
|
78
76
|
edge,
|
|
79
77
|
dep,
|
|
80
78
|
preferDedupe,
|
|
81
|
-
globalStyle,
|
|
82
|
-
legacyBundling,
|
|
83
79
|
explicitRequest,
|
|
84
80
|
updateNames,
|
|
81
|
+
installStrategy,
|
|
85
82
|
checks,
|
|
86
83
|
} = this
|
|
87
84
|
|
|
@@ -170,13 +167,13 @@ class PlaceDep {
|
|
|
170
167
|
|
|
171
168
|
// nest packages like npm v1 and v2
|
|
172
169
|
// very disk-inefficient
|
|
173
|
-
if (
|
|
170
|
+
if (installStrategy === 'nested') {
|
|
174
171
|
break
|
|
175
172
|
}
|
|
176
173
|
|
|
177
174
|
// when installing globally, or just in global style, we never place
|
|
178
175
|
// deps above the first level.
|
|
179
|
-
if (
|
|
176
|
+
if (installStrategy === 'shallow') {
|
|
180
177
|
const rp = target.resolveParent
|
|
181
178
|
if (rp && rp.isProjectRoot) {
|
|
182
179
|
break
|
|
@@ -463,7 +460,7 @@ class PlaceDep {
|
|
|
463
460
|
// prune all the nodes in a branch of the tree that can be safely removed
|
|
464
461
|
// This is only the most basic duplication detection; it finds if there
|
|
465
462
|
// is another satisfying node further up the tree, and if so, dedupes.
|
|
466
|
-
// Even in
|
|
463
|
+
// Even in installStategy is nested, we do this amount of deduplication.
|
|
467
464
|
pruneDedupable (node, descend = true) {
|
|
468
465
|
if (node.canDedupe(this.preferDedupe)) {
|
|
469
466
|
// gather up all deps that have no valid edges in from outside
|
|
@@ -120,13 +120,13 @@ class Results {
|
|
|
120
120
|
this.#pendingCombinator = combinators[String(this.currentAstNode)]
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// name selectors (i.e. #foo
|
|
123
|
+
// name selectors (i.e. #foo)
|
|
124
124
|
// css calls this id, we interpret it as name
|
|
125
125
|
idType () {
|
|
126
|
-
const
|
|
126
|
+
const name = this.currentAstNode.value
|
|
127
127
|
const nextResults = this.initialItems.filter(node =>
|
|
128
|
-
(
|
|
129
|
-
|
|
128
|
+
(name === node.name) || (name === node.package.name)
|
|
129
|
+
)
|
|
130
130
|
this.processPendingCombinator(nextResults)
|
|
131
131
|
}
|
|
132
132
|
|
package/lib/realpath.js
CHANGED
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
// built-in fs.realpath, because we only care about symbolic links,
|
|
6
6
|
// so we can handle many fewer edge cases.
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const promisify = require('util').promisify
|
|
10
|
-
const readlink = promisify(fs.readlink)
|
|
11
|
-
const lstat = promisify(fs.lstat)
|
|
8
|
+
const { lstat, readlink } = require('fs/promises')
|
|
12
9
|
const { resolve, basename, dirname } = require('path')
|
|
13
10
|
|
|
14
11
|
const realpathCached = (path, rpcache, stcache, depth) => {
|
package/lib/shrinkwrap.js
CHANGED
|
@@ -35,30 +35,14 @@ const mismatch = (a, b) => a && b && a !== b
|
|
|
35
35
|
|
|
36
36
|
const log = require('proc-log')
|
|
37
37
|
const YarnLock = require('./yarn-lock.js')
|
|
38
|
-
const {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// XXX remove when drop support for node v10
|
|
48
|
-
const lstat = promisify(fs.lstat)
|
|
49
|
-
/* istanbul ignore next - version specific polyfill */
|
|
50
|
-
const readdir = async (path, opt) => {
|
|
51
|
-
if (!opt || !opt.withFileTypes) {
|
|
52
|
-
return readdir_(path, opt)
|
|
53
|
-
}
|
|
54
|
-
const ents = await readdir_(path, opt)
|
|
55
|
-
if (typeof ents[0] === 'string') {
|
|
56
|
-
return Promise.all(ents.map(async ent => {
|
|
57
|
-
return Object.assign(await lstat(path + '/' + ent), { name: ent })
|
|
58
|
-
}))
|
|
59
|
-
}
|
|
60
|
-
return ents
|
|
61
|
-
}
|
|
38
|
+
const {
|
|
39
|
+
readFile,
|
|
40
|
+
readdir,
|
|
41
|
+
readlink,
|
|
42
|
+
rm,
|
|
43
|
+
stat,
|
|
44
|
+
writeFile,
|
|
45
|
+
} = require('fs/promises')
|
|
62
46
|
|
|
63
47
|
const { resolve, basename, relative } = require('path')
|
|
64
48
|
const specFromLock = require('./spec-from-lock.js')
|
|
@@ -1153,7 +1137,7 @@ class Shrinkwrap {
|
|
|
1153
1137
|
// a node_modules folder, but then the lockfile is not important.
|
|
1154
1138
|
// Remove the file, so that in case there WERE deps, but we just
|
|
1155
1139
|
// failed to update the file for some reason, it's not out of sync.
|
|
1156
|
-
return
|
|
1140
|
+
return rm(this.filename, { recursive: true, force: true })
|
|
1157
1141
|
}
|
|
1158
1142
|
throw er
|
|
1159
1143
|
}),
|
package/package.json
CHANGED
|
@@ -1,48 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/arborist",
|
|
3
|
-
"version": "6.0.0-pre.
|
|
3
|
+
"version": "6.0.0-pre.5",
|
|
4
4
|
"description": "Manage node_modules trees",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@isaacs/string-locale-compare": "^1.1.0",
|
|
7
|
-
"@npmcli/installed-package-contents": "^
|
|
8
|
-
"@npmcli/map-workspaces": "^
|
|
9
|
-
"@npmcli/metavuln-calculator": "^
|
|
10
|
-
"@npmcli/move-file": "^
|
|
7
|
+
"@npmcli/installed-package-contents": "^2.0.0",
|
|
8
|
+
"@npmcli/map-workspaces": "^3.0.0",
|
|
9
|
+
"@npmcli/metavuln-calculator": "^5.0.0",
|
|
10
|
+
"@npmcli/move-file": "^3.0.0",
|
|
11
11
|
"@npmcli/name-from-folder": "^1.0.1",
|
|
12
|
-
"@npmcli/node-gyp": "^
|
|
13
|
-
"@npmcli/package-json": "^
|
|
14
|
-
"@npmcli/query": "^
|
|
15
|
-
"@npmcli/run-script": "^
|
|
16
|
-
"bin-links": "^
|
|
17
|
-
"cacache": "^
|
|
12
|
+
"@npmcli/node-gyp": "^3.0.0",
|
|
13
|
+
"@npmcli/package-json": "^3.0.0",
|
|
14
|
+
"@npmcli/query": "^3.0.0",
|
|
15
|
+
"@npmcli/run-script": "^5.0.0",
|
|
16
|
+
"bin-links": "^4.0.1",
|
|
17
|
+
"cacache": "^17.0.1",
|
|
18
18
|
"common-ancestor-path": "^1.0.1",
|
|
19
|
-
"json-parse-even-better-errors": "^
|
|
19
|
+
"json-parse-even-better-errors": "^3.0.0",
|
|
20
20
|
"json-stringify-nice": "^1.1.4",
|
|
21
21
|
"minimatch": "^5.1.0",
|
|
22
|
-
"mkdirp": "^1.0.4",
|
|
23
|
-
"mkdirp-infer-owner": "^2.0.0",
|
|
24
22
|
"nopt": "^6.0.0",
|
|
25
|
-
"npm-install-checks": "^
|
|
26
|
-
"npm-package-arg": "^
|
|
27
|
-
"npm-pick-manifest": "^
|
|
28
|
-
"npm-registry-fetch": "^
|
|
29
|
-
"npmlog": "^
|
|
30
|
-
"pacote": "^
|
|
31
|
-
"parse-conflict-json": "^
|
|
32
|
-
"proc-log": "^
|
|
23
|
+
"npm-install-checks": "^6.0.0",
|
|
24
|
+
"npm-package-arg": "^10.0.0",
|
|
25
|
+
"npm-pick-manifest": "^8.0.1",
|
|
26
|
+
"npm-registry-fetch": "^14.0.2",
|
|
27
|
+
"npmlog": "^7.0.1",
|
|
28
|
+
"pacote": "^15.0.2",
|
|
29
|
+
"parse-conflict-json": "^3.0.0",
|
|
30
|
+
"proc-log": "^3.0.0",
|
|
33
31
|
"promise-all-reject-late": "^1.0.0",
|
|
34
32
|
"promise-call-limit": "^1.0.1",
|
|
35
|
-
"read-package-json-fast": "^
|
|
33
|
+
"read-package-json-fast": "^3.0.1",
|
|
36
34
|
"readdir-scoped-modules": "^1.1.0",
|
|
37
|
-
"rimraf": "^3.0.2",
|
|
38
35
|
"semver": "^7.3.7",
|
|
39
|
-
"ssri": "^
|
|
40
|
-
"treeverse": "^
|
|
36
|
+
"ssri": "^10.0.0",
|
|
37
|
+
"treeverse": "^3.0.0",
|
|
41
38
|
"walk-up-path": "^1.0.0"
|
|
42
39
|
},
|
|
43
40
|
"devDependencies": {
|
|
44
|
-
"@npmcli/eslint-config": "^
|
|
45
|
-
"@npmcli/template-oss": "4.
|
|
41
|
+
"@npmcli/eslint-config": "^4.0.0",
|
|
42
|
+
"@npmcli/template-oss": "4.6.2",
|
|
46
43
|
"benchmark": "^2.1.4",
|
|
47
44
|
"chalk": "^4.1.0",
|
|
48
45
|
"minify-registry-metadata": "^2.1.0",
|
|
@@ -104,7 +101,7 @@
|
|
|
104
101
|
},
|
|
105
102
|
"templateOSS": {
|
|
106
103
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
107
|
-
"version": "4.
|
|
104
|
+
"version": "4.6.2",
|
|
108
105
|
"content": "../../scripts/template-oss/index.js"
|
|
109
106
|
}
|
|
110
107
|
}
|