@cloudflare/vite-plugin 1.20.2 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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) {
@@ -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,13 +2212,13 @@ 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
  }
@@ -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
  }
@@ -4607,10 +4680,10 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
4607
4680
  return typeOf(t$5) === "boolean";
4608
4681
  }
4609
4682
  __name(isBoolean2, "isBoolean");
4610
- function isObject$1(t$5) {
4683
+ function isObject$2(t$5) {
4611
4684
  return typeOf(t$5) === "object";
4612
4685
  }
4613
- __name(isObject$1, "isObject");
4686
+ __name(isObject$2, "isObject");
4614
4687
  function isString2(t$5) {
4615
4688
  return typeOf(t$5) === "string";
4616
4689
  }
@@ -4630,7 +4703,7 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
4630
4703
  return new XDGAppPaths_2(options2);
4631
4704
  }
4632
4705
  __name(XDGAppPaths, "XDGAppPaths");
4633
- var options = isObject$1(options_) ? options_ : { name: options_ };
4706
+ var options = isObject$2(options_) ? options_ : { name: options_ };
4634
4707
  var suffix = (_a = options.suffix) !== null && _a !== void 0 ? _a : "";
4635
4708
  var isolated_ = (_b = options.isolated) !== null && _b !== void 0 ? _b : true;
