pnpm 7.9.1 → 7.9.2

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.
Files changed (108) hide show
  1. package/README.md +22 -7
  2. package/bin/pnpm.cjs +3 -0
  3. package/bin/pnpx.cjs +1 -15
  4. package/dist/node_modules/.modules.yaml +3 -3
  5. package/dist/node_modules/.pnpm/lock.yaml +76 -42
  6. package/dist/node_modules/@npmcli/fs/lib/common/owner-sync.js +96 -0
  7. package/dist/node_modules/@npmcli/fs/lib/common/owner.js +8 -4
  8. package/dist/node_modules/@npmcli/fs/lib/copy-file.js +3 -9
  9. package/dist/node_modules/@npmcli/fs/lib/fs.js +9 -3
  10. package/dist/node_modules/@npmcli/fs/lib/index.js +3 -1
  11. package/dist/node_modules/@npmcli/fs/lib/mkdir.js +19 -0
  12. package/dist/node_modules/@npmcli/fs/lib/mkdtemp.js +3 -8
  13. package/dist/node_modules/@npmcli/fs/lib/with-owner-sync.js +21 -0
  14. package/dist/node_modules/@npmcli/fs/lib/with-owner.js +21 -0
  15. package/dist/node_modules/@npmcli/fs/lib/with-temp-dir.js +4 -2
  16. package/dist/node_modules/@npmcli/fs/lib/write-file.js +3 -8
  17. package/dist/node_modules/@npmcli/fs/package.json +21 -9
  18. package/dist/node_modules/@npmcli/move-file/{index.js → lib/index.js} +50 -27
  19. package/dist/node_modules/@npmcli/move-file/package.json +20 -7
  20. package/dist/node_modules/@tootallnate/once/LICENSE +21 -0
  21. package/dist/node_modules/@tootallnate/once/dist/index.js +21 -36
  22. package/dist/node_modules/@tootallnate/once/dist/index.js.map +1 -1
  23. package/dist/node_modules/@tootallnate/once/dist/overloaded-parameters.js +3 -0
  24. package/dist/node_modules/@tootallnate/once/dist/overloaded-parameters.js.map +1 -0
  25. package/dist/node_modules/@tootallnate/once/dist/types.js +3 -0
  26. package/dist/node_modules/@tootallnate/once/dist/types.js.map +1 -0
  27. package/dist/node_modules/@tootallnate/once/package.json +22 -15
  28. package/dist/node_modules/cacache/lib/content/read.js +99 -102
  29. package/dist/node_modules/cacache/lib/content/rm.js +9 -8
  30. package/dist/node_modules/cacache/lib/content/write.js +67 -67
  31. package/dist/node_modules/cacache/lib/entry-index.js +128 -118
  32. package/dist/node_modules/cacache/{get.js → lib/get.js} +88 -100
  33. package/dist/node_modules/cacache/{index.js → lib/index.js} +5 -6
  34. package/dist/node_modules/cacache/lib/memoization.js +10 -11
  35. package/dist/node_modules/cacache/{put.js → lib/put.js} +23 -26
  36. package/dist/node_modules/cacache/{rm.js → lib/rm.js} +3 -3
  37. package/dist/node_modules/cacache/lib/util/fix-owner.js +41 -38
  38. package/dist/node_modules/cacache/lib/util/move-file.js +36 -47
  39. package/dist/node_modules/cacache/lib/util/tmp.js +5 -7
  40. package/dist/node_modules/cacache/lib/verify.js +160 -190
  41. package/dist/node_modules/cacache/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
  42. package/dist/node_modules/cacache/node_modules/brace-expansion/LICENSE +21 -0
  43. package/dist/node_modules/cacache/node_modules/brace-expansion/index.js +203 -0
  44. package/dist/node_modules/cacache/node_modules/brace-expansion/package.json +46 -0
  45. package/dist/node_modules/cacache/node_modules/glob/LICENSE +15 -0
  46. package/dist/node_modules/cacache/node_modules/glob/common.js +240 -0
  47. package/dist/node_modules/cacache/node_modules/glob/glob.js +790 -0
  48. package/dist/node_modules/cacache/node_modules/glob/package.json +55 -0
  49. package/dist/node_modules/cacache/node_modules/glob/sync.js +486 -0
  50. package/dist/node_modules/cacache/node_modules/minimatch/LICENSE +15 -0
  51. package/dist/node_modules/cacache/node_modules/minimatch/lib/path.js +4 -0
  52. package/dist/node_modules/cacache/node_modules/minimatch/minimatch.js +906 -0
  53. package/dist/node_modules/cacache/node_modules/minimatch/package.json +32 -0
  54. package/dist/node_modules/cacache/package.json +34 -30
  55. package/dist/node_modules/http-proxy-agent/dist/agent.js +3 -3
  56. package/dist/node_modules/http-proxy-agent/dist/agent.js.map +1 -1
  57. package/dist/node_modules/http-proxy-agent/package.json +4 -4
  58. package/dist/node_modules/lru-cache/LICENSE +1 -1
  59. package/dist/node_modules/lru-cache/index.js +921 -247
  60. package/dist/node_modules/lru-cache/package.json +49 -9
  61. package/dist/node_modules/make-fetch-happen/LICENSE +1 -1
  62. package/dist/node_modules/make-fetch-happen/lib/agent.js +34 -14
  63. package/dist/node_modules/make-fetch-happen/lib/cache/entry.js +90 -106
  64. package/dist/node_modules/make-fetch-happen/lib/cache/errors.js +1 -0
  65. package/dist/node_modules/make-fetch-happen/lib/cache/index.js +10 -6
  66. package/dist/node_modules/make-fetch-happen/lib/cache/policy.js +21 -21
  67. package/dist/node_modules/make-fetch-happen/lib/dns.js +49 -0
  68. package/dist/node_modules/make-fetch-happen/lib/fetch.js +40 -22
  69. package/dist/node_modules/make-fetch-happen/lib/index.js +4 -3
  70. package/dist/node_modules/make-fetch-happen/lib/options.js +17 -9
  71. package/dist/node_modules/make-fetch-happen/lib/pipeline.js +41 -0
  72. package/dist/node_modules/make-fetch-happen/lib/remote.js +28 -9
  73. package/dist/node_modules/make-fetch-happen/package.json +36 -33
  74. package/dist/node_modules/minipass-fetch/lib/blob.js +4 -4
  75. package/dist/node_modules/minipass-fetch/lib/body.js +63 -49
  76. package/dist/node_modules/minipass-fetch/lib/fetch-error.js +2 -1
  77. package/dist/node_modules/minipass-fetch/lib/headers.js +38 -21
  78. package/dist/node_modules/minipass-fetch/lib/index.js +130 -106
  79. package/dist/node_modules/minipass-fetch/lib/request.js +46 -28
  80. package/dist/node_modules/minipass-fetch/lib/response.js +3 -2
  81. package/dist/node_modules/minipass-fetch/package.json +27 -14
  82. package/dist/node_modules/node-gyp/.github/workflows/release-please.yml +1 -1
  83. package/dist/node_modules/node-gyp/.github/workflows/tests.yml +16 -9
  84. package/dist/node_modules/node-gyp/.github/workflows/visual-studio.yml +16 -8
  85. package/dist/node_modules/node-gyp/lib/build.js +7 -0
  86. package/dist/node_modules/node-gyp/lib/configure.js +26 -1
  87. package/dist/node_modules/node-gyp/lib/create-config-gypi.js +2 -1
  88. package/dist/node_modules/node-gyp/lib/find-visualstudio.js +9 -8
  89. package/dist/node_modules/node-gyp/lib/node-gyp.js +4 -0
  90. package/dist/node_modules/node-gyp/package.json +4 -4
  91. package/dist/node_modules/semver/node_modules/lru-cache/LICENSE +15 -0
  92. package/dist/node_modules/semver/node_modules/lru-cache/index.js +334 -0
  93. package/dist/node_modules/semver/node_modules/lru-cache/package.json +34 -0
  94. package/dist/node_modules/socks-proxy-agent/dist/index.js +3 -3
  95. package/dist/node_modules/socks-proxy-agent/dist/index.js.map +1 -1
  96. package/dist/node_modules/socks-proxy-agent/package.json +2 -2
  97. package/dist/node_modules/ssri/{index.js → lib/index.js} +78 -24
  98. package/dist/node_modules/ssri/package.json +27 -16
  99. package/dist/pnpm.cjs +67042 -65886
  100. package/package.json +6 -6
  101. package/dist/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js +0 -17
  102. package/dist/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js +0 -121
  103. package/dist/node_modules/@npmcli/fs/lib/mkdir/index.js +0 -32
  104. package/dist/node_modules/@npmcli/fs/lib/mkdir/polyfill.js +0 -81
  105. package/dist/node_modules/cacache/lib/util/disposer.js +0 -30
  106. package/dist/node_modules/cacache/ls.js +0 -6
  107. package/dist/node_modules/cacache/verify.js +0 -3
  108. package/dist/node_modules/minipass-fetch/index.js +0 -1
