@pnpm/exe 11.0.0-alpha.9 → 11.0.0-beta.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.
Files changed (219) hide show
  1. package/dist/node_modules/@gar/promise-retry/lib/index.js +28 -0
  2. package/dist/node_modules/@gar/promise-retry/package.json +48 -0
  3. package/dist/node_modules/@npmcli/agent/package.json +7 -7
  4. package/dist/node_modules/@npmcli/fs/package.json +4 -4
  5. package/dist/node_modules/abbrev/package.json +11 -15
  6. package/dist/node_modules/balanced-match/package.json +4 -7
  7. package/dist/node_modules/brace-expansion/dist/commonjs/index.js +1 -1
  8. package/dist/node_modules/brace-expansion/dist/esm/index.js +1 -1
  9. package/dist/node_modules/brace-expansion/package.json +3 -3
  10. package/dist/node_modules/cacache/package.json +10 -11
  11. package/dist/node_modules/glob/dist/commonjs/glob.js +2 -1
  12. package/dist/node_modules/glob/dist/commonjs/index.min.js +4 -0
  13. package/dist/node_modules/glob/dist/commonjs/pattern.js +4 -0
  14. package/dist/node_modules/glob/dist/esm/glob.js +2 -1
  15. package/dist/node_modules/glob/dist/esm/index.min.js +4 -0
  16. package/dist/node_modules/glob/dist/esm/pattern.js +4 -0
  17. package/dist/node_modules/glob/package.json +38 -37
  18. package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js +460 -525
  19. package/dist/node_modules/iconv-lite/encodings/dbcs-data.js +179 -182
  20. package/dist/node_modules/iconv-lite/encodings/index.js +15 -15
  21. package/dist/node_modules/iconv-lite/encodings/internal.js +168 -148
  22. package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js +55 -52
  23. package/dist/node_modules/iconv-lite/encodings/sbcs-data.js +174 -175
  24. package/dist/node_modules/iconv-lite/encodings/utf16.js +121 -131
  25. package/dist/node_modules/iconv-lite/encodings/utf32.js +226 -238
  26. package/dist/node_modules/iconv-lite/encodings/utf7.js +208 -215
  27. package/dist/node_modules/iconv-lite/lib/bom-handling.js +30 -34
  28. package/dist/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  29. package/dist/node_modules/iconv-lite/lib/index.js +125 -123
  30. package/dist/node_modules/iconv-lite/lib/streams.js +92 -96
  31. package/dist/node_modules/iconv-lite/package.json +34 -8
  32. package/dist/node_modules/isexe/package.json +65 -18
  33. package/dist/node_modules/lru-cache/dist/commonjs/index.js +134 -85
  34. package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
  35. package/dist/node_modules/lru-cache/dist/esm/index.js +134 -85
  36. package/dist/node_modules/lru-cache/dist/esm/index.min.js +1 -1
  37. package/dist/node_modules/lru-cache/package.json +18 -41
  38. package/dist/node_modules/make-fetch-happen/lib/remote.js +1 -1
  39. package/dist/node_modules/make-fetch-happen/package.json +10 -10
  40. package/dist/node_modules/minimatch/dist/commonjs/ast.js +266 -21
  41. package/dist/node_modules/minimatch/dist/commonjs/index.js +178 -92
  42. package/dist/node_modules/minimatch/dist/esm/ast.js +266 -21
  43. package/dist/node_modules/minimatch/dist/esm/index.js +178 -92
  44. package/dist/node_modules/minimatch/package.json +4 -4
  45. package/dist/node_modules/minipass/dist/commonjs/index.js +13 -3
  46. package/dist/node_modules/minipass/dist/esm/index.js +3 -1
  47. package/dist/node_modules/minipass/package.json +9 -14
  48. package/dist/node_modules/minipass-fetch/lib/body.js +25 -15
  49. package/dist/node_modules/minipass-fetch/package.json +7 -7
  50. package/dist/node_modules/minipass-sized/dist/commonjs/index.js +69 -0
  51. package/dist/node_modules/minipass-sized/dist/esm/index.js +64 -0
  52. package/dist/node_modules/minipass-sized/package.json +39 -9
  53. package/dist/node_modules/node-gyp/.release-please-manifest.json +1 -1
  54. package/dist/node_modules/node-gyp/bin/node-gyp.js +7 -0
  55. package/dist/node_modules/node-gyp/gyp/.release-please-manifest.json +1 -1
  56. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +3 -3
  57. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +26 -1
  58. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +1 -1
  59. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +3 -4
  60. package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +1 -1
  61. package/dist/node_modules/node-gyp/gyp/pyproject.toml +1 -1
  62. package/dist/node_modules/node-gyp/lib/build.js +2 -2
  63. package/dist/node_modules/node-gyp/lib/find-python.js +2 -8
  64. package/dist/node_modules/node-gyp/lib/find-visualstudio.js +11 -5
  65. package/dist/node_modules/node-gyp/lib/install.js +1 -1
  66. package/dist/node_modules/node-gyp/lib/process-release.js +3 -3
  67. package/dist/node_modules/node-gyp/package.json +13 -13
  68. package/dist/node_modules/nopt/package.json +5 -5
  69. package/dist/node_modules/path-scurry/package.json +8 -24
  70. package/dist/node_modules/proc-log/lib/index.js +10 -5
  71. package/dist/node_modules/proc-log/package.json +5 -5
  72. package/dist/node_modules/retry/lib/retry.js +2 -2
  73. package/dist/node_modules/retry/lib/retry_operation.js +10 -6
  74. package/dist/node_modules/retry/package.json +6 -2
  75. package/dist/node_modules/ssri/lib/index.js +33 -63
  76. package/dist/node_modules/ssri/package.json +17 -17
  77. package/dist/node_modules/tar/dist/commonjs/index.min.js +2 -2
  78. package/dist/node_modules/tar/dist/commonjs/unpack.js +4 -4
  79. package/dist/node_modules/tar/dist/esm/index.min.js +2 -2
  80. package/dist/node_modules/tar/dist/esm/unpack.js +4 -4
  81. package/dist/node_modules/tar/package.json +6 -6
  82. package/dist/node_modules/unique-filename/package.json +5 -5
  83. package/dist/node_modules/unique-slug/package.json +4 -4
  84. package/dist/node_modules/which/package.json +29 -20
  85. package/dist/pnpm.mjs +225713 -208017
  86. package/dist/worker.js +4838 -5926
  87. package/package.json +10 -10
  88. package/setup.js +12 -14
  89. package/dist/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js +0 -16
  90. package/dist/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js +0 -170
  91. package/dist/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js +0 -307
  92. package/dist/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js +0 -7
  93. package/dist/node_modules/@isaacs/cliui/dist/commonjs/index.js +0 -322
  94. package/dist/node_modules/@isaacs/cliui/dist/commonjs/index.min.js +0 -12
  95. package/dist/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js +0 -49
  96. package/dist/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js +0 -8
  97. package/dist/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js +0 -176
  98. package/dist/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js +0 -12
  99. package/dist/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js +0 -167
  100. package/dist/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js +0 -299
  101. package/dist/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js +0 -3
  102. package/dist/node_modules/@isaacs/cliui/dist/esm/index.js +0 -317
  103. package/dist/node_modules/@isaacs/cliui/dist/esm/index.min.js +0 -12
  104. package/dist/node_modules/@isaacs/cliui/dist/esm/string-width/index.js +0 -46
  105. package/dist/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js +0 -4
  106. package/dist/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js +0 -172
  107. package/dist/node_modules/@isaacs/cliui/package.json +0 -163
  108. package/dist/node_modules/cross-spawn/LICENSE +0 -21
  109. package/dist/node_modules/cross-spawn/index.js +0 -39
  110. package/dist/node_modules/cross-spawn/lib/enoent.js +0 -59
  111. package/dist/node_modules/cross-spawn/lib/parse.js +0 -91
  112. package/dist/node_modules/cross-spawn/lib/util/escape.js +0 -47
  113. package/dist/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
  114. package/dist/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
  115. package/dist/node_modules/cross-spawn/package.json +0 -73
  116. package/dist/node_modules/encoding/.prettierrc.js +0 -8
  117. package/dist/node_modules/encoding/LICENSE +0 -16
  118. package/dist/node_modules/encoding/lib/encoding.js +0 -83
  119. package/dist/node_modules/encoding/package.json +0 -18
  120. package/dist/node_modules/err-code/.eslintrc.json +0 -7
  121. package/dist/node_modules/err-code/bower.json +0 -30
  122. package/dist/node_modules/err-code/index.js +0 -47
  123. package/dist/node_modules/err-code/index.umd.js +0 -51
  124. package/dist/node_modules/err-code/package.json +0 -34
  125. package/dist/node_modules/foreground-child/LICENSE +0 -15
  126. package/dist/node_modules/foreground-child/dist/commonjs/all-signals.js +0 -58
  127. package/dist/node_modules/foreground-child/dist/commonjs/index.js +0 -123
  128. package/dist/node_modules/foreground-child/dist/commonjs/proxy-signals.js +0 -38
  129. package/dist/node_modules/foreground-child/dist/commonjs/watchdog.js +0 -50
  130. package/dist/node_modules/foreground-child/dist/esm/all-signals.js +0 -52
  131. package/dist/node_modules/foreground-child/dist/esm/index.js +0 -115
  132. package/dist/node_modules/foreground-child/dist/esm/proxy-signals.js +0 -34
  133. package/dist/node_modules/foreground-child/dist/esm/watchdog.js +0 -46
  134. package/dist/node_modules/foreground-child/package.json +0 -106
  135. package/dist/node_modules/glob/dist/esm/bin.d.mts +0 -3
  136. package/dist/node_modules/glob/dist/esm/bin.mjs +0 -346
  137. package/dist/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  138. package/dist/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  139. package/dist/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  140. package/dist/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  141. package/dist/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  142. package/dist/node_modules/iconv-lite/.idea/modules.xml +0 -8
  143. package/dist/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  144. package/dist/node_modules/isexe/LICENSE +0 -15
  145. package/dist/node_modules/isexe/index.js +0 -57
  146. package/dist/node_modules/isexe/mode.js +0 -41
  147. package/dist/node_modules/isexe/windows.js +0 -42
  148. package/dist/node_modules/jackspeak/dist/commonjs/index.js +0 -944
  149. package/dist/node_modules/jackspeak/dist/commonjs/index.min.js +0 -33
  150. package/dist/node_modules/jackspeak/dist/commonjs/package.json +0 -3
  151. package/dist/node_modules/jackspeak/dist/esm/index.js +0 -936
  152. package/dist/node_modules/jackspeak/dist/esm/index.min.js +0 -33
  153. package/dist/node_modules/jackspeak/dist/esm/package.json +0 -3
  154. package/dist/node_modules/jackspeak/package.json +0 -115
  155. package/dist/node_modules/lru-cache/LICENSE +0 -15
  156. package/dist/node_modules/minipass/LICENSE +0 -15
  157. package/dist/node_modules/minipass-sized/index.js +0 -67
  158. package/dist/node_modules/minipass-sized/node_modules/minipass/LICENSE +0 -15
  159. package/dist/node_modules/minipass-sized/node_modules/minipass/index.js +0 -649
  160. package/dist/node_modules/minipass-sized/node_modules/minipass/package.json +0 -56
  161. package/dist/node_modules/minipass-sized/package-lock.json +0 -3464
  162. package/dist/node_modules/node-gyp/node_modules/isexe/dist/commonjs/package.json +0 -3
  163. package/dist/node_modules/node-gyp/node_modules/isexe/dist/esm/package.json +0 -3
  164. package/dist/node_modules/node-gyp/node_modules/isexe/package.json +0 -78
  165. package/dist/node_modules/node-gyp/node_modules/which/LICENSE +0 -15
  166. package/dist/node_modules/node-gyp/node_modules/which/package.json +0 -52
  167. package/dist/node_modules/package-json-from-dist/dist/commonjs/index.js +0 -134
  168. package/dist/node_modules/package-json-from-dist/dist/commonjs/package.json +0 -3
  169. package/dist/node_modules/package-json-from-dist/dist/esm/index.js +0 -129
  170. package/dist/node_modules/package-json-from-dist/dist/esm/package.json +0 -3
  171. package/dist/node_modules/package-json-from-dist/package.json +0 -68
  172. package/dist/node_modules/path-key/index.js +0 -16
  173. package/dist/node_modules/path-key/license +0 -9
  174. package/dist/node_modules/path-key/package.json +0 -39
  175. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +0 -1589
  176. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +0 -2
  177. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +0 -3
  178. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +0 -1585
  179. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +0 -2
  180. package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +0 -3
  181. package/dist/node_modules/path-scurry/node_modules/lru-cache/package.json +0 -101
  182. package/dist/node_modules/promise-retry/index.js +0 -52
  183. package/dist/node_modules/promise-retry/package.json +0 -37
  184. package/dist/node_modules/retry/equation.gif +0 -0
  185. package/dist/node_modules/shebang-command/index.js +0 -19
  186. package/dist/node_modules/shebang-command/license +0 -9
  187. package/dist/node_modules/shebang-command/package.json +0 -34
  188. package/dist/node_modules/shebang-regex/index.js +0 -2
  189. package/dist/node_modules/shebang-regex/license +0 -9
  190. package/dist/node_modules/shebang-regex/package.json +0 -35
  191. package/dist/node_modules/signal-exit/LICENSE.txt +0 -16
  192. package/dist/node_modules/signal-exit/dist/cjs/browser.js +0 -10
  193. package/dist/node_modules/signal-exit/dist/cjs/index.js +0 -279
  194. package/dist/node_modules/signal-exit/dist/cjs/package.json +0 -3
  195. package/dist/node_modules/signal-exit/dist/cjs/signals.js +0 -42
  196. package/dist/node_modules/signal-exit/dist/mjs/browser.js +0 -4
  197. package/dist/node_modules/signal-exit/dist/mjs/index.js +0 -275
  198. package/dist/node_modules/signal-exit/dist/mjs/package.json +0 -3
  199. package/dist/node_modules/signal-exit/dist/mjs/signals.js +0 -39
  200. package/dist/node_modules/signal-exit/package.json +0 -106
  201. package/dist/node_modules/which/bin/node-which +0 -52
  202. package/dist/node_modules/which/which.js +0 -125
  203. /package/dist/node_modules/{promise-retry → @gar/promise-retry}/LICENSE +0 -0
  204. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/index.js +0 -0
  205. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/index.min.js +0 -0
  206. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/options.js +0 -0
  207. /package/dist/node_modules/{@isaacs/cliui → isexe}/dist/commonjs/package.json +0 -0
  208. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/posix.js +0 -0
  209. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/win32.js +0 -0
  210. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/index.js +0 -0
  211. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/index.min.js +0 -0
  212. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/options.js +0 -0
  213. /package/dist/node_modules/{@isaacs/cliui → isexe}/dist/esm/package.json +0 -0
  214. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/posix.js +0 -0
  215. /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/win32.js +0 -0
  216. /package/dist/node_modules/{foreground-child → minipass-sized}/dist/commonjs/package.json +0 -0
  217. /package/dist/node_modules/{foreground-child → minipass-sized}/dist/esm/package.json +0 -0
  218. /package/dist/node_modules/{node-gyp/node_modules/which → which}/bin/which.js +0 -0
  219. /package/dist/node_modules/{node-gyp/node_modules/which → which}/lib/index.js +0 -0
