pnpm 7.9.5 → 7.10.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.
Files changed (43) hide show
  1. package/README.md +2 -2
  2. package/dist/node_modules/.modules.yaml +2 -2
  3. package/dist/node_modules/.pnpm/lock.yaml +35 -33
  4. package/dist/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js +17 -0
  5. package/dist/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js +121 -0
  6. package/dist/node_modules/@npmcli/fs/lib/common/owner-sync.js +4 -8
  7. package/dist/node_modules/@npmcli/fs/lib/common/owner.js +4 -8
  8. package/dist/node_modules/@npmcli/fs/lib/index.js +1 -1
  9. package/dist/node_modules/@npmcli/fs/lib/mkdir/index.js +29 -0
  10. package/dist/node_modules/@npmcli/fs/lib/mkdir/polyfill.js +81 -0
  11. package/dist/node_modules/@npmcli/fs/lib/with-temp-dir.js +2 -4
  12. package/dist/node_modules/@npmcli/fs/package.json +4 -4
  13. package/dist/node_modules/@npmcli/move-file/lib/index.js +6 -16
  14. package/dist/node_modules/@npmcli/move-file/package.json +3 -3
  15. package/dist/node_modules/are-we-there-yet/lib/tracker-group.js +1 -1
  16. package/dist/node_modules/are-we-there-yet/package.json +13 -12
  17. package/dist/node_modules/cacache/lib/content/read.js +1 -1
  18. package/dist/node_modules/cacache/lib/content/write.js +0 -2
  19. package/dist/node_modules/cacache/lib/entry-index.js +0 -1
  20. package/dist/node_modules/cacache/lib/get.js +0 -1
  21. package/dist/node_modules/cacache/package.json +2 -2
  22. package/dist/node_modules/ip/lib/ip.js +59 -54
  23. package/dist/node_modules/ip/package.json +1 -1
  24. package/dist/node_modules/lru-cache/index.js +8 -21
  25. package/dist/node_modules/lru-cache/package.json +2 -3
  26. package/dist/node_modules/make-fetch-happen/lib/cache/entry.js +0 -2
  27. package/dist/node_modules/make-fetch-happen/package.json +1 -1
  28. package/dist/node_modules/minipass-fetch/lib/body.js +11 -13
  29. package/dist/node_modules/minipass-fetch/package.json +3 -4
  30. package/dist/node_modules/socks/build/client/socksclient.js +1 -5
  31. package/dist/node_modules/socks/build/client/socksclient.js.map +1 -1
  32. package/dist/node_modules/socks/build/common/receivebuffer.js.map +1 -1
  33. package/dist/node_modules/socks/build/common/util.js +1 -0
  34. package/dist/node_modules/socks/build/common/util.js.map +1 -1
  35. package/dist/node_modules/socks/build/index.js +1 -5
  36. package/dist/node_modules/socks/build/index.js.map +1 -1
  37. package/dist/node_modules/socks/package.json +37 -12
  38. package/dist/node_modules/unique-filename/{lib/index.js → index.js} +1 -0
  39. package/dist/node_modules/unique-filename/package.json +8 -29
  40. package/dist/pnpm.cjs +124561 -117523
  41. package/package.json +3 -3
  42. package/dist/node_modules/@npmcli/fs/lib/mkdir.js +0 -19
  43. package/dist/node_modules/socks/.eslintrc.cjs +0 -11
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)
2
2
 