@@ -1,20 +1,19 @@
1
1
  'use strict'
2
2
 
3
- const ls = require('./ls.js')
4
3
  const get = require('./get.js')
5
4
  const put = require('./put.js')
6
5
  const rm = require('./rm.js')
7
6
  const verify = require('./verify.js')
8
- const { clearMemoized } = require('./lib/memoization.js')
9
- const tmp = require('./lib/util/tmp.js')
10
- const index = require('./lib/entry-index.js')
7
+ const { clearMemoized } = require('./memoization.js')
8
+ const tmp = require('./util/tmp.js')
9
+ const index = require('./entry-index.js')
11
10
 
12
11
  module.exports.index = {}
13
12
  module.exports.index.compact = index.compact
14
13
  module.exports.index.insert = index.insert
15
14
 
16
- module.exports.ls = ls
17
- module.exports.ls.stream = ls.stream
15
+ module.exports.ls = index.ls
16
+ module.exports.ls.stream = index.lsStream
18
17
 
19
18
  module.exports.get = get
20
19
  module.exports.get.byDigest = get.byDigest
@@ -2,13 +2,11 @@
2
2
 
3
3
  const LRU = require('lru-cache')
4
4
 
5
- const MAX_SIZE = 50 * 1024 * 1024 // 50MB
6
- const MAX_AGE = 3 * 60 * 1000
7
-
8
5
  const MEMOIZED = new LRU({
9
- max: MAX_SIZE,
10
- maxAge: MAX_AGE,
11
- length: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length,
6
+ max: 500,
7
+ maxSize: 50 * 1024 * 1024, // 50MB
8
+ ttl: 3 * 60 * 1000, // 3 minutes
9
+ sizeCalculation: (entry, key) => key.startsWith('key:') ? entry.data.length : entry.length,
12
10
  })
