@vite-hub/schedule 0.5.0 → 0.5.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 (49) hide show
  1. package/dist/{console-DueeEBcM.d.ts → console-DFI1QBkP.d.ts} +0 -4
  2. package/dist/{cron-C1l3TquN.js → cron-BT3ef48f.js} +2 -4
  3. package/dist/definition.d.ts +2 -4
  4. package/dist/definition.js +4 -5
  5. package/dist/{due-n120-_nz.js → due-D-0trD1g.js} +2 -3
  6. package/dist/durability.d.ts +1 -3
  7. package/dist/durability.js +1 -2
  8. package/dist/{error-diagnostics-DTmP6baC.js → error-diagnostics-B1AaIGWP.js} +1 -2
  9. package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
  10. package/dist/index.d.ts +3 -13
  11. package/dist/index.js +5 -7
  12. package/dist/{inspect-DTfAo5gS.js → inspect-CW0qwt9p.js} +2 -4
  13. package/dist/{kv-storage-2kZtP2CC.js → kv-storage-Dsr3TL9c.js} +1 -2
  14. package/dist/{kv-storage-Bm9aYLfZ.d.ts → kv-storage-hI2IOjb5.d.ts} +0 -2
  15. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  16. package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
  17. package/dist/{operations-DlrK9mlH.js → operations-BTUQeba1.js} +7 -8
  18. package/dist/operations.d.ts +2 -6
  19. package/dist/operations.js +8 -13
  20. package/dist/os.d.ts +0 -8
  21. package/dist/os.js +13 -22
  22. package/dist/{out-BbXG-yVX.js → out-By90R-Bo.js} +3345 -2394
  23. package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
  24. package/dist/runtime/console.d.ts +2 -4
  25. package/dist/runtime/console.js +2 -3
  26. package/dist/runtime/kv.d.ts +2 -4
  27. package/dist/runtime/kv.js +2 -3
  28. package/dist/runtime/process.d.ts +1 -3
  29. package/dist/runtime/process.js +10 -13
  30. package/dist/runtime/state.d.ts +1 -1
  31. package/dist/runtime/state.js +1 -2
  32. package/dist/runtime/static.d.ts +1 -1
  33. package/dist/runtime/static.js +2 -2
  34. package/dist/runtime.d.ts +5 -7
  35. package/dist/runtime.js +5 -5
  36. package/dist/{started-BWWr7Ufw.js → started-B1Se_Iwo.js} +6 -7
  37. package/dist/{started-BXdWMdji.js → started-Bzvr4t5f.js} +6 -7
  38. package/dist/{started-errors-BMg04lL3.js → started-errors-IG9DlT2A.js} +6 -9
  39. package/dist/{started-name-DudQ0fsR.js → started-name-w6n9uDdt.js} +1 -2
  40. package/dist/{state-CJKAhskJ.d.ts → state-BDEDVlyr.d.ts} +1 -5
  41. package/dist/{state-BjWnxyhv.js → state-BZLy46UJ.js} +4 -6
  42. package/dist/{static-BgoOCoe5.js → static-Bg7Jj92L.js} +11 -18
  43. package/dist/{static-CcBWx1kU.d.ts → static-DeRvJqcQ.d.ts} +1 -5
  44. package/dist/{store-CZHZfttA.d.ts → store-CEv3cScg.d.ts} +2 -6
  45. package/dist/{time-zone-SBldrUgt.js → time-zone-pMp_g8Uu.js} +1 -2
  46. package/dist/{types-Cw5LjPuc.d.ts → types-DTVPVY5O.d.ts} +0 -2
  47. package/dist/vite.d.ts +3 -19
  48. package/dist/vite.js +1443 -918
  49. package/package.json +9 -9
package/dist/vite.js CHANGED
@@ -1,12 +1,12 @@
1
- import { r as __toESM } from "./rolldown-runtime-CMFfr-1z.js";
2
- import { t as isIanaTimeZone } from "./time-zone-SBldrUgt.js";
3
- import { n as isRecordOrFunction, t as isRecord$1 } from "./object-Da1zyPCR.js";
4
- import { t as scheduleErrorDiagnostics } from "./error-diagnostics-DTmP6baC.js";
5
- import { t as internalErrorDiagnostics } from "./error-diagnostics-C0KyI408.js";
6
- import { i as timeZoneOffsetMinutes, t as cronWithWeekdayNames } from "./due-n120-_nz.js";
7
- import { t as startedSchedulesTickName } from "./started-name-DudQ0fsR.js";
8
- import { a as relative$1, i as isAbsolute$1, n as relativeDefinitionFile, o as resolve$1, r as dirname$1 } from "./inspect-DTfAo5gS.js";
9
- import { a as parseCronFields, l as invariant, u as invariantError } from "./cron-C1l3TquN.js";
1
+ import { r as __toESM } from "./rolldown-runtime-DegdyBIC.js";
2
+ import { a as parseCronFields, l as invariant, u as invariantError } from "./cron-BT3ef48f.js";
3
+ import { a as relative$1, i as isAbsolute$1, n as relativeDefinitionFile, o as resolve$1, r as dirname$1 } from "./inspect-CW0qwt9p.js";
4
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
5
+ import { n as isRecordOrFunction, t as isRecord$1 } from "./object-CAK6UYR5.js";
6
+ import { t as scheduleErrorDiagnostics } from "./error-diagnostics-B1AaIGWP.js";
7
+ import { t as startedSchedulesTickName } from "./started-name-w6n9uDdt.js";
8
+ import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
9
+ import { i as timeZoneOffsetMinutes, t as cronWithWeekdayNames } from "./due-D-0trD1g.js";
10
10
  import { scheduleConsoleTiming } from "./runtime/console.js";
11
11
  import { builtinModules, createRequire, isBuiltin } from "node:module";
12
12
  import { formatDiagnostic } from "nostics";
@@ -19,7 +19,7 @@ import { access, chmod, copyFile, cp, lstat, mkdir, mkdtemp, readFile, readdir,
19
19
  import { createHash, randomUUID } from "node:crypto";
20
20
  import { isDeepStrictEqual } from "node:util";
21
21
  import { parseSync } from "vite";
22
- //#region ../internal/src/build/vite.ts
22
+ // ../internal/src/build/vite.ts
23
23
  async function prepareViteHubProviderSources(plugins, sources) {
24
24
  for (const plugin of plugins) await plugin.vitehub?.providerOutput?.prepareSources?.(sources);
25
25
  }
@@ -149,8 +149,7 @@ function isMissingProjectMarker(error) {
149
149
  const code = error.code;
150
150
  return code === "ENOENT" || code === "ENOTDIR";
151
151
  }
152
- //#endregion
153
- //#region ../internal/src/build/paths.ts
152
+ // ../internal/src/build/paths.ts
154
153
  function generatedDirSegments(productName) {
155
154
  return [".vitehub", productName];
156
155
  }
@@ -196,8 +195,7 @@ function realpathIfExists(path) {
196
195
  return resolve$1(path);
197
196
  }
198
197
  }
199
- //#endregion
200
- //#region ../internal/src/build/client-output.ts
198
+ // ../internal/src/build/client-output.ts
201
199
  function hasStaticIndex(clientDir) {
202
200
  return existsSync(resolve$1(clientDir, "index.html"));
203
201
  }
@@ -234,8 +232,7 @@ async function copyClientOutput(clientDir, targetDir, excludedDirs = []) {
234
232
  filter
235
233
  });
236
234
  }
237
- //#endregion
238
- //#region ../internal/src/build/provider-output-config.ts
235
+ // ../internal/src/build/provider-output-config.ts
239
236
  function isProviderJsonArray(value, ancestors) {
240
237
  if (Object.getPrototypeOf(value) !== Array.prototype || ancestors.has(value)) return false;
241
238
  if (Reflect.ownKeys(value).length !== value.length + 1) return false;
@@ -373,8 +370,7 @@ async function cleanProviderOutputConfig(file, ownership) {
373
370
  if (!changed) return;
374
371
  await persistProviderJsonRecord(file, next, true);
375
372
  }
376
- //#endregion
377
- //#region ../internal/src/build/user-entry.ts
373
+ // ../internal/src/build/user-entry.ts
378
374
  function toSafeAppName(rootDir) {
379
375
  return basename(rootDir).replace(/[^a-z0-9-]+/gi, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
380
376
  }
@@ -395,8 +391,7 @@ async function writeCloudflareWranglerConfig(options) {
395
391
  removeIfEmpty: true
396
392
  });
397
393
  }
398
- //#endregion
399
- //#region ../internal/src/build/bundle-options.ts
394
+ // ../internal/src/build/bundle-options.ts
400
395
  const encodedAliasPrefixMarker = "\0vitehub-prefix:";
401
396
  const encodedAliasExactMarker = "\0vitehub-exact:";
402
397
  function encodeProviderOutputAliases(configAliases) {
@@ -421,8 +416,7 @@ function resolveViteHubBundleDefines(config) {
421
416
  }
422
417
  return defines;
423
418
  }
424
- //#endregion
425
- //#region ../internal/src/build/ast-walk.ts
419
+ // ../internal/src/build/ast-walk.ts
426
420
  /** The oxc parser grammar for a file, from its extension. Defaults to TypeScript. */
427
421
  function moduleLanguage(file) {
428
422
  if (/\.(?:c|m)?tsx$/i.test(file)) return "tsx";
@@ -445,8 +439,7 @@ function walk(node, visit, parent) {
445
439
  } else if (isNode(child)) walk(child, visit, node);
446
440
  }
447
441
  }
448
- //#endregion
449
- //#region ../internal/src/build/rolldown.ts
442
+ // ../internal/src/build/rolldown.ts
450
443
  const viteRawPrefix = "\0vitehub-vite-raw:";
451
444
  const markdownTemplatePrefix = "\0vitehub-markdown-template:";
452
445
  const markdownTemplateFileSuffix = ".template.md";
@@ -1043,8 +1036,7 @@ async function bundleEsmEntry(entryFile, outfile, options = {}) {
1043
1036
  await writeFile(outfile, chunk.code, { signal: options.signal });
1044
1037
  options.signal?.throwIfAborted();
1045
1038
  }
1046
- //#endregion
1047
- //#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
1039
+ // ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
1048
1040
  const balanced = (a, b, str) => {
1049
1041
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
1050
1042
  const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
@@ -1091,8 +1083,7 @@ const range = (a, b, str) => {
1091
1083
  }
1092
1084
  return result;
1093
1085
  };
1094
- //#endregion
1095
- //#region ../../node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/esm/index.js
1086
+ // ../../node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/esm/index.js
1096
1087
  const escSlash = "\0SLASH" + Math.random() + "\0";
1097
1088
  const escOpen = "\0OPEN" + Math.random() + "\0";
1098
1089
  const escClose = "\0CLOSE" + Math.random() + "\0";
@@ -1292,39 +1283,94 @@ function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
1292
1283
  }
1293
1284
  return acc;
1294
1285
  }