3
- [中文](https://pnpm.io/zh/) |
3
+ [简体中文](https://pnpm.io/zh/) |
4
4
  [日本語](https://pnpm.io/ja/) |
5
5
  [한국어](https://pnpm.io/ko/) |
6
6
  [Italiano](https://pnpm.io/it/) |
7
- [Français](https://pnpm.io/fr/)
7
+ [Português Brasileiro](https://pnpm.io/pt/)
8
8
 
9
9
  ![](https://i.imgur.com/qlW1eEG.png)
10
10
 
@@ -7,11 +7,11 @@ included:
7
7
  injectedDeps: {}
8
8
  layoutVersion: 5
9
9
  nodeLinker: hoisted
10
- packageManager: pnpm@7.9.4
10
+ packageManager: pnpm@7.10.0-1
11
11
  pendingBuilds:
12
12
  - /node-gyp/9.1.0
13
13
  - /encoding/0.1.13
14
- prunedAt: Wed, 24 Aug 2022 12:08:52 GMT
14
+ prunedAt: Sun, 04 Sep 2022 09:32:34 GMT
15
15
  publicHoistPattern:
16
16
  - '*eslint*'
17
17
  - '*prettier*'
@@ -13,8 +13,8 @@ packages:
13
13
  dev: false
14
14
  optional: true
15
15
 
16
- /@npmcli/fs/2.1.2:
17
- resolution: {integrity: sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==}
16
+ /@npmcli/fs/2.1.0:
17
+ resolution: {integrity: sha512-DmfBvNXGaetMxj9LTp8NAN9vEidXURrf5ZTslQzEAi/6GbW+4yjaLFQc6Tue5cpZ9Frlk4OBo/Snf1Bh/S7qTQ==}
18
18
  engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
19
19
  dependencies:
20
20
  '@gar/promisify': 1.1.3
@@ -22,8 +22,8 @@ packages:
22
22
  dev: false
23
23
  optional: true
24
24
 
25
- /@npmcli/move-file/2.0.1:
26
- resolution: {integrity: sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==}
25
+ /@npmcli/move-file/2.0.0:
26
+ resolution: {integrity: sha512-UR6D5f4KEGWJV6BGPH3Qb2EtgH+t+1XQ1Tt85c7qicN6cezzuHPdZwwAxqZr4JLtnQu0LZsTza/5gmNmSl8XLg==}
27
27
  engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
28
28
  dependencies:
29
29
  mkdirp: 1.0.4
@@ -84,9 +84,9 @@ packages:
84
84
  dev: false
85
85
  optional: true
86
86
 
87
- /are-we-there-yet/3.0.1:
88
- resolution: {integrity: sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==}
89
- engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
87
+ /are-we-there-yet/3.0.0:
88
+ resolution: {integrity: sha512-0GWpv50YSOcLXaN6/FAKY3vfRbllXWV2xvfA/oKJF8pzFhWXPV+yjhJXDBbjscDYowv7Yw1A3uigpzn5iEGTyw==}
89
+ engines: {node: ^12.13.0 || ^14.15.0 || >=16}
90
90
  dependencies:
91
91
  delegates: 1.0.0
92
92
  readable-stream: 3.6.0
@@ -113,17 +113,17 @@ packages:
113
113
  dev: false
114
114
  optional: true
115
115
 
116
- /cacache/16.1.3:
117
- resolution: {integrity: sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==}
116
+ /cacache/16.1.1:
117
+ resolution: {integrity: sha512-VDKN+LHyCQXaaYZ7rA/qtkURU+/yYhviUdvqEv2LT6QPZU8jpyzEkEVAcKlKLt5dJ5BRp11ym8lo3NKLluEPLg==}
118
118
  engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
119
119
  dependencies:
120
- '@npmcli/fs': 2.1.2
121
- '@npmcli/move-file': 2.0.1
120
+ '@npmcli/fs': 2.1.0
121
+ '@npmcli/move-file': 2.0.0
122
122
  chownr: 2.0.0
123
123
  fs-minipass: 2.1.0
124
124
  glob: 8.0.3
125
125
  infer-owner: 1.0.4
126
- lru-cache: 7.14.0
126
+ lru-cache: 7.13.0
127
127
  minipass: 3.3.4
128
128
  minipass-collect: 1.0.2
129
129
  minipass-flush: 1.0.5
@@ -134,7 +134,7 @@ packages:
134
134
  rimraf: 3.0.2
135
135
  ssri: 9.0.1
136
136
  tar: 6.1.11
137
- unique-filename: 2.0.0
137
+ unique-filename: 1.1.1
138
138
  transitivePeerDependencies:
139
139
  - bluebird
140
140
  dev: false
@@ -351,8 +351,8 @@ packages:
351
351
  dev: false
352
352
  optional: true
353
353
 
354
- /ip/2.0.0:
355
- resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==}
354
+ /ip/1.1.8:
355
+ resolution: {integrity: sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==}
356
356
  dev: false
357
357
  optional: true
358
358
 
@@ -380,26 +380,26 @@ packages:
380
380
  dev: false
381
381
  optional: true
382
382
 
383
- /lru-cache/7.14.0:
384
- resolution: {integrity: sha512-EIRtP1GrSJny0dqb50QXRUNBxHJhcpxHC++M5tD7RYbvLLn5KVWKsbyswSSqDuU15UFi3bgTQIY8nhDMeF6aDQ==}
383
+ /lru-cache/7.13.0:
384
+ resolution: {integrity: sha512-SNFKDOORR41fkWP3DXiIUvXvfzDRPg3bxD1+29iRyP2ZW+Njp2o6zhx9YkEpq1tbP0AEDNW2VBUedzDIxmNhdg==}
385
385
  engines: {node: '>=12'}
386
386
  dev: false
387
387
  optional: true
388
388
 
389
- /make-fetch-happen/10.2.1:
390
- resolution: {integrity: sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==}
389
+ /make-fetch-happen/10.1.8:
390
+ resolution: {integrity: sha512-0ASJbG12Au6+N5I84W+8FhGS6iM8MyzvZady+zaQAu+6IOaESFzCLLD0AR1sAFF3Jufi8bxm586ABN6hWd3k7g==}
391
391
  engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
392
392
  dependencies:
393
393
  agentkeepalive: 4.2.1
394
- cacache: 16.1.3
394
+ cacache: 16.1.1
395
395
  http-cache-semantics: 4.1.0
396
396
  http-proxy-agent: 5.0.0
397
397
  https-proxy-agent: 5.0.1
398
398
  is-lambda: 1.0.1
399
- lru-cache: 7.14.0
399
+ lru-cache: 7.13.0
400
400
  minipass: 3.3.4
401
401
  minipass-collect: 1.0.2
402
- minipass-fetch: 2.1.2
402
+ minipass-fetch: 2.1.0
403
403
  minipass-flush: 1.0.5
404
404
  minipass-pipeline: 1.2.4
405
405
  negotiator: 0.6.3
@@ -435,8 +435,8 @@ packages:
435
435
  dev: false
436
436
  optional: true
437
437
 
438
- /minipass-fetch/2.1.2:
439
- resolution: {integrity: sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==}
438
+ /minipass-fetch/2.1.0:
439
+ resolution: {integrity: sha512-H9U4UVBGXEyyWJnqYDCLp1PwD8XIkJ4akNHp1aGVI+2Ym7wQMlxDKi4IB4JbmyU+pl9pEs/cVrK6cOuvmbK4Sg==}
440
440
  engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
441
441
  dependencies:
442
442
  minipass: 3.3.4
@@ -520,7 +520,7 @@ packages:
520
520
  env-paths: 2.2.1
521
521
  glob: 7.2.3
522
522
  graceful-fs: 4.2.10
523
- make-fetch-happen: 10.2.1
523
+ make-fetch-happen: 10.1.8
524
524
  nopt: 5.0.0
525
525
  npmlog: 6.0.2
526
526
  rimraf: 3.0.2
@@ -546,7 +546,7 @@ packages:
546
546
  resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==}
547
547
  engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
548
548
  dependencies:
549
- are-we-there-yet: 3.0.1
549
+ are-we-there-yet: 3.0.0
550
550
  console-control-strings: 1.1.0
551
551
  gauge: 4.0.4
552
552
  set-blocking: 2.0.0
@@ -658,17 +658,17 @@ packages:
658
658
  dependencies:
659
659
  agent-base: 6.0.2
660
660
  debug: 4.3.4
661
- socks: 2.7.0
661
+ socks: 2.6.2
662
662
  transitivePeerDependencies:
663
663
  - supports-color
664
664
  dev: false
665
665
  optional: true
666
666
 
667
- /socks/2.7.0:
668
- resolution: {integrity: sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==}
667
+ /socks/2.6.2:
668
+ resolution: {integrity: sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==}
669
669
  engines: {node: '>= 10.13.0', npm: '>= 3.0.0'}
670
670
  dependencies:
671
- ip: 2.0.0
671
+ ip: 1.1.8
672
672
  smart-buffer: 4.2.0
673
673
  dev: false
674
674
  optional: true
@@ -719,9 +719,8 @@ packages:
719
719
  dev: false
720
720
  optional: true
721
721
 
722
- /unique-filename/2.0.0:
723
- resolution: {integrity: sha512-tpzoz2RpZ//6Zt4GPpOFTyrnfZuSvjIfe8lvx6Thp4yTQwJtAFwPlssEBE62VhGA2We5/COyNpcIu+OABu3/Yg==}
724
- engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
722
+ /unique-filename/1.1.1:
723
+ resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==}
725
724
  dependencies:
726
725
  unique-slug: 2.0.2
727
726
  dev: false
@@ -764,3 +763,6 @@ packages:
764
763
  resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
765
764
  dev: false
766
765
  optional: true
766
+
767
+ time:
768
+ /node-gyp/9.1.0: '2022-07-14T01:03:18.318Z'
@@ -0,0 +1,17 @@
1
+ const url = require('url')
2
+
3
+ const node = require('../node.js')
4
+ const polyfill = require('./polyfill.js')
5
+
6
+ const useNative = node.satisfies('>=10.12.0')
7
+
8
+ const fileURLToPath = (path) => {
9
+ // the polyfill is tested separately from this module, no need to hack
10
+ // process.version to try to trigger it just for coverage
11
+ // istanbul ignore next
12
+ return useNative
13
+ ? url.fileURLToPath(path)
14
+ : polyfill(path)
15
+ }
16
+
17
+ module.exports = fileURLToPath
@@ -0,0 +1,121 @@
1
+ const { URL, domainToUnicode } = require('url')
2
+
3
+ const CHAR_LOWERCASE_A = 97
4
+ const CHAR_LOWERCASE_Z = 122
5
+
6
+ const isWindows = process.platform === 'win32'
7
+
8
+ class ERR_INVALID_FILE_URL_HOST extends TypeError {
9
+ constructor (platform) {
10
+ super(`File URL host must be "localhost" or empty on ${platform}`)
11
+ this.code = 'ERR_INVALID_FILE_URL_HOST'
12
+ }
13
+
14
+ toString () {
15
+ return `${this.name} [${this.code}]: ${this.message}`
16
+ }
17
+ }
18
+
19
+ class ERR_INVALID_FILE_URL_PATH extends TypeError {
20
+ constructor (msg) {
21
+ super(`File URL path ${msg}`)
22
+ this.code = 'ERR_INVALID_FILE_URL_PATH'
23
+ }
24
+
25
+ toString () {
26
+ return `${this.name} [${this.code}]: ${this.message}`
27
+ }
28
+ }
29
+
30
+ class ERR_INVALID_ARG_TYPE extends TypeError {
31
+ constructor (name, actual) {
32
+ super(`The "${name}" argument must be one of type string or an instance ` +
33
+ `of URL. Received type ${typeof actual} ${actual}`)
34
+ this.code = 'ERR_INVALID_ARG_TYPE'
35
+ }
36
+
37
+ toString () {
38
+ return `${this.name} [${this.code}]: ${this.message}`
39
+ }
40
+ }
41
+
42
+ class ERR_INVALID_URL_SCHEME extends TypeError {
43
+ constructor (expected) {
44
+ super(`The URL must be of scheme ${expected}`)
45
+ this.code = 'ERR_INVALID_URL_SCHEME'
46
+ }
47
+
48
+ toString () {
49
+ return `${this.name} [${this.code}]: ${this.message}`
50
+ }
51
+ }
52
+
53
+ const isURLInstance = (input) => {
54
+ return input != null && input.href && input.origin
55
+ }
56
+
57
+ const getPathFromURLWin32 = (url) => {
58
+ const hostname = url.hostname
59
+ let pathname = url.pathname
60
+ for (let n = 0; n < pathname.length; n++) {
61
+ if (pathname[n] === '%') {
62
+ const third = pathname.codePointAt(n + 2) | 0x20
63
+ if ((pathname[n + 1] === '2' && third === 102) ||
64
+ (pathname[n + 1] === '5' && third === 99)) {
65
+ throw new ERR_INVALID_FILE_URL_PATH('must not include encoded \\ or / characters')
66
+ }
67
+ }
68
+ }
69
+
70
+ pathname = pathname.replace(/\//g, '\\')
71
+ pathname = decodeURIComponent(pathname)
72
+ if (hostname !== '') {
73
+ return `\\\\${domainToUnicode(hostname)}${pathname}`
74
+ }
75
+
76
+ const letter = pathname.codePointAt(1) | 0x20
77
+ const sep = pathname[2]
78
+ if (letter < CHAR_LOWERCASE_A || letter > CHAR_LOWERCASE_Z ||
79
+ (sep !== ':')) {
80
+ throw new ERR_INVALID_FILE_URL_PATH('must be absolute')
81
+ }
82
+
83
+ return pathname.slice(1)
84
+ }
85
+
86
+ const getPathFromURLPosix = (url) => {
87
+ if (url.hostname !== '') {
88
+ throw new ERR_INVALID_FILE_URL_HOST(process.platform)
89
+ }
90
+
91
+ const pathname = url.pathname
92
+
93
+ for (let n = 0; n < pathname.length; n++) {
94
+ if (pathname[n] === '%') {
95
+ const third = pathname.codePointAt(n + 2) | 0x20
96
+ if (pathname[n + 1] === '2' && third === 102) {
97
+ throw new ERR_INVALID_FILE_URL_PATH('must not include encoded / characters')
98
+ }
99
+ }
100
+ }
101
+
102
+ return decodeURIComponent(pathname)
103
+ }
104
+
105
+ const fileURLToPath = (path) => {
106
+ if (typeof path === 'string') {
107
+ path = new URL(path)
108
+ } else if (!isURLInstance(path)) {
109
+ throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path)
110
+ }
111
+
112
+ if (path.protocol !== 'file:') {
113
+ throw new ERR_INVALID_URL_SCHEME('file')
114
+ }
115
+
116
+ return isWindows
117
+ ? getPathFromURLWin32(path)
118
+ : getPathFromURLPosix(path)
119
+ }
120
+
121
+ module.exports = fileURLToPath
@@ -1,6 +1,6 @@
1
1
  const { dirname, resolve } = require('path')
2
- const url = require('url')
3
2
 
3
+ const fileURLToPath = require('./file-url-to-path/index.js')
4
4
  const fs = require('../fs.js')
5
5
 
6
6
  // given a path, find the owner of the nearest parent
@@ -13,7 +13,7 @@ const find = (path) => {
13
13
  // fs methods accept URL objects with a scheme of file: so we need to unwrap
14
14
  // those into an actual path string before we can resolve it
15
15
  const resolved = path != null && path.href && path.origin
16
- ? resolve(url.fileURLToPath(path))
16
+ ? resolve(fileURLToPath(path))
17
17
  : resolve(path)
18
18
 
19
19
  let stat
@@ -50,15 +50,11 @@ const update = (path, uid, gid) => {
50
50
  if (uid === stat.uid && gid === stat.gid) {
51
51
  return
52
52
  }
53
- } catch {
54
- // ignore errors
55
- }
53
+ } catch (err) {}
56
54
 
57
55
  try {
58
56
  fs.chownSync(path, uid, gid)
59
- } catch {
60
- // ignore errors
61
- }
57
+ } catch (err) {}
62
58
  }
63
59
 
64
60
  // accepts a `path` and the `owner` property of an options object and normalizes
@@ -1,6 +1,6 @@
1
1
  const { dirname, resolve } = require('path')
2
- const url = require('url')
3
2
 
3
+ const fileURLToPath = require('./file-url-to-path/index.js')
4
4
  const fs = require('../fs.js')
5
5
 
6
6
  // given a path, find the owner of the nearest parent
@@ -13,7 +13,7 @@ const find = async (path) => {
13
13
  // fs methods accept URL objects with a scheme of file: so we need to unwrap
14
14
  // those into an actual path string before we can resolve it
15
15
  const resolved = path != null && path.href && path.origin
16
- ? resolve(url.fileURLToPath(path))
16
+ ? resolve(fileURLToPath(path))
17
17
  : resolve(path)
18
18
 
19
19
  let stat
@@ -50,15 +50,11 @@ const update = async (path, uid, gid) => {
50
50
  if (uid === stat.uid && gid === stat.gid) {
51
51
  return
52
52
  }
53
- } catch {
54
- // ignore errors
55
- }
53
+ } catch (err) {}
56
54
 
57
55
  try {
58
56
  await fs.chown(path, uid, gid)
59
- } catch {
60
- // ignore errors
61
- }
57
+ } catch (err) {}
62
58
  }
63
59
 
64
60
  // accepts a `path` and the `owner` property of an options object and normalizes
@@ -2,7 +2,7 @@ module.exports = {
2
2
  ...require('./fs.js'),
3
3
  copyFile: require('./copy-file.js'),
4
4
  cp: require('./cp/index.js'),
5
- mkdir: require('./mkdir.js'),
5
+ mkdir: require('./mkdir/index.js'),
6
6
  mkdtemp: require('./mkdtemp.js'),
7
7
  rm: require('./rm/index.js'),
8
8
  withTempDir: require('./with-temp-dir.js'),
@@ -0,0 +1,29 @@
1
+ const fs = require('../fs.js')
2
+ const getOptions = require('../common/get-options.js')
3
+ const node = require('../common/node.js')
4
+ const withOwner = require('../with-owner.js')
5
+
6
+ const polyfill = require('./polyfill.js')
7
+
8
+ // node 10.12.0 added the options parameter, which allows recursive and mode
9
+ // properties to be passed
10
+ const useNative = node.satisfies('>=10.12.0')
11
+
12
+ // extends mkdir with the ability to specify an owner of the new dir
13
+ const mkdir = async (path, opts) => {
14
+ const options = getOptions(opts, {
15
+ copy: ['mode', 'recursive'],
16
+ wrap: 'mode',
17
+ })
18
+
19
+ // the polyfill is tested separately from this module, no need to hack
20
+ // process.version to try to trigger it just for coverage
21
+ // istanbul ignore next
22
+ return withOwner(
23
+ path,
24
+ () => useNative ? fs.mkdir(path, options) : polyfill(path, options),
25
+ opts
26
+ )
27
+ }
28
+
29
+ module.exports = mkdir
@@ -0,0 +1,81 @@
1
+ const { dirname } = require('path')
2
+
3
+ const fileURLToPath = require('../common/file-url-to-path/index.js')
4
+ const fs = require('../fs.js')
5
+
6
+ const defaultOptions = {
7
+ mode: 0o777,
8
+ recursive: false,
9
+ }
10
+
11
+ const mkdir = async (path, opts) => {
12
+ const options = { ...defaultOptions, ...opts }
13
+
14
+ // if we're not in recursive mode, just call the real mkdir with the path and
15
+ // the mode option only
16
+ if (!options.recursive) {
17
+ return fs.mkdir(path, options.mode)
18
+ }
19
+
20
+ const makeDirectory = async (dir, mode) => {
21
+ // we can't use dirname directly since these functions support URL
22
+ // objects with the file: protocol as the path input, so first we get a
23
+ // string path, then we can call dirname on that
24
+ const parent = dir != null && dir.href && dir.origin
25
+ ? dirname(fileURLToPath(dir))
26
+ : dirname(dir)
27
+
28
+ // if the parent is the dir itself, try to create it. anything but EISDIR
29
+ // should be rethrown
30
+ if (parent === dir) {
31
+ try {
32
+ await fs.mkdir(dir, opts)
33
+ } catch (err) {
34
+ if (err.code !== 'EISDIR') {
35
+ throw err
36
+ }
37
+ }
38
+ return undefined
39
+ }
40
+
41
+ try {
42
+ await fs.mkdir(dir, mode)
43
+ return dir
44
+ } catch (err) {
45
+ // ENOENT means the parent wasn't there, so create that
46
+ if (err.code === 'ENOENT') {
47
+ const made = await makeDirectory(parent, mode)
48
+ await makeDirectory(dir, mode)
49
+ // return the shallowest path we created, i.e. the result of creating
50
+ // the parent
51
+ return made
52
+ }
53
+
54
+ // an EEXIST means there's already something there
55
+ // an EROFS means we have a read-only filesystem and can't create a dir
56
+ // any other error is fatal and we should give up now
57
+ if (err.code !== 'EEXIST' && err.code !== 'EROFS') {
58
+ throw err
59
+ }
60
+
61
+ // stat the directory, if the result is a directory, then we successfully
62
+ // created this one so return its path. otherwise, we reject with the
63
+ // original error by ignoring the error in the catch
64
+ try {
65
+ const stat = await fs.stat(dir)
66
+ if (stat.isDirectory()) {
67
+ // if it already existed, we didn't create anything so return
68
+ // undefined
69
+ return undefined
70
+ }
71
+ } catch (_) {}
72
+
73
+ // if the thing that's there isn't a directory, then just re-throw
74
+ throw err
75
+ }
76
+ }
77
+
78
+ return makeDirectory(path, options.mode)
79
+ }
80
+
81
+ module.exports = mkdir
@@ -1,7 +1,7 @@
1
1
  const { join, sep } = require('path')
2
2
 
3
3
  const getOptions = require('./common/get-options.js')
4
- const mkdir = require('./mkdir.js')
4
+ const mkdir = require('./mkdir/index.js')
5
5
  const mkdtemp = require('./mkdtemp.js')
6
6
  const rm = require('./rm/index.js')
7
7
 
@@ -27,9 +27,7 @@ const withTempDir = async (root, fn, opts) => {
27
27
 
28
28
  try {
29
29
  await rm(target, { force: true, recursive: true })
30
- } catch {
31
- // ignore errors
32
- }
30
+ } catch {}
33
31
 
34
32
  if (err) {
35
33
  throw err
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/fs",
3
- "version": "2.1.2",
3
+ "version": "2.1.0",
4
4
  "description": "filesystem utilities for the npm cli",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -33,8 +33,8 @@
33
33
  "license": "ISC",
34
34
  "devDependencies": {
35
35
  "@npmcli/eslint-config": "^3.0.1",
36
- "@npmcli/template-oss": "3.5.0",
37
- "tap": "^16.0.1"
36
+ "@npmcli/template-oss": "3.1.2",
37
+ "tap": "^15.1.6"
38
38
  },
39
39
  "dependencies": {
40
40
  "@gar/promisify": "^1.1.3",
@@ -45,6 +45,6 @@
45
45
  },
46
46
  "templateOSS": {
47
47
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
48
- "version": "3.5.0"
48
+ "version": "3.1.2"
49
49
  }
50
50
  }
@@ -97,19 +97,14 @@ const moveFile = async (source, destination, options = {}, root = true, symlinks
97
97
  }
98
98
  // try to determine what the actual file is so we can create the correct
99
99
  // type of symlink in windows
100
- let targetStat = 'file'
100
+ let targetStat
101
101
  try {
102
102
  targetStat = await stat(resolve(dirname(symSource), target))
103
- if (targetStat.isDirectory()) {
104
- targetStat = 'junction'
105
- }
106
- } catch {
107
- // targetStat remains 'file'
108
- }
103
+ } catch (err) {}
109
104
  await symlink(
110
105
  target,
111
106
  symDestination,
112
- targetStat
107
+ targetStat && targetStat.isDirectory() ? 'junction' : 'file'
113
108
  )
114
109
  }))