@@ -193,11 +193,13 @@ export class Minimatch {
193
193
  isWindows;
194
194
  platform;
195
195
  windowsNoMagicRoot;
196
+ maxGlobstarRecursion;
196
197
  regexp;
197
198
  constructor(pattern, options = {}) {
198
199
  assertValidPattern(pattern);
199
200
  options = options || {};
200
201
  this.options = options;
202
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
201
203
  this.pattern = pattern;
202
204
  this.platform = options.platform || defaultPlatform;
203
205
  this.isWindows = this.platform === 'win32';
@@ -602,7 +604,8 @@ export class Minimatch {
602
604
  // out of pattern, then that's fine, as long as all
603
605
  // the parts match.
604
606
  matchOne(file, pattern, partial = false) {
605
- const options = this.options;
607
+ let fileStartIndex = 0;
608
+ let patternStartIndex = 0;
606
609
  // UNC paths like //?/X:/... can match X:/... and vice versa
607
610
  // Drive letters in absolute drive or unc paths are always compared
608
611
  // case-insensitively.
@@ -631,14 +634,11 @@ export class Minimatch {
631
634
  file[fdi],
632
635
  pattern[pdi],
633
636
  ];
637
+ // start matching at the drive letter index of each
634
638
  if (fd.toLowerCase() === pd.toLowerCase()) {
635
639
  pattern[pdi] = fd;
636
- if (pdi > fdi) {
637
- pattern = pattern.slice(pdi);
638
- }
639
- else if (fdi > pdi) {
640
- file = file.slice(fdi);
641
- }
640
+ patternStartIndex = pdi;
641
+ fileStartIndex = fdi;
642
642
  }
643
643
  }
644
644
  }
@@ -648,99 +648,185 @@ export class Minimatch {
648
648
  if (optimizationLevel >= 2) {
649
649
  file = this.levelTwoFileOptimize(file);
650
650
  }
651
- this.debug('matchOne', this, { file, pattern });
652
- this.debug('matchOne', file.length, pattern.length);
653
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
651
+ if (pattern.includes(GLOBSTAR)) {
652
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
653
+ }
654
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
655
+ }
656
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
657
+ // split the pattern into head, tail, and middle of ** delimited parts
658
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
659
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
660
+ // split the pattern up into globstar-delimited sections
661
+ // the tail has to be at the end, and the others just have
662
+ // to be found in order from the head.
663
+ const [head, body, tail] = partial ? [
664
+ pattern.slice(patternIndex, firstgs),
665
+ pattern.slice(firstgs + 1),
666
+ [],
667
+ ] : [
668
+ pattern.slice(patternIndex, firstgs),
669
+ pattern.slice(firstgs + 1, lastgs),
670
+ pattern.slice(lastgs + 1),
671
+ ];
672
+ // check the head, from the current file/pattern index.
673
+ if (head.length) {
674
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
675
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
676
+ return false;
677
+ }
678
+ fileIndex += head.length;
679
+ patternIndex += head.length;
680
+ }
681
+ // now we know the head matches!
682
+ // if the last portion is not empty, it MUST match the end
683
+ // check the tail
684
+ let fileTailMatch = 0;
685
+ if (tail.length) {
686
+ // if head + tail > file, then we cannot possibly match
687
+ if (tail.length + fileIndex > file.length)
688
+ return false;
689
+ // try to match the tail
690
+ let tailStart = file.length - tail.length;
691
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
692
+ fileTailMatch = tail.length;
693
+ }
694
+ else {
695
+ // affordance for stuff like a/**/* matching a/b/
696
+ // if the last file portion is '', and there's more to the pattern
697
+ // then try without the '' bit.
698
+ if (file[file.length - 1] !== '' ||
699
+ fileIndex + tail.length === file.length) {
700
+ return false;
701
+ }
702
+ tailStart--;
703
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
704
+ return false;
705
+ }
706
+ fileTailMatch = tail.length + 1;
707
+ }
708
+ }
709
+ // now we know the tail matches!
710
+ // the middle is zero or more portions wrapped in **, possibly
711
+ // containing more ** sections.
712
+ // so a/**/b/**/c/**/d has become **/b/**/c/**
713
+ // if it's empty, it means a/**/b, just verify we have no bad dots
714
+ // if there's no tail, so it ends on /**, then we must have *something*
715
+ // after the head, or it's not a matc
716
+ if (!body.length) {
717
+ let sawSome = !!fileTailMatch;
718
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
719
+ const f = String(file[i]);
720
+ sawSome = true;
721
+ if (f === '.' ||
722
+ f === '..' ||
723
+ (!this.options.dot && f.startsWith('.'))) {
724
+ return false;
725
+ }
726
+ }
727
+ // in partial mode, we just need to get past all file parts
728
+ return partial || sawSome;
729
+ }
730
+ // now we know that there's one or more body sections, which can
731
+ // be matched anywhere from the 0 index (because the head was pruned)
732
+ // through to the length-fileTailMatch index.
733
+ // split the body up into sections, and note the minimum index it can
734
+ // be found at (start with the length of all previous segments)
735
+ // [section, before, after]
736
+ const bodySegments = [[[], 0]];
737
+ let currentBody = bodySegments[0];
738
+ let nonGsParts = 0;
739
+ const nonGsPartsSums = [0];
740
+ for (const b of body) {
741
+ if (b === GLOBSTAR) {
742
+ nonGsPartsSums.push(nonGsParts);
743
+ currentBody = [[], 0];
744
+ bodySegments.push(currentBody);
745
+ }
746
+ else {
747
+ currentBody[0].push(b);
748
+ nonGsParts++;
749
+ }
750
+ }
751
+ let i = bodySegments.length - 1;
752
+ const fileLength = file.length - fileTailMatch;
753
+ for (const b of bodySegments) {
754
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
755
+ }
756
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
757
+ }
758
+ // return false for "nope, not matching"
759
+ // return null for "not matching, cannot keep trying"
760
+ #matchGlobStarBodySections(file,
761
+ // pattern section, last possible position for it
762
+ bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
763
+ // take the first body segment, and walk from fileIndex to its "after"
764
+ // value at the end
765
+ // If it doesn't match at that position, we increment, until we hit
766
+ // that final possible position, and give up.
767
+ // If it does match, then advance and try to rest.
768
+ // If any of them fail we keep walking forward.
769
+ // this is still a bit recursively painful, but it's more constrained
770
+ // than previous implementations, because we never test something that
771
+ // can't possibly be a valid matching condition.
772
+ const bs = bodySegments[bodyIndex];
773
+ if (!bs) {
774
+ // just make sure that there's no bad dots
775
+ for (let i = fileIndex; i < file.length; i++) {
776
+ sawTail = true;
777
+ const f = file[i];
778
+ if (f === '.' ||
779
+ f === '..' ||
780
+ (!this.options.dot && f.startsWith('.'))) {
781
+ return false;
782
+ }
783
+ }
784
+ return sawTail;
785
+ }
786
+ // have a non-globstar body section to test
787
+ const [body, after] = bs;
788
+ while (fileIndex <= after) {
789
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
790
+ // if limit exceeded, no match. intentional false negative,
791
+ // acceptable break in correctness for security.
792
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
793
+ // match! see if the rest match. if so, we're done!
794
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
795
+ if (sub !== false) {
796
+ return sub;
797
+ }
798
+ }
799
+ const f = file[fileIndex];
800
+ if (f === '.' ||
801
+ f === '..' ||
802
+ (!this.options.dot && f.startsWith('.'))) {
803
+ return false;
804
+ }
805
+ fileIndex++;
806
+ }
807
+ // walked off. no point continuing
808
+ return partial || null;
809
+ }
810
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
811
+ let fi;
812
+ let pi;
813
+ let pl;
814
+ let fl;
815
+ for (fi = fileIndex,
816
+ pi = patternIndex,
817
+ fl = file.length,
818
+ pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
654
819
  this.debug('matchOne loop');
655
- var p = pattern[pi];
656
- var f = file[fi];
820
+ let p = pattern[pi];
821
+ let f = file[fi];
657
822
  this.debug(pattern, p, f);
658
823
  // should be impossible.
659
824
  // some invalid regexp stuff in the set.
660
825
  /* c8 ignore start */
661
- if (p === false) {
826
+ if (p === false || p === GLOBSTAR) {
662
827
  return false;
663
828
  }
664
829
  /* c8 ignore stop */
665
- if (p === GLOBSTAR) {
666
- this.debug('GLOBSTAR', [pattern, p, f]);
667
- // "**"
668
- // a/**/b/**/c would match the following:
669
- // a/b/x/y/z/c
670
- // a/x/y/z/b/c
671
- // a/b/x/b/x/c
672
- // a/b/c
673
- // To do this, take the rest of the pattern after
674
- // the **, and see if it would match the file remainder.
675
- // If so, return success.
676
- // If not, the ** "swallows" a segment, and try again.
677
- // This is recursively awful.
678
- //
679
- // a/**/b/**/c matching a/b/x/y/z/c
680
- // - a matches a
681
- // - doublestar
682
- // - matchOne(b/x/y/z/c, b/**/c)
683
- // - b matches b
684
- // - doublestar
685
- // - matchOne(x/y/z/c, c) -> no
686
- // - matchOne(y/z/c, c) -> no
687
- // - matchOne(z/c, c) -> no
688
- // - matchOne(c, c) yes, hit
689
- var fr = fi;
690
- var pr = pi + 1;
691
- if (pr === pl) {
692
- this.debug('** at the end');
693
- // a ** at the end will just swallow the rest.
694
- // We have found a match.
695
- // however, it will not swallow /.x, unless
696
- // options.dot is set.
697
- // . and .. are *never* matched by **, for explosively
698
- // exponential reasons.
699
- for (; fi < fl; fi++) {
700
- if (file[fi] === '.' ||
701
- file[fi] === '..' ||
702
- (!options.dot && file[fi].charAt(0) === '.'))
703
- return false;
704
- }
705
- return true;
706
- }
707
- // ok, let's see if we can swallow whatever we can.
708
- while (fr < fl) {
709
- var swallowee = file[fr];
710
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
711
- // XXX remove this slice. Just pass the start index.
712
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
713
- this.debug('globstar found match!', fr, fl, swallowee);
714
- // found a match.
715
- return true;
716
- }
717
- else {
718
- // can't swallow "." or ".." ever.
719
- // can only swallow ".foo" when explicitly asked.
720
- if (swallowee === '.' ||
721
- swallowee === '..' ||
722
- (!options.dot && swallowee.charAt(0) === '.')) {
723
- this.debug('dot detected!', file, fr, pattern, pr);
724
- break;
725
- }
726
- // ** swallows a segment, and continue.
727
- this.debug('globstar swallow a segment, and continue');
728
- fr++;
729
- }
730
- }
731
- // no match was found.
732
- // However, in partial mode, we can't say this is necessarily over.
733
- /* c8 ignore start */
734
- if (partial) {
735
- // ran out of file
736
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
737
- if (fr === fl) {
738
- return true;
739
- }
740
- }
741
- /* c8 ignore stop */
742
- return false;
743
- }
744
830
  // something other than **
745
831
  // non-magic patterns just have to match exactly
746
832
  // patterns with magic have been turned into regexps.
@@ -2,7 +2,7 @@
2
2
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
3
3
  "name": "minimatch",
4
4
  "description": "a glob matcher in javascript",
5
- "version": "10.2.1",
5
+ "version": "10.2.4",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git@github.com:isaacs/minimatch"
@@ -39,13 +39,13 @@
39
39
  "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
40
40
  },
