@npmcli/arborist 5.2.2 → 5.3.1
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/lib/arborist/build-ideal-tree.js +2 -2
- package/lib/arborist/load-actual.js +1 -1
- package/lib/arborist/load-virtual.js +1 -1
- package/lib/arborist/reify.js +26 -1
- package/lib/consistent-resolve.js +2 -2
- package/lib/link.js +1 -1
- package/lib/node.js +1 -1
- package/lib/shrinkwrap.js +3 -3
- package/package.json +2 -2
|
@@ -484,7 +484,7 @@ Try using the package name instead, e.g:
|
|
|
484
484
|
.catch(/* istanbul ignore next */ er => null)
|
|
485
485
|
if (st && st.isSymbolicLink()) {
|
|
486
486
|
const target = await readlink(dir)
|
|
487
|
-
const real = resolve(dirname(dir), target)
|
|
487
|
+
const real = resolve(dirname(dir), target).replace(/#/g, '%23')
|
|
488
488
|
tree.package.dependencies[name] = `file:${real}`
|
|
489
489
|
} else {
|
|
490
490
|
tree.package.dependencies[name] = '*'
|
|
@@ -603,7 +603,7 @@ Try using the package name instead, e.g:
|
|
|
603
603
|
if (filepath) {
|
|
604
604
|
const { name } = spec
|
|
605
605
|
const tree = this.idealTree.target
|
|
606
|
-
spec = npa(`file:${relpath(tree.path, filepath)}`, tree.path)
|
|
606
|
+
spec = npa(`file:${relpath(tree.path, filepath).replace(/#/g, '%23')}`, tree.path)
|
|
607
607
|
spec.name = name
|
|
608
608
|
}
|
|
609
609
|
return spec
|
|
@@ -196,7 +196,7 @@ module.exports = cls => class ActualLoader extends cls {
|
|
|
196
196
|
const actualRoot = tree.isLink ? tree.target : tree
|
|
197
197
|
const { dependencies = {} } = actualRoot.package
|
|
198
198
|
for (const [name, kid] of actualRoot.children.entries()) {
|
|
199
|
-
const def = kid.isLink ? `file:${kid.realpath}` : '*'
|
|
199
|
+
const def = kid.isLink ? `file:${kid.realpath.replace(/#/g, '%23')}` : '*'
|
|
200
200
|
dependencies[name] = dependencies[name] || def
|
|
201
201
|
}
|
|
202
202
|
actualRoot.package = { ...actualRoot.package, dependencies }
|
|
@@ -162,7 +162,7 @@ module.exports = cls => class VirtualLoader extends cls {
|
|
|
162
162
|
lockfile: s.data,
|
|
163
163
|
})
|
|
164
164
|
for (const [name, path] of workspaces.entries()) {
|
|
165
|
-
lockWS.push(['workspace', name, `file:${path}`])
|
|
165
|
+
lockWS.push(['workspace', name, `file:${path.replace(/#/g, '%23')}`])
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
const lockEdges = [
|
package/lib/arborist/reify.js
CHANGED
|
@@ -22,6 +22,7 @@ const moveFile = require('@npmcli/move-file')
|
|
|
22
22
|
const rimraf = promisify(require('rimraf'))
|
|
23
23
|
const PackageJson = require('@npmcli/package-json')
|
|
24
24
|
const packageContents = require('@npmcli/installed-package-contents')
|
|
25
|
+
const runScript = require('@npmcli/run-script')
|
|
25
26
|
const { checkEngine, checkPlatform } = require('npm-install-checks')
|
|
26
27
|
const _force = Symbol.for('force')
|
|
27
28
|
|
|
@@ -1240,7 +1241,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1240
1241
|
// path initially, in which case we can end up with the wrong
|
|
1241
1242
|
// thing, so just get the ultimate fetchSpec and relativize it.
|
|
1242
1243
|
const p = req.fetchSpec.replace(/^file:/, '')
|
|
1243
|
-
const rel = relpath(addTree.realpath, p)
|
|
1244
|
+
const rel = relpath(addTree.realpath, p).replace(/#/g, '%23')
|
|
1244
1245
|
newSpec = `file:${rel}`
|
|
1245
1246
|
}
|
|
1246
1247
|
} else {
|
|
@@ -1516,6 +1517,30 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1516
1517
|
|
|
1517
1518
|
if (!this[_global]) {
|
|
1518
1519
|
await this.actualTree.meta.save()
|
|
1520
|
+
const ignoreScripts = !!this.options.ignoreScripts
|
|
1521
|
+
// if we aren't doing a dry run or ignoring scripts and we actually made changes to the dep
|
|
1522
|
+
// tree, then run the dependencies scripts
|
|
1523
|
+
if (!this[_dryRun] && !ignoreScripts && this.diff && this.diff.children.length) {
|
|
1524
|
+
const { path, package: pkg } = this.actualTree.target
|
|
1525
|
+
const stdio = this.options.foregroundScripts ? 'inherit' : 'pipe'
|
|
1526
|
+
const { scripts = {} } = pkg
|
|
1527
|
+
for (const event of ['predependencies', 'dependencies', 'postdependencies']) {
|
|
1528
|
+
if (Object.prototype.hasOwnProperty.call(scripts, event)) {
|
|
1529
|
+
const timer = `reify:run:${event}`
|
|
1530
|
+
process.emit('time', timer)
|
|
1531
|
+
log.info('run', pkg._id, event, scripts[event])
|
|
1532
|
+
await runScript({
|
|
1533
|
+
event,
|
|
1534
|
+
path,
|
|
1535
|
+
pkg,
|
|
1536
|
+
stdioString: true,
|
|
1537
|
+
stdio,
|
|
1538
|
+
scriptShell: this.options.scriptShell,
|
|
1539
|
+
})
|
|
1540
|
+
process.emit('timeEnd', timer)
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1519
1544
|
}
|
|
1520
1545
|
}
|
|
1521
1546
|
}
|
|
@@ -20,8 +20,8 @@ const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
|
|
|
20
20
|
raw,
|
|
21
21
|
} = npa(resolved, fromPath)
|
|
22
22
|
const isPath = type === 'file' || type === 'directory'
|
|
23
|
-
return isPath && !relPaths ? `file:${fetchSpec}`
|
|
24
|
-
: isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec) : fetchSpec)
|
|
23
|
+
return isPath && !relPaths ? `file:${fetchSpec.replace(/#/g, '%23')}`
|
|
24
|
+
: isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec.replace(/#/g, '%23')) : fetchSpec.replace(/#/g, '%23'))
|
|
25
25
|
: hosted ? `git+${
|
|
26
26
|
hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)
|
|
27
27
|
}`
|
package/lib/link.js
CHANGED
|
@@ -118,7 +118,7 @@ class Link extends Node {
|
|
|
118
118
|
// the path/realpath guard is there for the benefit of setting
|
|
119
119
|
// these things in the "wrong" order
|
|
120
120
|
return this.path && this.realpath
|
|
121
|
-
? `file:${relpath(dirname(this.path), this.realpath)}`
|
|
121
|
+
? `file:${relpath(dirname(this.path), this.realpath).replace(/#/g, '%23')}`
|
|
122
122
|
: null
|
|
123
123
|
}
|
|
124
124
|
|
package/lib/node.js
CHANGED
|
@@ -824,7 +824,7 @@ class Node {
|
|
|
824
824
|
}
|
|
825
825
|
|
|
826
826
|
for (const [name, path] of this[_workspaces].entries()) {
|
|
827
|
-
new Edge({ from: this, name, spec: `file:${path}`, type: 'workspace' })
|
|
827
|
+
new Edge({ from: this, name, spec: `file:${path.replace(/#/g, '%23')}`, type: 'workspace' })
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
830
|
|
package/lib/shrinkwrap.js
CHANGED
|
@@ -815,7 +815,7 @@ class Shrinkwrap {
|
|
|
815
815
|
const pathFixed = !resolved ? null
|
|
816
816
|
: !/^file:/.test(resolved) ? resolved
|
|
817
817
|
// resolve onto the metadata path
|
|
818
|
-
: `file:${resolve(this.path, resolved.slice(5))}`
|
|
818
|
+
: `file:${resolve(this.path, resolved.slice(5)).replace(/#/g, '%23')}`
|
|
819
819
|
|
|
820
820
|
// if we have one, only set the other if it matches
|
|
821
821
|
// otherwise it could be for a completely different thing.
|
|
@@ -996,7 +996,7 @@ class Shrinkwrap {
|
|
|
996
996
|
: npa.resolve(node.name, edge.spec, edge.from.realpath)
|
|
997
997
|
|
|
998
998
|
if (node.isLink) {
|
|
999
|
-
lock.version = `file:${relpath(this.path, node.realpath)}`
|
|
999
|
+
lock.version = `file:${relpath(this.path, node.realpath).replace(/#/g, '%23')}`
|
|
1000
1000
|
} else if (spec && (spec.type === 'file' || spec.type === 'remote')) {
|
|
1001
1001
|
lock.version = spec.saveSpec
|
|
1002
1002
|
} else if (spec && spec.type === 'git' || rSpec.type === 'git') {
|
|
@@ -1074,7 +1074,7 @@ class Shrinkwrap {
|
|
|
1074
1074
|
// this especially shows up with workspace edges when the root
|
|
1075
1075
|
// node is also a workspace in the set.
|
|
1076
1076
|
const p = resolve(node.realpath, spec.slice('file:'.length))
|
|
1077
|
-
set[k] = `file:${relpath(node.realpath, p)}`
|
|
1077
|
+
set[k] = `file:${relpath(node.realpath, p).replace(/#/g, '%23')}`
|
|
1078
1078
|
} else {
|
|
1079
1079
|
set[k] = spec
|
|
1080
1080
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/arborist",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Manage node_modules trees",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@isaacs/string-locale-compare": "^1.1.0",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@npmcli/name-from-folder": "^1.0.1",
|
|
12
12
|
"@npmcli/node-gyp": "^2.0.0",
|
|
13
13
|
"@npmcli/package-json": "^2.0.0",
|
|
14
|
-
"@npmcli/run-script": "^4.1.
|
|
14
|
+
"@npmcli/run-script": "^4.1.3",
|
|
15
15
|
"bin-links": "^3.0.0",
|
|
16
16
|
"cacache": "^16.0.6",
|
|
17
17
|
"common-ancestor-path": "^1.0.1",
|