115
110
  await rimraf(source)
@@ -162,19 +157,14 @@ const moveFileSync = (source, destination, options = {}, root = true, symlinks =
162
157
  }
163
158
  // try to determine what the actual file is so we can create the correct
164
159
  // type of symlink in windows
165
- let targetStat = 'file'
160
+ let targetStat
166
161
  try {
167
162
  targetStat = statSync(resolve(dirname(symSource), target))
168
- if (targetStat.isDirectory()) {
169
- targetStat = 'junction'
170
- }
171
- } catch {
172
- // targetStat remains 'file'
173
- }
163
+ } catch (err) {}
174
164
  symlinkSync(
175
165
  target,
176
166
  symDestination,
177
- targetStat
167
+ targetStat && targetStat.isDirectory() ? 'junction' : 'file'
178
168
  )
179
169
  }
180
170
  rimrafSync(source)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/move-file",
3
- "version": "2.0.1",
3
+ "version": "2.0.0",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@npmcli/eslint-config": "^3.0.1",
16
- "@npmcli/template-oss": "3.5.0",
16
+ "@npmcli/template-oss": "3.2.2",
17
17
  "tap": "^16.0.1"
18
18
  },
19
19
  "scripts": {
@@ -42,6 +42,6 @@
42
42
  "author": "GitHub Inc.",
43
43
  "templateOSS": {
44
44
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
45
- "version": "3.5.0"
45
+ "version": "3.2.2"
46
46
  }
47
47
  }
@@ -103,7 +103,7 @@ TrackerGroup.prototype.finish = function () {
103
103
  var buffer = ' '
104
104
  TrackerGroup.prototype.debug = function (depth) {
105
105
  depth = depth || 0
106
- var indent = depth ? buffer.slice(0, depth) : ''
106
+ var indent = depth ? buffer.substr(0, depth) : ''
107
107
  var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
108
108
  this.trackers.forEach(function (tracker) {
109
109
  if (tracker instanceof TrackerGroup) {