41
41
  "engines": {
42
- "node": "20 || >=22"
42
+ "node": "18 || 20 || >=22"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/node": "^24.0.0",
45
+ "@types/node": "^25.3.0",
46
46
  "mkdirp": "^3.0.1",
47
47
  "prettier": "^3.6.2",
48
- "tap": "^21.1.0",
48
+ "tap": "^21.6.2",
49
49
  "tshy": "^3.0.2",
50
50
  "typedoc": "^0.28.5"
51
51
  },
@@ -22,7 +22,11 @@ const isStream = (s) => !!s &&
22
22
  (s instanceof Minipass ||
23
23
  s instanceof node_stream_1.default ||
24
24
  (0, exports.isReadable)(s) ||
25
- (0, exports.isWritable)(s));
25
+ (0, exports.isWritable)(s))
26
+ /**
27
+ * Return true if the argument is a valid {@link Minipass.Readable}
28
+ */
29
+ ;
26
30
  exports.isStream = isStream;
27
31
  /**
28
32
  * Return true if the argument is a valid {@link Minipass.Readable}
@@ -32,7 +36,11 @@ const isReadable = (s) => !!s &&
32
36
  s instanceof node_events_1.EventEmitter &&
33
37
  typeof s.pipe === 'function' &&
34
38
  // node core Writable streams have a pipe() method, but it throws
35
- s.pipe !== node_stream_1.default.Writable.prototype.pipe;
39
+ s.pipe !== node_stream_1.default.Writable.prototype.pipe
40
+ /**
41
+ * Return true if the argument is a valid {@link Minipass.Writable}
42
+ */
43
+ ;
36
44
  exports.isReadable = isReadable;