13
11
 
14
12
  module.exports.clearMemoized = clearMemoized
@@ -18,7 +16,7 @@ function clearMemoized () {
18
16
  MEMOIZED.forEach((v, k) => {
19
17
  old[k] = v
20
18
  })
21
- MEMOIZED.reset()
19
+ MEMOIZED.clear()
22
20
  return old
23
21
  }
24
22
 
@@ -62,12 +60,13 @@ class ObjProxy {
62
60
  }
63
61
 
64
62
  function pickMem (opts) {
65
- if (!opts || !opts.memoize)
63
+ if (!opts || !opts.memoize) {
66
64
  return MEMOIZED
67
- else if (opts.memoize.get && opts.memoize.set)
65
+ } else if (opts.memoize.get && opts.memoize.set) {
68
66
  return opts.memoize
69
- else if (typeof opts.memoize === 'object')
67
+ } else if (typeof opts.memoize === 'object') {
70
68
  return new ObjProxy(opts.memoize)
71
- else
69
+ } else {
72
70
  return MEMOIZED
71
+ }
73
72
  }
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
- const index = require('./lib/entry-index')
4
- const memo = require('./lib/memoization')
5
- const write = require('./lib/content/write')
3
+ const index = require('./entry-index')
4
+ const memo = require('./memoization')
5
+ const write = require('./content/write')
6
6
  const Flush = require('minipass-flush')