4636
4709
  var namePriorityList = [
@@ -4699,7 +4772,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4699
4772
  exports$1.__esModule = true;
4700
4773
  exports$1.Adapt = void 0;
4701
4774
  function Adapt(adapter_) {
4702
- var env = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
4775
+ var env$1 = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
4703
4776
  var isMacOS = /^darwin$/i.test(adapter_.process.platform);
4704
4777
  var isWinOS = /^win/i.test(adapter_.process.platform);
4705
4778
  function baseDir() {
@@ -4713,23 +4786,23 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4713
4786
  var linux = /* @__PURE__ */ __name(function() {
4714
4787
  return {
4715
4788
  cache: /* @__PURE__ */ __name(function() {
4716
- return valOrPath(env.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
4789
+ return valOrPath(env$1.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
4717
4790
  }, "cache"),
4718
4791
  config: /* @__PURE__ */ __name(function() {
4719
- return valOrPath(env.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
4792
+ return valOrPath(env$1.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
4720
4793
  }, "config"),
4721
4794
  data: /* @__PURE__ */ __name(function() {
4722
- return valOrPath(env.get("XDG_DATA_HOME"), [
4795
+ return valOrPath(env$1.get("XDG_DATA_HOME"), [
4723
4796
  baseDir(),
4724
4797
  ".local",
4725
4798
  "share"
4726
4799
  ]);
4727
4800
  }, "data"),
4728
4801
  runtime: /* @__PURE__ */ __name(function() {
4729
- return env.get("XDG_RUNTIME_DIR") || void 0;
4802
+ return env$1.get("XDG_RUNTIME_DIR") || void 0;
4730
4803
  }, "runtime"),
4731
4804
  state: /* @__PURE__ */ __name(function() {
4732
- return valOrPath(env.get("XDG_STATE_HOME"), [
4805
+ return valOrPath(env$1.get("XDG_STATE_HOME"), [
4733
4806
  baseDir(),
4734
4807
  ".local",
4735
4808
  "state"
@@ -4740,31 +4813,31 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4740
4813
  var macos = /* @__PURE__ */ __name(function() {
4741
4814
  return {
4742
4815
  cache: /* @__PURE__ */ __name(function() {
4743
- return valOrPath(env.get("XDG_CACHE_HOME"), [
4816
+ return valOrPath(env$1.get("XDG_CACHE_HOME"), [
4744
4817
  baseDir(),
4745
4818
  "Library",
4746
4819
  "Caches"
4747
4820
  ]);
4748
4821
  }, "cache"),
4749
4822
  config: /* @__PURE__ */ __name(function() {
4750
- return valOrPath(env.get("XDG_CONFIG_HOME"), [
4823
+ return valOrPath(env$1.get("XDG_CONFIG_HOME"), [
4751
4824
  baseDir(),
4752
4825
  "Library",
4753
4826
  "Preferences"
4754
4827
  ]);
4755
4828
  }, "config"),
4756
4829
  data: /* @__PURE__ */ __name(function() {
4757
- return valOrPath(env.get("XDG_DATA_HOME"), [
4830
+ return valOrPath(env$1.get("XDG_DATA_HOME"), [
4758
4831
  baseDir(),
4759
4832
  "Library",
4760
4833
  "Application Support"
4761
4834
  ]);
4762
4835
  }, "data"),
4763
4836
  runtime: /* @__PURE__ */ __name(function() {
4764
- return env.get("XDG_RUNTIME_DIR") || void 0;
4837
+ return env$1.get("XDG_RUNTIME_DIR") || void 0;
4765
4838
  }, "runtime"),
4766
4839
  state: /* @__PURE__ */ __name(function() {
4767
- return valOrPath(env.get("XDG_STATE_HOME"), [
4840
+ return valOrPath(env$1.get("XDG_STATE_HOME"), [
4768
4841
  baseDir(),
4769
4842
  "Library",
4770
4843
  "State"
@@ -4774,7 +4847,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4774
4847
  }, "macos");
4775
4848
  var windows = /* @__PURE__ */ __name(function() {
4776
4849
  function appData() {
4777
- return valOrPath(env.get("APPDATA"), [
4850
+ return valOrPath(env$1.get("APPDATA"), [
4778
4851
  baseDir(),
4779
4852
  "AppData",
4780
4853
  "Roaming"
@@ -4782,7 +4855,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4782
4855
  }
4783
4856
  __name(appData, "appData");
4784
4857
  function localAppData() {
4785
- return valOrPath(env.get("LOCALAPPDATA"), [
4858
+ return valOrPath(env$1.get("LOCALAPPDATA"), [
4786
4859
  baseDir(),
4787
4860
  "AppData",
4788
4861
  "Local"
@@ -4791,19 +4864,19 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4791
4864
  __name(localAppData, "localAppData");
4792
4865
  return {
4793
4866
  cache: /* @__PURE__ */ __name(function() {
4794
- return valOrPath(env.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
4867
+ return valOrPath(env$1.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
4795
4868
  }, "cache"),
4796
4869
  config: /* @__PURE__ */ __name(function() {
4797
- return valOrPath(env.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
4870
+ return valOrPath(env$1.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
4798
4871
  }, "config"),
4799
4872
  data: /* @__PURE__ */ __name(function() {
4800
- return valOrPath(env.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
4873
+ return valOrPath(env$1.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
4801
4874
  }, "data"),
4802
4875
  runtime: /* @__PURE__ */ __name(function() {
4803
- return env.get("XDG_RUNTIME_DIR") || void 0;
4876
+ return env$1.get("XDG_RUNTIME_DIR") || void 0;
4804
4877
  }, "runtime"),
4805
4878
  state: /* @__PURE__ */ __name(function() {
4806
- return valOrPath(env.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
4879
+ return valOrPath(env$1.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
4807
4880
  }, "state")
4808
4881
  };
4809
4882
  }, "windows");
@@ -4820,11 +4893,11 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
4820
4893
  XDG.runtime = extension.runtime;
4821
4894
  XDG.state = extension.state;
4822
4895
  XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
4823
- var pathList = env.get("XDG_CONFIG_DIRS");
4896
+ var pathList = env$1.get("XDG_CONFIG_DIRS");
4824
4897
  return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
4825
4898
  }, "configDirs");
4826
4899
  XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
4827
- var pathList = env.get("XDG_DATA_DIRS");
4900
+ var pathList = env$1.get("XDG_DATA_DIRS");
4828
4901
  return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
4829
4902
  }, "dataDirs");
4830
4903
  return XDG;
@@ -4848,24 +4921,24 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4848
4921
  }
4849
4922
  __name(isEmpty, "isEmpty");
4850
4923
  function Adapt(adapter_) {
4851
- var env = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
4924
+ var env$1 = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
4852
4925
  var isWinOS = /^win/i.test(adapter_.process.platform);
4853
- function normalizePath(path_) {
4926
+ function normalizePath$1(path_) {
4854
4927
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
4855
4928
  }
4856
- __name(normalizePath, "normalizePath");
4929
+ __name(normalizePath$1, "normalizePath");
4857
4930
  function home() {
4858
4931
  return isWinOS ? (/* @__PURE__ */ __name(function() {
4859
- return normalizePath([
4932
+ return normalizePath$1([
4860
4933
  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
4934
+ env$1.get("USERPROFILE"),
4935
+ env$1.get("HOME"),
4936
+ env$1.get("HOMEDRIVE") || env$1.get("HOMEPATH") ? path5.join(env$1.get("HOMEDRIVE") || "", env$1.get("HOMEPATH") || "") : void 0
4864
4937
  ].find(function(v) {
4865
4938
  return !isEmpty(v);
4866
4939
  }));
4867
4940
  }, "windows"))() : (/* @__PURE__ */ __name(function() {
4868
- return normalizePath((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env.get("HOME"));
4941
+ return normalizePath$1((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env$1.get("HOME"));
4869
4942
  }, "posix"))();
4870
4943
  }
4871
4944
  __name(home, "home");
@@ -4874,29 +4947,29 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4874
4947
  return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
4875
4948
  }
4876
4949
  __name(joinPathToBase, "joinPathToBase");
4877
- function posix() {
4878
- return normalizePath([
4950
+ function posix$1() {
4951
+ return normalizePath$1([
4879
4952
  typeof os2.tmpdir === "function" ? os2.tmpdir() : void 0,
4880
- env.get("TMPDIR"),
4881
- env.get("TEMP"),
4882
- env.get("TMP")
4953
+ env$1.get("TMPDIR"),
4954
+ env$1.get("TEMP"),
4955
+ env$1.get("TMP")
4883
4956
  ].find(function(v) {
4884
4957
  return !isEmpty(v);
4885
4958
  })) || "/tmp";
4886
4959
  }
4887
- __name(posix, "posix");
4960
+ __name(posix$1, "posix");
4888
4961
  function windows() {
4889
4962
  var fallback = "C:\\Temp";
4890
4963
  var v = [
4891
4964
  typeof os2.tmpdir === "function" ? os2.tmpdir : function() {},
4892
4965
  function() {
4893
- return env.get("TEMP");
4966
+ return env$1.get("TEMP");
4894
4967
  },
4895
4968
  function() {
4896
- return env.get("TMP");
4969
+ return env$1.get("TMP");
4897
4970
  },
4898
4971
  function() {
4899
- return joinPathToBase(env.get("LOCALAPPDATA"), ["Temp"]);
4972
+ return joinPathToBase(env$1.get("LOCALAPPDATA"), ["Temp"]);
4900
4973
  },
4901
4974
  function() {
4902
4975
  return joinPathToBase(home(), [
@@ -4906,24 +4979,24 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4906
4979
  ]);
4907
4980
  },
4908
4981
  function() {
4909
- return joinPathToBase(env.get("ALLUSERSPROFILE"), ["Temp"]);
4982
+ return joinPathToBase(env$1.get("ALLUSERSPROFILE"), ["Temp"]);
4910
4983
  },
4911
4984
  function() {
4912
- return joinPathToBase(env.get("SystemRoot"), ["Temp"]);
4985
+ return joinPathToBase(env$1.get("SystemRoot"), ["Temp"]);
4913
4986
  },
4914
4987
  function() {
4915
- return joinPathToBase(env.get("windir"), ["Temp"]);
4988
+ return joinPathToBase(env$1.get("windir"), ["Temp"]);
4916
4989
  },
4917
4990
  function() {
4918
- return joinPathToBase(env.get("SystemDrive"), ["\\", "Temp"]);
4991
+ return joinPathToBase(env$1.get("SystemDrive"), ["\\", "Temp"]);
4919
4992
  }
4920
4993
  ].find(function(v2) {
4921
4994
  return v2 && !isEmpty(v2());
4922
4995
  });
4923
- return v && normalizePath(v()) || fallback;
4996
+ return v && normalizePath$1(v()) || fallback;
4924
4997
  }
4925
4998
  __name(windows, "windows");
4926
- return isWinOS ? windows() : posix();
4999
+ return isWinOS ? windows() : posix$1();
4927
5000
  }
4928
5001
  __name(temp, "temp");
4929
5002
  return { OSPaths: new (/* @__PURE__ */ function() {
@@ -4944,7 +5017,7 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4944
5017
  exports$1.Adapt = Adapt;
4945
5018
  } });
4946
5019
  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) {
5020
+ var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
4948
5021
  if (k2 === void 0) k2 = k;
4949
5022
  Object.defineProperty(o, k2, {
4950
5023
  enumerable: true,
@@ -4956,7 +5029,7 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
4956
5029
  if (k2 === void 0) k2 = k;
4957
5030
  o[k2] = m[k];
4958
5031
  });
4959
- var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5032
+ var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
4960
5033
  Object.defineProperty(o, "default", {
4961
5034
  enumerable: true,
4962
5035
  value: v
@@ -4964,19 +5037,19 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
4964
5037
  } : function(o, v) {
4965
5038
  o["default"] = v;
4966
5039
  });
4967
- var __importStar = exports$1 && exports$1.__importStar || function(mod) {
5040
+ var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
4968
5041
  if (mod && mod.__esModule) return mod;
4969
5042
  var result = {};
4970
5043
  if (mod != null) {
4971
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5044
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
4972
5045
  }
4973
- __setModuleDefault(result, mod);
5046
+ __setModuleDefault$1(result, mod);
4974
5047
  return result;
4975
5048
  };
4976
5049
  exports$1.__esModule = true;
4977
5050
  exports$1.adapter = void 0;
4978
- var os2 = __importStar(__require("os"));
4979
- var path5 = __importStar(__require("path"));
5051
+ var os2 = __importStar$1(__require("os"));
5052
+ var path5 = __importStar$1(__require("path"));
4980
5053
  exports$1.adapter = {
4981
5054
  atImportPermissions: { env: true },
4982
5055
  env: { get: /* @__PURE__ */ __name(function(s) {
@@ -4993,7 +5066,7 @@ var require_mod_cjs = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
4993
5066
  module$2.exports = OSPaths_js_1.Adapt(node_js_1.adapter).OSPaths;
4994
5067
  } });
4995
5068
  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) {
5069
+ var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
4997
5070
  if (k2 === void 0) k2 = k;
4998
5071
  Object.defineProperty(o, k2, {
4999
5072
  enumerable: true,
@@ -5005,7 +5078,7 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
5005
5078
  if (k2 === void 0) k2 = k;
5006
5079
  o[k2] = m[k];
5007
5080
  });
5008
- var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5081
+ var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5009
5082
  Object.defineProperty(o, "default", {
5010
5083
  enumerable: true,
5011
5084
  value: v
@@ -5013,22 +5086,22 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
5013
5086
  } : function(o, v) {
5014
5087
  o["default"] = v;
5015
5088
  });
5016
- var __importStar = exports$1 && exports$1.__importStar || function(mod) {
5089
+ var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
5017
5090
  if (mod && mod.__esModule) return mod;
5018
5091
  var result = {};
5019
5092
  if (mod != null) {
5020
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5093
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
5021
5094
  }
5022
- __setModuleDefault(result, mod);
5095
+ __setModuleDefault$1(result, mod);
5023
5096
  return result;
5024
5097
  };
5025
- var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
5098
+ var __importDefault$2 = exports$1 && exports$1.__importDefault || function(mod) {
5026
5099
  return mod && mod.__esModule ? mod : { "default": mod };
5027
5100
  };
5028
5101
  exports$1.__esModule = true;
5029
5102
  exports$1.adapter = void 0;
5030
- var path5 = __importStar(__require("path"));
5031
- var os_paths_1 = __importDefault(require_mod_cjs());
5103
+ var path5 = __importStar$1(__require("path"));
5104
+ var os_paths_1 = __importDefault$2(require_mod_cjs());
5032
5105
  exports$1.adapter = {
5033
5106
  atImportPermissions: { env: true },
5034
5107
  env: { get: /* @__PURE__ */ __name(function(s) {
@@ -5045,7 +5118,7 @@ var require_mod_cjs2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.
5045
5118
  module$2.exports = XDG_js_1.Adapt(node_js_1.adapter).XDG;
5046
5119
  } });
5047
5120
  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) {
5121
+ var __createBinding$2 = exports$1 && exports$1.__createBinding || (Object.create ? function(o, m, k, k2) {
5049
5122
  if (k2 === void 0) k2 = k;
5050
5123
  Object.defineProperty(o, k2, {
5051
5124
  enumerable: true,
@@ -5057,7 +5130,7 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
5057
5130
  if (k2 === void 0) k2 = k;
5058
5131
  o[k2] = m[k];
5059
5132
  });
5060
- var __setModuleDefault = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5133
+ var __setModuleDefault$1 = exports$1 && exports$1.__setModuleDefault || (Object.create ? function(o, v) {
5061
5134
  Object.defineProperty(o, "default", {
5062
5135
  enumerable: true,
5063
5136
  value: v
@@ -5065,22 +5138,22 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
5065
5138
  } : function(o, v) {
5066
5139
  o["default"] = v;
5067
5140
  });
5068
- var __importStar = exports$1 && exports$1.__importStar || function(mod) {
5141
+ var __importStar$1 = exports$1 && exports$1.__importStar || function(mod) {
5069
5142
  if (mod && mod.__esModule) return mod;
5070
5143
  var result = {};
5071
5144
  if (mod != null) {
5072
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5145
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k);
5073
5146
  }
5074
- __setModuleDefault(result, mod);
5147
+ __setModuleDefault$1(result, mod);
5075
5148
  return result;
5076
5149
  };
5077
- var __importDefault = exports$1 && exports$1.__importDefault || function(mod) {
5150
+ var __importDefault$2 = exports$1 && exports$1.__importDefault || function(mod) {
5078
5151
  return mod && mod.__esModule ? mod : { "default": mod };
5079
5152
  };
5080
5153
  exports$1.__esModule = true;
5081
5154
  exports$1.adapter = void 0;
5082
- var path5 = __importStar(__require("path"));
5083
- var xdg_portable_1 = __importDefault(require_mod_cjs2());
5155
+ var path5 = __importStar$1(__require("path"));
5156
+ var xdg_portable_1 = __importDefault$2(require_mod_cjs2());
5084
5157
  exports$1.adapter = {
5085
5158
  atImportPermissions: {
5086
5159
  env: true,
@@ -5842,7 +5915,7 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
5842
5915
  const isRedirectedConfig = isRedirectedRawConfig(rawConfig, configPath, userConfigPath);
5843
5916
  const definedEnvironments = Object.keys(rawConfig.env ?? {});
5844
5917
  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")}
5918
+ Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env$1) => ` - ${env$1}`).join("\n")}
5846
5919
 
5847
5920
 
5848
5921
  Such configurations are generated by tools, meaning that one of the tools
@@ -6210,7 +6283,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6210
6283
  const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
6211
6284
  const workers_dev = inheritable(diagnostics, topLevelEnv, rawEnv, "workers_dev", isBoolean, void 0);
6212
6285
  const preview_urls = inheritable(diagnostics, topLevelEnv, rawEnv, "preview_urls", isBoolean, void 0);
6213
- const build = normalizeAndValidateBuild(diagnostics, rawEnv, rawEnv.build ?? topLevelEnv?.build ?? {}, configPath);
6286
+ const build$8 = normalizeAndValidateBuild(diagnostics, rawEnv, rawEnv.build ?? topLevelEnv?.build ?? {}, configPath);
6214
6287
  const environment = {
6215
6288
  account_id,
6216
6289
  compatibility_date: inheritable(diagnostics, topLevelEnv, rawEnv, "compatibility_date", validateCompatibilityDate, void 0),
@@ -6230,7 +6303,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6230
6303
  assets: normalizeAndValidateAssets(diagnostics, topLevelEnv, rawEnv),
6231
6304
  limits: normalizeAndValidateLimits(diagnostics, topLevelEnv, rawEnv),
6232
6305
  placement: normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv),
6233
- build,
6306
+ build: build$8,
6234
6307
  workers_dev,
6235
6308
  preview_urls,
6236
6309
  vars: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vars", validateVars(envName), {}),
@@ -7687,6 +7760,47 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
7687
7760
  }
7688
7761
  __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
7689
7762
 
7763
+ //#endregion
7764
+ //#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
7765
+ function isPlainObject(value) {
7766
+ if (value === null || typeof value !== "object") return false;
7767
+ const prototype = Object.getPrototypeOf(value);
7768
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
7769
+ if (Symbol.iterator in value) return false;
7770
+ if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
7771
+ return true;
7772
+ }
7773
+ function _defu(baseObject, defaults, namespace = ".", merger) {
7774
+ if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
7775
+ const object = Object.assign({}, defaults);
7776
+ for (const key in baseObject) {
7777
+ if (key === "__proto__" || key === "constructor") continue;
7778
+ const value = baseObject[key];
7779
+ if (value === null || value === void 0) continue;
7780
+ if (merger && merger(object, key, value, namespace)) continue;
7781
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
7782
+ else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
7783
+ else object[key] = value;
7784
+ }
7785
+ return object;
7786
+ }
7787
+ function createDefu(merger) {
7788
+ return (...arguments_) => arguments_.reduce((p$1, c) => _defu(p$1, c, "", merger), {});
7789
+ }
7790
+ const defu = createDefu();
7791
+ const defuFn = createDefu((object, key, currentValue) => {
7792
+ if (object[key] !== void 0 && typeof currentValue === "function") {
7793
+ object[key] = currentValue(object[key]);
7794
+ return true;
7795
+ }
7796
+ });
7797
+ const defuArrayFn = createDefu((object, key, currentValue) => {
7798
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
7799
+ object[key] = currentValue(object[key]);
7800
+ return true;
7801
+ }
7802
+ });
7803
+
7690
7804
  //#endregion
7691
7805
  //#region src/deploy-config.ts
7692
7806
  function getDeployConfigPath(root) {
@@ -8905,10 +9019,10 @@ var Position = function Position$1(line, col) {
8905
9019
  Position.prototype.offset = function offset(n$1) {
8906
9020
  return new Position(this.line, this.column + n$1);
8907
9021
  };
8908
- var SourceLocation = function SourceLocation$1(p, start, end) {
9022
+ var SourceLocation = function SourceLocation$1(p$1, start, end) {
8909
9023
  this.start = start;
8910
9024
  this.end = end;
8911
- if (p.sourceFile !== null) this.source = p.sourceFile;
9025
+ if (p$1.sourceFile !== null) this.source = p$1.sourceFile;
8912
9026
  };
8913
9027
  function getLineInfo(input, offset) {
8914
9028
  for (var line = 1, cur = 0;;) {
@@ -9035,7 +9149,7 @@ var prototypeAccessors = {
9035
9149
  allowNewDotTarget: { configurable: true },
9036
9150
  inClassStaticBlock: { configurable: true }
9037
9151
  };
9038
- Parser.prototype.parse = function parse$8() {
9152
+ Parser.prototype.parse = function parse$10() {
9039
9153
  var node = this.options.program || this.startNode();
9040
9154
  this.nextToken();
9041
9155
  return this.parseTopLevel(node);
@@ -9085,7 +9199,7 @@ Parser.extend = function extend() {
9085
9199
  for (var i$1 = 0; i$1 < plugins.length; i$1++) cls = plugins[i$1](cls);
9086
9200
  return cls;
9087
9201
  };
9088
- Parser.parse = function parse$8(input, options) {
9202
+ Parser.parse = function parse$10(input, options) {
9089
9203
  return new this(options, input).parse();
9090
9204
  };
9091
9205
  Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
@@ -9424,7 +9538,7 @@ pp$8.parseThrowStatement = function(node) {
9424
9538
  this.semicolon();
9425
9539
  return this.finishNode(node, "ThrowStatement");
9426
9540
  };
9427
- var empty$1 = [];
9541
+ var empty$1$1 = [];
9428
9542
  pp$8.parseCatchClauseParam = function() {
9429
9543
  var param = this.parseBindingAtom();
9430
9544
  var simple = param.type === "Identifier";
@@ -9878,7 +9992,7 @@ pp$8.parseExportSpecifiers = function(exports$1) {
9878
9992
  pp$8.parseImport = function(node) {
9879
9993
  this.next();
9880
9994
  if (this.type === types$1$1.string) {
9881
- node.specifiers = empty$1;
9995
+ node.specifiers = empty$1$1;
9882
9996
  node.source = this.parseExprAtom();
9883
9997
  } else {
9884
9998
  node.specifiers = this.parseImportSpecifiers();
@@ -10169,8 +10283,8 @@ var types$2 = {
10169
10283
  b_tmpl: new TokContext("${", false),
10170
10284
  p_stat: new TokContext("(", false),
10171
10285
  p_expr: new TokContext("(", true),
10172
- q_tmpl: new TokContext("`", true, true, function(p) {
10173
- return p.tryReadTemplateToken();
10286
+ q_tmpl: new TokContext("`", true, true, function(p$1) {
10287
+ return p$1.tryReadTemplateToken();
10174
10288
  }),
10175
10289
  f_stat: new TokContext("function", false),
10176
10290
  f_expr: new TokContext("function", true),
@@ -10714,7 +10828,7 @@ pp$5.parseParenItem = function(item) {
10714
10828
  pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
10715
10829
  return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit);
10716
10830
  };
10717
- var empty = [];
10831
+ var empty$3 = [];
10718
10832
  pp$5.parseNew = function() {
10719
10833
  if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword new");
10720
10834
  var node = this.startNode();
@@ -10734,7 +10848,7 @@ pp$5.parseNew = function() {
10734
10848
  var startPos = this.start, startLoc = this.startLoc;
10735
10849
  node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
10736
10850
  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;
10851
+ else node.arguments = empty$3;
10738
10852
  return this.finishNode(node, "NewExpression");
10739
10853
  };
10740
10854
  pp$5.parseTemplateElement = function(ref$1) {
@@ -12092,13 +12206,13 @@ pp$1.regexp_eatFixedHexDigits = function(state, length) {
12092
12206
  }
12093
12207
  return true;
12094
12208
  };
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];
12209
+ var Token = function Token$1(p$1) {
12210
+ this.type = p$1.type;
12211
+ this.value = p$1.value;
12212
+ this.start = p$1.start;
12213
+ this.end = p$1.end;
12214
+ if (p$1.options.locations) this.loc = new SourceLocation(p$1, p$1.startLoc, p$1.endLoc);
12215
+ if (p$1.options.ranges) this.range = [p$1.start, p$1.end];
12102
12216
  };
12103
12217
  var pp = Parser.prototype;
12104
12218
  pp.next = function(ignoreEscapeSequenceInKeyword) {
@@ -12721,15 +12835,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
12721
12835
  function withTrailingSlash$1(input = "", respectQueryAndFragment) {
12722
12836
  if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
12723
12837
  if (hasTrailingSlash(input, true)) return input || "/";
12724
- let path = input;
12838
+ let path$1 = input;
12725
12839
  let fragment = "";
12726
12840
  const fragmentIndex = input.indexOf("#");
12727
12841
  if (fragmentIndex >= 0) {
12728
- path = input.slice(0, fragmentIndex);
12842
+ path$1 = input.slice(0, fragmentIndex);
12729
12843
  fragment = input.slice(fragmentIndex);
12730
- if (!path) return fragment;
12844
+ if (!path$1) return fragment;
12731
12845
  }
12732
- const [s0, ...s] = path.split("?");
12846
+ const [s0, ...s] = path$1.split("?");
12733
12847
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
12734
12848
  }
12735
12849
  function isNonEmptyURL(url) {
@@ -12748,15 +12862,15 @@ const protocolRelative = Symbol.for("ufo:protocolRelative");
12748
12862
  //#endregion
12749
12863
  //#region ../../node_modules/.pnpm/pathe@2.0.1/node_modules/pathe/dist/shared/pathe.BLwDEnA5.mjs
12750
12864
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
12751
- const isAbsolute = function(p) {
12752
- return _IS_ABSOLUTE_RE.test(p);
12865
+ const isAbsolute = function(p$1) {
12866
+ return _IS_ABSOLUTE_RE.test(p$1);
12753
12867
  };
12754
12868
 
12755
12869
  //#endregion
12756
12870
  //#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
12757
12871
  const BUILTIN_MODULES = new Set(builtinModules);
12758
- function normalizeSlash(path) {
12759
- return path.replace(/\\/g, "/");
12872
+ function normalizeSlash(path$1) {
12873
+ return path$1.replace(/\\/g, "/");
12760
12874
  }
12761
12875
  /**
12762
12876
  * @typedef ErrnoExceptionFields
@@ -12876,8 +12990,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
12876
12990
  * @param {string} [base]
12877
12991
  * @param {string} [message]
12878
12992
  */
12879
- (path, base, message) => {
12880
- return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
12993
+ (path$1, base, message) => {
12994
+ return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
12881
12995
  },
12882
12996
  Error
12883
12997
  );
@@ -12907,8 +13021,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
12907
13021
  * @param {string} base
12908
13022
  * @param {boolean} [exactUrl]
12909
13023
  */
12910
- (path, base, exactUrl = false) => {
12911
- return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
13024
+ (path$1, base, exactUrl = false) => {
13025
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`;
12912
13026
  },
12913
13027
  Error
12914
13028
  );
@@ -12946,8 +13060,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
12946
13060
  * @param {string} extension
12947
13061
  * @param {string} path
12948
13062
  */
12949
- (extension, path) => {
12950
- return `Unknown file extension "${extension}" for ${path}`;
13063
+ (extension, path$1) => {
13064
+ return `Unknown file extension "${extension}" for ${path$1}`;
12951
13065
  },
12952
13066
  TypeError
12953
13067
  );
@@ -13316,9 +13430,9 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
13316
13430
  * @param {string} path
13317
13431
  * @returns {Stats | undefined}
13318
13432
  */
13319
- function tryStatSync(path) {
13433
+ function tryStatSync(path$1) {
13320
13434
  try {
13321
- return statSync(path);
13435
+ return statSync(path$1);
13322
13436
  } catch {}
13323
13437
  }
13324
13438
  /**
@@ -13932,12 +14046,12 @@ var NodeJsCompat = class {
13932
14046
  */
13933
14047
  #virtualModulePathToSpecifier;
13934
14048
  constructor(workerConfig) {
13935
- const { env } = defineEnv({ presets: [getCloudflarePreset({
14049
+ const { env: env$1 } = defineEnv({ presets: [getCloudflarePreset({
13936
14050
  compatibilityDate: workerConfig.compatibility_date,
13937
14051
  compatibilityFlags: workerConfig.compatibility_flags
13938
14052
  })] });
13939
- this.#env = env;
13940
- this.externals = new Set(env.external);
14053
+ this.#env = env$1;
14054
+ this.externals = new Set(env$1.external);
13941
14055
  this.entries = this.#getEntries();
13942
14056
  const { injectsByModule, virtualModulePathToSpecifier } = this.#getInjects();
13943
14057
  this.#injectsByModule = injectsByModule;
@@ -14129,14 +14243,14 @@ const nullableNonApplicable = [
14129
14243
  "site",
14130
14244
  "tsconfig"
14131
14245
  ];
14132
- function readWorkerConfig(configPath, env) {
14246
+ function readWorkerConfig(configPath, env$1) {
14133
14247
  const nonApplicable = {
14134
14248
  replacedByVite: /* @__PURE__ */ new Set(),
14135
14249
  notRelevant: /* @__PURE__ */ new Set()
14136
14250
  };
14137
14251
  const config = wrangler.unstable_readConfig({
14138
14252
  config: configPath,
14139
- env
14253
+ env: env$1
14140
14254
  }, { preserveOriginalMain: true });
14141
14255
  const raw = structuredClone(config);
14142
14256
  nullableNonApplicable.forEach((prop) => {
@@ -14196,15 +14310,15 @@ function isReplacedByVite(configName) {
14196
14310
  function isNotRelevant(configName) {
14197
14311
  return nonApplicableWorkerConfigs.notRelevant.includes(configName);
14198
14312
  }
14199
- function missingFieldErrorMessage(field, configPath, env) {
14200
- return `No '${field}' field provided${configPath ? ` in '${configPath}'` : ""}${env ? ` for '${env}' environment` : ""}`;
14313
+ function missingFieldErrorMessage(field, configPath, env$1) {
14314
+ return `No '${field}' field provided${configPath ? ` in '${configPath}'` : ""}${env$1 ? ` for '${env$1}' environment` : ""}`;
14201
14315
  }
14202
14316
  /**
14203
14317
  * Reads and sanitizes a worker config from a wrangler config file.
14204
14318
  */
14205
- function readWorkerConfigFromFile(configPath, env, opts) {
14319
+ function readWorkerConfigFromFile(configPath, env$1, opts) {
14206
14320
  if (opts?.visitedConfigPaths?.has(configPath)) throw new Error(`Duplicate Wrangler config path found: ${configPath}`);
14207
- const result = readWorkerConfig(configPath, env);
14321
+ const result = readWorkerConfig(configPath, env$1);
14208
14322
  opts?.visitedConfigPaths?.add(configPath);
14209
14323
  return result;
14210
14324
  }
@@ -14392,6 +14506,9 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14392
14506
  let staticRouting;
14393
14507
  if (Array.isArray(entryWorkerConfig.assets?.run_worker_first)) staticRouting = parseStaticRouting(entryWorkerConfig.assets.run_worker_first);
14394
14508
  const environmentNameToWorkerMap = new Map([[entryWorkerEnvironmentName, resolveWorker(entryWorkerConfig)]]);
14509
+ const environmentNameToChildEnvironmentNamesMap = /* @__PURE__ */ new Map();
14510
+ const entryWorkerChildEnvironments = pluginConfig.viteEnvironment?.childEnvironments;
14511
+ if (entryWorkerChildEnvironments) environmentNameToChildEnvironmentNamesMap.set(entryWorkerEnvironmentName, entryWorkerChildEnvironments);
14395
14512
  const auxiliaryWorkersResolvedConfigs = [];
14396
14513
  for (const auxiliaryWorker of pluginConfig.auxiliaryWorkers ?? []) {
14397
14514
  const workerResolvedConfig = resolveWorkerConfig({
@@ -14406,6 +14523,8 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14406
14523
  const workerEnvironmentName = auxiliaryWorker.viteEnvironment?.name ?? workerNameToEnvironmentName(workerResolvedConfig.config.topLevelName);
14407
14524
  if (environmentNameToWorkerMap.has(workerEnvironmentName)) throw new Error(`Duplicate Vite environment name found: ${workerEnvironmentName}`);
14408
14525
  environmentNameToWorkerMap.set(workerEnvironmentName, resolveWorker(workerResolvedConfig.config));
14526
+ const auxiliaryWorkerChildEnvironments = auxiliaryWorker.viteEnvironment?.childEnvironments;
14527
+ if (auxiliaryWorkerChildEnvironments) environmentNameToChildEnvironmentNamesMap.set(workerEnvironmentName, auxiliaryWorkerChildEnvironments);
14409
14528
  }
14410
14529
  return {
14411
14530
  ...shared,
@@ -14413,6 +14532,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14413
14532
  cloudflareEnv,
14414
14533
  configPaths,
14415
14534
  environmentNameToWorkerMap,
14535
+ environmentNameToChildEnvironmentNamesMap,
14416
14536
  entryWorkerEnvironmentName,
14417
14537
  staticRouting,
14418
14538
  remoteBindings: pluginConfig.remoteBindings ?? true,
@@ -14685,7 +14805,7 @@ function guessIndent(code) {
14685
14805
  }, Infinity);
14686
14806
  return new Array(min + 1).join(" ");
14687
14807
  }
14688
- function getRelativePath(from, to) {
14808
+ function getRelativePath$1(from, to) {
14689
14809
  const fromParts = from.split(/[/\\]/);
14690
14810
  const toParts = to.split(/[/\\]/);
14691
14811
  fromParts.pop();
@@ -14700,7 +14820,7 @@ function getRelativePath(from, to) {
14700
14820
  return fromParts.concat(toParts).join("/");
14701
14821
  }
14702
14822
  const toString = Object.prototype.toString;
14703
- function isObject(thing) {
14823
+ function isObject$1(thing) {
14704
14824
  return toString.call(thing) === "[object Object]";
14705
14825
  }
14706
14826
  function getLocator(source) {
@@ -14965,7 +15085,7 @@ var MagicString = class MagicString {
14965
15085
  });
14966
15086
  return {
14967
15087
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
14968
- sources: [options.source ? getRelativePath(options.file || "", options.source) : options.file || ""],
15088
+ sources: [options.source ? getRelativePath$1(options.file || "", options.source) : options.file || ""],
14969
15089
  sourcesContent: options.includeContent ? [this.original] : void 0,
14970
15090
  names,
14971
15091
  mappings: mappings.raw,
@@ -14988,7 +15108,7 @@ var MagicString = class MagicString {
14988
15108
  }
14989
15109
  indent(indentStr, options) {
14990
15110
  const pattern = /^[^\r\n]/gm;
14991
- if (isObject(indentStr)) {
15111
+ if (isObject$1(indentStr)) {
14992
15112
  options = indentStr;
14993
15113
  indentStr = void 0;
14994
15114
  }
@@ -15596,9 +15716,9 @@ function constructHeaders({ headers, headersFile, logger }) {
15596
15716
 
15597
15717
  //#endregion
15598
15718
  //#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://");
15719
+ const extractPathname = (path$1 = "/", includeSearch, includeHash) => {
15720
+ if (!path$1.startsWith("/")) path$1 = `/${path$1}`;
15721
+ const url = new URL(`//${path$1}`, "relative://");
15602
15722
  return `${url.pathname}${includeSearch ? url.search : ""}${includeHash ? url.hash : ""}`;
15603
15723
  };
15604
15724
  const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
@@ -15655,7 +15775,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
15655
15775
  lineNumber: i$1 + 1,
15656
15776
  message: "No headers specified"
15657
15777
  });
15658
- const [path, pathError] = validateUrl(line, false, true);
15778
+ const [path$1, pathError] = validateUrl(line, false, true);
15659
15779
  if (pathError) {
15660
15780
  invalid.push({
15661
15781
  line,
@@ -15666,7 +15786,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
15666
15786
  continue;
15667
15787
  }
15668
15788
  rule = {
15669
- path,
15789
+ path: path$1,
15670
15790
  line,
15671
15791
  headers: {},
15672
15792
  unsetHeaders: []
@@ -15931,7 +16051,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
15931
16051
  };
15932
16052
  const isString$1 = (subject) => typeof subject === "string";
15933
16053
  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);
16054
+ const splitPattern$1 = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
15935
16055
  var IgnoreRule = class {
15936
16056
  constructor(origin, pattern, negative, regex) {
15937
16057
  this.origin = origin;
@@ -15954,15 +16074,15 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
15954
16074
  const throwError = (message, Ctor) => {
15955
16075
  throw new Ctor(message);
15956
16076
  };
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);
16077
+ const checkPath = (path$1, originalPath, doThrow) => {
16078
+ if (!isString$1(path$1)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
16079
+ if (!path$1) return doThrow(`path must not be empty`, TypeError);
16080
+ if (checkPath.isNotRelative(path$1)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
15961
16081
  return true;
15962
16082
  };
15963
- const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
16083
+ const isNotRelative = (path$1) => REGEX_TEST_INVALID_PATH.test(path$1);
15964
16084
  checkPath.isNotRelative = isNotRelative;
15965
- checkPath.convert = (p) => p;
16085
+ checkPath.convert = (p$1) => p$1;
15966
16086
  var Ignore = class {
15967
16087
  constructor({ ignorecase = true, ignoreCase = ignorecase, allowRelativePaths = false } = {}) {
15968
16088
  define(this, KEY_IGNORE, true);
@@ -15989,20 +16109,20 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
15989
16109
  }
15990
16110
  add(pattern) {
15991
16111
  this._added = false;
15992
- makeArray(isString$1(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
16112
+ makeArray(isString$1(pattern) ? splitPattern$1(pattern) : pattern).forEach(this._addPattern, this);
15993
16113
  if (this._added) this._initCache();
15994
16114
  return this;
15995
16115
  }
15996
16116
  addPattern(pattern) {
15997
16117
  return this.add(pattern);
15998
16118
  }
15999
- _testOne(path, checkUnignored) {
16119
+ _testOne(path$1, checkUnignored) {
16000
16120
  let ignored = false;
16001
16121
  let unignored = false;
16002
16122
  this._rules.forEach((rule) => {
16003
16123
  const { negative } = rule;
16004
16124
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
16005
- if (rule.regex.test(path)) {
16125
+ if (rule.regex.test(path$1)) {
16006
16126
  ignored = !negative;
16007
16127
  unignored = negative;
16008
16128
  }
@@ -16013,33 +16133,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
16013
16133
  };
16014
16134
  }
16015
16135
  _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);
16136
+ const path$1 = originalPath && checkPath.convert(originalPath);
16137
+ checkPath(path$1, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
16138
+ return this._t(path$1, cache$2, checkUnignored, slices);
16019
16139
  }
16020
- _t(path, cache$2, checkUnignored, slices) {
16021
- if (path in cache$2) return cache$2[path];
16022
- if (!slices) slices = path.split(SLASH);
16140
+ _t(path$1, cache$2, checkUnignored, slices) {
16141
+ if (path$1 in cache$2) return cache$2[path$1];
16142
+ if (!slices) slices = path$1.split(SLASH);
16023
16143
  slices.pop();
16024
- if (!slices.length) return cache$2[path] = this._testOne(path, checkUnignored);
16144
+ if (!slices.length) return cache$2[path$1] = this._testOne(path$1, checkUnignored);
16025
16145
  const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
16026
- return cache$2[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
16146
+ return cache$2[path$1] = parent.ignored ? parent : this._testOne(path$1, checkUnignored);
16027
16147
  }
16028
- ignores(path) {
16029
- return this._test(path, this._ignoreCache, false).ignored;
16148
+ ignores(path$1) {
16149
+ return this._test(path$1, this._ignoreCache, false).ignored;
16030
16150
  }
16031
16151
  createFilter() {
16032
- return (path) => !this.ignores(path);
16152
+ return (path$1) => !this.ignores(path$1);
16033
16153
  }
16034
16154
  filter(paths) {
16035
16155
  return makeArray(paths).filter(this.createFilter());
16036
16156
  }
16037
- test(path) {
16038
- return this._test(path, this._testCache, true);
16157
+ test(path$1) {
16158
+ return this._test(path$1, this._testCache, true);
16039
16159
  }
16040
16160
  };
16041
16161
  const factory = (options) => new Ignore(options);
16042
- const isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
16162
+ const isPathValid = (path$1) => checkPath(path$1 && checkPath.convert(path$1), path$1, RETURN_FALSE);
16043
16163
  factory.isPathValid = isPathValid;
16044
16164
  factory.default = factory;
16045
16165
  module.exports = factory;
@@ -16048,7 +16168,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
16048
16168
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
16049
16169
  checkPath.convert = makePosix;
16050
16170
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
16051
- checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
16171
+ checkPath.isNotRelative = (path$1) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$1) || isNotRelative(path$1);
16052
16172
  }
16053
16173
  }) });
16054
16174
 
@@ -17403,11 +17523,11 @@ var Mime = class {
17403
17523
  }
17404
17524
  return this;
17405
17525
  }
17406
- getType(path) {
17407
- if (typeof path !== "string") return null;
17408
- const last = path.replace(/^.*[/\\]/s, "").toLowerCase();
17526
+ getType(path$1) {
17527
+ if (typeof path$1 !== "string") return null;
17528
+ const last = path$1.replace(/^.*[/\\]/s, "").toLowerCase();
17409
17529
  const ext = last.replace(/^.*\./s, "").toLowerCase();
17410
- const hasPath = last.length < path.length;
17530
+ const hasPath = last.length < path$1.length;
17411
17531
  if (!(ext.length < last.length - 1) && hasPath) return null;
17412
17532
  return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
17413
17533
  }
@@ -17741,8 +17861,8 @@ function getErrorMap() {
17741
17861
  //#endregion
17742
17862
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
17743
17863
  const makeIssue = (params) => {
17744
- const { data: data$1, path, errorMaps, issueData } = params;
17745
- const fullPath = [...path, ...issueData.path || []];
17864
+ const { data: data$1, path: path$1, errorMaps, issueData } = params;
17865
+ const fullPath = [...path$1, ...issueData.path || []];
17746
17866
  const fullIssue = {
17747
17867
  ...issueData,
17748
17868
  path: fullPath
@@ -17854,11 +17974,11 @@ var errorUtil;
17854
17974
  //#endregion
17855
17975
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
17856
17976
  var ParseInputLazyPath = class {
17857
- constructor(parent, value, path, key) {
17977
+ constructor(parent, value, path$1, key) {
17858
17978
  this._cachedPath = [];
17859
17979
  this.parent = parent;
17860
17980
  this.data = value;
17861
- this._path = path;
17981
+ this._path = path$1;
17862
17982
  this._key = key;
17863
17983
  }
17864
17984
  get path() {
@@ -21135,13 +21255,85 @@ function getHeadersConfigPath(config) {
21135
21255
  return nodePath.join(config.publicDir, HEADERS_FILENAME);
21136
21256
  }
21137
21257
 
21258
+ //#endregion
21259
+ //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
21260
+ var require_picocolors = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": ((exports, module) => {
21261
+ let p = process || {}, argv = p.argv || [], env = p.env || {};
21262
+ 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);
21263
+ let formatter = (open, close, replace = open) => (input) => {
21264
+ let string = "" + input, index = string.indexOf(close, open.length);
21265
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
21266
+ };
21267
+ let replaceClose = (string, close, replace, index) => {
21268
+ let result = "", cursor = 0;
21269
+ do {
21270
+ result += string.substring(cursor, index) + replace;
21271
+ cursor = index + close.length;
21272
+ index = string.indexOf(close, cursor);
21273
+ } while (~index);
21274
+ return result + string.substring(cursor);
21275
+ };
21276
+ let createColors = (enabled = isColorSupported) => {
21277
+ let f = enabled ? formatter : () => String;
21278
+ return {
21279
+ isColorSupported: enabled,
21280
+ reset: f("\x1B[0m", "\x1B[0m"),
21281
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
21282
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
21283
+ italic: f("\x1B[3m", "\x1B[23m"),
21284
+ underline: f("\x1B[4m", "\x1B[24m"),
21285
+ inverse: f("\x1B[7m", "\x1B[27m"),
21286
+ hidden: f("\x1B[8m", "\x1B[28m"),
21287
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
21288
+ black: f("\x1B[30m", "\x1B[39m"),
21289
+ red: f("\x1B[31m", "\x1B[39m"),
21290
+ green: f("\x1B[32m", "\x1B[39m"),
21291
+ yellow: f("\x1B[33m", "\x1B[39m"),
21292
+ blue: f("\x1B[34m", "\x1B[39m"),
21293
+ magenta: f("\x1B[35m", "\x1B[39m"),
21294
+ cyan: f("\x1B[36m", "\x1B[39m"),
21295
+ white: f("\x1B[37m", "\x1B[39m"),
21296
+ gray: f("\x1B[90m", "\x1B[39m"),
21297
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
21298
+ bgRed: f("\x1B[41m", "\x1B[49m"),
21299
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
21300
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
21301
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
21302
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
21303
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
21304
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
21305
+ blackBright: f("\x1B[90m", "\x1B[39m"),
21306
+ redBright: f("\x1B[91m", "\x1B[39m"),
21307
+ greenBright: f("\x1B[92m", "\x1B[39m"),
21308
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
21309
+ blueBright: f("\x1B[94m", "\x1B[39m"),
21310
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
21311
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
21312
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
21313
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
21314
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
21315
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
21316
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
21317
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
21318
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
21319
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
21320
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
21321
+ };
21322
+ };
21323
+ module.exports = createColors();
21324
+ module.exports.createColors = createColors;
21325
+ }) });
21326
+
21138
21327
  //#endregion
21139
21328
  //#region src/shared.ts
21329
+ var import_picocolors$4 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
21140
21330
  const UNKNOWN_HOST = "http://localhost";
21141
21331
  const INIT_PATH = "/__vite_plugin_cloudflare_init__";
21142
21332
  const GET_EXPORT_TYPES_PATH = "/__vite_plugin_cloudflare_get_export_types__";
21143
21333
  const WORKER_ENTRY_PATH_HEADER = "__VITE_WORKER_ENTRY_PATH__";
21144
21334
  const IS_ENTRY_WORKER_HEADER = "__VITE_IS_ENTRY_WORKER__";
21335
+ const ENVIRONMENT_NAME_HEADER = "__VITE_ENVIRONMENT_NAME__";
21336
+ const IS_PARENT_ENVIRONMENT_HEADER = "__VITE_IS_PARENT_ENVIRONMENT__";
21145
21337
  const virtualPrefix = "virtual:cloudflare/";
21146
21338
  const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
21147
21339
  const VIRTUAL_EXPORT_TYPES = `${virtualPrefix}export-types`;
@@ -21156,7 +21348,7 @@ const VIRTUAL_CLIENT_FALLBACK_ENTRY = `${virtualPrefix}client-fallback-entry`;
21156
21348
  const virtualModulesPlugin = createPlugin("virtual-modules", (ctx) => {
21157
21349
  return {
21158
21350
  applyToEnvironment(environment) {
21159
- return ctx.getWorkerConfig(environment.name) !== void 0;
21351
+ return !ctx.isChildEnvironment(environment.name) && ctx.getWorkerConfig(environment.name) !== void 0;
21160
21352
  },
21161
21353
  async resolveId(source) {
21162
21354
  if (source === VIRTUAL_WORKER_ENTRY || source === VIRTUAL_EXPORT_TYPES) return `\0${source}`;
@@ -21295,7 +21487,7 @@ function createBuildApp(resolvedPluginConfig) {
21295
21487
  movedAssetPaths.push(dest);
21296
21488
  }
21297
21489
  }
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"));
21490
+ 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
21491
  };
21300
21492
  }
21301
21493
  function getHasPublicAssets({ publicDir }) {
@@ -21385,11 +21577,13 @@ var CloudflareDevEnvironment = class extends vite.DevEnvironment {
21385
21577
  });
21386
21578
  this.#webSocketContainer = webSocketContainer;
21387
21579
  }
21388
- async initRunner(miniflare, workerConfig, isEntryWorker) {
21580
+ async initRunner(miniflare, workerConfig, options) {
21389
21581
  const response = await miniflare.dispatchFetch(new URL(INIT_PATH, UNKNOWN_HOST), { headers: {
21390
21582
  [CoreHeaders.ROUTE_OVERRIDE]: workerConfig.name,
21391
21583
  [WORKER_ENTRY_PATH_HEADER]: encodeURIComponent(workerConfig.main),
21392
- [IS_ENTRY_WORKER_HEADER]: String(isEntryWorker),
21584
+ [IS_ENTRY_WORKER_HEADER]: String(options.isEntryWorker),
21585
+ [ENVIRONMENT_NAME_HEADER]: this.name,
21586
+ [IS_PARENT_ENVIRONMENT_HEADER]: String(options.isParentEnvironment),
21393
21587
  upgrade: "websocket"
21394
21588
  } });
21395
21589
  assert(response.ok, `Failed to initialize module runner, error: ${await response.text()}`);
@@ -21424,10 +21618,6 @@ const defaultConditions = [
21424
21618
  "browser"
21425
21619
  ];
21426
21620
  const target = "es2024";
21427
- const rollupOptions = {
21428
- input: { [MAIN_ENTRY_NAME]: VIRTUAL_WORKER_ENTRY },
21429
- preserveEntrySignatures: "strict"
21430
- };
21431
21621
  const resolveExtensions = [
21432
21622
  ".mjs",
21433
21623
  ".js",
@@ -21440,7 +21630,11 @@ const resolveExtensions = [
21440
21630
  ".cts",
21441
21631
  ".ctx"
21442
21632
  ];
21443
- function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, environmentName, isEntryWorker, hasNodeJsCompat: hasNodeJsCompat$1 }) {
21633
+ function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, environmentName, isEntryWorker, isParentEnvironment, hasNodeJsCompat: hasNodeJsCompat$1 }) {
21634
+ const rollupOptions = isParentEnvironment ? {
21635
+ input: { [MAIN_ENTRY_NAME]: VIRTUAL_WORKER_ENTRY },
21636
+ preserveEntrySignatures: "strict"
21637
+ } : {};
21444
21638
  const define$1 = getProcessEnvReplacements(hasNodeJsCompat$1, mode);
21445
21639
  return {
21446
21640
  resolve: {
@@ -21517,11 +21711,22 @@ function getProcessEnvReplacements(hasNodeJsCompat$1, mode) {
21517
21711
  };
21518
21712
  }
21519
21713
  function initRunners(resolvedPluginConfig, viteDevServer, miniflare) {
21520
- return Promise.all([...resolvedPluginConfig.environmentNameToWorkerMap].map(([environmentName, worker]) => {
21714
+ const initPromises = [...resolvedPluginConfig.environmentNameToWorkerMap].flatMap(([environmentName, worker]) => {
21521
21715
  debuglog("Initializing worker:", worker.config.name);
21522
21716
  const isEntryWorker = environmentName === resolvedPluginConfig.entryWorkerEnvironmentName;
21523
- return viteDevServer.environments[environmentName].initRunner(miniflare, worker.config, isEntryWorker);
21524
- }));
21717
+ const childEnvironmentNames = resolvedPluginConfig.environmentNameToChildEnvironmentNamesMap.get(environmentName) ?? [];
21718
+ return [viteDevServer.environments[environmentName].initRunner(miniflare, worker.config, {
21719
+ isEntryWorker,
21720
+ isParentEnvironment: true
21721
+ }), ...childEnvironmentNames.map((childEnvironmentName) => {
21722
+ debuglog("Initializing child environment:", childEnvironmentName);
21723
+ return viteDevServer.environments[childEnvironmentName].initRunner(miniflare, worker.config, {
21724
+ isEntryWorker: false,
21725
+ isParentEnvironment: false
21726
+ });
21727
+ })];
21728
+ });
21729
+ return Promise.all(initPromises);
21525
21730
  }
21526
21731
 
21527
21732
  //#endregion
@@ -21580,7 +21785,7 @@ function validateWorkerEnvironmentOptions(resolvedPluginConfig, resolvedViteConf
21580
21785
  */
21581
21786
  const configPlugin = createPlugin("config", (ctx) => {
21582
21787
  return {
21583
- config(userConfig, env) {
21788
+ config(userConfig, env$1) {
21584
21789
  if (ctx.resolvedPluginConfig.type === "preview") return { appType: "custom" };
21585
21790
  if (!ctx.hasShownWorkerConfigWarnings) {
21586
21791
  ctx.setHasShownWorkerConfigWarnings(true);
@@ -21599,22 +21804,7 @@ const configPlugin = createPlugin("config", (ctx) => {
21599
21804
  ".dev.vars",
21600
21805
  ".dev.vars.*"
21601
21806
  ] } },
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,
21807
+ environments: getEnvironmentsConfig(ctx, userConfig, env$1.mode),
21618
21808
  builder: { buildApp: userConfig.builder?.buildApp ?? createBuildApp(ctx.resolvedPluginConfig) }
21619
21809
  };
21620
21810
  },
@@ -21656,9 +21846,146 @@ const configPlugin = createPlugin("config", (ctx) => {
21656
21846
  }
21657
21847
  };
21658
21848
  });
21849
+ /**
21850
+ * Generates the environment configuration for all Worker environments.
21851
+ */
21852
+ function getEnvironmentsConfig(ctx, userConfig, mode) {
21853
+ if (ctx.resolvedPluginConfig.type !== "workers") return;
21854
+ const workersConfig = ctx.resolvedPluginConfig;
21855
+ return {
21856
+ ...Object.fromEntries([...workersConfig.environmentNameToWorkerMap].flatMap(([environmentName, worker]) => {
21857
+ const childEnvironmentNames = workersConfig.environmentNameToChildEnvironmentNamesMap.get(environmentName) ?? [];
21858
+ const sharedOptions = {
21859
+ workerConfig: worker.config,
21860
+ userConfig,
21861
+ mode,
21862
+ hasNodeJsCompat: ctx.getNodeJsCompat(environmentName) !== void 0
21863
+ };
21864
+ return [[environmentName, createCloudflareEnvironmentOptions({
21865
+ ...sharedOptions,
21866
+ environmentName,
21867
+ isEntryWorker: environmentName === workersConfig.entryWorkerEnvironmentName,
21868
+ isParentEnvironment: true
21869
+ })], ...childEnvironmentNames.map((childEnvironmentName) => [childEnvironmentName, createCloudflareEnvironmentOptions({
21870
+ ...sharedOptions,
21871
+ environmentName: childEnvironmentName,
21872
+ isEntryWorker: false,
21873
+ isParentEnvironment: false
21874
+ })])];
21875
+ })),
21876
+ client: {
21877
+ build: { outDir: getOutputDirectory(userConfig, "client") },
21878
+ optimizeDeps: { exclude: [...cloudflareBuiltInModules] }
21879
+ }
21880
+ };
21881
+ }
21882
+
21883
+ //#endregion
21884
+ //#region ../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
21885
+ var Locked = class extends Error {
21886
+ constructor(port) {
21887
+ super(`${port} is locked`);
21888
+ }
21889
+ };
21890
+ const lockedPorts = {
21891
+ old: /* @__PURE__ */ new Set(),
21892
+ young: /* @__PURE__ */ new Set()
21893
+ };
21894
+ const releaseOldLockedPortsIntervalMs = 1e3 * 15;
21895
+ const minPort = 1024;
21896
+ const maxPort = 65535;
21897
+ let timeout;
21898
+ const getLocalHosts = () => {
21899
+ const interfaces = os.networkInterfaces();
21900
+ const results = new Set([void 0, "0.0.0.0"]);
21901
+ for (const _interface of Object.values(interfaces)) for (const config of _interface) results.add(config.address);
21902
+ return results;
21903
+ };
21904
+ const checkAvailablePort = (options) => new Promise((resolve$2, reject) => {
21905
+ const server = net.createServer();
21906
+ server.unref();
21907
+ server.on("error", reject);
21908
+ server.listen(options, () => {
21909
+ const { port } = server.address();
21910
+ server.close(() => {
21911
+ resolve$2(port);
21912
+ });
21913
+ });
21914
+ });
21915
+ const getAvailablePort = async (options, hosts) => {
21916
+ if (options.host || options.port === 0) return checkAvailablePort(options);
21917
+ for (const host of hosts) try {
21918
+ await checkAvailablePort({
21919
+ port: options.port,
21920
+ host
21921
+ });
21922
+ } catch (error) {
21923
+ if (!["EADDRNOTAVAIL", "EINVAL"].includes(error.code)) throw error;
21924
+ }
21925
+ return options.port;
21926
+ };
21927
+ const portCheckSequence = function* (ports) {
21928
+ if (ports) yield* ports;
21929
+ yield 0;
21930
+ };
21931
+ async function getPorts(options) {
21932
+ let ports;
21933
+ let exclude = /* @__PURE__ */ new Set();
21934
+ if (options) {
21935
+ if (options.port) ports = typeof options.port === "number" ? [options.port] : options.port;
21936
+ if (options.exclude) {
21937
+ const excludeIterable = options.exclude;
21938
+ if (typeof excludeIterable[Symbol.iterator] !== "function") throw new TypeError("The `exclude` option must be an iterable.");
21939
+ for (const element of excludeIterable) {
21940
+ if (typeof element !== "number") throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");
21941
+ if (!Number.isSafeInteger(element)) throw new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);
21942
+ }
21943
+ exclude = new Set(excludeIterable);
21944
+ }
21945
+ }
21946
+ if (timeout === void 0) {
21947
+ timeout = setTimeout(() => {
21948
+ timeout = void 0;
21949
+ lockedPorts.old = lockedPorts.young;
21950
+ lockedPorts.young = /* @__PURE__ */ new Set();
21951
+ }, releaseOldLockedPortsIntervalMs);
21952
+ if (timeout.unref) timeout.unref();
21953
+ }
21954
+ const hosts = getLocalHosts();
21955
+ for (const port of portCheckSequence(ports)) try {
21956
+ if (exclude.has(port)) continue;
21957
+ let availablePort = await getAvailablePort({
21958
+ ...options,
21959
+ port
21960
+ }, hosts);
21961
+ while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
21962
+ if (port !== 0) throw new Locked(port);
21963
+ availablePort = await getAvailablePort({
21964
+ ...options,
21965
+ port
21966
+ }, hosts);
21967
+ }
21968
+ lockedPorts.young.add(availablePort);
21969
+ return availablePort;
21970
+ } catch (error) {
21971
+ if (!["EADDRINUSE", "EACCES"].includes(error.code) && !(error instanceof Locked)) throw error;
21972
+ }
21973
+ throw new Error("No available ports found");
21974
+ }
21975
+ function portNumbers(from, to) {
21976
+ if (!Number.isInteger(from) || !Number.isInteger(to)) throw new TypeError("`from` and `to` must be integer numbers");
21977
+ if (from < minPort || from > maxPort) throw new RangeError(`'from' must be between ${minPort} and ${maxPort}`);
21978
+ if (to < minPort || to > maxPort) throw new RangeError(`'to' must be between ${minPort} and ${maxPort}`);
21979
+ if (from > to) throw new RangeError("`to` must be greater than or equal to `from`");
21980
+ const generator = function* (from$1, to$1) {
21981
+ for (let port = from$1; port <= to$1; port++) yield port;
21982
+ };
21983
+ return generator(from, to);
21984
+ }
21659
21985
 
21660
21986
  //#endregion
21661
21987
  //#region src/debug.ts
21988
+ var import_picocolors$3 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
21662
21989
  const DEBUG_PATH = "/__debug";
21663
21990
  const DEFAULT_INSPECTOR_PORT = 9229;
21664
21991
  /**
@@ -21670,11 +21997,11 @@ async function getInputInspectorPort(ctx, viteServer) {
21670
21997
  if (resolvedInspectorPort !== null) return resolvedInspectorPort;
21671
21998
  }
21672
21999
  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`));
22000
+ 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
22001
  return inputInspectorPort;
21675
22002
  }
21676
22003
  function getFirstAvailablePort(start) {
21677
- return getPort({ port: portNumbers(start, 65535) });
22004
+ return getPorts({ port: portNumbers(start, 65535) });
21678
22005
  }
21679
22006
  /**
21680
22007
  * Modifies the URL printing logic to also include a URL that developers can use to open DevTools to debug their Worker(s)
@@ -21686,8 +22013,8 @@ function addDebugToVitePrintUrls(server) {
21686
22013
  const localUrl = server.resolvedUrls?.local[0];
21687
22014
  if (localUrl) {
21688
22015
  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}`)}`);
22016
+ const colorDebugUrl = (url) => import_picocolors$3.default.dim(import_picocolors$3.default.yellow(url.replace(/:(\d+)\//, (_, portNumber) => `:${import_picocolors$3.default.bold(portNumber)}/`)));
22017
+ server.config.logger.info(` ${import_picocolors$3.default.green("➜")} ${import_picocolors$3.default.bold("Debug")}: ${colorDebugUrl(`${protocol}//${hostname}:${port}${DEBUG_PATH}`)}`);
21691
22018
  }
21692
22019
  };
21693
22020
  }
@@ -22135,11 +22462,11 @@ const getQueryString = (params) => {
22135
22462
  };
22136
22463
  const getUrl = (config, options) => {
22137
22464
  const encoder = config.ENCODE_PATH || encodeURI;
22138
- const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
22465
+ const path$1 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
22139
22466
  if (options.path?.hasOwnProperty(group)) return encoder(String(options.path[group]));
22140
22467
  return substring;
22141
22468
  });
22142
- const url = `${config.BASE}${path}`;
22469
+ const url = `${config.BASE}${path$1}`;
22143
22470
  if (options.query) return `${url}${getQueryString(options.query)}`;
22144
22471
  return url;
22145
22472
  };
@@ -22884,15 +23211,15 @@ async function prepareContainerImagesForDev(args) {
22884
23211
  await verifyDockerInstalled(dockerPath);
22885
23212
  for (const options of containerOptions) {
22886
23213
  if ("dockerfile" in options) {
22887
- const build = await buildImage(dockerPath, options);
23214
+ const build$8 = await buildImage(dockerPath, options);
22888
23215
  onContainerImagePreparationStart({
22889
23216
  containerOptions: options,
22890
23217
  abort: () => {
22891
23218
  aborted = true;
22892
- build.abort();
23219
+ build$8.abort();
22893
23220
  }
22894
23221
  });
22895
- await build.ready;
23222
+ await build$8.ready;
22896
23223
  onContainerImagePreparationEnd({ containerOptions: options });
22897
23224
  } else {
22898
23225
  const pull = await pullImage(dockerPath, options, args.logger, args.isVite);
@@ -22973,6 +23300,2595 @@ function getContainerOptions(options) {
22973
23300
  });
22974
23301
  }
22975
23302
 
23303
+ //#endregion
23304
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/utils.js
23305
+ 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) => {
23306
+ Object.defineProperty(exports, "__esModule", { value: true });
23307
+ exports.normalizePath = exports.convertSlashes = exports.cleanPath = void 0;
23308
+ const path_1$4 = __require$1("path");
23309
+ function cleanPath(path$1) {
23310
+ let normalized = (0, path_1$4.normalize)(path$1);
23311
+ if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$4.sep) normalized = normalized.substring(0, normalized.length - 1);
23312
+ return normalized;
23313
+ }
23314
+ exports.cleanPath = cleanPath;
23315
+ const SLASHES_REGEX = /[\\/]/g;
23316
+ function convertSlashes(path$1, separator) {
23317
+ return path$1.replace(SLASHES_REGEX, separator);
23318
+ }
23319
+ exports.convertSlashes = convertSlashes;
23320
+ function normalizePath(path$1, options) {
23321
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
23322
+ const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
23323
+ if (resolvePaths) path$1 = (0, path_1$4.resolve)(path$1);
23324
+ if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
23325
+ if (path$1 === ".") return "";
23326
+ return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
23327
+ }
23328
+ exports.normalizePath = normalizePath;
23329
+ }) });
23330
+
23331
+ //#endregion
23332
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js
23333
+ 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) => {
23334
+ Object.defineProperty(exports, "__esModule", { value: true });
23335
+ exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
23336
+ const path_1$3 = __require$1("path");
23337
+ const utils_1$1 = require_utils$1();
23338
+ function joinPathWithBasePath(filename, directoryPath) {
23339
+ return directoryPath + filename;
23340
+ }
23341
+ exports.joinPathWithBasePath = joinPathWithBasePath;
23342
+ function joinPathWithRelativePath(root, options) {
23343
+ return function(filename, directoryPath) {
23344
+ if (directoryPath.startsWith(root)) return directoryPath.replace(root, "") + filename;
23345
+ else return (0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
23346
+ };
23347
+ }
23348
+ function joinPath$1(filename) {
23349
+ return filename;
23350
+ }
23351
+ function joinDirectoryPath(filename, directoryPath, separator) {
23352
+ return directoryPath + filename + separator;
23353
+ }
23354
+ exports.joinDirectoryPath = joinDirectoryPath;
23355
+ function build$7(root, options) {
23356
+ const { relativePaths, includeBasePath } = options;
23357
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath$1;
23358
+ }
23359
+ exports.build = build$7;
23360
+ }) });
23361
+
23362
+ //#endregion
23363
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js
23364
+ 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) => {
23365
+ Object.defineProperty(exports, "__esModule", { value: true });
23366
+ exports.build = void 0;
23367
+ function pushDirectoryWithRelativePath(root) {
23368
+ return function(directoryPath, paths) {
23369
+ paths.push(directoryPath.substring(root.length) || ".");
23370
+ };
23371
+ }
23372
+ function pushDirectoryFilterWithRelativePath(root) {
23373
+ return function(directoryPath, paths, filters) {
23374
+ const relativePath = directoryPath.substring(root.length) || ".";
23375
+ if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
23376
+ };
23377
+ }
23378
+ const pushDirectory$1 = (directoryPath, paths) => {
23379
+ paths.push(directoryPath || ".");
23380
+ };
23381
+ const pushDirectoryFilter = (directoryPath, paths, filters) => {
23382
+ const path$1 = directoryPath || ".";
23383
+ if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
23384
+ };
23385
+ const empty$2 = () => {};
23386
+ function build$6(root, options) {
23387
+ const { includeDirs, filters, relativePaths } = options;
23388
+ if (!includeDirs) return empty$2;
23389
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
23390
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
23391
+ }
23392
+ exports.build = build$6;
23393
+ }) });
23394
+
23395
+ //#endregion
23396
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-file.js
23397
+ 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) => {
23398
+ Object.defineProperty(exports, "__esModule", { value: true });
23399
+ exports.build = void 0;
23400
+ const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
23401
+ if (filters.every((filter) => filter(filename, false))) counts.files++;
23402
+ };
23403
+ const pushFileFilter = (filename, paths, _counts, filters) => {
23404
+ if (filters.every((filter) => filter(filename, false))) paths.push(filename);
23405
+ };
23406
+ const pushFileCount = (_filename, _paths, counts, _filters) => {
23407
+ counts.files++;
23408
+ };
23409
+ const pushFile$1 = (filename, paths) => {
23410
+ paths.push(filename);
23411
+ };
23412
+ const empty$1 = () => {};
23413
+ function build$5(options) {
23414
+ const { excludeFiles, filters, onlyCounts } = options;
23415
+ if (excludeFiles) return empty$1;
23416
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
23417
+ else if (onlyCounts) return pushFileCount;
23418
+ else return pushFile$1;
23419
+ }
23420
+ exports.build = build$5;
23421
+ }) });
23422
+
23423
+ //#endregion
23424
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/get-array.js
23425
+ 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) => {
23426
+ Object.defineProperty(exports, "__esModule", { value: true });
23427
+ exports.build = void 0;
23428
+ const getArray$1 = (paths) => {
23429
+ return paths;
23430
+ };
23431
+ const getArrayGroup = () => {
23432
+ return [""].slice(0, 0);
23433
+ };
23434
+ function build$4(options) {
23435
+ return options.group ? getArrayGroup : getArray$1;
23436
+ }
23437
+ exports.build = build$4;
23438
+ }) });
23439
+
23440
+ //#endregion
23441
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/group-files.js
23442
+ 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) => {
23443
+ Object.defineProperty(exports, "__esModule", { value: true });
23444
+ exports.build = void 0;
23445
+ const groupFiles$1 = (groups, directory, files) => {
23446
+ groups.push({
23447
+ directory,
23448
+ files,
23449
+ dir: directory
23450
+ });
23451
+ };
23452
+ const empty = () => {};
23453
+ function build$3(options) {
23454
+ return options.group ? groupFiles$1 : empty;
23455
+ }
23456
+ exports.build = build$3;
23457
+ }) });
23458
+
23459
+ //#endregion
23460
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/resolve-symlink.js
23461
+ 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) => {
23462
+ var __importDefault$1 = exports && exports.__importDefault || function(mod) {
23463
+ return mod && mod.__esModule ? mod : { "default": mod };
23464
+ };
23465
+ Object.defineProperty(exports, "__esModule", { value: true });
23466
+ exports.build = void 0;
23467
+ const fs_1$1 = __importDefault$1(__require$1("fs"));
23468
+ const path_1$2 = __require$1("path");
23469
+ const resolveSymlinksAsync = function(path$1, state, callback$1) {
23470
+ const { queue, options: { suppressErrors } } = state;
23471
+ queue.enqueue();
23472
+ fs_1$1.default.realpath(path$1, (error, resolvedPath) => {
23473
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
23474
+ fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
23475
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
23476
+ if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
23477
+ callback$1(stat, resolvedPath);
23478
+ queue.dequeue(null, state);
23479
+ });
23480
+ });
23481
+ };
23482
+ const resolveSymlinks = function(path$1, state, callback$1) {
23483
+ const { queue, options: { suppressErrors } } = state;
23484
+ queue.enqueue();
23485
+ try {
23486
+ const resolvedPath = fs_1$1.default.realpathSync(path$1);
23487
+ const stat = fs_1$1.default.statSync(resolvedPath);
23488
+ if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
23489
+ callback$1(stat, resolvedPath);
23490
+ } catch (e) {
23491
+ if (!suppressErrors) throw e;
23492
+ }
23493
+ };
23494
+ function build$2(options, isSynchronous) {
23495
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
23496
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
23497
+ }
23498
+ exports.build = build$2;
23499
+ function isRecursive(path$1, resolved, state) {
23500
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
23501
+ let parent = (0, path_1$2.dirname)(path$1);
23502
+ let depth$1 = 1;
23503
+ while (parent !== state.root && depth$1 < 2) {
23504
+ const resolvedPath = state.symlinks.get(parent);
23505
+ if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
23506
+ else parent = (0, path_1$2.dirname)(parent);
23507
+ }
23508
+ state.symlinks.set(path$1, resolved);
23509
+ return depth$1 > 1;
23510
+ }
23511
+ function isRecursiveUsingRealPaths(resolved, state) {
23512
+ return state.visited.includes(resolved + state.options.pathSeparator);
23513
+ }
23514
+ }) });
23515
+
23516
+ //#endregion
23517
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/invoke-callback.js
23518
+ 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) => {
23519
+ Object.defineProperty(exports, "__esModule", { value: true });
23520
+ exports.build = void 0;
23521
+ const onlyCountsSync = (state) => {
23522
+ return state.counts;
23523
+ };
23524
+ const groupsSync = (state) => {
23525
+ return state.groups;
23526
+ };
23527
+ const defaultSync = (state) => {
23528
+ return state.paths;
23529
+ };
23530
+ const limitFilesSync = (state) => {
23531
+ return state.paths.slice(0, state.options.maxFiles);
23532
+ };
23533
+ const onlyCountsAsync = (state, error, callback$1) => {
23534
+ report(error, callback$1, state.counts, state.options.suppressErrors);
23535
+ return null;
23536
+ };
23537
+ const defaultAsync = (state, error, callback$1) => {
23538
+ report(error, callback$1, state.paths, state.options.suppressErrors);
23539
+ return null;
23540
+ };
23541
+ const limitFilesAsync = (state, error, callback$1) => {
23542
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
23543
+ return null;
23544
+ };
23545
+ const groupsAsync = (state, error, callback$1) => {
23546
+ report(error, callback$1, state.groups, state.options.suppressErrors);
23547
+ return null;
23548
+ };
23549
+ function report(error, callback$1, output, suppressErrors) {
23550
+ if (error && !suppressErrors) callback$1(error, output);
23551
+ else callback$1(null, output);
23552
+ }
23553
+ function build$1(options, isSynchronous) {
23554
+ const { onlyCounts, group, maxFiles } = options;
23555
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
23556
+ else if (group) return isSynchronous ? groupsSync : groupsAsync;
23557
+ else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
23558
+ else return isSynchronous ? defaultSync : defaultAsync;
23559
+ }
23560
+ exports.build = build$1;
23561
+ }) });
23562
+
23563
+ //#endregion
23564
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/functions/walk-directory.js
23565
+ 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) => {
23566
+ var __importDefault = exports && exports.__importDefault || function(mod) {
23567
+ return mod && mod.__esModule ? mod : { "default": mod };
23568
+ };
23569
+ Object.defineProperty(exports, "__esModule", { value: true });
23570
+ exports.build = void 0;
23571
+ const fs_1 = __importDefault(__require$1("fs"));
23572
+ const readdirOpts = { withFileTypes: true };
23573
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
23574
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
23575
+ state.visited.push(crawlPath);
23576
+ state.counts.directories++;
23577
+ state.queue.enqueue();
23578
+ fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
23579
+ callback$1(entries, directoryPath, currentDepth);
23580
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
23581
+ });
23582
+ };
23583
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
23584
+ if (currentDepth < 0) return;
23585
+ state.visited.push(crawlPath);
23586
+ state.counts.directories++;
23587
+ let entries = [];
23588
+ try {
23589
+ entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
23590
+ } catch (e) {
23591
+ if (!state.options.suppressErrors) throw e;
23592
+ }
23593
+ callback$1(entries, directoryPath, currentDepth);
23594
+ };
23595
+ function build(isSynchronous) {
23596
+ return isSynchronous ? walkSync : walkAsync;
23597
+ }
23598
+ exports.build = build;
23599
+ }) });
23600
+
23601
+ //#endregion
23602
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/queue.js
23603
+ 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) => {
23604
+ Object.defineProperty(exports, "__esModule", { value: true });
23605
+ exports.Queue = void 0;
23606
+ /**
23607
+ * This is a custom stateless queue to track concurrent async fs calls.
23608
+ * It increments a counter whenever a call is queued and decrements it
23609
+ * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
23610
+ */
23611
+ var Queue = class {
23612
+ onQueueEmpty;
23613
+ count = 0;
23614
+ constructor(onQueueEmpty) {
23615
+ this.onQueueEmpty = onQueueEmpty;
23616
+ }
23617
+ enqueue() {
23618
+ this.count++;
23619
+ }
23620
+ dequeue(error, output) {
23621
+ if (--this.count <= 0 || error) this.onQueueEmpty(error, output);
23622
+ }
23623
+ };
23624
+ exports.Queue = Queue;
23625
+ }) });
23626
+
23627
+ //#endregion
23628
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/counter.js
23629
+ 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) => {
23630
+ Object.defineProperty(exports, "__esModule", { value: true });
23631
+ exports.Counter = void 0;
23632
+ var Counter = class {
23633
+ _files = 0;
23634
+ _directories = 0;
23635
+ set files(num) {
23636
+ this._files = num;
23637
+ }
23638
+ get files() {
23639
+ return this._files;
23640
+ }
23641
+ set directories(num) {
23642
+ this._directories = num;
23643
+ }
23644
+ get directories() {
23645
+ return this._directories;
23646
+ }
23647
+ /**
23648
+ * @deprecated use `directories` instead
23649
+ */
23650
+ /* c8 ignore next 3 */
23651
+ get dirs() {
23652
+ return this._directories;
23653
+ }
23654
+ };
23655
+ exports.Counter = Counter;
23656
+ }) });
23657
+
23658
+ //#endregion
23659
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/walker.js
23660
+ 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) => {
23661
+ var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
23662
+ if (k2 === void 0) k2 = k;
23663
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23664
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
23665
+ enumerable: true,
23666
+ get: function() {
23667
+ return m[k];
23668
+ }
23669
+ };
23670
+ Object.defineProperty(o, k2, desc);
23671
+ }) : (function(o, m, k, k2) {
23672
+ if (k2 === void 0) k2 = k;
23673
+ o[k2] = m[k];
23674
+ }));
23675
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
23676
+ Object.defineProperty(o, "default", {
23677
+ enumerable: true,
23678
+ value: v
23679
+ });
23680
+ }) : function(o, v) {
23681
+ o["default"] = v;
23682
+ });
23683
+ var __importStar = exports && exports.__importStar || function(mod) {
23684
+ if (mod && mod.__esModule) return mod;
23685
+ var result = {};
23686
+ if (mod != null) {
23687
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k);
23688
+ }
23689
+ __setModuleDefault(result, mod);
23690
+ return result;
23691
+ };
23692
+ Object.defineProperty(exports, "__esModule", { value: true });
23693
+ exports.Walker = void 0;
23694
+ const path_1$1 = __require$1("path");
23695
+ const utils_1 = require_utils$1();
23696
+ const joinPath = __importStar(require_join_path());
23697
+ const pushDirectory = __importStar(require_push_directory());
23698
+ const pushFile = __importStar(require_push_file());
23699
+ const getArray = __importStar(require_get_array());
23700
+ const groupFiles = __importStar(require_group_files());
23701
+ const resolveSymlink = __importStar(require_resolve_symlink());
23702
+ const invokeCallback = __importStar(require_invoke_callback());
23703
+ const walkDirectory = __importStar(require_walk_directory());
23704
+ const queue_1 = require_queue();
23705
+ const counter_1 = require_counter();
23706
+ var Walker = class {
23707
+ root;
23708
+ isSynchronous;
23709
+ state;
23710
+ joinPath;
23711
+ pushDirectory;
23712
+ pushFile;
23713
+ getArray;
23714
+ groupFiles;
23715
+ resolveSymlink;
23716
+ walkDirectory;
23717
+ callbackInvoker;
23718
+ constructor(root, options, callback$1) {
23719
+ this.isSynchronous = !callback$1;
23720
+ this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
23721
+ this.root = (0, utils_1.normalizePath)(root, options);
23722
+ this.state = {
23723
+ root: this.root.slice(0, -1),
23724
+ paths: [""].slice(0, 0),
23725
+ groups: [],
23726
+ counts: new counter_1.Counter(),
23727
+ options,
23728
+ queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
23729
+ symlinks: /* @__PURE__ */ new Map(),
23730
+ visited: [""].slice(0, 0)
23731
+ };
23732
+ this.joinPath = joinPath.build(this.root, options);
23733
+ this.pushDirectory = pushDirectory.build(this.root, options);
23734
+ this.pushFile = pushFile.build(options);
23735
+ this.getArray = getArray.build(options);
23736
+ this.groupFiles = groupFiles.build(options);
23737
+ this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
23738
+ this.walkDirectory = walkDirectory.build(this.isSynchronous);
23739
+ }
23740
+ start() {
23741
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
23742
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
23743
+ }
23744
+ walk = (entries, directoryPath, depth$1) => {
23745
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator } } = this.state;
23746
+ if (signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
23747
+ this.pushDirectory(directoryPath, paths, filters);
23748
+ const files = this.getArray(this.state.paths);
23749
+ for (let i$1 = 0; i$1 < entries.length; ++i$1) {
23750
+ const entry = entries[i$1];
23751
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
23752
+ const filename = this.joinPath(entry.name, directoryPath);
23753
+ this.pushFile(filename, files, this.state.counts, filters);
23754
+ } else if (entry.isDirectory()) {
23755
+ let path$1 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
23756
+ if (exclude && exclude(entry.name, path$1)) continue;
23757
+ this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
23758
+ } else if (entry.isSymbolicLink() && this.resolveSymlink) {
23759
+ let path$1 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
23760
+ this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
23761
+ if (stat.isDirectory()) {
23762
+ resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
23763
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
23764
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
23765
+ } else {
23766
+ resolvedPath = useRealPaths ? resolvedPath : path$1;
23767
+ const filename = (0, path_1$1.basename)(resolvedPath);
23768
+ const directoryPath$1 = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
23769
+ resolvedPath = this.joinPath(filename, directoryPath$1);
23770
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
23771
+ }
23772
+ });
23773
+ }
23774
+ }
23775
+ this.groupFiles(this.state.groups, directoryPath, files);
23776
+ };
23777
+ };
23778
+ exports.Walker = Walker;
23779
+ }) });
23780
+
23781
+ //#endregion
23782
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/async.js
23783
+ 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) => {
23784
+ Object.defineProperty(exports, "__esModule", { value: true });
23785
+ exports.callback = exports.promise = void 0;
23786
+ const walker_1$1 = require_walker();
23787
+ function promise(root, options) {
23788
+ return new Promise((resolve$2, reject) => {
23789
+ callback(root, options, (err, output) => {
23790
+ if (err) return reject(err);
23791
+ resolve$2(output);
23792
+ });
23793
+ });
23794
+ }
23795
+ exports.promise = promise;
23796
+ function callback(root, options, callback$1) {
23797
+ new walker_1$1.Walker(root, options, callback$1).start();
23798
+ }
23799
+ exports.callback = callback;
23800
+ }) });
23801
+
23802
+ //#endregion
23803
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/api/sync.js
23804
+ 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) => {
23805
+ Object.defineProperty(exports, "__esModule", { value: true });
23806
+ exports.sync = void 0;
23807
+ const walker_1 = require_walker();
23808
+ function sync(root, options) {
23809
+ return new walker_1.Walker(root, options).start();
23810
+ }
23811
+ exports.sync = sync;
23812
+ }) });
23813
+
23814
+ //#endregion
23815
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js
23816
+ 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) => {
23817
+ Object.defineProperty(exports, "__esModule", { value: true });
23818
+ exports.APIBuilder = void 0;
23819
+ const async_1 = require_async();
23820
+ const sync_1 = require_sync();
23821
+ var APIBuilder = class {
23822
+ root;
23823
+ options;
23824
+ constructor(root, options) {
23825
+ this.root = root;
23826
+ this.options = options;
23827
+ }
23828
+ withPromise() {
23829
+ return (0, async_1.promise)(this.root, this.options);
23830
+ }
23831
+ withCallback(cb) {
23832
+ (0, async_1.callback)(this.root, this.options, cb);
23833
+ }
23834
+ sync() {
23835
+ return (0, sync_1.sync)(this.root, this.options);
23836
+ }
23837
+ };
23838
+ exports.APIBuilder = APIBuilder;
23839
+ }) });
23840
+
23841
+ //#endregion
23842
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js
23843
+ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js": ((exports, module) => {
23844
+ const WIN_SLASH = "\\\\/";
23845
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
23846
+ /**
23847
+ * Posix glob regex
23848
+ */
23849
+ const DOT_LITERAL = "\\.";
23850
+ const PLUS_LITERAL = "\\+";
23851
+ const QMARK_LITERAL = "\\?";
23852
+ const SLASH_LITERAL = "\\/";
23853
+ const ONE_CHAR = "(?=.)";
23854
+ const QMARK = "[^/]";
23855
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
23856
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
23857
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
23858
+ const POSIX_CHARS = {
23859
+ DOT_LITERAL,
23860
+ PLUS_LITERAL,
23861
+ QMARK_LITERAL,
23862
+ SLASH_LITERAL,
23863
+ ONE_CHAR,
23864
+ QMARK,
23865
+ END_ANCHOR,
23866
+ DOTS_SLASH,
23867
+ NO_DOT: `(?!${DOT_LITERAL})`,
23868
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
23869
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
23870
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
23871
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
23872
+ STAR: `${QMARK}*?`,
23873
+ START_ANCHOR,
23874
+ SEP: "/"
23875
+ };
23876
+ /**
23877
+ * Windows glob regex
23878
+ */
23879
+ const WINDOWS_CHARS = {
23880
+ ...POSIX_CHARS,
23881
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
23882
+ QMARK: WIN_NO_SLASH,
23883
+ STAR: `${WIN_NO_SLASH}*?`,
23884
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
23885
+ NO_DOT: `(?!${DOT_LITERAL})`,
23886
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
23887
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
23888
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
23889
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
23890
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
23891
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
23892
+ SEP: "\\"
23893
+ };
23894
+ /**
23895
+ * POSIX Bracket Regex
23896
+ */
23897
+ const POSIX_REGEX_SOURCE$1 = {
23898
+ alnum: "a-zA-Z0-9",
23899
+ alpha: "a-zA-Z",
23900
+ ascii: "\\x00-\\x7F",
23901
+ blank: " \\t",
23902
+ cntrl: "\\x00-\\x1F\\x7F",
23903
+ digit: "0-9",
23904
+ graph: "\\x21-\\x7E",
23905
+ lower: "a-z",
23906
+ print: "\\x20-\\x7E ",
23907
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
23908
+ space: " \\t\\r\\n\\v\\f",
23909
+ upper: "A-Z",
23910
+ word: "A-Za-z0-9_",
23911
+ xdigit: "A-Fa-f0-9"
23912
+ };
23913
+ module.exports = {
23914
+ MAX_LENGTH: 1024 * 64,
23915
+ POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
23916
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
23917
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
23918
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
23919
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
23920
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
23921
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
23922
+ REPLACEMENTS: {
23923
+ "***": "*",
23924
+ "**/**": "**",
23925
+ "**/**/**": "**"
23926
+ },
23927
+ CHAR_0: 48,
23928
+ CHAR_9: 57,
23929
+ CHAR_UPPERCASE_A: 65,
23930
+ CHAR_LOWERCASE_A: 97,
23931
+ CHAR_UPPERCASE_Z: 90,
23932
+ CHAR_LOWERCASE_Z: 122,
23933
+ CHAR_LEFT_PARENTHESES: 40,
23934
+ CHAR_RIGHT_PARENTHESES: 41,
23935
+ CHAR_ASTERISK: 42,
23936
+ CHAR_AMPERSAND: 38,
23937
+ CHAR_AT: 64,
23938
+ CHAR_BACKWARD_SLASH: 92,
23939
+ CHAR_CARRIAGE_RETURN: 13,
23940
+ CHAR_CIRCUMFLEX_ACCENT: 94,
23941
+ CHAR_COLON: 58,
23942
+ CHAR_COMMA: 44,
23943
+ CHAR_DOT: 46,
23944
+ CHAR_DOUBLE_QUOTE: 34,
23945
+ CHAR_EQUAL: 61,
23946
+ CHAR_EXCLAMATION_MARK: 33,
23947
+ CHAR_FORM_FEED: 12,
23948
+ CHAR_FORWARD_SLASH: 47,
23949
+ CHAR_GRAVE_ACCENT: 96,
23950
+ CHAR_HASH: 35,
23951
+ CHAR_HYPHEN_MINUS: 45,
23952
+ CHAR_LEFT_ANGLE_BRACKET: 60,
23953
+ CHAR_LEFT_CURLY_BRACE: 123,
23954
+ CHAR_LEFT_SQUARE_BRACKET: 91,
23955
+ CHAR_LINE_FEED: 10,
23956
+ CHAR_NO_BREAK_SPACE: 160,
23957
+ CHAR_PERCENT: 37,
23958
+ CHAR_PLUS: 43,
23959
+ CHAR_QUESTION_MARK: 63,
23960
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
23961
+ CHAR_RIGHT_CURLY_BRACE: 125,
23962
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
23963
+ CHAR_SEMICOLON: 59,
23964
+ CHAR_SINGLE_QUOTE: 39,
23965
+ CHAR_SPACE: 32,
23966
+ CHAR_TAB: 9,
23967
+ CHAR_UNDERSCORE: 95,
23968
+ CHAR_VERTICAL_LINE: 124,
23969
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
23970
+ extglobChars(chars$1) {
23971
+ return {
23972
+ "!": {
23973
+ type: "negate",
23974
+ open: "(?:(?!(?:",
23975
+ close: `))${chars$1.STAR})`
23976
+ },
23977
+ "?": {
23978
+ type: "qmark",
23979
+ open: "(?:",
23980
+ close: ")?"
23981
+ },
23982
+ "+": {
23983
+ type: "plus",
23984
+ open: "(?:",
23985
+ close: ")+"
23986
+ },
23987
+ "*": {
23988
+ type: "star",
23989
+ open: "(?:",
23990
+ close: ")*"
23991
+ },
23992
+ "@": {
23993
+ type: "at",
23994
+ open: "(?:",
23995
+ close: ")"
23996
+ }
23997
+ };
23998
+ },
23999
+ globChars(win32) {
24000
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
24001
+ }
24002
+ };
24003
+ }) });
24004
+
24005
+ //#endregion
24006
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js
24007
+ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js": ((exports) => {
24008
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
24009
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
24010
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
24011
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
24012
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
24013
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
24014
+ exports.isWindows = () => {
24015
+ if (typeof navigator !== "undefined" && navigator.platform) {
24016
+ const platform = navigator.platform.toLowerCase();
24017
+ return platform === "win32" || platform === "windows";
24018
+ }
24019
+ if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
24020
+ return false;
24021
+ };
24022
+ exports.removeBackslashes = (str) => {
24023
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
24024
+ return match === "\\" ? "" : match;
24025
+ });
24026
+ };
24027
+ exports.escapeLast = (input, char, lastIdx) => {
24028
+ const idx = input.lastIndexOf(char, lastIdx);
24029
+ if (idx === -1) return input;
24030
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
24031
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
24032
+ };
24033
+ exports.removePrefix = (input, state = {}) => {
24034
+ let output = input;
24035
+ if (output.startsWith("./")) {
24036
+ output = output.slice(2);
24037
+ state.prefix = "./";
24038
+ }
24039
+ return output;
24040
+ };
24041
+ exports.wrapOutput = (input, state = {}, options = {}) => {
24042
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
24043
+ if (state.negated === true) output = `(?:^(?!${output}).*$)`;
24044
+ return output;
24045
+ };
24046
+ exports.basename = (path$1, { windows } = {}) => {
24047
+ const segs = path$1.split(windows ? /[\\/]/ : "/");
24048
+ const last = segs[segs.length - 1];
24049
+ if (last === "") return segs[segs.length - 2];
24050
+ return last;
24051
+ };
24052
+ }) });
24053
+
24054
+ //#endregion
24055
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js
24056
+ var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js": ((exports, module) => {
24057
+ const utils$3 = require_utils();
24058
+ 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();
24059
+ const isPathSeparator = (code) => {
24060
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
24061
+ };
24062
+ const depth = (token) => {
24063
+ if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
24064
+ };
24065
+ /**
24066
+ * Quickly scans a glob pattern and returns an object with a handful of
24067
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
24068
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
24069
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
24070
+ *
24071
+ * ```js
24072
+ * const pm = require('picomatch');
24073
+ * console.log(pm.scan('foo/bar/*.js'));
24074
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
24075
+ * ```
24076
+ * @param {String} `str`
24077
+ * @param {Object} `options`
24078
+ * @return {Object} Returns an object with tokens and regex source string.
24079
+ * @api public
24080
+ */
24081
+ const scan$1 = (input, options) => {
24082
+ const opts = options || {};
24083
+ const length = input.length - 1;
24084
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
24085
+ const slashes = [];
24086
+ const tokens = [];
24087
+ const parts = [];
24088
+ let str = input;
24089
+ let index = -1;
24090
+ let start = 0;
24091
+ let lastIndex = 0;
24092
+ let isBrace = false;
24093
+ let isBracket = false;
24094
+ let isGlob = false;
24095
+ let isExtglob = false;
24096
+ let isGlobstar = false;
24097
+ let braceEscaped = false;
24098
+ let backslashes = false;
24099
+ let negated = false;
24100
+ let negatedExtglob = false;
24101
+ let finished = false;
24102
+ let braces = 0;
24103
+ let prev;
24104
+ let code;
24105
+ let token = {
24106
+ value: "",
24107
+ depth: 0,
24108
+ isGlob: false
24109
+ };
24110
+ const eos = () => index >= length;
24111
+ const peek = () => str.charCodeAt(index + 1);
24112
+ const advance = () => {
24113
+ prev = code;
24114
+ return str.charCodeAt(++index);
24115
+ };
24116
+ while (index < length) {
24117
+ code = advance();
24118
+ let next;
24119
+ if (code === CHAR_BACKWARD_SLASH) {
24120
+ backslashes = token.backslashes = true;
24121
+ code = advance();
24122
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
24123
+ continue;
24124
+ }
24125
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
24126
+ braces++;
24127
+ while (eos() !== true && (code = advance())) {
24128
+ if (code === CHAR_BACKWARD_SLASH) {
24129
+ backslashes = token.backslashes = true;
24130
+ advance();
24131
+ continue;
24132
+ }
24133
+ if (code === CHAR_LEFT_CURLY_BRACE) {
24134
+ braces++;
24135
+ continue;
24136
+ }
24137
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
24138
+ isBrace = token.isBrace = true;
24139
+ isGlob = token.isGlob = true;
24140
+ finished = true;
24141
+ if (scanToEnd === true) continue;
24142
+ break;
24143
+ }
24144
+ if (braceEscaped !== true && code === CHAR_COMMA) {
24145
+ isBrace = token.isBrace = true;
24146
+ isGlob = token.isGlob = true;
24147
+ finished = true;
24148
+ if (scanToEnd === true) continue;
24149
+ break;
24150
+ }
24151
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
24152
+ braces--;
24153
+ if (braces === 0) {
24154
+ braceEscaped = false;
24155
+ isBrace = token.isBrace = true;
24156
+ finished = true;
24157
+ break;
24158
+ }
24159
+ }
24160
+ }
24161
+ if (scanToEnd === true) continue;
24162
+ break;
24163
+ }
24164
+ if (code === CHAR_FORWARD_SLASH) {
24165
+ slashes.push(index);
24166
+ tokens.push(token);
24167
+ token = {
24168
+ value: "",
24169
+ depth: 0,
24170
+ isGlob: false
24171
+ };
24172
+ if (finished === true) continue;
24173
+ if (prev === CHAR_DOT && index === start + 1) {
24174
+ start += 2;
24175
+ continue;
24176
+ }
24177
+ lastIndex = index + 1;
24178
+ continue;
24179
+ }
24180
+ if (opts.noext !== true) {
24181
+ if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
24182
+ isGlob = token.isGlob = true;
24183
+ isExtglob = token.isExtglob = true;
24184
+ finished = true;
24185
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
24186
+ if (scanToEnd === true) {
24187
+ while (eos() !== true && (code = advance())) {
24188
+ if (code === CHAR_BACKWARD_SLASH) {
24189
+ backslashes = token.backslashes = true;
24190
+ code = advance();
24191
+ continue;
24192
+ }
24193
+ if (code === CHAR_RIGHT_PARENTHESES) {
24194
+ isGlob = token.isGlob = true;
24195
+ finished = true;
24196
+ break;
24197
+ }
24198
+ }
24199
+ continue;
24200
+ }
24201
+ break;
24202
+ }
24203
+ }
24204
+ if (code === CHAR_ASTERISK) {
24205
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
24206
+ isGlob = token.isGlob = true;
24207
+ finished = true;
24208
+ if (scanToEnd === true) continue;
24209
+ break;
24210
+ }
24211
+ if (code === CHAR_QUESTION_MARK) {
24212
+ isGlob = token.isGlob = true;
24213
+ finished = true;
24214
+ if (scanToEnd === true) continue;
24215
+ break;
24216
+ }
24217
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
24218
+ while (eos() !== true && (next = advance())) {
24219
+ if (next === CHAR_BACKWARD_SLASH) {
24220
+ backslashes = token.backslashes = true;
24221
+ advance();
24222
+ continue;
24223
+ }
24224
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
24225
+ isBracket = token.isBracket = true;
24226
+ isGlob = token.isGlob = true;
24227
+ finished = true;
24228
+ break;
24229
+ }
24230
+ }
24231
+ if (scanToEnd === true) continue;
24232
+ break;
24233
+ }
24234
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
24235
+ negated = token.negated = true;
24236
+ start++;
24237
+ continue;
24238
+ }
24239
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
24240
+ isGlob = token.isGlob = true;
24241
+ if (scanToEnd === true) {
24242
+ while (eos() !== true && (code = advance())) {
24243
+ if (code === CHAR_LEFT_PARENTHESES) {
24244
+ backslashes = token.backslashes = true;
24245
+ code = advance();
24246
+ continue;
24247
+ }
24248
+ if (code === CHAR_RIGHT_PARENTHESES) {
24249
+ finished = true;
24250
+ break;
24251
+ }
24252
+ }
24253
+ continue;
24254
+ }
24255
+ break;
24256
+ }
24257
+ if (isGlob === true) {
24258
+ finished = true;
24259
+ if (scanToEnd === true) continue;
24260
+ break;
24261
+ }
24262
+ }
24263
+ if (opts.noext === true) {
24264
+ isExtglob = false;
24265
+ isGlob = false;
24266
+ }
24267
+ let base = str;
24268
+ let prefix = "";
24269
+ let glob = "";
24270
+ if (start > 0) {
24271
+ prefix = str.slice(0, start);
24272
+ str = str.slice(start);
24273
+ lastIndex -= start;
24274
+ }
24275
+ if (base && isGlob === true && lastIndex > 0) {
24276
+ base = str.slice(0, lastIndex);
24277
+ glob = str.slice(lastIndex);
24278
+ } else if (isGlob === true) {
24279
+ base = "";
24280
+ glob = str;
24281
+ } else base = str;
24282
+ if (base && base !== "" && base !== "/" && base !== str) {
24283
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
24284
+ }
24285
+ if (opts.unescape === true) {
24286
+ if (glob) glob = utils$3.removeBackslashes(glob);
24287
+ if (base && backslashes === true) base = utils$3.removeBackslashes(base);
24288
+ }
24289
+ const state = {
24290
+ prefix,
24291
+ input,
24292
+ start,
24293
+ base,
24294
+ glob,
24295
+ isBrace,
24296
+ isBracket,
24297
+ isGlob,
24298
+ isExtglob,
24299
+ isGlobstar,
24300
+ negated,
24301
+ negatedExtglob
24302
+ };
24303
+ if (opts.tokens === true) {
24304
+ state.maxDepth = 0;
24305
+ if (!isPathSeparator(code)) tokens.push(token);
24306
+ state.tokens = tokens;
24307
+ }
24308
+ if (opts.parts === true || opts.tokens === true) {
24309
+ let prevIndex;
24310
+ for (let idx = 0; idx < slashes.length; idx++) {
24311
+ const n$1 = prevIndex ? prevIndex + 1 : start;
24312
+ const i$1 = slashes[idx];
24313
+ const value = input.slice(n$1, i$1);
24314
+ if (opts.tokens) {
24315
+ if (idx === 0 && start !== 0) {
24316
+ tokens[idx].isPrefix = true;
24317
+ tokens[idx].value = prefix;
24318
+ } else tokens[idx].value = value;
24319
+ depth(tokens[idx]);
24320
+ state.maxDepth += tokens[idx].depth;
24321
+ }
24322
+ if (idx !== 0 || value !== "") parts.push(value);
24323
+ prevIndex = i$1;
24324
+ }
24325
+ if (prevIndex && prevIndex + 1 < input.length) {
24326
+ const value = input.slice(prevIndex + 1);
24327
+ parts.push(value);
24328
+ if (opts.tokens) {
24329
+ tokens[tokens.length - 1].value = value;
24330
+ depth(tokens[tokens.length - 1]);
24331
+ state.maxDepth += tokens[tokens.length - 1].depth;
24332
+ }
24333
+ }
24334
+ state.slashes = slashes;
24335
+ state.parts = parts;
24336
+ }
24337
+ return state;
24338
+ };
24339
+ module.exports = scan$1;
24340
+ }) });
24341
+
24342
+ //#endregion
24343
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js
24344
+ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js": ((exports, module) => {
24345
+ const constants$1 = require_constants();
24346
+ const utils$2 = require_utils();
24347
+ /**
24348
+ * Constants
24349
+ */
24350
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
24351
+ /**
24352
+ * Helpers
24353
+ */
24354
+ const expandRange = (args, options) => {
24355
+ if (typeof options.expandRange === "function") return options.expandRange(...args, options);
24356
+ args.sort();
24357
+ const value = `[${args.join("-")}]`;
24358
+ try {
24359
+ new RegExp(value);
24360
+ } catch (ex) {
24361
+ return args.map((v) => utils$2.escapeRegex(v)).join("..");
24362
+ }
24363
+ return value;
24364
+ };
24365
+ /**
24366
+ * Create the message for a syntax error
24367
+ */
24368
+ const syntaxError = (type, char) => {
24369
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
24370
+ };
24371
+ /**
24372
+ * Parse the given input string.
24373
+ * @param {String} input
24374
+ * @param {Object} options
24375
+ * @return {Object}
24376
+ */
24377
+ const parse$1 = (input, options) => {
24378
+ if (typeof input !== "string") throw new TypeError("Expected a string");
24379
+ input = REPLACEMENTS[input] || input;
24380
+ const opts = { ...options };
24381
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
24382
+ let len = input.length;
24383
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
24384
+ const bos = {
24385
+ type: "bos",
24386
+ value: "",
24387
+ output: opts.prepend || ""
24388
+ };
24389
+ const tokens = [bos];
24390
+ const capture = opts.capture ? "" : "?:";
24391
+ const PLATFORM_CHARS = constants$1.globChars(opts.windows);
24392
+ const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
24393
+ 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;
24394
+ const globstar = (opts$1) => {
24395
+ return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
24396
+ };
24397
+ const nodot = opts.dot ? "" : NO_DOT;
24398
+ const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
24399
+ let star = opts.bash === true ? globstar(opts) : STAR;
24400
+ if (opts.capture) star = `(${star})`;
24401
+ if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
24402
+ const state = {
24403
+ input,
24404
+ index: -1,
24405
+ start: 0,
24406
+ dot: opts.dot === true,
24407
+ consumed: "",
24408
+ output: "",
24409
+ prefix: "",
24410
+ backtrack: false,
24411
+ negated: false,
24412
+ brackets: 0,
24413
+ braces: 0,
24414
+ parens: 0,
24415
+ quotes: 0,
24416
+ globstar: false,
24417
+ tokens
24418
+ };
24419
+ input = utils$2.removePrefix(input, state);
24420
+ len = input.length;
24421
+ const extglobs = [];
24422
+ const braces = [];
24423
+ const stack = [];
24424
+ let prev = bos;
24425
+ let value;
24426
+ /**
24427
+ * Tokenizing helpers
24428
+ */
24429
+ const eos = () => state.index === len - 1;
24430
+ const peek = state.peek = (n$1 = 1) => input[state.index + n$1];
24431
+ const advance = state.advance = () => input[++state.index] || "";
24432
+ const remaining = () => input.slice(state.index + 1);
24433
+ const consume = (value$1 = "", num = 0) => {
24434
+ state.consumed += value$1;
24435
+ state.index += num;
24436
+ };
24437
+ const append = (token) => {
24438
+ state.output += token.output != null ? token.output : token.value;
24439
+ consume(token.value);
24440
+ };
24441
+ const negate = () => {
24442
+ let count = 1;
24443
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
24444
+ advance();
24445
+ state.start++;
24446
+ count++;
24447
+ }
24448
+ if (count % 2 === 0) return false;
24449
+ state.negated = true;
24450
+ state.start++;
24451
+ return true;
24452
+ };
24453
+ const increment = (type) => {
24454
+ state[type]++;
24455
+ stack.push(type);
24456
+ };
24457
+ const decrement = (type) => {
24458
+ state[type]--;
24459
+ stack.pop();
24460
+ };
24461
+ /**
24462
+ * Push tokens onto the tokens array. This helper speeds up
24463
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
24464
+ * and 2) helping us avoid creating extra tokens when consecutive
24465
+ * characters are plain text. This improves performance and simplifies
24466
+ * lookbehinds.
24467
+ */
24468
+ const push = (tok) => {
24469
+ if (prev.type === "globstar") {
24470
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
24471
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
24472
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
24473
+ state.output = state.output.slice(0, -prev.output.length);
24474
+ prev.type = "star";
24475
+ prev.value = "*";
24476
+ prev.output = star;
24477
+ state.output += prev.output;
24478
+ }
24479
+ }
24480
+ if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
24481
+ if (tok.value || tok.output) append(tok);
24482
+ if (prev && prev.type === "text" && tok.type === "text") {
24483
+ prev.output = (prev.output || prev.value) + tok.value;
24484
+ prev.value += tok.value;
24485
+ return;
24486
+ }
24487
+ tok.prev = prev;
24488
+ tokens.push(tok);
24489
+ prev = tok;
24490
+ };
24491
+ const extglobOpen = (type, value$1) => {
24492
+ const token = {
24493
+ ...EXTGLOB_CHARS[value$1],
24494
+ conditions: 1,
24495
+ inner: ""
24496
+ };
24497
+ token.prev = prev;
24498
+ token.parens = state.parens;
24499
+ token.output = state.output;
24500
+ const output = (opts.capture ? "(" : "") + token.open;
24501
+ increment("parens");
24502
+ push({
24503
+ type,
24504
+ value: value$1,
24505
+ output: state.output ? "" : ONE_CHAR$1
24506
+ });
24507
+ push({
24508
+ type: "paren",
24509
+ extglob: true,
24510
+ value: advance(),
24511
+ output
24512
+ });
24513
+ extglobs.push(token);
24514
+ };
24515
+ const extglobClose = (token) => {
24516
+ let output = token.close + (opts.capture ? ")" : "");
24517
+ let rest;
24518
+ if (token.type === "negate") {
24519
+ let extglobStar = star;
24520
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
24521
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
24522
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse$1(rest, {
24523
+ ...options,
24524
+ fastpaths: false
24525
+ }).output})${extglobStar})`;
24526
+ if (token.prev.type === "bos") state.negatedExtglob = true;
24527
+ }
24528
+ push({
24529
+ type: "paren",
24530
+ extglob: true,
24531
+ value,
24532
+ output
24533
+ });
24534
+ decrement("parens");
24535
+ };
24536
+ /**
24537
+ * Fast paths
24538
+ */
24539
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
24540
+ let backslashes = false;
24541
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars$1, first, rest, index) => {
24542
+ if (first === "\\") {
24543
+ backslashes = true;
24544
+ return m;
24545
+ }
24546
+ if (first === "?") {
24547
+ if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
24548
+ if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
24549
+ return QMARK$1.repeat(chars$1.length);
24550
+ }
24551
+ if (first === ".") return DOT_LITERAL$1.repeat(chars$1.length);
24552
+ if (first === "*") {
24553
+ if (esc) return esc + first + (rest ? star : "");
24554
+ return star;
24555
+ }
24556
+ return esc ? m : `\\${m}`;
24557
+ });
24558
+ if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
24559
+ else output = output.replace(/\\+/g, (m) => {
24560
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
24561
+ });
24562
+ if (output === input && opts.contains === true) {
24563
+ state.output = input;
24564
+ return state;
24565
+ }
24566
+ state.output = utils$2.wrapOutput(output, state, options);
24567
+ return state;
24568
+ }
24569
+ /**
24570
+ * Tokenize input until we reach end-of-string
24571
+ */
24572
+ while (!eos()) {
24573
+ value = advance();
24574
+ if (value === "\0") continue;
24575
+ /**
24576
+ * Escaped characters
24577
+ */
24578
+ if (value === "\\") {
24579
+ const next = peek();
24580
+ if (next === "/" && opts.bash !== true) continue;
24581
+ if (next === "." || next === ";") continue;
24582
+ if (!next) {
24583
+ value += "\\";
24584
+ push({
24585
+ type: "text",
24586
+ value
24587
+ });
24588
+ continue;
24589
+ }
24590
+ const match = /^\\+/.exec(remaining());
24591
+ let slashes = 0;
24592
+ if (match && match[0].length > 2) {
24593
+ slashes = match[0].length;
24594
+ state.index += slashes;
24595
+ if (slashes % 2 !== 0) value += "\\";
24596
+ }
24597
+ if (opts.unescape === true) value = advance();
24598
+ else value += advance();
24599
+ if (state.brackets === 0) {
24600
+ push({
24601
+ type: "text",
24602
+ value
24603
+ });
24604
+ continue;
24605
+ }
24606
+ }
24607
+ /**
24608
+ * If we're inside a regex character class, continue
24609
+ * until we reach the closing bracket.
24610
+ */
24611
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
24612
+ if (opts.posix !== false && value === ":") {
24613
+ const inner = prev.value.slice(1);
24614
+ if (inner.includes("[")) {
24615
+ prev.posix = true;
24616
+ if (inner.includes(":")) {
24617
+ const idx = prev.value.lastIndexOf("[");
24618
+ const pre = prev.value.slice(0, idx);
24619
+ const posix$1 = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
24620
+ if (posix$1) {
24621
+ prev.value = pre + posix$1;
24622
+ state.backtrack = true;
24623
+ advance();
24624
+ if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
24625
+ continue;
24626
+ }
24627
+ }
24628
+ }
24629
+ }
24630
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
24631
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
24632
+ if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
24633
+ prev.value += value;
24634
+ append({ value });
24635
+ continue;
24636
+ }
24637
+ /**
24638
+ * If we're inside a quoted string, continue
24639
+ * until we reach the closing double quote.
24640
+ */
24641
+ if (state.quotes === 1 && value !== "\"") {
24642
+ value = utils$2.escapeRegex(value);
24643
+ prev.value += value;
24644
+ append({ value });
24645
+ continue;
24646
+ }
24647
+ /**
24648
+ * Double quotes
24649
+ */
24650
+ if (value === "\"") {
24651
+ state.quotes = state.quotes === 1 ? 0 : 1;
24652
+ if (opts.keepQuotes === true) push({
24653
+ type: "text",
24654
+ value
24655
+ });
24656
+ continue;
24657
+ }
24658
+ /**
24659
+ * Parentheses
24660
+ */
24661
+ if (value === "(") {
24662
+ increment("parens");
24663
+ push({
24664
+ type: "paren",
24665
+ value
24666
+ });
24667
+ continue;
24668
+ }
24669
+ if (value === ")") {
24670
+ if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
24671
+ const extglob = extglobs[extglobs.length - 1];
24672
+ if (extglob && state.parens === extglob.parens + 1) {
24673
+ extglobClose(extglobs.pop());
24674
+ continue;
24675
+ }
24676
+ push({
24677
+ type: "paren",
24678
+ value,
24679
+ output: state.parens ? ")" : "\\)"
24680
+ });
24681
+ decrement("parens");
24682
+ continue;
24683
+ }
24684
+ /**
24685
+ * Square brackets
24686
+ */
24687
+ if (value === "[") {
24688
+ if (opts.nobracket === true || !remaining().includes("]")) {
24689
+ if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
24690
+ value = `\\${value}`;
24691
+ } else increment("brackets");
24692
+ push({
24693
+ type: "bracket",
24694
+ value
24695
+ });
24696
+ continue;
24697
+ }
24698
+ if (value === "]") {
24699
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
24700
+ push({
24701
+ type: "text",
24702
+ value,
24703
+ output: `\\${value}`
24704
+ });
24705
+ continue;
24706
+ }
24707
+ if (state.brackets === 0) {
24708
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
24709
+ push({
24710
+ type: "text",
24711
+ value,
24712
+ output: `\\${value}`
24713
+ });
24714
+ continue;
24715
+ }
24716
+ decrement("brackets");
24717
+ const prevValue = prev.value.slice(1);
24718
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
24719
+ prev.value += value;
24720
+ append({ value });
24721
+ if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
24722
+ const escaped = utils$2.escapeRegex(prev.value);
24723
+ state.output = state.output.slice(0, -prev.value.length);
24724
+ if (opts.literalBrackets === true) {
24725
+ state.output += escaped;
24726
+ prev.value = escaped;
24727
+ continue;
24728
+ }
24729
+ prev.value = `(${capture}${escaped}|${prev.value})`;
24730
+ state.output += prev.value;
24731
+ continue;
24732
+ }
24733
+ /**
24734
+ * Braces
24735
+ */
24736
+ if (value === "{" && opts.nobrace !== true) {
24737
+ increment("braces");
24738
+ const open = {
24739
+ type: "brace",
24740
+ value,
24741
+ output: "(",
24742
+ outputIndex: state.output.length,
24743
+ tokensIndex: state.tokens.length
24744
+ };
24745
+ braces.push(open);
24746
+ push(open);
24747
+ continue;
24748
+ }
24749
+ if (value === "}") {
24750
+ const brace = braces[braces.length - 1];
24751
+ if (opts.nobrace === true || !brace) {
24752
+ push({
24753
+ type: "text",
24754
+ value,
24755
+ output: value
24756
+ });
24757
+ continue;
24758
+ }
24759
+ let output = ")";
24760
+ if (brace.dots === true) {
24761
+ const arr = tokens.slice();
24762
+ const range = [];
24763
+ for (let i$1 = arr.length - 1; i$1 >= 0; i$1--) {
24764
+ tokens.pop();
24765
+ if (arr[i$1].type === "brace") break;
24766
+ if (arr[i$1].type !== "dots") range.unshift(arr[i$1].value);
24767
+ }
24768
+ output = expandRange(range, opts);
24769
+ state.backtrack = true;
24770
+ }
24771
+ if (brace.comma !== true && brace.dots !== true) {
24772
+ const out = state.output.slice(0, brace.outputIndex);
24773
+ const toks = state.tokens.slice(brace.tokensIndex);
24774
+ brace.value = brace.output = "\\{";
24775
+ value = output = "\\}";
24776
+ state.output = out;
24777
+ for (const t$5 of toks) state.output += t$5.output || t$5.value;
24778
+ }
24779
+ push({
24780
+ type: "brace",
24781
+ value,
24782
+ output
24783
+ });
24784
+ decrement("braces");
24785
+ braces.pop();
24786
+ continue;
24787
+ }
24788
+ /**
24789
+ * Pipes
24790
+ */
24791
+ if (value === "|") {
24792
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
24793
+ push({
24794
+ type: "text",
24795
+ value
24796
+ });
24797
+ continue;
24798
+ }
24799
+ /**
24800
+ * Commas
24801
+ */
24802
+ if (value === ",") {
24803
+ let output = value;
24804
+ const brace = braces[braces.length - 1];
24805
+ if (brace && stack[stack.length - 1] === "braces") {
24806
+ brace.comma = true;
24807
+ output = "|";
24808
+ }
24809
+ push({
24810
+ type: "comma",
24811
+ value,
24812
+ output
24813
+ });
24814
+ continue;
24815
+ }
24816
+ /**
24817
+ * Slashes
24818
+ */
24819
+ if (value === "/") {
24820
+ if (prev.type === "dot" && state.index === state.start + 1) {
24821
+ state.start = state.index + 1;
24822
+ state.consumed = "";
24823
+ state.output = "";
24824
+ tokens.pop();
24825
+ prev = bos;
24826
+ continue;
24827
+ }
24828
+ push({
24829
+ type: "slash",
24830
+ value,
24831
+ output: SLASH_LITERAL$1
24832
+ });
24833
+ continue;
24834
+ }
24835
+ /**
24836
+ * Dots
24837
+ */
24838
+ if (value === ".") {
24839
+ if (state.braces > 0 && prev.type === "dot") {
24840
+ if (prev.value === ".") prev.output = DOT_LITERAL$1;
24841
+ const brace = braces[braces.length - 1];
24842
+ prev.type = "dots";
24843
+ prev.output += value;
24844
+ prev.value += value;
24845
+ brace.dots = true;
24846
+ continue;
24847
+ }
24848
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
24849
+ push({
24850
+ type: "text",
24851
+ value,
24852
+ output: DOT_LITERAL$1
24853
+ });
24854
+ continue;
24855
+ }
24856
+ push({
24857
+ type: "dot",
24858
+ value,
24859
+ output: DOT_LITERAL$1
24860
+ });
24861
+ continue;
24862
+ }
24863
+ /**
24864
+ * Question marks
24865
+ */
24866
+ if (value === "?") {
24867
+ if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
24868
+ extglobOpen("qmark", value);
24869
+ continue;
24870
+ }
24871
+ if (prev && prev.type === "paren") {
24872
+ const next = peek();
24873
+ let output = value;
24874
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
24875
+ push({
24876
+ type: "text",
24877
+ value,
24878
+ output
24879
+ });
24880
+ continue;
24881
+ }
24882
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
24883
+ push({
24884
+ type: "qmark",
24885
+ value,
24886
+ output: QMARK_NO_DOT
24887
+ });
24888
+ continue;
24889
+ }
24890
+ push({
24891
+ type: "qmark",
24892
+ value,
24893
+ output: QMARK$1
24894
+ });
24895
+ continue;
24896
+ }
24897
+ /**
24898
+ * Exclamation
24899
+ */
24900
+ if (value === "!") {
24901
+ if (opts.noextglob !== true && peek() === "(") {
24902
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
24903
+ extglobOpen("negate", value);
24904
+ continue;
24905
+ }
24906
+ }
24907
+ if (opts.nonegate !== true && state.index === 0) {
24908
+ negate();
24909
+ continue;
24910
+ }
24911
+ }
24912
+ /**
24913
+ * Plus
24914
+ */
24915
+ if (value === "+") {
24916
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
24917
+ extglobOpen("plus", value);
24918
+ continue;
24919
+ }
24920
+ if (prev && prev.value === "(" || opts.regex === false) {
24921
+ push({
24922
+ type: "plus",
24923
+ value,
24924
+ output: PLUS_LITERAL$1
24925
+ });
24926
+ continue;
24927
+ }
24928
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
24929
+ push({
24930
+ type: "plus",
24931
+ value
24932
+ });
24933
+ continue;
24934
+ }
24935
+ push({
24936
+ type: "plus",
24937
+ value: PLUS_LITERAL$1
24938
+ });
24939
+ continue;
24940
+ }
24941
+ /**
24942
+ * Plain text
24943
+ */
24944
+ if (value === "@") {
24945
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
24946
+ push({
24947
+ type: "at",
24948
+ extglob: true,
24949
+ value,
24950
+ output: ""
24951
+ });
24952
+ continue;
24953
+ }
24954
+ push({
24955
+ type: "text",
24956
+ value
24957
+ });
24958
+ continue;
24959
+ }
24960
+ /**
24961
+ * Plain text
24962
+ */
24963
+ if (value !== "*") {
24964
+ if (value === "$" || value === "^") value = `\\${value}`;
24965
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
24966
+ if (match) {
24967
+ value += match[0];
24968
+ state.index += match[0].length;
24969
+ }
24970
+ push({
24971
+ type: "text",
24972
+ value
24973
+ });
24974
+ continue;
24975
+ }
24976
+ /**
24977
+ * Stars
24978
+ */
24979
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
24980
+ prev.type = "star";
24981
+ prev.star = true;
24982
+ prev.value += value;
24983
+ prev.output = star;
24984
+ state.backtrack = true;
24985
+ state.globstar = true;
24986
+ consume(value);
24987
+ continue;
24988
+ }
24989
+ let rest = remaining();
24990
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
24991
+ extglobOpen("star", value);
24992
+ continue;
24993
+ }
24994
+ if (prev.type === "star") {
24995
+ if (opts.noglobstar === true) {
24996
+ consume(value);
24997
+ continue;
24998
+ }
24999
+ const prior = prev.prev;
25000
+ const before = prior.prev;
25001
+ const isStart = prior.type === "slash" || prior.type === "bos";
25002
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
25003
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
25004
+ push({
25005
+ type: "star",
25006
+ value,
25007
+ output: ""
25008
+ });
25009
+ continue;
25010
+ }
25011
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
25012
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
25013
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
25014
+ push({
25015
+ type: "star",
25016
+ value,
25017
+ output: ""
25018
+ });
25019
+ continue;
25020
+ }
25021
+ while (rest.slice(0, 3) === "/**") {
25022
+ const after = input[state.index + 4];
25023
+ if (after && after !== "/") break;
25024
+ rest = rest.slice(3);
25025
+ consume("/**", 3);
25026
+ }
25027
+ if (prior.type === "bos" && eos()) {
25028
+ prev.type = "globstar";
25029
+ prev.value += value;
25030
+ prev.output = globstar(opts);
25031
+ state.output = prev.output;
25032
+ state.globstar = true;
25033
+ consume(value);
25034
+ continue;
25035
+ }
25036
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
25037
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
25038
+ prior.output = `(?:${prior.output}`;
25039
+ prev.type = "globstar";
25040
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
25041
+ prev.value += value;
25042
+ state.globstar = true;
25043
+ state.output += prior.output + prev.output;
25044
+ consume(value);
25045
+ continue;
25046
+ }
25047
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
25048
+ const end = rest[1] !== void 0 ? "|$" : "";
25049
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
25050
+ prior.output = `(?:${prior.output}`;
25051
+ prev.type = "globstar";
25052
+ prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
25053
+ prev.value += value;
25054
+ state.output += prior.output + prev.output;
25055
+ state.globstar = true;
25056
+ consume(value + advance());
25057
+ push({
25058
+ type: "slash",
25059
+ value: "/",
25060
+ output: ""
25061
+ });
25062
+ continue;
25063
+ }
25064
+ if (prior.type === "bos" && rest[0] === "/") {
25065
+ prev.type = "globstar";
25066
+ prev.value += value;
25067
+ prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
25068
+ state.output = prev.output;
25069
+ state.globstar = true;
25070
+ consume(value + advance());
25071
+ push({
25072
+ type: "slash",
25073
+ value: "/",
25074
+ output: ""
25075
+ });
25076
+ continue;
25077
+ }
25078
+ state.output = state.output.slice(0, -prev.output.length);
25079
+ prev.type = "globstar";
25080
+ prev.output = globstar(opts);
25081
+ prev.value += value;
25082
+ state.output += prev.output;
25083
+ state.globstar = true;
25084
+ consume(value);
25085
+ continue;
25086
+ }
25087
+ const token = {
25088
+ type: "star",
25089
+ value,
25090
+ output: star
25091
+ };
25092
+ if (opts.bash === true) {
25093
+ token.output = ".*?";
25094
+ if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
25095
+ push(token);
25096
+ continue;
25097
+ }
25098
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
25099
+ token.output = value;
25100
+ push(token);
25101
+ continue;
25102
+ }
25103
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
25104
+ if (prev.type === "dot") {
25105
+ state.output += NO_DOT_SLASH;
25106
+ prev.output += NO_DOT_SLASH;
25107
+ } else if (opts.dot === true) {
25108
+ state.output += NO_DOTS_SLASH;
25109
+ prev.output += NO_DOTS_SLASH;
25110
+ } else {
25111
+ state.output += nodot;
25112
+ prev.output += nodot;
25113
+ }
25114
+ if (peek() !== "*") {
25115
+ state.output += ONE_CHAR$1;
25116
+ prev.output += ONE_CHAR$1;
25117
+ }
25118
+ }
25119
+ push(token);
25120
+ }
25121
+ while (state.brackets > 0) {
25122
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
25123
+ state.output = utils$2.escapeLast(state.output, "[");
25124
+ decrement("brackets");
25125
+ }
25126
+ while (state.parens > 0) {
25127
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
25128
+ state.output = utils$2.escapeLast(state.output, "(");
25129
+ decrement("parens");
25130
+ }
25131
+ while (state.braces > 0) {
25132
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
25133
+ state.output = utils$2.escapeLast(state.output, "{");
25134
+ decrement("braces");
25135
+ }
25136
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
25137
+ type: "maybe_slash",
25138
+ value: "",
25139
+ output: `${SLASH_LITERAL$1}?`
25140
+ });
25141
+ if (state.backtrack === true) {
25142
+ state.output = "";
25143
+ for (const token of state.tokens) {
25144
+ state.output += token.output != null ? token.output : token.value;
25145
+ if (token.suffix) state.output += token.suffix;
25146
+ }
25147
+ }
25148
+ return state;
25149
+ };
25150
+ /**
25151
+ * Fast paths for creating regular expressions for common glob patterns.
25152
+ * This can significantly speed up processing and has very little downside
25153
+ * impact when none of the fast paths match.
25154
+ */
25155
+ parse$1.fastpaths = (input, options) => {
25156
+ const opts = { ...options };
25157
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
25158
+ const len = input.length;
25159
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
25160
+ input = REPLACEMENTS[input] || input;
25161
+ 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);
25162
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
25163
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
25164
+ const capture = opts.capture ? "" : "?:";
25165
+ const state = {
25166
+ negated: false,
25167
+ prefix: ""
25168
+ };
25169
+ let star = opts.bash === true ? ".*?" : STAR;
25170
+ if (opts.capture) star = `(${star})`;
25171
+ const globstar = (opts$1) => {
25172
+ if (opts$1.noglobstar === true) return star;
25173
+ return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
25174
+ };
25175
+ const create = (str) => {
25176
+ switch (str) {
25177
+ case "*": return `${nodot}${ONE_CHAR$1}${star}`;
25178
+ case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25179
+ case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25180
+ case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
25181
+ case "**": return nodot + globstar(opts);
25182
+ case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
25183
+ case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25184
+ case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
25185
+ default: {
25186
+ const match = /^(.*?)\.(\w+)$/.exec(str);
25187
+ if (!match) return;
25188
+ const source$1 = create(match[1]);
25189
+ if (!source$1) return;
25190
+ return source$1 + DOT_LITERAL$1 + match[2];
25191
+ }
25192
+ }
25193
+ };
25194
+ let source = create(utils$2.removePrefix(input, state));
25195
+ if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
25196
+ return source;
25197
+ };
25198
+ module.exports = parse$1;
25199
+ }) });
25200
+
25201
+ //#endregion
25202
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js
25203
+ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
25204
+ const scan = require_scan();
25205
+ const parse = require_parse();
25206
+ const utils$1 = require_utils();
25207
+ const constants = require_constants();
25208
+ const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
25209
+ /**
25210
+ * Creates a matcher function from one or more glob patterns. The
25211
+ * returned function takes a string to match as its first argument,
25212
+ * and returns true if the string is a match. The returned matcher
25213
+ * function also takes a boolean as the second argument that, when true,
25214
+ * returns an object with additional information.
25215
+ *
25216
+ * ```js
25217
+ * const picomatch = require('picomatch');
25218
+ * // picomatch(glob[, options]);
25219
+ *
25220
+ * const isMatch = picomatch('*.!(*a)');
25221
+ * console.log(isMatch('a.a')); //=> false
25222
+ * console.log(isMatch('a.b')); //=> true
25223
+ * ```
25224
+ * @name picomatch
25225
+ * @param {String|Array} `globs` One or more glob patterns.
25226
+ * @param {Object=} `options`
25227
+ * @return {Function=} Returns a matcher function.
25228
+ * @api public
25229
+ */
25230
+ const picomatch$2 = (glob, options, returnState = false) => {
25231
+ if (Array.isArray(glob)) {
25232
+ const fns = glob.map((input) => picomatch$2(input, options, returnState));
25233
+ const arrayMatcher = (str) => {
25234
+ for (const isMatch of fns) {
25235
+ const state$1 = isMatch(str);
25236
+ if (state$1) return state$1;
25237
+ }
25238
+ return false;
25239
+ };
25240
+ return arrayMatcher;
25241
+ }
25242
+ const isState = isObject(glob) && glob.tokens && glob.input;
25243
+ if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
25244
+ const opts = options || {};
25245
+ const posix$1 = opts.windows;
25246
+ const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
25247
+ const state = regex.state;
25248
+ delete regex.state;
25249
+ let isIgnored = () => false;
25250
+ if (opts.ignore) {
25251
+ const ignoreOpts = {
25252
+ ...options,
25253
+ ignore: null,
25254
+ onMatch: null,
25255
+ onResult: null
25256
+ };
25257
+ isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
25258
+ }
25259
+ const matcher = (input, returnObject = false) => {
25260
+ const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
25261
+ glob,
25262
+ posix: posix$1
25263
+ });
25264
+ const result = {
25265
+ glob,
25266
+ state,
25267
+ regex,
25268
+ posix: posix$1,
25269
+ input,
25270
+ output,
25271
+ match,
25272
+ isMatch
25273
+ };
25274
+ if (typeof opts.onResult === "function") opts.onResult(result);
25275
+ if (isMatch === false) {
25276
+ result.isMatch = false;
25277
+ return returnObject ? result : false;
25278
+ }
25279
+ if (isIgnored(input)) {
25280
+ if (typeof opts.onIgnore === "function") opts.onIgnore(result);
25281
+ result.isMatch = false;
25282
+ return returnObject ? result : false;
25283
+ }
25284
+ if (typeof opts.onMatch === "function") opts.onMatch(result);
25285
+ return returnObject ? result : true;
25286
+ };
25287
+ if (returnState) matcher.state = state;
25288
+ return matcher;
25289
+ };
25290
+ /**
25291
+ * Test `input` with the given `regex`. This is used by the main
25292
+ * `picomatch()` function to test the input string.
25293
+ *
25294
+ * ```js
25295
+ * const picomatch = require('picomatch');
25296
+ * // picomatch.test(input, regex[, options]);
25297
+ *
25298
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
25299
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
25300
+ * ```
25301
+ * @param {String} `input` String to test.
25302
+ * @param {RegExp} `regex`
25303
+ * @return {Object} Returns an object with matching info.
25304
+ * @api public
25305
+ */
25306
+ picomatch$2.test = (input, regex, options, { glob, posix: posix$1 } = {}) => {
25307
+ if (typeof input !== "string") throw new TypeError("Expected input to be a string");
25308
+ if (input === "") return {
25309
+ isMatch: false,
25310
+ output: ""
25311
+ };
25312
+ const opts = options || {};
25313
+ const format$2 = opts.format || (posix$1 ? utils$1.toPosixSlashes : null);
25314
+ let match = input === glob;
25315
+ let output = match && format$2 ? format$2(input) : input;
25316
+ if (match === false) {
25317
+ output = format$2 ? format$2(input) : input;
25318
+ match = output === glob;
25319
+ }
25320
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
25321
+ else match = regex.exec(output);
25322
+ return {
25323
+ isMatch: Boolean(match),
25324
+ match,
25325
+ output
25326
+ };
25327
+ };
25328
+ /**
25329
+ * Match the basename of a filepath.
25330
+ *
25331
+ * ```js
25332
+ * const picomatch = require('picomatch');
25333
+ * // picomatch.matchBase(input, glob[, options]);
25334
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
25335
+ * ```
25336
+ * @param {String} `input` String to test.
25337
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
25338
+ * @return {Boolean}
25339
+ * @api public
25340
+ */
25341
+ picomatch$2.matchBase = (input, glob, options) => {
25342
+ return (glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options)).test(utils$1.basename(input));
25343
+ };
25344
+ /**
25345
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
25346
+ *
25347
+ * ```js
25348
+ * const picomatch = require('picomatch');
25349
+ * // picomatch.isMatch(string, patterns[, options]);
25350
+ *
25351
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
25352
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
25353
+ * ```
25354
+ * @param {String|Array} str The string to test.
25355
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
25356
+ * @param {Object} [options] See available [options](#options).
25357
+ * @return {Boolean} Returns true if any patterns match `str`
25358
+ * @api public
25359
+ */
25360
+ picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
25361
+ /**
25362
+ * Parse a glob pattern to create the source string for a regular
25363
+ * expression.
25364
+ *
25365
+ * ```js
25366
+ * const picomatch = require('picomatch');
25367
+ * const result = picomatch.parse(pattern[, options]);
25368
+ * ```
25369
+ * @param {String} `pattern`
25370
+ * @param {Object} `options`
25371
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
25372
+ * @api public
25373
+ */
25374
+ picomatch$2.parse = (pattern, options) => {
25375
+ if (Array.isArray(pattern)) return pattern.map((p$1) => picomatch$2.parse(p$1, options));
25376
+ return parse(pattern, {
25377
+ ...options,
25378
+ fastpaths: false
25379
+ });
25380
+ };
25381
+ /**
25382
+ * Scan a glob pattern to separate the pattern into segments.
25383
+ *
25384
+ * ```js
25385
+ * const picomatch = require('picomatch');
25386
+ * // picomatch.scan(input[, options]);
25387
+ *
25388
+ * const result = picomatch.scan('!./foo/*.js');
25389
+ * console.log(result);
25390
+ * { prefix: '!./',
25391
+ * input: '!./foo/*.js',
25392
+ * start: 3,
25393
+ * base: 'foo',
25394
+ * glob: '*.js',
25395
+ * isBrace: false,
25396
+ * isBracket: false,
25397
+ * isGlob: true,
25398
+ * isExtglob: false,
25399
+ * isGlobstar: false,
25400
+ * negated: true }
25401
+ * ```
25402
+ * @param {String} `input` Glob pattern to scan.
25403
+ * @param {Object} `options`
25404
+ * @return {Object} Returns an object with
25405
+ * @api public
25406
+ */
25407
+ picomatch$2.scan = (input, options) => scan(input, options);
25408
+ /**
25409
+ * Compile a regular expression from the `state` object returned by the
25410
+ * [parse()](#parse) method.
25411
+ *
25412
+ * @param {Object} `state`
25413
+ * @param {Object} `options`
25414
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
25415
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
25416
+ * @return {RegExp}
25417
+ * @api public
25418
+ */
25419
+ picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
25420
+ if (returnOutput === true) return state.output;
25421
+ const opts = options || {};
25422
+ const prepend = opts.contains ? "" : "^";
25423
+ const append = opts.contains ? "" : "$";
25424
+ let source = `${prepend}(?:${state.output})${append}`;
25425
+ if (state && state.negated === true) source = `^(?!${source}).*$`;
25426
+ const regex = picomatch$2.toRegex(source, options);
25427
+ if (returnState === true) regex.state = state;
25428
+ return regex;
25429
+ };
25430
+ /**
25431
+ * Create a regular expression from a parsed glob pattern.
25432
+ *
25433
+ * ```js
25434
+ * const picomatch = require('picomatch');
25435
+ * const state = picomatch.parse('*.js');
25436
+ * // picomatch.compileRe(state[, options]);
25437
+ *
25438
+ * console.log(picomatch.compileRe(state));
25439
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
25440
+ * ```
25441
+ * @param {String} `state` The object returned from the `.parse` method.
25442
+ * @param {Object} `options`
25443
+ * @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.
25444
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
25445
+ * @return {RegExp} Returns a regex created from the given pattern.
25446
+ * @api public
25447
+ */
25448
+ picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
25449
+ if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
25450
+ let parsed = {
25451
+ negated: false,
25452
+ fastpaths: true
25453
+ };
25454
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
25455
+ if (!parsed.output) parsed = parse(input, options);
25456
+ return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
25457
+ };
25458
+ /**
25459
+ * Create a regular expression from the given regex source string.
25460
+ *
25461
+ * ```js
25462
+ * const picomatch = require('picomatch');
25463
+ * // picomatch.toRegex(source[, options]);
25464
+ *
25465
+ * const { output } = picomatch.parse('*.js');
25466
+ * console.log(picomatch.toRegex(output));
25467
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
25468
+ * ```
25469
+ * @param {String} `source` Regular expression source string.
25470
+ * @param {Object} `options`
25471
+ * @return {RegExp}
25472
+ * @api public
25473
+ */
25474
+ picomatch$2.toRegex = (source, options) => {
25475
+ try {
25476
+ const opts = options || {};
25477
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
25478
+ } catch (err) {
25479
+ if (options && options.debug === true) throw err;
25480
+ return /$^/;
25481
+ }
25482
+ };
25483
+ /**
25484
+ * Picomatch constants.
25485
+ * @return {Object}
25486
+ */
25487
+ picomatch$2.constants = constants;
25488
+ /**
25489
+ * Expose "picomatch"
25490
+ */
25491
+ module.exports = picomatch$2;
25492
+ }) });
25493
+
25494
+ //#endregion
25495
+ //#region ../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js
25496
+ var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js": ((exports, module) => {
25497
+ const pico = require_picomatch$1();
25498
+ const utils = require_utils();
25499
+ function picomatch$1(glob, options, returnState = false) {
25500
+ if (options && (options.windows === null || options.windows === void 0)) options = {
25501
+ ...options,
25502
+ windows: utils.isWindows()
25503
+ };
25504
+ return pico(glob, options, returnState);
25505
+ }
25506
+ Object.assign(picomatch$1, pico);
25507
+ module.exports = picomatch$1;
25508
+ }) });
25509
+
25510
+ //#endregion
25511
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/builder/index.js
25512
+ 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) => {
25513
+ Object.defineProperty(exports, "__esModule", { value: true });
25514
+ exports.Builder = void 0;
25515
+ const path_1 = __require$1("path");
25516
+ const api_builder_1 = require_api_builder();
25517
+ var pm = null;
25518
+ /* c8 ignore next 6 */
25519
+ try {
25520
+ __require$1.resolve("picomatch");
25521
+ pm = require_picomatch();
25522
+ } catch (_e) {}
25523
+ var Builder = class {
25524
+ globCache = {};
25525
+ options = {
25526
+ maxDepth: Infinity,
25527
+ suppressErrors: true,
25528
+ pathSeparator: path_1.sep,
25529
+ filters: []
25530
+ };
25531
+ globFunction;
25532
+ constructor(options) {
25533
+ this.options = {
25534
+ ...this.options,
25535
+ ...options
25536
+ };
25537
+ this.globFunction = this.options.globFunction;
25538
+ }
25539
+ group() {
25540
+ this.options.group = true;
25541
+ return this;
25542
+ }
25543
+ withPathSeparator(separator) {
25544
+ this.options.pathSeparator = separator;
25545
+ return this;
25546
+ }
25547
+ withBasePath() {
25548
+ this.options.includeBasePath = true;
25549
+ return this;
25550
+ }
25551
+ withRelativePaths() {
25552
+ this.options.relativePaths = true;
25553
+ return this;
25554
+ }
25555
+ withDirs() {
25556
+ this.options.includeDirs = true;
25557
+ return this;
25558
+ }
25559
+ withMaxDepth(depth$1) {
25560
+ this.options.maxDepth = depth$1;
25561
+ return this;
25562
+ }
25563
+ withMaxFiles(limit) {
25564
+ this.options.maxFiles = limit;
25565
+ return this;
25566
+ }
25567
+ withFullPaths() {
25568
+ this.options.resolvePaths = true;
25569
+ this.options.includeBasePath = true;
25570
+ return this;
25571
+ }
25572
+ withErrors() {
25573
+ this.options.suppressErrors = false;
25574
+ return this;
25575
+ }
25576
+ withSymlinks({ resolvePaths = true } = {}) {
25577
+ this.options.resolveSymlinks = true;
25578
+ this.options.useRealPaths = resolvePaths;
25579
+ return this.withFullPaths();
25580
+ }
25581
+ withAbortSignal(signal) {
25582
+ this.options.signal = signal;
25583
+ return this;
25584
+ }
25585
+ normalize() {
25586
+ this.options.normalizePath = true;
25587
+ return this;
25588
+ }
25589
+ filter(predicate) {
25590
+ this.options.filters.push(predicate);
25591
+ return this;
25592
+ }
25593
+ onlyDirs() {
25594
+ this.options.excludeFiles = true;
25595
+ this.options.includeDirs = true;
25596
+ return this;
25597
+ }
25598
+ exclude(predicate) {
25599
+ this.options.exclude = predicate;
25600
+ return this;
25601
+ }
25602
+ onlyCounts() {
25603
+ this.options.onlyCounts = true;
25604
+ return this;
25605
+ }
25606
+ crawl(root) {
25607
+ return new api_builder_1.APIBuilder(root || ".", this.options);
25608
+ }
25609
+ withGlobFunction(fn) {
25610
+ this.globFunction = fn;
25611
+ return this;
25612
+ }
25613
+ /**
25614
+ * @deprecated Pass options using the constructor instead:
25615
+ * ```ts
25616
+ * new fdir(options).crawl("/path/to/root");
25617
+ * ```
25618
+ * This method will be removed in v7.0
25619
+ */
25620
+ /* c8 ignore next 4 */
25621
+ crawlWithOptions(root, options) {
25622
+ this.options = {
25623
+ ...this.options,
25624
+ ...options
25625
+ };
25626
+ return new api_builder_1.APIBuilder(root || ".", this.options);
25627
+ }
25628
+ glob(...patterns) {
25629
+ if (this.globFunction) return this.globWithOptions(patterns);
25630
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
25631
+ }
25632
+ globWithOptions(patterns, ...options) {
25633
+ const globFn = this.globFunction || pm;
25634
+ /* c8 ignore next 5 */
25635
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
25636
+ var isMatch = this.globCache[patterns.join("\0")];
25637
+ if (!isMatch) {
25638
+ isMatch = globFn(patterns, ...options);
25639
+ this.globCache[patterns.join("\0")] = isMatch;
25640
+ }
25641
+ this.options.filters.push((path$1) => isMatch(path$1));
25642
+ return this;
25643
+ }
25644
+ };
25645
+ exports.Builder = Builder;
25646
+ }) });
25647
+
25648
+ //#endregion
25649
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/types.js
25650
+ var require_types = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/types.js": ((exports) => {
25651
+ Object.defineProperty(exports, "__esModule", { value: true });
25652
+ }) });
25653
+
25654
+ //#endregion
25655
+ //#region ../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/index.js
25656
+ var require_dist = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/fdir@6.4.3_picomatch@4.0.2/node_modules/fdir/dist/index.js": ((exports) => {
25657
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
25658
+ if (k2 === void 0) k2 = k;
25659
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25660
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
25661
+ enumerable: true,
25662
+ get: function() {
25663
+ return m[k];
25664
+ }
25665
+ };
25666
+ Object.defineProperty(o, k2, desc);
25667
+ }) : (function(o, m, k, k2) {
25668
+ if (k2 === void 0) k2 = k;
25669
+ o[k2] = m[k];
25670
+ }));
25671
+ var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
25672
+ for (var p$1 in m) if (p$1 !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p$1)) __createBinding(exports$1, m, p$1);
25673
+ };
25674
+ Object.defineProperty(exports, "__esModule", { value: true });
25675
+ exports.fdir = void 0;
25676
+ const builder_1 = require_builder();
25677
+ Object.defineProperty(exports, "fdir", {
25678
+ enumerable: true,
25679
+ get: function() {
25680
+ return builder_1.Builder;
25681
+ }
25682
+ });
25683
+ __exportStar(require_types(), exports);
25684
+ }) });
25685
+
25686
+ //#endregion
25687
+ //#region ../../node_modules/.pnpm/tinyglobby@0.2.12/node_modules/tinyglobby/dist/index.mjs
25688
+ var import_dist = require_dist();
25689
+ var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
25690
+ var import_picomatch$1 = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
25691
+ var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
25692
+ function getPartialMatcher(patterns, options) {
25693
+ const patternsCount = patterns.length;
25694
+ const patternsParts = Array(patternsCount);
25695
+ const regexes = Array(patternsCount);
25696
+ for (let i$1 = 0; i$1 < patternsCount; i$1++) {
25697
+ const parts = splitPattern(patterns[i$1]);
25698
+ patternsParts[i$1] = parts;
25699
+ const partsCount = parts.length;
25700
+ const partRegexes = Array(partsCount);
25701
+ for (let j = 0; j < partsCount; j++) partRegexes[j] = import_picomatch$1.default.makeRe(parts[j], options);
25702
+ regexes[i$1] = partRegexes;
25703
+ }
25704
+ return (input) => {
25705
+ const inputParts = input.split("/");
25706
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
25707
+ for (let i$1 = 0; i$1 < patterns.length; i$1++) {
25708
+ const patternParts = patternsParts[i$1];
25709
+ const regex = regexes[i$1];
25710
+ const inputPatternCount = inputParts.length;
25711
+ const minParts = Math.min(inputPatternCount, patternParts.length);
25712
+ let j = 0;
25713
+ while (j < minParts) {
25714
+ const part = patternParts[j];
25715
+ if (part.includes("/")) return true;
25716
+ if (!regex[j].test(inputParts[j])) break;
25717
+ if (part === "**") return true;
25718
+ j++;
25719
+ }
25720
+ if (j === inputPatternCount) return true;
25721
+ }
25722
+ return false;
25723
+ };
25724
+ }
25725
+ var splitPatternOptions = { parts: true };
25726
+ function splitPattern(path2) {
25727
+ var _a;
25728
+ const result = import_picomatch$1.default.scan(path2, splitPatternOptions);
25729
+ return ((_a = result.parts) == null ? void 0 : _a.length) ? result.parts : [path2];
25730
+ }
25731
+ var isWin = process.platform === "win32";
25732
+ var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
25733
+ var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
25734
+ var escapePosixPath = (path2) => path2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
25735
+ var escapeWin32Path = (path2) => path2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
25736
+ var escapePath = isWin ? escapeWin32Path : escapePosixPath;
25737
+ function isDynamicPattern(pattern, options) {
25738
+ if ((options == null ? void 0 : options.caseSensitiveMatch) === false) return true;
25739
+ const scan$2 = import_picomatch$1.default.scan(pattern);
25740
+ return scan$2.isGlob || scan$2.negated;
25741
+ }
25742
+ function log(...tasks) {
25743
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
25744
+ }
25745
+ var PARENT_DIRECTORY = /^(\/?\.\.)+/;
25746
+ var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
25747
+ var BACKSLASHES = /\\/g;
25748
+ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
25749
+ let result = pattern;
25750
+ if (pattern.endsWith("/")) result = pattern.slice(0, -1);
25751
+ if (!result.endsWith("*") && expandDirectories) result += "/**";
25752
+ if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapePath(cwd), result);
25753
+ else result = posix.normalize(result);
25754
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
25755
+ if (parentDirectoryMatch == null ? void 0 : parentDirectoryMatch[0]) {
25756
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0]);
25757
+ if (props.root.length > potentialRoot.length) {
25758
+ props.root = potentialRoot;
25759
+ props.depthOffset = -(parentDirectoryMatch[0].length + 1) / 3;
25760
+ }
25761
+ } else if (!isIgnore && props.depthOffset >= 0) {
25762
+ const parts = splitPattern(result);
25763
+ props.commonPath ??= parts;
25764
+ const newCommonPath = [];
25765
+ const length = Math.min(props.commonPath.length, parts.length);
25766
+ for (let i$1 = 0; i$1 < length; i$1++) {
25767
+ const part = parts[i$1];
25768
+ if (part === "**" && !parts[i$1 + 1]) {
25769
+ newCommonPath.pop();
25770
+ break;
25771
+ }
25772
+ if (part !== props.commonPath[i$1] || isDynamicPattern(part) || i$1 === parts.length - 1) break;
25773
+ newCommonPath.push(part);
25774
+ }
25775
+ props.depthOffset = newCommonPath.length;
25776
+ props.commonPath = newCommonPath;
25777
+ props.root = newCommonPath.length > 0 ? `${cwd}/${newCommonPath.join("/")}` : cwd;
25778
+ }
25779
+ return result;
25780
+ }
25781
+ function processPatterns({ patterns, ignore: ignore$1 = [], expandDirectories = true }, cwd, props) {
25782
+ if (typeof patterns === "string") patterns = [patterns];
25783
+ else if (!patterns) patterns = ["**/*"];
25784
+ if (typeof ignore$1 === "string") ignore$1 = [ignore$1];
25785
+ const matchPatterns = [];
25786
+ const ignorePatterns = [];
25787
+ for (const pattern of ignore$1) {
25788
+ if (!pattern) continue;
25789
+ if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
25790
+ }
25791
+ for (const pattern of patterns) {
25792
+ if (!pattern) continue;
25793
+ if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
25794
+ else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
25795
+ }
25796
+ return {
25797
+ match: matchPatterns,
25798
+ ignore: ignorePatterns
25799
+ };
25800
+ }
25801
+ function getRelativePath(path2, cwd, root) {
25802
+ return posix.relative(cwd, `${root}/${path2}`) || ".";
25803
+ }
25804
+ function processPath(path2, cwd, root, isDirectory$1, absolute) {
25805
+ const relativePath = absolute ? path2.slice(root.length + 1) || "." : path2;
25806
+ if (root === cwd) return isDirectory$1 && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
25807
+ return getRelativePath(relativePath, cwd, root);
25808
+ }
25809
+ function formatPaths(paths, cwd, root) {
25810
+ for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
25811
+ const path2 = paths[i$1];
25812
+ paths[i$1] = getRelativePath(path2, cwd, root) + (!path2 || path2.endsWith("/") ? "/" : "");
25813
+ }
25814
+ return paths;
25815
+ }
25816
+ function crawl(options, cwd, sync$1) {
25817
+ if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
25818
+ if (options.debug) log("globbing with options:", options, "cwd:", cwd);
25819
+ if (Array.isArray(options.patterns) && options.patterns.length === 0) return sync$1 ? [] : Promise.resolve([]);
25820
+ const props = {
25821
+ root: cwd,
25822
+ commonPath: null,
25823
+ depthOffset: 0
25824
+ };
25825
+ const processed = processPatterns(options, cwd, props);
25826
+ const nocase = options.caseSensitiveMatch === false;
25827
+ if (options.debug) log("internal processing patterns:", processed);
25828
+ const matcher = (0, import_picomatch.default)(processed.match, {
25829
+ dot: options.dot,
25830
+ nocase,
25831
+ ignore: processed.ignore
25832
+ });
25833
+ const ignore$1 = (0, import_picomatch.default)(processed.ignore, {
25834
+ dot: options.dot,
25835
+ nocase
25836
+ });
25837
+ const partialMatcher = getPartialMatcher(processed.match, {
25838
+ dot: options.dot,
25839
+ nocase
25840
+ });
25841
+ const fdirOptions = {
25842
+ filters: [options.debug ? (p$1, isDirectory$1) => {
25843
+ const path2 = processPath(p$1, cwd, props.root, isDirectory$1, options.absolute);
25844
+ const matches = matcher(path2);
25845
+ if (matches) log(`matched ${path2}`);
25846
+ return matches;
25847
+ } : (p$1, isDirectory$1) => matcher(processPath(p$1, cwd, props.root, isDirectory$1, options.absolute))],
25848
+ exclude: options.debug ? (_, p$1) => {
25849
+ const relativePath = processPath(p$1, cwd, props.root, true, true);
25850
+ const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
25851
+ if (skipped) log(`skipped ${p$1}`);
25852
+ else log(`crawling ${p$1}`);
25853
+ return skipped;
25854
+ } : (_, p$1) => {
25855
+ const relativePath = processPath(p$1, cwd, props.root, true, true);
25856
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
25857
+ },
25858
+ pathSeparator: "/",
25859
+ relativePaths: true,
25860
+ resolveSymlinks: true
25861
+ };
25862
+ if (options.deep) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
25863
+ if (options.absolute) {
25864
+ fdirOptions.relativePaths = false;
25865
+ fdirOptions.resolvePaths = true;
25866
+ fdirOptions.includeBasePath = true;
25867
+ }
25868
+ if (options.followSymbolicLinks === false) {
25869
+ fdirOptions.resolveSymlinks = false;
25870
+ fdirOptions.excludeSymlinks = true;
25871
+ }
25872
+ if (options.onlyDirectories) {
25873
+ fdirOptions.excludeFiles = true;
25874
+ fdirOptions.includeDirs = true;
25875
+ } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
25876
+ props.root = props.root.replace(BACKSLASHES, "");
25877
+ const root = props.root;
25878
+ if (options.debug) log("internal properties:", props);
25879
+ const api = new import_dist.fdir(fdirOptions).crawl(root);
25880
+ if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
25881
+ return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
25882
+ }
25883
+ function globSync(patternsOrOptions, options) {
25884
+ if (patternsOrOptions && (options == null ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
25885
+ const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? {
25886
+ ...options,
25887
+ patterns: patternsOrOptions
25888
+ } : patternsOrOptions;
25889
+ return crawl(opts, opts.cwd ? path.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/"), true);
25890
+ }
25891
+
22976
25892
  //#endregion
22977
25893
  //#region src/miniflare-options.ts
22978
25894
  const INTERNAL_WORKERS_COMPATIBILITY_DATE = "2024-10-04";
@@ -23137,8 +26053,10 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
23137
26053
  viteDevServer.middlewares(req, res);
23138
26054
  } } } : {},
23139
26055
  __VITE_INVOKE_MODULE__: async (request$1) => {
26056
+ const targetEnvironmentName = request$1.headers.get(ENVIRONMENT_NAME_HEADER);
26057
+ assert(targetEnvironmentName, `Expected ${ENVIRONMENT_NAME_HEADER} header`);
23140
26058
  const payload = await request$1.json();
23141
- const result = await viteDevServer.environments[environmentName].hot.handleInvoke(payload);
26059
+ const result = await viteDevServer.environments[targetEnvironmentName].hot.handleInvoke(payload);
23142
26060
  return Response$1.json(result);
23143
26061
  }
23144
26062
  },
@@ -23341,6 +26259,7 @@ function handleWebSocket(httpServer, miniflare, entryWorkerName) {
23341
26259
 
23342
26260
  //#endregion
23343
26261
  //#region src/plugins/dev.ts
26262
+ var import_picocolors$2 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
23344
26263
  let exitCallback$2 = () => {};
23345
26264
  process.on("exit", () => {
23346
26265
  exitCallback$2();
@@ -23386,7 +26305,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
23386
26305
  const oldExportTypes = ctx.workerNameToExportTypesMap.get(workerConfig.name);
23387
26306
  assert(oldExportTypes, `Expected export types for Worker "${workerConfig.name}" to be defined`);
23388
26307
  if (compareExportTypes(oldExportTypes, newExportTypes)) {
23389
- viteDevServer.config.logger.info(colors.dim(colors.yellow("Worker exports have changed. Restarting dev server.")));
26308
+ viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("Worker exports have changed. Restarting dev server.")));
23390
26309
  await viteDevServer.restart();
23391
26310
  }
23392
26311
  });
@@ -23415,7 +26334,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
23415
26334
  };
23416
26335
  }
23417
26336
  if (containerTagToOptionsMap.size) {
23418
- viteDevServer.config.logger.info(colors.dim(colors.yellow("∷ Building container images for local development...\n")));
26337
+ viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("∷ Building container images for local development...\n")));
23419
26338
  await prepareContainerImagesForDev({
23420
26339
  dockerPath: getDockerPath(),
23421
26340
  containerOptions: [...containerTagToOptionsMap.values()],
@@ -23425,7 +26344,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
23425
26344
  isVite: true
23426
26345
  });
23427
26346
  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).")));
26347
+ 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
26348
  exitCallback$2 = () => {
23430
26349
  if (containerImageTags.size) cleanupContainers(getDockerPath(), containerImageTags);
23431
26350
  };
@@ -23564,12 +26483,12 @@ const nodeJsCompatWarningsPlugin = createPlugin("nodejs-compat-warnings", (ctx)
23564
26483
  }
23565
26484
  }] } } : { esbuildOptions: { plugins: [{
23566
26485
  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);
26486
+ setup(build$8) {
26487
+ build$8.onResolve({ filter: /* @__PURE__ */ new RegExp(`^(${nonPrefixedNodeModules.join("|")}|node:.+)$`) }, ({ path: path$1, importer }) => {
26488
+ if (hasNodeJsAls(workerConfig) && isNodeAlsModule(path$1)) return;
26489
+ nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(path$1, importer);
23571
26490
  return {
23572
- path,
26491
+ path: path$1,
23573
26492
  external: true
23574
26493
  };
23575
26494
  });
@@ -23601,6 +26520,7 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
23601
26520
  return {
23602
26521
  generateBundle(_, bundle) {
23603
26522
  assertIsNotPreview(ctx);
26523
+ if (ctx.isChildEnvironment(this.environment.name)) return;
23604
26524
  let outputConfig;
23605
26525
  if (ctx.resolvedPluginConfig.type === "workers") {
23606
26526
  const inputConfig = ctx.getWorkerConfig(this.environment.name);
@@ -23666,6 +26586,7 @@ function getAssetsDirectory(workerOutputDirectory, resolvedViteConfig) {
23666
26586
 
23667
26587
  //#endregion
23668
26588
  //#region src/plugins/preview.ts
26589
+ var import_picocolors$1 = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
23669
26590
  let exitCallback = () => {};
23670
26591
  process.on("exit", () => {
23671
26592
  exitCallback();
@@ -23684,7 +26605,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
23684
26605
  await ctx.startOrUpdateMiniflare(miniflareOptions);
23685
26606
  if (containerTagToOptionsMap.size) {
23686
26607
  const dockerPath = getDockerPath();
23687
- vitePreviewServer.config.logger.info(colors.dim(colors.yellow("∷ Building container images for local preview...\n")));
26608
+ vitePreviewServer.config.logger.info(import_picocolors$1.default.dim(import_picocolors$1.default.yellow("∷ Building container images for local preview...\n")));
23688
26609
  await prepareContainerImagesForDev({
23689
26610
  dockerPath: getDockerPath(),
23690
26611
  containerOptions: [...containerTagToOptionsMap.values()],
@@ -23694,7 +26615,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
23694
26615
  isVite: true
23695
26616
  });
23696
26617
  const containerImageTags = new Set(containerTagToOptionsMap.keys());
23697
- vitePreviewServer.config.logger.info(colors.dim(colors.yellow("\n⚡️ Containers successfully built.\n")));
26618
+ vitePreviewServer.config.logger.info(import_picocolors$1.default.dim(import_picocolors$1.default.yellow("\n⚡️ Containers successfully built.\n")));
23698
26619
  exitCallback = () => {
23699
26620
  if (containerImageTags.size) cleanupContainers(dockerPath, containerImageTags);
23700
26621
  };
@@ -23708,6 +26629,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
23708
26629
 
23709
26630
  //#endregion
23710
26631
  //#region src/plugins/shortcuts.ts
26632
+ var import_picocolors = /* @__PURE__ */ __toESM$1(require_picocolors(), 1);
23711
26633
  const shortcutsPlugin = createPlugin("shortcuts", (ctx) => {
23712
26634
  const isCustomShortcutsSupported = satisfiesViteVersion("7.2.7");
23713
26635
  return {
@@ -23758,7 +26680,7 @@ function addBindingsShortcut(server, ctx) {
23758
26680
  };
23759
26681
  const bindCLIShortcuts = server.bindCLIShortcuts.bind(server);
23760
26682
  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}`));
26683
+ 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
26684
  bindCLIShortcuts(options);
23763
26685
  };
23764
26686
  server.bindCLIShortcuts({ customShortcuts: [printBindingsShortcut] });
@@ -23828,8 +26750,8 @@ function cloudflare(pluginConfig = {}) {
23828
26750
  {
23829
26751
  name: "vite-plugin-cloudflare",
23830
26752
  sharedDuringBuild: true,
23831
- config(userConfig, env) {
23832
- ctx.setResolvedPluginConfig(resolvePluginConfig(pluginConfig, userConfig, env));
26753
+ config(userConfig, env$1) {
26754
+ ctx.setResolvedPluginConfig(resolvePluginConfig(pluginConfig, userConfig, env$1));
23833
26755
  },
23834
26756
  async configureServer(viteDevServer) {
23835
26757
  const restartServer = viteDevServer.restart.bind(viteDevServer);