@volter/tabnode 0.2.14-volter.88 → 0.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.
Files changed (226) hide show
  1. package/README.md +12 -5
  2. package/dist/assets/{runtime-worker-4MKaHFVb.js → runtime-worker-CUO9SNFs.js} +587 -233
  3. package/dist/code-transforms.d.ts +0 -1
  4. package/dist/config/cdn.d.ts +0 -1
  5. package/dist/create-runtime.d.ts +0 -1
  6. package/dist/host-globals.d.ts +0 -1
  7. package/dist/index.d.ts +0 -1
  8. package/dist/index.mjs +51 -21
  9. package/dist/node-internals.d.ts +0 -1
  10. package/dist/node-lib/binding/blob.d.ts +0 -1
  11. package/dist/node-lib/binding/buffer.d.ts +0 -1
  12. package/dist/node-lib/binding/cares_wrap.d.ts +0 -1
  13. package/dist/node-lib/binding/fds.d.ts +0 -1
  14. package/dist/node-lib/binding/fs.d.ts +2 -3
  15. package/dist/node-lib/binding/handles.d.ts +0 -1
  16. package/dist/node-lib/binding/http_parser.d.ts +0 -1
  17. package/dist/node-lib/binding/index.d.ts +0 -1
  18. package/dist/node-lib/binding/llhttp-wasm.d.ts +0 -1
  19. package/dist/node-lib/binding/misc.d.ts +0 -1
  20. package/dist/node-lib/binding/pipe_wrap.d.ts +0 -1
  21. package/dist/node-lib/binding/process_wrap.d.ts +0 -1
  22. package/dist/node-lib/binding/spawn_sync.d.ts +0 -1
  23. package/dist/node-lib/binding/stream_wrap.d.ts +0 -1
  24. package/dist/node-lib/binding/stubs.d.ts +0 -1
  25. package/dist/node-lib/binding/tcp_wrap.d.ts +0 -1
  26. package/dist/node-lib/binding/tty_wrap.d.ts +0 -1
  27. package/dist/node-lib/binding/util.d.ts +0 -1
  28. package/dist/node-lib/binding/uv.d.ts +0 -1
  29. package/dist/node-lib/binding/zlib-pako.d.ts +0 -1
  30. package/dist/node-lib/binding/zlib.d.ts +0 -1
  31. package/dist/node-lib/buffer-module.d.ts +0 -1
  32. package/dist/node-lib/child-process-module.d.ts +0 -1
  33. package/dist/node-lib/events-module.d.ts +0 -1
  34. package/dist/node-lib/fs-module.d.ts +0 -1
  35. package/dist/node-lib/http-bridge.d.ts +0 -1
  36. package/dist/node-lib/http-module.d.ts +0 -1
  37. package/dist/node-lib/internals/addresses.d.ts +0 -1
  38. package/dist/node-lib/internals/buffer-and-streams.d.ts +0 -1
  39. package/dist/node-lib/internals/child-process.d.ts +0 -1
  40. package/dist/node-lib/internals/events-util.d.ts +0 -1
  41. package/dist/node-lib/internals/index.d.ts +0 -1
  42. package/dist/node-lib/internals/modules.d.ts +0 -1
  43. package/dist/node-lib/internals/readline-access.d.ts +0 -1
  44. package/dist/node-lib/internals/runtime.d.ts +0 -1
  45. package/dist/node-lib/internals/util.d.ts +0 -1
  46. package/dist/node-lib/lazy.d.ts +0 -1
  47. package/dist/node-lib/load.d.ts +0 -1
  48. package/dist/node-lib/module-hooks.d.ts +0 -1
  49. package/dist/node-lib/net-module.d.ts +0 -1
  50. package/dist/node-lib/node-versions.d.ts +0 -1
  51. package/dist/node-lib/public-modules.d.ts +0 -1
  52. package/dist/node-lib/require-hook.d.ts +0 -1
  53. package/dist/node-lib/small-modules.d.ts +0 -1
  54. package/dist/node-lib/sources.d.ts +1 -2
  55. package/dist/node-lib/stream-module.d.ts +0 -1
  56. package/dist/node-lib/timers.d.ts +0 -1
  57. package/dist/node-lib/util-module.d.ts +0 -1
  58. package/dist/node-resolution.d.ts +0 -1
  59. package/dist/node-resolver.d.ts +0 -1
  60. package/dist/npm/index.d.ts +0 -1
  61. package/dist/npm/registry.d.ts +0 -1
  62. package/dist/npm/resolver.d.ts +0 -1
  63. package/dist/npm/tarball.d.ts +0 -1
  64. package/dist/process-tokens.d.ts +0 -1
  65. package/dist/punycode-source.d.ts +0 -1
  66. package/dist/runtime-interface.d.ts +0 -1
  67. package/dist/runtime.d.ts +0 -1
  68. package/dist/server-bridge.d.ts +0 -1
  69. package/dist/shims/async_hooks.d.ts +0 -1
  70. package/dist/shims/child_process.d.ts +0 -1
  71. package/dist/shims/cluster.d.ts +0 -1
  72. package/dist/shims/command-line.d.ts +0 -1
  73. package/dist/shims/constants.d.ts +0 -1
  74. package/dist/shims/crypto-constants.d.ts +0 -1
  75. package/dist/shims/crypto.d.ts +0 -1
  76. package/dist/shims/dgram.d.ts +0 -1
  77. package/dist/shims/dns.d.ts +0 -1
  78. package/dist/shims/domain.d.ts +0 -1
  79. package/dist/shims/esbuild.d.ts +0 -1
  80. package/dist/shims/fs.d.ts +0 -1
  81. package/dist/shims/http2.d.ts +0 -1
  82. package/dist/shims/inspector.d.ts +0 -1
  83. package/dist/shims/module.d.ts +0 -1
  84. package/dist/shims/os.d.ts +0 -1
  85. package/dist/shims/path.d.ts +0 -1
  86. package/dist/shims/perf_hooks.d.ts +0 -1
  87. package/dist/shims/process.d.ts +0 -1
  88. package/dist/shims/rollup.d.ts +0 -1
  89. package/dist/shims/string_decoder.d.ts +0 -1
  90. package/dist/shims/sync-child.d.ts +0 -1
  91. package/dist/shims/tls.d.ts +0 -1
  92. package/dist/shims/url.d.ts +0 -1
  93. package/dist/shims/v8.d.ts +0 -1
  94. package/dist/shims/vfs-adapter.d.ts +0 -1
  95. package/dist/shims/vm.d.ts +0 -1
  96. package/dist/shims/wasi.d.ts +0 -1
  97. package/dist/shims/worker_threads.d.ts +0 -1
  98. package/dist/shims/zlib-constants.d.ts +0 -1
  99. package/dist/shims/zlib.d.ts +0 -1
  100. package/dist/transform.d.ts +0 -1
  101. package/dist/types/package-json.d.ts +0 -1
  102. package/dist/utils/binary-encoding.d.ts +0 -1
  103. package/dist/utils/glob.d.ts +0 -1
  104. package/dist/utils/hash.d.ts +0 -1
  105. package/dist/virtual-fs.d.ts +0 -1
  106. package/dist/vite-plugin.d.ts +0 -1
  107. package/dist/vite-plugin.mjs +0 -1
  108. package/dist/worker/runtime-worker.d.ts +0 -1
  109. package/dist/worker-runtime.d.ts +0 -1
  110. package/package.json +11 -24
  111. package/src/node-lib/binding/fs.ts +25 -13
  112. package/src/node-lib/binding/zlib.ts +1 -1
  113. package/src/node-lib/sources.ts +1 -1
  114. package/src/virtual-fs.ts +13 -2
  115. package/dist/assets/runtime-worker-4MKaHFVb.js.map +0 -1
  116. package/dist/code-transforms.d.ts.map +0 -1
  117. package/dist/config/cdn.d.ts.map +0 -1
  118. package/dist/create-runtime.d.ts.map +0 -1
  119. package/dist/host-globals.d.ts.map +0 -1
  120. package/dist/index.cjs +0 -36021
  121. package/dist/index.cjs.map +0 -1
  122. package/dist/index.d.ts.map +0 -1
  123. package/dist/index.mjs.map +0 -1
  124. package/dist/node-internals.d.ts.map +0 -1
  125. package/dist/node-lib/binding/blob.d.ts.map +0 -1
  126. package/dist/node-lib/binding/buffer.d.ts.map +0 -1
  127. package/dist/node-lib/binding/cares_wrap.d.ts.map +0 -1
  128. package/dist/node-lib/binding/fds.d.ts.map +0 -1
  129. package/dist/node-lib/binding/fs.d.ts.map +0 -1
  130. package/dist/node-lib/binding/handles.d.ts.map +0 -1
  131. package/dist/node-lib/binding/http_parser.d.ts.map +0 -1
  132. package/dist/node-lib/binding/index.d.ts.map +0 -1
  133. package/dist/node-lib/binding/llhttp-wasm.d.ts.map +0 -1
  134. package/dist/node-lib/binding/misc.d.ts.map +0 -1
  135. package/dist/node-lib/binding/pipe_wrap.d.ts.map +0 -1
  136. package/dist/node-lib/binding/process_wrap.d.ts.map +0 -1
  137. package/dist/node-lib/binding/spawn_sync.d.ts.map +0 -1
  138. package/dist/node-lib/binding/stream_wrap.d.ts.map +0 -1
  139. package/dist/node-lib/binding/stubs.d.ts.map +0 -1
  140. package/dist/node-lib/binding/tcp_wrap.d.ts.map +0 -1
  141. package/dist/node-lib/binding/tty_wrap.d.ts.map +0 -1
  142. package/dist/node-lib/binding/util.d.ts.map +0 -1
  143. package/dist/node-lib/binding/uv.d.ts.map +0 -1
  144. package/dist/node-lib/binding/zlib-pako.d.ts.map +0 -1
  145. package/dist/node-lib/binding/zlib.d.ts.map +0 -1
  146. package/dist/node-lib/buffer-module.d.ts.map +0 -1
  147. package/dist/node-lib/child-process-module.d.ts.map +0 -1
  148. package/dist/node-lib/events-module.d.ts.map +0 -1
  149. package/dist/node-lib/fs-module.d.ts.map +0 -1
  150. package/dist/node-lib/http-bridge.d.ts.map +0 -1
  151. package/dist/node-lib/http-module.d.ts.map +0 -1
  152. package/dist/node-lib/internals/addresses.d.ts.map +0 -1
  153. package/dist/node-lib/internals/buffer-and-streams.d.ts.map +0 -1
  154. package/dist/node-lib/internals/child-process.d.ts.map +0 -1
  155. package/dist/node-lib/internals/events-util.d.ts.map +0 -1
  156. package/dist/node-lib/internals/index.d.ts.map +0 -1
  157. package/dist/node-lib/internals/modules.d.ts.map +0 -1
  158. package/dist/node-lib/internals/readline-access.d.ts.map +0 -1
  159. package/dist/node-lib/internals/runtime.d.ts.map +0 -1
  160. package/dist/node-lib/internals/util.d.ts.map +0 -1
  161. package/dist/node-lib/lazy.d.ts.map +0 -1
  162. package/dist/node-lib/load.d.ts.map +0 -1
  163. package/dist/node-lib/module-hooks.d.ts.map +0 -1
  164. package/dist/node-lib/net-module.d.ts.map +0 -1
  165. package/dist/node-lib/node-versions.d.ts.map +0 -1
  166. package/dist/node-lib/public-modules.d.ts.map +0 -1
  167. package/dist/node-lib/require-hook.d.ts.map +0 -1
  168. package/dist/node-lib/small-modules.d.ts.map +0 -1
  169. package/dist/node-lib/sources.d.ts.map +0 -1
  170. package/dist/node-lib/stream-module.d.ts.map +0 -1
  171. package/dist/node-lib/timers.d.ts.map +0 -1
  172. package/dist/node-lib/util-module.d.ts.map +0 -1
  173. package/dist/node-resolution.d.ts.map +0 -1
  174. package/dist/node-resolver.d.ts.map +0 -1
  175. package/dist/npm/index.d.ts.map +0 -1
  176. package/dist/npm/registry.d.ts.map +0 -1
  177. package/dist/npm/resolver.d.ts.map +0 -1
  178. package/dist/npm/tarball.d.ts.map +0 -1
  179. package/dist/process-tokens.d.ts.map +0 -1
  180. package/dist/punycode-source.d.ts.map +0 -1
  181. package/dist/runtime-interface.d.ts.map +0 -1
  182. package/dist/runtime.d.ts.map +0 -1
  183. package/dist/server-bridge.d.ts.map +0 -1
  184. package/dist/shims/async_hooks.d.ts.map +0 -1
  185. package/dist/shims/child_process.d.ts.map +0 -1
  186. package/dist/shims/cluster.d.ts.map +0 -1
  187. package/dist/shims/command-line.d.ts.map +0 -1
  188. package/dist/shims/constants.d.ts.map +0 -1
  189. package/dist/shims/crypto-constants.d.ts.map +0 -1
  190. package/dist/shims/crypto.d.ts.map +0 -1
  191. package/dist/shims/dgram.d.ts.map +0 -1
  192. package/dist/shims/dns.d.ts.map +0 -1
  193. package/dist/shims/domain.d.ts.map +0 -1
  194. package/dist/shims/esbuild.d.ts.map +0 -1
  195. package/dist/shims/fs.d.ts.map +0 -1
  196. package/dist/shims/http2.d.ts.map +0 -1
  197. package/dist/shims/inspector.d.ts.map +0 -1
  198. package/dist/shims/module.d.ts.map +0 -1
  199. package/dist/shims/os.d.ts.map +0 -1
  200. package/dist/shims/path.d.ts.map +0 -1
  201. package/dist/shims/perf_hooks.d.ts.map +0 -1
  202. package/dist/shims/process.d.ts.map +0 -1
  203. package/dist/shims/rollup.d.ts.map +0 -1
  204. package/dist/shims/string_decoder.d.ts.map +0 -1
  205. package/dist/shims/sync-child.d.ts.map +0 -1
  206. package/dist/shims/tls.d.ts.map +0 -1
  207. package/dist/shims/url.d.ts.map +0 -1
  208. package/dist/shims/v8.d.ts.map +0 -1
  209. package/dist/shims/vfs-adapter.d.ts.map +0 -1
  210. package/dist/shims/vm.d.ts.map +0 -1
  211. package/dist/shims/wasi.d.ts.map +0 -1
  212. package/dist/shims/worker_threads.d.ts.map +0 -1
  213. package/dist/shims/zlib-constants.d.ts.map +0 -1
  214. package/dist/shims/zlib.d.ts.map +0 -1
  215. package/dist/transform.d.ts.map +0 -1
  216. package/dist/types/package-json.d.ts.map +0 -1
  217. package/dist/utils/binary-encoding.d.ts.map +0 -1
  218. package/dist/utils/glob.d.ts.map +0 -1
  219. package/dist/utils/hash.d.ts.map +0 -1
  220. package/dist/virtual-fs.d.ts.map +0 -1
  221. package/dist/vite-plugin.cjs +0 -50
  222. package/dist/vite-plugin.cjs.map +0 -1
  223. package/dist/vite-plugin.d.ts.map +0 -1
  224. package/dist/vite-plugin.mjs.map +0 -1
  225. package/dist/worker/runtime-worker.d.ts.map +0 -1
  226. package/dist/worker-runtime.d.ts.map +0 -1
