@cloudflare/vite-plugin 1.20.3 → 1.21.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.
package/dist/index.mjs CHANGED
@@ -6,7 +6,6 @@ import * as nodePath from "node:path";
6
6
  import path4, { relative, resolve } from "node:path";
7
7
  import * as util$1 from "node:util";
8
8
  import { format, inspect } from "node:util";
9
- import { createHeaders, createRequest, sendResponse } from "@remix-run/node-fetch-server";
10
9
  import * as vite from "vite";
11
10
  import { version } from "vite";
12
11
  import * as fs$1 from "node:fs";
@@ -14,16 +13,14 @@ import fs, { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
14
13
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
15
14
  import process2 from "node:process";
16
15
  import os from "node:os";
17
- import { defu } from "defu";
18
16
  import { getCloudflarePreset, nonPrefixedNodeModules } from "@cloudflare/unenv-preset";
19
17
  import v8 from "node:v8";
20
18
  import { defineEnv } from "unenv";
21
19
  import * as fsp from "node:fs/promises";
22
- import colors from "picocolors";
23
- import getPort, { portNumbers } from "get-port";
20
+ import net from "node:net";
24
21
  import { execFileSync, spawn } from "node:child_process";
25
22
  import { randomUUID } from "node:crypto";
26
- import { globSync } from "tinyglobby";
23
+ import path, { posix } from "path";
27
24
  import { WebSocketServer } from "ws";
28
25
 
29
26
  //#region rolldown:runtime
@@ -54,12 +51,12 @@ var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
54
51
 
55
52
  //#endregion
56
53
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
57
- var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js": ((exports, module) => {
54
+ var require_constants$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js": ((exports, module) => {
58
55
  const SEMVER_SPEC_VERSION = "2.0.0";
59
- const MAX_LENGTH$2 = 256;
56
+ const MAX_LENGTH$3 = 256;
60
57
  const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991;
61
58
  const MAX_SAFE_COMPONENT_LENGTH$1 = 16;
62
- const MAX_SAFE_BUILD_LENGTH$1 = MAX_LENGTH$2 - 6;
59
+ const MAX_SAFE_BUILD_LENGTH$1 = MAX_LENGTH$3 - 6;
63
60
  const RELEASE_TYPES = [
64
61
  "major",
65
62
  "premajor",
@@ -70,7 +67,7 @@ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
70
67
  "prerelease"
71
68
  ];
72
69
  module.exports = {
73
- MAX_LENGTH: MAX_LENGTH$2,
70
+ MAX_LENGTH: MAX_LENGTH$3,
74
71
  MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH$1,
75
72
  MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH$1,
76
73
  MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
@@ -91,7 +88,7 @@ var require_debug = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
91
88
  //#endregion
92
89
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js
93
90
  var require_re = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js": ((exports, module) => {
94
- const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH: MAX_LENGTH$1 } = require_constants();
91
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH: MAX_LENGTH$2 } = require_constants$1();
95
92
  const debug$3 = require_debug();
96
93
  exports = module.exports = {};
97
94
  const re$4 = exports.re = [];
@@ -103,7 +100,7 @@ var require_re = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver
103
100
  const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
104
101
  const safeRegexReplacements = [
105
102
  ["\\s", 1],
106
- ["\\d", MAX_LENGTH$1],
103
+ ["\\d", MAX_LENGTH$2],
107
104
  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
108
105
  ];
109
106
  const makeSafeRegex = (value) => {
@@ -206,7 +203,7 @@ var require_identifiers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
206
203
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js
207
204
  var require_semver$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js": ((exports, module) => {
208
205
  const debug$2 = require_debug();
209
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
206
+ const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER } = require_constants$1();
210
207
  const { safeRe: re$3, t: t$3 } = require_re();
211
208
  const parseOptions$2 = require_parse_options();
212
209
  const { compareIdentifiers } = require_identifiers();
@@ -216,7 +213,7 @@ var require_semver$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
216
213
  if (version$2 instanceof SemVer$15) if (version$2.loose === !!options.loose && version$2.includePrerelease === !!options.includePrerelease) return version$2;
217
214
  else version$2 = version$2.version;
218
215
  else if (typeof version$2 !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version$2}".`);