7
7
  const { PassThrough } = require('minipass-collect')
8
8
  const Pipeline = require('minipass-pipeline')
@@ -14,19 +14,16 @@ const putOpts = (opts) => ({
14
14
 
15
15
  module.exports = putData
16
16
 
17
- function putData (cache, key, data, opts = {}) {
17
+ async function putData (cache, key, data, opts = {}) {
18
18
  const { memoize } = opts
19
19
  opts = putOpts(opts)
20
- return write(cache, data, opts).then((res) => {
21
- return index
22
- .insert(cache, key, res.integrity, { ...opts, size: res.size })
23
- .then((entry) => {
24
- if (memoize)
25
- memo.put(cache, entry, data, opts)
20
+ const res = await write(cache, data, opts)
21
+ const entry = await index.insert(cache, key, res.integrity, { ...opts, size: res.size })
22
+ if (memoize) {
23
+ memo.put(cache, entry, data, opts)
24
+ }
26
25
 
27
- return res.integrity
28
- })
29
- })
26
+ return res.integrity
30
27
  }
31
28
 
32
29
  module.exports.stream = putStream
@@ -36,6 +33,7 @@ function putStream (cache, key, opts = {}) {
36
33
  opts = putOpts(opts)
37
34
  let integrity
38
35
  let size
36
+ let error
39
37
 
40
38
  let memoData
41
39
  const pipeline = new Pipeline()
@@ -57,25 +55,24 @@ function putStream (cache, key, opts = {}) {
57
55
  .on('size', (s) => {
58
56
  size = s
59
57
  })
58
+ .on('error', (err) => {
59
+ error = err
60
+ })
60
61
 
61
62
  pipeline.push(contentStream)
62
63
 
63
64
  // last but not least, we write the index and emit hash and size,
64
65
  // and memoize if we're doing that
65
66
  pipeline.push(new Flush({
66
- flush () {
67
- return index
68
- .insert(cache, key, integrity, { ...opts, size })
69
- .then((entry) => {
70
- if (memoize && memoData)
71
- memo.put(cache, entry, memoData, opts)
72
-
73
- if (integrity)
74
- pipeline.emit('integrity', integrity)
75
-
76
- if (size)
77
- pipeline.emit('size', size)
78
- })
67
+ async flush () {
68
+ if (!error) {
69
+ const entry = await index.insert(cache, key, integrity, { ...opts, size })
70
+ if (memoize && memoData) {
71
+ memo.put(cache, entry, memoData, opts)
72
+ }
73
+ pipeline.emit('integrity', integrity)
74
+ pipeline.emit('size', size)
75
+ }
79
76
  },
80
77
  }))
81
78
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  const util = require('util')
4
4
 
5
- const index = require('./lib/entry-index')
6
- const memo = require('./lib/memoization')
5
+ const index = require('./entry-index')
6
+ const memo = require('./memoization')
7
7
  const path = require('path')
8
8
  const rimraf = util.promisify(require('rimraf'))
9
- const rmContent = require('./lib/content/rm')
9
+ const rmContent = require('./content/rm')
10
10
 
11
11
  module.exports = entry
12
12
  module.exports.entry = entry
@@ -33,38 +33,38 @@ const getSelf = () => {
33
33
 
34
34
  module.exports.chownr = fixOwner
35
35
 
36
- function fixOwner (cache, filepath) {
36
+ async function fixOwner (cache, filepath) {
37
37
  if (!process.getuid) {
38
38
  // This platform doesn't need ownership fixing
39
- return Promise.resolve()
39
+ return
40
40
  }
41
41
 
42
42
  getSelf()
43
43
  if (self.uid !== 0) {
44
44
  // almost certainly can't chown anyway
45
- return Promise.resolve()
45
+ return
46
46
  }
47
47
 
48
- return Promise.resolve(inferOwner(cache)).then((owner) => {
49
- const { uid, gid } = owner
48
+ const { uid, gid } = await inferOwner(cache)
50
49
 
51
- // No need to override if it's already what we used.
52
- if (self.uid === uid && self.gid === gid)
53
- return
54
-
55
- return inflight('fixOwner: fixing ownership on ' + filepath, () =>
56
- chownr(
57
- filepath,
58
- typeof uid === 'number' ? uid : self.uid,
59
- typeof gid === 'number' ? gid : self.gid
60
- ).catch((err) => {
61
- if (err.code === 'ENOENT')
62
- return null
63
-
64
- throw err
65
- })
66
- )
67
- })
50
+ // No need to override if it's already what we used.
51
+ if (self.uid === uid && self.gid === gid) {
52
+ return
53
+ }
54
+
55
+ return inflight('fixOwner: fixing ownership on ' + filepath, () =>
56
+ chownr(
57
+ filepath,
58
+ typeof uid === 'number' ? uid : self.uid,
59
+ typeof gid === 'number' ? gid : self.gid
60
+ ).catch((err) => {
61
+ if (err.code === 'ENOENT') {
62
+ return null
63
+ }
64
+
65
+ throw err
66
+ })
67
+ )
68
68
  }
69
69
 
70
70
  module.exports.chownr.sync = fixOwnerSync
@@ -93,8 +93,9 @@ function fixOwnerSync (cache, filepath) {
93
93
  )
94
94
  } catch (err) {
95
95
  // only catch ENOENT, any other error is a problem.
96
- if (err.code === 'ENOENT')
96
+ if (err.code === 'ENOENT') {
97
97
  return null
98
+ }
98
99
 
99
100
  throw err
100
101
  }
@@ -102,24 +103,25 @@ function fixOwnerSync (cache, filepath) {
102
103
 
103
104
  module.exports.mkdirfix = mkdirfix
104
105
 
105
- function mkdirfix (cache, p, cb) {
106
+ async function mkdirfix (cache, p, cb) {
106
107
  // we have to infer the owner _before_ making the directory, even though
107
108
  // we aren't going to use the results, since the cache itself might not
108
109
  // exist yet. If we mkdirp it, then our current uid/gid will be assumed
109
110
  // to be correct if it creates the cache folder in the process.
110
- return Promise.resolve(inferOwner(cache)).then(() => {
111
- return mkdirp(p)
112
- .then((made) => {
113
- if (made)
114
- return fixOwner(cache, made).then(() => made)
115
- })
116
- .catch((err) => {
117
- if (err.code === 'EEXIST')
118
- return fixOwner(cache, p).then(() => null)
119
-
120
- throw err
121
- })
122
- })
111
+ await inferOwner(cache)
112
+ try {
113
+ const made = await mkdirp(p)
114
+ if (made) {
115
+ await fixOwner(cache, made)
116
+ return made
117
+ }
118
+ } catch (err) {
119
+ if (err.code === 'EEXIST') {
120
+ await fixOwner(cache, p)
121
+ return null
122
+ }
123
+ throw err
124
+ }
123
125
  }
124
126
 
125
127
  module.exports.mkdirfix.sync = mkdirfixSync
@@ -136,7 +138,8 @@ function mkdirfixSync (cache, p) {
136
138
  if (err.code === 'EEXIST') {
137
139
  fixOwnerSync(cache, p)
138
140
  return null
139
- } else
141
+ } else {
140
142
  throw err
143
+ }
141
144
  }
142
145
  }
@@ -1,18 +1,13 @@
1
1
  'use strict'
2
2
 
3
- const fs = require('fs')
4
- const util = require('util')
5
- const chmod = util.promisify(fs.chmod)
6
- const unlink = util.promisify(fs.unlink)
7
- const stat = util.promisify(fs.stat)
3
+ const fs = require('@npmcli/fs')
8
4
  const move = require('@npmcli/move-file')
9
5
  const pinflight = require('promise-inflight')
10
6
 
11
7
  module.exports = moveFile
12
8
 
13
- function moveFile (src, dest) {
14
- const isWindows = global.__CACACHE_TEST_FAKE_WINDOWS__ ||
15
- process.platform === 'win32'
9
+ async function moveFile (src, dest) {
10
+ const isWindows = process.platform === 'win32'
16
11
 
17
12
  // This isn't quite an fs.rename -- the assumption is that
18
13
  // if `dest` already exists, and we get certain errors while
@@ -23,45 +18,39 @@ function moveFile (src, dest) {
23
18
  // content their own way.
24
19
  //
25
20
  // Note that, as the name suggests, this strictly only supports file moves.
26
- return new Promise((resolve, reject) => {
27
- fs.link(src, dest, (err) => {
28
- if (err) {
29
- if (isWindows && err.code === 'EPERM') {
30
- // XXX This is a really weird way to handle this situation, as it
31
- // results in the src file being deleted even though the dest
32
- // might not exist. Since we pretty much always write files to
33
- // deterministic locations based on content hash, this is likely
34
- // ok (or at worst, just ends in a future cache miss). But it would
35
- // be worth investigating at some time in the future if this is
36
- // really what we want to do here.
37
- return resolve()
38
- } else if (err.code === 'EEXIST' || err.code === 'EBUSY') {
39
- // file already exists, so whatever
40
- return resolve()
41
- } else
42
- return reject(err)
43
- } else
44
- return resolve()
45
- })
46
- })
47
- .then(() => {
48
- // content should never change for any reason, so make it read-only
49
- return Promise.all([
50
- unlink(src),
51
- !isWindows && chmod(dest, '0444'),
52
- ])
53
- })
54
- .catch(() => {
55
- return pinflight('cacache-move-file:' + dest, () => {
56
- return stat(dest).catch((err) => {
57
- if (err.code !== 'ENOENT') {
58
- // Something else is wrong here. Bail bail bail
59
- throw err
60
- }
61
- // file doesn't already exist! let's try a rename -> copy fallback
62
- // only delete if it successfully copies
63
- return move(src, dest)
64
- })
21
+ try {
22
+ await fs.link(src, dest)
23
+ } catch (err) {
24
+ if (isWindows && err.code === 'EPERM') {
25
+ // XXX This is a really weird way to handle this situation, as it
26
+ // results in the src file being deleted even though the dest
27
+ // might not exist. Since we pretty much always write files to
28
+ // deterministic locations based on content hash, this is likely
29
+ // ok (or at worst, just ends in a future cache miss). But it would
30
+ // be worth investigating at some time in the future if this is
31
+ // really what we want to do here.
32
+ } else if (err.code === 'EEXIST' || err.code === 'EBUSY') {
33
+ // file already exists, so whatever
34
+ } else {
35
+ throw err
36
+ }
37
+ }
38
+ try {
39
+ await Promise.all([
40
+ fs.unlink(src),
41
+ !isWindows && fs.chmod(dest, '0444'),
42
+ ])
43
+ } catch (e) {
44
+ return pinflight('cacache-move-file:' + dest, async () => {
45
+ await fs.stat(dest).catch((err) => {
46
+ if (err.code !== 'ENOENT') {
47
+ // Something else is wrong here. Bail bail bail
48
+ throw err
49
+ }
65
50
  })
51
+ // file doesn't already exist! let's try a rename -> copy fallback
52
+ // only delete if it successfully copies
53
+ return move(src, dest)
66
54
  })
55
+ }
67
56
  }
@@ -7,15 +7,13 @@ const path = require('path')
7
7
 
8
8
  module.exports.mkdir = mktmpdir
9
9
 
10
- function mktmpdir (cache, opts = {}) {
10
+ async function mktmpdir (cache, opts = {}) {
11
11
  const { tmpPrefix } = opts
12
12
  const tmpDir = path.join(cache, 'tmp')
13
- return fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' })
14
- .then(() => {
15
- // do not use path.join(), it drops the trailing / if tmpPrefix is unset
16
- const target = `${tmpDir}${path.sep}${tmpPrefix || ''}`
17
- return fs.mkdtemp(target, { owner: 'inherit' })
18
- })
13
+ await fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' })
14
+ // do not use path.join(), it drops the trailing / if tmpPrefix is unset
15
+ const target = `${tmpDir}${path.sep}${tmpPrefix || ''}`
16
+ return fs.mkdtemp(target, { owner: 'inherit' })
19
17
  }
20
18
 
21
19
  module.exports.withTmp = withTmp