37
45
  /**
38
46
  * Return true if the argument is a valid {@link Minipass.Writable}
@@ -129,7 +137,7 @@ class PipeProxyErrors extends Pipe {
129
137
  }
130
138
  constructor(src, dest, opts) {
131
139
  super(src, dest, opts);
132
- this.proxyErrors = er => dest.emit('error', er);
140
+ this.proxyErrors = (er) => this.dest.emit('error', er);
133
141
  src.on('error', this.proxyErrors);
134
142
  }
135
143
  }
@@ -939,6 +947,7 @@ class Minipass extends node_events_1.EventEmitter {
939
947
  [Symbol.asyncIterator]() {
940
948
  return this;
941
949
  },
950
+ [Symbol.asyncDispose]: async () => { },
942
951
  };
943
952
  }
944
953
  /**
@@ -976,6 +985,7 @@ class Minipass extends node_events_1.EventEmitter {
976
985
  [Symbol.iterator]() {
977
986
  return this;
978
987
  },
988
+ [Symbol.dispose]: () => { },
979
989
  };
980
990
  }
981
991
  /**
@@ -120,7 +120,7 @@ class PipeProxyErrors extends Pipe {
120
120
  }
121
121
  constructor(src, dest, opts) {
122
122
  super(src, dest, opts);
123
- this.proxyErrors = er => dest.emit('error', er);
123
+ this.proxyErrors = (er) => this.dest.emit('error', er);
124
124
  src.on('error', this.proxyErrors);
125
125
  }
126
126
  }
@@ -930,6 +930,7 @@ export class Minipass extends EventEmitter {
930
930
  [Symbol.asyncIterator]() {
931
931
  return this;
932
932
  },
933
+ [Symbol.asyncDispose]: async () => { },
933
934
  };
934
935
  }
935
936
  /**
@@ -967,6 +968,7 @@ export class Minipass extends EventEmitter {
967
968
  [Symbol.iterator]() {
968
969
  return this;
969
970
  },
971
+ [Symbol.dispose]: () => { },
970
972
  };
971
973
  }
972
974
  /**
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "minipass",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "minimal implementation of a PassThrough stream",
5
5
  "main": "./dist/commonjs/index.js",
6
6
  "types": "./dist/commonjs/index.d.ts",
7
+ "module": "./dist/esm/index.js",
7
8
  "type": "module",
8
9
  "tshy": {
9
10
  "selfLink": false,
10
- "main": true,
11
+ "compiler": "tsgo",
11
12
  "exports": {
12
13
  "./package.json": "./package.json",
13
14
  ".": "./src/index.ts"
@@ -54,14 +55,14 @@
54
55
  },
55
56
  "devDependencies": {
56
57
  "@types/end-of-stream": "^1.4.2",
57
- "@types/node": "^20.1.2",
58
+ "@types/node": "^25.2.3",
58
59
  "end-of-stream": "^1.4.0",
59
60
  "node-abort-controller": "^3.1.1",
60
- "prettier": "^2.6.2",
61
- "tap": "^19.0.0",
61
+ "prettier": "^3.8.1",
62
+ "tap": "^21.6.1",
62
63
  "through2": "^2.0.3",
63
- "tshy": "^1.14.0",
64
- "typedoc": "^0.25.1"
64
+ "tshy": "^3.3.2",
65
+ "typedoc": "^0.28.17"
65
66
  },
66
67
  "repository": "https://github.com/isaacs/minipass",
67
68
  "keywords": [
@@ -69,14 +70,8 @@
69
70
  "stream"
70
71
  ],
71
72
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
72
- "license": "ISC",
73
+ "license": "BlueOak-1.0.0",
73
74
  "engines": {
74
75
  "node": ">=16 || 14 >=14.17"
75
- },
76
- "tap": {
77
- "typecheck": true,
78
- "include": [
79
- "test/*.ts"
80
- ]
81
76
  }
82
77
  }
@@ -1,15 +1,15 @@
1
1
  'use strict'
2
2
  const { Minipass } = require('minipass')
3
- const MinipassSized = require('minipass-sized')
3
+ const { MinipassSized } = require('minipass-sized')
4
4
 
5
5
  const Blob = require('./blob.js')
6
6
  const { BUFFER } = Blob
7
7
  const FetchError = require('./fetch-error.js')
8
8
 
9
- // optional dependency on 'encoding'
10
- let convert
9
+ // optional dependency on 'iconv-lite'
10
+ let decode
11
11
  try {
12
- convert = require('encoding').convert
12
+ decode = require('iconv-lite').decode
13
13
  } catch (e) {
14
14
  // defer error until textConverted is called
15
15
  }
@@ -92,6 +92,10 @@ class Body {
92
92
  }
93
93
 
94
94
  textConverted () {
95
+ /* istanbul ignore if */
96
+ if (typeof decode !== 'function') {
97
+ throw new Error('The package `iconv-lite` must be installed to use the textConverted() function')
98
+ }
95
99
  return this[CONSUME_BODY]().then(buf => convertBody(buf, this.headers))