219
- if (version$2.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
216
+ if (version$2.length > MAX_LENGTH$1) throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`);
220
217
  debug$2("SemVer", version$2, options);
221
218
  this.options = options;
222
219
  this.loose = !!options.loose;
@@ -384,9 +381,9 @@ var require_semver$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
384
381
 
385
382
  //#endregion
386
383
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js
387
- var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js": ((exports, module) => {
384
+ var require_parse$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js": ((exports, module) => {
388
385
  const SemVer$14 = require_semver$1();
389
- const parse$7 = (version$2, options, throwErrors = false) => {
386
+ const parse$9 = (version$2, options, throwErrors = false) => {
390
387
  if (version$2 instanceof SemVer$14) return version$2;
391
388
  try {
392
389
  return new SemVer$14(version$2, options);
@@ -395,15 +392,15 @@ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
395
392
  throw er;
396
393
  }
397
394
  };
398
- module.exports = parse$7;
395
+ module.exports = parse$9;
399
396
  }) });
400
397
 
401
398
  //#endregion
402
399
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
403
400
  var require_valid$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js": ((exports, module) => {
404
- const parse$6 = require_parse();
401
+ const parse$8 = require_parse$1();
405
402
  const valid$1 = (version$2, options) => {
406
- const v = parse$6(version$2, options);
403
+ const v = parse$8(version$2, options);
407
404
  return v ? v.version : null;
408
405
  };
409
406
  module.exports = valid$1;
@@ -412,9 +409,9 @@ var require_valid$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/s
412
409
  //#endregion
413
410
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
414
411
  var require_clean = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js": ((exports, module) => {
415
- const parse$5 = require_parse();
412
+ const parse$7 = require_parse$1();
416
413
  const clean$1 = (version$2, options) => {
417
- const s = parse$5(version$2.trim().replace(/^[=v]+/, ""), options);
414
+ const s = parse$7(version$2.trim().replace(/^[=v]+/, ""), options);
418
415
  return s ? s.version : null;
419
416
  };
420
417
  module.exports = clean$1;
@@ -442,10 +439,10 @@ var require_inc = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semve
442
439
  //#endregion
443
440
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js
444
441
  var require_diff = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js": ((exports, module) => {
445
- const parse$4 = require_parse();
442
+ const parse$6 = require_parse$1();
446
443
  const diff$1 = (version1, version2) => {
447
- const v1 = parse$4(version1, null, true);
448
- const v2 = parse$4(version2, null, true);
444
+ const v1 = parse$6(version1, null, true);
445
+ const v2 = parse$6(version2, null, true);
449
446
  const comparison = v1.compare(v2);
450
447
  if (comparison === 0) return null;
451
448
  const v1Higher = comparison > 0;
@@ -495,9 +492,9 @@ var require_patch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
495
492
  //#endregion
496
493
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
497
494
  var require_prerelease = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js": ((exports, module) => {
498
- const parse$3 = require_parse();
495
+ const parse$5 = require_parse$1();
499
496
  const prerelease$1 = (version$2, options) => {
500
- const parsed = parse$3(version$2, options);
497
+ const parsed = parse$5(version$2, options);
501
498
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
502
499
  };
503
500
  module.exports = prerelease$1;
@@ -640,7 +637,7 @@ var require_cmp = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semve
640
637
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js
641
638
  var require_coerce = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js": ((exports, module) => {
642
639
  const SemVer$7 = require_semver$1();
643
- const parse$2 = require_parse();
640
+ const parse$4 = require_parse$1();
644
641
  const { safeRe: re$2, t: t$2 } = require_re();
645
642
  const coerce$1 = (version$2, options) => {
646
643
  if (version$2 instanceof SemVer$7) return version$2;
@@ -660,7 +657,7 @@ var require_coerce = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/se
660
657
  }
661
658
  if (match === null) return null;
662
659
  const major$2 = match[2];
663
- return parse$2(`${major$2}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
660
+ return parse$4(`${major$2}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
664
661
  };
665
662
  module.exports = coerce$1;
666
663
  }) });
@@ -814,7 +811,7 @@ var require_range = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
814
811
  const debug$1 = require_debug();
815
812
  const SemVer$6 = require_semver$1();
816
813
  const { safeRe: re$1, t: t$1, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
817
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
814
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$1();
818
815
  const isNullSet = (c) => c.value === "<0.0.0-0";
819
816
  const isAny = (c) => c.value === "";
820
817
  const isSatisfiable = (comparators, options) => {
@@ -848,16 +845,16 @@ var require_range = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
848
845
  };
849
846
  const replaceTilde = (comp, options) => {
850
847
  const r$1 = options.loose ? re$1[t$1.TILDELOOSE] : re$1[t$1.TILDE];
851
- return comp.replace(r$1, (_, M, m, p, pr) => {
852
- debug$1("tilde", comp, _, M, m, p, pr);
848
+ return comp.replace(r$1, (_, M, m, p$1, pr) => {
849
+ debug$1("tilde", comp, _, M, m, p$1, pr);
853
850
  let ret;
854
851
  if (isX(M)) ret = "";
855
852
  else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
856
- else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
853
+ else if (isX(p$1)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
857
854
  else if (pr) {
858
855
  debug$1("replaceTilde pr", pr);
859
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
860
- } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
856
+ ret = `>=${M}.${m}.${p$1}-${pr} <${M}.${+m + 1}.0-0`;
857
+ } else ret = `>=${M}.${m}.${p$1} <${M}.${+m + 1}.0-0`;
861
858
  debug$1("tilde return", ret);
862
859
  return ret;
863
860
  });
@@ -869,23 +866,23 @@ var require_range = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
869
866
  debug$1("caret", comp, options);
870
867
  const r$1 = options.loose ? re$1[t$1.CARETLOOSE] : re$1[t$1.CARET];
871
868
  const z = options.includePrerelease ? "-0" : "";
872
- return comp.replace(r$1, (_, M, m, p, pr) => {
873
- debug$1("caret", comp, _, M, m, p, pr);
869
+ return comp.replace(r$1, (_, M, m, p$1, pr) => {
870
+ debug$1("caret", comp, _, M, m, p$1, pr);
874
871
  let ret;
875
872
  if (isX(M)) ret = "";
876
873
  else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
877
- else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
874
+ else if (isX(p$1)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
878
875
  else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
879
876
  else if (pr) {
880
877
  debug$1("replaceCaret pr", pr);
881
- if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
882
- else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
883
- else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
878
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p$1}-${pr} <${M}.${m}.${+p$1 + 1}-0`;
879
+ else ret = `>=${M}.${m}.${p$1}-${pr} <${M}.${+m + 1}.0-0`;
880
+ else ret = `>=${M}.${m}.${p$1}-${pr} <${+M + 1}.0.0-0`;
884
881
  } else {
885
882
  debug$1("no pr");
886
- if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
887
- else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
888
- else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
883
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p$1}${z} <${M}.${m}.${+p$1 + 1}-0`;
884
+ else ret = `>=${M}.${m}.${p$1}${z} <${M}.${+m + 1}.0-0`;
885
+ else ret = `>=${M}.${m}.${p$1} <${+M + 1}.0.0-0`;
889
886
  }
890
887
  debug$1("caret return", ret);
891
888
  return ret;
@@ -898,11 +895,11 @@ var require_range = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
898
895
  const replaceXRange = (comp, options) => {
899
896
  comp = comp.trim();
900
897
  const r$1 = options.loose ? re$1[t$1.XRANGELOOSE] : re$1[t$1.XRANGE];
901
- return comp.replace(r$1, (ret, gtlt, M, m, p, pr) => {
902
- debug$1("xRange", comp, ret, gtlt, M, m, p, pr);
898
+ return comp.replace(r$1, (ret, gtlt, M, m, p$1, pr) => {
899
+ debug$1("xRange", comp, ret, gtlt, M, m, p$1, pr);
903
900
  const xM = isX(M);
904
901
  const xm = xM || isX(m);
905
- const xp = xm || isX(p);
902
+ const xp = xm || isX(p$1);
906
903
  const anyX = xp;
907
904
  if (gtlt === "=" && anyX) gtlt = "";
908
905
  pr = options.includePrerelease ? "-0" : "";
@@ -910,16 +907,16 @@ var require_range = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
910
907
  else ret = "*";
911
908
  else if (gtlt && anyX) {
912
909
  if (xm) m = 0;
913
- p = 0;
910
+ p$1 = 0;
914
911
  if (gtlt === ">") {
915
912
  gtlt = ">=";
916
913
  if (xm) {
917
914
  M = +M + 1;
918
915
  m = 0;
919
- p = 0;
916
+ p$1 = 0;
920
917
  } else {
921
918
  m = +m + 1;
922
- p = 0;
919
+ p$1 = 0;
923
920
  }
924
921
  } else if (gtlt === "<=") {
925
922
  gtlt = "<";
@@ -927,7 +924,7 @@ var require_range = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/sem
927
924
  else m = +m + 1;
928
925
  }
929
926
  if (gtlt === "<") pr = "-0";
930
- ret = `${gtlt + M}.${m}.${p}${pr}`;
927
+ ret = `${gtlt + M}.${m}.${p$1}${pr}`;
931
928
  } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
932
929
  else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
933
930
  debug$1("xRange return", ret);
@@ -1389,10 +1386,10 @@ var require_subset = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/se
1389
1386
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js
1390
1387
  var require_semver = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js": ((exports, module) => {
1391
1388
  const internalRe = require_re();
1392
- const constants = require_constants();
1389
+ const constants$2 = require_constants$1();
1393
1390
  const SemVer = require_semver$1();
1394
1391
  const identifiers = require_identifiers();
1395
- const parse$1 = require_parse();
1392
+ const parse$3 = require_parse$1();
1396
1393
  const valid = require_valid$1();
1397
1394
  const clean = require_clean();
1398
1395
  const inc = require_inc();
@@ -1430,7 +1427,7 @@ var require_semver = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/se
1430
1427
  const simplifyRange = require_simplify();
1431
1428
  const subset = require_subset();
1432
1429
  module.exports = {
1433
- parse: parse$1,
1430
+ parse: parse$3,
1434
1431
  valid,
1435
1432
  clean,
1436
1433
  inc,
@@ -1471,8 +1468,8 @@ var require_semver = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/se
1471
1468
  re: internalRe.re,
1472
1469
  src: internalRe.src,
1473
1470
  tokens: internalRe.t,
1474
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
1475
- RELEASE_TYPES: constants.RELEASE_TYPES,
1471
+ SEMVER_SPEC_VERSION: constants$2.SEMVER_SPEC_VERSION,
1472
+ RELEASE_TYPES: constants$2.RELEASE_TYPES,
1476
1473
  compareIdentifiers: identifiers.compareIdentifiers,
1477
1474
  rcompareIdentifiers: identifiers.rcompareIdentifiers
1478
1475
  };
@@ -1494,6 +1491,71 @@ async function assertWranglerVersion() {
1494
1491
  if (!(0, import_semver.satisfies)(installedVersion, peerDependency)) throw new Error(`The installed version of Wrangler (${installedVersion}) does not satisfy the peer dependency required by @cloudflare/vite-plugin (${peerDependency}).\nPlease install wrangler@${peerDependency}.`);
1495
1492
  }
1496
1493
 
1494
+ //#endregion
1495
+ //#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@0.8.0/node_modules/@remix-run/node-fetch-server/dist/node-fetch-server.js
1496
+ async function* readStream(stream) {
1497
+ let reader = stream.getReader();
1498
+ try {
1499
+ while (true) {
1500
+ let result = await reader.read();
1501
+ if (result.done) break;
1502
+ yield result.value;
1503
+ }
1504
+ } finally {
1505
+ reader.releaseLock();
1506
+ }
1507
+ }
1508
+ function createRequest(req, res, options) {
1509
+ let controller = new AbortController();
1510
+ res.on("close", () => {
1511
+ controller.abort();
1512
+ });
1513
+ let method = req.method ?? "GET";
1514
+ let headers = createHeaders(req);
1515
+ let protocol = options?.protocol ?? ("encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:");
1516
+ let host = options?.host ?? headers.get("Host") ?? "localhost";
1517
+ let url = new URL(req.url, `${protocol}//${host}`);
1518
+ let init = {
1519
+ method,
1520
+ headers,
1521
+ signal: controller.signal
1522
+ };
1523
+ if (method !== "GET" && method !== "HEAD") {
1524
+ init.body = new ReadableStream({ start(controller2) {
1525
+ req.on("data", (chunk) => {
1526
+ controller2.enqueue(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
1527
+ });
1528
+ req.on("end", () => {
1529
+ controller2.close();
1530
+ });
1531
+ } });
1532
+ init.duplex = "half";
1533
+ }
1534
+ return new Request(url, init);
1535
+ }
1536
+ function createHeaders(req) {
1537
+ let headers = new Headers();
1538
+ let rawHeaders = req.rawHeaders;
1539
+ for (let i$1 = 0; i$1 < rawHeaders.length; i$1 += 2) {
1540
+ if (rawHeaders[i$1].startsWith(":")) continue;
1541
+ headers.append(rawHeaders[i$1], rawHeaders[i$1 + 1]);
1542
+ }
1543
+ return headers;
1544
+ }
1545
+ async function sendResponse(res, response) {
1546
+ let headers = {};
1547
+ for (let [key, value] of response.headers) if (key in headers) if (Array.isArray(headers[key])) headers[key].push(value);
1548
+ else headers[key] = [headers[key], value];
1549
+ else headers[key] = value;
1550
+ res.writeHead(response.status, headers);
1551
+ if (response.body != null && res.req.method !== "HEAD") {
1552
+ for await (let chunk of readStream(response.body)) if (res.write(chunk) === false) await new Promise((resolve$2) => {
1553
+ res.once("drain", resolve$2);
1554
+ });
1555
+ }
1556
+ res.end();
1557
+ }
1558
+
1497
1559
  //#endregion
1498
1560
  //#region src/utils.ts
1499
1561
  var import_gte = /* @__PURE__ */ __toESM$1(require_gte(), 1);
@@ -1519,8 +1581,8 @@ const postfixRE = /[?#].*$/;
1519
1581
  function cleanUrl(url) {
1520
1582
  return url.replace(postfixRE, "");
1521
1583
  }
1522
- function withTrailingSlash(path) {
1523
- return path.endsWith("/") ? path : `${path}/`;
1584
+ function withTrailingSlash(path$1) {
1585
+ return path$1.endsWith("/") ? path$1 : `${path$1}/`;
1524
1586
  }
1525
1587
  function createRequestHandler(handler) {
1526
1588
  return async (req, res, next) => {
@@ -1713,8 +1775,19 @@ var PluginContext = class {
1713
1775
  assert(this.#resolvedViteConfig, "Expected `resolvedViteConfig` to be defined");
1714
1776
  return this.#resolvedViteConfig;
1715
1777
  }
1778
+ isChildEnvironment(environmentName) {
1779
+ if (this.resolvedPluginConfig.type !== "workers") return false;
1780
+ for (const childEnvironmentNames of this.resolvedPluginConfig.environmentNameToChildEnvironmentNamesMap.values()) if (childEnvironmentNames.includes(environmentName)) return true;
1781
+ return false;
1782
+ }
1783
+ #getWorker(environmentName) {
1784
+ if (this.resolvedPluginConfig.type !== "workers") return;
1785
+ const worker = this.resolvedPluginConfig.environmentNameToWorkerMap.get(environmentName);
1786
+ if (worker) return worker;
1787
+ for (const [parentEnvironmentName, childEnvironmentNames] of this.resolvedPluginConfig.environmentNameToChildEnvironmentNamesMap) if (childEnvironmentNames.includes(environmentName)) return this.resolvedPluginConfig.environmentNameToWorkerMap.get(parentEnvironmentName);
1788
+ }
1716
1789
  getWorkerConfig(environmentName) {
1717
- return this.resolvedPluginConfig.type === "workers" ? this.resolvedPluginConfig.environmentNameToWorkerMap.get(environmentName)?.config : void 0;
1790
+ return this.#getWorker(environmentName)?.config;
1718
1791
  }
1719
1792
  get allWorkerConfigs() {
1720
1793
  switch (this.resolvedPluginConfig.type) {
@@ -1728,7 +1801,7 @@ var PluginContext = class {
1728
1801
  return this.resolvedPluginConfig.environmentNameToWorkerMap.get(this.resolvedPluginConfig.entryWorkerEnvironmentName)?.config;
1729
1802
  }
1730
1803
  getNodeJsCompat(environmentName) {
1731
- return this.resolvedPluginConfig.type === "workers" ? this.resolvedPluginConfig.environmentNameToWorkerMap.get(environmentName)?.nodeJsCompat : void 0;
1804
+ return this.#getWorker(environmentName)?.nodeJsCompat;
1732
1805
  }
1733
1806
  };
1734
1807
  function assertIsNotPreview(ctx) {
@@ -1811,7 +1884,7 @@ const formatInvalidRoutes = (invalidRules) => {
1811
1884
  };
1812
1885
 
1813
1886
  //#endregion
1814
- //#region ../workers-utils/dist/chunk-UB4QLUTD.mjs
1887
+ //#region ../workers-utils/dist/chunk-LDFBMPMW.mjs
1815
1888
  var __create = Object.create;
1816
1889
  var __defProp = Object.defineProperty;
1817
1890
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1855,7 +1928,7 @@ var ENVIRONMENT_TAG_PREFIX = "cf:environment=";
1855
1928
  var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
1856
1929
 
1857
1930
  //#endregion
1858
- //#region ../workers-utils/dist/chunk-Y5D2J4RL.mjs
1931
+ //#region ../workers-utils/dist/chunk-4N6XW2IM.mjs
1859
1932
  function getLocalWorkerdCompatibilityDate({ projectPath = process.cwd() } = {}) {
1860
1933
  try {
1861
1934
  const miniflareEntry = module$1.createRequire(projectPath).resolve("miniflare");
@@ -1977,7 +2050,7 @@ function mapWorkerMetadataBindings(bindings) {
1977
2050
  ...binding.outbound && { outbound: {
1978
2051
  service: binding.outbound.worker.service,
1979
2052
  environment: binding.outbound.worker.environment,
1980
- parameters: binding.outbound.params?.map((p) => p.name) ?? []
2053
+ parameters: binding.outbound.params?.map((p$1) => p$1.name) ?? []
1981
2054
  } }
1982
2055
  }];
1983
2056
  break;
@@ -2139,20 +2212,20 @@ function constructWranglerConfig(workerOrWorkers) {
2139
2212
  name: workerName,
2140
2213
  main: entrypoint
2141
2214
  };
2142
- for (const env of workers) {
2143
- const serviceTag = env.tags?.find((t$5) => t$5 === `${SERVICE_TAG_PREFIX}${workerName}`);
2144
- const envTag = env.tags?.find((t$5) => t$5.startsWith(ENVIRONMENT_TAG_PREFIX));
2215
+ for (const env$1 of workers) {
2216
+ const serviceTag = env$1.tags?.find((t$5) => t$5 === `${SERVICE_TAG_PREFIX}${workerName}`);
2217
+ const envTag = env$1.tags?.find((t$5) => t$5.startsWith(ENVIRONMENT_TAG_PREFIX));
2145
2218
  if (serviceTag !== `${SERVICE_TAG_PREFIX}${workerName}` || envTag === void 0) continue;
2146
2219
  const [_, envName] = envTag.split("=");
2147
2220
  combinedConfig.env ??= {};
2148
- combinedConfig.env[envName] = convertWorkerToWranglerConfig(env);
2221
+ combinedConfig.env[envName] = convertWorkerToWranglerConfig(env$1);
2149
2222
  }
2150
2223
  return combinedConfig;
2151
2224
  }
2152
2225
  __name(constructWranglerConfig, "constructWranglerConfig");
2153
2226
 
2154
2227
  //#endregion
2155
- //#region ../workers-utils/dist/chunk-6T3PMLAP.mjs
2228
+ //#region ../workers-utils/dist/chunk-AT3LIX2I.mjs
2156
2229
  var UserError$1 = class extends Error {
2157
2230
  static {
2158
2231
  __name(this, "UserError");
@@ -2768,7 +2841,7 @@ var ParseOptions;
2768
2841
  (function(ParseOptions2) {
2769
2842
  ParseOptions2.DEFAULT = { allowTrailingComma: false };
2770
2843
  })(ParseOptions || (ParseOptions = {}));
2771
- function parse(text, errors = [], options = ParseOptions.DEFAULT) {
2844
+ function parse$2(text, errors = [], options = ParseOptions.DEFAULT) {
2772
2845
  let currentProperty = null;
2773
2846
  let currentParent = [];
2774
2847
  const previousParents = [];
@@ -2812,7 +2885,7 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
2812
2885
  }, options);
2813
2886
  return currentParent[0];
2814
2887
  }
2815
- __name(parse, "parse");
2888
+ __name(parse$2, "parse");
2816
2889
  function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
2817
2890
  let currentParent = {
2818
2891
  type: "array",
@@ -3183,7 +3256,7 @@ function setProperty(text, originalPath, value, options) {
3183
3256
  else {
3184
3257
  if (value === void 0) return [];
3185
3258
  const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
3186
- const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
3259
+ const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p$1) => p$1.children[0].value)) : parent.children.length;
3187
3260
  let edit;
3188
3261
  if (index > 0) {
3189
3262
  let previous = parent.children[index - 1];
@@ -3340,7 +3413,7 @@ var SyntaxKind;
3340
3413
  SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
3341
3414
  SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
3342
3415
  })(SyntaxKind || (SyntaxKind = {}));
3343
- var parse2 = parse;
3416
+ var parse2 = parse$2;
3344
3417
  var ParseErrorCode;
3345
3418
  (function(ParseErrorCode2) {
3346
3419
  ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
@@ -3725,14 +3798,14 @@ function sliceAndTrimEndOf(str, startPtr, endPtr, allowNewLines) {
3725
3798
  return [trimmed, commentIdx];
3726
3799
  }
3727
3800
  __name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
3728
- function extractValue(str, ptr, end, depth, integersAsBigInt) {
3729
- if (depth === 0) throw new TomlError("document contains excessively nested structures. aborting.", {
3801
+ function extractValue(str, ptr, end, depth$1, integersAsBigInt) {
3802
+ if (depth$1 === 0) throw new TomlError("document contains excessively nested structures. aborting.", {
3730
3803
  toml: str,
3731
3804
  ptr
3732
3805
  });
3733
3806
  let c = str[ptr];
3734
3807
  if (c === "[" || c === "{") {
3735
- let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
3808
+ let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth$1, integersAsBigInt) : parseInlineTable(str, ptr, depth$1, integersAsBigInt);
3736
3809
  let newPtr = end ? skipUntil(str, endPtr2, ",", end) : endPtr2;
3737
3810
  if (endPtr2 - newPtr && end === "}") {
3738
3811
  let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
@@ -3823,7 +3896,7 @@ function parseKey(str, ptr, end = "=") {
3823
3896
  return [parsed, skipVoid(str, endPtr + 1, true, true)];
3824
3897
  }
3825
3898
  __name(parseKey, "parseKey");
3826
- function parseInlineTable(str, ptr, depth, integersAsBigInt) {
3899
+ function parseInlineTable(str, ptr, depth$1, integersAsBigInt) {
3827
3900
  let res = {};
3828
3901
  let seen = /* @__PURE__ */ new Set();
3829
3902
  let c;
@@ -3859,7 +3932,7 @@ function parseInlineTable(str, ptr, depth, integersAsBigInt) {
3859
3932
  toml: str,
3860
3933
  ptr
3861
3934
  });
3862
- let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
3935
+ let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth$1 - 1, integersAsBigInt);
3863
3936
  seen.add(value);
3864
3937
  t$5[k] = value;
3865
3938
  ptr = valueEndPtr;
@@ -3877,7 +3950,7 @@ function parseInlineTable(str, ptr, depth, integersAsBigInt) {
3877
3950
  return [res, ptr];
3878
3951
  }
3879
3952
  __name(parseInlineTable, "parseInlineTable");
3880
- function parseArray(str, ptr, depth, integersAsBigInt) {
3953
+ function parseArray(str, ptr, depth$1, integersAsBigInt) {
3881
3954
  let res = [];
3882
3955
  let c;
3883
3956
  ptr++;
@@ -3887,7 +3960,7 @@ function parseArray(str, ptr, depth, integersAsBigInt) {
3887
3960
  });
3888
3961
  else if (c === "#") ptr = skipComment(str, ptr);
3889
3962
  else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
3890
- let e = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
3963
+ let e = extractValue(str, ptr - 1, "]", depth$1 - 1, integersAsBigInt);
3891
3964
  res.push(e[0]);
3892
3965
  ptr = e[1];
3893
3966
  }
@@ -3980,23 +4053,23 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
3980
4053
  });
3981
4054
  k[1]++;
3982
4055
  }
3983
- let p = peekTable(k[0], res, meta, isTableArray ? 2 : 1);
3984
- if (!p) throw new TomlError("trying to redefine an already defined table or value", {
4056
+ let p$1 = peekTable(k[0], res, meta, isTableArray ? 2 : 1);
4057
+ if (!p$1) throw new TomlError("trying to redefine an already defined table or value", {
3985
4058
  toml,
3986
4059
  ptr
3987
4060
  });
3988
- m = p[2];
3989
- tbl = p[1];
4061
+ m = p$1[2];
4062
+ tbl = p$1[1];
3990
4063
  ptr = k[1];
3991
4064
  } else {
3992
4065
  let k = parseKey(toml, ptr);
3993
- let p = peekTable(k[0], tbl, m, 0);
3994
- if (!p) throw new TomlError("trying to redefine an already defined table or value", {
4066
+ let p$1 = peekTable(k[0], tbl, m, 0);
4067
+ if (!p$1) throw new TomlError("trying to redefine an already defined table or value", {
3995
4068
  toml,
3996
4069
  ptr
3997
4070
  });
3998
4071
  let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
3999
- p[1][p[0]] = v[0];
4072
+ p$1[1][p$1[0]] = v[0];
4000
4073
  ptr = v[1];
4001
4074
  }
4002
4075
  ptr = skipVoid(toml, ptr, true);
@@ -4028,8 +4101,8 @@ function formatString(s) {
4028
4101
  return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
4029
4102
  }
4030
4103
  __name(formatString, "formatString");
4031
- function stringifyValue(val, type, depth, numberAsFloat) {
4032
- if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
4104
+ function stringifyValue(val, type, depth$1, numberAsFloat) {
4105
+ if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
4033
4106
  if (type === "number") {
4034
4107
  if (isNaN(val)) return "nan";
4035
4108
  if (val === Infinity) return "inf";
@@ -4043,11 +4116,11 @@ function stringifyValue(val, type, depth, numberAsFloat) {
4043
4116
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
4044
4117
  return val.toISOString();
4045
4118
  }
4046
- if (type === "object") return stringifyInlineTable(val, depth, numberAsFloat);
4047
- if (type === "array") return stringifyArray(val, depth, numberAsFloat);
4119
+ if (type === "object") return stringifyInlineTable(val, depth$1, numberAsFloat);
4120
+ if (type === "array") return stringifyArray(val, depth$1, numberAsFloat);
4048
4121
  }
4049
4122
  __name(stringifyValue, "stringifyValue");
4050
- function stringifyInlineTable(obj, depth, numberAsFloat) {
4123
+ function stringifyInlineTable(obj, depth$1, numberAsFloat) {
4051
4124
  let keys = Object.keys(obj);
4052
4125
  if (keys.length === 0) return "{}";
4053
4126
  let res = "{ ";
@@ -4056,35 +4129,35 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
4056
4129
  if (i$1) res += ", ";
4057
4130
  res += BARE_KEY.test(k) ? k : formatString(k);
4058
4131
  res += " = ";
4059
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
4132
+ res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth$1 - 1, numberAsFloat);
4060
4133
  }
4061
4134
  return res + " }";
4062
4135
  }
4063
4136
  __name(stringifyInlineTable, "stringifyInlineTable");
4064
- function stringifyArray(array, depth, numberAsFloat) {
4137
+ function stringifyArray(array, depth$1, numberAsFloat) {
4065
4138
  if (array.length === 0) return "[]";
4066
4139
  let res = "[ ";
4067
4140
  for (let i$1 = 0; i$1 < array.length; i$1++) {
4068
4141
  if (i$1) res += ", ";
4069
4142
  if (array[i$1] === null || array[i$1] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
4070
- res += stringifyValue(array[i$1], extendedTypeOf(array[i$1]), depth - 1, numberAsFloat);
4143
+ res += stringifyValue(array[i$1], extendedTypeOf(array[i$1]), depth$1 - 1, numberAsFloat);
4071
4144
  }
4072
4145
  return res + " ]";
4073
4146
  }
4074
4147
  __name(stringifyArray, "stringifyArray");
4075
- function stringifyArrayTable(array, key, depth, numberAsFloat) {
4076
- if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
4148
+ function stringifyArrayTable(array, key, depth$1, numberAsFloat) {
4149
+ if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
4077
4150
  let res = "";
4078
4151
  for (let i$1 = 0; i$1 < array.length; i$1++) {
4079
4152
  res += `${res && "\n"}[[${key}]]
4080
4153
  `;
4081
- res += stringifyTable(0, array[i$1], key, depth, numberAsFloat);
4154
+ res += stringifyTable(0, array[i$1], key, depth$1, numberAsFloat);
4082
4155
  }
4083
4156
  return res;
4084
4157
  }
4085
4158
  __name(stringifyArrayTable, "stringifyArrayTable");
4086
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
4087
- if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
4159
+ function stringifyTable(tableKey, obj, prefix, depth$1, numberAsFloat) {
4160
+ if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
4088
4161
  let preamble = "";
4089
4162
  let tables = "";
4090
4163
  let keys = Object.keys(obj);
@@ -4094,14 +4167,14 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
4094
4167
  let type = extendedTypeOf(obj[k]);
4095
4168
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
4096
4169
  let key = BARE_KEY.test(k) ? k : formatString(k);
4097
- if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
4170
+ if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth$1 - 1, numberAsFloat);
4098
4171
  else if (type === "object") {
4099
4172
  let tblKey = prefix ? `${prefix}.${key}` : key;
4100
- tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
4173
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth$1 - 1, numberAsFloat);
4101
4174
  } else {
4102
4175
  preamble += key;
4103
4176
  preamble += " = ";
4104
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
4177
+ preamble += stringifyValue(obj[k], type, depth$1, numberAsFloat);
4105
4178
  preamble += "\n";
4106
4179
  }
4107
4180
  }
@@ -4581,15 +4654,18 @@ function isRedirectedRawConfig(rawConfig, configPath, userConfigPath) {
4581
4654
  __name(isRedirectedRawConfig, "isRedirectedRawConfig");
4582
4655
  function configFormat(configPath) {
4583
4656
  if (configPath?.endsWith("toml")) return "toml";
4584
- else if (configPath?.endsWith("json") || configPath?.endsWith("jsonc")) return "jsonc";
4657
+ if (configPath?.endsWith("jsonc")) return "jsonc";
4658
+ if (configPath?.endsWith("json")) return "json";
4585
4659
  return "none";
4586
4660
  }
4587
4661
  __name(configFormat, "configFormat");
4588
4662
  function configFileName(configPath) {
4589
- const format3 = configFormat(configPath);
4590
- if (format3 === "toml") return "wrangler.toml";
4591
- else if (format3 === "jsonc") return "wrangler.json";
4592
- else return "Wrangler configuration";
4663
+ switch (configFormat(configPath)) {
4664
+ case "toml": return "wrangler.toml";
4665
+ case "json": return "wrangler.json";
4666
+ case "jsonc": return "wrangler.jsonc";
4667
+ default: return "Wrangler configuration";
4668
+ }
4593
4669
  }
4594
4670
  __name(configFileName, "configFileName");
4595
4671
  function formatConfigSnippet(snippet, configPath, formatted = true) {
@@ -4607,10 +4683,10 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
4607
4683
  return typeOf(t$5) === "boolean";
4608
4684
  }
4609
4685
  __name(isBoolean2, "isBoolean");
4610
- function isObject$1(t$5) {
4686
+ function isObject$2(t$5) {
4611
4687
  return typeOf(t$5) === "object";
4612
4688
  }
4613
- __name(isObject$1, "isObject");
4689
+ __name(isObject$2, "isObject");
4614
4690
  function isString2(t$5) {
4615
4691
  return typeOf(t$5) === "string";
4616
4692
  }
@@ -4630,7 +4706,7 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
4630
4706
  return new XDGAppPaths_2(options2);
4631
4707
  }
4632
4708
  __name(XDGAppPaths, "XDGAppPaths");
4633
- var options = isObject$1(options_) ? options_ : { name: options_ };
4709
+ var options = isObject$2(options_) ? options_ : { name: options_ };
4634
4710
  var suffix = (_a = options.suffix) !== null && _a !== void 0 ? _a : "";
4635
4711
  var isolated_ = (_b = options.isolated) !== null && _b !== void 0 ? _b : true;
4636
4712
  var namePriorityList = [
@@ -4699,7 +4775,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4699
4775
  exports$1.__esModule = true;
4700
4776
  exports$1.Adapt = void 0;
4701
4777
  function Adapt(adapter_) {
4702
- var env = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
4778
+ var env$1 = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
4703
4779
  var isMacOS = /^darwin$/i.test(adapter_.process.platform);
4704
4780
  var isWinOS = /^win/i.test(adapter_.process.platform);
4705
4781
  function baseDir() {
@@ -4713,23 +4789,23 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4713
4789
  var linux = /* @__PURE__ */ __name(function() {
4714
4790
  return {
4715
4791
  cache: /* @__PURE__ */ __name(function() {
4716
- return valOrPath(env.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
4792
+ return valOrPath(env$1.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
4717
4793
  }, "cache"),
4718
4794
  config: /* @__PURE__ */ __name(function() {
4719
- return valOrPath(env.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
4795
+ return valOrPath(env$1.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
4720
4796
  }, "config"),
4721
4797
  data: /* @__PURE__ */ __name(function() {
4722
- return valOrPath(env.get("XDG_DATA_HOME"), [
4798
+ return valOrPath(env$1.get("XDG_DATA_HOME"), [
4723
4799
  baseDir(),
4724
4800
  ".local",
4725
4801
  "share"
4726
4802
  ]);
4727
4803
  }, "data"),
4728
4804
  runtime: /* @__PURE__ */ __name(function() {
4729
- return env.get("XDG_RUNTIME_DIR") || void 0;
4805
+ return env$1.get("XDG_RUNTIME_DIR") || void 0;
4730
4806
  }, "runtime"),
4731
4807
  state: /* @__PURE__ */ __name(function() {
4732
- return valOrPath(env.get("XDG_STATE_HOME"), [
4808
+ return valOrPath(env$1.get("XDG_STATE_HOME"), [
4733
4809
  baseDir(),
4734
4810
  ".local",
4735
4811
  "state"
@@ -4740,31 +4816,31 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4740
4816
  var macos = /* @__PURE__ */ __name(function() {
4741
4817
  return {
4742
4818
  cache: /* @__PURE__ */ __name(function() {
4743
- return valOrPath(env.get("XDG_CACHE_HOME"), [
4819
+ return valOrPath(env$1.get("XDG_CACHE_HOME"), [
4744
4820
  baseDir(),
4745
4821
  "Library",
4746
4822
  "Caches"
4747
4823
  ]);
4748
4824
  }, "cache"),
4749
4825
  config: /* @__PURE__ */ __name(function() {
4750
- return valOrPath(env.get("XDG_CONFIG_HOME"), [
4826
+ return valOrPath(env$1.get("XDG_CONFIG_HOME"), [
4751
4827
  baseDir(),
4752
4828
  "Library",
4753
4829
  "Preferences"
4754
4830
  ]);
4755
4831
  }, "config"),
4756
4832
  data: /* @__PURE__ */ __name(function() {
4757
- return valOrPath(env.get("XDG_DATA_HOME"), [
4833
+ return valOrPath(env$1.get("XDG_DATA_HOME"), [
4758
4834
  baseDir(),
4759
4835
  "Library",
4760
4836
  "Application Support"
4761
4837
  ]);
4762
4838
  }, "data"),
4763
4839
  runtime: /* @__PURE__ */ __name(function() {
4764
- return env.get("XDG_RUNTIME_DIR") || void 0;
4840
+ return env$1.get("XDG_RUNTIME_DIR") || void 0;
4765
4841
  }, "runtime"),
4766
4842
  state: /* @__PURE__ */ __name(function() {
4767
- return valOrPath(env.get("XDG_STATE_HOME"), [
4843
+ return valOrPath(env$1.get("XDG_STATE_HOME"), [
4768
4844
  baseDir(),
4769
4845
  "Library",
4770
4846
  "State"
@@ -4774,7 +4850,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4774
4850
  }, "macos");
4775
4851
  var windows = /* @__PURE__ */ __name(function() {
4776
4852
  function appData() {
4777
- return valOrPath(env.get("APPDATA"), [
4853
+ return valOrPath(env$1.get("APPDATA"), [
4778
4854
  baseDir(),
4779
4855
  "AppData",
4780
4856
  "Roaming"
@@ -4782,7 +4858,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4782
4858
  }
4783
4859
  __name(appData, "appData");
4784
4860
  function localAppData() {
4785
- return valOrPath(env.get("LOCALAPPDATA"), [
4861
+ return valOrPath(env$1.get("LOCALAPPDATA"), [
4786
4862
  baseDir(),
4787
4863
  "AppData",
4788
4864
  "Local"
@@ -4791,19 +4867,19 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4791
4867
  __name(localAppData, "localAppData");
4792
4868
  return {
4793
4869
  cache: /* @__PURE__ */ __name(function() {
4794
- return valOrPath(env.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
4870
+ return valOrPath(env$1.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
4795
4871
  }, "cache"),
4796
4872
  config: /* @__PURE__ */ __name(function() {
4797
- return valOrPath(env.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
4873
+ return valOrPath(env$1.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
4798
4874
  }, "config"),
4799
4875
  data: /* @__PURE__ */ __name(function() {
4800
- return valOrPath(env.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
4876
+ return valOrPath(env$1.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
4801
4877
  }, "data"),
4802
4878
  runtime: /* @__PURE__ */ __name(function() {
4803
- return env.get("XDG_RUNTIME_DIR") || void 0;
4879
+ return env$1.get("XDG_RUNTIME_DIR") || void 0;
4804
4880
  }, "runtime"),
4805
4881
  state: /* @__PURE__ */ __name(function() {
4806
- return valOrPath(env.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
4882
+ return valOrPath(env$1.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
4807
4883
  }, "state")
4808
4884
  };
4809
4885
  }, "windows");
@@ -4820,11 +4896,11 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4820
4896
  XDG.runtime = extension.runtime;
4821
4897
  XDG.state = extension.state;
4822
4898
  XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
4823
- var pathList = env.get("XDG_CONFIG_DIRS");
4899
+ var pathList = env$1.get("XDG_CONFIG_DIRS");
4824
4900
  return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
4825
4901
  }, "configDirs");
4826
4902
  XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
4827
- var pathList = env.get("XDG_DATA_DIRS");
4903
+ var pathList = env$1.get("XDG_DATA_DIRS");
4828
4904
  return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
4829
4905
  }, "dataDirs");
4830
4906
  return XDG;
@@ -4848,24 +4924,24 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4848
4924
  }
4849
4925
  __name(isEmpty, "isEmpty");
4850
4926
  function Adapt(adapter_) {
4851
- var env = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
4927
+ var env$1 = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
4852
4928
  var isWinOS = /^win/i.test(adapter_.process.platform);
4853
- function normalizePath(path_) {
4929
+ function normalizePath$1(path_) {
4854
4930
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
4855
4931
  }
4856
- __name(normalizePath, "normalizePath");
4932
+ __name(normalizePath$1, "normalizePath");
4857
4933
  function home() {
4858
4934
  return isWinOS ? (/* @__PURE__ */ __name(function() {
4859
- return normalizePath([
4935
+ return normalizePath$1([
4860
4936
  typeof os2.homedir === "function" ? os2.homedir() : void 0,
4861
- env.get("USERPROFILE"),
4862
- env.get("HOME"),
4863
- env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path5.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
4937
+ env$1.get("USERPROFILE"),
4938
+ env$1.get("HOME"),
4939
+ env$1.get("HOMEDRIVE") || env$1.get("HOMEPATH") ? path5.join(env$1.get("HOMEDRIVE") || "", env$1.get("HOMEPATH") || "") : void 0
4864
4940
  ].find(function(v) {
4865
4941
  return !isEmpty(v);
4866
4942
  }));
4867
4943
  }, "windows"))() : (/* @__PURE__ */ __name(function() {
4868
- return normalizePath((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env.get("HOME"));
4944
+ return normalizePath$1((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env$1.get("HOME"));
4869
4945
  }, "posix"))();
4870
4946
  }
4871
4947
  __name(home, "home");
@@ -4874,29 +4950,29 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4874
4950
  return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
4875
4951
  }
4876
4952
  __name(joinPathToBase, "joinPathToBase");
4877
- function posix() {
4878
- return normalizePath([
4953
+ function posix$1() {
4954
+ return normalizePath$1([
4879
4955
  typeof os2.tmpdir === "function" ? os2.tmpdir() : void 0,
4880
- env.get("TMPDIR"),
4881
- env.get("TEMP"),
4882
- env.get("TMP")
4956
+ env$1.get("TMPDIR"),
4957
+ env$1.get("TEMP"),
4958
+ env$1.get("TMP")
4883
4959
  ].find(function(v) {
4884
4960
  return !isEmpty(v);
4885
4961
  })) || "/tmp";
4886
4962
  }
4887
- __name(posix, "posix");
4963
+ __name(posix$1, "posix");
4888
4964
  function windows() {
4889
4965
  var fallback = "C:\\Temp";
4890
4966
  var v = [
4891
4967
  typeof os2.tmpdir === "function" ? os2.tmpdir : function() {},
4892
4968
  function() {
4893
- return env.get("TEMP");
4969
+ return env$1.get("TEMP");
4894
4970
  },
4895
4971
  function() {
4896
- return env.get("TMP");
4972
+ return env$1.get("TMP");
4897
4973
  },
4898
4974
  function() {
4899
- return joinPathToBase(env.get("LOCALAPPDATA"), ["Temp"]);
4975
+ return joinPathToBase(env$1.get("LOCALAPPDATA"), ["Temp"]);
4900
4976
  },
4901
4977
  function() {
4902
4978
  return joinPathToBase(home(), [
@@ -4906,24 +4982,24 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4906
4982
  ]);
4907
4983
  },
4908
4984
  function() {
4909
- return joinPathToBase(env.get("ALLUSERSPROFILE"), ["Temp"]);
4985
+ return joinPathToBase(env$1.get("ALLUSERSPROFILE"), ["Temp"]);
4910
4986
  },
4911
4987
  function() {
4912
- return joinPathToBase(env.get("SystemRoot"), ["Temp"]);
4988
+ return joinPathToBase(env$1.get("SystemRoot"), ["Temp"]);
4913
4989
  },
4914
4990
  function() {
4915
- return joinPathToBase(env.get("windir"), ["Temp"]);
4991
+ return joinPathToBase(env$1.get("windir"), ["Temp"]);
4916
4992
  },
4917
4993
  function() {
4918
- return joinPathToBase(env.get("SystemDrive"), ["\\", "Temp"]);
4994
+ return joinPathToBase(env$1.get("SystemDrive"), ["\\", "Temp"]);
4919
4995
  }
4920
4996
  ].find(function(v2) {
4921
4997
  return v2 && !isEmpty(v2());
4922
4998
  });
4923
- return v && normalizePath(v()) || fallback;
4999
+ return v && normalizePath$1(v()) || fallback;
4924
5000
  }
4925
5001
  __name(windows, "windows");
4926
- return isWinOS ? windows() : posix();
5002
+ return isWinOS ? windows() : posix$1();
4927
5003
  }
4928
5004
  __name(temp, "temp");
4929
5005
  return { OSPaths: new (/* @__PURE__ */ function() {
@@ -4944,7 +5020,7 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4944
5020
  exports$1.Adapt = Adapt;
4945
5021
  } });
4946
5022
  var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/platform-adapters/node.js"(exports$1) {
4947
- var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
5023
+ var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
4948
5024
  if (k2 === void 0) k2 = k;
4949
5025
  Object.defineProperty(o, k2, {
4950
5026
  enumerable: true,
@@ -4956,7 +5032,7 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
4956
5032
  if (k2 === void 0) k2 = k;
4957
5033
  o[k2] = m[k];
4958
5034
  });
4959
- var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5035
+ var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
4960
5036
  Object.defineProperty(o, "default", {
4961
5037
  enumerable: true,
4962
5038
  value: v
@@ -4964,19 +5040,19 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
4964
5040
  } : function(o, v) {
4965
5041
  o["default"] = v;
4966
5042
  });
4967
- var __importStar = exports$1 && exports$1.__importStar || function(mod) {
5043
+ var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
4968
5044
  if (mod && mod.__esModule) return mod;
4969
5045
  var result = {};
4970
5046
  if (mod != null) {
4971
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5047
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
4972
5048
  }
4973
- __setModuleDefault(result, mod);
5049
+ __setModuleDefault$1(result, mod);
4974
5050
  return result;
4975
5051
  };
4976
5052
  exports$1.__esModule = true;
4977
5053
  exports$1.adapter = void 0;
4978
- var os2 = __importStar(__require("os"));
4979
- var path5 = __importStar(__require("path"));
5054
+ var os2 = __importStar$1(__require("os"));
5055
+ var path5 = __importStar$1(__require("path"));
4980
5056
  exports$1.adapter = {
4981
5057
  atImportPermissions: { env: true },
4982
5058
  env: { get: /* @__PURE__ */ __name(function(s) {
@@ -4993,7 +5069,7 @@ var require_mod_cjs = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4993
5069
  module$2.exports = OSPaths_js_1.Adapt(node_js_1.adapter).OSPaths;
4994
5070
  } });
4995
5071
  var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/platform-adapters/node.js"(exports$1) {
4996
- var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
5072
+ var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
4997
5073
  if (k2 === void 0) k2 = k;
4998
5074
  Object.defineProperty(o, k2, {
4999
5075
  enumerable: true,
@@ -5005,7 +5081,7 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
5005
5081
  if (k2 === void 0) k2 = k;
5006
5082
  o[k2] = m[k];
5007
5083
  });
5008
- var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5084
+ var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5009
5085
  Object.defineProperty(o, "default", {
5010
5086
  enumerable: true,
5011
5087
  value: v
@@ -5013,22 +5089,22 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
5013
5089
  } : function(o, v) {
5014
5090
  o["default"] = v;
5015
5091
  });
5016
- var __importStar = exports$1 && exports$1.__importStar || function(mod) {
5092
+ var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
5017
5093
  if (mod && mod.__esModule) return mod;
5018
5094
  var result = {};
5019
5095
  if (mod != null) {
5020
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5096
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
5021
5097
  }
5022
- __setModuleDefault(result, mod);
5098
+ __setModuleDefault$1(result, mod);
5023
5099
  return result;
5024
5100
  };
5025
- var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
5101
+ var __importDefault$2 = exports$1 && exports$1.__importDefault || function(mod) {
5026
5102
  return mod && mod.__esModule ? mod : { "default": mod };
5027
5103
  };
5028
5104
  exports$1.__esModule = true;
5029
5105
  exports$1.adapter = void 0;
5030
- var path5 = __importStar(__require("path"));
5031
- var os_paths_1 = __importDefault(require_mod_cjs());
5106
+ var path5 = __importStar$1(__require("path"));
5107
+ var os_paths_1 = __importDefault$2(require_mod_cjs());
5032
5108
  exports$1.adapter = {
5033
5109
  atImportPermissions: { env: true },
5034
5110
  env: { get: /* @__PURE__ */ __name(function(s) {
@@ -5045,7 +5121,7 @@ var require_mod_cjs2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.
5045
5121
  module$2.exports = XDG_js_1.Adapt(node_js_1.adapter).XDG;
5046
5122
  } });
5047
5123
  var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/platform-adapters/node.js"(exports$1) {
5048
- var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
5124
+ var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
5049
5125
  if (k2 === void 0) k2 = k;
5050
5126
  Object.defineProperty(o, k2, {
5051
5127
  enumerable: true,
@@ -5057,7 +5133,7 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
5057
5133
  if (k2 === void 0) k2 = k;
5058
5134
  o[k2] = m[k];
5059
5135
  });
5060
- var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5136
+ var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5061
5137
  Object.defineProperty(o, "default", {
5062
5138
  enumerable: true,
5063
5139
  value: v
@@ -5065,22 +5141,22 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
5065
5141
  } : function(o, v) {
5066
5142
  o["default"] = v;
5067
5143
  });
5068
- var __importStar = exports$1 && exports$1.__importStar || function(mod) {
5144
+ var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
5069
5145
  if (mod && mod.__esModule) return mod;
5070
5146
  var result = {};
5071
5147
  if (mod != null) {
5072
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5148
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
5073
5149
  }
5074
- __setModuleDefault(result, mod);
5150
+ __setModuleDefault$1(result, mod);
5075
5151
  return result;
5076
5152
  };
5077
- var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
5153
+ var __importDefault$2 = exports$1 && exports$1.__importDefault || function(mod) {
5078
5154
  return mod && mod.__esModule ? mod : { "default": mod };
5079
5155
  };
5080
5156
  exports$1.__esModule = true;
5081
5157
  exports$1.adapter = void 0;
5082
- var path5 = __importStar(__require("path"));
5083
- var xdg_portable_1 = __importDefault(require_mod_cjs2());
5158
+ var path5 = __importStar$1(__require("path"));
5159
+ var xdg_portable_1 = __importDefault$2(require_mod_cjs2());
5084
5160
  exports$1.adapter = {
5085
5161
  atImportPermissions: {
5086
5162
  env: true,
@@ -5842,7 +5918,7 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
5842
5918
  const isRedirectedConfig = isRedirectedRawConfig(rawConfig, configPath, userConfigPath);
5843
5919
  const definedEnvironments = Object.keys(rawConfig.env ?? {});
5844
5920
  if (isRedirectedConfig && definedEnvironments.length > 0) diagnostics.errors.push(dedent`
5845
- Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env) => ` - ${env}`).join("\n")}
5921
+ Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env$1) => ` - ${env$1}`).join("\n")}
5846
5922
 
5847
5923
 
5848
5924
  Such configurations are generated by tools, meaning that one of the tools
@@ -6210,7 +6286,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6210
6286
  const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
6211
6287
  const workers_dev = inheritable(diagnostics, topLevelEnv, rawEnv, "workers_dev", isBoolean, void 0);
6212
6288
  const preview_urls = inheritable(diagnostics, topLevelEnv, rawEnv, "preview_urls", isBoolean, void 0);
6213
- const build = normalizeAndValidateBuild(diagnostics, rawEnv, rawEnv.build ?? topLevelEnv?.build ?? {}, configPath);
6289
+ const build$8 = normalizeAndValidateBuild(diagnostics, rawEnv, rawEnv.build ?? topLevelEnv?.build ?? {}, configPath);
6214
6290
  const environment = {
6215
6291
  account_id,
6216
6292
  compatibility_date: inheritable(diagnostics, topLevelEnv, rawEnv, "compatibility_date", validateCompatibilityDate, void 0),
@@ -6230,7 +6306,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6230
6306
  assets: normalizeAndValidateAssets(diagnostics, topLevelEnv, rawEnv),
6231
6307
  limits: normalizeAndValidateLimits(diagnostics, topLevelEnv, rawEnv),
6232
6308
  placement: normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv),
6233
- build,
6309
+ build: build$8,
6234
6310
  workers_dev,
6235
6311
  preview_urls,
6236
6312
  vars: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vars", validateVars(envName), {}),
@@ -7687,6 +7763,47 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
7687
7763
  }
7688
7764
  __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
7689
7765
 
7766
+ //#endregion
7767
+ //#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
7768
+ function isPlainObject(value) {
7769
+ if (value === null || typeof value !== "object") return false;
7770
+ const prototype = Object.getPrototypeOf(value);
7771
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
7772
+ if (Symbol.iterator in value) return false;
7773
+ if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
7774
+ return true;
7775
+ }
7776
+ function _defu(baseObject, defaults, namespace = ".", merger) {
7777
+ if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
7778
+ const object = Object.assign({}, defaults);
7779
+ for (const key in baseObject) {
7780
+ if (key === "__proto__" || key === "constructor") continue;
7781
+ const value = baseObject[key];
7782
+ if (value === null || value === void 0) continue;
7783
+ if (merger && merger(object, key, value, namespace)) continue;
7784
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
7785
+ else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
7786
+ else object[key] = value;
7787
+ }
7788
+ return object;
7789
+ }
7790
+ function createDefu(merger) {
7791
+ return (...arguments_) => arguments_.reduce((p$1, c) => _defu(p$1, c, "", merger), {});
7792
+ }
7793
+ const defu = createDefu();
7794
+ const defuFn = createDefu((object, key, currentValue) => {
7795
+ if (object[key] !== void 0 && typeof currentValue === "function") {
7796
+ object[key] = currentValue(object[key]);
7797
+ return true;
7798
+ }
7799
+ });
7800
+ const defuArrayFn = createDefu((object, key, currentValue) => {
7801
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
7802
+ object[key] = currentValue(object[key]);
7803
+ return true;
7804
+ }
7805
+ });
7806
+
7690
7807
  //#endregion
7691
7808
  //#region src/deploy-config.ts
7692
7809
  function getDeployConfigPath(root) {
@@ -8905,10 +9022,10 @@ var Position = function Position$1(line, col) {
8905
9022
  Position.prototype.offset = function offset(n$1) {
8906
9023
  return new Position(this.line, this.column + n$1);
8907
9024
  };
8908
- var SourceLocation = function SourceLocation$1(p, start, end) {
9025
+ var SourceLocation = function SourceLocation$1(p$1, start, end) {
8909
9026
  this.start = start;
8910
9027
  this.end = end;
8911
- if (p.sourceFile !== null) this.source = p.sourceFile;
9028
+ if (p$1.sourceFile !== null) this.source = p$1.sourceFile;
8912
9029
  };
8913
9030
  function getLineInfo(input, offset) {
8914
9031
  for (var line = 1, cur = 0;;) {
@@ -9035,7 +9152,7 @@ var prototypeAccessors = {
9035
9152
  allowNewDotTarget: { configurable: true },
9036
9153
  inClassStaticBlock: { configurable: true }
9037
9154
  };
9038
- Parser.prototype.parse = function parse$8() {
9155
+ Parser.prototype.parse = function parse$10() {
9039
9156
  var node = this.options.program || this.startNode();
9040
9157
  this.nextToken();
9041
9158
  return this.parseTopLevel(node);
@@ -9085,7 +9202,7 @@ Parser.extend = function extend() {
9085
9202
  for (var i$1 = 0; i$1 < plugins.length; i$1++) cls = plugins[i$1](cls);
9086
9203
  return cls;
9087
9204
  };
9088
- Parser.parse = function parse$8(input, options) {
9205
+ Parser.parse = function parse$10(input, options) {
9089
9206
  return new this(options, input).parse();
9090
9207
  };
9091
9208
  Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
@@ -9424,7 +9541,7 @@ pp$8.parseThrowStatement = function(node) {
9424
9541
  this.semicolon();
9425
9542
  return this.finishNode(node, "ThrowStatement");
9426
9543
  };
9427
- var empty$1 = [];
9544
+ var empty$1$1 = [];
9428
9545
  pp$8.parseCatchClauseParam = function() {
9429
9546
  var param = this.parseBindingAtom();
9430
9547
  var simple = param.type === "Identifier";
@@ -9878,7 +9995,7 @@ pp$8.parseExportSpecifiers = function(exports$1) {
9878
9995
  pp$8.parseImport = function(node) {
9879
9996
  this.next();
9880
9997
  if (this.type === types$1$1.string) {
9881
- node.specifiers = empty$1;
9998
+ node.specifiers = empty$1$1;
9882
9999
  node.source = this.parseExprAtom();
9883
10000
  } else {
9884
10001
  node.specifiers = this.parseImportSpecifiers();
@@ -10169,8 +10286,8 @@ var types$2 = {
10169
10286
  b_tmpl: new TokContext("${", false),
10170
10287
  p_stat: new TokContext("(", false),
10171
10288
  p_expr: new TokContext("(", true),
10172
- q_tmpl: new TokContext("`", true, true, function(p) {
10173
- return p.tryReadTemplateToken();
10289
+ q_tmpl: new TokContext("`", true, true, function(p$1) {
10290
+ return p$1.tryReadTemplateToken();
10174
10291
  }),
10175
10292
  f_stat: new TokContext("function", false),
10176
10293
  f_expr: new TokContext("function", true),
@@ -10714,7 +10831,7 @@ pp$5.parseParenItem = function(item) {
10714
10831
  pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
10715
10832
  return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit);
10716
10833
  };
10717
- var empty = [];
10834
+ var empty$3 = [];
10718
10835
  pp$5.parseNew = function() {
10719
10836
  if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword new");
10720
10837
  var node = this.startNode();
@@ -10734,7 +10851,7 @@ pp$5.parseNew = function() {
10734
10851
  var startPos = this.start, startLoc = this.startLoc;
10735
10852
  node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
10736
10853
  if (this.eat(types$1$1.parenL)) node.arguments = this.parseExprList(types$1$1.parenR, this.options.ecmaVersion >= 8, false);
10737
- else node.arguments = empty;
10854
+ else node.arguments = empty$3;
10738
10855
  return this.finishNode(node, "NewExpression");
10739
10856
  };
10740
10857
  pp$5.parseTemplateElement = function(ref$1) {
@@ -12092,13 +12209,13 @@ pp$1.regexp_eatFixedHexDigits = function(state, length) {
12092
12209
  }
12093
12210
  return true;
12094
12211
  };
12095
- var Token = function Token$1(p) {
12096
- this.type = p.type;
12097
- this.value = p.value;
12098
- this.start = p.start;
12099
- this.end = p.end;
12100
- if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
12101
- if (p.options.ranges) this.range = [p.start, p.end];
12212
+ var Token = function Token$1(p$1) {
12213
+ this.type = p$1.type;
12214
+ this.value = p$1.value;
12215
+ this.start = p$1.start;
12216
+ this.end = p$1.end;
12217
+ if (p$1.options.locations) this.loc = new SourceLocation(p$1, p$1.startLoc, p$1.endLoc);
12218
+ if (p$1.options.ranges) this.range = [p$1.start, p$1.end];
12102
12219
  };
12103
12220
  var pp = Parser.prototype;
12104
12221
  pp.next = function(ignoreEscapeSequenceInKeyword) {
@@ -12721,15 +12838,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
12721
12838
  function withTrailingSlash$1(input = "", respectQueryAndFragment) {
12722
12839
  if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
12723
12840
  if (hasTrailingSlash(input, true)) return input || "/";
12724
- let path = input;
12841
+ let path$1 = input;
12725
12842
  let fragment = "";
12726
12843
  const fragmentIndex = input.indexOf("#");
12727
12844
  if (fragmentIndex >= 0) {
12728
- path = input.slice(0, fragmentIndex);
12845
+ path$1 = input.slice(0, fragmentIndex);
12729
12846
  fragment = input.slice(fragmentIndex);
12730
- if (!path) return fragment;
12847
+ if (!path$1) return fragment;
12731
12848
  }
12732
- const [s0, ...s] = path.split("?");
12849
+ const [s0, ...s] = path$1.split("?");
12733
12850
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
12734
12851
  }
12735
12852
  function isNonEmptyURL(url) {
@@ -12748,15 +12865,15 @@ const protocolRelative = Symbol.for("ufo:protocolRelative");
12748
12865
  //#endregion
12749
12866
  //#region ../../node_modules/.pnpm/pathe@2.0.1/node_modules/pathe/dist/shared/pathe.BLwDEnA5.mjs
12750
12867
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
12751
- const isAbsolute = function(p) {
12752
- return _IS_ABSOLUTE_RE.test(p);
12868
+ const isAbsolute = function(p$1) {
12869
+ return _IS_ABSOLUTE_RE.test(p$1);
12753
12870
  };
12754
12871
 
12755
12872
  //#endregion
12756
12873
  //#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
12757
12874
  const BUILTIN_MODULES = new Set(builtinModules);
12758
- function normalizeSlash(path) {
12759
- return path.replace(/\\/g, "/");
12875
+ function normalizeSlash(path$1) {
12876
+ return path$1.replace(/\\/g, "/");
12760
12877
  }
12761
12878
  /**
12762
12879
  * @typedef ErrnoExceptionFields
@@ -12876,8 +12993,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
12876
12993
  * @param {string} [base]
12877
12994
  * @param {string} [message]
12878
12995
  */
12879
- (path, base, message) => {
12880
- return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
12996
+ (path$1, base, message) => {
12997
+ return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
12881
12998
  },
12882
12999
  Error
12883
13000
  );
@@ -12907,8 +13024,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
12907
13024
  * @param {string} base
12908
13025
  * @param {boolean} [exactUrl]
12909
13026
  */
12910
- (path, base, exactUrl = false) => {
12911
- return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
13027
+ (path$1, base, exactUrl = false) => {
13028
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`;
12912
13029
  },
12913
13030
  Error
12914
13031
  );
@@ -12946,8 +13063,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
12946
13063
  * @param {string} extension
12947
13064
  * @param {string} path
12948
13065
  */
12949
- (extension, path) => {
12950
- return `Unknown file extension "${extension}" for ${path}`;
13066
+ (extension, path$1) => {
13067
+ return `Unknown file extension "${extension}" for ${path$1}`;
12951
13068
  },
12952
13069
  TypeError
12953
13070
  );
@@ -13316,9 +13433,9 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
13316
13433
  * @param {string} path
13317
13434
  * @returns {Stats | undefined}
13318
13435
  */
13319
- function tryStatSync(path) {
13436
+ function tryStatSync(path$1) {
13320
13437
  try {
13321
- return statSync(path);
13438
+ return statSync(path$1);
13322
13439
  } catch {}
13323
13440
  }
13324
13441
  /**
@@ -13932,12 +14049,12 @@ var NodeJsCompat = class {
13932
14049
  */
13933
14050
  #virtualModulePathToSpecifier;
13934
14051
  constructor(workerConfig) {
13935
- const { env } = defineEnv({ presets: [getCloudflarePreset({
14052
+ const { env: env$1 } = defineEnv({ presets: [getCloudflarePreset({
13936
14053
  compatibilityDate: workerConfig.compatibility_date,
13937
14054
  compatibilityFlags: workerConfig.compatibility_flags
13938
14055
  })] });
13939
- this.#env = env;
13940
- this.externals = new Set(env.external);
14056
+ this.#env = env$1;
14057
+ this.externals = new Set(env$1.external);
13941
14058
  this.entries = this.#getEntries();
13942
14059
  const { injectsByModule, virtualModulePathToSpecifier } = this.#getInjects();
13943
14060
  this.#injectsByModule = injectsByModule;
@@ -14129,14 +14246,14 @@ const nullableNonApplicable = [
14129
14246
  "site",
14130
14247
  "tsconfig"
14131
14248
  ];
14132
- function readWorkerConfig(configPath, env) {
14249
+ function readWorkerConfig(configPath, env$1) {
14133
14250
  const nonApplicable = {
14134
14251
  replacedByVite: /* @__PURE__ */ new Set(),
14135
14252
  notRelevant: /* @__PURE__ */ new Set()
14136
14253
  };
14137
14254
  const config = wrangler.unstable_readConfig({
14138
14255
  config: configPath,
14139
- env
14256
+ env: env$1
14140
14257
  }, { preserveOriginalMain: true });
14141
14258
  const raw = structuredClone(config);
14142
14259
  nullableNonApplicable.forEach((prop) => {
@@ -14196,15 +14313,15 @@ function isReplacedByVite(configName) {
14196
14313
  function isNotRelevant(configName) {
14197
14314
  return nonApplicableWorkerConfigs.notRelevant.includes(configName);
14198
14315
  }
14199
- function missingFieldErrorMessage(field, configPath, env) {
14200
- return `No '${field}' field provided${configPath ? ` in '${configPath}'` : ""}${env ? ` for '${env}' environment` : ""}`;
14316
+ function missingFieldErrorMessage(field, configPath, env$1) {
14317
+ return `No '${field}' field provided${configPath ? ` in '${configPath}'` : ""}${env$1 ? ` for '${env$1}' environment` : ""}`;
14201
14318
  }
14202
14319
  /**
14203
14320
  * Reads and sanitizes a worker config from a wrangler config file.
14204
14321
  */
14205
- function readWorkerConfigFromFile(configPath, env, opts) {
14322
+ function readWorkerConfigFromFile(configPath, env$1, opts) {
14206
14323
  if (opts?.visitedConfigPaths?.has(configPath)) throw new Error(`Duplicate Wrangler config path found: ${configPath}`);
14207
- const result = readWorkerConfig(configPath, env);
14324
+ const result = readWorkerConfig(configPath, env$1);
14208
14325
  opts?.visitedConfigPaths?.add(configPath);
14209
14326
  return result;
14210
14327
  }
@@ -14389,9 +14506,17 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14389
14506
  };
14390
14507
  const entryWorkerConfig = entryWorkerResolvedConfig.config;
14391
14508
  const entryWorkerEnvironmentName = pluginConfig.viteEnvironment?.name ?? workerNameToEnvironmentName(entryWorkerConfig.topLevelName);
14509
+ const validateAndAddEnvironmentName = createEnvironmentNameValidator();
14510
+ validateAndAddEnvironmentName(entryWorkerEnvironmentName);
14392
14511
  let staticRouting;
14393
14512
  if (Array.isArray(entryWorkerConfig.assets?.run_worker_first)) staticRouting = parseStaticRouting(entryWorkerConfig.assets.run_worker_first);
14394
14513
  const environmentNameToWorkerMap = new Map([[entryWorkerEnvironmentName, resolveWorker(entryWorkerConfig)]]);
14514
+ const environmentNameToChildEnvironmentNamesMap = /* @__PURE__ */ new Map();
14515
+ const entryWorkerChildEnvironments = pluginConfig.viteEnvironment?.childEnvironments;
14516
+ if (entryWorkerChildEnvironments) {
14517
+ for (const childName of entryWorkerChildEnvironments) validateAndAddEnvironmentName(childName);
14518
+ environmentNameToChildEnvironmentNamesMap.set(entryWorkerEnvironmentName, entryWorkerChildEnvironments);
14519
+ }
14395
14520
  const auxiliaryWorkersResolvedConfigs = [];
14396
14521
  for (const auxiliaryWorker of pluginConfig.auxiliaryWorkers ?? []) {
14397
14522
  const workerResolvedConfig = resolveWorkerConfig({
@@ -14404,8 +14529,13 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14404
14529
  });
14405
14530
  auxiliaryWorkersResolvedConfigs.push(workerResolvedConfig);
14406
14531
  const workerEnvironmentName = auxiliaryWorker.viteEnvironment?.name ?? workerNameToEnvironmentName(workerResolvedConfig.config.topLevelName);
14407
- if (environmentNameToWorkerMap.has(workerEnvironmentName)) throw new Error(`Duplicate Vite environment name found: ${workerEnvironmentName}`);
14532
+ validateAndAddEnvironmentName(workerEnvironmentName);
14408
14533
  environmentNameToWorkerMap.set(workerEnvironmentName, resolveWorker(workerResolvedConfig.config));
14534
+ const auxiliaryWorkerChildEnvironments = auxiliaryWorker.viteEnvironment?.childEnvironments;
14535
+ if (auxiliaryWorkerChildEnvironments) {
14536
+ for (const childName of auxiliaryWorkerChildEnvironments) validateAndAddEnvironmentName(childName);
14537
+ environmentNameToChildEnvironmentNamesMap.set(workerEnvironmentName, auxiliaryWorkerChildEnvironments);
14538
+ }
14409
14539
  }
14410
14540
  return {
14411
14541
  ...shared,
@@ -14413,6 +14543,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14413
14543
  cloudflareEnv,
14414
14544
  configPaths,
14415
14545
  environmentNameToWorkerMap,
14546
+ environmentNameToChildEnvironmentNamesMap,
14416
14547
  entryWorkerEnvironmentName,
14417
14548
  staticRouting,
14418
14549
  remoteBindings: pluginConfig.remoteBindings ?? true,
@@ -14425,6 +14556,14 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14425
14556
  function workerNameToEnvironmentName(workerName) {
14426
14557
  return workerName.replaceAll("-", "_");
14427
14558
  }
14559
+ function createEnvironmentNameValidator() {
14560
+ const usedNames = /* @__PURE__ */ new Set();
14561
+ return (name) => {
14562
+ if (name === "client") throw new Error(`"client" is a reserved Vite environment name`);
14563
+ if (usedNames.has(name)) throw new Error(`Duplicate Vite environment name: "${name}"`);
14564
+ usedNames.add(name);
14565
+ };
14566
+ }
14428
14567
  function resolveWorker(workerConfig) {
14429
14568
  return {
14430
14569
  config: workerConfig,
@@ -14685,7 +14824,7 @@ function guessIndent(code) {
14685
14824
  }, Infinity);
14686
14825
  return new Array(min + 1).join(" ");
14687
14826
  }
14688
- function getRelativePath(from, to) {
14827
+ function getRelativePath$1(from, to) {
14689
14828
  const fromParts = from.split(/[/\\]/);
14690
14829
  const toParts = to.split(/[/\\]/);
14691
14830
  fromParts.pop();
@@ -14700,7 +14839,7 @@ function getRelativePath(from, to) {
14700
14839
  return fromParts.concat(toParts).join("/");
14701
14840
  }
14702
14841
  const toString = Object.prototype.toString;
14703
- function isObject(thing) {
14842
+ function isObject$1(thing) {
14704
14843
  return toString.call(thing) === "[object Object]";
14705
14844
  }
14706
14845
  function getLocator(source) {
@@ -14965,7 +15104,7 @@ var MagicString = class MagicString {
14965
15104
  });
14966
15105
  return {
14967
15106
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
14968
- sources: [options.source ? getRelativePath(options.file || "", options.source) : options.file || ""],
15107
+ sources: [options.source ? getRelativePath$1(options.file || "", options.source) : options.file || ""],
14969
15108
  sourcesContent: options.includeContent ? [this.original] : void 0,
14970
15109
  names,
14971
15110
  mappings: mappings.raw,
@@ -14988,7 +15127,7 @@ var MagicString = class MagicString {
14988
15127
  }
14989
15128
  indent(indentStr, options) {
14990
15129
  const pattern = /^[^\r\n]/gm;
14991
- if (isObject(indentStr)) {
15130
+ if (isObject$1(indentStr)) {
14992
15131
  options = indentStr;
14993
15132
  indentStr = void 0;
14994
15133
  }
@@ -15596,9 +15735,9 @@ function constructHeaders({ headers, headersFile, logger }) {
15596
15735
 
15597
15736
  //#endregion
15598
15737
  //#region ../workers-shared/utils/configuration/validateURL.ts
15599
- const extractPathname = (path = "/", includeSearch, includeHash) => {
15600
- if (!path.startsWith("/")) path = `/${path}`;
15601
- const url = new URL(`//${path}`, "relative://");
15738
+ const extractPathname = (path$1 = "/", includeSearch, includeHash) => {
15739
+ if (!path$1.startsWith("/")) path$1 = `/${path$1}`;
15740
+ const url = new URL(`//${path$1}`, "relative://");
15602
15741
  return `${url.pathname}${includeSearch ? url.search : ""}${includeHash ? url.hash : ""}`;
15603
15742
  };
15604
15743
  const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
@@ -15655,7 +15794,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
15655
15794
  lineNumber: i$1 + 1,
15656
15795
  message: "No headers specified"
15657
15796
  });
15658
- const [path, pathError] = validateUrl(line, false, true);
15797
+ const [path$1, pathError] = validateUrl(line, false, true);
15659
15798
  if (pathError) {
15660
15799
  invalid.push({
15661
15800
  line,
@@ -15666,7 +15805,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
15666
15805
  continue;
15667
15806
  }
15668
15807
  rule = {
15669
- path,
15808
+ path: path$1,
15670
15809
  line,
15671
15810
  headers: {},
15672
15811
  unsetHeaders: []
@@ -15745,7 +15884,7 @@ function isValidRule(rule) {
15745
15884
 
15746
15885
  //#endregion
15747
15886
  //#region ../workers-shared/utils/configuration/parseRedirects.ts
15748
- function parseRedirects(input, { maxStaticRules = MAX_STATIC_REDIRECT_RULES, maxDynamicRules = MAX_DYNAMIC_REDIRECT_RULES, maxLineLength = MAX_LINE_LENGTH } = {}) {
15887
+ function parseRedirects(input, { htmlHandling = void 0, maxStaticRules = MAX_STATIC_REDIRECT_RULES, maxDynamicRules = MAX_DYNAMIC_REDIRECT_RULES, maxLineLength = MAX_LINE_LENGTH } = {}) {
15749
15888
  const lines = input.split("\n");
15750
15889
  const rules = [];
15751
15890
  const seen_paths = /* @__PURE__ */ new Set();
@@ -15813,7 +15952,10 @@ function parseRedirects(input, { maxStaticRules = MAX_STATIC_REDIRECT_RULES, max
15813
15952
  });
15814
15953
  continue;
15815
15954
  }
15816
- if (/\/\*?$/.test(from) && /\/index(.html)?$/.test(to) && !urlHasHost(to)) {
15955
+ const hasRelativePath = !urlHasHost(to);
15956
+ const hasWildcardToIndex = /\/\*$/.test(from) && /\/index(.html)?$/.test(to);
15957
+ const hasRootToIndex = /\/$/.test(from) && /\/index(.html)?$/.test(to);
15958
+ if (hasRelativePath && (hasWildcardToIndex || hasRootToIndex && htmlHandling !== "none")) {
15817
15959
  invalid.push({
15818
15960
  line,
15819
15961
  lineNumber: i$1 + 1,
@@ -15931,7 +16073,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
15931
16073
  };
15932
16074
  const isString$1 = (subject) => typeof subject === "string";
15933
16075
  const checkPattern = (pattern) => pattern && isString$1(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
15934
- const splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
16076
+ const splitPattern$1 = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
15935
16077
  var IgnoreRule = class {
15936
16078
  constructor(origin, pattern, negative, regex) {
15937
16079
  this.origin = origin;
@@ -15954,15 +16096,15 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
15954
16096
  const throwError = (message, Ctor) => {
15955
16097
  throw new Ctor(message);
15956
16098
  };
15957
- const checkPath = (path, originalPath, doThrow) => {
15958
- if (!isString$1(path)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
15959
- if (!path) return doThrow(`path must not be empty`, TypeError);
15960
- if (checkPath.isNotRelative(path)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
16099
+ const checkPath = (path$1, originalPath, doThrow) => {
16100
+ if (!isString$1(path$1)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
16101
+ if (!path$1) return doThrow(`path must not be empty`, TypeError);
16102
+ if (checkPath.isNotRelative(path$1)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
15961
16103
  return true;
15962
16104
  };
15963
- const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
16105
+ const isNotRelative = (path$1) => REGEX_TEST_INVALID_PATH.test(path$1);
15964
16106
  checkPath.isNotRelative = isNotRelative;
15965
- checkPath.convert = (p) => p;
16107
+ checkPath.convert = (p$1) => p$1;
15966
16108
  var Ignore = class {
15967
16109
  constructor({ ignorecase = true, ignoreCase = ignorecase, allowRelativePaths = false } = {}) {
15968
16110
  define(this, KEY_IGNORE, true);
@@ -15989,20 +16131,20 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
15989
16131
  }
15990
16132
  add(pattern) {
15991
16133
  this._added = false;
15992
- makeArray(isString$1(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
16134
+ makeArray(isString$1(pattern) ? splitPattern$1(pattern) : pattern).forEach(this._addPattern, this);
15993
16135
  if (this._added) this._initCache();
15994
16136
  return this;
15995
16137
  }
15996
16138
  addPattern(pattern) {
15997
16139
  return this.add(pattern);
15998
16140
  }
15999
- _testOne(path, checkUnignored) {
16141
+ _testOne(path$1, checkUnignored) {
16000
16142
  let ignored = false;
16001
16143
  let unignored = false;
16002
16144
  this._rules.forEach((rule) => {
16003
16145
  const { negative } = rule;
16004
16146
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
16005
- if (rule.regex.test(path)) {
16147
+ if (rule.regex.test(path$1)) {
16006
16148
  ignored = !negative;
16007
16149
  unignored = negative;
16008
16150
  }
@@ -16013,33 +16155,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
16013
16155
  };
16014
16156
  }
16015
16157
  _test(originalPath, cache$2, checkUnignored, slices) {
16016
- const path = originalPath && checkPath.convert(originalPath);
16017
- checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
16018
- return this._t(path, cache$2, checkUnignored, slices);
16158
+ const path$1 = originalPath && checkPath.convert(originalPath);
16159
+ checkPath(path$1, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
16160
+ return this._t(path$1, cache$2, checkUnignored, slices);
16019
16161
  }
16020
- _t(path, cache$2, checkUnignored, slices) {
16021
- if (path in cache$2) return cache$2[path];
16022
- if (!slices) slices = path.split(SLASH);
16162
+ _t(path$1, cache$2, checkUnignored, slices) {
16163
+ if (path$1 in cache$2) return cache$2[path$1];
16164
+ if (!slices) slices = path$1.split(SLASH);
16023
16165
  slices.pop();
16024
- if (!slices.length) return cache$2[path] = this._testOne(path, checkUnignored);
16166
+ if (!slices.length) return cache$2[path$1] = this._testOne(path$1, checkUnignored);
16025
16167
  const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
16026
- return cache$2[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
16168
+ return cache$2[path$1] = parent.ignored ? parent : this._testOne(path$1, checkUnignored);
16027
16169
  }
16028
- ignores(path) {
16029
- return this._test(path, this._ignoreCache, false).ignored;
16170
+ ignores(path$1) {
16171
+ return this._test(path$1, this._ignoreCache, false).ignored;
16030
16172
  }
16031
16173
  createFilter() {
16032
- return (path) => !this.ignores(path);
16174
+ return (path$1) => !this.ignores(path$1);
16033
16175
  }
16034
16176
  filter(paths) {
16035
16177
  return makeArray(paths).filter(this.createFilter());
16036
16178
  }
16037
- test(path) {
16038
- return this._test(path, this._testCache, true);
16179
+ test(path$1) {
16180
+ return this._test(path$1, this._testCache, true);
16039
16181
  }
16040
16182
  };
16041
16183
  const factory = (options) => new Ignore(options);
16042
- const isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
16184
+ const isPathValid = (path$1) => checkPath(path$1 && checkPath.convert(path$1), path$1, RETURN_FALSE);
16043
16185
  factory.isPathValid = isPathValid;
16044
16186
  factory.default = factory;
16045
16187
  module.exports = factory;
@@ -16048,7 +16190,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
16048
16190
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
16049
16191
  checkPath.convert = makePosix;
16050
16192
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
16051
- checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
16193
+ checkPath.isNotRelative = (path$1) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$1) || isNotRelative(path$1);
16052
16194
  }
16053
16195
  }) });
16054
16196
 
@@ -17403,11 +17545,11 @@ var Mime = class {
17403
17545
  }
17404
17546
  return this;
17405
17547
  }
17406
- getType(path) {
17407
- if (typeof path !== "string") return null;
17408
- const last = path.replace(/^.*[/\\]/s, "").toLowerCase();
17548
+ getType(path$1) {
17549
+ if (typeof path$1 !== "string") return null;
17550
+ const last = path$1.replace(/^.*[/\\]/s, "").toLowerCase();
17409
17551
  const ext = last.replace(/^.*\./s, "").toLowerCase();
17410
- const hasPath = last.length < path.length;
17552
+ const hasPath = last.length < path$1.length;
17411
17553
  if (!(ext.length < last.length - 1) && hasPath) return null;
17412
17554
  return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
17413
17555
  }
@@ -17741,8 +17883,8 @@ function getErrorMap() {
17741
17883
  //#endregion
17742
17884
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
17743
17885
  const makeIssue = (params) => {
17744
- const { data: data$1, path, errorMaps, issueData } = params;
17745
- const fullPath = [...path, ...issueData.path || []];
17886
+ const { data: data$1, path: path$1, errorMaps, issueData } = params;
17887
+ const fullPath = [...path$1, ...issueData.path || []];
17746
17888
  const fullIssue = {
17747
17889
  ...issueData,
17748
17890
  path: fullPath
@@ -17854,11 +17996,11 @@ var errorUtil;
17854
17996
  //#endregion
17855
17997
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
17856
17998
  var ParseInputLazyPath = class {
17857
- constructor(parent, value, path, key) {
17999
+ constructor(parent, value, path$1, key) {
17858
18000
  this._cachedPath = [];
17859
18001
  this.parent = parent;
17860
18002
  this.data = value;
17861
- this._path = path;
18003
+ this._path = path$1;
17862
18004
  this._key = key;
17863
18005
  }
17864
18006
  get path() {
@@ -21111,7 +21253,7 @@ function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig
21111
21253
  const redirectsFile = getRedirectsConfigPath(resolvedConfig);
21112
21254
  const redirectsContents = maybeGetFile(redirectsFile);
21113
21255
  const redirects = redirectsContents && RedirectsSchema.parse(constructRedirects({
21114
- redirects: parseRedirects(redirectsContents),
21256
+ redirects: parseRedirects(redirectsContents, { htmlHandling: assetsConfig?.html_handling }),
21115
21257
  redirectsFile,
21116
21258
  logger
21117
21259
  }).redirects);
@@ -21135,13 +21277,85 @@ function getHeadersConfigPath(config) {
21135
21277
  return nodePath.join(config.publicDir, HEADERS_FILENAME);
21136
21278
  }
21137
21279
 
21280
+ //#endregion
21281
+ //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
21282
+ var require_picocolors = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": ((exports, module) => {
21283
+ let p = process || {}, argv = p.argv || [], env = p.env || {};
21284
+ let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
21285
+ let formatter = (open, close, replace = open) => (input) => {
21286
+ let string = "" + input, index = string.indexOf(close, open.length);
21287
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
21288
+ };
21289
+ let replaceClose = (string, close, replace, index) => {
21290
+ let result = "", cursor = 0;
21291
+ do {
21292
+ result += string.substring(cursor, index) + replace;
21293
+ cursor = index + close.length;
21294
+ index = string.indexOf(close, cursor);
21295
+ } while (~index);
21296
+ return result + string.substring(cursor);
21297
+ };
21298
+ let createColors = (enabled = isColorSupported) => {
21299
+ let f = enabled ? formatter : () => String;
21300
+ return {
21301
+ isColorSupported: enabled,
21302
+ reset: f("\x1B[0m", "\x1B[0m"),
21303
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
21304
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
21305
+ italic: f("\x1B[3m", "\x1B[23m"),
21306
+ underline: f("\x1B[4m", "\x1B[24m"),
21307
+ inverse: f("\x1B[7m", "\x1B[27m"),
21308
+ hidden: f("\x1B[8m", "\x1B[28m"),
21309
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
21310
+ black: f("\x1B[30m", "\x1B[39m"),
21311
+ red: f("\x1B[31m", "\x1B[39m"),
21312
+ green: f("\x1B[32m", "\x1B[39m"),
21313
+ yellow: f("\x1B[33m", "\x1B[39m"),
21314
+ blue: f("\x1B[34m", "\x1B[39m"),
21315
+ magenta: f("\x1B[35m", "\x1B[39m"),
21316
+ cyan: f("\x1B[36m", "\x1B[39m"),
21317
+ white: f("\x1B[37m", "\x1B[39m"),
21318
+ gray: f("\x1B[90m", "\x1B[39m"),
21319
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
21320
+ bgRed: f("\x1B[41m", "\x1B[49m"),
21321
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
21322
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
21323
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
21324
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
21325
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
21326
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
21327
+ blackBright: f("\x1B[90m", "\x1B[39m"),
21328
+ redBright: f("\x1B[91m", "\x1B[39m"),
21329
+ greenBright: f("\x1B[92m", "\x1B[39m"),
21330
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
21331
+ blueBright: f("\x1B[94m", "\x1B[39m"),
21332
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
21333
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
21334
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
21335
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
21336
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
21337
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
21338
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
21339
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
21340
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
21341
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
21342
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
21343
+ };
21344
+ };
21345
+ module.exports = createColors();
21346
+ module.exports.createColors = createColors;
21347
+ }) });
21348
+
21138
21349
  //#endregion
21139
21350
  //#region src/shared.ts
21351
+ var import_picocolors$4 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
21140
21352
  const UNKNOWN_HOST = "http://localhost";
21141
21353
  const INIT_PATH = "/__vite_plugin_cloudflare_init__";
21142
21354
  const GET_EXPORT_TYPES_PATH = "/__vite_plugin_cloudflare_get_export_types__";
21143
21355
  const WORKER_ENTRY_PATH_HEADER = "__VITE_WORKER_ENTRY_PATH__";
21144
21356
  const IS_ENTRY_WORKER_HEADER = "__VITE_IS_ENTRY_WORKER__";
21357
+ const ENVIRONMENT_NAME_HEADER = "__VITE_ENVIRONMENT_NAME__";
21358
+ const IS_PARENT_ENVIRONMENT_HEADER = "__VITE_IS_PARENT_ENVIRONMENT__";
21145
21359
  const virtualPrefix = "virtual:cloudflare/";
21146
21360
  const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
21147
21361
  const VIRTUAL_EXPORT_TYPES = `${virtualPrefix}export-types`;
@@ -21156,7 +21370,7 @@ const VIRTUAL_CLIENT_FALLBACK_ENTRY = `${virtualPrefix}client-fallback-entry`;
21156
21370
  const virtualModulesPlugin = createPlugin("virtual-modules", (ctx) => {
21157
21371
  return {
21158
21372
  applyToEnvironment(environment) {
21159
- return ctx.getWorkerConfig(environment.name) !== void 0;
21373
+ return !ctx.isChildEnvironment(environment.name) && ctx.getWorkerConfig(environment.name) !== void 0;
21160
21374
  },
21161
21375
  async resolveId(source) {
21162
21376
  if (source === VIRTUAL_WORKER_ENTRY || source === VIRTUAL_EXPORT_TYPES) return `\0${source}`;
@@ -21295,7 +21509,7 @@ function createBuildApp(resolvedPluginConfig) {
21295
21509
  movedAssetPaths.push(dest);
21296
21510
  }
21297
21511
  }
21298
- if (movedAssetPaths.length) builder.config.logger.info([`${colors.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => colors.dim(nodePath.relative(builder.config.root, assetPath)))].join("\n"));
21512
+ if (movedAssetPaths.length) builder.config.logger.info([`${import_picocolors$4.default.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => import_picocolors$4.default.dim(nodePath.relative(builder.config.root, assetPath)))].join("\n"));
21299
21513
  };
21300
21514
  }
21301
21515
  function getHasPublicAssets({ publicDir }) {
@@ -21385,11 +21599,13 @@ var CloudflareDevEnvironment = class extends vite.DevEnvironment {
21385
21599
  });
21386
21600
  this.#webSocketContainer = webSocketContainer;
21387
21601
  }
21388
- async initRunner(miniflare, workerConfig, isEntryWorker) {
21602
+ async initRunner(miniflare, workerConfig, options) {
21389
21603
  const response = await miniflare.dispatchFetch(new URL(INIT_PATH, UNKNOWN_HOST), { headers: {
21390
21604
  [CoreHeaders.ROUTE_OVERRIDE]: workerConfig.name,
21391
21605
  [WORKER_ENTRY_PATH_HEADER]: encodeURIComponent(workerConfig.main),
21392
- [IS_ENTRY_WORKER_HEADER]: String(isEntryWorker),
21606
+ [IS_ENTRY_WORKER_HEADER]: String(options.isEntryWorker),
21607
+ [ENVIRONMENT_NAME_HEADER]: this.name,
21608
+ [IS_PARENT_ENVIRONMENT_HEADER]: String(options.isParentEnvironment),
21393
21609
  upgrade: "websocket"
21394
21610
  } });
21395
21611
  assert(response.ok, `Failed to initialize module runner, error: ${await response.text()}`);
@@ -21424,10 +21640,6 @@ const defaultConditions = [
21424
21640
  "browser"
21425
21641
  ];
21426
21642
  const target = "es2024";
21427
- const rollupOptions = {
21428
- input: { [MAIN_ENTRY_NAME]: VIRTUAL_WORKER_ENTRY },
21429
- preserveEntrySignatures: "strict"
21430
- };
21431
21643
  const resolveExtensions = [
21432
21644
  ".mjs",
21433
21645
  ".js",
@@ -21440,7 +21652,11 @@ const resolveExtensions = [
21440
21652
  ".cts",
21441
21653
  ".ctx"
21442
21654
  ];
21443
- function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, environmentName, isEntryWorker, hasNodeJsCompat: hasNodeJsCompat$1 }) {
21655
+ function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, environmentName, isEntryWorker, isParentEnvironment, hasNodeJsCompat: hasNodeJsCompat$1 }) {
21656
+ const rollupOptions = isParentEnvironment ? {
21657
+ input: { [MAIN_ENTRY_NAME]: VIRTUAL_WORKER_ENTRY },
21658
+ preserveEntrySignatures: "strict"
21659
+ } : {};
21444
21660
  const define$1 = getProcessEnvReplacements(hasNodeJsCompat$1, mode);
21445
21661
  return {
21446
21662
  resolve: {
@@ -21517,11 +21733,22 @@ function getProcessEnvReplacements(hasNodeJsCompat$1, mode) {
21517
21733
  };
21518
21734
  }
21519
21735
  function initRunners(resolvedPluginConfig, viteDevServer, miniflare) {
21520
- return Promise.all([...resolvedPluginConfig.environmentNameToWorkerMap].map(([environmentName, worker]) => {
21736
+ const initPromises = [...resolvedPluginConfig.environmentNameToWorkerMap].flatMap(([environmentName, worker]) => {
21521
21737
  debuglog("Initializing worker:", worker.config.name);
21522
21738
  const isEntryWorker = environmentName === resolvedPluginConfig.entryWorkerEnvironmentName;
21523
- return viteDevServer.environments[environmentName].initRunner(miniflare, worker.config, isEntryWorker);
21524
- }));
21739
+ const childEnvironmentNames = resolvedPluginConfig.environmentNameToChildEnvironmentNamesMap.get(environmentName) ?? [];
21740
+ return [viteDevServer.environments[environmentName].initRunner(miniflare, worker.config, {
21741
+ isEntryWorker,
21742
+ isParentEnvironment: true
21743
+ }), ...childEnvironmentNames.map((childEnvironmentName) => {
21744
+ debuglog("Initializing child environment:", childEnvironmentName);
21745
+ return viteDevServer.environments[childEnvironmentName].initRunner(miniflare, worker.config, {
21746
+ isEntryWorker: false,
21747
+ isParentEnvironment: false
21748
+ });
21749
+ })];
21750
+ });
21751
+ return Promise.all(initPromises);
21525
21752
  }
21526
21753
 
21527
21754
  //#endregion
@@ -21580,7 +21807,7 @@ function validateWorkerEnvironmentOptions(resolvedPluginConfig, resolvedViteConf
21580
21807
  */
21581
21808
  const configPlugin = createPlugin("config", (ctx) => {
21582
21809
  return {
21583
- config(userConfig, env) {
21810
+ config(userConfig, env$1) {
21584
21811
  if (ctx.resolvedPluginConfig.type === "preview") return { appType: "custom" };
21585
21812
  if (!ctx.hasShownWorkerConfigWarnings) {
21586
21813
  ctx.setHasShownWorkerConfigWarnings(true);
@@ -21599,22 +21826,7 @@ const configPlugin = createPlugin("config", (ctx) => {
21599
21826
  ".dev.vars",
21600
21827
  ".dev.vars.*"
21601
21828
  ] } },
21602
- environments: ctx.resolvedPluginConfig.type === "workers" ? {
21603
- ...Object.fromEntries([...ctx.resolvedPluginConfig.environmentNameToWorkerMap].map(([environmentName, worker]) => {
21604
- return [environmentName, createCloudflareEnvironmentOptions({
21605
- workerConfig: worker.config,
21606
- userConfig,
21607
- mode: env.mode,
21608
- environmentName,
21609
- isEntryWorker: ctx.resolvedPluginConfig.type === "workers" && environmentName === ctx.resolvedPluginConfig.entryWorkerEnvironmentName,
21610
- hasNodeJsCompat: ctx.getNodeJsCompat(environmentName) !== void 0
21611
- })];
21612
- })),
21613
- client: {
21614
- build: { outDir: getOutputDirectory(userConfig, "client") },
21615
- optimizeDeps: { exclude: [...cloudflareBuiltInModules] }
21616
- }
21617
- } : void 0,
21829
+ environments: getEnvironmentsConfig(ctx, userConfig, env$1.mode),
21618
21830
  builder: { buildApp: userConfig.builder?.buildApp ?? createBuildApp(ctx.resolvedPluginConfig) }
21619
21831
  };
21620
21832
  },
@@ -21656,9 +21868,146 @@ const configPlugin = createPlugin("config", (ctx) => {
21656
21868
  }
21657
21869
  };
21658
21870
  });
21871
+ /**
21872
+ * Generates the environment configuration for all Worker environments.
21873
+ */
21874
+ function getEnvironmentsConfig(ctx, userConfig, mode) {
21875
+ if (ctx.resolvedPluginConfig.type !== "workers") return;
21876
+ const workersConfig = ctx.resolvedPluginConfig;
21877
+ return {
21878
+ ...Object.fromEntries([...workersConfig.environmentNameToWorkerMap].flatMap(([environmentName, worker]) => {
21879
+ const childEnvironmentNames = workersConfig.environmentNameToChildEnvironmentNamesMap.get(environmentName) ?? [];
21880
+ const sharedOptions = {
21881
+ workerConfig: worker.config,
21882
+ userConfig,
21883
+ mode,
21884
+ hasNodeJsCompat: ctx.getNodeJsCompat(environmentName) !== void 0
21885
+ };
21886
+ return [[environmentName, createCloudflareEnvironmentOptions({
21887
+ ...sharedOptions,
21888
+ environmentName,
21889
+ isEntryWorker: environmentName === workersConfig.entryWorkerEnvironmentName,
21890
+ isParentEnvironment: true
21891
+ })], ...childEnvironmentNames.map((childEnvironmentName) => [childEnvironmentName, createCloudflareEnvironmentOptions({
21892
+ ...sharedOptions,
21893
+ environmentName: childEnvironmentName,
21894
+ isEntryWorker: false,
21895
+ isParentEnvironment: false
21896
+ })])];
21897
+ })),
21898
+ client: {
21899
+ build: { outDir: getOutputDirectory(userConfig, "client") },
21900
+ optimizeDeps: { exclude: [...cloudflareBuiltInModules] }
21901
+ }
21902
+ };
21903
+ }
21904
+
21905
+ //#endregion
21906
+ //#region ../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
21907
+ var Locked = class extends Error {
21908
+ constructor(port) {
21909
+ super(`${port} is locked`);
21910
+ }
21911
+ };
21912
+ const lockedPorts = {
21913
+ old: /* @__PURE__ */ new Set(),
21914
+ young: /* @__PURE__ */ new Set()
21915
+ };
21916
+ const releaseOldLockedPortsIntervalMs = 1e3 * 15;
21917
+ const minPort = 1024;
21918
+ const maxPort = 65535;
21919
+ let timeout;
21920
+ const getLocalHosts = () => {
21921
+ const interfaces = os.networkInterfaces();
21922
+ const results = new Set([void 0, "0.0.0.0"]);
21923
+ for (const _interface of Object.values(interfaces)) for (const config of _interface) results.add(config.address);
21924
+ return results;
21925
+ };
21926
+ const checkAvailablePort = (options) => new Promise((resolve$2, reject) => {
21927
+ const server = net.createServer();
21928
+ server.unref();
21929
+ server.on("error", reject);
21930
+ server.listen(options, () => {
21931
+ const { port } = server.address();
21932
+ server.close(() => {
21933
+ resolve$2(port);
21934
+ });
21935
+ });
21936
+ });
21937
+ const getAvailablePort = async (options, hosts) => {
21938
+ if (options.host || options.port === 0) return checkAvailablePort(options);
21939
+ for (const host of hosts) try {
21940
+ await checkAvailablePort({
21941
+ port: options.port,
21942
+ host
21943
+ });
21944
+ } catch (error) {
21945
+ if (!["EADDRNOTAVAIL", "EINVAL"].includes(error.code)) throw error;
21946
+ }
21947
+ return options.port;
21948
+ };
21949
+ const portCheckSequence = function* (ports) {
21950
+ if (ports) yield* ports;
21951
+ yield 0;
21952
+ };
21953
+ async function getPorts(options) {
21954
+ let ports;
21955
+ let exclude = /* @__PURE__ */ new Set();
21956
+ if (options) {
21957
+ if (options.port) ports = typeof options.port === "number" ? [options.port] : options.port;
21958
+ if (options.exclude) {
21959
+ const excludeIterable = options.exclude;
21960
+ if (typeof excludeIterable[Symbol.iterator] !== "function") throw new TypeError("The `exclude` option must be an iterable.");
21961
+ for (const element of excludeIterable) {
21962
+ if (typeof element !== "number") throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");
21963
+ if (!Number.isSafeInteger(element)) throw new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);
21964
+ }
21965
+ exclude = new Set(excludeIterable);
21966
+ }
21967
+ }
21968
+ if (timeout === void 0) {
21969
+ timeout = setTimeout(() => {
21970
+ timeout = void 0;
21971
+ lockedPorts.old = lockedPorts.young;
21972
+ lockedPorts.young = /* @__PURE__ */ new Set();
21973
+ }, releaseOldLockedPortsIntervalMs);
21974
+ if (timeout.unref) timeout.unref();
21975
+ }
21976
+ const hosts = getLocalHosts();
21977
+ for (const port of portCheckSequence(ports)) try {
21978
+ if (exclude.has(port)) continue;
21979
+ let availablePort = await getAvailablePort({
21980
+ ...options,
21981
+ port
21982
+ }, hosts);
21983
+ while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
21984
+ if (port !== 0) throw new Locked(port);
21985
+ availablePort = await getAvailablePort({
21986
+ ...options,
21987
+ port
21988
+ }, hosts);
21989
+ }
21990
+ lockedPorts.young.add(availablePort);
21991
+ return availablePort;
21992
+ } catch (error) {
21993
+ if (!["EADDRINUSE", "EACCES"].includes(error.code) && !(error instanceof Locked)) throw error;
21994
+ }
21995
+ throw new Error("No available ports found");
21996
+ }
21997
+ function portNumbers(from, to) {
21998
+ if (!Number.isInteger(from) || !Number.isInteger(to)) throw new TypeError("`from` and `to` must be integer numbers");
21999
+ if (from < minPort || from > maxPort) throw new RangeError(`'from' must be between ${minPort} and ${maxPort}`);
22000
+ if (to < minPort || to > maxPort) throw new RangeError(`'to' must be between ${minPort} and ${maxPort}`);
22001
+ if (from > to) throw new RangeError("`to` must be greater than or equal to `from`");
22002
+ const generator = function* (from$1, to$1) {
22003
+ for (let port = from$1; port <= to$1; port++) yield port;
22004
+ };
22005
+ return generator(from, to);
22006
+ }
21659
22007
 
21660
22008
  //#endregion
21661
22009
  //#region src/debug.ts
22010
+ var import_picocolors$3 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
21662
22011
  const DEBUG_PATH = "/__debug";
21663
22012
  const DEFAULT_INSPECTOR_PORT = 9229;
21664
22013
  /**
@@ -21670,11 +22019,11 @@ async function getInputInspectorPort(ctx, viteServer) {
21670
22019
  if (resolvedInspectorPort !== null) return resolvedInspectorPort;
21671
22020
  }
21672
22021
  const inputInspectorPort = ctx.resolvedPluginConfig.inspectorPort ?? await getFirstAvailablePort(DEFAULT_INSPECTOR_PORT);
21673
- if (ctx.resolvedPluginConfig.inspectorPort === void 0 && inputInspectorPort !== DEFAULT_INSPECTOR_PORT) viteServer.config.logger.warn(colors.dim(`Default inspector port ${DEFAULT_INSPECTOR_PORT} not available, using ${inputInspectorPort} instead\n`));
22022
+ if (ctx.resolvedPluginConfig.inspectorPort === void 0 && inputInspectorPort !== DEFAULT_INSPECTOR_PORT) viteServer.config.logger.warn(import_picocolors$3.default.dim(`Default inspector port ${DEFAULT_INSPECTOR_PORT} not available, using ${inputInspectorPort} instead\n`));
21674
22023
  return inputInspectorPort;
21675
22024
  }
21676
22025
  function getFirstAvailablePort(start) {
21677
- return getPort({ port: portNumbers(start, 65535) });
22026
+ return getPorts({ port: portNumbers(start, 65535) });
21678
22027
  }
21679
22028
  /**
21680
22029
  * Modifies the URL printing logic to also include a URL that developers can use to open DevTools to debug their Worker(s)
@@ -21686,8 +22035,8 @@ function addDebugToVitePrintUrls(server) {
21686
22035
  const localUrl = server.resolvedUrls?.local[0];
21687
22036
  if (localUrl) {
21688
22037
  const { protocol, hostname, port } = new URL(localUrl);
21689
- const colorDebugUrl = (url) => colors.dim(colors.yellow(url.replace(/:(\d+)\//, (_, portNumber) => `:${colors.bold(portNumber)}/`)));
21690
- server.config.logger.info(` ${colors.green("➜")} ${colors.bold("Debug")}: ${colorDebugUrl(`${protocol}//${hostname}:${port}${DEBUG_PATH}`)}`);
22038
+ const colorDebugUrl = (url) => import_picocolors$3.default.dim(import_picocolors$3.default.yellow(url.replace(/:(\d+)\//, (_, portNumber) => `:${import_picocolors$3.default.bold(portNumber)}/`)));
22039
+ server.config.logger.info(` ${import_picocolors$3.default.green("➜")} ${import_picocolors$3.default.bold("Debug")}: ${colorDebugUrl(`${protocol}//${hostname}:${port}${DEBUG_PATH}`)}`);
21691
22040
  }
21692
22041
  };
21693
22042
  }
@@ -22135,11 +22484,11 @@ const getQueryString = (params) => {
22135
22484
  };
22136
22485
  const getUrl = (config, options) => {
22137
22486
  const encoder = config.ENCODE_PATH || encodeURI;
22138
- const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
22487
+ const path$1 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
22139
22488
  if (options.path?.hasOwnProperty(group)) return encoder(String(options.path[group]));
22140
22489
  return substring;
22141
22490
  });
22142
- const url = `${config.BASE}${path}`;
22491
+ const url = `${config.BASE}${path$1}`;
22143
22492
  if (options.query) return `${url}${getQueryString(options.query)}`;
22144
22493
  return url;
22145
22494
  };
@@ -22884,15 +23233,15 @@ async function prepareContainerImagesForDev(args) {
22884
23233
  await verifyDockerInstalled(dockerPath);
22885
23234
  for (const options of containerOptions) {
22886
23235
  if ("dockerfile" in options) {
22887
- const build = await buildImage(dockerPath, options);
23236
+ const build$8 = await buildImage(dockerPath, options);
22888
23237
  onContainerImagePreparationStart({
22889
23238
  containerOptions: options,
22890
23239
  abort: () => {
22891
23240
  aborted = true;
22892
- build.abort();
23241
+ build$8.abort();
22893
23242
  }
22894
23243
  });
22895
- await build.ready;
23244
+ await build$8.ready;
22896
23245
  onContainerImagePreparationEnd({ containerOptions: options });
22897
23246
  } else {
22898
23247
  const pull = await pullImage(dockerPath, options, args.logger, args.isVite);
@@ -22973,6 +23322,2595 @@ function getContainerOptions(options) {
22973
23322
  });
22974
23323
  }
22975
23324
 
23325
+ //#endregion
23326
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/utils.js
23327
+ var require_utils$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/utils.js": ((exports) => {
23328
+ Object.defineProperty(exports, "__esModule", { value: true });
23329
+ exports.normalizePath = exports.convertSlashes = exports.cleanPath = void 0;
23330
+ const path_1$4 = __require$1("path");
23331
+ function cleanPath(path$1) {
23332
+ let normalized = (0, path_1$4.normalize)(path$1);
23333
+ if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$4.sep) normalized = normalized.substring(0, normalized.length - 1);
23334
+ return normalized;
23335
+ }
23336
+ exports.cleanPath = cleanPath;
23337
+ const SLASHES_REGEX = /[\\/]/g;
23338
+ function convertSlashes(path$1, separator) {
23339
+ return path$1.replace(SLASHES_REGEX, separator);
23340
+ }
23341
+ exports.convertSlashes = convertSlashes;
23342
+ function normalizePath(path$1, options) {
23343
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
23344
+ const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
23345
+ if (resolvePaths) path$1 = (0, path_1$4.resolve)(path$1);
23346
+ if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
23347
+ if (path$1 === ".") return "";
23348
+ return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
23349
+ }
23350
+ exports.normalizePath = normalizePath;
23351
+ }) });
23352
+
23353
+ //#endregion
23354
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js
23355
+ var require_join_path = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js": ((exports) => {
23356
+ Object.defineProperty(exports, "__esModule", { value: true });
23357
+ exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
23358
+ const path_1$3 = __require$1("path");
23359
+ const utils_1$1 = require_utils$1();
23360
+ function joinPathWithBasePath(filename, directoryPath) {
23361
+ return directoryPath + filename;
23362
+ }
23363
+ exports.joinPathWithBasePath = joinPathWithBasePath;
23364
+ function joinPathWithRelativePath(root, options) {
23365
+ return function(filename, directoryPath) {
23366
+ if (directoryPath.startsWith(root)) return directoryPath.replace(root, "") + filename;
23367
+ else return (0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
23368
+ };
23369
+ }
23370
+ function joinPath$1(filename) {
23371
+ return filename;
23372
+ }
23373
+ function joinDirectoryPath(filename, directoryPath, separator) {
23374
+ return directoryPath + filename + separator;
23375
+ }
23376
+ exports.joinDirectoryPath = joinDirectoryPath;
23377
+ function build$7(root, options) {
23378
+ const { relativePaths, includeBasePath } = options;
23379
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath$1;
23380
+ }
23381
+ exports.build = build$7;
23382
+ }) });
23383
+
23384
+ //#endregion
23385
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js
23386
+ var require_push_directory = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js": ((exports) => {
23387
+ Object.defineProperty(exports, "__esModule", { value: true });
23388
+ exports.build = void 0;
23389
+ function pushDirectoryWithRelativePath(root) {
23390
+ return function(directoryPath, paths) {
23391
+ paths.push(directoryPath.substring(root.length) || ".");
23392
+ };
23393
+ }
23394
+ function pushDirectoryFilterWithRelativePath(root) {
23395
+ return function(directoryPath, paths, filters) {
23396
+ const relativePath = directoryPath.substring(root.length) || ".";
23397
+ if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
23398
+ };
23399
+ }
23400
+ const pushDirectory$1 = (directoryPath, paths) => {
23401
+ paths.push(directoryPath || ".");
23402
+ };
23403
+ const pushDirectoryFilter = (directoryPath, paths, filters) => {
23404
+ const path$1 = directoryPath || ".";
23405
+ if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
23406
+ };
23407
+ const empty$2 = () => {};
23408
+ function build$6(root, options) {
23409
+ const { includeDirs, filters, relativePaths } = options;
23410
+ if (!includeDirs) return empty$2;
23411
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
23412
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
23413
+ }
23414
+ exports.build = build$6;
23415
+ }) });
23416
+
23417
+ //#endregion
23418
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js
23419
+ var require_push_file = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js": ((exports) => {
23420
+ Object.defineProperty(exports, "__esModule", { value: true });
23421
+ exports.build = void 0;
23422
+ const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
23423
+ if (filters.every((filter) => filter(filename, false))) counts.files++;
23424
+ };
23425
+ const pushFileFilter = (filename, paths, _counts, filters) => {
23426
+ if (filters.every((filter) => filter(filename, false))) paths.push(filename);
23427
+ };
23428
+ const pushFileCount = (_filename, _paths, counts, _filters) => {
23429
+ counts.files++;
23430
+ };
23431
+ const pushFile$1 = (filename, paths) => {
23432
+ paths.push(filename);
23433
+ };
23434
+ const empty$1 = () => {};
23435
+ function build$5(options) {
23436
+ const { excludeFiles, filters, onlyCounts } = options;
23437
+ if (excludeFiles) return empty$1;
23438
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
23439
+ else if (onlyCounts) return pushFileCount;
23440
+ else return pushFile$1;
23441
+ }
23442
+ exports.build = build$5;
23443
+ }) });
23444
+
23445
+ //#endregion
23446
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js
23447
+ var require_get_array = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js": ((exports) => {
23448
+ Object.defineProperty(exports, "__esModule", { value: true });
23449
+ exports.build = void 0;
23450
+ const getArray$1 = (paths) => {
23451
+ return paths;
23452
+ };
23453
+ const getArrayGroup = () => {
23454
+ return [""].slice(0, 0);
23455
+ };
23456
+ function build$4(options) {
23457
+ return options.group ? getArrayGroup : getArray$1;
23458
+ }
23459
+ exports.build = build$4;
23460
+ }) });
23461
+
23462
+ //#endregion
23463
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js
23464
+ var require_group_files = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js": ((exports) => {
23465
+ Object.defineProperty(exports, "__esModule", { value: true });
23466
+ exports.build = void 0;
23467
+ const groupFiles$1 = (groups, directory, files) => {
23468
+ groups.push({
23469
+ directory,
23470
+ files,
23471
+ dir: directory
23472
+ });
23473
+ };
23474
+ const empty = () => {};
23475
+ function build$3(options) {
23476
+ return options.group ? groupFiles$1 : empty;
23477
+ }
23478
+ exports.build = build$3;
23479
+ }) });
23480
+
23481
+ //#endregion
23482
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js
23483
+ var require_resolve_symlink = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js": ((exports) => {
23484
+ var __importDefault$1 = exports && exports.__importDefault || function(mod) {
23485
+ return mod && mod.__esModule ? mod : { "default": mod };
23486
+ };
23487
+ Object.defineProperty(exports, "__esModule", { value: true });
23488
+ exports.build = void 0;
23489
+ const fs_1$1 = __importDefault$1(__require$1("fs"));
23490
+ const path_1$2 = __require$1("path");
23491
+ const resolveSymlinksAsync = function(path$1, state, callback$1) {
23492
+ const { queue, options: { suppressErrors } } = state;
23493
+ queue.enqueue();
23494
+ fs_1$1.default.realpath(path$1, (error, resolvedPath) => {
23495
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
23496
+ fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
23497
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
23498
+ if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
23499
+ callback$1(stat, resolvedPath);
23500
+ queue.dequeue(null, state);
23501
+ });
23502
+ });
23503
+ };
23504
+ const resolveSymlinks = function(path$1, state, callback$1) {
23505
+ const { queue, options: { suppressErrors } } = state;
23506
+ queue.enqueue();
23507
+ try {
23508
+ const resolvedPath = fs_1$1.default.realpathSync(path$1);
23509
+ const stat = fs_1$1.default.statSync(resolvedPath);
23510
+ if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
23511
+ callback$1(stat, resolvedPath);
23512
+ } catch (e) {
23513
+ if (!suppressErrors) throw e;
23514
+ }
23515
+ };
23516
+ function build$2(options, isSynchronous) {
23517
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
23518
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
23519
+ }
23520
+ exports.build = build$2;
23521
+ function isRecursive(path$1, resolved, state) {
23522
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
23523
+ let parent = (0, path_1$2.dirname)(path$1);
23524
+ let depth$1 = 1;
23525
+ while (parent !== state.root && depth$1 < 2) {
23526
+ const resolvedPath = state.symlinks.get(parent);
23527
+ if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
23528
+ else parent = (0, path_1$2.dirname)(parent);
23529
+ }
23530
+ state.symlinks.set(path$1, resolved);
23531
+ return depth$1 > 1;
23532
+ }
23533
+ function isRecursiveUsingRealPaths(resolved, state) {
23534
+ return state.visited.includes(resolved + state.options.pathSeparator);
23535
+ }
23536
+ }) });
23537
+
23538
+ //#endregion
23539
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js
23540
+ var require_invoke_callback = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js": ((exports) => {
23541
+ Object.defineProperty(exports, "__esModule", { value: true });
23542
+ exports.build = void 0;
23543
+ const onlyCountsSync = (state) => {
23544
+ return state.counts;
23545
+ };
23546
+ const groupsSync = (state) => {
23547
+ return state.groups;
23548
+ };
23549
+ const defaultSync = (state) => {
23550
+ return state.paths;
23551
+ };
23552
+ const limitFilesSync = (state) => {
23553
+ return state.paths.slice(0, state.options.maxFiles);
23554
+ };
23555
+ const onlyCountsAsync = (state, error, callback$1) => {
23556
+ report(error, callback$1, state.counts, state.options.suppressErrors);
23557
+ return null;
23558
+ };
23559
+ const defaultAsync = (state, error, callback$1) => {
23560
+ report(error, callback$1, state.paths, state.options.suppressErrors);
23561
+ return null;
23562
+ };
23563
+ const limitFilesAsync = (state, error, callback$1) => {
23564
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
23565
+ return null;
23566
+ };
23567
+ const groupsAsync = (state, error, callback$1) => {
23568
+ report(error, callback$1, state.groups, state.options.suppressErrors);
23569
+ return null;
23570
+ };
23571
+ function report(error, callback$1, output, suppressErrors) {
23572
+ if (error && !suppressErrors) callback$1(error, output);
23573
+ else callback$1(null, output);
23574
+ }
23575
+ function build$1(options, isSynchronous) {
23576
+ const { onlyCounts, group, maxFiles } = options;
23577
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
23578
+ else if (group) return isSynchronous ? groupsSync : groupsAsync;
23579
+ else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
23580
+ else return isSynchronous ? defaultSync : defaultAsync;
23581
+ }
23582
+ exports.build = build$1;
23583
+ }) });
23584
+
23585
+ //#endregion
23586
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js
23587
+ var require_walk_directory = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js": ((exports) => {
23588
+ var __importDefault = exports && exports.__importDefault || function(mod) {
23589
+ return mod && mod.__esModule ? mod : { "default": mod };
23590
+ };
23591
+ Object.defineProperty(exports, "__esModule", { value: true });
23592
+ exports.build = void 0;
23593
+ const fs_1 = __importDefault(__require$1("fs"));
23594
+ const readdirOpts = { withFileTypes: true };
23595
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
23596
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
23597
+ state.visited.push(crawlPath);
23598
+ state.counts.directories++;
23599
+ state.queue.enqueue();
23600
+ fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
23601
+ callback$1(entries, directoryPath, currentDepth);
23602
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
23603
+ });
23604
+ };
23605
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
23606
+ if (currentDepth < 0) return;
23607
+ state.visited.push(crawlPath);
23608
+ state.counts.directories++;
23609
+ let entries = [];
23610
+ try {
23611
+ entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
23612
+ } catch (e) {
23613
+ if (!state.options.suppressErrors) throw e;
23614
+ }
23615
+ callback$1(entries, directoryPath, currentDepth);
23616
+ };
23617
+ function build(isSynchronous) {
23618
+ return isSynchronous ? walkSync : walkAsync;
23619
+ }
23620
+ exports.build = build;
23621
+ }) });
23622
+
23623
+ //#endregion
23624
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js
23625
+ var require_queue = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js": ((exports) => {
23626
+ Object.defineProperty(exports, "__esModule", { value: true });
23627
+ exports.Queue = void 0;
23628
+ /**
23629
+ * This is a custom stateless queue to track concurrent async fs calls.
23630
+ * It increments a counter whenever a call is queued and decrements it
23631
+ * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
23632
+ */
23633
+ var Queue = class {
23634
+ onQueueEmpty;
23635
+ count = 0;
23636
+ constructor(onQueueEmpty) {
23637
+ this.onQueueEmpty = onQueueEmpty;
23638
+ }
23639
+ enqueue() {
23640
+ this.count++;
23641
+ }
23642
+ dequeue(error, output) {
23643
+ if (--this.count <= 0 || error) this.onQueueEmpty(error, output);
23644
+ }
23645
+ };
23646
+ exports.Queue = Queue;
23647
+ }) });
23648
+
23649
+ //#endregion
23650
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js
23651
+ var require_counter = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js": ((exports) => {
23652
+ Object.defineProperty(exports, "__esModule", { value: true });
23653
+ exports.Counter = void 0;
23654
+ var Counter = class {
23655
+ _files = 0;
23656
+ _directories = 0;
23657
+ set files(num) {
23658
+ this._files = num;
23659
+ }
23660
+ get files() {
23661
+ return this._files;
23662
+ }
23663
+ set directories(num) {
23664
+ this._directories = num;
23665
+ }
23666
+ get directories() {
23667
+ return this._directories;
23668
+ }
23669
+ /**
23670
+ * @deprecated use `directories` instead
23671
+ */
23672
+ /* c8 ignore next 3 */
23673
+ get dirs() {
23674
+ return this._directories;
23675
+ }
23676
+ };
23677
+ exports.Counter = Counter;
23678
+ }) });
23679
+
23680
+ //#endregion
23681
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js
23682
+ var require_walker = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js": ((exports) => {
23683
+ var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
23684
+ if (k2 === void 0) k2 = k;
23685
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23686
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
23687
+ enumerable: true,
23688
+ get: function() {
23689
+ return m[k];
23690
+ }
23691
+ };
23692
+ Object.defineProperty(o, k2, desc);
23693
+ }) : (function(o, m, k, k2) {
23694
+ if (k2 === void 0) k2 = k;
23695
+ o[k2] = m[k];
23696
+ }));
23697
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
23698
+ Object.defineProperty(o, "default", {
23699
+ enumerable: true,
23700
+ value: v
23701
+ });
23702
+ }) : function(o, v) {
23703
+ o["default"] = v;
23704
+ });
23705
+ var __importStar = exports && exports.__importStar || function(mod) {
23706
+ if (mod && mod.__esModule) return mod;
23707
+ var result = {};
23708
+ if (mod != null) {
23709
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k);
23710
+ }
23711
+ __setModuleDefault(result, mod);
23712
+ return result;
23713
+ };
23714
+ Object.defineProperty(exports, "__esModule", { value: true });
23715
+ exports.Walker = void 0;
23716
+ const path_1$1 = __require$1("path");
23717
+ const utils_1 = require_utils$1();
23718
+ const joinPath = __importStar(require_join_path());
23719
+ const pushDirectory = __importStar(require_push_directory());
23720
+ const pushFile = __importStar(require_push_file());
23721
+ const getArray = __importStar(require_get_array());
23722
+ const groupFiles = __importStar(require_group_files());
23723
+ const resolveSymlink = __importStar(require_resolve_symlink());
23724
+ const invokeCallback = __importStar(require_invoke_callback());
23725
+ const walkDirectory = __importStar(require_walk_directory());
23726
+ const queue_1 = require_queue();
23727
+ const counter_1 = require_counter();
23728
+ var Walker = class {
23729
+ root;
23730
+ isSynchronous;
23731
+ state;
23732
+ joinPath;
23733
+ pushDirectory;
23734
+ pushFile;
23735
+ getArray;
23736
+ groupFiles;
23737
+ resolveSymlink;
23738
+ walkDirectory;
23739
+ callbackInvoker;
23740
+ constructor(root, options, callback$1) {
23741
+ this.isSynchronous = !callback$1;
23742
+ this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
23743
+ this.root = (0, utils_1.normalizePath)(root, options);
23744
+ this.state = {
23745
+ root: this.root.slice(0, -1),
23746
+ paths: [""].slice(0, 0),
23747
+ groups: [],
23748
+ counts: new counter_1.Counter(),
23749
+ options,
23750
+ queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
23751
+ symlinks: /* @__PURE__ */ new Map(),
23752
+ visited: [""].slice(0, 0)
23753
+ };
23754
+ this.joinPath = joinPath.build(this.root, options);
23755
+ this.pushDirectory = pushDirectory.build(this.root, options);
23756
+ this.pushFile = pushFile.build(options);
23757
+ this.getArray = getArray.build(options);
23758
+ this.groupFiles = groupFiles.build(options);
23759
+ this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
23760
+ this.walkDirectory = walkDirectory.build(this.isSynchronous);
23761
+ }
23762
+ start() {
23763
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
23764
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
23765
+ }
23766
+ walk = (entries, directoryPath, depth$1) => {
23767
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator } } = this.state;
23768
+ if (signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
23769
+ this.pushDirectory(directoryPath, paths, filters);
23770
+ const files = this.getArray(this.state.paths);
23771
+ for (let i$1 = 0; i$1 < entries.length; ++i$1) {
23772
+ const entry = entries[i$1];
23773
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
23774
+ const filename = this.joinPath(entry.name, directoryPath);
23775
+ this.pushFile(filename, files, this.state.counts, filters);
23776
+ } else if (entry.isDirectory()) {
23777
+ let path$1 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
23778
+ if (exclude && exclude(entry.name, path$1)) continue;
23779
+ this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
23780
+ } else if (entry.isSymbolicLink() && this.resolveSymlink) {
23781
+ let path$1 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
23782
+ this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
23783
+ if (stat.isDirectory()) {
23784
+ resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
23785
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
23786
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
23787
+ } else {
23788
+ resolvedPath = useRealPaths ? resolvedPath : path$1;
23789
+ const filename = (0, path_1$1.basename)(resolvedPath);
23790
+ const directoryPath$1 = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
23791
+ resolvedPath = this.joinPath(filename, directoryPath$1);
23792
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
23793
+ }
23794
+ });
23795
+ }
23796
+ }
23797
+ this.groupFiles(this.state.groups, directoryPath, files);
23798
+ };
23799
+ };
23800
+ exports.Walker = Walker;
23801
+ }) });
23802
+
23803
+ //#endregion
23804
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/async.js
23805
+ var require_async = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/async.js": ((exports) => {
23806
+ Object.defineProperty(exports, "__esModule", { value: true });
23807
+ exports.callback = exports.promise = void 0;
23808
+ const walker_1$1 = require_walker();
23809
+ function promise(root, options) {
23810
+ return new Promise((resolve$2, reject) => {
23811
+ callback(root, options, (err, output) => {
23812
+ if (err) return reject(err);
23813
+ resolve$2(output);
23814
+ });
23815
+ });
23816
+ }
23817
+ exports.promise = promise;
23818
+ function callback(root, options, callback$1) {
23819
+ new walker_1$1.Walker(root, options, callback$1).start();
23820
+ }
23821
+ exports.callback = callback;
23822
+ }) });
23823
+
23824
+ //#endregion
23825
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js
23826
+ var require_sync = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js": ((exports) => {
23827
+ Object.defineProperty(exports, "__esModule", { value: true });
23828
+ exports.sync = void 0;
23829
+ const walker_1 = require_walker();
23830
+ function sync(root, options) {
23831
+ return new walker_1.Walker(root, options).start();
23832
+ }
23833
+ exports.sync = sync;
23834
+ }) });
23835
+
23836
+ //#endregion
23837
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js
23838
+ var require_api_builder = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js": ((exports) => {
23839
+ Object.defineProperty(exports, "__esModule", { value: true });
23840
+ exports.APIBuilder = void 0;
23841
+ const async_1 = require_async();
23842
+ const sync_1 = require_sync();
23843
+ var APIBuilder = class {
23844
+ root;
23845
+ options;
23846
+ constructor(root, options) {
23847
+ this.root = root;
23848
+ this.options = options;
23849
+ }
23850
+ withPromise() {
23851
+ return (0, async_1.promise)(this.root, this.options);
23852
+ }
23853
+ withCallback(cb) {
23854
+ (0, async_1.callback)(this.root, this.options, cb);
23855
+ }
23856
+ sync() {
23857
+ return (0, sync_1.sync)(this.root, this.options);
23858
+ }
23859
+ };
23860
+ exports.APIBuilder = APIBuilder;
23861
+ }) });
23862
+
23863
+ //#endregion
23864
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js
23865
+ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js": ((exports, module) => {
23866
+ const WIN_SLASH = "\\\\/";
23867
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
23868
+ /**
23869
+ * Posix glob regex
23870
+ */
23871
+ const DOT_LITERAL = "\\.";
23872
+ const PLUS_LITERAL = "\\+";
23873
+ const QMARK_LITERAL = "\\?";
23874
+ const SLASH_LITERAL = "\\/";
23875
+ const ONE_CHAR = "(?=.)";
23876
+ const QMARK = "[^/]";
23877
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
23878
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
23879
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
23880
+ const POSIX_CHARS = {
23881
+ DOT_LITERAL,
23882
+ PLUS_LITERAL,
23883
+ QMARK_LITERAL,
23884
+ SLASH_LITERAL,
23885
+ ONE_CHAR,
23886
+ QMARK,
23887
+ END_ANCHOR,
23888
+ DOTS_SLASH,
23889
+ NO_DOT: `(?!${DOT_LITERAL})`,
23890
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
23891
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
23892
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
23893
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
23894
+ STAR: `${QMARK}*?`,
23895
+ START_ANCHOR,
23896
+ SEP: "/"
23897
+ };
23898
+ /**
23899
+ * Windows glob regex
23900
+ */
23901
+ const WINDOWS_CHARS = {
23902
+ ...POSIX_CHARS,
23903
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
23904
+ QMARK: WIN_NO_SLASH,
23905
+ STAR: `${WIN_NO_SLASH}*?`,
23906
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
23907
+ NO_DOT: `(?!${DOT_LITERAL})`,
23908
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
23909
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
23910
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
23911
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
23912
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
23913
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
23914
+ SEP: "\\"
23915
+ };
23916
+ /**
23917
+ * POSIX Bracket Regex
23918
+ */
23919
+ const POSIX_REGEX_SOURCE$1 = {
23920
+ alnum: "a-zA-Z0-9",
23921
+ alpha: "a-zA-Z",
23922
+ ascii: "\\x00-\\x7F",
23923
+ blank: " \\t",
23924
+ cntrl: "\\x00-\\x1F\\x7F",
23925
+ digit: "0-9",
23926
+ graph: "\\x21-\\x7E",
23927
+ lower: "a-z",
23928
+ print: "\\x20-\\x7E ",
23929
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
23930
+ space: " \\t\\r\\n\\v\\f",
23931
+ upper: "A-Z",
23932
+ word: "A-Za-z0-9_",
23933
+ xdigit: "A-Fa-f0-9"
23934
+ };
23935
+ module.exports = {
23936
+ MAX_LENGTH: 1024 * 64,
23937
+ POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
23938
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
23939
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
23940
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
23941
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
23942
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
23943
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
23944
+ REPLACEMENTS: {
23945
+ "***": "*",
23946
+ "**/**": "**",
23947
+ "**/**/**": "**"
23948
+ },
23949
+ CHAR_0: 48,
23950
+ CHAR_9: 57,
23951
+ CHAR_UPPERCASE_A: 65,
23952
+ CHAR_LOWERCASE_A: 97,
23953
+ CHAR_UPPERCASE_Z: 90,
23954
+ CHAR_LOWERCASE_Z: 122,
23955
+ CHAR_LEFT_PARENTHESES: 40,
23956
+ CHAR_RIGHT_PARENTHESES: 41,
23957
+ CHAR_ASTERISK: 42,
23958
+ CHAR_AMPERSAND: 38,
23959
+ CHAR_AT: 64,
23960
+ CHAR_BACKWARD_SLASH: 92,
23961
+ CHAR_CARRIAGE_RETURN: 13,
23962
+ CHAR_CIRCUMFLEX_ACCENT: 94,
23963
+ CHAR_COLON: 58,
23964
+ CHAR_COMMA: 44,
23965
+ CHAR_DOT: 46,
23966
+ CHAR_DOUBLE_QUOTE: 34,
23967
+ CHAR_EQUAL: 61,
23968
+ CHAR_EXCLAMATION_MARK: 33,
23969
+ CHAR_FORM_FEED: 12,
23970
+ CHAR_FORWARD_SLASH: 47,
23971
+ CHAR_GRAVE_ACCENT: 96,
23972
+ CHAR_HASH: 35,
23973
+ CHAR_HYPHEN_MINUS: 45,
23974
+ CHAR_LEFT_ANGLE_BRACKET: 60,
23975
+ CHAR_LEFT_CURLY_BRACE: 123,
23976
+ CHAR_LEFT_SQUARE_BRACKET: 91,
23977
+ CHAR_LINE_FEED: 10,
23978
+ CHAR_NO_BREAK_SPACE: 160,
23979
+ CHAR_PERCENT: 37,
23980
+ CHAR_PLUS: 43,
23981
+ CHAR_QUESTION_MARK: 63,
23982
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
23983
+ CHAR_RIGHT_CURLY_BRACE: 125,
23984
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
23985
+ CHAR_SEMICOLON: 59,
23986
+ CHAR_SINGLE_QUOTE: 39,
23987
+ CHAR_SPACE: 32,
23988
+ CHAR_TAB: 9,
23989
+ CHAR_UNDERSCORE: 95,
23990
+ CHAR_VERTICAL_LINE: 124,
23991
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
23992
+ extglobChars(chars$1) {
23993
+ return {
23994
+ "!": {
23995
+ type: "negate",
23996
+ open: "(?:(?!(?:",
23997
+ close: `))${chars$1.STAR})`
23998
+ },
23999
+ "?": {
24000
+ type: "qmark",
24001
+ open: "(?:",
24002
+ close: ")?"
24003
+ },
24004
+ "+": {
24005
+ type: "plus",
24006
+ open: "(?:",
24007
+ close: ")+"
24008
+ },
24009
+ "*": {
24010
+ type: "star",
24011
+ open: "(?:",
24012
+ close: ")*"
24013
+ },
24014
+ "@": {
24015
+ type: "at",
24016
+ open: "(?:",
24017
+ close: ")"
24018
+ }
24019
+ };
24020
+ },
24021
+ globChars(win32) {
24022
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
24023
+ }
24024
+ };
24025
+ }) });
24026
+
24027
+ //#endregion
24028
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js
24029
+ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js": ((exports) => {
24030
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
24031
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
24032
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
24033
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
24034
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
24035
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
24036
+ exports.isWindows = () => {
24037
+ if (typeof navigator !== "undefined" && navigator.platform) {
24038
+ const platform = navigator.platform.toLowerCase();
24039
+ return platform === "win32" || platform === "windows";
24040
+ }
24041
+ if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
24042
+ return false;
24043
+ };
24044
+ exports.removeBackslashes = (str) => {
24045
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
24046
+ return match === "\\" ? "" : match;
24047
+ });
24048
+ };
24049
+ exports.escapeLast = (input, char, lastIdx) => {
24050
+ const idx = input.lastIndexOf(char, lastIdx);
24051
+ if (idx === -1) return input;
24052
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
24053
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
24054
+ };
24055
+ exports.removePrefix = (input, state = {}) => {
24056
+ let output = input;
24057
+ if (output.startsWith("./")) {
24058
+ output = output.slice(2);
24059
+ state.prefix = "./";
24060
+ }
24061
+ return output;
24062
+ };
24063
+ exports.wrapOutput = (input, state = {}, options = {}) => {
24064
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
24065
+ if (state.negated === true) output = `(?:^(?!${output}).*$)`;
24066
+ return output;
24067
+ };
24068
+ exports.basename = (path$1, { windows } = {}) => {
24069
+ const segs = path$1.split(windows ? /[\\/]/ : "/");
24070
+ const last = segs[segs.length - 1];
24071
+ if (last === "") return segs[segs.length - 2];
24072
+ return last;
24073
+ };
24074
+ }) });
24075
+
24076
+ //#endregion
24077
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js
24078
+ var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js": ((exports, module) => {
24079
+ const utils$3 = require_utils();
24080
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
24081
+ const isPathSeparator = (code) => {
24082
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
24083
+ };
24084
+ const depth = (token) => {
24085
+ if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
24086
+ };
24087
+ /**
24088
+ * Quickly scans a glob pattern and returns an object with a handful of
24089
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
24090
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
24091
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
24092
+ *
24093
+ * ```js
24094
+ * const pm = require('picomatch');
24095
+ * console.log(pm.scan('foo/bar/*.js'));
24096
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
24097
+ * ```
24098
+ * @param {String} `str`
24099
+ * @param {Object} `options`
24100
+ * @return {Object} Returns an object with tokens and regex source string.
24101
+ * @api public
24102
+ */
24103
+ const scan$1 = (input, options) => {
24104
+ const opts = options || {};
24105
+ const length = input.length - 1;
24106
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
24107
+ const slashes = [];
24108
+ const tokens = [];
24109
+ const parts = [];
24110
+ let str = input;
24111
+ let index = -1;
24112
+ let start = 0;
24113
+ let lastIndex = 0;
24114
+ let isBrace = false;
24115
+ let isBracket = false;
24116
+ let isGlob = false;
24117
+ let isExtglob = false;
24118
+ let isGlobstar = false;
24119
+ let braceEscaped = false;
24120
+ let backslashes = false;
24121
+ let negated = false;
24122
+ let negatedExtglob = false;
24123
+ let finished = false;
24124
+ let braces = 0;
24125
+ let prev;
24126
+ let code;
24127
+ let token = {
24128
+ value: "",
24129
+ depth: 0,
24130
+ isGlob: false
24131
+ };
24132
+ const eos = () => index >= length;
24133
+ const peek = () => str.charCodeAt(index + 1);
24134
+ const advance = () => {
24135
+ prev = code;
24136
+ return str.charCodeAt(++index);
24137
+ };
24138
+ while (index < length) {
24139
+ code = advance();
24140
+ let next;
24141
+ if (code === CHAR_BACKWARD_SLASH) {
24142
+ backslashes = token.backslashes = true;
24143
+ code = advance();
24144
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
24145
+ continue;
24146
+ }
24147
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
24148
+ braces++;
24149
+ while (eos() !== true && (code = advance())) {
24150
+ if (code === CHAR_BACKWARD_SLASH) {
24151
+ backslashes = token.backslashes = true;
24152
+ advance();
24153
+ continue;
24154
+ }
24155
+ if (code === CHAR_LEFT_CURLY_BRACE) {
24156
+ braces++;
24157
+ continue;
24158
+ }
24159
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
24160
+ isBrace = token.isBrace = true;
24161
+ isGlob = token.isGlob = true;
24162
+ finished = true;
24163
+ if (scanToEnd === true) continue;
24164
+ break;
24165
+ }
24166
+ if (braceEscaped !== true && code === CHAR_COMMA) {
24167
+ isBrace = token.isBrace = true;
24168
+ isGlob = token.isGlob = true;
24169
+ finished = true;
24170
+ if (scanToEnd === true) continue;
24171
+ break;
24172
+ }
24173
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
24174
+ braces--;
24175
+ if (braces === 0) {
24176
+ braceEscaped = false;
24177
+ isBrace = token.isBrace = true;
24178
+ finished = true;
24179
+ break;
24180
+ }
24181
+ }
24182
+ }
24183
+ if (scanToEnd === true) continue;
24184
+ break;
24185
+ }
24186
+ if (code === CHAR_FORWARD_SLASH) {
24187
+ slashes.push(index);
24188
+ tokens.push(token);
24189
+ token = {
24190
+ value: "",
24191
+ depth: 0,
24192
+ isGlob: false
24193
+ };
24194
+ if (finished === true) continue;
24195
+ if (prev === CHAR_DOT && index === start + 1) {
24196
+ start += 2;
24197
+ continue;
24198
+ }
24199
+ lastIndex = index + 1;
24200
+ continue;
24201
+ }
24202
+ if (opts.noext !== true) {
24203
+ if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
24204
+ isGlob = token.isGlob = true;
24205
+ isExtglob = token.isExtglob = true;
24206
+ finished = true;
24207
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
24208
+ if (scanToEnd === true) {
24209
+ while (eos() !== true && (code = advance())) {
24210
+ if (code === CHAR_BACKWARD_SLASH) {
24211
+ backslashes = token.backslashes = true;
24212
+ code = advance();
24213
+ continue;
24214
+ }
24215
+ if (code === CHAR_RIGHT_PARENTHESES) {
24216
+ isGlob = token.isGlob = true;
24217
+ finished = true;
24218
+ break;
24219
+ }
24220
+ }
24221
+ continue;
24222
+ }
24223
+ break;
24224
+ }
24225
+ }
24226
+ if (code === CHAR_ASTERISK) {
24227
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
24228
+ isGlob = token.isGlob = true;
24229
+ finished = true;
24230
+ if (scanToEnd === true) continue;
24231
+ break;
24232
+ }
24233
+ if (code === CHAR_QUESTION_MARK) {
24234
+ isGlob = token.isGlob = true;
24235
+ finished = true;
24236
+ if (scanToEnd === true) continue;
24237
+ break;
24238
+ }
24239
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
24240
+ while (eos() !== true && (next = advance())) {
24241
+ if (next === CHAR_BACKWARD_SLASH) {
24242
+ backslashes = token.backslashes = true;
24243
+ advance();
24244
+ continue;
24245
+ }
24246
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
24247
+ isBracket = token.isBracket = true;
24248
+ isGlob = token.isGlob = true;
24249
+ finished = true;
24250
+ break;
24251
+ }
24252
+ }
24253
+ if (scanToEnd === true) continue;
24254
+ break;
24255
+ }
24256
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
24257
+ negated = token.negated = true;
24258
+ start++;
24259
+ continue;
24260
+ }
24261
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
24262
+ isGlob = token.isGlob = true;
24263
+ if (scanToEnd === true) {
24264
+ while (eos() !== true && (code = advance())) {
24265
+ if (code === CHAR_LEFT_PARENTHESES) {
24266
+ backslashes = token.backslashes = true;
24267
+ code = advance();
24268
+ continue;
24269
+ }
24270
+ if (code === CHAR_RIGHT_PARENTHESES) {
24271
+ finished = true;
24272
+ break;
24273
+ }
24274
+ }
24275
+ continue;
24276
+ }
24277
+ break;
24278
+ }
24279
+ if (isGlob === true) {
24280
+ finished = true;
24281
+ if (scanToEnd === true) continue;
24282
+ break;
24283
+ }
24284
+ }
24285
+ if (opts.noext === true) {
24286
+ isExtglob = false;
24287
+ isGlob = false;
24288
+ }
24289
+ let base = str;
24290
+ let prefix = "";
24291
+ let glob = "";
24292
+ if (start > 0) {
24293
+ prefix = str.slice(0, start);
24294
+ str = str.slice(start);
24295
+ lastIndex -= start;
24296
+ }
24297
+ if (base && isGlob === true && lastIndex > 0) {
24298
+ base = str.slice(0, lastIndex);
24299
+ glob = str.slice(lastIndex);
24300
+ } else if (isGlob === true) {
24301
+ base = "";
24302
+ glob = str;
24303
+ } else base = str;
24304
+ if (base && base !== "" && base !== "/" && base !== str) {
24305
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
24306
+ }
24307
+ if (opts.unescape === true) {
24308
+ if (glob) glob = utils$3.removeBackslashes(glob);
24309
+ if (base && backslashes === true) base = utils$3.removeBackslashes(base);
24310
+ }
24311
+ const state = {
24312
+ prefix,
24313
+ input,
24314
+ start,
24315
+ base,
24316
+ glob,
24317
+ isBrace,
24318
+ isBracket,
24319
+ isGlob,
24320
+ isExtglob,
24321
+ isGlobstar,
24322
+ negated,
24323
+ negatedExtglob
24324
+ };
24325
+ if (opts.tokens === true) {
24326
+ state.maxDepth = 0;
24327
+ if (!isPathSeparator(code)) tokens.push(token);
24328
+ state.tokens = tokens;
24329
+ }
24330
+ if (opts.parts === true || opts.tokens === true) {
24331
+ let prevIndex;
24332
+ for (let idx = 0; idx < slashes.length; idx++) {
24333
+ const n$1 = prevIndex ? prevIndex + 1 : start;
24334
+ const i$1 = slashes[idx];
24335
+ const value = input.slice(n$1, i$1);
24336
+ if (opts.tokens) {
24337
+ if (idx === 0 && start !== 0) {
24338
+ tokens[idx].isPrefix = true;
24339
+ tokens[idx].value = prefix;
24340
+ } else tokens[idx].value = value;
24341
+ depth(tokens[idx]);
24342
+ state.maxDepth += tokens[idx].depth;
24343
+ }
24344
+ if (idx !== 0 || value !== "") parts.push(value);
24345
+ prevIndex = i$1;
24346
+ }
24347
+ if (prevIndex && prevIndex + 1 < input.length) {
24348
+ const value = input.slice(prevIndex + 1);
24349
+ parts.push(value);
24350
+ if (opts.tokens) {
24351
+ tokens[tokens.length - 1].value = value;
24352
+ depth(tokens[tokens.length - 1]);
24353
+ state.maxDepth += tokens[tokens.length - 1].depth;
24354
+ }
24355
+ }
24356
+ state.slashes = slashes;
24357
+ state.parts = parts;
24358
+ }
24359
+ return state;
24360
+ };
24361
+ module.exports = scan$1;
24362
+ }) });
24363
+
24364
+ //#endregion
24365
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js
24366
+ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js": ((exports, module) => {
24367
+ const constants$1 = require_constants();
24368
+ const utils$2 = require_utils();
24369
+ /**
24370
+ * Constants
24371
+ */
24372
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
24373
+ /**
24374
+ * Helpers
24375
+ */
24376
+ const expandRange = (args, options) => {
24377
+ if (typeof options.expandRange === "function") return options.expandRange(...args, options);
24378
+ args.sort();
24379
+ const value = `[${args.join("-")}]`;
24380
+ try {
24381
+ new RegExp(value);
24382
+ } catch (ex) {
24383
+ return args.map((v) => utils$2.escapeRegex(v)).join("..");
24384
+ }
24385
+ return value;
24386
+ };
24387
+ /**
24388
+ * Create the message for a syntax error
24389
+ */
24390
+ const syntaxError = (type, char) => {
24391
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
24392
+ };
24393
+ /**
24394
+ * Parse the given input string.
24395
+ * @param {String} input
24396
+ * @param {Object} options
24397
+ * @return {Object}
24398
+ */
24399
+ const parse$1 = (input, options) => {
24400
+ if (typeof input !== "string") throw new TypeError("Expected a string");
24401
+ input = REPLACEMENTS[input] || input;
24402
+ const opts = { ...options };
24403
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
24404
+ let len = input.length;
24405
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
24406
+ const bos = {
24407
+ type: "bos",
24408
+ value: "",
24409
+ output: opts.prepend || ""
24410
+ };
24411
+ const tokens = [bos];
24412
+ const capture = opts.capture ? "" : "?:";
24413
+ const PLATFORM_CHARS = constants$1.globChars(opts.windows);
24414
+ const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
24415
+ const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
24416
+ const globstar = (opts$1) => {
24417
+ return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
24418
+ };
24419
+ const nodot = opts.dot ? "" : NO_DOT;
24420
+ const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
24421
+ let star = opts.bash === true ? globstar(opts) : STAR;
24422
+ if (opts.capture) star = `(${star})`;
24423
+ if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
24424
+ const state = {
24425
+ input,
24426
+ index: -1,
24427
+ start: 0,
24428
+ dot: opts.dot === true,
24429
+ consumed: "",
24430
+ output: "",
24431
+ prefix: "",
24432
+ backtrack: false,
24433
+ negated: false,
24434
+ brackets: 0,
24435
+ braces: 0,
24436
+ parens: 0,
24437
+ quotes: 0,
24438
+ globstar: false,
24439
+ tokens
24440
+ };
24441
+ input = utils$2.removePrefix(input, state);
24442
+ len = input.length;
24443
+ const extglobs = [];
24444
+ const braces = [];
24445
+ const stack = [];
24446
+ let prev = bos;
24447
+ let value;
24448
+ /**
24449
+ * Tokenizing helpers
24450
+ */
24451
+ const eos = () => state.index === len - 1;
24452
+ const peek = state.peek = (n$1 = 1) => input[state.index + n$1];
24453
+ const advance = state.advance = () => input[++state.index] || "";
24454
+ const remaining = () => input.slice(state.index + 1);
24455
+ const consume = (value$1 = "", num = 0) => {
24456
+ state.consumed += value$1;
24457
+ state.index += num;
24458
+ };
24459
+ const append = (token) => {
24460
+ state.output += token.output != null ? token.output : token.value;
24461
+ consume(token.value);
24462
+ };
24463
+ const negate = () => {
24464
+ let count = 1;
24465
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
24466
+ advance();
24467
+ state.start++;
24468
+ count++;
24469
+ }
24470
+ if (count % 2 === 0) return false;
24471
+ state.negated = true;
24472
+ state.start++;
24473
+ return true;
24474
+ };
24475
+ const increment = (type) => {
24476
+ state[type]++;
24477
+ stack.push(type);
24478
+ };
24479
+ const decrement = (type) => {
24480
+ state[type]--;
24481
+ stack.pop();
24482
+ };
24483
+ /**
24484
+ * Push tokens onto the tokens array. This helper speeds up
24485
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
24486
+ * and 2) helping us avoid creating extra tokens when consecutive
24487
+ * characters are plain text. This improves performance and simplifies
24488
+ * lookbehinds.
24489
+ */
24490
+ const push = (tok) => {
24491
+ if (prev.type === "globstar") {
24492
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
24493
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
24494
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
24495
+ state.output = state.output.slice(0, -prev.output.length);
24496
+ prev.type = "star";
24497
+ prev.value = "*";
24498
+ prev.output = star;
24499
+ state.output += prev.output;
24500
+ }
24501
+ }
24502
+ if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
24503
+ if (tok.value || tok.output) append(tok);
24504
+ if (prev && prev.type === "text" && tok.type === "text") {
24505
+ prev.output = (prev.output || prev.value) + tok.value;
24506
+ prev.value += tok.value;
24507
+ return;
24508
+ }
24509
+ tok.prev = prev;
24510
+ tokens.push(tok);
24511
+ prev = tok;
24512
+ };
24513
+ const extglobOpen = (type, value$1) => {
24514
+ const token = {
24515
+ ...EXTGLOB_CHARS[value$1],
24516
+ conditions: 1,
24517
+ inner: ""
24518
+ };
24519
+ token.prev = prev;
24520
+ token.parens = state.parens;
24521
+ token.output = state.output;
24522
+ const output = (opts.capture ? "(" : "") + token.open;
24523
+ increment("parens");
24524
+ push({
24525
+ type,
24526
+ value: value$1,
24527
+ output: state.output ? "" : ONE_CHAR$1
24528
+ });
24529
+ push({
24530
+ type: "paren",
24531
+ extglob: true,
24532
+ value: advance(),
24533
+ output
24534
+ });
24535
+ extglobs.push(token);
24536
+ };
24537
+ const extglobClose = (token) => {
24538
+ let output = token.close + (opts.capture ? ")" : "");
24539
+ let rest;
24540
+ if (token.type === "negate") {
24541
+ let extglobStar = star;
24542
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
24543
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
24544
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse$1(rest, {
24545
+ ...options,
24546
+ fastpaths: false
24547
+ }).output})${extglobStar})`;
24548
+ if (token.prev.type === "bos") state.negatedExtglob = true;
24549
+ }
24550
+ push({
24551
+ type: "paren",
24552
+ extglob: true,
24553
+ value,
24554
+ output
24555
+ });
24556
+ decrement("parens");
24557
+ };
24558
+ /**
24559
+ * Fast paths
24560
+ */
24561
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
24562
+ let backslashes = false;
24563
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars$1, first, rest, index) => {
24564
+ if (first === "\\") {
24565
+ backslashes = true;
24566
+ return m;
24567
+ }
24568
+ if (first === "?") {
24569
+ if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
24570
+ if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
24571
+ return QMARK$1.repeat(chars$1.length);
24572
+ }
24573
+ if (first === ".") return DOT_LITERAL$1.repeat(chars$1.length);
24574
+ if (first === "*") {
24575
+ if (esc) return esc + first + (rest ? star : "");
24576
+ return star;
24577
+ }
24578
+ return esc ? m : `\\${m}`;
24579
+ });
24580
+ if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
24581
+ else output = output.replace(/\\+/g, (m) => {
24582
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
24583
+ });
24584
+ if (output === input && opts.contains === true) {
24585
+ state.output = input;
24586
+ return state;
24587
+ }
24588
+ state.output = utils$2.wrapOutput(output, state, options);
24589
+ return state;
24590
+ }
24591
+ /**
24592
+ * Tokenize input until we reach end-of-string
24593
+ */
24594
+ while (!eos()) {
24595
+ value = advance();
24596
+ if (value === "\0") continue;
24597
+ /**
24598
+ * Escaped characters
24599
+ */
24600
+ if (value === "\\") {
24601
+ const next = peek();
24602
+ if (next === "/" && opts.bash !== true) continue;
24603
+ if (next === "." || next === ";") continue;
24604
+ if (!next) {
24605
+ value += "\\";
24606
+ push({
24607
+ type: "text",
24608
+ value
24609
+ });
24610
+ continue;
24611
+ }
24612
+ const match = /^\\+/.exec(remaining());
24613
+ let slashes = 0;
24614
+ if (match && match[0].length > 2) {
24615
+ slashes = match[0].length;
24616
+ state.index += slashes;
24617
+ if (slashes % 2 !== 0) value += "\\";
24618
+ }
24619
+ if (opts.unescape === true) value = advance();
24620
+ else value += advance();
24621
+ if (state.brackets === 0) {
24622
+ push({
24623
+ type: "text",
24624
+ value
24625
+ });
24626
+ continue;
24627
+ }
24628
+ }
24629
+ /**
24630
+ * If we're inside a regex character class, continue
24631
+ * until we reach the closing bracket.
24632
+ */
24633
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
24634
+ if (opts.posix !== false && value === ":") {
24635
+ const inner = prev.value.slice(1);
24636
+ if (inner.includes("[")) {
24637
+ prev.posix = true;
24638
+ if (inner.includes(":")) {
24639
+ const idx = prev.value.lastIndexOf("[");
24640
+ const pre = prev.value.slice(0, idx);
24641
+ const posix$1 = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
24642
+ if (posix$1) {
24643
+ prev.value = pre + posix$1;
24644
+ state.backtrack = true;
24645
+ advance();
24646
+ if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
24647
+ continue;
24648
+ }
24649
+ }
24650
+ }
24651
+ }
24652
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
24653
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
24654
+ if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
24655
+ prev.value += value;
24656
+ append({ value });
24657
+ continue;
24658
+ }
24659
+ /**
24660
+ * If we're inside a quoted string, continue
24661
+ * until we reach the closing double quote.
24662
+ */
24663
+ if (state.quotes === 1 && value !== "\"") {
24664
+ value = utils$2.escapeRegex(value);
24665
+ prev.value += value;
24666
+ append({ value });
24667
+ continue;
24668
+ }
24669
+ /**
24670
+ * Double quotes
24671
+ */
24672
+ if (value === "\"") {
24673
+ state.quotes = state.quotes === 1 ? 0 : 1;
24674
+ if (opts.keepQuotes === true) push({
24675
+ type: "text",
24676
+ value
24677
+ });
24678
+ continue;
24679
+ }
24680
+ /**
24681
+ * Parentheses
24682
+ */
24683
+ if (value === "(") {
24684
+ increment("parens");
24685
+ push({
24686
+ type: "paren",
24687
+ value
24688
+ });
24689
+ continue;
24690
+ }
24691
+ if (value === ")") {
24692
+ if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
24693
+ const extglob = extglobs[extglobs.length - 1];
24694
+ if (extglob && state.parens === extglob.parens + 1) {
24695
+ extglobClose(extglobs.pop());
24696
+ continue;
24697
+ }
24698
+ push({
24699
+ type: "paren",
24700
+ value,
24701
+ output: state.parens ? ")" : "\\)"
24702
+ });
24703
+ decrement("parens");
24704
+ continue;
24705
+ }
24706
+ /**
24707
+ * Square brackets
24708
+ */
24709
+ if (value === "[") {
24710
+ if (opts.nobracket === true || !remaining().includes("]")) {
24711
+ if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
24712
+ value = `\\${value}`;
24713
+ } else increment("brackets");
24714
+ push({
24715
+ type: "bracket",
24716
+ value
24717
+ });
24718
+ continue;
24719
+ }
24720
+ if (value === "]") {
24721
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
24722
+ push({
24723
+ type: "text",
24724
+ value,
24725
+ output: `\\${value}`
24726
+ });
24727
+ continue;
24728
+ }
24729
+ if (state.brackets === 0) {
24730
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
24731
+ push({
24732
+ type: "text",
24733
+ value,
24734
+ output: `\\${value}`
24735
+ });
24736
+ continue;
24737
+ }
24738
+ decrement("brackets");
24739
+ const prevValue = prev.value.slice(1);
24740
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
24741
+ prev.value += value;
24742
+ append({ value });
24743
+ if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
24744
+ const escaped = utils$2.escapeRegex(prev.value);
24745
+ state.output = state.output.slice(0, -prev.value.length);
24746
+ if (opts.literalBrackets === true) {
24747
+ state.output += escaped;
24748
+ prev.value = escaped;
24749
+ continue;
24750
+ }
24751
+ prev.value = `(${capture}${escaped}|${prev.value})`;
24752
+ state.output += prev.value;
24753
+ continue;
24754
+ }
24755
+ /**
24756
+ * Braces
24757
+ */
24758
+ if (value === "{" && opts.nobrace !== true) {
24759
+ increment("braces");
24760
+ const open = {
24761
+ type: "brace",
24762
+ value,
24763
+ output: "(",
24764
+ outputIndex: state.output.length,
24765
+ tokensIndex: state.tokens.length
24766
+ };
24767
+ braces.push(open);
24768
+ push(open);
24769
+ continue;
24770
+ }
24771
+ if (value === "}") {
24772
+ const brace = braces[braces.length - 1];
24773
+ if (opts.nobrace === true || !brace) {
24774
+ push({
24775
+ type: "text",
24776
+ value,
24777
+ output: value
24778
+ });
24779
+ continue;
24780
+ }
24781
+ let output = ")";
24782
+ if (brace.dots === true) {
24783
+ const arr = tokens.slice();
24784
+ const range = [];
24785
+ for (let i$1 = arr.length - 1; i$1 >= 0; i$1--) {
24786
+ tokens.pop();
24787
+ if (arr[i$1].type === "brace") break;
24788
+ if (arr[i$1].type !== "dots") range.unshift(arr[i$1].value);
24789
+ }
24790
+ output = expandRange(range, opts);
24791
+ state.backtrack = true;
24792
+ }
24793
+ if (brace.comma !== true && brace.dots !== true) {
24794
+ const out = state.output.slice(0, brace.outputIndex);
24795
+ const toks = state.tokens.slice(brace.tokensIndex);
24796
+ brace.value = brace.output = "\\{";
24797
+ value = output = "\\}";
24798
+ state.output = out;
24799
+ for (const t$5 of toks) state.output += t$5.output || t$5.value;
24800
+ }
24801
+ push({
24802
+ type: "brace",
24803
+ value,
24804
+ output
24805
+ });
24806
+ decrement("braces");
24807
+ braces.pop();
24808
+ continue;
24809
+ }
24810
+ /**
24811
+ * Pipes
24812
+ */
24813
+ if (value === "|") {
24814
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
24815
+ push({
24816
+ type: "text",
24817
+ value
24818
+ });
24819
+ continue;
24820
+ }
24821
+ /**
24822
+ * Commas
24823
+ */
24824
+ if (value === ",") {
24825
+ let output = value;
24826
+ const brace = braces[braces.length - 1];
24827
+ if (brace && stack[stack.length - 1] === "braces") {
24828
+ brace.comma = true;
24829
+ output = "|";
24830
+ }
24831
+ push({
24832
+ type: "comma",
24833
+ value,
24834
+ output
24835
+ });
24836
+ continue;
24837
+ }
24838
+ /**
24839
+ * Slashes
24840
+ */
24841
+ if (value === "/") {
24842
+ if (prev.type === "dot" && state.index === state.start + 1) {
24843
+ state.start = state.index + 1;
24844
+ state.consumed = "";
24845
+ state.output = "";
24846
+ tokens.pop();
24847
+ prev = bos;
24848
+ continue;
24849
+ }
24850
+ push({
24851
+ type: "slash",
24852
+ value,
24853
+ output: SLASH_LITERAL$1
24854
+ });
24855
+ continue;
24856
+ }
24857
+ /**
24858
+ * Dots
24859
+ */
24860
+ if (value === ".") {
24861
+ if (state.braces > 0 && prev.type === "dot") {
24862
+ if (prev.value === ".") prev.output = DOT_LITERAL$1;
24863
+ const brace = braces[braces.length - 1];
24864
+ prev.type = "dots";
24865
+ prev.output += value;
24866
+ prev.value += value;
24867
+ brace.dots = true;
24868
+ continue;
24869
+ }
24870
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
24871
+ push({
24872
+ type: "text",
24873
+ value,
24874
+ output: DOT_LITERAL$1
24875
+ });
24876
+ continue;
24877
+ }
24878
+ push({
24879
+ type: "dot",
24880
+ value,
24881
+ output: DOT_LITERAL$1
24882
+ });
24883
+ continue;
24884
+ }
24885
+ /**
24886
+ * Question marks
24887
+ */
24888
+ if (value === "?") {
24889
+ if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
24890
+ extglobOpen("qmark", value);
24891
+ continue;
24892
+ }
24893
+ if (prev && prev.type === "paren") {
24894
+ const next = peek();
24895
+ let output = value;
24896
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
24897
+ push({
24898
+ type: "text",
24899
+ value,
24900
+ output
24901
+ });
24902
+ continue;
24903
+ }
24904
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
24905
+ push({
24906
+ type: "qmark",
24907
+ value,
24908
+ output: QMARK_NO_DOT
24909
+ });
24910
+ continue;
24911
+ }
24912
+ push({
24913
+ type: "qmark",
24914
+ value,
24915
+ output: QMARK$1
24916
+ });
24917
+ continue;
24918
+ }
24919
+ /**
24920
+ * Exclamation
24921
+ */
24922
+ if (value === "!") {
24923
+ if (opts.noextglob !== true && peek() === "(") {
24924
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
24925
+ extglobOpen("negate", value);
24926
+ continue;
24927
+ }
24928
+ }
24929
+ if (opts.nonegate !== true && state.index === 0) {
24930
+ negate();
24931
+ continue;
24932
+ }
24933
+ }
24934
+ /**
24935
+ * Plus
24936
+ */
24937
+ if (value === "+") {
24938
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
24939
+ extglobOpen("plus", value);
24940
+ continue;
24941
+ }
24942
+ if (prev && prev.value === "(" || opts.regex === false) {
24943
+ push({
24944
+ type: "plus",
24945
+ value,
24946
+ output: PLUS_LITERAL$1
24947
+ });
24948
+ continue;
24949
+ }
24950
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
24951
+ push({
24952
+ type: "plus",
24953
+ value
24954
+ });
24955
+ continue;
24956
+ }
24957
+ push({
24958
+ type: "plus",
24959
+ value: PLUS_LITERAL$1
24960
+ });
24961
+ continue;
24962
+ }
24963
+ /**
24964
+ * Plain text
24965
+ */
24966
+ if (value === "@") {
24967
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
24968
+ push({
24969
+ type: "at",
24970
+ extglob: true,
24971
+ value,
24972
+ output: ""
24973
+ });
24974
+ continue;
24975
+ }
24976
+ push({
24977
+ type: "text",
24978
+ value
24979
+ });
24980
+ continue;
24981
+ }
24982
+ /**
24983
+ * Plain text
24984
+ */
24985
+ if (value !== "*") {
24986
+ if (value === "$" || value === "^") value = `\\${value}`;
24987
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
24988
+ if (match) {
24989
+ value += match[0];
24990
+ state.index += match[0].length;
24991
+ }
24992
+ push({
24993
+ type: "text",
24994
+ value
24995
+ });
24996
+ continue;
24997
+ }
24998
+ /**
24999
+ * Stars
25000
+ */
25001
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
25002
+ prev.type = "star";
25003
+ prev.star = true;
25004
+ prev.value += value;
25005
+ prev.output = star;
25006
+ state.backtrack = true;
25007
+ state.globstar = true;
25008
+ consume(value);
25009
+ continue;
25010
+ }
25011
+ let rest = remaining();
25012
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
25013
+ extglobOpen("star", value);
25014
+ continue;
25015
+ }
25016
+ if (prev.type === "star") {
25017
+ if (opts.noglobstar === true) {
25018
+ consume(value);
25019
+ continue;
25020
+ }
25021
+ const prior = prev.prev;
25022
+ const before = prior.prev;
25023
+ const isStart = prior.type === "slash" || prior.type === "bos";
25024
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
25025
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
25026
+ push({
25027
+ type: "star",
25028
+ value,
25029
+ output: ""
25030
+ });
25031
+ continue;
25032
+ }
25033
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
25034
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
25035
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
25036
+ push({
25037
+ type: "star",
25038
+ value,
25039
+ output: ""
25040
+ });
25041
+ continue;
25042
+ }
25043
+ while (rest.slice(0, 3) === "/**") {
25044
+ const after = input[state.index + 4];
25045
+ if (after && after !== "/") break;
25046
+ rest = rest.slice(3);
25047
+ consume("/**", 3);
25048
+ }
25049
+ if (prior.type === "bos" && eos()) {
25050
+ prev.type = "globstar";
25051
+ prev.value += value;
25052
+ prev.output = globstar(opts);
25053
+ state.output = prev.output;
25054
+ state.globstar = true;
25055
+ consume(value);
25056
+ continue;
25057
+ }
25058
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
25059
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
25060
+ prior.output = `(?:${prior.output}`;
25061
+ prev.type = "globstar";
25062
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
25063
+ prev.value += value;
25064
+ state.globstar = true;
25065
+ state.output += prior.output + prev.output;
25066
+ consume(value);
25067
+ continue;
25068
+ }
25069
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
25070
+ const end = rest[1] !== void 0 ? "|$" : "";
25071
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
25072
+ prior.output = `(?:${prior.output}`;
25073
+ prev.type = "globstar";
25074
+ prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
25075
+ prev.value += value;
25076
+ state.output += prior.output + prev.output;
25077
+ state.globstar = true;
25078
+ consume(value + advance());
25079
+ push({
25080
+ type: "slash",
25081
+ value: "/",
25082
+ output: ""
25083
+ });
25084
+ continue;
25085
+ }
25086
+ if (prior.type === "bos" && rest[0] === "/") {
25087
+ prev.type = "globstar";
25088
+ prev.value += value;
25089
+ prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
25090
+ state.output = prev.output;
25091
+ state.globstar = true;
25092
+ consume(value + advance());
25093
+ push({
25094
+ type: "slash",
25095
+ value: "/",
25096
+ output: ""
25097
+ });
25098
+ continue;
25099
+ }
25100
+ state.output = state.output.slice(0, -prev.output.length);
25101
+ prev.type = "globstar";
25102
+ prev.output = globstar(opts);
25103
+ prev.value += value;
25104
+ state.output += prev.output;
25105
+ state.globstar = true;
25106
+ consume(value);
25107
+ continue;
25108
+ }
25109
+ const token = {
25110
+ type: "star",
25111
+ value,
25112
+ output: star
25113
+ };
25114
+ if (opts.bash === true) {
25115
+ token.output = ".*?";
25116
+ if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
25117
+ push(token);
25118
+ continue;
25119
+ }
25120
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
25121
+ token.output = value;
25122
+ push(token);
25123
+ continue;
25124
+ }
25125
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
25126
+ if (prev.type === "dot") {
25127
+ state.output += NO_DOT_SLASH;
25128
+ prev.output += NO_DOT_SLASH;
25129
+ } else if (opts.dot === true) {
25130
+ state.output += NO_DOTS_SLASH;
25131
+ prev.output += NO_DOTS_SLASH;
25132
+ } else {
25133
+ state.output += nodot;
25134
+ prev.output += nodot;
25135
+ }
25136
+ if (peek() !== "*") {
25137
+ state.output += ONE_CHAR$1;
25138
+ prev.output += ONE_CHAR$1;
25139
+ }
25140
+ }
25141
+ push(token);
25142
+ }
25143
+ while (state.brackets > 0) {
25144
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
25145
+ state.output = utils$2.escapeLast(state.output, "[");
25146
+ decrement("brackets");
25147
+ }
25148
+ while (state.parens > 0) {
25149
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
25150
+ state.output = utils$2.escapeLast(state.output, "(");
25151
+ decrement("parens");
25152
+ }
25153
+ while (state.braces > 0) {
25154
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
25155
+ state.output = utils$2.escapeLast(state.output, "{");
25156
+ decrement("braces");
25157
+ }
25158
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
25159
+ type: "maybe_slash",
25160
+ value: "",
25161
+ output: `${SLASH_LITERAL$1}?`
25162
+ });
25163
+ if (state.backtrack === true) {
25164
+ state.output = "";
25165
+ for (const token of state.tokens) {
25166
+ state.output += token.output != null ? token.output : token.value;
25167
+ if (token.suffix) state.output += token.suffix;
25168
+ }
25169
+ }
25170
+ return state;
25171
+ };
25172
+ /**
25173
+ * Fast paths for creating regular expressions for common glob patterns.
25174
+ * This can significantly speed up processing and has very little downside
25175
+ * impact when none of the fast paths match.
25176
+ */
25177
+ parse$1.fastpaths = (input, options) => {
25178
+ const opts = { ...options };
25179
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
25180
+ const len = input.length;
25181
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
25182
+ input = REPLACEMENTS[input] || input;
25183
+ const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
25184
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
25185
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
25186
+ const capture = opts.capture ? "" : "?:";
25187
+ const state = {
25188
+ negated: false,
25189
+ prefix: ""
25190
+ };
25191
+ let star = opts.bash === true ? ".*?" : STAR;
25192
+ if (opts.capture) star = `(${star})`;
25193
+ const globstar = (opts$1) => {
25194
+ if (opts$1.noglobstar === true) return star;
25195
+ return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
25196
+ };
25197
+ const create = (str) => {
25198
+ switch (str) {
25199
+ case "*": return `${nodot}${ONE_CHAR$1}${star}`;
25200
+ case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25201
+ case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25202
+ case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
25203
+ case "**": return nodot + globstar(opts);
25204
+ case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
25205
+ case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25206
+ case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25207
+ default: {
25208
+ const match = /^(.*?)\.(\w+)$/.exec(str);
25209
+ if (!match) return;
25210
+ const source$1 = create(match[1]);
25211
+ if (!source$1) return;
25212
+ return source$1 + DOT_LITERAL$1 + match[2];
25213
+ }
25214
+ }
25215
+ };
25216
+ let source = create(utils$2.removePrefix(input, state));
25217
+ if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
25218
+ return source;
25219
+ };
25220
+ module.exports = parse$1;
25221
+ }) });
25222
+
25223
+ //#endregion
25224
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js
25225
+ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
25226
+ const scan = require_scan();
25227
+ const parse = require_parse();
25228
+ const utils$1 = require_utils();
25229
+ const constants = require_constants();
25230
+ const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
25231
+ /**
25232
+ * Creates a matcher function from one or more glob patterns. The
25233
+ * returned function takes a string to match as its first argument,
25234
+ * and returns true if the string is a match. The returned matcher
25235
+ * function also takes a boolean as the second argument that, when true,
25236
+ * returns an object with additional information.
25237
+ *
25238
+ * ```js
25239
+ * const picomatch = require('picomatch');
25240
+ * // picomatch(glob[, options]);
25241
+ *
25242
+ * const isMatch = picomatch('*.!(*a)');
25243
+ * console.log(isMatch('a.a')); //=> false
25244
+ * console.log(isMatch('a.b')); //=> true
25245
+ * ```
25246
+ * @name picomatch
25247
+ * @param {String|Array} `globs` One or more glob patterns.
25248
+ * @param {Object=} `options`
25249
+ * @return {Function=} Returns a matcher function.
25250
+ * @api public
25251
+ */
25252
+ const picomatch$2 = (glob, options, returnState = false) => {
25253
+ if (Array.isArray(glob)) {
25254
+ const fns = glob.map((input) => picomatch$2(input, options, returnState));
25255
+ const arrayMatcher = (str) => {
25256
+ for (const isMatch of fns) {
25257
+ const state$1 = isMatch(str);
25258
+ if (state$1) return state$1;
25259
+ }
25260
+ return false;
25261
+ };
25262
+ return arrayMatcher;
25263
+ }
25264
+ const isState = isObject(glob) && glob.tokens && glob.input;
25265
+ if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
25266
+ const opts = options || {};
25267
+ const posix$1 = opts.windows;
25268
+ const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
25269
+ const state = regex.state;
25270
+ delete regex.state;
25271
+ let isIgnored = () => false;
25272
+ if (opts.ignore) {
25273
+ const ignoreOpts = {
25274
+ ...options,
25275
+ ignore: null,
25276
+ onMatch: null,
25277
+ onResult: null
25278
+ };
25279
+ isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
25280
+ }
25281
+ const matcher = (input, returnObject = false) => {
25282
+ const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
25283
+ glob,
25284
+ posix: posix$1
25285
+ });
25286
+ const result = {
25287
+ glob,
25288
+ state,
25289
+ regex,
25290
+ posix: posix$1,
25291
+ input,
25292
+ output,
25293
+ match,
25294
+ isMatch
25295
+ };
25296
+ if (typeof opts.onResult === "function") opts.onResult(result);
25297
+ if (isMatch === false) {
25298
+ result.isMatch = false;
25299
+ return returnObject ? result : false;
25300
+ }
25301
+ if (isIgnored(input)) {
25302
+ if (typeof opts.onIgnore === "function") opts.onIgnore(result);
25303
+ result.isMatch = false;
25304
+ return returnObject ? result : false;
25305
+ }
25306
+ if (typeof opts.onMatch === "function") opts.onMatch(result);
25307
+ return returnObject ? result : true;
25308
+ };
25309
+ if (returnState) matcher.state = state;
25310
+ return matcher;
25311
+ };
25312
+ /**
25313
+ * Test `input` with the given `regex`. This is used by the main
25314
+ * `picomatch()` function to test the input string.
25315
+ *
25316
+ * ```js
25317
+ * const picomatch = require('picomatch');
25318
+ * // picomatch.test(input, regex[, options]);
25319
+ *
25320
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
25321
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
25322
+ * ```
25323
+ * @param {String} `input` String to test.
25324
+ * @param {RegExp} `regex`
25325
+ * @return {Object} Returns an object with matching info.
25326
+ * @api public
25327
+ */
25328
+ picomatch$2.test = (input, regex, options, { glob, posix: posix$1 } = {}) => {
25329
+ if (typeof input !== "string") throw new TypeError("Expected input to be a string");
25330
+ if (input === "") return {
25331
+ isMatch: false,
25332
+ output: ""
25333
+ };
25334
+ const opts = options || {};
25335
+ const format$2 = opts.format || (posix$1 ? utils$1.toPosixSlashes : null);
25336
+ let match = input === glob;
25337
+ let output = match && format$2 ? format$2(input) : input;
25338
+ if (match === false) {
25339
+ output = format$2 ? format$2(input) : input;
25340
+ match = output === glob;
25341
+ }
25342
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
25343
+ else match = regex.exec(output);
25344
+ return {
25345
+ isMatch: Boolean(match),
25346
+ match,
25347
+ output
25348
+ };
25349
+ };
25350
+ /**
25351
+ * Match the basename of a filepath.
25352
+ *
25353
+ * ```js
25354
+ * const picomatch = require('picomatch');
25355
+ * // picomatch.matchBase(input, glob[, options]);
25356
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
25357
+ * ```
25358
+ * @param {String} `input` String to test.
25359
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
25360
+ * @return {Boolean}
25361
+ * @api public
25362
+ */
25363
+ picomatch$2.matchBase = (input, glob, options) => {
25364
+ return (glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options)).test(utils$1.basename(input));
25365
+ };
25366
+ /**
25367
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
25368
+ *
25369
+ * ```js
25370
+ * const picomatch = require('picomatch');
25371
+ * // picomatch.isMatch(string, patterns[, options]);
25372
+ *
25373
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
25374
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
25375
+ * ```
25376
+ * @param {String|Array} str The string to test.
25377
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
25378
+ * @param {Object} [options] See available [options](#options).
25379
+ * @return {Boolean} Returns true if any patterns match `str`
25380
+ * @api public
25381
+ */
25382
+ picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
25383
+ /**
25384
+ * Parse a glob pattern to create the source string for a regular
25385
+ * expression.
25386
+ *
25387
+ * ```js
25388
+ * const picomatch = require('picomatch');
25389
+ * const result = picomatch.parse(pattern[, options]);
25390
+ * ```
25391
+ * @param {String} `pattern`
25392
+ * @param {Object} `options`
25393
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
25394
+ * @api public
25395
+ */
25396
+ picomatch$2.parse = (pattern, options) => {
25397
+ if (Array.isArray(pattern)) return pattern.map((p$1) => picomatch$2.parse(p$1, options));
25398
+ return parse(pattern, {
25399
+ ...options,
25400
+ fastpaths: false
25401
+ });
25402
+ };
25403
+ /**
25404
+ * Scan a glob pattern to separate the pattern into segments.
25405
+ *
25406
+ * ```js
25407
+ * const picomatch = require('picomatch');
25408
+ * // picomatch.scan(input[, options]);
25409
+ *
25410
+ * const result = picomatch.scan('!./foo/*.js');
25411
+ * console.log(result);
25412
+ * { prefix: '!./',
25413
+ * input: '!./foo/*.js',
25414
+ * start: 3,
25415
+ * base: 'foo',
25416
+ * glob: '*.js',
25417
+ * isBrace: false,
25418
+ * isBracket: false,
25419
+ * isGlob: true,
25420
+ * isExtglob: false,
25421
+ * isGlobstar: false,
25422
+ * negated: true }
25423
+ * ```
25424
+ * @param {String} `input` Glob pattern to scan.
25425
+ * @param {Object} `options`
25426
+ * @return {Object} Returns an object with
25427
+ * @api public
25428
+ */
25429
+ picomatch$2.scan = (input, options) => scan(input, options);
25430
+ /**
25431
+ * Compile a regular expression from the `state` object returned by the
25432
+ * [parse()](#parse) method.
25433
+ *
25434
+ * @param {Object} `state`
25435
+ * @param {Object} `options`
25436
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
25437
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
25438
+ * @return {RegExp}
25439
+ * @api public
25440
+ */
25441
+ picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
25442
+ if (returnOutput === true) return state.output;
25443
+ const opts = options || {};
25444
+ const prepend = opts.contains ? "" : "^";
25445
+ const append = opts.contains ? "" : "$";
25446
+ let source = `${prepend}(?:${state.output})${append}`;
25447
+ if (state && state.negated === true) source = `^(?!${source}).*$`;
25448
+ const regex = picomatch$2.toRegex(source, options);
25449
+ if (returnState === true) regex.state = state;
25450
+ return regex;
25451
+ };
25452
+ /**
25453
+ * Create a regular expression from a parsed glob pattern.
25454
+ *
25455
+ * ```js
25456
+ * const picomatch = require('picomatch');
25457
+ * const state = picomatch.parse('*.js');
25458
+ * // picomatch.compileRe(state[, options]);
25459
+ *
25460
+ * console.log(picomatch.compileRe(state));
25461
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
25462
+ * ```
25463
+ * @param {String} `state` The object returned from the `.parse` method.
25464
+ * @param {Object} `options`
25465
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
25466
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
25467
+ * @return {RegExp} Returns a regex created from the given pattern.
25468
+ * @api public
25469
+ */
25470
+ picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
25471
+ if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
25472
+ let parsed = {
25473
+ negated: false,
25474
+ fastpaths: true
25475
+ };
25476
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
25477
+ if (!parsed.output) parsed = parse(input, options);
25478
+ return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
25479
+ };
25480
+ /**
25481
+ * Create a regular expression from the given regex source string.
25482
+ *
25483
+ * ```js
25484
+ * const picomatch = require('picomatch');
25485
+ * // picomatch.toRegex(source[, options]);
25486
+ *
25487
+ * const { output } = picomatch.parse('*.js');
25488
+ * console.log(picomatch.toRegex(output));
25489
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
25490
+ * ```
25491
+ * @param {String} `source` Regular expression source string.
25492
+ * @param {Object} `options`
25493
+ * @return {RegExp}
25494
+ * @api public
25495
+ */
25496
+ picomatch$2.toRegex = (source, options) => {
25497
+ try {
25498
+ const opts = options || {};
25499
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
25500
+ } catch (err) {
25501
+ if (options && options.debug === true) throw err;
25502
+ return /$^/;
25503
+ }
25504
+ };
25505
+ /**
25506
+ * Picomatch constants.
25507
+ * @return {Object}
25508
+ */
25509
+ picomatch$2.constants = constants;
25510
+ /**
25511
+ * Expose "picomatch"
25512
+ */
25513
+ module.exports = picomatch$2;
25514
+ }) });
25515
+
25516
+ //#endregion
25517
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js
25518
+ var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js": ((exports, module) => {
25519
+ const pico = require_picomatch$1();
25520
+ const utils = require_utils();
25521
+ function picomatch$1(glob, options, returnState = false) {
25522
+ if (options && (options.windows === null || options.windows === void 0)) options = {
25523
+ ...options,
25524
+ windows: utils.isWindows()
25525
+ };
25526
+ return pico(glob, options, returnState);
25527
+ }
25528
+ Object.assign(picomatch$1, pico);
25529
+ module.exports = picomatch$1;
25530
+ }) });
25531
+
25532
+ //#endregion
25533
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js
25534
+ var require_builder = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js": ((exports) => {
25535
+ Object.defineProperty(exports, "__esModule", { value: true });
25536
+ exports.Builder = void 0;
25537
+ const path_1 = __require$1("path");
25538
+ const api_builder_1 = require_api_builder();
25539
+ var pm = null;
25540
+ /* c8 ignore next 6 */
25541
+ try {
25542
+ __require$1.resolve("picomatch");
25543
+ pm = require_picomatch();
25544
+ } catch (_e) {}
25545
+ var Builder = class {
25546
+ globCache = {};
25547
+ options = {
25548
+ maxDepth: Infinity,
25549
+ suppressErrors: true,
25550
+ pathSeparator: path_1.sep,
25551
+ filters: []
25552
+ };
25553
+ globFunction;
25554
+ constructor(options) {
25555
+ this.options = {
25556
+ ...this.options,
25557
+ ...options
25558
+ };
25559
+ this.globFunction = this.options.globFunction;
25560
+ }
25561
+ group() {
25562
+ this.options.group = true;
25563
+ return this;
25564
+ }
25565
+ withPathSeparator(separator) {
25566
+ this.options.pathSeparator = separator;
25567
+ return this;
25568
+ }
25569
+ withBasePath() {
25570
+ this.options.includeBasePath = true;
25571
+ return this;
25572
+ }
25573
+ withRelativePaths() {
25574
+ this.options.relativePaths = true;
25575
+ return this;
25576
+ }
25577
+ withDirs() {
25578
+ this.options.includeDirs = true;
25579
+ return this;
25580
+ }
25581
+ withMaxDepth(depth$1) {
25582
+ this.options.maxDepth = depth$1;
25583
+ return this;
25584
+ }
25585
+ withMaxFiles(limit) {
25586
+ this.options.maxFiles = limit;
25587
+ return this;
25588
+ }
25589
+ withFullPaths() {
25590
+ this.options.resolvePaths = true;
25591
+ this.options.includeBasePath = true;
25592
+ return this;
25593
+ }
25594
+ withErrors() {
25595
+ this.options.suppressErrors = false;
25596
+ return this;
25597
+ }
25598
+ withSymlinks({ resolvePaths = true } = {}) {
25599
+ this.options.resolveSymlinks = true;
25600
+ this.options.useRealPaths = resolvePaths;
25601
+ return this.withFullPaths();
25602
+ }
25603
+ withAbortSignal(signal) {
25604
+ this.options.signal = signal;
25605
+ return this;
25606
+ }
25607
+ normalize() {
25608
+ this.options.normalizePath = true;
25609
+ return this;
25610
+ }
25611
+ filter(predicate) {
25612
+ this.options.filters.push(predicate);
25613
+ return this;
25614
+ }
25615
+ onlyDirs() {
25616
+ this.options.excludeFiles = true;
25617
+ this.options.includeDirs = true;
25618
+ return this;
25619
+ }
25620
+ exclude(predicate) {
25621
+ this.options.exclude = predicate;
25622
+ return this;
25623
+ }
25624
+ onlyCounts() {
25625
+ this.options.onlyCounts = true;
25626
+ return this;
25627
+ }
25628
+ crawl(root) {
25629
+ return new api_builder_1.APIBuilder(root || ".", this.options);
25630
+ }
25631
+ withGlobFunction(fn) {
25632
+ this.globFunction = fn;
25633
+ return this;
25634
+ }
25635
+ /**
25636
+ * @deprecated Pass options using the constructor instead:
25637
+ * ```ts
25638
+ * new fdir(options).crawl("/path/to/root");
25639
+ * ```
25640
+ * This method will be removed in v7.0
25641
+ */
25642
+ /* c8 ignore next 4 */
25643
+ crawlWithOptions(root, options) {
25644
+ this.options = {
25645
+ ...this.options,
25646
+ ...options
25647
+ };
25648
+ return new api_builder_1.APIBuilder(root || ".", this.options);
25649
+ }
25650
+ glob(...patterns) {
25651
+ if (this.globFunction) return this.globWithOptions(patterns);
25652
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
25653
+ }
25654
+ globWithOptions(patterns, ...options) {
25655
+ const globFn = this.globFunction || pm;
25656
+ /* c8 ignore next 5 */
25657
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
25658
+ var isMatch = this.globCache[patterns.join("\0")];
25659
+ if (!isMatch) {
25660
+ isMatch = globFn(patterns, ...options);
25661
+ this.globCache[patterns.join("\0")] = isMatch;
25662
+ }
25663
+ this.options.filters.push((path$1) => isMatch(path$1));
25664
+ return this;
25665
+ }
25666
+ };
25667
+ exports.Builder = Builder;
25668
+ }) });
25669
+
25670
+ //#endregion
25671
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/types.js
25672
+ var require_types = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/types.js": ((exports) => {
25673
+ Object.defineProperty(exports, "__esModule", { value: true });
25674
+ }) });
25675
+
25676
+ //#endregion
25677
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/index.js
25678
+ var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/index.js": ((exports) => {
25679
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
25680
+ if (k2 === void 0) k2 = k;
25681
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25682
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
25683
+ enumerable: true,
25684
+ get: function() {
25685
+ return m[k];
25686
+ }
25687
+ };
25688
+ Object.defineProperty(o, k2, desc);
25689
+ }) : (function(o, m, k, k2) {
25690
+ if (k2 === void 0) k2 = k;
25691
+ o[k2] = m[k];
25692
+ }));
25693
+ var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
25694
+ for (var p$1 in m) if (p$1 !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p$1)) __createBinding(exports$1, m, p$1);
25695
+ };
25696
+ Object.defineProperty(exports, "__esModule", { value: true });
25697
+ exports.fdir = void 0;
25698
+ const builder_1 = require_builder();
25699
+ Object.defineProperty(exports, "fdir", {
25700
+ enumerable: true,
25701
+ get: function() {
25702
+ return builder_1.Builder;
25703
+ }
25704
+ });
25705
+ __exportStar(require_types(), exports);
25706
+ }) });
25707
+
25708
+ //#endregion
25709
+ //#region ../../node_modules/.pnpm/tinyglobby@0.2.12/node_modules/tinyglobby/dist/index.mjs
25710
+ var import_dist = require_dist();
25711
+ var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
25712
+ var import_picomatch$1 = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
25713
+ var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
25714
+ function getPartialMatcher(patterns, options) {
25715
+ const patternsCount = patterns.length;
25716
+ const patternsParts = Array(patternsCount);
25717
+ const regexes = Array(patternsCount);
25718
+ for (let i$1 = 0; i$1 < patternsCount; i$1++) {
25719
+ const parts = splitPattern(patterns[i$1]);
25720
+ patternsParts[i$1] = parts;
25721
+ const partsCount = parts.length;
25722
+ const partRegexes = Array(partsCount);
25723
+ for (let j = 0; j < partsCount; j++) partRegexes[j] = import_picomatch$1.default.makeRe(parts[j], options);
25724
+ regexes[i$1] = partRegexes;
25725
+ }
25726
+ return (input) => {
25727
+ const inputParts = input.split("/");
25728
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
25729
+ for (let i$1 = 0; i$1 < patterns.length; i$1++) {
25730
+ const patternParts = patternsParts[i$1];
25731
+ const regex = regexes[i$1];
25732
+ const inputPatternCount = inputParts.length;
25733
+ const minParts = Math.min(inputPatternCount, patternParts.length);
25734
+ let j = 0;
25735
+ while (j < minParts) {
25736
+ const part = patternParts[j];
25737
+ if (part.includes("/")) return true;
25738
+ if (!regex[j].test(inputParts[j])) break;
25739
+ if (part === "**") return true;
25740
+ j++;
25741
+ }
25742
+ if (j === inputPatternCount) return true;
25743
+ }
25744
+ return false;
25745
+ };
25746
+ }
25747
+ var splitPatternOptions = { parts: true };
25748
+ function splitPattern(path2) {
25749
+ var _a;
25750
+ const result = import_picomatch$1.default.scan(path2, splitPatternOptions);
25751
+ return ((_a = result.parts) == null ? void 0 : _a.length) ? result.parts : [path2];
25752
+ }
25753
+ var isWin = process.platform === "win32";
25754
+ var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
25755
+ var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
25756
+ var escapePosixPath = (path2) => path2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
25757
+ var escapeWin32Path = (path2) => path2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
25758
+ var escapePath = isWin ? escapeWin32Path : escapePosixPath;
25759
+ function isDynamicPattern(pattern, options) {
25760
+ if ((options == null ? void 0 : options.caseSensitiveMatch) === false) return true;
25761
+ const scan$2 = import_picomatch$1.default.scan(pattern);
25762
+ return scan$2.isGlob || scan$2.negated;
25763
+ }
25764
+ function log(...tasks) {
25765
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
25766
+ }
25767
+ var PARENT_DIRECTORY = /^(\/?\.\.)+/;
25768
+ var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
25769
+ var BACKSLASHES = /\\/g;
25770
+ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
25771
+ let result = pattern;
25772
+ if (pattern.endsWith("/")) result = pattern.slice(0, -1);
25773
+ if (!result.endsWith("*") && expandDirectories) result += "/**";
25774
+ if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapePath(cwd), result);
25775
+ else result = posix.normalize(result);
25776
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
25777
+ if (parentDirectoryMatch == null ? void 0 : parentDirectoryMatch[0]) {
25778
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0]);
25779
+ if (props.root.length > potentialRoot.length) {
25780
+ props.root = potentialRoot;
25781
+ props.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
25782
+ }
25783
+ } else if (!isIgnore && props.depthOffset >= 0) {
25784
+ const parts = splitPattern(result);
25785
+ props.commonPath ??= parts;
25786
+ const newCommonPath = [];
25787
+ const length = Math.min(props.commonPath.length, parts.length);
25788
+ for (let i$1 = 0; i$1 < length; i$1++) {
25789
+ const part = parts[i$1];
25790
+ if (part === "**" && !parts[i$1 + 1]) {
25791
+ newCommonPath.pop();
25792
+ break;
25793
+ }
25794
+ if (part !== props.commonPath[i$1] || isDynamicPattern(part) || i$1 === parts.length - 1) break;
25795
+ newCommonPath.push(part);
25796
+ }
25797
+ props.depthOffset = newCommonPath.length;
25798
+ props.commonPath = newCommonPath;
25799
+ props.root = newCommonPath.length > 0 ? `${cwd}/${newCommonPath.join("/")}` : cwd;
25800
+ }
25801
+ return result;
25802
+ }
25803
+ function processPatterns({ patterns, ignore: ignore$1 = [], expandDirectories = true }, cwd, props) {
25804
+ if (typeof patterns === "string") patterns = [patterns];
25805
+ else if (!patterns) patterns = ["**/*"];
25806
+ if (typeof ignore$1 === "string") ignore$1 = [ignore$1];
25807
+ const matchPatterns = [];
25808
+ const ignorePatterns = [];
25809
+ for (const pattern of ignore$1) {
25810
+ if (!pattern) continue;
25811
+ if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
25812
+ }
25813
+ for (const pattern of patterns) {
25814
+ if (!pattern) continue;
25815
+ if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
25816
+ else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
25817
+ }
25818
+ return {
25819
+ match: matchPatterns,
25820
+ ignore: ignorePatterns
25821
+ };
25822
+ }
25823
+ function getRelativePath(path2, cwd, root) {
25824
+ return posix.relative(cwd, `${root}/${path2}`) || ".";
25825
+ }
25826
+ function processPath(path2, cwd, root, isDirectory$1, absolute) {
25827
+ const relativePath = absolute ? path2.slice(root.length + 1) || "." : path2;
25828
+ if (root === cwd) return isDirectory$1 && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
25829
+ return getRelativePath(relativePath, cwd, root);
25830
+ }
25831
+ function formatPaths(paths, cwd, root) {
25832
+ for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
25833
+ const path2 = paths[i$1];
25834
+ paths[i$1] = getRelativePath(path2, cwd, root) + (!path2 || path2.endsWith("/") ? "/" : "");
25835
+ }
25836
+ return paths;
25837
+ }
25838
+ function crawl(options, cwd, sync$1) {
25839
+ if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
25840
+ if (options.debug) log("globbing with options:", options, "cwd:", cwd);
25841
+ if (Array.isArray(options.patterns) && options.patterns.length === 0) return sync$1 ? [] : Promise.resolve([]);
25842
+ const props = {
25843
+ root: cwd,
25844
+ commonPath: null,
25845
+ depthOffset: 0
25846
+ };
25847
+ const processed = processPatterns(options, cwd, props);
25848
+ const nocase = options.caseSensitiveMatch === false;
25849
+ if (options.debug) log("internal processing patterns:", processed);
25850
+ const matcher = (0, import_picomatch.default)(processed.match, {
25851
+ dot: options.dot,
25852
+ nocase,
25853
+ ignore: processed.ignore
25854
+ });
25855
+ const ignore$1 = (0, import_picomatch.default)(processed.ignore, {
25856
+ dot: options.dot,
25857
+ nocase
25858
+ });
25859
+ const partialMatcher = getPartialMatcher(processed.match, {
25860
+ dot: options.dot,
25861
+ nocase
25862
+ });
25863
+ const fdirOptions = {
25864
+ filters: [options.debug ? (p$1, isDirectory$1) => {
25865
+ const path2 = processPath(p$1, cwd, props.root, isDirectory$1, options.absolute);
25866
+ const matches = matcher(path2);
25867
+ if (matches) log(`matched ${path2}`);
25868
+ return matches;
25869
+ } : (p$1, isDirectory$1) => matcher(processPath(p$1, cwd, props.root, isDirectory$1, options.absolute))],
25870
+ exclude: options.debug ? (_, p$1) => {
25871
+ const relativePath = processPath(p$1, cwd, props.root, true, true);
25872
+ const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
25873
+ if (skipped) log(`skipped ${p$1}`);
25874
+ else log(`crawling ${p$1}`);
25875
+ return skipped;
25876
+ } : (_, p$1) => {
25877
+ const relativePath = processPath(p$1, cwd, props.root, true, true);
25878
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
25879
+ },
25880
+ pathSeparator: "/",
25881
+ relativePaths: true,
25882
+ resolveSymlinks: true
25883
+ };
25884
+ if (options.deep) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
25885
+ if (options.absolute) {
25886
+ fdirOptions.relativePaths = false;
25887
+ fdirOptions.resolvePaths = true;
25888
+ fdirOptions.includeBasePath = true;
25889
+ }
25890
+ if (options.followSymbolicLinks === false) {
25891
+ fdirOptions.resolveSymlinks = false;
25892
+ fdirOptions.excludeSymlinks = true;
25893
+ }
25894
+ if (options.onlyDirectories) {
25895
+ fdirOptions.excludeFiles = true;
25896
+ fdirOptions.includeDirs = true;
25897
+ } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
25898
+ props.root = props.root.replace(BACKSLASHES, "");
25899
+ const root = props.root;
25900
+ if (options.debug) log("internal properties:", props);
25901
+ const api = new import_dist.fdir(fdirOptions).crawl(root);
25902
+ if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
25903
+ return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
25904
+ }
25905
+ function globSync(patternsOrOptions, options) {
25906
+ if (patternsOrOptions && (options == null ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
25907
+ const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? {
25908
+ ...options,
25909
+ patterns: patternsOrOptions
25910
+ } : patternsOrOptions;
25911
+ return crawl(opts, opts.cwd ? path.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/"), true);
25912
+ }
25913
+
22976
25914
  //#endregion
22977
25915
  //#region src/miniflare-options.ts
22978
25916
  const INTERNAL_WORKERS_COMPATIBILITY_DATE = "2024-10-04";
@@ -23137,8 +26075,10 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
23137
26075
  viteDevServer.middlewares(req, res);
23138
26076
  } } } : {},
23139
26077
  __VITE_INVOKE_MODULE__: async (request$1) => {
26078
+ const targetEnvironmentName = request$1.headers.get(ENVIRONMENT_NAME_HEADER);
26079
+ assert(targetEnvironmentName, `Expected ${ENVIRONMENT_NAME_HEADER} header`);
23140
26080
  const payload = await request$1.json();
23141
- const result = await viteDevServer.environments[environmentName].hot.handleInvoke(payload);
26081
+ const result = await viteDevServer.environments[targetEnvironmentName].hot.handleInvoke(payload);
23142
26082
  return Response$1.json(result);
23143
26083
  }
23144
26084
  },
@@ -23341,6 +26281,7 @@ function handleWebSocket(httpServer, miniflare, entryWorkerName) {
23341
26281
 
23342
26282
  //#endregion
23343
26283
  //#region src/plugins/dev.ts
26284
+ var import_picocolors$2 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
23344
26285
  let exitCallback$2 = () => {};
23345
26286
  process.on("exit", () => {
23346
26287
  exitCallback$2();
@@ -23386,7 +26327,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
23386
26327
  const oldExportTypes = ctx.workerNameToExportTypesMap.get(workerConfig.name);
23387
26328
  assert(oldExportTypes, `Expected export types for Worker "${workerConfig.name}" to be defined`);
23388
26329
  if (compareExportTypes(oldExportTypes, newExportTypes)) {
23389
- viteDevServer.config.logger.info(colors.dim(colors.yellow("Worker exports have changed. Restarting dev server.")));
26330
+ viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("Worker exports have changed. Restarting dev server.")));
23390
26331
  await viteDevServer.restart();
23391
26332
  }
23392
26333
  });
@@ -23415,7 +26356,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
23415
26356
  };
23416
26357
  }
23417
26358
  if (containerTagToOptionsMap.size) {
23418
- viteDevServer.config.logger.info(colors.dim(colors.yellow("∷ Building container images for local development...\n")));
26359
+ viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("∷ Building container images for local development...\n")));
23419
26360
  await prepareContainerImagesForDev({
23420
26361
  dockerPath: getDockerPath(),
23421
26362
  containerOptions: [...containerTagToOptionsMap.values()],
@@ -23425,7 +26366,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
23425
26366
  isVite: true
23426
26367
  });
23427
26368
  containerImageTags = new Set(containerTagToOptionsMap.keys());
23428
- viteDevServer.config.logger.info(colors.dim(colors.yellow("\n⚡️ Containers successfully built. To rebuild your containers during development, restart the Vite dev server (r + enter).")));
26369
+ viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("\n⚡️ Containers successfully built. To rebuild your containers during development, restart the Vite dev server (r + enter).")));
23429
26370
  exitCallback$2 = () => {
23430
26371
  if (containerImageTags.size) cleanupContainers(getDockerPath(), containerImageTags);
23431
26372
  };
@@ -23564,12 +26505,12 @@ const nodeJsCompatWarningsPlugin = createPlugin("nodejs-compat-warnings", (ctx)
23564
26505
  }
23565
26506
  }] } } : { esbuildOptions: { plugins: [{
23566
26507
  name: "vite-plugin-cloudflare:nodejs-compat-warnings-resolver",
23567
- setup(build) {
23568
- build.onResolve({ filter: /* @__PURE__ */ new RegExp(`^(${nonPrefixedNodeModules.join("|")}|node:.+)$`) }, ({ path, importer }) => {
23569
- if (hasNodeJsAls(workerConfig) && isNodeAlsModule(path)) return;
23570
- nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(path, importer);
26508
+ setup(build$8) {
26509
+ build$8.onResolve({ filter: /* @__PURE__ */ new RegExp(`^(${nonPrefixedNodeModules.join("|")}|node:.+)$`) }, ({ path: path$1, importer }) => {
26510
+ if (hasNodeJsAls(workerConfig) && isNodeAlsModule(path$1)) return;
26511
+ nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(path$1, importer);
23571
26512
  return {
23572
- path,
26513
+ path: path$1,
23573
26514
  external: true
23574
26515
  };
23575
26516
  });
@@ -23601,6 +26542,7 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
23601
26542
  return {
23602
26543
  generateBundle(_, bundle) {
23603
26544
  assertIsNotPreview(ctx);
26545
+ if (ctx.isChildEnvironment(this.environment.name)) return;
23604
26546
  let outputConfig;
23605
26547
  if (ctx.resolvedPluginConfig.type === "workers") {
23606
26548
  const inputConfig = ctx.getWorkerConfig(this.environment.name);
@@ -23666,6 +26608,7 @@ function getAssetsDirectory(workerOutputDirectory, resolvedViteConfig) {
23666
26608
 
23667
26609
  //#endregion
23668
26610
  //#region src/plugins/preview.ts
26611
+ var import_picocolors$1 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
23669
26612
  let exitCallback = () => {};
23670
26613
  process.on("exit", () => {
23671
26614
  exitCallback();
@@ -23684,7 +26627,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
23684
26627
  await ctx.startOrUpdateMiniflare(miniflareOptions);
23685
26628
  if (containerTagToOptionsMap.size) {
23686
26629
  const dockerPath = getDockerPath();
23687
- vitePreviewServer.config.logger.info(colors.dim(colors.yellow("∷ Building container images for local preview...\n")));
26630
+ vitePreviewServer.config.logger.info(import_picocolors$1.default.dim(import_picocolors$1.default.yellow("∷ Building container images for local preview...\n")));
23688
26631
  await prepareContainerImagesForDev({
23689
26632
  dockerPath: getDockerPath(),
23690
26633
  containerOptions: [...containerTagToOptionsMap.values()],
@@ -23694,7 +26637,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
23694
26637
  isVite: true
23695
26638
  });
23696
26639
  const containerImageTags = new Set(containerTagToOptionsMap.keys());
23697
- vitePreviewServer.config.logger.info(colors.dim(colors.yellow("\n⚡️ Containers successfully built.\n")));
26640
+ vitePreviewServer.config.logger.info(import_picocolors$1.default.dim(import_picocolors$1.default.yellow("\n⚡️ Containers successfully built.\n")));
23698
26641
  exitCallback = () => {
23699
26642
  if (containerImageTags.size) cleanupContainers(dockerPath, containerImageTags);
23700
26643
  };
@@ -23708,6 +26651,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
23708
26651
 
23709
26652
  //#endregion
23710
26653
  //#region src/plugins/shortcuts.ts
26654
+ var import_picocolors = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
23711
26655
  const shortcutsPlugin = createPlugin("shortcuts", (ctx) => {
23712
26656
  const isCustomShortcutsSupported = satisfiesViteVersion("7.2.7");
23713
26657
  return {
@@ -23758,7 +26702,7 @@ function addBindingsShortcut(server, ctx) {
23758
26702
  };
23759
26703
  const bindCLIShortcuts = server.bindCLIShortcuts.bind(server);
23760
26704
  server.bindCLIShortcuts = (options) => {
23761
- if (server.httpServer && process.stdin.isTTY && !process.env.CI && options?.print) server.config.logger.info(colors.dim(colors.green(" ➜")) + colors.dim(" press ") + colors.bold(`${printBindingsShortcut.key} + enter`) + colors.dim(` to ${printBindingsShortcut.description}`));
26705
+ if (server.httpServer && process.stdin.isTTY && !process.env.CI && options?.print) server.config.logger.info(import_picocolors.default.dim(import_picocolors.default.green(" ➜")) + import_picocolors.default.dim(" press ") + import_picocolors.default.bold(`${printBindingsShortcut.key} + enter`) + import_picocolors.default.dim(` to ${printBindingsShortcut.description}`));
23762
26706
  bindCLIShortcuts(options);
23763
26707
  };
23764
26708
  server.bindCLIShortcuts({ customShortcuts: [printBindingsShortcut] });
@@ -23828,8 +26772,8 @@ function cloudflare(pluginConfig = {}) {
23828
26772
  {
23829
26773
  name: "vite-plugin-cloudflare",
23830
26774
  sharedDuringBuild: true,
23831
- config(userConfig, env) {
23832
- ctx.setResolvedPluginConfig(resolvePluginConfig(pluginConfig, userConfig, env));
26775
+ config(userConfig, env$1) {
26776
+ ctx.setResolvedPluginConfig(resolvePluginConfig(pluginConfig, userConfig, env$1));
23833
26777
  },
23834
26778
  async configureServer(viteDevServer) {
23835
26779
  const restartServer = viteDevServer.restart.bind(viteDevServer);