@@ -17,7 +17,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
17
17
  return __privateGet(obj, member, getter);
18
18
  }
19
19
  });
20
- var _a2, _b2, _asyncId, _triggerAsyncId, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _ptr, _type, _maxHeaderSize, _headerBytes, _headers, _field, _value, _readingValue, _url, _statusMessage, _headersSent, _paused, _buffer, _bufferPtr, _bufferSize, _connections, _HTTPParser_instances, reset_fn, copyIn_fn, pushHeader_fn, countHeaderBytes_fn, _parsers, _entries, _at, _encoding, _watcher, _timer, _previous, _strm, _writeState, _callback, _level, _strategy, _windowBits, _memLevel, _dictionary, _ended, _Zlib_instances, inflating_get, windowFor_fn, start_fn, fail_fn, report_fn, run_fn, end_fn, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options2, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn, _resolveChain, _loadChain, _initializing, _initializeFailure, _RunModuleHooks_instances, run_fn2;
20
+ var _a2, _b2, _asyncId, _triggerAsyncId, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _ptr, _type, _maxHeaderSize, _headerBytes, _headers, _field, _value, _readingValue, _url, _statusMessage, _headersSent, _paused, _buffer, _bufferPtr, _bufferSize, _connections, _HTTPParser_instances, reset_fn, copyIn_fn, pushHeader_fn, countHeaderBytes_fn, _parsers, _entries, _at, _encoding, _watcher, _timer, _previous, _strm, _writeState, _callback, _level, _strategy, _windowBits, _memLevel, _dictionary, _ended, _Zlib_instances, inflating_get, windowFor_fn, start_fn, fail_fn, report_fn, run_fn, end_fn, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options2, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _resolveChain, _loadChain, _initializing, _initializeFailure, _RunModuleHooks_instances, run_fn2;
21
21
  function _mergeNamespaces(n8, m) {
22
22
  m.forEach(function(e2) {
23
23
  e2 && typeof e2 !== "string" && !Array.isArray(e2) && Object.keys(e2).forEach(function(k10) {
@@ -7913,11 +7913,11 @@ function answerFilesystem(method, args) {
7913
7913
  return answer2.apply(hostVfs, plain) ?? null;
7914
7914
  }
7915
7915
  const inodes = /* @__PURE__ */ new Map();
7916
- let nextInode = 1;
7916
+ let nextInode$1 = 1;
7917
7917
  function inodeOf(path2) {
7918
7918
  let inode = inodes.get(path2);
7919
7919
  if (inode === void 0) {
7920
- inode = nextInode++;
7920
+ inode = nextInode$1++;
7921
7921
  inodes.set(path2, inode);
7922
7922
  }
7923
7923
  return inode;
@@ -9431,6 +9431,8 @@ const fsBinding = {
9431
9431
  if ((flags & bits.excl) !== 0 && (flags & bits.create) !== 0 && exists) throw createNodeError$1("EEXIST", "open", name);
9432
9432
  if (!exists) {
9433
9433
  if ((flags & bits.create) === 0) throw createNodeError$1("ENOENT", "open", name);
9434
+ const parent = name.slice(0, name.lastIndexOf("/")) || "/";
9435
+ if (!tree2.statSync(parent).isDirectory()) throw createNodeError$1("ENOTDIR", "open", name);
9434
9436
  tree2.writeFileSync(name, "");
9435
9437
  } else if ((flags & bits.truncate) !== 0) {
9436
9438
  tree2.writeFileSync(name, "");
@@ -9443,6 +9445,7 @@ const fsBinding = {
9443
9445
  },
9444
9446
  close(fd2, req) {
9445
9447
  return answer(req, () => {
9448
+ fileFor(fd2);
9446
9449
  openFiles.delete(fd2);
9447
9450
  return void 0;
9448
9451
  });
@@ -9451,6 +9454,7 @@ const fsBinding = {
9451
9454
  read(fd2, buffer2, offset2, length, position, req) {
9452
9455
  return answer(req, () => {
9453
9456
  const file = fileFor(fd2);
9457
+ if ((file.flags & 3) === 1) throw createNodeError$1("EBADF", "read", file.path);
9454
9458
  if (file.cached === void 0) file.cached = file.tree.readFileSync(file.path);
9455
9459
  const bytes2 = file.cached;
9456
9460
  const from = position === null || position === void 0 || position < 0 ? file.position : position;
@@ -9473,17 +9477,27 @@ const fsBinding = {
9473
9477
  });
9474
9478
  },
9475
9479
  /** Node's fast path for `readFile` with an encoding it can decode itself. */
9476
- readFileUtf8(path2, _flags) {
9477
- return vfs$1().readFileSync(asPath(path2), "utf8");
9480
+ readFileUtf8(path2, flags) {
9481
+ const owned = typeof path2 !== "number";
9482
+ const fd2 = owned ? fsBinding.open(path2, flags, 438) : path2;
9483
+ try {
9484
+ const file = fileFor(fd2);
9485
+ const bytes2 = new Uint8Array(file.tree.statSync(file.path).size);
9486
+ const length = fsBinding.read(fd2, bytes2, 0, bytes2.length, -1);
9487
+ return new TextDecoder().decode(bytes2.subarray(0, length));
9488
+ } finally {
9489
+ if (owned) fsBinding.close(fd2);
9490
+ }
9478
9491
  },
9479
9492
  // ---- writing ------------------------------------------------------------
9480
9493
  writeBuffer(fd2, buffer2, offset2, length, position, req) {
9481
9494
  return answer(req, () => {
9482
9495
  const file = fileFor(fd2);
9496
+ if ((file.flags & 3) === 0) throw createNodeError$1("EBADF", "write", file.path);
9483
9497
  const tree2 = file.tree;
9484
9498
  const slice = buffer2.subarray(offset2, offset2 + length);
9485
9499
  const existing = file.cached ?? (tree2.existsSync(file.path) ? tree2.readFileSync(file.path) : new Uint8Array(0));
9486
- const at3 = position === null || position === void 0 || position < 0 ? file.position : position;
9500
+ const at3 = (file.flags & flagBits().append) !== 0 ? existing.length : position === null || position === void 0 || position < 0 ? file.position : position;
9487
9501
  const size = Math.max(existing.length, at3 + slice.length);
9488
9502
  const next2 = new Uint8Array(size);
9489
9503
  next2.set(existing, 0);
@@ -9513,15 +9527,14 @@ const fsBinding = {
9513
9527
  const bytes2 = encoding === "utf8" || encoding === void 0 || encoding === "utf-8" ? new TextEncoder().encode(value) : Uint8Array.from(value, (character) => character.charCodeAt(0) & 255);
9514
9528
  return fsBinding.writeBuffer(fd2, bytes2, 0, bytes2.length, position ?? null, req);
9515
9529
  },
9516
- writeFileUtf8(path2, data2, flags, _mode) {
9517
- const tree2 = vfs$1();
9518
- const name = asPath(path2);
9519
- if ((flags & flagBits().append) !== 0 && tree2.existsSync(name)) {
9520
- const existing = tree2.readFileSync(name, "utf8");
9521
- tree2.writeFileSync(name, existing + data2);
9522
- return void 0;
9530
+ writeFileUtf8(path2, data2, flags, mode) {
9531
+ const owned = typeof path2 !== "number";
9532
+ const fd2 = owned ? fsBinding.open(path2, flags, mode) : path2;
9533
+ try {
9534
+ fsBinding.writeString(fd2, data2, null, "utf8");
9535
+ } finally {
9536
+ if (owned) fsBinding.close(fd2);
9523
9537
  }
9524
- tree2.writeFileSync(name, data2);
9525
9538
  return void 0;
9526
9539
  },
9527
9540
  // ---- metadata -----------------------------------------------------------
@@ -9802,6 +9815,7 @@ const fsBinding = {
9802
9815
  ftruncate(fd2, length, req) {
9803
9816
  return answer(req, () => {
9804
9817
  const file = fileFor(fd2);
9818
+ if ((file.flags & 3) === 0) throw createNodeError$1("EBADF", "ftruncate", file.path);
9805
9819
  const tree2 = file.tree;
9806
9820
  const bytes2 = file.cached ?? tree2.readFileSync(file.path);
9807
9821
  const next2 = new Uint8Array(length);
@@ -16915,10 +16929,17 @@ var implementation$1 = function bind2(that) {
16915
16929
  var implementation = implementation$1;
16916
16930
  var functionBind = Function.prototype.bind || implementation;
16917
16931
  var functionCall = Function.prototype.call;
16918
- var functionApply = Function.prototype.apply;
16932
+ var functionApply;
16933
+ var hasRequiredFunctionApply;
16934
+ function requireFunctionApply() {
16935
+ if (hasRequiredFunctionApply) return functionApply;
16936
+ hasRequiredFunctionApply = 1;
16937
+ functionApply = Function.prototype.apply;
16938
+ return functionApply;
16939
+ }
16919
16940
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
16920
16941
  var bind$2 = functionBind;
16921
- var $apply$1 = functionApply;
16942
+ var $apply$1 = requireFunctionApply();
16922
16943
  var $call$2 = functionCall;
16923
16944
  var $reflectApply = reflectApply;
16924
16945
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
@@ -17038,7 +17059,7 @@ var hasSymbols = requireHasSymbols()();
17038
17059
  var getProto = requireGetProto();
17039
17060
  var $ObjectGPO = requireObject_getPrototypeOf();
17040
17061
  var $ReflectGPO = requireReflect_getPrototypeOf();
17041
- var $apply = functionApply;
17062
+ var $apply = requireFunctionApply();
17042
17063
  var $call = functionCall;
17043
17064
  var needsEval = {};
17044
17065
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
@@ -17679,7 +17700,7 @@ function requireApplyBind() {
17679
17700
  if (hasRequiredApplyBind) return applyBind;
17680
17701
  hasRequiredApplyBind = 1;
17681
17702
  var bind3 = functionBind;
17682
- var $apply2 = functionApply;
17703
+ var $apply2 = requireFunctionApply();
17683
17704
  var actualApply$1 = actualApply;
17684
17705
  applyBind = function applyBind2() {
17685
17706
  return actualApply$1(bind3, $apply2, arguments);
@@ -26091,6 +26112,16 @@ lazyExport("stream", "pipeline");
26091
26112
  lazyExport("stream", "finished");
26092
26113
  lazyModule("stream/promises");
26093
26114
  const streamPromisesModule = lazyModule("stream/promises");
26115
+ const nodeInodes = /* @__PURE__ */ new WeakMap();
26116
+ let nextInode = 1;
26117
+ function inodeFor(node) {
26118
+ let inode = nodeInodes.get(node);
26119
+ if (inode === void 0) {
26120
+ inode = nextInode++;
26121
+ nodeInodes.set(node, inode);
26122
+ }
26123
+ return inode;
26124
+ }
26094
26125
  function createNodeError(code2, syscall, path2, message) {
26095
26126
  const errno = {
26096
26127
  ENOENT: -2,
@@ -26407,7 +26438,7 @@ class VirtualFS {
26407
26438
  uid: 1e3,
26408
26439
  gid: 1e3,
26409
26440
  dev: 0,
26410
- ino: 0,
26441
+ ino: inodeFor(node),
26411
26442
  rdev: 0,
26412
26443
  blksize: 4096,
26413
26444
  blocks: Math.ceil(size / 512)
@@ -26446,7 +26477,7 @@ class VirtualFS {
26446
26477
  uid: 1e3,
26447
26478
  gid: 1e3,
26448
26479
  dev: 0,
26449
- ino: 0,
26480
+ ino: inodeFor(node),
26450
26481
  rdev: 0,
26451
26482
  blksize: 4096,
26452
26483
  blocks: 0
@@ -27670,7 +27701,11 @@ const slashPattern = /\\\\/g;
27670
27701
  const openPattern = /\\{/g;
27671
27702
  const closePattern = /\\}/g;
27672
27703
  const commaPattern = /\\,/g;
27673
- const periodPattern = /\\./g;
27704
+ const periodPattern = /\\\./g;
27705
+ const EXPANSION_MAX = 1e5;
27706
+ const EXPANSION_MAX_LENGTH = 4e6;
27707
+ const EXPANSION_MAX_DEPTH = 1e3;
27708
+ const EXPANSION_MAX_REWRITES = 1e3;
27674
27709
  function numeric(str) {
27675
27710
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
27676
27711
  }
@@ -27680,34 +27715,44 @@ function escapeBraces(str) {
27680
27715
  function unescapeBraces(str) {
27681
27716
  return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
27682
27717
  }
27683
- function parseCommaParts(str) {
27684
- if (!str) {
27685
- return [""];
27718
+ function pushAll(target, items) {
27719
+ for (let i10 = 0; i10 < items.length; i10++) {
27720
+ target.push(items[i10]);
27686
27721
  }
27722
+ }
27723
+ function parseCommaParts(str) {
27687
27724
  const parts = [];
27688
- const m = balanced("{", "}", str);
27689
- if (!m) {
27690
- return str.split(",");
27691
- }
27692
- const { pre, body, post } = m;
27693
- const p = pre.split(",");
27694
- p[p.length - 1] += "{" + body + "}";
27695
- const postParts = parseCommaParts(post);
27696
- if (post.length) {
27697
- p[p.length - 1] += postParts.shift();
27698
- p.push.apply(p, postParts);
27699
- }
27700
- parts.push.apply(parts, p);
27701
- return parts;
27702
- }
27703
- function expand(str) {
27725
+ let carry = "";
27726
+ for (; ; ) {
27727
+ const m = balanced("{", "}", str);
27728
+ if (!m) {
27729
+ const tail = str.split(",");
27730
+ tail[0] = carry + tail[0];
27731
+ pushAll(parts, tail);
27732
+ return parts;
27733
+ }
27734
+ const { pre, body, post } = m;
27735
+ const p = pre.split(",");
27736
+ p[0] = carry + p[0];
27737
+ p[p.length - 1] += "{" + body + "}";
27738
+ if (!post.length) {
27739
+ pushAll(parts, p);
27740
+ return parts;
27741
+ }
27742
+ carry = p.pop();
27743
+ pushAll(parts, p);
27744
+ str = post;
27745
+ }
27746
+ }
27747
+ function expand(str, options = {}) {
27704
27748
  if (!str) {
27705
27749
  return [];
27706
27750
  }
27751
+ const { max: max2 = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options;
27707
27752
  if (str.slice(0, 2) === "{}") {
27708
27753
  str = "\\{\\}" + str.slice(2);
27709
27754
  }
27710
- return expand_(escapeBraces(str), true).map(unescapeBraces);
27755
+ return expand_(escapeBraces(str), max2, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
27711
27756
  }
27712
27757
  function embrace(str) {
27713
27758
  return "{" + str + "}";
@@ -27721,95 +27766,152 @@ function lte(i10, y) {
27721
27766
  function gte(i10, y) {
27722
27767
  return i10 >= y;
27723
27768
  }
27724
- function expand_(str, isTop) {
27725
- const expansions = [];
27726
- const m = balanced("{", "}", str);
27727
- if (!m)
27769
+ function combine(acc, pre, values, max2, maxLength, dropEmpties) {
27770
+ const out = [];
27771
+ let length = 0;
27772
+ for (let a = 0; a < acc.length; a++) {
27773
+ for (let v2 = 0; v2 < values.length; v2++) {
27774
+ if (out.length >= max2)
27775
+ return out;
27776
+ const expansion = acc[a] + pre + values[v2];
27777
+ if (dropEmpties && !expansion)
27778
+ continue;
27779
+ if (length + expansion.length > maxLength)
27780
+ return out;
27781
+ out.push(expansion);
27782
+ length += expansion.length;
27783
+ }
27784
+ }
27785
+ return out;
27786
+ }
27787
+ function expandSequence(body, isAlphaSequence, max2, maxLength) {
27788
+ const n8 = body.split(/\.\./);
27789
+ const N = [];
27790
+ if (n8[0] === void 0 || n8[1] === void 0) {
27791
+ return N;
27792
+ }
27793
+ const x = numeric(n8[0]);
27794
+ const y = numeric(n8[1]);
27795
+ const width = Math.max(n8[0].length, n8[1].length);
27796
+ let incr = n8.length === 3 && n8[2] !== void 0 ? Math.max(Math.abs(numeric(n8[2])), 1) : 1;
27797
+ let test = lte;
27798
+ const reverse2 = y < x;
27799
+ if (reverse2) {
27800
+ incr *= -1;
27801
+ test = gte;
27802
+ }
27803
+ const pad = n8.some(isPadded);
27804
+ let length = 0;
27805
+ for (let i10 = x; test(i10, y) && N.length < max2; i10 += incr) {
27806
+ let c;
27807
+ if (isAlphaSequence) {
27808
+ c = String.fromCharCode(i10);
27809
+ if (c === "\\") {
27810
+ c = "";
27811
+ }
27812
+ } else {
27813
+ c = String(i10);
27814
+ if (pad) {
27815
+ const need = width - c.length;
27816
+ if (need > 0) {
27817
+ const z10 = new Array(need + 1).join("0");
27818
+ if (i10 < 0) {
27819
+ c = "-" + z10 + c.slice(1);
27820
+ } else {
27821
+ c = z10 + c;
27822
+ }
27823
+ }
27824
+ }
27825
+ }
27826
+ if (length + c.length > maxLength)
27827
+ break;
27828
+ N.push(c);
27829
+ length += c.length;
27830
+ }
27831
+ return N;
27832
+ }
27833
+ function expand_(str, max2, maxLength, maxDepth, depth, maxRewrites, isTop) {
27834
+ if (depth > maxDepth) {
27728
27835
  return [str];
27729
- const pre = m.pre;
27730
- const post = m.post.length ? expand_(m.post, false) : [""];
27731
- if (/\$$/.test(m.pre)) {
27732
- for (let k10 = 0; k10 < post.length; k10++) {
27733
- const expansion = pre + "{" + m.body + "}" + post[k10];
27734
- expansions.push(expansion);
27836
+ }
27837
+ let acc = [""];
27838
+ let rewrites = 0;
27839
+ let dropEmpties = false;
27840
+ let firstGroup = true;
27841
+ for (; ; ) {
27842
+ const m = balanced("{", "}", str);
27843
+ if (!m) {
27844
+ return combine(acc, str, [""], max2, maxLength, dropEmpties);
27845
+ }
27846
+ const pre = m.pre;
27847
+ if (/\$$/.test(pre)) {
27848
+ acc = combine(acc, pre + "{" + m.body + "}", [""], max2, maxLength, dropEmpties && !m.post.length);
27849
+ firstGroup = false;
27850
+ if (!m.post.length)
27851
+ break;
27852
+ str = m.post;
27853
+ continue;
27735
27854
  }
27736
- } else {
27737
27855
  const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
27738
27856
  const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
27739
27857
  const isSequence = isNumericSequence || isAlphaSequence;
27740
27858
  const isOptions = m.body.indexOf(",") >= 0;
27741
27859
  if (!isSequence && !isOptions) {
27742
- if (m.post.match(/,(?!,).*\}/)) {
27860
+ if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
27861
+ rewrites++;
27743
27862
  str = m.pre + "{" + m.body + escClose + m.post;
27744
- return expand_(str);
27863
+ isTop = true;
27864
+ continue;
27745
27865
  }
27746
- return [str];
27866
+ return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max2, maxLength, dropEmpties);
27867
+ }
27868
+ if (firstGroup) {
27869
+ dropEmpties = isTop && !isSequence;
27870
+ firstGroup = false;
27747
27871
  }
27748
- let n8;
27872
+ let values;
27749
27873
  if (isSequence) {
27750
- n8 = m.body.split(/\.\./);
27874
+ values = expandSequence(m.body, isAlphaSequence, max2, maxLength);
27751
27875
  } else {
27752
- n8 = parseCommaParts(m.body);
27876
+ let n8 = parseCommaParts(m.body);
27753
27877
  if (n8.length === 1 && n8[0] !== void 0) {
27754
- n8 = expand_(n8[0], false).map(embrace);
27878
+ n8 = expand_(n8[0], max2, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
27755
27879
  if (n8.length === 1) {
27756
- return post.map((p) => m.pre + n8[0] + p);
27880
+ acc = combine(acc, pre + n8[0], [""], max2, maxLength, dropEmpties && !m.post.length);
27881
+ if (!m.post.length)
27882
+ break;
27883
+ str = m.post;
27884
+ continue;
27757
27885
  }
27758
27886
  }
27759
- }
27760
- let N;
27761
- if (isSequence && n8[0] !== void 0 && n8[1] !== void 0) {
27762
- const x = numeric(n8[0]);
27763
- const y = numeric(n8[1]);
27764
- const width = Math.max(n8[0].length, n8[1].length);
27765
- let incr = n8.length === 3 && n8[2] !== void 0 ? Math.abs(numeric(n8[2])) : 1;
27766
- let test = lte;
27767
- const reverse2 = y < x;
27768
- if (reverse2) {
27769
- incr *= -1;
27770
- test = gte;
27771
- }
27772
- const pad = n8.some(isPadded);
27773
- N = [];
27774
- for (let i10 = x; test(i10, y); i10 += incr) {
27775
- let c;
27776
- if (isAlphaSequence) {
27777
- c = String.fromCharCode(i10);
27778
- if (c === "\\") {
27779
- c = "";
27780
- }
27781
- } else {
27782
- c = String(i10);
27783
- if (pad) {
27784
- const need = width - c.length;
27785
- if (need > 0) {
27786
- const z10 = new Array(need + 1).join("0");
27787
- if (i10 < 0) {
27788
- c = "-" + z10 + c.slice(1);
27789
- } else {
27790
- c = z10 + c;
27791
- }
27792
- }
27793
- }
27887
+ let dropsEmpties = dropEmpties && !m.post.length && !pre;
27888
+ for (let d = 0; dropsEmpties && d < acc.length; d++) {
27889
+ if (acc[d]) {
27890
+ dropsEmpties = false;
27794
27891
  }
27795
- N.push(c);
27796
27892
  }
27797
- } else {
27798
- N = [];
27799
- for (let j = 0; j < n8.length; j++) {
27800
- N.push.apply(N, expand_(n8[j], false));
27801
- }
27802
- }
27803
- for (let j = 0; j < N.length; j++) {
27804
- for (let k10 = 0; k10 < post.length; k10++) {
27805
- const expansion = pre + N[j] + post[k10];
27806
- if (!isTop || isSequence || expansion) {
27807
- expansions.push(expansion);
27893
+ values = [];
27894
+ let valuesLength = 0;
27895
+ outer: for (let j = 0; j < n8.length; j++) {
27896
+ const expanded = expand_(n8[j], max2, maxLength, maxDepth, depth + 1, maxRewrites, false);
27897
+ for (let k10 = 0; k10 < expanded.length; k10++) {
27898
+ const v2 = expanded[k10];
27899
+ if (dropsEmpties && !v2)
27900
+ continue;
27901
+ if (values.length >= max2 || valuesLength + v2.length > maxLength) {
27902
+ break outer;
27903
+ }
27904
+ values.push(v2);
27905
+ valuesLength += v2.length;
27808
27906
  }
27809
27907
  }
27810
27908
  }
27909
+ acc = combine(acc, pre, values, max2, maxLength, dropEmpties && !m.post.length);
27910
+ if (!m.post.length)
27911
+ break;
27912
+ str = m.post;
27811
27913
  }
27812
- return expansions;
27914
+ return acc;
27813
27915
  }
27814
27916
  const MAX_PATTERN_LENGTH = 1024 * 64;
27815
27917
  const assertValidPattern = (pattern) => {
@@ -27929,12 +28031,60 @@ const parseClass = (glob, position) => {
27929
28031
  };
27930
28032
  const unescape = (s10, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
27931
28033
  if (magicalBraces) {
27932
- return windowsPathsNoEscape ? s10.replace(/\[([^\/\\])\]/g, "$1") : s10.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
28034
+ return windowsPathsNoEscape ? s10.replace(/\[([^/\\])\]/g, "$1") : s10.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
27933
28035
  }
27934
- return windowsPathsNoEscape ? s10.replace(/\[([^\/\\{}])\]/g, "$1") : s10.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
28036
+ return windowsPathsNoEscape ? s10.replace(/\[([^/\\{}])\]/g, "$1") : s10.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
27935
28037
  };
28038
+ var _a$1;
27936
28039
  const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
27937
28040
  const isExtglobType = (c) => types.has(c);
28041
+ const isExtglobAST = (c) => isExtglobType(c.type);
28042
+ const adoptionMap = /* @__PURE__ */ new Map([
28043
+ ["!", ["@"]],
28044
+ ["?", ["?", "@"]],
28045
+ ["@", ["@"]],
28046
+ ["*", ["*", "+", "?", "@"]],
28047
+ ["+", ["+", "@"]]
28048
+ ]);
28049
+ const adoptionWithSpaceMap = /* @__PURE__ */ new Map([
28050
+ ["!", ["?"]],
28051
+ ["@", ["?"]],
28052
+ ["+", ["?", "*"]]
28053
+ ]);
28054
+ const adoptionAnyMap = /* @__PURE__ */ new Map([
28055
+ ["!", ["?", "@"]],
28056
+ ["?", ["?", "@"]],
28057
+ ["@", ["?", "@"]],
28058
+ ["*", ["*", "+", "?", "@"]],
28059
+ ["+", ["+", "@", "?", "*"]]
28060
+ ]);
28061
+ const usurpMap = /* @__PURE__ */ new Map([
28062
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
28063
+ [
28064
+ "?",
28065
+ /* @__PURE__ */ new Map([
28066
+ ["*", "*"],
28067
+ ["+", "*"]
28068
+ ])
28069
+ ],
28070
+ [
28071
+ "@",
28072
+ /* @__PURE__ */ new Map([
28073
+ ["!", "!"],
28074
+ ["?", "?"],
28075
+ ["@", "@"],
28076
+ ["*", "*"],
28077
+ ["+", "+"]
28078
+ ])
28079
+ ],
28080
+ [
28081
+ "+",
28082
+ /* @__PURE__ */ new Map([
28083
+ ["?", "*"],
28084
+ ["*", "*"]
28085
+ ])
28086
+ ]
28087
+ ]);
27938
28088
  const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
27939
28089
  const startNoDot = "(?!\\.)";
27940
28090
  const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -27944,7 +28094,8 @@ const regExpEscape$1 = (s10) => s10.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
27944
28094
  const qmark$1 = "[^/]";
27945
28095
  const star$1 = qmark$1 + "*?";
27946
28096
  const starNoEmpty = qmark$1 + "+?";
27947
- const _AST = class _AST {
28097
+ let ID = 0;
28098
+ class AST {
27948
28099
  constructor(type2, parent, options = {}) {
27949
28100
  __privateAdd(this, _AST_instances);
27950
28101
  __publicField(this, "type");
@@ -27961,6 +28112,7 @@ const _AST = class _AST {
27961
28112
  // set to true if it's an extglob with no children
27962
28113
  // (which really means one child of '')
27963
28114
  __privateAdd(this, _emptyExt, false);
28115
+ __publicField(this, "id", ++ID);
27964
28116
  this.type = type2;
27965
28117
  if (type2)
27966
28118
  __privateSet(this, _hasMagic, true);
@@ -27972,6 +28124,23 @@ const _AST = class _AST {
27972
28124
  __privateGet(this, _negs).push(this);
27973
28125
  __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
27974
28126
  }
28127
+ get depth() {
28128
+ var _a3;
28129
+ return (((_a3 = __privateGet(this, _parent)) == null ? void 0 : _a3.depth) ?? -1) + 1;
28130
+ }
28131
+ [Symbol.for("nodejs.util.inspect.custom")]() {
28132
+ var _a3;
28133
+ return {
28134
+ "@@type": "AST",
28135
+ id: this.id,
28136
+ type: this.type,
28137
+ root: __privateGet(this, _root).id,
28138
+ parent: (_a3 = __privateGet(this, _parent)) == null ? void 0 : _a3.id,
28139
+ depth: this.depth,
28140
+ partsLength: __privateGet(this, _parts).length,
28141
+ parts: __privateGet(this, _parts)
28142
+ };
28143
+ }
27975
28144
  get hasMagic() {
27976
28145
  if (__privateGet(this, _hasMagic) !== void 0)
27977
28146
  return __privateGet(this, _hasMagic);
@@ -27985,19 +28154,13 @@ const _AST = class _AST {
27985
28154
  }
27986
28155
  // reconstructs the pattern
27987
28156
  toString() {
27988
- if (__privateGet(this, _toString) !== void 0)
27989
- return __privateGet(this, _toString);
27990
- if (!this.type) {
27991
- return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
27992
- } else {
27993
- return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
27994
- }
28157
+ return __privateGet(this, _toString) !== void 0 ? __privateGet(this, _toString) : !this.type ? __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join("")) : __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
27995
28158
  }
27996
28159
  push(...parts) {
27997
28160
  for (const p of parts) {
27998
28161
  if (p === "")
27999
28162
  continue;
28000
- if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
28163
+ if (typeof p !== "string" && !(p instanceof _a$1 && __privateGet(p, _parent) === this)) {
28001
28164
  throw new Error("invalid part: " + p);
28002
28165
  }
28003
28166
  __privateGet(this, _parts).push(p);
@@ -28024,7 +28187,7 @@ const _AST = class _AST {
28024
28187
  const p = __privateGet(this, _parent);
28025
28188
  for (let i10 = 0; i10 < __privateGet(this, _parentIndex); i10++) {
28026
28189
  const pp2 = __privateGet(p, _parts)[i10];
28027
- if (!(pp2 instanceof _AST && pp2.type === "!")) {
28190
+ if (!(pp2 instanceof _a$1 && pp2.type === "!")) {
28028
28191
  return false;
28029
28192
  }
28030
28193
  }
@@ -28050,7 +28213,7 @@ const _AST = class _AST {
28050
28213
  this.push(part.clone(this));
28051
28214
  }
28052
28215
  clone(parent) {
28053
- const c = new _AST(this.type, parent);
28216
+ const c = new _a$1(this.type, parent);
28054
28217
  for (const p of __privateGet(this, _parts)) {
28055
28218
  c.copyIn(p);
28056
28219
  }
@@ -28058,8 +28221,8 @@ const _AST = class _AST {
28058
28221
  }
28059
28222
  static fromGlob(pattern, options = {}) {
28060
28223
  var _a3;
28061
- const ast = new _AST(null, void 0, options);
28062
- __privateMethod(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, pattern, ast, 0, options);
28224
+ const ast = new _a$1(null, void 0, options);
28225
+ __privateMethod(_a3 = _a$1, _AST_static, parseAST_fn).call(_a3, pattern, ast, 0, options, 0);
28063
28226
  return ast;
28064
28227
  }
28065
28228
  // returns the regular expression if there's magic, or the unescaped
@@ -28154,13 +28317,15 @@ const _AST = class _AST {
28154
28317
  toRegExpSource(allowDot) {
28155
28318
  var _a3;
28156
28319
  const dot = allowDot ?? !!__privateGet(this, _options2).dot;
28157
- if (__privateGet(this, _root) === this)
28320
+ if (__privateGet(this, _root) === this) {
28321
+ __privateMethod(this, _AST_instances, flatten_fn).call(this);
28158
28322
  __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
28159
- if (!this.type) {
28323
+ }
28324
+ if (!isExtglobAST(this)) {
28160
28325
  const noEmpty = this.isStart() && this.isEnd() && !__privateGet(this, _parts).some((s10) => typeof s10 !== "string");
28161
28326
  const src = __privateGet(this, _parts).map((p) => {
28162
28327
  var _a4;
28163
- const [re2, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a4 = _AST, _AST_static, parseGlob_fn).call(_a4, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
28328
+ const [re2, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a4 = _a$1, _AST_static, parseGlob_fn).call(_a4, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
28164
28329
  __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
28165
28330
  __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
28166
28331
  return re2;
@@ -28199,9 +28364,10 @@ const _AST = class _AST {
28199
28364
  let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
28200
28365
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
28201
28366
  const s10 = this.toString();
28202
- __privateSet(this, _parts, [s10]);
28203
- this.type = null;
28204
- __privateSet(this, _hasMagic, void 0);
28367
+ const me = this;
28368
+ __privateSet(me, _parts, [s10]);
28369
+ me.type = null;
28370
+ __privateSet(me, _hasMagic, void 0);
28205
28371
  return [s10, unescape(this.toString()), false, false];
28206
28372
  }
28207
28373
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
@@ -28228,7 +28394,7 @@ const _AST = class _AST {
28228
28394
  __privateGet(this, _uflag)
28229
28395
  ];
28230
28396
  }
28231
- };
28397
+ }
28232
28398
  _root = new WeakMap();
28233
28399
  _hasMagic = new WeakMap();
28234
28400
  _uflag = new WeakMap();
@@ -28270,8 +28436,9 @@ fillNegs_fn = function() {
28270
28436
  return this;
28271
28437
  };
28272
28438
  _AST_static = new WeakSet();
28273
- parseAST_fn = function(str, ast, pos, opt) {
28274
- var _a3, _b3;
28439
+ parseAST_fn = function(str, ast, pos, opt, extDepth) {
28440
+ var _a3, _b3, _c3, _d3;
28441
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
28275
28442
  let escaping = false;
28276
28443
  let inBrace = false;
28277
28444
  let braceStart = -1;
@@ -28303,11 +28470,12 @@ parseAST_fn = function(str, ast, pos, opt) {
28303
28470
  acc2 += c;
28304
28471
  continue;
28305
28472
  }
28306
- if (!opt.noext && isExtglobType(c) && str.charAt(i11) === "(") {
28473
+ const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i11) === "(" && extDepth <= maxDepth;
28474
+ if (doRecurse) {
28307
28475
  ast.push(acc2);
28308
28476
  acc2 = "";
28309
- const ext2 = new _AST(c, ast);
28310
- i11 = __privateMethod(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, str, ext2, i11, opt);
28477
+ const ext2 = new _a$1(c, ast);
28478
+ i11 = __privateMethod(_a3 = _a$1, _AST_static, parseAST_fn).call(_a3, str, ext2, i11, opt, extDepth + 1);
28311
28479
  ast.push(ext2);
28312
28480
  continue;
28313
28481
  }
@@ -28317,7 +28485,7 @@ parseAST_fn = function(str, ast, pos, opt) {
28317
28485
  return i11;
28318
28486
  }
28319
28487
  let i10 = pos + 1;
28320
- let part = new _AST(null, ast);
28488
+ let part = new _a$1(null, ast);
28321
28489
  const parts = [];
28322
28490
  let acc = "";
28323
28491
  while (i10 < str.length) {
@@ -28344,19 +28512,22 @@ parseAST_fn = function(str, ast, pos, opt) {
28344
28512
  acc += c;
28345
28513
  continue;
28346
28514
  }
28347
- if (isExtglobType(c) && str.charAt(i10) === "(") {
28515
+ const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i10) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
28516
+ (extDepth <= maxDepth || ast && __privateMethod(_b3 = ast, _AST_instances, canAdoptType_fn).call(_b3, c));
28517
+ if (doRecurse) {
28518
+ const depthAdd = ast && __privateMethod(_c3 = ast, _AST_instances, canAdoptType_fn).call(_c3, c) ? 0 : 1;
28348
28519
  part.push(acc);
28349
28520
  acc = "";
28350
- const ext2 = new _AST(c, part);
28521
+ const ext2 = new _a$1(c, part);
28351
28522
  part.push(ext2);
28352
- i10 = __privateMethod(_b3 = _AST, _AST_static, parseAST_fn).call(_b3, str, ext2, i10, opt);
28523
+ i10 = __privateMethod(_d3 = _a$1, _AST_static, parseAST_fn).call(_d3, str, ext2, i10, opt, extDepth + depthAdd);
28353
28524
  continue;
28354
28525
  }
28355
28526
  if (c === "|") {
28356
28527
  part.push(acc);
28357
28528
  acc = "";
28358
28529
  parts.push(part);
28359
- part = new _AST(null, ast);
28530
+ part = new _a$1(null, ast);
28360
28531
  continue;
28361
28532
  }
28362
28533
  if (c === ")") {
@@ -28375,6 +28546,102 @@ parseAST_fn = function(str, ast, pos, opt) {
28375
28546
  __privateSet(ast, _parts, [str.substring(pos - 1)]);
28376
28547
  return i10;
28377
28548
  };
28549
+ canAdoptWithSpace_fn = function(child) {
28550
+ return __privateMethod(this, _AST_instances, canAdopt_fn).call(this, child, adoptionWithSpaceMap);
28551
+ };
28552
+ canAdopt_fn = function(child, map = adoptionMap) {
28553
+ if (!child || typeof child !== "object" || child.type !== null || __privateGet(child, _parts).length !== 1 || this.type === null) {
28554
+ return false;
28555
+ }
28556
+ const gc2 = __privateGet(child, _parts)[0];
28557
+ if (!gc2 || typeof gc2 !== "object" || gc2.type === null) {
28558
+ return false;
28559
+ }
28560
+ return __privateMethod(this, _AST_instances, canAdoptType_fn).call(this, gc2.type, map);
28561
+ };
28562
+ canAdoptType_fn = function(c, map = adoptionAnyMap) {
28563
+ var _a3;
28564
+ return !!((_a3 = map.get(this.type)) == null ? void 0 : _a3.includes(c));
28565
+ };
28566
+ adoptWithSpace_fn = function(child, index2) {
28567
+ const gc2 = __privateGet(child, _parts)[0];
28568
+ const blank = new _a$1(null, gc2, this.options);
28569
+ __privateGet(blank, _parts).push("");
28570
+ gc2.push(blank);
28571
+ __privateMethod(this, _AST_instances, adopt_fn).call(this, child, index2);
28572
+ };
28573
+ adopt_fn = function(child, index2) {
28574
+ const gc2 = __privateGet(child, _parts)[0];
28575
+ __privateGet(this, _parts).splice(index2, 1, ...__privateGet(gc2, _parts));
28576
+ for (const p of __privateGet(gc2, _parts)) {
28577
+ if (typeof p === "object")
28578
+ __privateSet(p, _parent, this);
28579
+ }
28580
+ __privateSet(this, _toString, void 0);
28581
+ };
28582
+ canUsurpType_fn = function(c) {
28583
+ const m = usurpMap.get(this.type);
28584
+ return !!(m == null ? void 0 : m.has(c));
28585
+ };
28586
+ canUsurp_fn = function(child) {
28587
+ if (!child || typeof child !== "object" || child.type !== null || __privateGet(child, _parts).length !== 1 || this.type === null || __privateGet(this, _parts).length !== 1) {
28588
+ return false;
28589
+ }
28590
+ const gc2 = __privateGet(child, _parts)[0];
28591
+ if (!gc2 || typeof gc2 !== "object" || gc2.type === null) {
28592
+ return false;
28593
+ }
28594
+ return __privateMethod(this, _AST_instances, canUsurpType_fn).call(this, gc2.type);
28595
+ };
28596
+ usurp_fn = function(child) {
28597
+ const m = usurpMap.get(this.type);
28598
+ const gc2 = __privateGet(child, _parts)[0];
28599
+ const nt2 = m == null ? void 0 : m.get(gc2.type);
28600
+ if (!nt2)
28601
+ return false;
28602
+ __privateSet(this, _parts, __privateGet(gc2, _parts));
28603
+ for (const p of __privateGet(this, _parts)) {
28604
+ if (typeof p === "object") {
28605
+ __privateSet(p, _parent, this);
28606
+ }
28607
+ }
28608
+ this.type = nt2;
28609
+ __privateSet(this, _toString, void 0);
28610
+ __privateSet(this, _emptyExt, false);
28611
+ };
28612
+ flatten_fn = function() {
28613
+ var _a3, _b3;
28614
+ if (!isExtglobAST(this)) {
28615
+ for (const p of __privateGet(this, _parts)) {
28616
+ if (typeof p === "object") {
28617
+ __privateMethod(_a3 = p, _AST_instances, flatten_fn).call(_a3);
28618
+ }
28619
+ }
28620
+ } else {
28621
+ let iterations = 0;
28622
+ let done = false;
28623
+ do {
28624
+ done = true;
28625
+ for (let i10 = 0; i10 < __privateGet(this, _parts).length; i10++) {
28626
+ const c = __privateGet(this, _parts)[i10];
28627
+ if (typeof c === "object") {
28628
+ __privateMethod(_b3 = c, _AST_instances, flatten_fn).call(_b3);
28629
+ if (__privateMethod(this, _AST_instances, canAdopt_fn).call(this, c)) {
28630
+ done = false;
28631
+ __privateMethod(this, _AST_instances, adopt_fn).call(this, c, i10);
28632
+ } else if (__privateMethod(this, _AST_instances, canAdoptWithSpace_fn).call(this, c)) {
28633
+ done = false;
28634
+ __privateMethod(this, _AST_instances, adoptWithSpace_fn).call(this, c, i10);
28635
+ } else if (__privateMethod(this, _AST_instances, canUsurp_fn).call(this, c)) {
28636
+ done = false;
28637
+ __privateMethod(this, _AST_instances, usurp_fn).call(this, c);
28638
+ }
28639
+ }
28640
+ }
28641
+ } while (!done && ++iterations < 10);
28642
+ }
28643
+ __privateSet(this, _toString, void 0);
28644
+ };
28378
28645
  partsToRegExp_fn = function(dot) {
28379
28646
  return __privateGet(this, _parts).map((p) => {
28380
28647
  if (typeof p === "string") {
@@ -28389,6 +28656,7 @@ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
28389
28656
  let escaping = false;
28390
28657
  let re2 = "";
28391
28658
  let uflag = false;
28659
+ let inStar = false;
28392
28660
  for (let i10 = 0; i10 < glob.length; i10++) {
28393
28661
  const c = glob.charAt(i10);
28394
28662
  if (escaping) {
@@ -28396,6 +28664,16 @@ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
28396
28664
  re2 += (reSpecials.has(c) ? "\\" : "") + c;
28397
28665
  continue;
28398
28666
  }
28667
+ if (c === "*") {
28668
+ if (inStar)
28669
+ continue;
28670
+ inStar = true;
28671
+ re2 += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
28672
+ hasMagic = true;
28673
+ continue;
28674
+ } else {
28675
+ inStar = false;
28676
+ }
28399
28677
  if (c === "\\") {
28400
28678
  if (i10 === glob.length - 1) {
28401
28679
  re2 += "\\\\";
@@ -28414,11 +28692,6 @@ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
28414
28692
  continue;
28415
28693
  }
28416
28694
  }
28417
- if (c === "*") {
28418
- re2 += noEmpty && glob === "*" ? starNoEmpty : star$1;
28419
- hasMagic = true;
28420
- continue;
28421
- }
28422
28695
  if (c === "?") {
28423
28696
  re2 += qmark$1;
28424
28697
  hasMagic = true;
@@ -28428,8 +28701,8 @@ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
28428
28701
  }
28429
28702
  return [re2, unescape(glob), !!hasMagic, uflag];
28430
28703
  };
28431
- __privateAdd(_AST, _AST_static);
28432
- let AST = _AST;
28704
+ __privateAdd(AST, _AST_static);
28705
+ _a$1 = AST;
28433
28706
  const escape = (s10, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
28434
28707
  if (magicalBraces) {
28435
28708
  return windowsPathsNoEscape ? s10.replace(/[?*()[\]{}]/g, "[$&]") : s10.replace(/[?*()[\]\\{}]/g, "\\$&");
@@ -28444,7 +28717,7 @@ const minimatch = (p, pattern, options = {}) => {
28444
28717
  }
28445
28718
  return new Minimatch(pattern, options).match(p);
28446
28719
  };
28447
- const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
28720
+ const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
28448
28721
  const starDotExtTest = (ext2) => (f10) => !f10.startsWith(".") && f10.endsWith(ext2);
28449
28722
  const starDotExtTestDot = (ext2) => (f10) => f10.endsWith(ext2);
28450
28723
  const starDotExtTestNocase = (ext2) => {
@@ -28463,7 +28736,7 @@ const dotStarTest = (f10) => f10 !== "." && f10 !== ".." && f10.startsWith(".");
28463
28736
  const starRE = /^\*+$/;
28464
28737
  const starTest = (f10) => f10.length !== 0 && !f10.startsWith(".");
28465
28738
  const starTestDot = (f10) => f10.length !== 0 && f10 !== "." && f10 !== "..";
28466
- const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
28739
+ const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
28467
28740
  const qmarksTestNocase = ([$02, ext2 = ""]) => {
28468
28741
  const noext = qmarksTestNoExt([$02]);
28469
28742
  if (!ext2)
@@ -28552,7 +28825,7 @@ const braceExpand = (pattern, options = {}) => {
28552
28825
  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
28553
28826
  return [pattern];
28554
28827
  }
28555
- return expand(pattern);
28828
+ return expand(pattern, { max: options.braceExpandMax });
28556
28829
  };
28557
28830
  minimatch.braceExpand = braceExpand;
28558
28831
  const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
@@ -28570,6 +28843,7 @@ const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
28570
28843
  const regExpEscape = (s10) => s10.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
28571
28844
  class Minimatch {
28572
28845
  constructor(pattern, options = {}) {
28846
+ __privateAdd(this, _Minimatch_instances);
28573
28847
  __publicField(this, "options");
28574
28848
  __publicField(this, "set");
28575
28849
  __publicField(this, "pattern");
@@ -28586,14 +28860,17 @@ class Minimatch {
28586
28860
  __publicField(this, "isWindows");
28587
28861
  __publicField(this, "platform");
28588
28862
  __publicField(this, "windowsNoMagicRoot");
28863
+ __publicField(this, "maxGlobstarRecursion");
28589
28864
  __publicField(this, "regexp");
28590
28865
  assertValidPattern(pattern);
28591
28866
  options = options || {};
28592
28867
  this.options = options;
28868
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
28593
28869
  this.pattern = pattern;
28594
28870
  this.platform = options.platform || defaultPlatform;
28595
28871
  this.isWindows = this.platform === "win32";
28596
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
28872
+ const awe = "allowWindowsEscape";
28873
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
28597
28874
  if (this.windowsPathsNoEscape) {
28598
28875
  this.pattern = this.pattern.replace(/\\/g, "/");
28599
28876
  }
@@ -28650,7 +28927,10 @@ class Minimatch {
28650
28927
  const isUNC = s10[0] === "" && s10[1] === "" && (s10[2] === "?" || !globMagic.test(s10[2])) && !globMagic.test(s10[3]);
28651
28928
  const isDrive = /^[a-z]:/i.test(s10[0]);
28652
28929
  if (isUNC) {
28653
- return [...s10.slice(0, 4), ...s10.slice(4).map((ss2) => this.parse(ss2))];
28930
+ return [
28931
+ ...s10.slice(0, 4),
28932
+ ...s10.slice(4).map((ss2) => this.parse(ss2))
28933
+ ];
28654
28934
  } else if (isDrive) {
28655
28935
  return [s10[0], ...s10.slice(1).map((ss2) => this.parse(ss2))];
28656
28936
  }
@@ -28676,10 +28956,10 @@ class Minimatch {
28676
28956
  // of patterns that we have to process.
28677
28957
  preprocess(globParts) {
28678
28958
  if (this.options.noglobstar) {
28679
- for (let i10 = 0; i10 < globParts.length; i10++) {
28680
- for (let j = 0; j < globParts[i10].length; j++) {
28681
- if (globParts[i10][j] === "**") {
28682
- globParts[i10][j] = "*";
28959
+ for (const partset of globParts) {
28960
+ for (let j = 0; j < partset.length; j++) {
28961
+ if (partset[j] === "**") {
28962
+ partset[j] = "*";
28683
28963
  }
28684
28964
  }
28685
28965
  }
@@ -28757,7 +29037,7 @@ class Minimatch {
28757
29037
  let dd2 = 0;
28758
29038
  while (-1 !== (dd2 = parts.indexOf("..", dd2 + 1))) {
28759
29039
  const p = parts[dd2 - 1];
28760
- if (p && p !== "." && p !== ".." && p !== "**") {
29040
+ if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
28761
29041
  didSomething = true;
28762
29042
  parts.splice(dd2 - 1, 2);
28763
29043
  dd2 -= 2;
@@ -28922,7 +29202,8 @@ class Minimatch {
28922
29202
  // out of pattern, then that's fine, as long as all
28923
29203
  // the parts match.
28924
29204
  matchOne(file, pattern, partial = false) {
28925
- const options = this.options;
29205
+ let fileStartIndex = 0;
29206
+ let patternStartIndex = 0;
28926
29207
  if (this.isWindows) {
28927
29208
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
28928
29209
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
@@ -28931,14 +29212,14 @@ class Minimatch {
28931
29212
  const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
28932
29213
  const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
28933
29214
  if (typeof fdi === "number" && typeof pdi === "number") {
28934
- const [fd2, pd2] = [file[fdi], pattern[pdi]];
29215
+ const [fd2, pd2] = [
29216
+ file[fdi],
29217
+ pattern[pdi]
29218
+ ];
28935
29219
  if (fd2.toLowerCase() === pd2.toLowerCase()) {
28936
29220
  pattern[pdi] = fd2;
28937
- if (pdi > fdi) {
28938
- pattern = pattern.slice(pdi);
28939
- } else if (fdi > pdi) {
28940
- file = file.slice(fdi);
28941
- }
29221
+ patternStartIndex = pdi;
29222
+ fileStartIndex = fdi;
28942
29223
  }
28943
29224
  }
28944
29225
  }
@@ -28946,71 +29227,10 @@ class Minimatch {
28946
29227
  if (optimizationLevel >= 2) {
28947
29228
  file = this.levelTwoFileOptimize(file);
28948
29229
  }
28949
- this.debug("matchOne", this, { file, pattern });
28950
- this.debug("matchOne", file.length, pattern.length);
28951
- for (var fi2 = 0, pi2 = 0, fl2 = file.length, pl2 = pattern.length; fi2 < fl2 && pi2 < pl2; fi2++, pi2++) {
28952
- this.debug("matchOne loop");
28953
- var p = pattern[pi2];
28954
- var f10 = file[fi2];
28955
- this.debug(pattern, p, f10);
28956
- if (p === false) {
28957
- return false;
28958
- }
28959
- if (p === GLOBSTAR) {
28960
- this.debug("GLOBSTAR", [pattern, p, f10]);
28961
- var fr2 = fi2;
28962
- var pr2 = pi2 + 1;
28963
- if (pr2 === pl2) {
28964
- this.debug("** at the end");
28965
- for (; fi2 < fl2; fi2++) {
28966
- if (file[fi2] === "." || file[fi2] === ".." || !options.dot && file[fi2].charAt(0) === ".")
28967
- return false;
28968
- }
28969
- return true;
28970
- }
28971
- while (fr2 < fl2) {
28972
- var swallowee = file[fr2];
28973
- this.debug("\nglobstar while", file, fr2, pattern, pr2, swallowee);
28974
- if (this.matchOne(file.slice(fr2), pattern.slice(pr2), partial)) {
28975
- this.debug("globstar found match!", fr2, fl2, swallowee);
28976
- return true;
28977
- } else {
28978
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
28979
- this.debug("dot detected!", file, fr2, pattern, pr2);
28980
- break;
28981
- }
28982
- this.debug("globstar swallow a segment, and continue");
28983
- fr2++;
28984
- }
28985
- }
28986
- if (partial) {
28987
- this.debug("\n>>> no match, partial?", file, fr2, pattern, pr2);
28988
- if (fr2 === fl2) {
28989
- return true;
28990
- }
28991
- }
28992
- return false;
28993
- }
28994
- let hit;
28995
- if (typeof p === "string") {
28996
- hit = f10 === p;
28997
- this.debug("string match", p, f10, hit);
28998
- } else {
28999
- hit = p.test(f10);
29000
- this.debug("pattern match", p, f10, hit);
29001
- }
29002
- if (!hit)
29003
- return false;
29004
- }
29005
- if (fi2 === fl2 && pi2 === pl2) {
29006
- return true;
29007
- } else if (fi2 === fl2) {
29008
- return partial;
29009
- } else if (pi2 === pl2) {
29010
- return fi2 === fl2 - 1 && file[fi2] === "";
29011
- } else {
29012
- throw new Error("wtf?");
29230
+ if (pattern.includes(GLOBSTAR)) {
29231
+ return __privateMethod(this, _Minimatch_instances, matchGlobstar_fn).call(this, file, pattern, partial, fileStartIndex, patternStartIndex);
29013
29232
  }
29233
+ return __privateMethod(this, _Minimatch_instances, matchOne_fn).call(this, file, pattern, partial, fileStartIndex, patternStartIndex);
29014
29234
  }
29015
29235
  braceExpand() {
29016
29236
  return braceExpand(this.pattern, this.options);
@@ -29098,7 +29318,7 @@ class Minimatch {
29098
29318
  re2 = "^(?!" + re2 + ").+$";
29099
29319
  try {
29100
29320
  this.regexp = new RegExp(re2, [...flags].join(""));
29101
- } catch (ex2) {
29321
+ } catch {
29102
29322
  this.regexp = false;
29103
29323
  }
29104
29324
  return this.regexp;
@@ -29106,7 +29326,7 @@ class Minimatch {
29106
29326
  slashSplit(p) {
29107
29327
  if (this.preserveMultipleSlashes) {
29108
29328
  return p.split("/");
29109
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
29329
+ } else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
29110
29330
  return ["", ...p.split(/\/+/)];
29111
29331
  } else {
29112
29332
  return p.split(/\/+/);
@@ -29137,8 +29357,7 @@ class Minimatch {
29137
29357
  filename = ff2[i10];
29138
29358
  }
29139
29359
  }
29140
- for (let i10 = 0; i10 < set.length; i10++) {
29141
- const pattern = set[i10];
29360
+ for (const pattern of set) {
29142
29361
  let file = ff2;
29143
29362
  if (options.matchBase && pattern.length === 1) {
29144
29363
  file = [filename];
@@ -29160,6 +29379,142 @@ class Minimatch {
29160
29379
  return minimatch.defaults(def).Minimatch;
29161
29380
  }
29162
29381
  }
29382
+ _Minimatch_instances = new WeakSet();
29383
+ matchGlobstar_fn = function(file, pattern, partial, fileIndex, patternIndex) {
29384
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
29385
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
29386
+ const [head, body, tail] = partial ? [
29387
+ pattern.slice(patternIndex, firstgs),
29388
+ pattern.slice(firstgs + 1),
29389
+ []
29390
+ ] : [
29391
+ pattern.slice(patternIndex, firstgs),
29392
+ pattern.slice(firstgs + 1, lastgs),
29393
+ pattern.slice(lastgs + 1)
29394
+ ];
29395
+ if (head.length) {
29396
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
29397
+ if (!__privateMethod(this, _Minimatch_instances, matchOne_fn).call(this, fileHead, head, partial, 0, 0)) {
29398
+ return false;
29399
+ }
29400
+ fileIndex += head.length;
29401
+ patternIndex += head.length;
29402
+ }
29403
+ let fileTailMatch = 0;
29404
+ if (tail.length) {
29405
+ if (tail.length + fileIndex > file.length)
29406
+ return false;
29407
+ let tailStart = file.length - tail.length;
29408
+ if (__privateMethod(this, _Minimatch_instances, matchOne_fn).call(this, file, tail, partial, tailStart, 0)) {
29409
+ fileTailMatch = tail.length;
29410
+ } else {
29411
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
29412
+ return false;
29413
+ }
29414
+ tailStart--;
29415
+ if (!__privateMethod(this, _Minimatch_instances, matchOne_fn).call(this, file, tail, partial, tailStart, 0)) {
29416
+ return false;
29417
+ }
29418
+ fileTailMatch = tail.length + 1;
29419
+ }
29420
+ }
29421
+ if (!body.length) {
29422
+ let sawSome = !!fileTailMatch;
29423
+ for (let i22 = fileIndex; i22 < file.length - fileTailMatch; i22++) {
29424
+ const f10 = String(file[i22]);
29425
+ sawSome = true;
29426
+ if (f10 === "." || f10 === ".." || !this.options.dot && f10.startsWith(".")) {
29427
+ return false;
29428
+ }
29429
+ }
29430
+ return partial || sawSome;
29431
+ }
29432
+ const bodySegments = [[[], 0]];
29433
+ let currentBody = bodySegments[0];
29434
+ let nonGsParts = 0;
29435
+ const nonGsPartsSums = [0];
29436
+ for (const b of body) {
29437
+ if (b === GLOBSTAR) {
29438
+ nonGsPartsSums.push(nonGsParts);
29439
+ currentBody = [[], 0];
29440
+ bodySegments.push(currentBody);
29441
+ } else {
29442
+ currentBody[0].push(b);
29443
+ nonGsParts++;
29444
+ }
29445
+ }
29446
+ let i10 = bodySegments.length - 1;
29447
+ const fileLength = file.length - fileTailMatch;
29448
+ for (const b of bodySegments) {
29449
+ b[1] = fileLength - (nonGsPartsSums[i10--] + b[0].length);
29450
+ }
29451
+ return !!__privateMethod(this, _Minimatch_instances, matchGlobStarBodySections_fn).call(this, file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
29452
+ };
29453
+ // return false for "nope, not matching"
29454
+ // return null for "not matching, cannot keep trying"
29455
+ matchGlobStarBodySections_fn = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
29456
+ const bs2 = bodySegments[bodyIndex];
29457
+ if (!bs2) {
29458
+ for (let i10 = fileIndex; i10 < file.length; i10++) {
29459
+ sawTail = true;
29460
+ const f10 = file[i10];
29461
+ if (f10 === "." || f10 === ".." || !this.options.dot && f10.startsWith(".")) {
29462
+ return false;
29463
+ }
29464
+ }
29465
+ return sawTail;
29466
+ }
29467
+ const [body, after] = bs2;
29468
+ while (fileIndex <= after) {
29469
+ const m = __privateMethod(this, _Minimatch_instances, matchOne_fn).call(this, file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
29470
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
29471
+ const sub = __privateMethod(this, _Minimatch_instances, matchGlobStarBodySections_fn).call(this, file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
29472
+ if (sub !== false) {
29473
+ return sub;
29474
+ }
29475
+ }
29476
+ const f10 = file[fileIndex];
29477
+ if (f10 === "." || f10 === ".." || !this.options.dot && f10.startsWith(".")) {
29478
+ return false;
29479
+ }
29480
+ fileIndex++;
29481
+ }
29482
+ return partial || null;
29483
+ };
29484
+ matchOne_fn = function(file, pattern, partial, fileIndex, patternIndex) {
29485
+ let fi2;
29486
+ let pi2;
29487
+ let pl2;
29488
+ let fl2;
29489
+ for (fi2 = fileIndex, pi2 = patternIndex, fl2 = file.length, pl2 = pattern.length; fi2 < fl2 && pi2 < pl2; fi2++, pi2++) {
29490
+ this.debug("matchOne loop");
29491
+ let p = pattern[pi2];
29492
+ let f10 = file[fi2];
29493
+ this.debug(pattern, p, f10);
29494
+ if (p === false || p === GLOBSTAR) {
29495
+ return false;
29496
+ }
29497
+ let hit;
29498
+ if (typeof p === "string") {
29499
+ hit = f10 === p;
29500
+ this.debug("string match", p, f10, hit);
29501
+ } else {
29502
+ hit = p.test(f10);
29503
+ this.debug("pattern match", p, f10, hit);
29504
+ }
29505
+ if (!hit)
29506
+ return false;
29507
+ }
29508
+ if (fi2 === fl2 && pi2 === pl2) {
29509
+ return true;
29510
+ } else if (fi2 === fl2) {
29511
+ return partial;
29512
+ } else if (pi2 === pl2) {
29513
+ return fi2 === fl2 - 1 && file[fi2] === "";
29514
+ } else {
29515
+ throw new Error("wtf?");
29516
+ }
29517
+ };
29163
29518
  minimatch.AST = AST;
29164
29519
  minimatch.Minimatch = Minimatch;
29165
29520
  minimatch.escape = escape;
@@ -75218,4 +75573,3 @@ var index = /* @__PURE__ */ Object.freeze({
75218
75573
  Registry,
75219
75574
  parsePackageSpec
75220
75575
  });
75221
- //# sourceMappingURL=runtime-worker-4MKaHFVb.js.map