@npmcli/arborist 5.0.0 → 5.0.3

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.
@@ -435,7 +435,7 @@ module.exports = cls => class ActualLoader extends cls {
435
435
  if (d.dummy) {
436
436
  // it's a placeholder, so likely would not have loaded this dep,
437
437
  // unless another dep in the tree also needs it.
438
- const depPath = `${p}/node_modules/${name}`
438
+ const depPath = normalize(`${p}/node_modules/${name}`)
439
439
  const cached = this[_cache].get(depPath)
440
440
  if (!cached || cached.dummy) {
441
441
  depPromises.push(this[_loadFSNode]({
@@ -136,15 +136,19 @@ module.exports = cls => class Builder extends cls {
136
136
  process.emit('time', `build:${type}`)
137
137
 
138
138
  await this[_buildQueues](nodes)
139
- if (!this[_ignoreScripts]) {
140
- await this[_runScripts]('preinstall')
141
- }
142
- if (this[_binLinks] && type !== 'links') {
143
- await this[_linkAllBins]()
144
- }
145
-
146
- // links should also run prepare scripts and only link bins after that
147
- if (type === 'links') {
139
+ // links should run prepare scripts and only link bins after that
140
+ if (type !== 'links') {
141
+ if (!this[_ignoreScripts]) {
142
+ await this[_runScripts]('preinstall')
143
+ }
144
+ if (this[_binLinks]) {
145
+ await this[_linkAllBins]()
146
+ }
147
+ if (!this[_ignoreScripts]) {
148
+ await this[_runScripts]('install')
149
+ await this[_runScripts]('postinstall')
150
+ }
151
+ } else {
148
152
  await this[_runScripts]('prepare')
149
153
 
150
154
  if (this[_binLinks]) {
@@ -152,11 +156,6 @@ module.exports = cls => class Builder extends cls {
152
156
  }
153
157
  }
154
158
 
155
- if (!this[_ignoreScripts]) {
156
- await this[_runScripts]('install')
157
- await this[_runScripts]('postinstall')
158
- }
159
-
160
159
  process.emit('timeEnd', `build:${type}`)
161
160
  }
162
161
 
@@ -1225,14 +1225,23 @@ module.exports = cls => class Reifier extends cls {
1225
1225
  newSpec = h.shortcut(opt)
1226
1226
  }
1227
1227
  } else if (isLocalDep) {
1228
- // save the relative path in package.json
1229
- // Normally saveSpec is updated with the proper relative
1230
- // path already, but it's possible to specify a full absolute
1231
- // path initially, in which case we can end up with the wrong
1232
- // thing, so just get the ultimate fetchSpec and relativize it.
1233
- const p = req.fetchSpec.replace(/^file:/, '')
1234
- const rel = relpath(addTree.realpath, p)
1235
- newSpec = `file:${rel}`
1228
+ // when finding workspace nodes, make sure that
1229
+ // we save them using their version instead of
1230
+ // using their relative path
1231
+ if (edge.type === 'workspace') {
1232
+ const { version } = edge.to.target
1233
+ const prefixRange = version ? this[_savePrefix] + version : '*'
1234
+ newSpec = prefixRange
1235
+ } else {
1236
+ // save the relative path in package.json
1237
+ // Normally saveSpec is updated with the proper relative
1238
+ // path already, but it's possible to specify a full absolute
1239
+ // path initially, in which case we can end up with the wrong
1240
+ // thing, so just get the ultimate fetchSpec and relativize it.
1241
+ const p = req.fetchSpec.replace(/^file:/, '')
1242
+ const rel = relpath(addTree.realpath, p)
1243
+ newSpec = `file:${rel}`
1244
+ }
1236
1245
  } else {
1237
1246
  newSpec = req.saveSpec
1238
1247
  }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "5.0.0",
3
+ "version": "5.0.3",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
7
7
  "@npmcli/installed-package-contents": "^1.0.7",
8
8
  "@npmcli/map-workspaces": "^2.0.0",
9
- "@npmcli/metavuln-calculator": "^3.0.0",
9
+ "@npmcli/metavuln-calculator": "^3.0.1",
10
10
  "@npmcli/move-file": "^1.1.0",
11
11
  "@npmcli/name-from-folder": "^1.0.1",
12
12
  "@npmcli/node-gyp": "^1.0.3",
13
13
  "@npmcli/package-json": "^1.0.1",
14
14
  "@npmcli/run-script": "^3.0.0",
15
15
  "bin-links": "^3.0.0",
16
- "cacache": "^15.0.3",
16
+ "cacache": "^16.0.0",
17
17
  "common-ancestor-path": "^1.0.1",
18
18
  "json-parse-even-better-errors": "^2.3.1",
19
19
  "json-stringify-nice": "^1.1.4",
@@ -25,7 +25,7 @@
25
25
  "npm-pick-manifest": "^7.0.0",
26
26
  "npm-registry-fetch": "^13.0.0",
27
27
  "npmlog": "^6.0.1",
28
- "pacote": "^13.0.2",
28
+ "pacote": "^13.0.5",
29
29
  "parse-conflict-json": "^2.0.1",
30
30
  "proc-log": "^2.0.0",
31
31
  "promise-all-reject-late": "^1.0.0",
@@ -62,11 +62,13 @@
62
62
  "benchmark": "node scripts/benchmark.js",
63
63
  "benchclean": "rm -rf scripts/benchmark/*/",
64
64
  "npmclilint": "npmcli-lint",
65
- "postlint": "npm-template-check"
65
+ "postlint": "npm-template-check",
66
+ "template-copy": "npm-template-copy --force"
66
67
  },
67
68
  "repository": {
68
69
  "type": "git",
69
- "url": "https://github.com/npm/arborist"
70
+ "url": "https://github.com/npm/cli",
71
+ "directory": "workspaces/arborist"
70
72
  },
71
73
  "author": "GitHub Inc.",
72
74
  "license": "ISC",
@@ -101,6 +103,6 @@
101
103
  "!test/fixtures/*.js"
102
104
  ],
103
105
  "templateOSS": {
104
- "version": "2.4.3"
106
+ "version": "2.9.2"
105
107
  }
106
108
  }