96
100
  }
97
101
 
@@ -285,11 +289,6 @@ const isBlob = obj =>
285
289
  /^(Blob|File)$/.test(obj[Symbol.toStringTag])
286
290
 
287
291
  const convertBody = (buffer, headers) => {
288
- /* istanbul ignore if */
289
- if (typeof convert !== 'function') {
290
- throw new Error('The package `encoding` must be installed to use the textConverted() function')
291
- }
292
-
293
292
  const ct = headers && headers.get('content-type')
294
293
  let charset = 'utf-8'
295
294
  let res
@@ -339,12 +338,23 @@ const convertBody = (buffer, headers) => {
339
338
  }
340
339
  }
341
340
 
342
- // turn raw buffers into a single utf-8 buffer
343
- return convert(
344
- buffer,
345
- 'UTF-8',
346
- charset
347
- ).toString()
341
+ if (charset === 'UTF-8') {
342
+ return buffer.toString('UTF-8')
343
+ }
344
+
345
+ charset = charset.toString().trim()
346
+ .replace(/^latin[-_]?(\d+)$/i, 'ISO-8859-$1')
347
+ .replace(/^win(?:dows)?[-_]?(\d+)$/i, 'WINDOWS-$1')
348
+ .replace(/^utf[-_]?(\d+)$/i, 'UTF-$1')
349
+ .replace(/^ks_c_5601-1987$/i, 'CP949')
350
+ .replace(/^us[-_]?ascii$/i, 'ASCII')
351
+ .toUpperCase()
352
+ try {
353
+ return decode(buffer, charset).toString()
354
+ } catch {
355
+ /* istanbul ignore next */
356
+ return buffer.toString('UTF-8')
357
+ }
348
358
  }