1295
- //#endregion
1296
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/assert-valid-pattern.js
1297
- const MAX_PATTERN_LENGTH = 65536;
1298
- const assertValidPattern = (pattern) => {
1299
- if (typeof pattern !== "string") throw new TypeError("invalid pattern");
1300
- if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
1286
+ // ../../node_modules/.pnpm/@isaacs+nonrecursive-glob-match@1.1.0/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/numeric-range.js
1287
+ const digit = (a, b) => a === b ? {
1288
+ t: "lit",
1289
+ ch: String(a)
1290
+ } : {
1291
+ t: "class",
1292
+ re: new RegExp(`^[${a}-${b}]$`)
1293
+ };
1294
+ const prefix = (d, alts) => alts.map((s) => [digit(d, d), ...s]);
1295
+ const fixed = (a, b) => {
1296
+ if (!a) return [[]];
1297
+ let lo = +a[0];
1298
+ let hi = +b[0];
1299
+ const ra = a.slice(1);
1300
+ const rb = b.slice(1);
1301
+ if (lo === hi) return prefix(lo, fixed(ra, rb));
1302
+ const zeros = "0".repeat(ra.length);
1303
+ const nines = "9".repeat(ra.length);
1304
+ const out = [];
1305
+ if (ra !== zeros) out.push(...prefix(lo++, fixed(ra, nines)));
1306
+ const last = rb === nines ? [] : prefix(hi--, fixed(zeros, rb));
1307
+ if (lo <= hi) out.push([digit(lo, hi), ...Array.from(ra, () => digit(0, 9))]);
1308
+ out.push(...last);
1309
+ return out;
1310
+ };
1311
+ const nonneg = (a, b, width) => {
1312
+ if (width) return fixed(String(a).padStart(width, "0"), String(b).padStart(width, "0"));
1313
+ const out = [];
1314
+ for (let len = String(a).length; len <= String(b).length; len++) {
1315
+ const lo = Math.max(a, len === 1 ? 0 : 10 ** (len - 1));
1316
+ const hi = Math.min(b, 10 ** len - 1);
1317
+ out.push(...fixed(String(lo), String(hi)));
1318
+ }
1319
+ return out;
1301
1320
  };
1302
- //#endregion
1303
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/brace-expressions.js
1321
+ /**
1322
+ * The strings that the bash brace expansion `{lo..hi}` makes, as
1323
+ * the alternatives of an `@(...)` extglob. Each one is a sequence of
1324
+ * digits and digit classes, so there are only a few of them, even for
1325
+ * a large range.
1326
+ *
1327
+ * If either end has a leading zero, such as `{01..10}`, each number
1328
+ * has leading zeros to make it as long as the longer end, counting a
1329
+ * `-` sign. So `{-05..3}` makes `-05` to `-01`, then `000` to `003`.
1330
+ *
1331
+ * Returns undefined if either end is not a safe integer.
1332
+ */
1333
+ const numericRange = (loStr, hiStr) => {
1334
+ let lo = Number(loStr);
1335
+ let hi = Number(hiStr);
1336
+ if (!Number.isSafeInteger(lo) || !Number.isSafeInteger(hi)) return;
1337
+ if (lo > hi) [lo, hi] = [hi, lo];
1338
+ const width = /^-?0\d/.test(loStr) || /^-?0\d/.test(hiStr) ? Math.max(loStr.length, hiStr.length) : 0;
1339
+ const out = [];
1340
+ if (lo < 0) {
1341
+ const neg = nonneg(Math.max(-hi, 1), -lo, width && width - 1);
1342
+ out.push(...neg.map((s) => [{
1343
+ t: "lit",
1344
+ ch: "-"
1345
+ }, ...s]));
1346
+ }
1347
+ if (hi >= 0) out.push(...nonneg(Math.max(lo, 0), hi, width));
1348
+ return out;
1349
+ };
1350
+ // ../../node_modules/.pnpm/@isaacs+nonrecursive-glob-match@1.1.0/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js
1304
1351
  const posixClasses = {
1305
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
1306
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
1307
- "[:ascii:]": ["\\x00-\\x7f", false],
1308
- "[:blank:]": ["\\p{Zs}\\t", true],
1309
- "[:cntrl:]": ["\\p{Cc}", true],
1310
- "[:digit:]": ["\\p{Nd}", true],
1311
- "[:graph:]": [
1312
- "\\p{Z}\\p{C}",
1313
- true,
1314
- true
1315
- ],
1316
- "[:lower:]": ["\\p{Ll}", true],
1352
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
1353
+ "[:alpha:]": ["\\p{L}\\p{Nl}"],
1354
+ "[:ascii:]": ["\\x00-\\x7f"],
1355
+ "[:blank:]": ["\\p{Zs}\\t"],
1356
+ "[:cntrl:]": ["\\p{Cc}"],
1357
+ "[:digit:]": ["\\p{Nd}"],
1358
+ "[:graph:]": ["\\p{Z}\\p{C}", true],
1359
+ "[:lower:]": ["\\p{Ll}"],
1317
1360
  "[:print:]": ["\\p{C}", true],
1318
- "[:punct:]": ["\\p{P}", true],
1319
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
1320
- "[:upper:]": ["\\p{Lu}", true],
1321
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
1322
- "[:xdigit:]": ["A-Fa-f0-9", false]
1361
+ "[:punct:]": ["\\p{P}\\p{S}"],
1362
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"],
1363
+ "[:upper:]": ["\\p{Lu}"],
1364
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
1365
+ "[:xdigit:]": ["A-Fa-f0-9"]
1323
1366
  };
1324
1367
  const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
1325
- const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1326
- const rangesToString = (ranges) => ranges.join("");
1327
- const parseClass = (glob, position) => {
1368
+ const noMatch = /$./;
1369
+ const parseClass = (glob, position, nocase = false, form) => {
1370
+ const norm = (c) => {
1371
+ const n = form ? c.normalize(form) : c;
1372
+ return [...n].length === 1 ? n : c;
1373
+ };
1328
1374
  const pos = position;
1329
1375
  /* c8 ignore start */
1330
1376
  if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
@@ -1333,13 +1379,12 @@ const parseClass = (glob, position) => {
1333
1379
  const negs = [];
1334
1380
  let i = pos + 1;
1335
1381
  let sawStart = false;
1336
- let uflag = false;
1337
1382
  let escaping = false;
1338
1383
  let negate = false;
1339
1384
  let endPos = pos;
1340
1385
  let rangeStart = "";
1341
1386
  WHILE: while (i < glob.length) {
1342
- const c = glob.charAt(i);
1387
+ const c = String.fromCodePoint(glob.codePointAt(i));
1343
1388
  if ((c === "!" || c === "^") && i === pos + 1) {
1344
1389
  negate = true;
1345
1390
  i++;
@@ -1358,607 +1403,659 @@ const parseClass = (glob, position) => {
1358
1403
  }
1359
1404
  }
1360
1405
  if (c === "[" && !escaping) {
1361
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
1362
- if (rangeStart) return [
1363
- "$.",
1364
- false,
1365
- glob.length - pos,
1366
- true
1367
- ];
1406
+ for (const [cls, [unip, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
1407
+ if (rangeStart) return [noMatch, glob.length - pos];
1368
1408
  i += cls.length;
1369
1409
  if (neg) negs.push(unip);
1370
1410
  else ranges.push(unip);
1371
- uflag = uflag || u;
1372
1411
  continue WHILE;
1373
1412
  }
1374
1413
  }
1375
1414
  escaping = false;
1415
+ const n = norm(c);
1376
1416
  if (rangeStart) {
1377
- if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
1378
- else if (c === rangeStart) ranges.push(braceEscape(c));
1417
+ if (n.codePointAt(0) > rangeStart.codePointAt(0)) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(n));
1418
+ else if (n === rangeStart) ranges.push(braceEscape(n));
1379
1419
  rangeStart = "";
1380
- i++;
1420
+ i += c.length;
1381
1421
  continue;
1382
1422
  }
1383
- if (glob.startsWith("-]", i + 1)) {
1384
- ranges.push(braceEscape(c + "-"));
1385
- i += 2;
1423
+ if (glob.startsWith("-]", i + c.length)) {
1424
+ ranges.push(braceEscape(n + "-"));
1425
+ i += c.length + 1;
1386
1426
  continue;
1387
1427
  }
1388
- if (glob.startsWith("-", i + 1)) {
1389
- rangeStart = c;
1390
- i += 2;
1428
+ if (glob.startsWith("-", i + c.length)) {
1429
+ rangeStart = n;
1430
+ i += c.length + 1;
1391
1431
  continue;
1392
1432
  }
1393
- ranges.push(braceEscape(c));
1394
- i++;
1433
+ ranges.push(braceEscape(n));
1434
+ i += c.length;
1395
1435
  }
1396
- if (endPos < i) return [
1397
- "",
1398
- false,
1399
- 0,
1400
- false
1401
- ];
1402
- if (!ranges.length && !negs.length) return [
1403
- "$.",
1404
- false,
1405
- glob.length - pos,
1406
- true
1407
- ];
1408
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
1409
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
1410
- return [
1411
- regexpEscape(r),
1412
- false,
1413
- endPos - pos,
1414
- false
1415
- ];
1436
+ if (endPos < i) return [noMatch, 0];
1437
+ if (!ranges.length && !negs.length) return [noMatch, glob.length - pos];
1438
+ const sranges = "[" + (negate ? "^" : "") + ranges.join("") + "]";
1439
+ const snegs = "[" + (negate ? "" : "^") + negs.join("") + "]";
1440
+ const comb = "^" + (ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs);
1441
+ return [new RegExp(comb, nocase ? "iu" : "u"), endPos - pos];
1442
+ };
1443
+ // ../../node_modules/.pnpm/@isaacs+nonrecursive-glob-match@1.1.0/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js
1444
+ const MATCH = {
1445
+ t: "match",
1446
+ id: 0
1447
+ };
1448
+ const extTypes = "!?+*@";
1449
+ const lit = (ch) => ({
1450
+ t: "lit",
1451
+ ch
1452
+ });
1453
+ const reEscape = (s) => s.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
1454
+ const newFoldRe = (s) => new RegExp(`^${reEscape(s)}$`, "iu");
1455
+ const foldCache = /* @__PURE__ */ new Map();
1456
+ const foldRe = (ch) => {
1457
+ let re = foldCache.get(ch);
1458
+ if (!re) {
1459
+ re = newFoldRe(ch);
1460
+ if (foldCache.size >= 1e3) foldCache.clear();
1461
+ foldCache.set(ch, re);
1462
+ }
1463
+ return re;
1464
+ };
1465
+ const litMatch = (l, c) => {
1466
+ if (c === l.ch) return true;
1467
+ if (!l.re) return false;
1468
+ const code = c.charCodeAt(0);
1469
+ if (code >= 128) return l.re.test(c);
1470
+ const ascii = l.ascii ??= /* @__PURE__ */ new Uint8Array(128);
1471
+ ascii[code] ||= l.re.test(c) ? 1 : 2;
1472
+ return ascii[code] === 1;
1473
+ };
1474
+ const tokenize = (p, nocase, noext, form, mark) => {
1475
+ const toks = [];
1476
+ for (let i = 0; i < p.length;) {
1477
+ const c = String.fromCodePoint(p.codePointAt(i));
1478
+ if (mark) {
1479
+ const m = c === "\\" && p.startsWith(mark, i + 1) ? 1 : 0;
1480
+ if (m || c === mark) {
1481
+ const start = i + m + mark.length;
1482
+ const end = p.indexOf(mark, start);
1483
+ const r = /^(-?\d+)\.\.(-?\d+)$/.exec(p.slice(start, end));
1484
+ const alts = end !== -1 && r && numericRange(r[1], r[2]);
1485
+ if (alts) {
1486
+ toks.push({
1487
+ t: "ext",
1488
+ type: "@",
1489
+ alts
1490
+ });
1491
+ i = end + mark.length;
1492
+ continue;
1493
+ }
1494
+ }
1495
+ }
1496
+ if (c === "\\") {
1497
+ const e = p.codePointAt(i + 1);
1498
+ const ch = e === void 0 ? c : String.fromCodePoint(e);
1499
+ toks.push(lit(ch));
1500
+ i += 1 + ch.length;
1501
+ continue;
1502
+ }
1503
+ if (c === "[") {
1504
+ const [re, consumed] = parseClass(p, i, nocase, form);
1505
+ if (consumed) {
1506
+ toks.push({
1507
+ t: "class",
1508
+ re
1509
+ });
1510
+ i += consumed;
1511
+ continue;
1512
+ }
1513
+ }
1514
+ if (!noext && extTypes.includes(c) && p[i + 1] === "(") {
1515
+ toks.push({
1516
+ t: "open",
1517
+ type: c
1518
+ });
1519
+ i += 2;
1520
+ continue;
1521
+ }
1522
+ toks.push(!noext && c === "|" ? { t: "bar" } : !noext && c === ")" ? { t: "close" } : c === "*" ? { t: "star" } : c === "?" ? { t: "any" } : lit(c));
1523
+ i += c.length;
1416
1524
  }
1417
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
1418
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
1419
- return [
1420
- ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
1421
- uflag,
1422
- endPos - pos,
1423
- true
1424
- ];
1525
+ return toks;
1425
1526
  };
1426
- //#endregion
1427
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/unescape.js
1428
- /**
1429
- * Un-escape a string that has been escaped with {@link escape}.
1430
- *
1431
- * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
1432
- * square-bracket escapes are removed, but not backslash escapes.
1433
- *
1434
- * For example, it will turn the string `'[*]'` into `*`, but it will not
1435
- * turn `'\\*'` into `'*'`, because `\` is a path separator in
1436
- * `windowsPathsNoEscape` mode.
1437
- *
1438
- * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
1439
- * backslash escapes are removed.
1440
- *
1441
- * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
1442
- * or unescaped.
1443
- *
1444
- * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
1445
- * unescaped.
1446
- */
1447
- const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
1448
- if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
1449
- return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
1527
+ const pair = (toks) => {
1528
+ const pairs = /* @__PURE__ */ new Map();
1529
+ const stack = [];
1530
+ toks.forEach((tok, i) => {
1531
+ if (tok.t === "open") stack.push(i);
1532
+ else if (tok.t === "close" && stack.length) pairs.set(stack.pop(), i);
1533
+ });
1534
+ return pairs;
1450
1535
  };
1451
- //#endregion
1452
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js
1453
- var _a;
1454
- const types = /* @__PURE__ */ new Set([
1455
- "!",
1456
- "?",
1457
- "+",
1458
- "*",
1459
- "@"
1460
- ]);
1461
- const isExtglobType = (c) => types.has(c);
1462
- const isExtglobAST = (c) => isExtglobType(c.type);
1463
- const adoptionMap = /* @__PURE__ */ new Map([
1464
- ["!", ["@"]],
1465
- ["?", ["?", "@"]],
1466
- ["@", ["@"]],
1467
- ["*", [
1468
- "*",
1469
- "+",
1470
- "?",
1471
- "@"
1472
- ]],
1473
- ["+", ["+", "@"]]
1474
- ]);
1475
- const adoptionWithSpaceMap = /* @__PURE__ */ new Map([
1476
- ["!", ["?"]],
1477
- ["@", ["?"]],
1478
- ["+", ["?", "*"]]
1479
- ]);
1480
- const adoptionAnyMap = /* @__PURE__ */ new Map([
1481
- ["!", ["?", "@"]],
1482
- ["?", ["?", "@"]],
1483
- ["@", ["?", "@"]],
1484
- ["*", [
1485
- "*",
1486
- "+",
1487
- "?",
1488
- "@"
1489
- ]],
1490
- ["+", [
1491
- "+",
1492
- "@",
1493
- "?",
1494
- "*"
1495
- ]]
1496
- ]);
1497
- const usurpMap = /* @__PURE__ */ new Map([
1498
- ["!", /* @__PURE__ */ new Map([["!", "@"]])],
1499
- ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
1500
- ["@", /* @__PURE__ */ new Map([
1501
- ["!", "!"],
1502
- ["?", "?"],
1503
- ["@", "@"],
1504
- ["*", "*"],
1505
- ["+", "+"]
1506
- ])],
1507
- ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
1508
- ]);
1509
- const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
1510
- const startNoDot = "(?!\\.)";
1511
- const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
1512
- const justDots = /* @__PURE__ */ new Set(["..", "."]);
1513
- const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
1514
- const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1515
- const qmark = "[^/]";
1516
- const star$1 = "[^/]*?";
1517
- const starNoEmpty = "[^/]+?";
1518
- let ID = 0;
1519
- var AST = class {
1520
- type;
1521
- #root;
1522
- #hasMagic;
1523
- #uflag = false;
1524
- #parts = [];
1525
- #parent;
1526
- #parentIndex;
1527
- #negs;
1528
- #filledNegs = false;
1529
- #options;
1530
- #toString;
1531
- #emptyExt = false;
1532
- id = ++ID;
1533
- get depth() {
1534
- return (this.#parent?.depth ?? -1) + 1;
1535
- }
1536
- [Symbol.for("nodejs.util.inspect.custom")]() {
1537
- return {
1538
- "@@type": "AST",
1539
- id: this.id,
1540
- type: this.type,
1541
- root: this.#root.id,
1542
- parent: this.#parent?.id,
1543
- depth: this.depth,
1544
- partsLength: this.#parts.length,
1545
- parts: this.#parts
1546
- };
1536
+ const build = (toks, pairs, start, end, top) => {
1537
+ let seq = [];
1538
+ const alts = [seq];
1539
+ for (let i = start; i < end; i++) {
1540
+ const tok = toks[i];
1541
+ const close = pairs.get(i);
1542
+ if (tok.t === "open" && close !== void 0) {
1543
+ const sub = build(toks, pairs, i + 1, close, false);
1544
+ seq.push({
1545
+ t: "ext",
1546
+ type: tok.type,
1547
+ alts: sub
1548
+ });
1549
+ i = close;
1550
+ } else if (tok.t === "bar" && !top) alts.push(seq = []);
1551
+ else if (tok.t === "open") seq.push(lit(tok.type), lit("("));
1552
+ else if (tok.t === "bar") seq.push(lit("|"));
1553
+ else if (tok.t === "close") seq.push(lit(")"));
1554
+ else seq.push(tok);
1555
+ }
1556
+ return alts;
1557
+ };
1558
+ const normalize$1 = (items, form) => {
1559
+ const out = [];
1560
+ let run = "";
1561
+ const flush = () => {
1562
+ for (const ch of run.normalize(form)) out.push(lit(ch));
1563
+ run = "";
1564
+ };
1565
+ for (const it of items) {
1566
+ if (it.t === "lit") {
1567
+ run += it.ch;
1568
+ continue;
1569
+ }
1570
+ flush();
1571
+ out.push(it.t === "ext" ? {
1572
+ ...it,
1573
+ alts: it.alts.map((a) => normalize$1(a, form))
1574
+ } : it);
1547
1575
  }
1548
- constructor(type, parent, options = {}) {
1549
- this.type = type;
1550
- if (type) this.#hasMagic = true;
1551
- this.#parent = parent;
1552
- this.#root = this.#parent ? this.#parent.#root : this;
1553
- this.#options = this.#root === this ? options : this.#root.#options;
1554
- this.#negs = this.#root === this ? [] : this.#root.#negs;
1555
- if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
1556
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
1557
- }
1558
- get hasMagic() {
1559
- /* c8 ignore start */
1560
- if (this.#hasMagic !== void 0) return this.#hasMagic;
1561
- /* c8 ignore stop */
1562
- for (const p of this.#parts) {
1563
- if (typeof p === "string") continue;
1564
- if (p.type || p.hasMagic) return this.#hasMagic = true;
1576
+ flush();
1577
+ return out;
1578
+ };
1579
+ const compile = (items, nocase) => {
1580
+ let id = 1;
1581
+ const split = (out) => ({
1582
+ t: "split",
1583
+ id: id++,
1584
+ out
1585
+ });
1586
+ const seq = (items, next) => items.reduceRight((next, it) => item(it, next), next);
1587
+ const item = (it, next) => {
1588
+ switch (it.t) {
1589
+ case "lit":
1590
+ const re = nocase ? foldRe(it.ch) : void 0;
1591
+ return {
1592
+ t: "lit",
1593
+ id: id++,
1594
+ ch: it.ch,
1595
+ re,
1596
+ next
1597
+ };
1598
+ case "any":
1599
+ case "star": return {
1600
+ t: it.t,
1601
+ id: id++,
1602
+ next
1603
+ };
1604
+ case "class": return {
1605
+ t: "class",
1606
+ id: id++,
1607
+ re: it.re,
1608
+ next
1609
+ };
1610
+ }
1611
+ const alts = (next) => it.alts.map((a) => seq(a, next));
1612
+ switch (it.type) {
1613
+ case "@": return split(alts(next));
1614
+ case "?": return split([next, ...alts(next)]);
1615
+ case "!": return {
1616
+ t: "neg",
1617
+ id: id++,
1618
+ sub: split(alts(MATCH)),
1619
+ next
1620
+ };
1565
1621
  }
1566
- return this.#hasMagic;
1622
+ const after = split([]);
1623
+ const entry = split(alts(after));
1624
+ after.out.push(next, entry);
1625
+ return it.type === "*" ? after : entry;
1626
+ };
1627
+ return [seq(items, MATCH), id];
1628
+ };
1629
+ const show = (start) => {
1630
+ const lines = [];
1631
+ const seen = /* @__PURE__ */ new Set();
1632
+ const ref = (n) => n.t === "match" ? "match" : String(n.id);
1633
+ const walk = (n, indent) => {
1634
+ if (n.t === "match" || seen.has(n)) return;
1635
+ seen.add(n);
1636
+ const line = (desc) => lines.push(`${indent}${n.id}: ${desc}`);
1637
+ switch (n.t) {
1638
+ case "split":
1639
+ line(`split -> ${n.out.map(ref).join(", ")}`);
1640
+ for (const o of n.out) walk(o, indent);
1641
+ return;
1642
+ case "neg":
1643
+ line(`!(${ref(n.sub)}) -> ${ref(n.next)}`);
1644
+ walk(n.sub, indent + " ");
1645
+ return walk(n.next, indent);
1646
+ case "lit":
1647
+ line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`);
1648
+ break;
1649
+ case "class":
1650
+ line(`${n.re} -> ${ref(n.next)}`);
1651
+ break;
1652
+ default: line(`${n.t === "any" ? "?" : "*"} -> ${ref(n.next)}`);
1653
+ }
1654
+ walk(n.next, indent);
1655
+ };
1656
+ walk(start, "");
1657
+ return [`start -> ${ref(start)}`, ...lines].join("\n");
1658
+ };
1659
+ var State = class {
1660
+ gen;
1661
+ threads = [];
1662
+ match = false;
1663
+ runs = [];
1664
+ ids = [];
1665
+ constructor(gen) {
1666
+ this.gen = gen;
1667
+ }
1668
+ get dead() {
1669
+ return !this.threads.length && !this.match && !this.runs.length;
1567
1670
  }
1568
- toString() {
1569
- return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
1671
+ };
1672
+ const sameState = (a, b) => {
1673
+ if (a.ids.length !== b.ids.length) return false;
1674
+ if (a.runs.length !== b.runs.length) return false;
1675
+ if (a.ids.some((id, i) => id !== b.ids[i])) return false;
1676
+ return a.runs.every((r) => b.runs.some((o) => o.neg === r.neg && sameState(o.state, r.state)));
1677
+ };
1678
+ const marks = (size) => ({
1679
+ has: new Float64Array(size),
1680
+ seen: new Float64Array(size),
1681
+ gen: 0
1682
+ });
1683
+ var Sim = class {
1684
+ dots;
1685
+ dotStart;
1686
+ #marks;
1687
+ constructor(dots, dotStart, marks) {
1688
+ this.dots = dots;
1689
+ this.dotStart = dotStart;
1690
+ this.#marks = marks;
1691
+ }
1692
+ state() {
1693
+ return new State(++this.#marks.gen);
1694
+ }
1695
+ done(state) {
1696
+ state.ids = state.threads.map((n) => n.id).sort((a, b) => a - b);
1697
+ if (state.match) state.ids.unshift(MATCH.id);
1698
+ return state;
1699
+ }
1700
+ #visit(state, node) {
1701
+ const { seen } = this.#marks;
1702
+ if (seen[node.id] === state.gen) return false;
1703
+ seen[node.id] = state.gen;
1704
+ return true;
1570
1705
  }
1571
- #fillNegs() {
1572
- /* c8 ignore start */
1573
- if (this !== this.#root) throw new Error("should only call on root");
1574
- if (this.#filledNegs) return this;
1575
- /* c8 ignore stop */
1576
- this.toString();
1577
- this.#filledNegs = true;
1578
- let n;
1579
- while (n = this.#negs.pop()) {
1580
- if (n.type !== "!") continue;
1581
- let p = n;
1582
- let pp = p.#parent;
1583
- while (pp) {
1584
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
1585
- /* c8 ignore start */
1586
- if (typeof part === "string") throw new Error("string part in extglob AST??");
1587
- /* c8 ignore stop */
1588
- part.copyIn(pp.#parts[i]);
1589
- }
1590
- p = pp;
1591
- pp = p.#parent;
1592
- }
1593
- }
1594
- return this;
1706
+ #addThread(state, node) {
1707
+ const { has } = this.#marks;
1708
+ if (has[node.id] === state.gen) return false;
1709
+ has[node.id] = state.gen;
1710
+ state.threads.push(node);
1711
+ return true;
1595
1712
  }
1596
- push(...parts) {
1597
- for (const p of parts) {
1598
- if (p === "") continue;
1599
- /* c8 ignore start */
1600
- if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
1601
- /* c8 ignore stop */
1602
- this.#parts.push(p);
1713
+ restricted(i, top) {
1714
+ return top && (this.dots || this.dotStart && i === 0);
1715
+ }
1716
+ add(state, node, i, top) {
1717
+ switch (node.t) {
1718
+ case "split":
1719
+ if (!this.#visit(state, node)) return;
1720
+ for (const o of node.out) this.add(state, o, i, top);
1721
+ return;
1722
+ case "neg":
1723
+ if (!this.#visit(state, node)) return;
1724
+ const sub = this.state();
1725
+ this.add(sub, node.sub, i, false);
1726
+ this.done(sub);
1727
+ return this.addRun(state, {
1728
+ t: "run",
1729
+ neg: node,
1730
+ state: sub
1731
+ }, i, top);
1732
+ case "star":
1733
+ if (this.restricted(i, top)) return;
1734
+ if (this.#addThread(state, node)) this.add(state, node.next, i, top);
1735
+ return;
1736
+ case "match":
1737
+ state.match = true;
1738
+ return;
1739
+ default: this.#addThread(state, node);
1603
1740
  }
1604
1741
  }
1605
- toJSON() {
1606
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
1607
- if (this.isStart() && !this.type) ret.unshift([]);
1608
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({});
1609
- return ret;
1742
+ addRun(state, run, i, top) {
1743
+ for (const r of state.runs) if (r.neg === run.neg && sameState(r.state, run.state)) return;
1744
+ state.runs.push(run);
1745
+ if (!run.state.match) this.add(state, run.neg.next, i, top);
1610
1746
  }
1611
- isStart() {
1612
- if (this.#root === this) return true;
1613
- if (!this.#parent?.isStart()) return false;
1614
- if (this.#parentIndex === 0) return true;
1615
- const p = this.#parent;
1616
- for (let i = 0; i < this.#parentIndex; i++) {
1617
- const pp = p.#parts[i];
1618
- if (!(pp instanceof _a && pp.type === "!")) return false;
1747
+ step(state, c, i, top) {
1748
+ const next = this.state();
1749
+ for (const th of state.threads) switch (th.t) {
1750
+ case "lit":
1751
+ if (litMatch(th, c)) this.add(next, th.next, i + 1, top);
1752
+ break;
1753
+ case "any":
1754
+ if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top);
1755
+ break;
1756
+ case "class":
1757
+ if (!this.restricted(i, top) && th.re.test(c)) this.add(next, th.next, i + 1, top);
1758
+ break;
1759
+ case "star": if (!this.restricted(i, top)) this.add(next, th, i + 1, top);
1619
1760
  }
1620
- return true;
1621
- }
1622
- isEnd() {
1623
- if (this.#root === this) return true;
1624
- if (this.#parent?.type === "!") return true;
1625
- if (!this.#parent?.isEnd()) return false;
1626
- if (!this.type) return this.#parent?.isEnd();
1627
- /* c8 ignore start */
1628
- const pl = this.#parent ? this.#parent.#parts.length : 0;
1629
- /* c8 ignore stop */
1630
- return this.#parentIndex === pl - 1;
1631
- }
1632
- copyIn(part) {
1633
- if (typeof part === "string") this.push(part);
1634
- else this.push(part.clone(this));
1635
- }
1636
- clone(parent) {
1637
- const c = new _a(this.type, parent);
1638
- for (const p of this.#parts) c.copyIn(p);
1639
- return c;
1640
- }
1641
- static #parseAST(str, ast, pos, opt, extDepth) {
1642
- const maxDepth = opt.maxExtglobRecursion ?? 2;
1643
- let escaping = false;
1644
- let inBrace = false;
1645
- let braceStart = -1;
1646
- let braceNeg = false;
1647
- if (ast.type === null) {
1648
- let i = pos;
1649
- let acc = "";
1650
- while (i < str.length) {
1651
- const c = str.charAt(i++);
1652
- if (escaping || c === "\\") {
1653
- escaping = !escaping;
1654
- acc += c;
1655
- continue;
1656
- }
1657
- if (inBrace) {
1658
- if (i === braceStart + 1) {
1659
- if (c === "^" || c === "!") braceNeg = true;
1660
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
1661
- acc += c;
1662
- continue;
1663
- } else if (c === "[") {
1664
- inBrace = true;
1665
- braceStart = i;
1666
- braceNeg = false;
1667
- acc += c;
1668
- continue;
1669
- }
1670
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
1671
- ast.push(acc);
1672
- acc = "";
1673
- const ext = new _a(c, ast);
1674
- i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
1675
- ast.push(ext);
1676
- continue;
1677
- }
1678
- acc += c;
1679
- }
1680
- ast.push(acc);
1681
- return i;
1682
- }
1683
- let i = pos + 1;
1684
- let part = new _a(null, ast);
1685
- const parts = [];
1686
- let acc = "";
1687
- while (i < str.length) {
1688
- const c = str.charAt(i++);
1689
- if (escaping || c === "\\") {
1690
- escaping = !escaping;
1691
- acc += c;
1761
+ if (!this.restricted(i, top)) for (const run of state.runs) {
1762
+ if (run.state.dead) {
1763
+ this.addRun(next, run, i + 1, top);
1692
1764
  continue;
1693
1765
  }
1694
- if (inBrace) {
1695
- if (i === braceStart + 1) {
1696
- if (c === "^" || c === "!") braceNeg = true;
1697
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
1698
- acc += c;
1699
- continue;
1700
- } else if (c === "[") {
1701
- inBrace = true;
1702
- braceStart = i;
1703
- braceNeg = false;
1704
- acc += c;
1705
- continue;
1706
- }
1707
- /* c8 ignore stop */
1708
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
1709
- const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
1710
- part.push(acc);
1711
- acc = "";
1712
- const ext = new _a(c, part);
1713
- part.push(ext);
1714
- i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
1715
- continue;
1716
- }
1717
- if (c === "|") {
1718
- part.push(acc);
1719
- acc = "";
1720
- parts.push(part);
1721
- part = new _a(null, ast);
1722
- continue;
1723
- }
1724
- if (c === ")") {
1725
- if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
1726
- part.push(acc);
1727
- acc = "";
1728
- ast.push(...parts, part);
1729
- return i;
1730
- }
1731
- acc += c;
1732
- }
1733
- ast.type = null;
1734
- ast.#hasMagic = void 0;
1735
- ast.#parts = [str.substring(pos - 1)];
1736
- return i;
1737
- }
1738
- #canAdoptWithSpace(child) {
1739
- return this.#canAdopt(child, adoptionWithSpaceMap);
1740
- }
1741
- #canAdopt(child, map = adoptionMap) {
1742
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
1743
- const gc = child.#parts[0];
1744
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
1745
- return this.#canAdoptType(gc.type, map);
1746
- }
1747
- #canAdoptType(c, map = adoptionAnyMap) {
1748
- return !!map.get(this.type)?.includes(c);
1749
- }
1750
- #adoptWithSpace(child, index) {
1751
- const gc = child.#parts[0];
1752
- const blank = new _a(null, gc, this.options);
1753
- blank.#parts.push("");
1754
- gc.push(blank);
1755
- this.#adopt(child, index);
1756
- }
1757
- #adopt(child, index) {
1758
- const gc = child.#parts[0];
1759
- this.#parts.splice(index, 1, ...gc.#parts);
1760
- for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
1761
- this.#toString = void 0;
1762
- }
1763
- #canUsurpType(c) {
1764
- return !!usurpMap.get(this.type)?.has(c);
1765
- }
1766
- #canUsurp(child) {
1767
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
1768
- const gc = child.#parts[0];
1769
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
1770
- return this.#canUsurpType(gc.type);
1771
- }
1772
- #usurp(child) {
1773
- const m = usurpMap.get(this.type);
1774
- const gc = child.#parts[0];
1775
- const nt = m?.get(gc.type);
1776
- /* c8 ignore start - impossible */
1777
- if (!nt) return false;
1778
- /* c8 ignore stop */
1779
- this.#parts = gc.#parts;
1780
- for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
1781
- this.type = nt;
1782
- this.#toString = void 0;
1783
- this.#emptyExt = false;
1784
- }
1785
- static fromGlob(pattern, options = {}) {
1786
- const ast = new _a(null, void 0, options);
1787
- _a.#parseAST(pattern, ast, 0, options, 0);
1788
- return ast;
1789
- }
1790
- toMMPattern() {
1791
- /* c8 ignore start */
1792
- if (this !== this.#root) return this.#root.toMMPattern();
1793
- /* c8 ignore stop */
1794
- const glob = this.toString();
1795
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
1796
- if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
1797
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
1798
- return Object.assign(new RegExp(`^${re}$`, flags), {
1799
- _src: re,
1800
- _glob: glob
1801
- });
1766
+ const sub = this.step(run.state, c, i, false);
1767
+ this.addRun(next, {
1768
+ t: "run",
1769
+ neg: run.neg,
1770
+ state: sub
1771
+ }, i + 1, top);
1772
+ }
1773
+ return this.done(next);
1802
1774
  }
1803
- get options() {
1804
- return this.#options;
1805
- }
1806
- toRegExpSource(allowDot) {
1807
- const dot = allowDot ?? !!this.#options.dot;
1808
- if (this.#root === this) {
1809
- this.#flatten();
1810
- this.#fillNegs();
1811
- }
1812
- if (!isExtglobAST(this)) {
1813
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
1814
- const src = this.#parts.map((p) => {
1815
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
1816
- this.#hasMagic = this.#hasMagic || hasMagic;
1817
- this.#uflag = this.#uflag || uflag;
1818
- return re;
1819
- }).join("");
1820
- let start = "";
1821
- if (this.isStart()) {
1822
- if (typeof this.#parts[0] === "string") {
1823
- if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
1824
- const aps = addPatternStart;
1825
- const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
1826
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
1827
- start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
1828
- }
1829
- }
1775
+ };
1776
+ const stateKey = (state) => {
1777
+ const ids = state.ids.join();
1778
+ if (!state.runs.length) return ids;
1779
+ return `${ids}|${state.runs.map((r) => `${r.neg.id}(${stateKey(r.state)})`).sort().join("|")}`;
1780
+ };
1781
+ const DFA_BUDGET = 1 << 18;
1782
+ var Dfa = class {
1783
+ #start;
1784
+ #states = /* @__PURE__ */ new Map();
1785
+ #size = 0;
1786
+ #plain;
1787
+ #dotStart;
1788
+ #sim;
1789
+ #dotSim;
1790
+ constructor(start, marks) {
1791
+ this.#start = start;
1792
+ this.#sim = new Sim(false, false, marks);
1793
+ this.#dotSim = new Sim(false, true, marks);
1794
+ }
1795
+ #make(state) {
1796
+ return {
1797
+ state,
1798
+ match: state.match,
1799
+ dead: state.dead,
1800
+ next: /* @__PURE__ */ new Map()
1801
+ };
1802
+ }
1803
+ #intern(state) {
1804
+ const key = stateKey(state);
1805
+ const found = this.#states.get(key);
1806
+ if (found) return found;
1807
+ if (this.#size > DFA_BUDGET) this.#clear();
1808
+ const d = this.#make(state);
1809
+ this.#states.set(key, d);
1810
+ this.#size += key.length + 1;
1811
+ return d;
1812
+ }
1813
+ #clear() {
1814
+ this.#states.clear();
1815
+ this.#size = 0;
1816
+ this.#plain = void 0;
1817
+ this.#dotStart = void 0;
1818
+ }
1819
+ start(dotStart) {
1820
+ if (dotStart) {
1821
+ if (this.#dotStart) return this.#dotStart;
1822
+ const state = this.#dotSim.state();
1823
+ this.#dotSim.add(state, this.#start, 0, true);
1824
+ return this.#dotStart = this.#make(this.#dotSim.done(state));
1825
+ }
1826
+ if (this.#plain) return this.#plain;
1827
+ const state = this.#sim.state();
1828
+ this.#sim.add(state, this.#start, 0, true);
1829
+ return this.#plain = this.#intern(this.#sim.done(state));
1830
+ }
1831
+ next(d, c) {
1832
+ const code = c.charCodeAt(0);
1833
+ const found = code < 128 ? void 0 : d.next.get(c);
1834
+ if (found) return found;
1835
+ const n = d === this.#dotStart ? this.#intern(this.#dotSim.step(d.state, c, 0, true)) : this.#intern(this.#sim.step(d.state, c, 1, true));
1836
+ if (code < 128) {
1837
+ if (!d.ascii) {
1838
+ d.ascii = new Array(128);
1839
+ this.#size += 128;
1830
1840
  }
1831
- let end = "";
1832
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
1833
- return [
1834
- start + src + end,
1835
- unescape(src),
1836
- this.#hasMagic = !!this.#hasMagic,
1837
- this.#uflag
1838
- ];
1839
- }
1840
- const repeated = this.type === "*" || this.type === "+";
1841
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
1842
- let body = this.#partsToRegExp(dot);
1843
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
1844
- const s = this.toString();
1845
- const me = this;
1846
- me.#parts = [s];
1847
- me.type = null;
1848
- me.#hasMagic = void 0;
1849
- return [
1850
- s,
1851
- unescape(this.toString()),
1852
- false,
1853
- false
1854
- ];
1855
- }
1856
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
1857
- if (bodyDotAllowed === body) bodyDotAllowed = "";
1858
- if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
1859
- let final = "";
1860
- if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
1861
- else {
1862
- const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + "[^/]*?)" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
1863
- final = start + body + close;
1864
- }
1865
- return [
1866
- final,
1867
- unescape(body),
1868
- this.#hasMagic = !!this.#hasMagic,
1869
- this.#uflag
1870
- ];
1841
+ d.ascii[code] = n;
1842
+ } else d.next.set(c, n);
1843
+ this.#size++;
1844
+ return n;
1871
1845
  }
1872
- #flatten() {
1873
- if (!isExtglobAST(this)) {
1874
- for (const p of this.#parts) if (typeof p === "object") p.#flatten();
1875
- } else {
1876
- let iterations = 0;
1877
- let done = false;
1878
- do {
1879
- done = true;
1880
- for (let i = 0; i < this.#parts.length; i++) {
1881
- const c = this.#parts[i];
1882
- if (typeof c === "object") {
1883
- c.#flatten();
1884
- if (this.#canAdopt(c)) {
1885
- done = false;
1886
- this.#adopt(c, i);
1887
- } else if (this.#canAdoptWithSpace(c)) {
1888
- done = false;
1889
- this.#adoptWithSpace(c, i);
1890
- } else if (this.#canUsurp(c)) {
1891
- done = false;
1892
- this.#usurp(c);
1893
- }
1894
- }
1895
- }
1896
- } while (!done && ++iterations < 10);
1846
+ };
1847
+ const linear = (start) => {
1848
+ const nodes = [];
1849
+ for (let n = start; n.t !== "match"; n = n.next) {
1850
+ if (n.t === "split" || n.t === "neg") return void 0;
1851
+ nodes.push(n);
1852
+ }
1853
+ return nodes;
1854
+ };
1855
+ const testLinear = (nodes, chars, start, end) => {
1856
+ let ni = 0;
1857
+ let ci = start;
1858
+ let starNi = -1;
1859
+ let starCi = 0;
1860
+ while (ci < end) {
1861
+ const n = nodes[ni];
1862
+ if (n?.t === "star") {
1863
+ starNi = ni++;
1864
+ starCi = ci;
1865
+ continue;
1897
1866
  }
1898
- this.#toString = void 0;
1867
+ const c = chars[ci];
1868
+ if (n && (n.t === "any" || n.t === "lit" && litMatch(n, c) || n.t === "class" && n.re.test(c))) {
1869
+ ni++;
1870
+ ci++;
1871
+ continue;
1872
+ }
1873
+ if (starNi === -1) return false;
1874
+ ni = starNi + 1;
1875
+ ci = ++starCi;
1899
1876
  }
1900
- #partsToRegExp(dot) {
1901
- return this.#parts.map((p) => {
1902
- /* c8 ignore start */
1903
- if (typeof p === "string") throw new Error("string type in extglob ast??");
1904
- /* c8 ignore stop */
1905
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
1906
- this.#uflag = this.#uflag || uflag;
1907
- return re;
1908
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
1909
- }
1910
- static #parseGlob(glob, hasMagic, noEmpty = false) {
1911
- let escaping = false;
1912
- let re = "";
1913
- let uflag = false;
1914
- let inStar = false;
1915
- for (let i = 0; i < glob.length; i++) {
1916
- const c = glob.charAt(i);
1917
- if (escaping) {
1918
- escaping = false;
1919
- re += (reSpecials.has(c) ? "\\" : "") + c;
1920
- continue;
1877
+ while (nodes[ni]?.t === "star") ni++;
1878
+ return ni === nodes.length;
1879
+ };
1880
+ const lengths = (items) => {
1881
+ let min = 0;
1882
+ let max = 0;
1883
+ for (const it of items) {
1884
+ const [lo, hi] = itemLengths(it);
1885
+ min += lo;
1886
+ max += hi;
1887
+ }
1888
+ return [min, max];
1889
+ };
1890
+ const itemLengths = (it) => {
1891
+ if (it.t === "star") return [0, Infinity];
1892
+ if (it.t !== "ext") return [1, 1];
1893
+ if (it.type === "!") return [0, Infinity];
1894
+ const alts = it.alts.map(lengths);
1895
+ const min = Math.min(...alts.map((a) => a[0]));
1896
+ const max = Math.max(...alts.map((a) => a[1]));
1897
+ const loop = max === 0 ? 0 : Infinity;
1898
+ return it.type === "@" ? [min, max] : it.type === "?" ? [0, max] : it.type === "*" ? [0, loop] : [min, loop];
1899
+ };
1900
+ const hasAffix = (lits, chars, start) => {
1901
+ for (let j = 0; j < lits.length; j++) if (!litMatch(lits[j], chars[start + j])) return false;
1902
+ return true;
1903
+ };
1904
+ const slashOrSurrogate = /[/\ud800-\udfff]/;
1905
+ const surrogate = /[\ud800-\udfff]/;
1906
+ const codePoints = (s) => surrogate.test(s) ? [...s] : s;
1907
+ const noSlash = (s) => {
1908
+ if (s.includes("/")) throw new Error("can only match a single path portion, got: " + s);
1909
+ };
1910
+ var Matcher = class {
1911
+ pattern;
1912
+ options;
1913
+ #start;
1914
+ #size;
1915
+ #marks;
1916
+ #dotsSim;
1917
+ #literal;
1918
+ #literalFold = false;
1919
+ #literalRe;
1920
+ #linear;
1921
+ #wild = false;
1922
+ #min = 0;
1923
+ #max = Infinity;
1924
+ #prefix = [];
1925
+ #suffix = [];
1926
+ #prefixStr;
1927
+ #suffixStr;
1928
+ #affix = false;
1929
+ #dfa;
1930
+ #form;
1931
+ constructor(pattern, options = {}) {
1932
+ if (pattern.includes("/")) throw new Error("can only match a single path portion, got pattern: " + pattern);
1933
+ this.pattern = pattern;
1934
+ this.options = options;
1935
+ const { nocase = false, noext = false, normalize: n } = options;
1936
+ this.#form = n === true ? "NFC" : n || void 0;
1937
+ const literal = /^[?*+@]\(\)$/.test(pattern);
1938
+ const toks = tokenize(pattern, nocase, noext || literal, this.#form, options.rangeMark);
1939
+ let [items] = build(toks, pair(toks), 0, toks.length, true);
1940
+ if (this.#form) items = normalize$1(items, this.#form);
1941
+ const [start, size] = compile(items, nocase);
1942
+ this.#start = start;
1943
+ this.#size = size;
1944
+ if (items.every((it) => it.t === "lit")) {
1945
+ this.#literal = items.map((it) => it.ch).join("");
1946
+ this.#literalFold = nocase;
1947
+ } else {
1948
+ const lit = (it) => it.t !== "lit" ? void 0 : nocase ? {
1949
+ ch: it.ch,
1950
+ re: foldRe(it.ch)
1951
+ } : { ch: it.ch };
1952
+ for (const it of items) {
1953
+ const l = lit(it);
1954
+ if (!l) break;
1955
+ this.#prefix.push(l);
1921
1956
  }
1922
- if (c === "*") {
1923
- if (inStar) continue;
1924
- inStar = true;
1925
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
1926
- hasMagic = true;
1927
- continue;
1928
- } else inStar = false;
1929
- if (c === "\\") {
1930
- if (i === glob.length - 1) re += "\\\\";
1931
- else escaping = true;
1932
- continue;
1957
+ for (let j = items.length - 1; j >= 0; j--) {
1958
+ const l = lit(items[j]);
1959
+ if (!l) break;
1960
+ this.#suffix.unshift(l);
1933
1961
  }
1934
- if (c === "[") {
1935
- const [src, needUflag, consumed, magic] = parseClass(glob, i);
1936
- if (consumed) {
1937
- re += src;
1938
- uflag = uflag || needUflag;
1939
- i += consumed - 1;
1940
- hasMagic = hasMagic || magic;
1941
- continue;
1942
- }
1962
+ this.#affix = !!(this.#prefix.length || this.#suffix.length);
1963
+ if (!nocase) {
1964
+ this.#prefixStr = this.#prefix.map((l) => l.ch).join("");
1965
+ this.#suffixStr = this.#suffix.map((l) => l.ch).join("");
1943
1966
  }
1944
- if (c === "?") {
1945
- re += qmark;
1946
- hasMagic = true;
1947
- continue;
1967
+ this.#linear = linear(this.#start)?.slice(this.#prefix.length, -this.#suffix.length || void 0);
1968
+ this.#wild = !!this.#linear?.every((n) => n.t === "star" || n.t === "any");
1969
+ const [min, max] = lengths(items);
1970
+ this.#min = min;
1971
+ this.#max = max;
1972
+ }
1973
+ }
1974
+ test(s) {
1975
+ if (this.#form) {
1976
+ noSlash(s);
1977
+ return this.#test(s.normalize(this.#form));
1978
+ }
1979
+ if (slashOrSurrogate.test(s)) {
1980
+ noSlash(s);
1981
+ return this.#test(s, [...s]);
1982
+ }
1983
+ return this.#test(s, s);
1984
+ }
1985
+ /**
1986
+ * The same as {@link Matcher#test}, but the string is not checked
1987
+ * for `/` chars, so the result for a string that has one is not
1988
+ * defined. Only use it for a string that is known to be one path
1989
+ * portion, such as a part of a path that was split on `/`. It can
1990
+ * be faster, because some patterns do not need to look at each char
1991
+ * of the string.
1992
+ */
1993
+ testUnchecked(s) {
1994
+ return this.#test(this.#form ? s.normalize(this.#form) : s);
1995
+ }
1996
+ #test(s, chars) {
1997
+ if (this.#literal !== void 0) return this.#literalFold ? (this.#literalRe ??= newFoldRe(this.#literal)).test(s) : s === this.#literal;
1998
+ const min = this.#min;
1999
+ const max = this.#max;
2000
+ if (chars === void 0) {
2001
+ const most = s.length;
2002
+ const least = most + 1 >> 1;
2003
+ if (most < min || least > max) return false;
2004
+ if (least < min || most > max) chars = codePoints(s);
2005
+ }
2006
+ if (chars !== void 0 && (chars.length < min || chars.length > max)) return false;
2007
+ const prefix = this.#prefix.length;
2008
+ if (this.#affix) {
2009
+ if (this.#prefixStr !== void 0 && this.#suffixStr !== void 0) {
2010
+ if (!s.startsWith(this.#prefixStr) || !s.endsWith(this.#suffixStr)) return false;
2011
+ } else {
2012
+ chars ??= codePoints(s);
2013
+ const end = chars.length - this.#suffix.length;
2014
+ if (!hasAffix(this.#prefix, chars, 0) || !hasAffix(this.#suffix, chars, end)) return false;
1948
2015
  }
1949
- re += regExpEscape$1(c);
1950
2016
  }
1951
- return [
1952
- re,
1953
- unescape(glob),
1954
- !!hasMagic,
1955
- uflag
1956
- ];
2017
+ const dotStart = !this.options.dot && s.startsWith(".");
2018
+ if (this.#linear) {
2019
+ if (s === "." || s === "..") return false;
2020
+ if (dotStart && !prefix) return false;
2021
+ if (this.#wild) return true;
2022
+ chars ??= codePoints(s);
2023
+ const end = chars.length - this.#suffix.length;
2024
+ return testLinear(this.#linear, chars, prefix, end);
2025
+ }
2026
+ chars ??= codePoints(s);
2027
+ if (s === "." || s === "..") {
2028
+ this.#marks ??= marks(this.#size);
2029
+ const sim = this.#dotsSim ??= new Sim(true, false, this.#marks);
2030
+ const start = sim.state();
2031
+ sim.add(start, this.#start, 0, true);
2032
+ let state = sim.done(start);
2033
+ for (let i = 0; i < chars.length; i++) state = sim.step(state, chars[i], i, true);
2034
+ return state.match;
2035
+ }
2036
+ this.#marks ??= marks(this.#size);
2037
+ const dfa = this.#dfa ??= new Dfa(this.#start, this.#marks);
2038
+ let d = dfa.start(dotStart);
2039
+ const str = chars === s;
2040
+ for (let i = 0; i < chars.length; i++) {
2041
+ if (d.dead) return false;
2042
+ const code = str ? s.charCodeAt(i) : chars[i].charCodeAt(0);
2043
+ d = d.ascii?.[code] ?? dfa.next(d, chars[i]);
2044
+ }
2045
+ return d.match;
2046
+ }
2047
+ /** a readable listing of the state machine */
2048
+ toString() {
2049
+ return show(this.#start);
1957
2050
  }
1958
2051
  };
1959
- _a = AST;
1960
- //#endregion
1961
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js
2052
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/assert-valid-pattern.js
2053
+ const MAX_PATTERN_LENGTH = 65536;
2054
+ const assertValidPattern = (pattern) => {
2055
+ if (typeof pattern !== "string") throw new TypeError("invalid pattern");
2056
+ if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
2057
+ };
2058
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/escape.js
1962
2059
  /**
1963
2060
  * Escape all magic characters in a glob pattern.
1964
2061
  *
@@ -1970,68 +2067,154 @@ _a = AST;
1970
2067
  *
1971
2068
  * If the {@link MinimatchOptions.magicalBraces} option is used,
1972
2069
  * then braces (`{` and `}`) will be escaped.
2070
+ *
2071
+ * A leading `#` or `!` is escaped as well, so that the result is never a
2072
+ * comment or a negated pattern. In `windowsPathsNoEscape` mode, a leading
2073
+ * `!` is written as `@(!)`, because `[!` starts a negated class.
1973
2074
  */
1974
2075
  const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
1975
- if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
1976
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
1977
- };
1978
- //#endregion
1979
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js
1980
- const minimatch = (p, pattern, options = {}) => {
1981
- assertValidPattern(pattern);
1982
- if (!options.nocomment && pattern.charAt(0) === "#") return false;
1983
- return new Minimatch(pattern, options).match(p);
1984
- };
1985
- const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
1986
- const starDotExtTest = (ext) => (f) => !f.startsWith(".") && f.endsWith(ext);
1987
- const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
1988
- const starDotExtTestNocase = (ext) => {
1989
- ext = ext.toLowerCase();
1990
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext);
1991
- };
1992
- const starDotExtTestNocaseDot = (ext) => {
1993
- ext = ext.toLowerCase();
1994
- return (f) => f.toLowerCase().endsWith(ext);
2076
+ const e = magicalBraces ? windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&") : windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
2077
+ const c = e.charAt(0);
2078
+ if (c === "#") return (windowsPathsNoEscape ? "[#]" : "\\#") + e.slice(1);
2079
+ if (c === "!") return (windowsPathsNoEscape ? "@(!)" : "\\!") + e.slice(1);
2080
+ return e;
1995
2081
  };
1996
- const starDotStarRE = /^\*+\.\*+$/;
1997
- const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
1998
- const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
1999
- const dotStarRE = /^\.\*+$/;
2000
- const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
2001
- const starRE = /^\*+$/;
2002
- const starTest = (f) => f.length !== 0 && !f.startsWith(".");
2003
- const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
2004
- const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
2005
- const qmarksTestNocase = ([$0, ext = ""]) => {
2006
- const noext = qmarksTestNoExt([$0]);
2007
- if (!ext) return noext;
2008
- ext = ext.toLowerCase();
2009
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
2082
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/unescape.js
2083
+ /**
2084
+ * Un-escape a string that has been escaped with {@link escape}.
2085
+ *
2086
+ * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
2087
+ * square-bracket escapes are removed, but not backslash escapes.
2088
+ *
2089
+ * For example, it will turn the string `'[*]'` into `*`, but it will not
2090
+ * turn `'\\*'` into `'*'`, because `\` is a path separator in
2091
+ * `windowsPathsNoEscape` mode.
2092
+ *
2093
+ * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
2094
+ * backslash escapes are removed.
2095
+ *
2096
+ * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
2097
+ * or unescaped.
2098
+ *
2099
+ * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
2100
+ * unescaped.
2101
+ */
2102
+ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
2103
+ if (windowsPathsNoEscape && s.startsWith("@(!)")) return "!" + unescape(s.slice(4), {
2104
+ windowsPathsNoEscape,
2105
+ magicalBraces
2106
+ });
2107
+ if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
2108
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
2010
2109
  };
2011
- const qmarksTestNocaseDot = ([$0, ext = ""]) => {
2012
- const noext = qmarksTestNoExtDot([$0]);
2013
- if (!ext) return noext;
2014
- ext = ext.toLowerCase();
2015
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
2110
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/index.js
2111
+ const DEFAULT_BRACE_EXPAND_MAX = 1e5;
2112
+ const DEFAULT_GLOB_STAR_RECURSION_MAX = 200;
2113
+ const AWE_KEY = "allowWindowsEscape";
2114
+ const minimatch = (p, pattern, options) => {
2115
+ assertValidPattern(pattern);
2116
+ if (!options?.nocomment && pattern.charAt(0) === "#") return false;
2117
+ return cachedMinimatch(pattern, options).match(p);
2016
2118
  };
2017
- const qmarksTestDot = ([$0, ext = ""]) => {
2018
- const noext = qmarksTestNoExtDot([$0]);
2019
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
2119
+ let cache = /* @__PURE__ */ new Map();
2120
+ let oldCache = /* @__PURE__ */ new Map();
2121
+ let cacheSize = 0;
2122
+ let cacheTotalWeight = 0;
2123
+ const cacheMax = 256;
2124
+ const cacheMaxWeight = 32768;
2125
+ const cacheMaxEntryWeight = 4096;
2126
+ const cacheWeight = (mm) => {
2127
+ let w = mm.pattern.length;
2128
+ for (const s of mm.globSet) {
2129
+ w += s.length + 1;
2130
+ if (w > cacheMaxEntryWeight) break;
2131
+ }
2132
+ return w;
2020
2133
  };
2021
- const qmarksTest = ([$0, ext = ""]) => {
2022
- const noext = qmarksTestNoExt([$0]);
2023
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
2134
+ const tri = (v) => v === void 0 ? 0 : v ? 2 : 1;
2135
+ const booleanWeights = new Map(Object.keys({
2136
+ nobrace: 0,
2137
+ nocomment: 0,
2138
+ nonegate: 0,
2139
+ noglobstar: 0,
2140
+ noext: 0,
2141
+ nonull: 0,
2142
+ partial: 0,
2143
+ dot: 0,
2144
+ nocase: 0,
2145
+ nocaseMagicOnly: 0,
2146
+ magicalBraces: 0,
2147
+ matchBase: 0,
2148
+ flipNegate: 0,
2149
+ preserveMultipleSlashes: 0,
2150
+ windowsNoMagicRoot: 0
2151
+ }).map((k, i) => [k, 24 * 3 ** i]));
2152
+ const optionsKey = (o) => {
2153
+ let n = 0;
2154
+ let wpe = false;
2155
+ for (const k in o) {
2156
+ const v = o[k];
2157
+ switch (k) {
2158
+ case "windowsPathsNoEscape":
2159
+ if (v) wpe = true;
2160
+ break;
2161
+ case AWE_KEY:
2162
+ if (v === false) wpe = true;
2163
+ break;
2164
+ case "platform": {
2165
+ const p = v || defaultPlatform;
2166
+ if (p === defaultPlatform) break;
2167
+ if (p === "darwin") n += 3;
2168
+ else if (p === "win32") n += 6;
2169
+ else if (p === "linux") n += 9;
2170
+ else return JSON.stringify(o);
2171
+ break;
2172
+ }
2173
+ case "optimizationLevel":
2174
+ if (v === void 0) break;
2175
+ n += v >= 2 ? 1 : v >= 1 ? 0 : 2;
2176
+ break;
2177
+ case "braceExpandMax":
2178
+ if (v !== void 0 && v !== DEFAULT_BRACE_EXPAND_MAX) return JSON.stringify(o);
2179
+ break;
2180
+ case "maxGlobstarRecursion":
2181
+ if (v !== void 0 && v !== DEFAULT_GLOB_STAR_RECURSION_MAX) return JSON.stringify(o);
2182
+ break;
2183
+ case "normalize":
2184
+ if (v !== void 0) return JSON.stringify(o);
2185
+ break;
2186
+ default: n += (booleanWeights.get(k) ?? 0) * tri(v);
2187
+ }
2188
+ }
2189
+ return wpe ? n + 12 : n;
2024
2190
  };
2025
- const qmarksTestNoExt = ([$0]) => {
2026
- const len = $0.length;
2027
- return (f) => f.length === len && !f.startsWith(".");
2191
+ const copyOptions = (o) => {
2192
+ const copy = {};
2193
+ for (const k in o) copy[k] = o[k];
2194
+ return copy;
2028
2195
  };
2029
- const qmarksTestNoExtDot = ([$0]) => {
2030
- const len = $0.length;
2031
- return (f) => f.length === len && f !== "." && f !== "..";
2196
+ const cachedMinimatch = (pattern, options) => {
2197
+ const key = options ? optionsKey(options) : 0;
2198
+ let mm = cache.get(key)?.get(pattern);
2199
+ if (mm) return mm;
2200
+ mm = oldCache.get(key)?.get(pattern) ?? new Minimatch(pattern, copyOptions(options));
2201
+ const weight = cacheWeight(mm);
2202
+ if (weight > cacheMaxEntryWeight) return mm;
2203
+ if (cacheSize >= cacheMax || cacheTotalWeight + weight > cacheMaxWeight) {
2204
+ oldCache = cache;
2205
+ cache = /* @__PURE__ */ new Map();
2206
+ cacheSize = 0;
2207
+ cacheTotalWeight = 0;
2208
+ }
2209
+ let byPattern = cache.get(key);
2210
+ if (!byPattern) cache.set(key, byPattern = /* @__PURE__ */ new Map());
2211
+ byPattern.set(pattern, mm);
2212
+ cacheSize++;
2213
+ cacheTotalWeight += weight;
2214
+ return mm;
2032
2215
  };
2033
2216
  /* c8 ignore start */
2034
- const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
2217
+ const defaultPlatform = typeof process === "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
2035
2218
  const path = {
2036
2219
  win32: { sep: "\\" },
2037
2220
  posix: { sep: "/" }
@@ -2039,10 +2222,10 @@ const path = {
2039
2222
  minimatch.sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
2040
2223
  const GLOBSTAR = Symbol("globstar **");
2041
2224
  minimatch.GLOBSTAR = GLOBSTAR;
2042
- const star = "[^/]*?";
2043
- const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
2044
- const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
2045
- const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
2225
+ const filter = (pattern, options) => {
2226
+ let mm;
2227
+ return (p) => (mm ??= cachedMinimatch(pattern, options)).match(p);
2228
+ };
2046
2229
  minimatch.filter = filter;
2047
2230
  const ext = (a, b = {}) => Object.assign({}, a, b);
2048
2231
  const defaults = (def) => {
@@ -2058,21 +2241,10 @@ const defaults = (def) => {
2058
2241
  return orig.defaults(ext(def, options)).Minimatch;
2059
2242
  }
2060
2243
  },
2061
- AST: class AST extends orig.AST {
2062
- /* c8 ignore start */
2063
- constructor(type, parent, options = {}) {
2064
- super(type, parent, ext(def, options));
2065
- }
2066
- /* c8 ignore stop */
2067
- static fromGlob(pattern, options = {}) {
2068
- return orig.AST.fromGlob(pattern, ext(def, options));
2069
- }
2070
- },
2071
2244
  unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
2072
2245
  escape: (s, options = {}) => orig.escape(s, ext(def, options)),
2073
2246
  filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
2074
2247
  defaults: (options) => orig.defaults(ext(def, options)),
2075
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
2076
2248
  braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
2077
2249
  match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
2078
2250
  sep: orig.sep,
@@ -2083,11 +2255,27 @@ minimatch.defaults = defaults;
2083
2255
  const braceExpand = (pattern, options = {}) => {
2084
2256
  assertValidPattern(pattern);
2085
2257
  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
2086
- return expand(pattern, { max: options.braceExpandMax });
2258
+ let p = pattern.replace(/\\\\/g, "\\\\\\\\");
2259
+ if (options.windowsPathsNoEscape || options[AWE_KEY] === false) p = p.replace(/\[([{}])\]/g, "[\\$1]");
2260
+ return expand(p, { max: options.braceExpandMax });
2087
2261
  };
2088
2262
  minimatch.braceExpand = braceExpand;
2089
- const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
2090
- minimatch.makeRe = makeRe;
2263
+ const RANGE_MIN = 100;
2264
+ const rangeRe = /(?<![\\$])\{(-?\d+)\.\.(-?\d+)\}/g;
2265
+ const inRepeatOrNegExt = (portion, mark) => {
2266
+ const stack = [];
2267
+ for (let i = 0; i < portion.length; i++) {
2268
+ const c = portion.charAt(i);
2269
+ if (c === "\\") i++;
2270
+ else if (c === mark) {
2271
+ if (stack.some((t) => t !== "@" && t !== "?")) return true;
2272
+ } else if (portion.charAt(i + 1) === "(" && "!?+*@".includes(c)) {
2273
+ stack.push(c);
2274
+ i++;
2275
+ } else if (c === ")") stack.pop();
2276
+ }
2277
+ return false;
2278
+ };
2091
2279
  const match = (list, pattern, options = {}) => {
2092
2280
  const mm = new Minimatch(pattern, options);
2093
2281
  list = list.filter((f) => mm.match(f));
@@ -2096,7 +2284,114 @@ const match = (list, pattern, options = {}) => {
2096
2284
  };
2097
2285
  minimatch.match = match;
2098
2286
  const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
2099
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2287
+ const classEnd = (pattern, start) => {
2288
+ let i = start + 1;
2289
+ if (pattern.charAt(i) === "!" || pattern.charAt(i) === "^") i++;
2290
+ let sawStart = false;
2291
+ for (; i < pattern.length; i++) {
2292
+ const c = pattern.charAt(i);
2293
+ if (c === "]" && sawStart) return i;
2294
+ sawStart = true;
2295
+ if (c === "\\") i++;
2296
+ }
2297
+ return -1;
2298
+ };
2299
+ const literal = (pattern, noext) => {
2300
+ if (!noext && (pattern === "+()" || pattern === "@()")) return pattern;
2301
+ let lit = "";
2302
+ for (let i = 0; i < pattern.length; i++) {
2303
+ const c = pattern.charAt(i);
2304
+ if (c === "\\") lit += pattern.charAt(++i) || c;
2305
+ else if (c === "*" || c === "?") return;
2306
+ else if (c === "[") {
2307
+ const close = classEnd(pattern, i);
2308
+ if (close === -1) {
2309
+ lit += c;
2310
+ continue;
2311
+ }
2312
+ let body = pattern.slice(i + 1, close);
2313
+ if (body.startsWith("\\")) body = body.slice(1);
2314
+ if ([...body].length !== 1 || "!^".includes(pattern.charAt(i + 1))) return;
2315
+ lit += body;
2316
+ i = close;
2317
+ } else if (!noext && "+@!".includes(c) && pattern.charAt(i + 1) === "(" && pattern.includes(")", i + 2)) return;
2318
+ else lit += c;
2319
+ }
2320
+ return lit;
2321
+ };
2322
+ const MAX_EXTGLOBS = 256;
2323
+ const extglobCount = (pattern) => {
2324
+ let n = 0;
2325
+ for (let i = 0; i < pattern.length - 1; i++) {
2326
+ const c = pattern.charAt(i);
2327
+ if (c === "\\") i++;
2328
+ else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
2329
+ n++;
2330
+ i++;
2331
+ }
2332
+ }
2333
+ return n;
2334
+ };
2335
+ const assertValidExtglobs = (pattern) => {
2336
+ if (extglobCount(pattern) > MAX_EXTGLOBS) throw new TypeError("pattern has too many extglobs");
2337
+ };
2338
+ const extSafe = (pattern) => {
2339
+ if (/^[?*+@]\(\)$/.test(pattern) || pattern.includes("[:")) return false;
2340
+ let depth = 0;
2341
+ for (let i = 0; i < pattern.length; i++) {
2342
+ const c = pattern.charAt(i);
2343
+ if (c === "\\") {
2344
+ if (++i === pattern.length) return false;
2345
+ } else if (c === "[") {
2346
+ const close = classEnd(pattern, i);
2347
+ if (close !== -1) i = close;
2348
+ } else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
2349
+ depth++;
2350
+ i++;
2351
+ } else if (c === ")") {
2352
+ if (!depth--) return false;
2353
+ } else if (c === "|" && !depth) return false;
2354
+ }
2355
+ return !depth;
2356
+ };
2357
+ let lastSplit;
2358
+ let lastChecked;
2359
+ const portionMatch = (p, f) => typeof p === "string" ? f === p : f !== "" && p.testUnchecked(f);
2360
+ const endIndex = (p, last, lastStart, prev, prevStart) => portionMatch(p, last) ? lastStart : prev !== void 0 && portionMatch(p, prev) ? prevStart : -1;
2361
+ const isDots = (p) => p === "." || p === "..";
2362
+ const isDrive = (p) => typeof p === "string" && /^[a-z]:$/i.test(p);
2363
+ const isLongUNC = (p) => typeof p === "string" && /^unc$/i.test(p);
2364
+ const uncHost = (p) => {
2365
+ if (p[0] !== "" || p[1] !== "") return -1;
2366
+ const h = p[2] !== "?" ? 2 : isLongUNC(p[3]) ? 4 : -1;
2367
+ const host = p[h];
2368
+ const share = p[h + 1];
2369
+ return h !== -1 && host !== void 0 && host !== "" && host !== GLOBSTAR && share !== void 0 && share !== "" && share !== GLOBSTAR ? h : -1;
2370
+ };
2371
+ const walkable = (p, dot) => !isDots(p) && (dot || !p.startsWith("."));
2372
+ const dotPortion = (f, start, end, dot, sep) => {
2373
+ for (let k = start; k < end;) {
2374
+ if (f.charCodeAt(k) === 46) {
2375
+ if (!dot) return true;
2376
+ const n = f.charCodeAt(k + 1) === 46 ? k + 2 : k + 1;
2377
+ if (n >= end || isSep(f.charCodeAt(n), sep)) return true;
2378
+ }
2379
+ const s = nextSep(f, k, sep);
2380
+ if (s === -1) return false;
2381
+ k = s + 1;
2382
+ while (k < end && isSep(f.charCodeAt(k), sep)) k++;
2383
+ }
2384
+ return false;
2385
+ };
2386
+ const isSep = (c, sep) => sep === "/" ? c === 47 : sep === "\\" ? c === 92 : c === 47 || c === 92;
2387
+ const nextSep = (f, from, sep) => {
2388
+ if (sep !== "both") return f.indexOf(sep, from);
2389
+ const s = f.indexOf("/", from);
2390
+ const b = f.indexOf("\\", from);
2391
+ return s === -1 ? b : b === -1 ? s : Math.min(s, b);
2392
+ };
2393
+ const lastSep = (f, from, sep) => sep !== "both" ? f.lastIndexOf(sep, from) : Math.max(f.lastIndexOf("/", from), f.lastIndexOf("\\", from));
2394
+ const PENDING = {};
2100
2395
  var Minimatch = class {
2101
2396
  options;
2102
2397
  set;
@@ -2115,20 +2410,28 @@ var Minimatch = class {
2115
2410
  platform;
2116
2411
  windowsNoMagicRoot;
2117
2412
  maxGlobstarRecursion;
2118
- regexp;
2413
+ #endCheck;
2414
+ #literalCheck;
2415
+ #level2;
2416
+ #form;
2417
+ #literals = [];
2418
+ #shapes = [];
2419
+ #endRows = [];
2420
+ #matchers = /* @__PURE__ */ new Map();
2421
+ #pending = false;
2422
+ #rangeMark;
2423
+ #globstarParts = /* @__PURE__ */ new WeakMap();
2119
2424
  constructor(pattern, options = {}) {
2120
2425
  assertValidPattern(pattern);
2121
2426
  options = options || {};
2122
2427
  this.options = options;
2123
- this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
2428
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? DEFAULT_GLOB_STAR_RECURSION_MAX;
2124
2429
  this.pattern = pattern;
2125
2430
  this.platform = options.platform || defaultPlatform;
2126
2431
  this.isWindows = this.platform === "win32";
2127
- const awe = "allowWindowsEscape";
2128
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
2432
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[AWE_KEY] === false;
2129
2433
  if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
2130
2434
  this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
2131
- this.regexp = null;
2132
2435
  this.negate = false;
2133
2436
  this.nonegate = !!options.nonegate;
2134
2437
  this.comment = false;
@@ -2139,14 +2442,45 @@ var Minimatch = class {
2139
2442
  this.globSet = [];
2140
2443
  this.globParts = [];
2141
2444
  this.set = [];
2445
+ this.#endCheck = !this.preserveMultipleSlashes;
2446
+ this.#level2 = (options.optimizationLevel ?? 1) >= 2;
2447
+ const n = options.normalize;
2448
+ this.#form = n === true ? "NFC" : n || void 0;
2142
2449
  this.make();
2450
+ const drives = this.set.map((row) => this.#rootIndex(row));
2451
+ this.#endRows = this.set.map((row, r) => this.#endCheck && row.length - 1 > drives[r]);
2452
+ this.#literals = this.set.map((row, r) => {
2453
+ const end = this.#endRows[r] ? row.length - 1 : row.length;
2454
+ const lits = row.slice(drives[r] + 1, end).filter((p) => typeof p === "string" && !!p);
2455
+ return [...new Set(lits)];
2456
+ });
2457
+ this.#literalCheck = this.#literals.some((l) => l.length);
2458
+ this.#shapes = this.set.map((row, r) => {
2459
+ const [p0, p1, p2] = row;
2460
+ if (this.#endRows[r] && row.length === 2) {
2461
+ if (p0 === GLOBSTAR && p1 !== GLOBSTAR) return "tail";
2462
+ }
2463
+ if (this.#endRows[r] && options.matchBase && row.length === 1 && p0 !== GLOBSTAR && p0 !== "") return "base";
2464
+ if (!this.#endCheck || drives[r] !== -1) return void 0;
2465
+ if (row.length === 3 && p0 === GLOBSTAR && p2 === GLOBSTAR && p1 !== GLOBSTAR && p1 !== "" && this.maxGlobstarRecursion > 0) return "mid";
2466
+ if (row.length === 2 && p1 === GLOBSTAR && p0 !== GLOBSTAR && p0 !== "") return "head";
2467
+ });
2468
+ }
2469
+ #norm(p) {
2470
+ return this.#form ? p.normalize(this.#form) : p;
2471
+ }
2472
+ #rootIndex(row) {
2473
+ if (!this.isWindows) return -1;
2474
+ if (isDrive(row[0])) return 0;
2475
+ if (row[0] === "" && row[1] === "" && row[2] === "?" && isDrive(row[3])) return 3;
2476
+ const h = uncHost(row);
2477
+ return h === -1 ? -1 : h + 1;
2143
2478
  }
2144
2479
  hasMagic() {
2145
2480
  if (this.options.magicalBraces && this.set.length > 1) return true;
2146
2481
  for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
2147
2482
  return false;
2148
2483
  }
2149
- debug(..._) {}
2150
2484
  make() {
2151
2485
  const pattern = this.pattern;
2152
2486
  const options = this.options;
@@ -2159,28 +2493,108 @@ var Minimatch = class {
2159
2493
  return;
2160
2494
  }
2161
2495
  this.parseNegate();
2162
- this.globSet = [...new Set(this.braceExpand())];
2163
- if (options.debug) this.debug = (...args) => console.error(...args);
2164
- this.debug(this.pattern, this.globSet);
2165
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
2496
+ this.globSet = [...new Set(this.#expandBraces())];
2497
+ const rawGlobParts = this.globSet.map((s) => this.#slashSplit(s));
2166
2498
  this.globParts = this.preprocess(rawGlobParts);
2167
- this.debug(this.pattern, this.globParts);
2499
+ this.#pending = true;
2168
2500
  let set = this.globParts.map((s, _, __) => {
2169
2501
  if (this.isWindows && this.windowsNoMagicRoot) {
2170
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
2502
+ const n = s[2] === "?" && isLongUNC(s[3]) ? 6 : 4;
2503
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && s.slice(3, n).every((p) => !globMagic.test(p));
2171
2504
  const isDrive = /^[a-z]:/i.test(s[0]);
2172
- if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
2173
- else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
2505
+ if (isUNC) return [...s.slice(0, n).map((p) => this.#norm(p)), ...s.slice(n).map((ss) => this.parse(ss))];
2506
+ else if (isDrive) return [this.#norm(s[0]), ...s.slice(1).map((ss) => this.parse(ss))];
2174
2507
  }
2175
2508
  return s.map((ss) => this.parse(ss));
2176
2509
  });
2177
- this.debug(this.pattern, set);
2178
2510
  this.set = set.filter((s) => s.indexOf(false) === -1);
2179
2511
  if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
2180
2512
  const p = this.set[i];
2181
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
2513
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && (isDrive(p[3]) || isLongUNC(this.globParts[i][3]))) {
2514
+ if (isLongUNC(this.globParts[i][3])) p[3] = "UNC";
2515
+ p[2] = "?";
2516
+ }
2517
+ }
2518
+ if (!options.noext) this.mergeRows();
2519
+ this.#pending = false;
2520
+ this.set.forEach((row, i) => {
2521
+ for (let k = 0; k < row.length; k++) if (row[k] === PENDING) row[k] = this.parse(this.globParts[i][k]);
2522
+ });
2523
+ }
2524
+ mergeRows() {
2525
+ let merged = true;
2526
+ while (merged) {
2527
+ merged = false;
2528
+ if (this.set.length < 2) return;
2529
+ let keys = this.#mergeKeys();
2530
+ const len = Math.max(0, ...this.set.map((r) => r.length));
2531
+ for (let k = 0; k < len; k++) {
2532
+ const groups = /* @__PURE__ */ new Map();
2533
+ const R = this.set.length + 1;
2534
+ this.set.forEach((row, i) => {
2535
+ if (!(row[k] instanceof Matcher || row[k] === PENDING) || !extSafe(this.globParts[i][k])) return;
2536
+ const { pre, suf } = keys[i];
2537
+ const key = pre[k] * R + suf[k + 1];
2538
+ const g = groups.get(key);
2539
+ if (g) g.push(i);
2540
+ else groups.set(key, [i]);
2541
+ });
2542
+ const drop = /* @__PURE__ */ new Set();
2543
+ for (const g of groups.values()) {
2544
+ if (g.length < 2) continue;
2545
+ const [first, ...rest] = g;
2546
+ const glob = `@(${g.map((i) => this.globParts[i][k]).join("|")})`;
2547
+ if (extglobCount(glob) > MAX_EXTGLOBS) continue;
2548
+ this.globParts[first][k] = glob;
2549
+ this.set[first][k] = this.parse(glob);
2550
+ for (const i of rest) drop.add(i);
2551
+ }
2552
+ if (drop.size) {
2553
+ merged = true;
2554
+ this.set = this.set.filter((_, i) => !drop.has(i));
2555
+ this.globParts = this.globParts.filter((_, i) => !drop.has(i));
2556
+ if (this.set.length < 2) return;
2557
+ keys = this.#mergeKeys();
2558
+ }
2559
+ }
2182
2560
  }
2183
- this.debug(this.pattern, this.set);
2561
+ }
2562
+ #mergeKeys() {
2563
+ const partIds = /* @__PURE__ */ new Map();
2564
+ const ids = this.globParts.map((parts) => parts.map((s) => {
2565
+ let id = partIds.get(s);
2566
+ if (id === void 0) partIds.set(s, id = partIds.size);
2567
+ return id;
2568
+ }));
2569
+ const P = partIds.size;
2570
+ const len = Math.max(0, ...ids.map((r) => r.length));
2571
+ const keys = ids.map((r) => ({
2572
+ pre: [0],
2573
+ suf: new Array(r.length + 1).fill(0)
2574
+ }));
2575
+ for (let k = 0; k < len; k++) {
2576
+ const m = /* @__PURE__ */ new Map();
2577
+ ids.forEach((r, i) => {
2578
+ if (k >= r.length) return;
2579
+ const { pre } = keys[i];
2580
+ const key = pre[k] * P + r[k];
2581
+ let id = m.get(key);
2582
+ if (id === void 0) m.set(key, id = m.size + 1);
2583
+ pre.push(id);
2584
+ });
2585
+ }
2586
+ for (let k = len - 1; k >= 0; k--) {
2587
+ const m = /* @__PURE__ */ new Map();
2588
+ ids.forEach((r, i) => {
2589
+ if (k >= r.length) return;
2590
+ const { suf } = keys[i];
2591
+ const key = suf[k + 1] * P + r[k];
2592
+ let id = m.get(key);
2593
+ if (id === void 0) m.set(key, id = m.size + 1);
2594
+ suf[k] = id;
2595
+ });
2596
+ }
2597
+ return keys;
2184
2598
  }
2185
2599
  preprocess(globParts) {
2186
2600
  if (this.options.noglobstar) {
@@ -2207,11 +2621,12 @@ var Minimatch = class {
2207
2621
  }
2208
2622
  levelOneOptimize(globParts) {
2209
2623
  return globParts.map((parts) => {
2624
+ const root = this.#rootIndex(parts) + 1;
2210
2625
  parts = parts.reduce((set, part) => {
2211
2626
  const prev = set[set.length - 1];
2212
2627
  if (part === "**" && prev === "**") return set;
2213
2628
  if (part === "..") {
2214
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
2629
+ if (set.length > root && prev && prev !== ".." && prev !== "." && prev !== "**") {
2215
2630
  set.pop();
2216
2631
  return set;
2217
2632
  }
@@ -2222,8 +2637,120 @@ var Minimatch = class {
2222
2637
  return parts.length === 0 ? [""] : parts;
2223
2638
  });
2224
2639
  }
2225
- levelTwoFileOptimize(parts) {
2226
- if (!Array.isArray(parts)) parts = this.slashSplit(parts);
2640
+ #canMatch(f) {
2641
+ const sep = !this.isWindows || !f.includes("\\") ? "/" : f.includes("/") ? "both" : "\\";
2642
+ let ends = this.#endCheck ? 0 : -1;
2643
+ let last = "";
2644
+ let lastStart = 0;
2645
+ let prev;
2646
+ let prevStart = 0;
2647
+ const dot = !!this.options.dot;
2648
+ ROWS: for (let r = 0; r < this.set.length; r++) {
2649
+ const row = this.set[r];
2650
+ const p = row[row.length - 1];
2651
+ let end = ends !== -1 && this.#endRows[r] && p !== GLOBSTAR;
2652
+ if (end && ends === 0) {
2653
+ const i = lastSep(f, f.length, sep);
2654
+ lastStart = i + 1;
2655
+ last = f.slice(lastStart);
2656
+ if (last === "" && i >= 0) {
2657
+ let j = i;
2658
+ while (j > 0 && isSep(f.charCodeAt(j - 1), sep)) j--;
2659
+ prevStart = j === 0 ? 0 : lastSep(f, j - 1, sep) + 1;
2660
+ prev = f.slice(prevStart, j);
2661
+ }
2662
+ const resolves = this.#level2 && (isDots(last) || last === "" && prev !== void 0 && isDots(prev));
2663
+ ends = resolves ? -1 : 1;
2664
+ end = !resolves;
2665
+ }
2666
+ let tailStart = -1;
2667
+ if (end && typeof p === "string") {
2668
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
2669
+ if (tailStart === -1) continue;
2670
+ }
2671
+ if (this.#literalCheck) {
2672
+ for (const l of this.#literals[r]) if (!f.includes(l)) continue ROWS;
2673
+ }
2674
+ if (end && typeof p === "object") {
2675
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
2676
+ if (tailStart === -1) continue;
2677
+ }
2678
+ const shape = this.#shapes[r];
2679
+ if (shape === "base" && end) return "yes";
2680
+ if (shape === "tail" && end) {
2681
+ if (this.#level2 && dotPortion(f, 0, tailStart, true, sep)) return "maybe";
2682
+ if (!dotPortion(f, 0, tailStart, dot, sep)) return "yes";
2683
+ continue;
2684
+ }
2685
+ if (shape === "mid" || shape === "head") {
2686
+ const m = this.#walk(f, row, shape === "head", dot, sep);
2687
+ if (m !== "no") return m;
2688
+ continue;
2689
+ }
2690
+ return "maybe";
2691
+ }
2692
+ return "no";
2693
+ }
2694
+ #matchShape(file, row, shape) {
2695
+ const dot = !!this.options.dot;
2696
+ const n = file.length;
2697
+ if (shape === "head") {
2698
+ if (n < 2 || !portionMatch(row[0], file[0])) return false;
2699
+ for (let i = 1; i < n; i++) if (!walkable(file[i], dot)) return false;
2700
+ return true;
2701
+ }
2702
+ const x = row[1];
2703
+ if (shape === "tail") {
2704
+ let t = n - 1;
2705
+ if (!portionMatch(x, file[t])) {
2706
+ if (file[t] !== "" || n === 1 || !portionMatch(x, file[--t])) return false;
2707
+ }
2708
+ for (let i = 0; i < t; i++) if (!walkable(file[i], dot)) return false;
2709
+ return true;
2710
+ }
2711
+ for (let k = 0; k < n; k++) {
2712
+ if (portionMatch(x, file[k]) && k + 1 < n) {
2713
+ let i = k + 1;
2714
+ while (i < n && walkable(file[i], dot)) i++;
2715
+ if (i === n) return true;
2716
+ }
2717
+ if (!walkable(file[k], dot)) return false;
2718
+ }
2719
+ return false;
2720
+ }
2721
+ #walk(f, row, head, dot, sep) {
2722
+ if (this.#level2 && dotPortion(f, 0, f.length, true, sep)) return "maybe";
2723
+ const x = row[head ? 0 : 1];
2724
+ let s = 0;
2725
+ for (let e = nextSep(f, s, sep); e !== -1; e = nextSep(f, s, sep)) {
2726
+ let next = e + 1;
2727
+ while (next < f.length && isSep(f.charCodeAt(next), sep)) next++;
2728
+ if ((typeof x === "string" ? e - s === x.length && f.startsWith(x, s) : e > s && x.testUnchecked(f.slice(s, e))) && !dotPortion(f, next, f.length, dot, sep)) return "yes";
2729
+ if (head || dotPortion(f, s, next, dot, sep)) return "no";
2730
+ s = next;
2731
+ }
2732
+ return "no";
2733
+ }
2734
+ #cachedSplit(f) {
2735
+ const last = lastSplit;
2736
+ return last?.f === f && last.isWindows === this.isWindows && last.preserveMultipleSlashes === this.preserveMultipleSlashes && last.normalize === this.#form ? last : void 0;
2737
+ }
2738
+ #split(f) {
2739
+ const { isWindows, preserveMultipleSlashes } = this;
2740
+ let parts = this.#slashSplit(isWindows ? f.split("\\").join("/") : f);
2741
+ const normalize = this.#form;
2742
+ if (normalize) parts = parts.map((p) => p.normalize(normalize));
2743
+ lastSplit = {
2744
+ f,
2745
+ isWindows,
2746
+ preserveMultipleSlashes,
2747
+ normalize,
2748
+ parts
2749
+ };
2750
+ return lastSplit;
2751
+ }
2752
+ #levelTwoFileOptimize(file) {
2753
+ const parts = [...file];
2227
2754
  let didSomething = false;
2228
2755
  do {
2229
2756
  didSomething = false;
@@ -2242,19 +2769,23 @@ var Minimatch = class {
2242
2769
  parts.pop();
2243
2770
  }
2244
2771
  }
2245
- let dd = 0;
2772
+ const root = this.#rootIndex(parts) + 1;
2773
+ let dd = root;
2246
2774
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
2247
2775
  const p = parts[dd - 1];
2248
- if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
2776
+ if (p && p !== "." && p !== ".." && p !== "**") {
2249
2777
  didSomething = true;
2250
2778
  parts.splice(dd - 1, 2);
2251
- dd -= 2;
2779
+ dd = Math.max(dd - 2, root);
2252
2780
  }
2253
2781
  }
2254
2782
  } while (didSomething);
2255
2783
  return parts.length === 0 ? [""] : parts;
2256
2784
  }
2257
2785
  firstPhasePreProcess(globParts) {
2786
+ const { braceExpandMax = DEFAULT_BRACE_EXPAND_MAX } = this.options;
2787
+ let splitCells = 0;
2788
+ const maxSplitCells = 1e6;
2258
2789
  let didSomething = false;
2259
2790
  do {
2260
2791
  didSomething = false;
@@ -2269,10 +2800,13 @@ var Minimatch = class {
2269
2800
  const p2 = parts[gs + 3];
2270
2801
  if (next !== "..") continue;
2271
2802
  if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
2803
+ const addedCells = parts.length - 1;
2804
+ if (globParts.length >= braceExpandMax || splitCells + addedCells > maxSplitCells) throw new RangeError(`optimizationLevel 2: too many patterns from '**/..'`);
2272
2805
  didSomething = true;
2273
2806
  parts.splice(gs, 1);
2274
2807
  const other = parts.slice(0);
2275
2808
  other[gs] = "**";
2809
+ splitCells += addedCells;
2276
2810
  globParts.push(other);
2277
2811
  gs--;
2278
2812
  }
@@ -2291,7 +2825,8 @@ var Minimatch = class {
2291
2825
  parts.pop();
2292
2826
  }
2293
2827
  }
2294
- let dd = 0;
2828
+ const root = this.#rootIndex(parts) + 1;
2829
+ let dd = root;
2295
2830
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
2296
2831
  const p = parts[dd - 1];
2297
2832
  if (p && p !== "." && p !== ".." && p !== "**") {
@@ -2299,7 +2834,7 @@ var Minimatch = class {
2299
2834
  const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
2300
2835
  parts.splice(dd - 1, 2, ...splin);
2301
2836
  if (parts.length === 0) parts.push("");
2302
- dd -= 2;
2837
+ dd = Math.max(dd - 2, root);
2303
2838
  }
2304
2839
  }
2305
2840
  }
@@ -2307,45 +2842,41 @@ var Minimatch = class {
2307
2842
  return globParts;
2308
2843
  }
2309
2844
  secondPhasePreProcess(globParts) {
2310
- for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
2311
- const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
2312
- if (matched) {
2313
- globParts[i] = [];
2314
- globParts[j] = matched;
2315
- break;
2845
+ const keys = /* @__PURE__ */ new Set();
2846
+ const rows = globParts.filter((parts) => {
2847
+ const key = parts.join("/");
2848
+ if (keys.has(key)) return false;
2849
+ keys.add(key);
2850
+ return true;
2851
+ });
2852
+ const stars = /* @__PURE__ */ new Map();
2853
+ for (const parts of rows) {
2854
+ const s = [];
2855
+ for (let i = 0; i < parts.length; i++) if (parts[i] === "*") s.push(i);
2856
+ if (s.length) stars.set(s.join(","), s);
2857
+ }
2858
+ if (!stars.size || rows.length * stars.size > 1e5) return rows;
2859
+ const { dot } = this.options;
2860
+ return rows.filter((parts) => {
2861
+ for (const s of stars.values()) {
2862
+ if (s[s.length - 1] >= parts.length) continue;
2863
+ const c = [...parts];
2864
+ let ok = true;
2865
+ let changed = false;
2866
+ for (const i of s) {
2867
+ const p = parts[i];
2868
+ if (p === "*") continue;
2869
+ if (!p || p === "**" || !dot && p.startsWith(".")) {
2870
+ ok = false;
2871
+ break;
2872
+ }
2873
+ c[i] = "*";
2874
+ changed = true;
2875
+ }
2876
+ if (ok && changed && keys.has(c.join("/"))) return false;
2316
2877
  }
2317
- }
2318
- return globParts.filter((gs) => gs.length);
2319
- }
2320
- partsMatch(a, b, emptyGSMatch = false) {
2321
- let ai = 0;
2322
- let bi = 0;
2323
- let result = [];
2324
- let which = "";
2325
- while (ai < a.length && bi < b.length) if (a[ai] === b[bi]) {
2326
- result.push(which === "b" ? b[bi] : a[ai]);
2327
- ai++;
2328
- bi++;
2329
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
2330
- result.push(a[ai]);
2331
- ai++;
2332
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
2333
- result.push(b[bi]);
2334
- bi++;
2335
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
2336
- if (which === "b") return false;
2337
- which = "a";
2338
- result.push(a[ai]);
2339
- ai++;
2340
- bi++;
2341
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
2342
- if (which === "a") return false;
2343
- which = "b";
2344
- result.push(b[bi]);
2345
- ai++;
2346
- bi++;
2347
- } else return false;
2348
- return a.length === b.length && result;
2878
+ return true;
2879
+ });
2349
2880
  }
2350
2881
  parseNegate() {
2351
2882
  if (this.nonegate) return;
@@ -2359,10 +2890,22 @@ var Minimatch = class {
2359
2890
  if (negateOffset) this.pattern = pattern.slice(negateOffset);
2360
2891
  this.negate = negate;
2361
2892
  }
2362
- matchOne(file, pattern, partial = false) {
2893
+ #matchRow(file, resolved, pattern, partial) {
2363
2894
  let fileStartIndex = 0;
2364
2895
  let patternStartIndex = 0;
2365
- if (this.isWindows) {
2896
+ const fh = this.isWindows ? uncHost(resolved) : -1;
2897
+ const ph = fh === -1 ? -1 : uncHost(pattern);
2898
+ if (ph !== -1) {
2899
+ const host = pattern[ph];
2900
+ const share = pattern[ph + 1];
2901
+ if (typeof host !== "string" || typeof share !== "string") {
2902
+ fileStartIndex = fh;
2903
+ patternStartIndex = ph;
2904
+ } else if (resolved[fh].toLowerCase() === host.toLowerCase() && resolved[fh + 1].toLowerCase() === share.toLowerCase()) {
2905
+ fileStartIndex = fh + 2;
2906
+ patternStartIndex = ph + 2;
2907
+ }
2908
+ } else if (this.isWindows) {
2366
2909
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
2367
2910
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
2368
2911
  const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
@@ -2372,32 +2915,20 @@ var Minimatch = class {
2372
2915
  if (typeof fdi === "number" && typeof pdi === "number") {
2373
2916
  const [fd, pd] = [file[fdi], pattern[pdi]];
2374
2917
  if (fd.toLowerCase() === pd.toLowerCase()) {
2375
- pattern[pdi] = fd;
2376
- patternStartIndex = pdi;
2377
- fileStartIndex = fdi;
2918
+ patternStartIndex = pdi + 1;
2919
+ fileStartIndex = fdi + 1;
2378
2920
  }
2379
2921
  }
2380
2922
  }
2381
- const { optimizationLevel = 1 } = this.options;
2382
- if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
2923
+ file = resolved;
2383
2924
  if (pattern.includes(GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
2384
2925
  return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
2385
2926
  }
2386
2927
  #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
2387
- const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
2388
- const lastgs = pattern.lastIndexOf(GLOBSTAR);
2389
- const [head, body, tail] = partial ? [
2390
- pattern.slice(patternIndex, firstgs),
2391
- pattern.slice(firstgs + 1),
2392
- []
2393
- ] : [
2394
- pattern.slice(patternIndex, firstgs),
2395
- pattern.slice(firstgs + 1, lastgs),
2396
- pattern.slice(lastgs + 1)
2397
- ];
2928
+ const { head, body, tail, segments } = this.#getGlobstarParts(pattern, partial, patternIndex);
2398
2929
  if (head.length) {
2399
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
2400
- if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
2930
+ const headEnd = fileIndex + head.length;
2931
+ if (!this.#matchOne(file, head, partial, fileIndex, 0, headEnd)) return false;
2401
2932
  fileIndex += head.length;
2402
2933
  patternIndex += head.length;
2403
2934
  }
@@ -2422,67 +2953,86 @@ var Minimatch = class {
2422
2953
  }
2423
2954
  return partial || sawSome;
2424
2955
  }
2425
- const bodySegments = [[[], 0]];
2426
- let currentBody = bodySegments[0];
2956
+ return !!this.#matchGlobStarBodySections(file, segments, file.length - fileTailMatch, fileIndex, 0, partial, 0, !!fileTailMatch, /* @__PURE__ */ new Set());
2957
+ }
2958
+ #getGlobstarParts(pattern, partial, patternIndex) {
2959
+ let byStart = this.#globstarParts.get(pattern);
2960
+ if (!byStart) {
2961
+ byStart = [];
2962
+ this.#globstarParts.set(pattern, byStart);
2963
+ }
2964
+ const key = patternIndex * 2 + (partial ? 1 : 0);
2965
+ const found = byStart[key];
2966
+ if (found) return found;
2967
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
2968
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
2969
+ const head = pattern.slice(patternIndex, firstgs);
2970
+ const body = pattern.slice(firstgs + 1, partial ? void 0 : lastgs);
2971
+ const tail = partial ? [] : pattern.slice(lastgs + 1);
2972
+ const segments = [[[], 0]];
2973
+ let current = segments[0];
2427
2974
  let nonGsParts = 0;
2428
2975
  const nonGsPartsSums = [0];
2429
2976
  for (const b of body) if (b === GLOBSTAR) {
2430
2977
  nonGsPartsSums.push(nonGsParts);
2431
- currentBody = [[], 0];
2432
- bodySegments.push(currentBody);
2978
+ current = [[], 0];
2979
+ segments.push(current);
2433
2980
  } else {
2434
- currentBody[0].push(b);
2981
+ current[0].push(b);
2435
2982
  nonGsParts++;
2436
2983
  }
2437
- let i = bodySegments.length - 1;
2438
- const fileLength = file.length - fileTailMatch;
2439
- for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
2440
- return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
2984
+ segments.forEach((b, i) => {
2985
+ b[1] = nonGsParts - nonGsPartsSums[i];
2986
+ });
2987
+ const parts = {
2988
+ head,
2989
+ body,
2990
+ tail,
2991
+ segments
2992
+ };
2993
+ byStart[key] = parts;
2994
+ return parts;
2441
2995
  }
2442
- #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
2996
+ #matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex, bodyIndex, partial, globStarDepth, sawTail, tried) {
2443
2997
  const bs = bodySegments[bodyIndex];
2444
2998
  if (!bs) {
2445
- for (let i = fileIndex; i < file.length; i++) {
2999
+ if (partial) return fileIndex >= fileLength || fileIndex === fileLength - 1 && file[fileIndex] === "";
3000
+ for (let i = fileIndex; i < fileLength; i++) {
2446
3001
  sawTail = true;
2447
3002
  const f = file[i];
2448
3003
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
2449
3004
  }
2450
3005
  return sawTail;
2451
3006
  }
2452
- const [body, after] = bs;
3007
+ const [body, need] = bs;
3008
+ const after = partial ? fileLength : fileLength - need;
2453
3009
  while (fileIndex <= after) {
2454
- if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
2455
- const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
3010
+ const key = bodyIndex * (file.length + 1) + fileIndex;
3011
+ if (tried.has(key)) return false;
3012
+ tried.add(key);
3013
+ if (this.#matchOne(file, body, partial, fileIndex, 0, fileIndex + body.length) && globStarDepth < this.maxGlobstarRecursion) {
3014
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail, tried);
2456
3015
  if (sub !== false) return sub;
2457
3016
  }
3017
+ if (fileIndex === after) break;
2458
3018
  const f = file[fileIndex];
2459
3019
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
2460
3020
  fileIndex++;
2461
3021
  }
2462
3022
  return partial || null;
2463
3023
  }
2464
- #matchOne(file, pattern, partial, fileIndex, patternIndex) {
3024
+ #matchOne(file, pattern, partial, fileIndex, patternIndex, fileEnd = file.length) {
2465
3025
  let fi;
2466
3026
  let pi;
2467
3027
  let pl;
2468
3028
  let fl;
2469
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
2470
- this.debug("matchOne loop");
3029
+ for (fi = fileIndex, pi = patternIndex, fl = Math.min(fileEnd, file.length), pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
2471
3030
  let p = pattern[pi];
2472
3031
  let f = file[fi];
2473
- this.debug(pattern, p, f);
2474
3032
  /* c8 ignore start */
2475
3033
  if (p === false || p === GLOBSTAR) return false;
2476
3034
  /* c8 ignore stop */
2477
- let hit;
2478
- if (typeof p === "string") {
2479
- hit = f === p;
2480
- this.debug("string match", p, f, hit);
2481
- } else {
2482
- hit = p.test(f);
2483
- this.debug("pattern match", p, f, hit);
2484
- }
2485
- if (!hit) return false;
3035
+ if (!portionMatch(p, f)) return false;
2486
3036
  }
2487
3037
  if (fi === fl && pi === pl) return true;
2488
3038
  else if (fi === fl) return partial;
@@ -2493,92 +3043,83 @@ var Minimatch = class {
2493
3043
  braceExpand() {
2494
3044
  return braceExpand(this.pattern, this.options);
2495
3045
  }
3046
+ #expandBraces() {
3047
+ const { pattern } = this;
3048
+ if (this.options.nobrace) return this.braceExpand();
3049
+ let code = 57344;
3050
+ while (pattern.includes(String.fromCharCode(code))) if (++code > 63743) return this.braceExpand();
3051
+ const mark = String.fromCharCode(code);
3052
+ let found = false;
3053
+ const marked = pattern.replace(rangeRe, (m, lo, hi) => {
3054
+ const a = Number(lo);
3055
+ const b = Number(hi);
3056
+ if (!Number.isSafeInteger(a) || !Number.isSafeInteger(b) || Math.abs(a - b) + 1 < RANGE_MIN) return m;
3057
+ found = true;
3058
+ return `${mark}${lo}..${hi}${mark}`;
3059
+ });
3060
+ if (!found) return this.braceExpand();
3061
+ const set = braceExpand(marked, this.options);
3062
+ for (const p of set) for (const portion of p.split("/")) {
3063
+ const c = portion.indexOf("[");
3064
+ if (c !== -1 && c < portion.lastIndexOf(mark)) return this.braceExpand();
3065
+ if (!this.options.noext && inRepeatOrNegExt(portion, mark)) return this.braceExpand();
3066
+ }
3067
+ this.#rangeMark = mark;
3068
+ return set;
3069
+ }
2496
3070
  parse(pattern) {
2497
3071
  assertValidPattern(pattern);
2498
3072
  const options = this.options;
2499
3073
  if (pattern === "**") return GLOBSTAR;
2500
3074
  if (pattern === "") return "";
2501
- let m;
2502
- let fastTest = null;
2503
- if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
2504
- else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
2505
- else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
2506
- else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
2507
- else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
2508
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
2509
- if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
2510
- return re;
2511
- }
2512
- makeRe() {
2513
- if (this.regexp || this.regexp === false) return this.regexp;
2514
- const set = this.set;
2515
- if (!set.length) {
2516
- this.regexp = false;
2517
- return this.regexp;
2518
- }
2519
- const options = this.options;
2520
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
2521
- const flags = new Set(options.nocase ? ["i"] : []);
2522
- let re = set.map((pattern) => {
2523
- const pp = pattern.map((p) => {
2524
- if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
2525
- return typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
2526
- });
2527
- pp.forEach((p, i) => {
2528
- const next = pp[i + 1];
2529
- const prev = pp[i - 1];
2530
- if (p !== GLOBSTAR || prev === GLOBSTAR) return;
2531
- if (prev === void 0) {
2532
- if (next !== void 0 && next !== GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
2533
- else pp[i] = twoStar;
2534
- } else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
2535
- else if (next !== GLOBSTAR) {
2536
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
2537
- pp[i + 1] = GLOBSTAR;
2538
- }
3075
+ const { nocase, nocaseMagicOnly, noext = false, dot, normalize } = options;
3076
+ const rangeMark = this.#rangeMark;
3077
+ const lit = rangeMark && pattern.includes(rangeMark) ? void 0 : literal(pattern, noext);
3078
+ if (lit !== void 0 && !(nocase && !nocaseMagicOnly && pattern.toUpperCase() !== pattern.toLowerCase())) return this.#norm(lit);
3079
+ if (this.#pending) return PENDING;
3080
+ let m = this.#matchers.get(pattern);
3081
+ if (!m) {
3082
+ if (!noext) assertValidExtglobs(pattern);
3083
+ m = new Matcher(pattern, {
3084
+ nocase,
3085
+ noext,
3086
+ dot,
3087
+ normalize,
3088
+ ...rangeMark && { rangeMark }
2539
3089
  });
2540
- const filtered = pp.filter((p) => p !== GLOBSTAR);
2541
- if (this.partial && filtered.length >= 1) {
2542
- const prefixes = [];
2543
- for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
2544
- return "(?:" + prefixes.join("|") + ")";
2545
- }
2546
- return filtered.join("/");
2547
- }).join("|");
2548
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
2549
- re = "^" + open + re + close + "$";
2550
- if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
2551
- if (this.negate) re = "^(?!" + re + ").+$";
2552
- try {
2553
- this.regexp = new RegExp(re, [...flags].join(""));
2554
- } catch {
2555
- this.regexp = false;
3090
+ this.#matchers.set(pattern, m);
2556
3091
  }
2557
- /* c8 ignore stop */
2558
- return this.regexp;
3092
+ return m;
2559
3093
  }
2560
- slashSplit(p) {
3094
+ #slashSplit(p) {
2561
3095
  if (this.preserveMultipleSlashes) return p.split("/");
2562
3096
  else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
2563
3097
  else return p.split(/\/+/);
2564
3098
  }
2565
3099
  match(f, partial = this.partial) {
2566
- this.debug("match", f, this.pattern);
2567
3100
  if (this.comment) return false;
2568
3101
  if (this.empty) return f === "";
2569
3102
  if (f === "/" && partial) return true;
2570
3103
  const options = this.options;
2571
- if (this.isWindows) f = f.split("\\").join("/");
2572
- const ff = this.slashSplit(f);
2573
- this.debug(this.pattern, "split", ff);
3104
+ let split = this.#cachedSplit(f);
3105
+ if (!split) {
3106
+ if (!partial && !this.#form && (this.#endCheck || this.#literalCheck) && lastChecked !== f) {
3107
+ lastChecked = f;
3108
+ const can = this.#canMatch(f);
3109
+ if (can === "no") return options.flipNegate ? false : this.negate;
3110
+ if (can === "yes") return options.flipNegate ? true : !this.negate;
3111
+ }
3112
+ split = this.#split(f);
3113
+ }
3114
+ const ff = split.parts;
3115
+ const resolved = this.#level2 ? split.resolved ??= this.#levelTwoFileOptimize(ff) : ff;
2574
3116
  const set = this.set;
2575
- this.debug(this.pattern, "set", set);
2576
3117
  let filename = ff[ff.length - 1];
2577
3118
  if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
2578
- for (const pattern of set) {
2579
- let file = ff;
2580
- if (options.matchBase && pattern.length === 1) file = [filename];
2581
- if (this.matchOne(file, pattern, partial)) {
3119
+ for (let r = 0; r < set.length; r++) {
3120
+ const pattern = set[r];
3121
+ const shape = partial ? void 0 : this.#shapes[r];
3122
+ if (shape === "base" ? portionMatch(pattern[0], filename) : shape ? this.#matchShape(resolved, pattern, shape) : options.matchBase && pattern.length === 1 ? this.#matchRow([filename], [filename], pattern, partial) : this.#matchRow(ff, resolved, pattern, partial)) {
2582
3123
  if (options.flipNegate) return true;
2583
3124
  return !this.negate;
2584
3125
  }
@@ -2591,12 +3132,10 @@ var Minimatch = class {
2591
3132
  }
2592
3133
  };
2593
3134
  /* c8 ignore stop */
2594
- minimatch.AST = AST;
2595
3135
  minimatch.Minimatch = Minimatch;
2596
3136
  minimatch.escape = escape;
2597
3137
  minimatch.unescape = unescape;
2598
- //#endregion
2599
- //#region ../internal/src/build/runtime-package-files.ts
3138
+ // ../internal/src/build/runtime-package-files.ts
2600
3139
  const alwaysPublishedFile = /^(?:package\.json|(?:readme|copying|licen[cs]e)(?:\..*[^~$])?)$/i;
2601
3140
  const rootExcluded = /* @__PURE__ */ new Set([
2602
3141
  "package-lock.json",
@@ -2780,8 +3319,7 @@ async function copyRuntimePackageFiles(packageDir, targetDir) {
2780
3319
  await unlessGone(() => copyFile(join(packageDir, path), target));
2781
3320
  }
2782
3321
  }
2783
- //#endregion
2784
- //#region ../internal/src/build/scan-module.ts
3322
+ // ../internal/src/build/scan-module.ts
2785
3323
  /**
2786
3324
  * Reads facts from JavaScript and TypeScript modules at build and dev time. The scanner parses each module once with
2787
3325
  * the oxc parser that Vite ships through Rolldown, and never runs it. Values that are not static literals read as
@@ -2993,8 +3531,7 @@ function maskLiterals(module) {
2993
3531
  for (const span of literalSpans(module)) for (let index = span.start; index < span.end; index++) if (!isLineTerminator(output[index] ?? "")) output[index] = " ";
2994
3532
  return output.join("");
2995
3533
  }
2996
- //#endregion
2997
- //#region ../internal/src/build/provider-output-sources.ts
3534
+ // ../internal/src/build/provider-output-sources.ts
2998
3535
  function escapeRegExp(value) {
2999
3536
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3000
3537
  }
@@ -4076,8 +4613,7 @@ async function retainProviderOutputSources(options) {
4076
4613
  return root ? resolve(retainedRoots.get(root), relative(root, resolvedPath)) : path;
4077
4614
  } };
4078
4615
  }
4079
- //#endregion
4080
- //#region ../internal/src/build/vercel-config.ts
4616
+ // ../internal/src/build/vercel-config.ts
4081
4617
  function createDefaultVercelOutputRoot(rootDir) {
4082
4618
  return resolve(rootDir, ".vercel", "output");
4083
4619
  }
@@ -4100,8 +4636,7 @@ function createNodeFunctionConfig(extra = {}) {
4100
4636
  ...extra
4101
4637
  };
4102
4638
  }
4103
- //#endregion
4104
- //#region ../internal/src/build/runtime-package-resolution.ts
4639
+ // ../internal/src/build/runtime-package-resolution.ts
4105
4640
  /** Locates package metadata through exports, an entry's ancestors, or the project's dependency roots. */
4106
4641
  function createRuntimePackageResolver(readPackageName) {
4107
4642
  return async (name, resolver, fromDir) => {
@@ -4142,8 +4677,7 @@ function isPackageResolutionMiss(error) {
4142
4677
  const code = error?.code;
4143
4678
  return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
4144
4679
  }
4145
- //#endregion
4146
- //#region ../internal/src/build/runtime-package-directory.ts
4680
+ // ../internal/src/build/runtime-package-directory.ts
4147
4681
  /** Update a staged copy, then publish it with rollback on failure or cancellation. */
4148
4682
  async function updateRuntimePackageDirectory(options) {
4149
4683
  const stagingRoot = await mkdtemp(join(dirname(options.directory), ".vitehub-runtime-packages-"));
@@ -4190,8 +4724,7 @@ async function updateRuntimePackageDirectory(options) {
4190
4724
  });
4191
4725
  }
4192
4726
  }
4193
- //#endregion
4194
- //#region ../internal/src/build/vercel-runtime-packages.ts
4727
+ // ../internal/src/build/vercel-runtime-packages.ts
4195
4728
  const runtimeExportConditions = /* @__PURE__ */ new Set([
4196
4729
  "default",
4197
4730
  "import",
@@ -4339,7 +4872,7 @@ async function copyTracedPackageFiles(name, resolver, packageDir, packageJsonPat
4339
4872
  return true;
4340
4873
  }
4341
4874
  async function loadNodeFileTrace() {
4342
- nodeFileTracePromise ??= import("./out-BbXG-yVX.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)).then(({ nodeFileTrace }) => nodeFileTrace);
4875
+ nodeFileTracePromise ??= import("./out-By90R-Bo.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)).then(({ nodeFileTrace }) => nodeFileTrace);
4343
4876
  return nodeFileTracePromise;
4344
4877
  }
4345
4878
  async function resolvePackageTraceEntries(name, resolver, packageDir, packageJson) {
@@ -4405,8 +4938,7 @@ function parsePackageJson(value, path) {
4405
4938
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw internalErrorDiagnostics.INTERNAL_B0047({ message: `Expected ${path} to contain a JSON object.` });
4406
4939
  return value;
4407
4940
  }
4408
- //#endregion
4409
- //#region ../internal/src/build/provider-output-catalog.ts
4941
+ // ../internal/src/build/provider-output-catalog.ts
4410
4942
  var ProviderOutputCatalog = class {
4411
4943
  bundleDefines = {};
4412
4944
  #appliedCloudflareContributions = /* @__PURE__ */ new Map();
@@ -4634,8 +5166,7 @@ function useProviderOutputCatalog(config) {
4634
5166
  providerOutputCatalogs.set(config, catalog);
4635
5167
  return catalog;
4636
5168
  }
4637
- //#endregion
4638
- //#region ../internal/src/build/deployment-output.ts
5169
+ // ../internal/src/build/deployment-output.ts
4639
5170
  const providerDeploymentOutputRegistry = globalThis;
4640
5171
  const providerDeploymentOutputWrites = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputWrites ??= /* @__PURE__ */ new Map();
4641
5172
  const providerDeploymentOutputFinalizations = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputFinalizations ??= /* @__PURE__ */ new WeakMap();
@@ -5647,14 +6178,12 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
5647
6178
  if (providerDeploymentOutputFinalizations.get(catalog) === active) providerDeploymentOutputFinalizations.delete(catalog);
5648
6179
  }
5649
6180
  }
5650
- //#endregion
5651
- //#region ../internal/src/durability.ts
6181
+ // ../internal/src/durability.ts
5652
6182
  /** The `durability` module next to the Vite plugin module at `importMetaUrl`, in source and in `dist`. */
5653
6183
  function durabilityModuleFile(importMetaUrl) {
5654
6184
  return fileURLToPath(new URL(importMetaUrl.endsWith(".ts") ? "./durability.ts" : "./durability.js", importMetaUrl));
5655
6185
  }
5656
- //#endregion
5657
- //#region ../internal/src/definition-catalog.ts
6186
+ // ../internal/src/definition-catalog.ts
5658
6187
  const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
5659
6188
  const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
5660
6189
  const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
@@ -5813,8 +6342,7 @@ async function writeFileIfChanged(file, contents) {
5813
6342
  await mkdir(resolve$1(file, ".."), { recursive: true });
5814
6343
  await writeFile(file, contents, "utf8");
5815
6344
  }
5816
- //#endregion
5817
- //#region ../internal/src/hints.ts
6345
+ // ../internal/src/hints.ts
5818
6346
  /**
5819
6347
  * The file that lists the hints of the last build or dev server, relative to the project root. A hint is a warning
5820
6348
  * about something that works now and fails later, such as counts that stay in one server's memory. Agents and CI read
@@ -5902,8 +6430,7 @@ function hostFromNitroPreset(value) {
5902
6430
  if (normalized === "node" || normalized.startsWith("node-")) return "node";
5903
6431
  if (normalized.startsWith("vercel")) return "vercel";
5904
6432
  }
5905
- //#endregion
5906
- //#region ../internal/src/hosting.ts
6433
+ // ../internal/src/hosting.ts
5907
6434
  /**
5908
6435
  * Returns the Nitro preset name that this build targets, as the developer wrote it.
5909
6436
  * The order is `nitro.preset`, `hosting`, `NITRO_PRESET`, `SERVER_PRESET`, then `VITEHUB_HOST`.
@@ -5953,8 +6480,7 @@ function createNitroServerKit(value = {}) {
5953
6480
  }
5954
6481
  };
5955
6482
  }
5956
- //#endregion
5957
- //#region src/deployment-env.ts
6483
+ // src/deployment-env.ts
5958
6484
  /**
5959
6485
  * The variables that Schedules read on the deployed host. The Vercel cron handler refuses every request until
5960
6486
  * `CRON_SECRET` is set, so it is required. Cloudflare cron triggers and the Process Runtime read none.
@@ -5969,8 +6495,7 @@ function scheduleDeploymentEnv(definitions, context) {
5969
6495
  owners: ["schedule"]
5970
6496
  }];
5971
6497
  }
5972
- //#endregion
5973
- //#region ../internal/src/contributions.ts
6498
+ // ../internal/src/contributions.ts
5974
6499
  const unnamedPlugin = "unnamed plugin";
5975
6500
  function isNonEmptyString(value) {
5976
6501
  return String(value) === value && value.length > 0;
@@ -6075,8 +6600,7 @@ function readContribution(entry, plugin, options, fail) {
6075
6600
  ...base
6076
6601
  };
6077
6602
  }
6078
- //#endregion
6079
- //#region src/contributions.ts
6603
+ // src/contributions.ts
6080
6604
  const scheduleNamePattern = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/i;
6081
6605
  /** Error for a Schedule name with two definitions. Both sources are named so the user knows which to rename. */
6082
6606
  function duplicateScheduleError(name, first, second) {
@@ -6105,8 +6629,7 @@ async function collectScheduleContributions(plugins, context) {
6105
6629
  }
6106
6630
  return contributions;
6107
6631
  }
6108
- //#endregion
6109
- //#region src/discovery.ts
6632
+ // src/discovery.ts
6110
6633
  /** Discovery source of Schedule Definitions that Vite plugins contribute through `vitehub.schedules`. */
6111
6634
  const contributedScheduleSource = "vite-plugin-contribution";
6112
6635
  /**
@@ -6270,13 +6793,11 @@ function discoverScheduleDefinitions(options) {
6270
6793
  function discoverStartableScheduleDefinitions(options) {
6271
6794
  return discoverAllScheduleDefinitions(options).filter((definition) => definition.startable);
6272
6795
  }
6273
- //#endregion
6274
- //#region src/integrations/vercel.ts
6796
+ // src/integrations/vercel.ts
6275
6797
  function getVercelSchedulePath(name) {
6276
6798
  return `/api/vitehub/schedules/vercel/${name.replace(/[^a-z0-9/_-]+/gi, "_")}`;
6277
6799
  }
6278
- //#endregion
6279
- //#region src/internal/time-zone-cron.ts
6800
+ // src/internal/time-zone-cron.ts
6280
6801
  const dayMs = 864e5;
6281
6802
  const dayMinutes = 1440;
6282
6803
  const sampledDays = 732;
@@ -6337,8 +6858,7 @@ function expandCron(cron, offsets) {
6337
6858
  })}`;
6338
6859
  return `${time} * * *`;
6339
6860
  }
6340
- //#endregion
6341
- //#region src/internal/provider-output.ts
6861
+ // src/internal/provider-output.ts
6342
6862
  const schedulePackageName = "@vite-hub/schedule";
6343
6863
  const scheduleStaticRuntimeImport = "@vite-hub/schedule/runtime/static";
6344
6864
  const productName = "schedule";
@@ -6639,14 +7159,23 @@ function netlifyScheduleFunctionNames(definitions) {
6639
7159
  }
6640
7160
  return names;
6641
7161
  }
6642
- function renderDenoCronEntry(file, registryFile, crons, runtimeImport = scheduleStaticRuntimeImport, timeZoneCrons = {}) {
6643
- const scheduleCrons = [...crons.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([name, cron], index) => {
6644
- const cronId = index.toString(36);
7162
+ const englishBuildHostOrder = new Intl.Collator("en-US");
7163
+ const denoCronNameLength = 64;
7164
+ function denoCronNames(scheduleNames) {
7165
+ const sorted = [...scheduleNames].sort((left, right) => englishBuildHostOrder.compare(left, right) || (left < right ? -1 : left > right ? 1 : 0));
7166
+ return new Map(sorted.map((name, index) => {
7167
+ const indexedName = `vitehub-${index.toString(36)}-${name}`;
7168
+ if (/^[a-z0-9 _-]*$/i.test(name) && indexedName.length <= denoCronNameLength) return [name, indexedName];
6645
7169
  const safeName = [...name].map((character) => /^[a-z0-9 _-]$/i.test(character) ? character : "_").join("");
6646
- const cronNamePrefix = `vitehub-${cronId}-`;
7170
+ return [name, `${`vitehub_${createHash("sha256").update(name).digest("hex").slice(0, 12)}-`}${safeName}`.slice(0, denoCronNameLength)];
7171
+ }));
7172
+ }
7173
+ function renderDenoCronEntry(file, registryFile, crons, runtimeImport = scheduleStaticRuntimeImport, timeZoneCrons = {}) {
7174
+ const scheduleCrons = [...denoCronNames(crons.keys())].map(([name, cronName]) => {
7175
+ const cron = crons.get(name);
6647
7176
  return {
6648
7177
  cron,
6649
- cronName: `${cronNamePrefix}${safeName.slice(0, 64 - cronNamePrefix.length)}`,
7178
+ cronName,
6650
7179
  denoCron: cronWithWeekdayNames(cron),
6651
7180
  inTimeZone: Object.hasOwn(timeZoneCrons, name),
6652
7181
  name
@@ -7254,8 +7783,7 @@ async function generateProviderOutputsWithinLock(options) {
7254
7783
  throw error;
7255
7784
  }
7256
7785
  }
7257
- //#endregion
7258
- //#region src/inspect.ts
7786
+ // src/inspect.ts
7259
7787
  function inspectTimeZone(timeZone) {
7260
7788
  return timeZone === null ? "Not a static string" : timeZone ?? "UTC";
7261
7789
  }
@@ -7406,8 +7934,7 @@ const scheduleConsoleSection = {
7406
7934
  notice: "The host runs each Schedule on its cron, in its time zone (UTC by default). A Definition without cron runs when code starts it with `startSchedule()`; each started Schedule has its own row. Static Definitions with `manual: true` can also run from the Console or `vitehub schedule run`."
7407
7935
  }
7408
7936
  };
7409
- //#endregion
7410
- //#region src/internal/registry-module.ts
7937
+ // src/internal/registry-module.ts
7411
7938
  /**
7412
7939
  * Renders the `#vitehub/schedule/registry` virtual module. A virtual module has no directory, so a relative import would
7413
7940
  * resolve against the Vite root, which is the app directory under Nuxt. Each definition is imported by its absolute
@@ -7424,8 +7951,7 @@ function renderScheduleRegistryModule(definitions) {
7424
7951
  ""
7425
7952
  ].join("\n");
7426
7953
  }
7427
- //#endregion
7428
- //#region src/vite.ts
7954
+ // src/vite.ts
7429
7955
  async function readScheduleDefinitionCrons(definitions) {
7430
7956
  return await readRuntimeDefinitionCrons(definitions);
7431
7957
  }
@@ -8245,5 +8771,4 @@ function hubSchedule(options = {}) {
8245
8771
  };
8246
8772
  return inspectable;
8247
8773
  }
8248
- //#endregion
8249
8774
  export { collectScheduleContributions, contributedScheduleSource, createScheduleNitroConfig, discoverScheduleDefinitions, discoverStartableScheduleDefinitions, hubSchedule, inspectScheduleDefinitions, readScheduleDefinitionCrons, scheduleConsoleSection };