349
359
 
350
360
  module.exports = Body
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minipass-fetch",
3
- "version": "4.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "An implementation of window.fetch in Node.js using Minipass streams",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@npmcli/eslint-config": "^5.0.0",
28
- "@npmcli/template-oss": "4.23.3",
28
+ "@npmcli/template-oss": "4.27.1",
29
29
  "@ungap/url-search-params": "^0.2.2",
30
30
  "abort-controller": "^3.0.0",
31
31
  "abortcontroller-polyfill": "~1.7.3",
32
- "encoding": "^0.1.13",
33
32
  "form-data": "^4.0.0",
33
+ "iconv-lite": "^0.7.2",
34
34
  "nock": "^13.2.4",
35
35
  "parted": "^0.1.1",
36
36
  "string-to-arraybuffer": "^1.0.2",
@@ -38,11 +38,11 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "minipass": "^7.0.3",
41
- "minipass-sized": "^1.0.3",
41
+ "minipass-sized": "^2.0.0",
42
42
  "minizlib": "^3.0.1"
43
43
  },
44
44
  "optionalDependencies": {
45
- "encoding": "^0.1.13"
45
+ "iconv-lite": "^0.7.2"
46
46
  },
47
47
  "repository": {
48
48
  "type": "git",
@@ -59,12 +59,12 @@
59
59
  "lib/"
60
60
  ],
61
61
  "engines": {
62
- "node": "^18.17.0 || >=20.5.0"
62
+ "node": "^20.17.0 || >=22.9.0"
63
63
  },
64
64
  "author": "GitHub Inc.",
65
65
  "templateOSS": {
66
66
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
67
- "version": "4.23.3",
67
+ "version": "4.27.1",
68
68
  "publish": "true"
69
69
  }
70
70
  }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MinipassSized = exports.SizeError = void 0;
4
+ const minipass_1 = require("minipass");
5
+ const isBufferEncoding = (enc) => typeof enc === 'string';
6
+ class SizeError extends Error {
7
+ expect;
8
+ found;
9
+ code = 'EBADSIZE';
10
+ constructor(found, expect, from) {
11
+ super(`Bad data size: expected ${expect} bytes, but got ${found}`);
12
+ this.expect = expect;
13
+ this.found = found;
14
+ Error.captureStackTrace(this, from ?? this.constructor);
15
+ }
16
+ get name() {
17
+ return 'SizeError';
18
+ }
19
+ }
20
+ exports.SizeError = SizeError;
21
+ class MinipassSized extends minipass_1.Minipass {
22
+ found = 0;
23
+ expect;
24
+ constructor(options) {
25
+ const size = options?.size;
26
+ if (typeof size !== 'number' ||
27
+ size > Number.MAX_SAFE_INTEGER ||
28
+ isNaN(size) ||
29
+ size < 0 ||
30
+ !isFinite(size) ||
31
+ size !== Math.floor(size)) {
32
+ throw new Error('invalid expected size: ' + size);
33
+ }
34
+ //@ts-ignore
35
+ super(options);
36
+ if (options.objectMode) {
37
+ throw new TypeError(`${this.constructor.name} streams only work with string and buffer data`);
38
+ }
39
+ this.expect = size;
40
+ }
41
+ write(chunk, encoding, cb) {
42
+ const buffer = Buffer.isBuffer(chunk) ? chunk
43
+ : typeof chunk === 'string' ?
44
+ Buffer.from(chunk, isBufferEncoding(encoding) ? encoding : 'utf8')
45
+ : chunk;
46
+ if (typeof encoding === 'function') {
47
+ cb = encoding;
48
+ encoding = null;
49
+ }
50
+ if (!Buffer.isBuffer(buffer)) {
51
+ this.emit('error', new TypeError(`${this.constructor.name} streams only work with string and buffer data`));
52
+ return false;
53
+ }
54
+ this.found += buffer.length;
55
+ if (this.found > this.expect)
56
+ this.emit('error', new SizeError(this.found, this.expect));
57
+ return super.write(chunk, encoding, cb);
58
+ }
59
+ emit(ev, ...args) {
60
+ if (ev === 'end') {
61
+ if (this.found !== this.expect) {
62
+ this.emit('error', new SizeError(this.found, this.expect, this.emit));
63
+ }
64
+ }
65
+ return super.emit(ev, ...args);
66
+ }
67
+ }
68
+ exports.MinipassSized = MinipassSized;
69
+ //# sourceMappingURL=index.js.map