@cloudflare/vitest-plugin 1.1.13 → 1.2.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.
@@ -324,7 +324,7 @@ function createFatalError$1(message, isJson, options) {
324
324
  __name$3(createFatalError$1, "createFatalError");
325
325
 
326
326
  //#endregion
327
- //#region ../workers-utils/dist/chunk-JGKSDUFK.mjs
327
+ //#region ../workers-utils/dist/chunk-JTB7VJSC.mjs
328
328
  function hasKnownExportType(entry) {
329
329
  const type = entry?.type;
330
330
  return type === "durable-object" || type === "worker";
@@ -351,7 +351,6 @@ function hasDurableObjectExports(exports$1) {
351
351
  return Object.keys(getDurableObjectExports(exports$1)).length > 0;
352
352
  }
353
353
  __name$3(hasDurableObjectExports, "hasDurableObjectExports");
354
- var CONTAINER_IMAGES_BINDING = "EXPERIMENTAL_CLOUDFLARE_CONTAINER_IMAGES";
355
354
  function isDurableObjectContainerApp(container) {
356
355
  return container.scheduling_policy === "durable_object";
357
356
  }
@@ -2802,8 +2801,8 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
2802
2801
  __name$3(formatConfigSnippet, "formatConfigSnippet");
2803
2802
 
2804
2803
  //#endregion
2805
- //#region ../workers-utils/dist/chunk-S6ZAI5DC.mjs
2806
- var DEFAULT_COMPAT_DATE = "2026-09-18";
2804
+ //#region ../workers-utils/dist/chunk-4PNP2TCS.mjs
2805
+ var DEFAULT_COMPAT_DATE = "2026-09-21";
2807
2806
  function assertNever(_value) {}
2808
2807
  __name$3(assertNever, "assertNever");
2809
2808
  function mapWorkerMetadataBindings(bindings) {
@@ -26554,11 +26553,11 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
26554
26553
  var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module$1) {
26555
26554
  var exec$3 = __require("child_process").exec;
26556
26555
  var execSync$1 = __require("child_process").execSync;
26557
- var fs3 = __require("fs");
26558
- var path5 = __require("path");
26559
- var access$1 = fs3.access;
26560
- var accessSync2 = fs3.accessSync;
26561
- var constants2 = fs3.constants || fs3;
26556
+ var fs4 = __require("fs");
26557
+ var path6 = __require("path");
26558
+ var access$1 = fs4.access;
26559
+ var accessSync2 = fs4.accessSync;
26560
+ var constants2 = fs4.constants || fs4;
26562
26561
  var isUsingWindows$1 = process.platform == "win32";
26563
26562
  var fileNotExists$1 = /* @__PURE__ */ __name$3(function(commandName, callback) {
26564
26563
  access$1(commandName, constants2.F_OK, function(err) {
@@ -26632,8 +26631,8 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
26632
26631
  }, "cleanInput");
26633
26632
  if (isUsingWindows$1) cleanInput$1 = /* @__PURE__ */ __name$3(function(s) {
26634
26633
  if (/[\\]/.test(s)) {
26635
- var dirname4 = "\"" + path5.dirname(s) + "\"";
26636
- var basename2 = "\"" + path5.basename(s) + "\"";
26634
+ var dirname4 = "\"" + path6.dirname(s) + "\"";
26635
+ var basename2 = "\"" + path6.basename(s) + "\"";
26637
26636
  return dirname4 + ":" + basename2;
26638
26637
  }
26639
26638
  return "\"" + s + "\"";
@@ -26854,9 +26853,9 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
26854
26853
  };
26855
26854
  } });
26856
26855
  var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
26857
- var fs3 = __require("fs");
26856
+ var fs4 = __require("fs");
26858
26857
  var ini = require_ini();
26859
- var path5 = __require("path");
26858
+ var path6 = __require("path");
26860
26859
  var stripJsonComments = require_strip_json_comments();
26861
26860
  var parse3$1 = exports$1.parse = function(content) {
26862
26861
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
@@ -26867,9 +26866,9 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
26867
26866
  return arg != null;
26868
26867
  });
26869
26868
  for (var i in args) if ("string" !== typeof args[i]) return;
26870
- var file3 = path5.join.apply(null, args);
26869
+ var file3 = path6.join.apply(null, args);
26871
26870
  try {
26872
- return fs3.readFileSync(file3, "utf-8");
26871
+ return fs4.readFileSync(file3, "utf-8");
26873
26872
  } catch (err) {
26874
26873
  return;
26875
26874
  }
@@ -26897,14 +26896,14 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
26897
26896
  return obj;
26898
26897
  };
26899
26898
  exports$1.find = function() {
26900
- var rel = path5.join.apply(null, [].slice.call(arguments));
26899
+ var rel = path6.join.apply(null, [].slice.call(arguments));
26901
26900
  function find2(start, rel2) {
26902
- var file3 = path5.join(start, rel2);
26901
+ var file3 = path6.join(start, rel2);
26903
26902
  try {
26904
- fs3.statSync(file3);
26903
+ fs4.statSync(file3);
26905
26904
  return file3;
26906
26905
  } catch (err) {
26907
- if (path5.dirname(start) !== start) return find2(path5.dirname(start), rel2);
26906
+ if (path6.dirname(start) !== start) return find2(path6.dirname(start), rel2);
26908
26907
  }
26909
26908
  }
26910
26909
  __name$3(find2, "find");
@@ -27294,8 +27293,8 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
27294
27293
  };
27295
27294
  }
27296
27295
  __name$3(getLegacyAuthInfo, "getLegacyAuthInfo");
27297
- function normalizePath$1(path5) {
27298
- return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
27296
+ function normalizePath$1(path6) {
27297
+ return path6[path6.length - 1] === "/" ? path6 : path6 + "/";
27299
27298
  }
27300
27299
  __name$3(normalizePath$1, "normalizePath");
27301
27300
  function getAuthInfoForUrl(regUrl, npmrc) {
@@ -27332,24 +27331,24 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
27332
27331
  var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
27333
27332
  var { URL: URL2 } = __require("url");
27334
27333
  var { join: join3 } = __require("path");
27335
- var fs3 = __require("fs");
27334
+ var fs4 = __require("fs");
27336
27335
  var { promisify: promisify$3 } = __require("util");
27337
27336
  var { tmpdir } = __require("os");
27338
27337
  var registryUrl = require_registry_url();
27339
- var writeFile$1 = promisify$3(fs3.writeFile);
27340
- var mkdir$1 = promisify$3(fs3.mkdir);
27341
- var readFile$1 = promisify$3(fs3.readFile);
27338
+ var writeFile$1 = promisify$3(fs4.writeFile);
27339
+ var mkdir$1 = promisify$3(fs4.mkdir);
27340
+ var readFile$1 = promisify$3(fs4.readFile);
27342
27341
  var compareVersions = /* @__PURE__ */ __name$3((a, b) => a.localeCompare(b, "en-US", { numeric: true }), "compareVersions");
27343
27342
  var encode3 = /* @__PURE__ */ __name$3((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
27344
27343
  var getFile = /* @__PURE__ */ __name$3(async (details, distTag) => {
27345
27344
  const subDir = join3(tmpdir(), "update-check");
27346
- if (!fs3.existsSync(subDir)) await mkdir$1(subDir);
27345
+ if (!fs4.existsSync(subDir)) await mkdir$1(subDir);
27347
27346
  let name = `${details.name}-${distTag}.json`;
27348
27347
  if (details.scope) name = `${details.scope}-${name}`;
27349
27348
  return join3(subDir, name);
27350
27349
  }, "getFile");
27351
27350
  var evaluateCache = /* @__PURE__ */ __name$3(async (file2, time3, interval) => {
27352
- if (fs3.existsSync(file2)) {
27351
+ if (fs4.existsSync(file2)) {
27353
27352
  const content = await readFile$1(file2, "utf8");
27354
27353
  const { lastUpdate, latest } = JSON.parse(content);
27355
27354
  if (lastUpdate + interval > time3) return {
@@ -27451,6 +27450,700 @@ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check
27451
27450
  return null;
27452
27451
  };
27453
27452
  } });
27453
+ var require_path = __commonJS$1({ "../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js"(exports$1, module$1) {
27454
+ module$1.exports = typeof process === "object" && process && process.platform === "win32" ? { sep: "\\" } : { sep: "/" };
27455
+ } });
27456
+ var require_balanced_match = __commonJS$1({ "../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports$1, module$1) {
27457
+ module$1.exports = balanced;
27458
+ function balanced(a, b, str) {
27459
+ if (a instanceof RegExp) a = maybeMatch(a, str);
27460
+ if (b instanceof RegExp) b = maybeMatch(b, str);
27461
+ var r2 = range(a, b, str);
27462
+ return r2 && {
27463
+ start: r2[0],
27464
+ end: r2[1],
27465
+ pre: str.slice(0, r2[0]),
27466
+ body: str.slice(r2[0] + a.length, r2[1]),
27467
+ post: str.slice(r2[1] + b.length)
27468
+ };
27469
+ }
27470
+ __name$3(balanced, "balanced");
27471
+ function maybeMatch(reg, str) {
27472
+ var m = str.match(reg);
27473
+ return m ? m[0] : null;
27474
+ }
27475
+ __name$3(maybeMatch, "maybeMatch");
27476
+ balanced.range = range;
27477
+ function range(a, b, str) {
27478
+ var begs, beg, left, right, result;
27479
+ var ai = str.indexOf(a);
27480
+ var bi = str.indexOf(b, ai + 1);
27481
+ var i = ai;
27482
+ if (ai >= 0 && bi > 0) {
27483
+ if (a === b) return [ai, bi];
27484
+ begs = [];
27485
+ left = str.length;
27486
+ while (i >= 0 && !result) {
27487
+ if (i == ai) {
27488
+ begs.push(i);
27489
+ ai = str.indexOf(a, i + 1);
27490
+ } else if (begs.length == 1) result = [begs.pop(), bi];
27491
+ else {
27492
+ beg = begs.pop();
27493
+ if (beg < left) {
27494
+ left = beg;
27495
+ right = bi;
27496
+ }
27497
+ bi = str.indexOf(b, i + 1);
27498
+ }
27499
+ i = ai < bi && ai >= 0 ? ai : bi;
27500
+ }
27501
+ if (begs.length) result = [left, right];
27502
+ }
27503
+ return result;
27504
+ }
27505
+ __name$3(range, "range");
27506
+ } });
27507
+ var require_brace_expansion = __commonJS$1({ "../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports$1, module$1) {
27508
+ var balanced = require_balanced_match();
27509
+ module$1.exports = expandTop;
27510
+ var escSlash = "\0SLASH" + Math.random() + "\0";
27511
+ var escOpen = "\0OPEN" + Math.random() + "\0";
27512
+ var escClose = "\0CLOSE" + Math.random() + "\0";
27513
+ var escComma = "\0COMMA" + Math.random() + "\0";
27514
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
27515
+ function numeric$1(str) {
27516
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
27517
+ }
27518
+ __name$3(numeric$1, "numeric");
27519
+ function escapeBraces(str) {
27520
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
27521
+ }
27522
+ __name$3(escapeBraces, "escapeBraces");
27523
+ function unescapeBraces(str) {
27524
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
27525
+ }
27526
+ __name$3(unescapeBraces, "unescapeBraces");
27527
+ function parseCommaParts(str) {
27528
+ if (!str) return [""];
27529
+ var parts = [];
27530
+ var m = balanced("{", "}", str);
27531
+ if (!m) return str.split(",");
27532
+ var pre = m.pre;
27533
+ var body = m.body;
27534
+ var post = m.post;
27535
+ var p$1 = pre.split(",");
27536
+ p$1[p$1.length - 1] += "{" + body + "}";
27537
+ var postParts = parseCommaParts(post);
27538
+ if (post.length) {
27539
+ p$1[p$1.length - 1] += postParts.shift();
27540
+ p$1.push.apply(p$1, postParts);
27541
+ }
27542
+ parts.push.apply(parts, p$1);
27543
+ return parts;
27544
+ }
27545
+ __name$3(parseCommaParts, "parseCommaParts");
27546
+ function expandTop(str) {
27547
+ if (!str) return [];
27548
+ if (str.substr(0, 2) === "{}") str = "\\{\\}" + str.substr(2);
27549
+ return expand(escapeBraces(str), true).map(unescapeBraces);
27550
+ }
27551
+ __name$3(expandTop, "expandTop");
27552
+ function embrace(str) {
27553
+ return "{" + str + "}";
27554
+ }
27555
+ __name$3(embrace, "embrace");
27556
+ function isPadded(el) {
27557
+ return /^-?0\d/.test(el);
27558
+ }
27559
+ __name$3(isPadded, "isPadded");
27560
+ function lte$2(i, y) {
27561
+ return i <= y;
27562
+ }
27563
+ __name$3(lte$2, "lte");
27564
+ function gte$2(i, y) {
27565
+ return i >= y;
27566
+ }
27567
+ __name$3(gte$2, "gte");
27568
+ function expand(str, isTop) {
27569
+ var expansions = [];
27570
+ var m = balanced("{", "}", str);
27571
+ if (!m) return [str];
27572
+ var pre = m.pre;
27573
+ var post = m.post.length ? expand(m.post, false) : [""];
27574
+ if (/\$$/.test(m.pre)) for (var k = 0; k < post.length; k++) {
27575
+ var expansion = pre + "{" + m.body + "}" + post[k];
27576
+ expansions.push(expansion);
27577
+ }
27578
+ else {
27579
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
27580
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
27581
+ var isSequence = isNumericSequence || isAlphaSequence;
27582
+ var isOptions = m.body.indexOf(",") >= 0;
27583
+ if (!isSequence && !isOptions) {
27584
+ if (m.post.match(/,.*\}/)) {
27585
+ str = m.pre + "{" + m.body + escClose + m.post;
27586
+ return expand(str);
27587
+ }
27588
+ return [str];
27589
+ }
27590
+ var n2;
27591
+ if (isSequence) n2 = m.body.split(/\.\./);
27592
+ else {
27593
+ n2 = parseCommaParts(m.body);
27594
+ if (n2.length === 1) {
27595
+ n2 = expand(n2[0], false).map(embrace);
27596
+ if (n2.length === 1) return post.map(function(p$1) {
27597
+ return m.pre + n2[0] + p$1;
27598
+ });
27599
+ }
27600
+ }
27601
+ var N;
27602
+ if (isSequence) {
27603
+ var x = numeric$1(n2[0]);
27604
+ var y = numeric$1(n2[1]);
27605
+ var width = Math.max(n2[0].length, n2[1].length);
27606
+ var incr = n2.length == 3 ? Math.abs(numeric$1(n2[2])) : 1;
27607
+ var test = lte$2;
27608
+ if (y < x) {
27609
+ incr *= -1;
27610
+ test = gte$2;
27611
+ }
27612
+ var pad = n2.some(isPadded);
27613
+ N = [];
27614
+ for (var i = x; test(i, y); i += incr) {
27615
+ var c$1;
27616
+ if (isAlphaSequence) {
27617
+ c$1 = String.fromCharCode(i);
27618
+ if (c$1 === "\\") c$1 = "";
27619
+ } else {
27620
+ c$1 = String(i);
27621
+ if (pad) {
27622
+ var need = width - c$1.length;
27623
+ if (need > 0) {
27624
+ var z2 = new Array(need + 1).join("0");
27625
+ if (i < 0) c$1 = "-" + z2 + c$1.slice(1);
27626
+ else c$1 = z2 + c$1;
27627
+ }
27628
+ }
27629
+ }
27630
+ N.push(c$1);
27631
+ }
27632
+ } else {
27633
+ N = [];
27634
+ for (var j$1 = 0; j$1 < n2.length; j$1++) N.push.apply(N, expand(n2[j$1], false));
27635
+ }
27636
+ for (var j$1 = 0; j$1 < N.length; j$1++) for (var k = 0; k < post.length; k++) {
27637
+ var expansion = pre + N[j$1] + post[k];
27638
+ if (!isTop || isSequence || expansion) expansions.push(expansion);
27639
+ }
27640
+ }
27641
+ return expansions;
27642
+ }
27643
+ __name$3(expand, "expand");
27644
+ } });
27645
+ var require_minimatch = __commonJS$1({ "../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js"(exports$1, module$1) {
27646
+ var minimatch = module$1.exports = (p$1, pattern, options = {}) => {
27647
+ assertValidPattern(pattern);
27648
+ if (!options.nocomment && pattern.charAt(0) === "#") return false;
27649
+ return new Minimatch2(pattern, options).match(p$1);
27650
+ };
27651
+ module$1.exports = minimatch;
27652
+ var path6 = require_path();
27653
+ minimatch.sep = path6.sep;
27654
+ var GLOBSTAR = Symbol("globstar **");
27655
+ minimatch.GLOBSTAR = GLOBSTAR;
27656
+ var expand = require_brace_expansion();
27657
+ var plTypes = {
27658
+ "!": {
27659
+ open: "(?:(?!(?:",
27660
+ close: "))[^/]*?)"
27661
+ },
27662
+ "?": {
27663
+ open: "(?:",
27664
+ close: ")?"
27665
+ },
27666
+ "+": {
27667
+ open: "(?:",
27668
+ close: ")+"
27669
+ },
27670
+ "*": {
27671
+ open: "(?:",
27672
+ close: ")*"
27673
+ },
27674
+ "@": {
27675
+ open: "(?:",
27676
+ close: ")"
27677
+ }
27678
+ };
27679
+ var qmark = "[^/]";
27680
+ var star = qmark + "*?";
27681
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
27682
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
27683
+ var charSet = /* @__PURE__ */ __name$3((s) => s.split("").reduce((set2, c$1) => {
27684
+ set2[c$1] = true;
27685
+ return set2;
27686
+ }, {}), "charSet");
27687
+ var reSpecials = charSet("().*{}+?[]^$\\!");
27688
+ var addPatternStartSet = charSet("[.(");
27689
+ var slashSplit = /\/+/;
27690
+ minimatch.filter = (pattern, options = {}) => (p$1, i, list) => minimatch(p$1, pattern, options);
27691
+ var ext = /* @__PURE__ */ __name$3((a, b = {}) => {
27692
+ const t2 = {};
27693
+ Object.keys(a).forEach((k) => t2[k] = a[k]);
27694
+ Object.keys(b).forEach((k) => t2[k] = b[k]);
27695
+ return t2;
27696
+ }, "ext");
27697
+ minimatch.defaults = (def) => {
27698
+ if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
27699
+ const orig = minimatch;
27700
+ const m = /* @__PURE__ */ __name$3((p$1, pattern, options) => orig(p$1, pattern, ext(def, options)), "m");
27701
+ m.Minimatch = class Minimatch extends orig.Minimatch {
27702
+ static {
27703
+ __name$3(this, "Minimatch");
27704
+ }
27705
+ constructor(pattern, options) {
27706
+ super(pattern, ext(def, options));
27707
+ }
27708
+ };
27709
+ m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
27710
+ m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
27711
+ m.defaults = (options) => orig.defaults(ext(def, options));
27712
+ m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
27713
+ m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
27714
+ m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
27715
+ return m;
27716
+ };
27717
+ minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
27718
+ var braceExpand = /* @__PURE__ */ __name$3((pattern, options = {}) => {
27719
+ assertValidPattern(pattern);
27720
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
27721
+ return expand(pattern);
27722
+ }, "braceExpand");
27723
+ var MAX_PATTERN_LENGTH = 1024 * 64;
27724
+ var assertValidPattern = /* @__PURE__ */ __name$3((pattern) => {
27725
+ if (typeof pattern !== "string") throw new TypeError("invalid pattern");
27726
+ if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
27727
+ }, "assertValidPattern");
27728
+ var SUBPARSE = Symbol("subparse");
27729
+ minimatch.makeRe = (pattern, options) => new Minimatch2(pattern, options || {}).makeRe();
27730
+ minimatch.match = (list, pattern, options = {}) => {
27731
+ const mm = new Minimatch2(pattern, options);
27732
+ list = list.filter((f) => mm.match(f));
27733
+ if (mm.options.nonull && !list.length) list.push(pattern);
27734
+ return list;
27735
+ };
27736
+ var globUnescape = /* @__PURE__ */ __name$3((s) => s.replace(/\\(.)/g, "$1"), "globUnescape");
27737
+ var charUnescape = /* @__PURE__ */ __name$3((s) => s.replace(/\\([^-\]])/g, "$1"), "charUnescape");
27738
+ var regExpEscape = /* @__PURE__ */ __name$3((s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "regExpEscape");
27739
+ var braExpEscape = /* @__PURE__ */ __name$3((s) => s.replace(/[[\]\\]/g, "\\$&"), "braExpEscape");
27740
+ var Minimatch2 = class {
27741
+ static {
27742
+ __name$3(this, "Minimatch");
27743
+ }
27744
+ constructor(pattern, options) {
27745
+ assertValidPattern(pattern);
27746
+ if (!options) options = {};
27747
+ this.options = options;
27748
+ this.set = [];
27749
+ this.pattern = pattern;
27750
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
27751
+ if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
27752
+ this.regexp = null;
27753
+ this.negate = false;
27754
+ this.comment = false;
27755
+ this.empty = false;
27756
+ this.partial = !!options.partial;
27757
+ this.make();
27758
+ }
27759
+ debug() {}
27760
+ make() {
27761
+ const pattern = this.pattern;
27762
+ const options = this.options;
27763
+ if (!options.nocomment && pattern.charAt(0) === "#") {
27764
+ this.comment = true;
27765
+ return;
27766
+ }
27767
+ if (!pattern) {
27768
+ this.empty = true;
27769
+ return;
27770
+ }
27771
+ this.parseNegate();
27772
+ let set2 = this.globSet = this.braceExpand();
27773
+ if (options.debug) this.debug = (...args) => console.error(...args);
27774
+ this.debug(this.pattern, set2);
27775
+ set2 = this.globParts = set2.map((s) => s.split(slashSplit));
27776
+ this.debug(this.pattern, set2);
27777
+ set2 = set2.map((s, si, set3) => s.map(this.parse, this));
27778
+ this.debug(this.pattern, set2);
27779
+ set2 = set2.filter((s) => s.indexOf(false) === -1);
27780
+ this.debug(this.pattern, set2);
27781
+ this.set = set2;
27782
+ }
27783
+ parseNegate() {
27784
+ if (this.options.nonegate) return;
27785
+ const pattern = this.pattern;
27786
+ let negate = false;
27787
+ let negateOffset = 0;
27788
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
27789
+ negate = !negate;
27790
+ negateOffset++;
27791
+ }
27792
+ if (negateOffset) this.pattern = pattern.slice(negateOffset);
27793
+ this.negate = negate;
27794
+ }
27795
+ matchOne(file2, pattern, partial2) {
27796
+ var options = this.options;
27797
+ this.debug("matchOne", {
27798
+ "this": this,
27799
+ file: file2,
27800
+ pattern
27801
+ });
27802
+ this.debug("matchOne", file2.length, pattern.length);
27803
+ for (var fi = 0, pi = 0, fl = file2.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
27804
+ this.debug("matchOne loop");
27805
+ var p$1 = pattern[pi];
27806
+ var f = file2[fi];
27807
+ this.debug(pattern, p$1, f);
27808
+ if (p$1 === false) return false;
27809
+ if (p$1 === GLOBSTAR) {
27810
+ this.debug("GLOBSTAR", [
27811
+ pattern,
27812
+ p$1,
27813
+ f
27814
+ ]);
27815
+ var fr = fi;
27816
+ var pr = pi + 1;
27817
+ if (pr === pl) {
27818
+ this.debug("** at the end");
27819
+ for (; fi < fl; fi++) if (file2[fi] === "." || file2[fi] === ".." || !options.dot && file2[fi].charAt(0) === ".") return false;
27820
+ return true;
27821
+ }
27822
+ while (fr < fl) {
27823
+ var swallowee = file2[fr];
27824
+ this.debug("\nglobstar while", file2, fr, pattern, pr, swallowee);
27825
+ if (this.matchOne(file2.slice(fr), pattern.slice(pr), partial2)) {
27826
+ this.debug("globstar found match!", fr, fl, swallowee);
27827
+ return true;
27828
+ } else {
27829
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
27830
+ this.debug("dot detected!", file2, fr, pattern, pr);
27831
+ break;
27832
+ }
27833
+ this.debug("globstar swallow a segment, and continue");
27834
+ fr++;
27835
+ }
27836
+ }
27837
+ if (partial2) {
27838
+ this.debug("\n>>> no match, partial?", file2, fr, pattern, pr);
27839
+ if (fr === fl) return true;
27840
+ }
27841
+ return false;
27842
+ }
27843
+ var hit;
27844
+ if (typeof p$1 === "string") {
27845
+ hit = f === p$1;
27846
+ this.debug("string match", p$1, f, hit);
27847
+ } else {
27848
+ hit = f.match(p$1);
27849
+ this.debug("pattern match", p$1, f, hit);
27850
+ }
27851
+ if (!hit) return false;
27852
+ }
27853
+ if (fi === fl && pi === pl) return true;
27854
+ else if (fi === fl) return partial2;
27855
+ else if (pi === pl) return fi === fl - 1 && file2[fi] === "";
27856
+ throw new Error("wtf?");
27857
+ }
27858
+ braceExpand() {
27859
+ return braceExpand(this.pattern, this.options);
27860
+ }
27861
+ parse(pattern, isSub) {
27862
+ assertValidPattern(pattern);
27863
+ const options = this.options;
27864
+ if (pattern === "**") if (!options.noglobstar) return GLOBSTAR;
27865
+ else pattern = "*";
27866
+ if (pattern === "") return "";
27867
+ let re$4 = "";
27868
+ let hasMagic = false;
27869
+ let escaping = false;
27870
+ const patternListStack = [];
27871
+ const negativeLists = [];
27872
+ let stateChar;
27873
+ let inClass = false;
27874
+ let reClassStart = -1;
27875
+ let classStart = -1;
27876
+ let cs;
27877
+ let pl;
27878
+ let sp;
27879
+ let dotTravAllowed = pattern.charAt(0) === ".";
27880
+ let dotFileAllowed = options.dot || dotTravAllowed;
27881
+ const patternStart = /* @__PURE__ */ __name$3(() => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)", "patternStart");
27882
+ const subPatternStart = /* @__PURE__ */ __name$3((p$1) => p$1.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)", "subPatternStart");
27883
+ const clearStateChar = /* @__PURE__ */ __name$3(() => {
27884
+ if (stateChar) {
27885
+ switch (stateChar) {
27886
+ case "*":
27887
+ re$4 += star;
27888
+ hasMagic = true;
27889
+ break;
27890
+ case "?":
27891
+ re$4 += qmark;
27892
+ hasMagic = true;
27893
+ break;
27894
+ default:
27895
+ re$4 += "\\" + stateChar;
27896
+ break;
27897
+ }
27898
+ this.debug("clearStateChar %j %j", stateChar, re$4);
27899
+ stateChar = false;
27900
+ }
27901
+ }, "clearStateChar");
27902
+ for (let i = 0, c$1; i < pattern.length && (c$1 = pattern.charAt(i)); i++) {
27903
+ this.debug("%s %s %s %j", pattern, i, re$4, c$1);
27904
+ if (escaping) {
27905
+ if (c$1 === "/") return false;
27906
+ if (reSpecials[c$1]) re$4 += "\\";
27907
+ re$4 += c$1;
27908
+ escaping = false;
27909
+ continue;
27910
+ }
27911
+ switch (c$1) {
27912
+ case "/": return false;
27913
+ case "\\":
27914
+ if (inClass && pattern.charAt(i + 1) === "-") {
27915
+ re$4 += c$1;
27916
+ continue;
27917
+ }
27918
+ clearStateChar();
27919
+ escaping = true;
27920
+ continue;
27921
+ case "?":
27922
+ case "*":
27923
+ case "+":
27924
+ case "@":
27925
+ case "!":
27926
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re$4, c$1);
27927
+ if (inClass) {
27928
+ this.debug(" in class");
27929
+ if (c$1 === "!" && i === classStart + 1) c$1 = "^";
27930
+ re$4 += c$1;
27931
+ continue;
27932
+ }
27933
+ this.debug("call clearStateChar %j", stateChar);
27934
+ clearStateChar();
27935
+ stateChar = c$1;
27936
+ if (options.noext) clearStateChar();
27937
+ continue;
27938
+ case "(": {
27939
+ if (inClass) {
27940
+ re$4 += "(";
27941
+ continue;
27942
+ }
27943
+ if (!stateChar) {
27944
+ re$4 += "\\(";
27945
+ continue;
27946
+ }
27947
+ const plEntry = {
27948
+ type: stateChar,
27949
+ start: i - 1,
27950
+ reStart: re$4.length,
27951
+ open: plTypes[stateChar].open,
27952
+ close: plTypes[stateChar].close
27953
+ };
27954
+ this.debug(this.pattern, " ", plEntry);
27955
+ patternListStack.push(plEntry);
27956
+ re$4 += plEntry.open;
27957
+ if (plEntry.start === 0 && plEntry.type !== "!") {
27958
+ dotTravAllowed = true;
27959
+ re$4 += subPatternStart(pattern.slice(i + 1));
27960
+ }
27961
+ this.debug("plType %j %j", stateChar, re$4);
27962
+ stateChar = false;
27963
+ continue;
27964
+ }
27965
+ case ")": {
27966
+ const plEntry = patternListStack[patternListStack.length - 1];
27967
+ if (inClass || !plEntry) {
27968
+ re$4 += "\\)";
27969
+ continue;
27970
+ }
27971
+ patternListStack.pop();
27972
+ clearStateChar();
27973
+ hasMagic = true;
27974
+ pl = plEntry;
27975
+ re$4 += pl.close;
27976
+ if (pl.type === "!") negativeLists.push(Object.assign(pl, { reEnd: re$4.length }));
27977
+ continue;
27978
+ }
27979
+ case "|": {
27980
+ const plEntry = patternListStack[patternListStack.length - 1];
27981
+ if (inClass || !plEntry) {
27982
+ re$4 += "\\|";
27983
+ continue;
27984
+ }
27985
+ clearStateChar();
27986
+ re$4 += "|";
27987
+ if (plEntry.start === 0 && plEntry.type !== "!") {
27988
+ dotTravAllowed = true;
27989
+ re$4 += subPatternStart(pattern.slice(i + 1));
27990
+ }
27991
+ continue;
27992
+ }
27993
+ case "[":
27994
+ clearStateChar();
27995
+ if (inClass) {
27996
+ re$4 += "\\" + c$1;
27997
+ continue;
27998
+ }
27999
+ inClass = true;
28000
+ classStart = i;
28001
+ reClassStart = re$4.length;
28002
+ re$4 += c$1;
28003
+ continue;
28004
+ case "]":
28005
+ if (i === classStart + 1 || !inClass) {
28006
+ re$4 += "\\" + c$1;
28007
+ continue;
28008
+ }
28009
+ cs = pattern.substring(classStart + 1, i);
28010
+ try {
28011
+ RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
28012
+ re$4 += c$1;
28013
+ } catch (er) {
28014
+ re$4 = re$4.substring(0, reClassStart) + "(?:$.)";
28015
+ }
28016
+ hasMagic = true;
28017
+ inClass = false;
28018
+ continue;
28019
+ default:
28020
+ clearStateChar();
28021
+ if (reSpecials[c$1] && !(c$1 === "^" && inClass)) re$4 += "\\";
28022
+ re$4 += c$1;
28023
+ break;
28024
+ }
28025
+ }
28026
+ if (inClass) {
28027
+ cs = pattern.slice(classStart + 1);
28028
+ sp = this.parse(cs, SUBPARSE);
28029
+ re$4 = re$4.substring(0, reClassStart) + "\\[" + sp[0];
28030
+ hasMagic = hasMagic || sp[1];
28031
+ }
28032
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
28033
+ let tail$1;
28034
+ tail$1 = re$4.slice(pl.reStart + pl.open.length);
28035
+ this.debug("setting tail", re$4, pl);
28036
+ tail$1 = tail$1.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
28037
+ if (!$2) $2 = "\\";
28038
+ return $1 + $1 + $2 + "|";
28039
+ });
28040
+ this.debug("tail=%j\n %s", tail$1, tail$1, pl, re$4);
28041
+ const t2 = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
28042
+ hasMagic = true;
28043
+ re$4 = re$4.slice(0, pl.reStart) + t2 + "\\(" + tail$1;
28044
+ }
28045
+ clearStateChar();
28046
+ if (escaping) re$4 += "\\\\";
28047
+ const addPatternStart = addPatternStartSet[re$4.charAt(0)];
28048
+ for (let n2 = negativeLists.length - 1; n2 > -1; n2--) {
28049
+ const nl = negativeLists[n2];
28050
+ const nlBefore = re$4.slice(0, nl.reStart);
28051
+ const nlFirst = re$4.slice(nl.reStart, nl.reEnd - 8);
28052
+ let nlAfter = re$4.slice(nl.reEnd);
28053
+ const nlLast = re$4.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
28054
+ const closeParensBefore = nlBefore.split(")").length;
28055
+ const openParensBefore = nlBefore.split("(").length - closeParensBefore;
28056
+ let cleanAfter = nlAfter;
28057
+ for (let i = 0; i < openParensBefore; i++) cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
28058
+ nlAfter = cleanAfter;
28059
+ const dollar = nlAfter === "" && isSub !== SUBPARSE ? "(?:$|\\/)" : "";
28060
+ re$4 = nlBefore + nlFirst + nlAfter + dollar + nlLast;
28061
+ }
28062
+ if (re$4 !== "" && hasMagic) re$4 = "(?=.)" + re$4;
28063
+ if (addPatternStart) re$4 = patternStart() + re$4;
28064
+ if (isSub === SUBPARSE) return [re$4, hasMagic];
28065
+ if (options.nocase && !hasMagic) hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
28066
+ if (!hasMagic) return globUnescape(pattern);
28067
+ const flags = options.nocase ? "i" : "";
28068
+ try {
28069
+ return Object.assign(new RegExp("^" + re$4 + "$", flags), {
28070
+ _glob: pattern,
28071
+ _src: re$4
28072
+ });
28073
+ } catch (er) {
28074
+ return /* @__PURE__ */ new RegExp("$.");
28075
+ }
28076
+ }
28077
+ makeRe() {
28078
+ if (this.regexp || this.regexp === false) return this.regexp;
28079
+ const set2 = this.set;
28080
+ if (!set2.length) {
28081
+ this.regexp = false;
28082
+ return this.regexp;
28083
+ }
28084
+ const options = this.options;
28085
+ const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
28086
+ const flags = options.nocase ? "i" : "";
28087
+ let re$4 = set2.map((pattern) => {
28088
+ pattern = pattern.map((p$1) => typeof p$1 === "string" ? regExpEscape(p$1) : p$1 === GLOBSTAR ? GLOBSTAR : p$1._src).reduce((set3, p$1) => {
28089
+ if (!(set3[set3.length - 1] === GLOBSTAR && p$1 === GLOBSTAR)) set3.push(p$1);
28090
+ return set3;
28091
+ }, []);
28092
+ pattern.forEach((p$1, i) => {
28093
+ if (p$1 !== GLOBSTAR || pattern[i - 1] === GLOBSTAR) return;
28094
+ if (i === 0) if (pattern.length > 1) pattern[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i + 1];
28095
+ else pattern[i] = twoStar;
28096
+ else if (i === pattern.length - 1) pattern[i - 1] += "(?:\\/|" + twoStar + ")?";
28097
+ else {
28098
+ pattern[i - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i + 1];
28099
+ pattern[i + 1] = GLOBSTAR;
28100
+ }
28101
+ });
28102
+ return pattern.filter((p$1) => p$1 !== GLOBSTAR).join("/");
28103
+ }).join("|");
28104
+ re$4 = "^(?:" + re$4 + ")$";
28105
+ if (this.negate) re$4 = "^(?!" + re$4 + ").*$";
28106
+ try {
28107
+ this.regexp = new RegExp(re$4, flags);
28108
+ } catch (ex) {
28109
+ this.regexp = false;
28110
+ }
28111
+ return this.regexp;
28112
+ }
28113
+ match(f, partial2 = this.partial) {
28114
+ this.debug("match", f, this.pattern);
28115
+ if (this.comment) return false;
28116
+ if (this.empty) return f === "";
28117
+ if (f === "/" && partial2) return true;
28118
+ const options = this.options;
28119
+ if (path6.sep !== "/") f = f.split(path6.sep).join("/");
28120
+ f = f.split(slashSplit);
28121
+ this.debug(this.pattern, "split", f);
28122
+ const set2 = this.set;
28123
+ this.debug(this.pattern, "set", set2);
28124
+ let filename;
28125
+ for (let i = f.length - 1; i >= 0; i--) {
28126
+ filename = f[i];
28127
+ if (filename) break;
28128
+ }
28129
+ for (let i = 0; i < set2.length; i++) {
28130
+ const pattern = set2[i];
28131
+ let file2 = f;
28132
+ if (options.matchBase && pattern.length === 1) file2 = [filename];
28133
+ if (this.matchOne(file2, pattern, partial2)) {
28134
+ if (options.flipNegate) return true;
28135
+ return !this.negate;
28136
+ }
28137
+ }
28138
+ if (options.flipNegate) return false;
28139
+ return this.negate;
28140
+ }
28141
+ static defaults(def) {
28142
+ return minimatch.defaults(def).Minimatch;
28143
+ }
28144
+ };
28145
+ minimatch.Minimatch = Minimatch2;
28146
+ } });
27454
28147
  var ARTIFACTS_EVENT_TYPES = [
27455
28148
  "cf.artifacts.repo.created",
27456
28149
  "cf.artifacts.repo.deleted",
@@ -28339,9 +29032,9 @@ function cloneDef(schema) {
28339
29032
  return mergeDefs(schema._zod.def);
28340
29033
  }
28341
29034
  __name$3(cloneDef, "cloneDef");
28342
- function getElementAtPath(obj, path5) {
28343
- if (!path5) return obj;
28344
- return path5.reduce((acc, key) => acc?.[key], obj);
29035
+ function getElementAtPath(obj, path6) {
29036
+ if (!path6) return obj;
29037
+ return path6.reduce((acc, key) => acc?.[key], obj);
28345
29038
  }
28346
29039
  __name$3(getElementAtPath, "getElementAtPath");
28347
29040
  function promiseAllObject(promisesObj) {
@@ -28671,11 +29364,11 @@ function explicitlyAborted(x, startIndex = 0) {
28671
29364
  return false;
28672
29365
  }
28673
29366
  __name$3(explicitlyAborted, "explicitlyAborted");
28674
- function prefixIssues$1(path5, issues) {
29367
+ function prefixIssues$1(path6, issues) {
28675
29368
  return issues.map((iss) => {
28676
29369
  var _a3;
28677
29370
  (_a3 = iss).path ?? (_a3.path = []);
28678
- iss.path.unshift(path5);
29371
+ iss.path.unshift(path6);
28679
29372
  return iss;
28680
29373
  });
28681
29374
  }
@@ -28810,12 +29503,12 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
28810
29503
  __name$3(flattenError, "flattenError");
28811
29504
  function formatError(error51, mapper = (issue2) => issue2.message) {
28812
29505
  const fieldErrors = { _errors: [] };
28813
- const processError = /* @__PURE__ */ __name$3((error52, path5 = []) => {
28814
- for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
28815
- else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
28816
- else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
29506
+ const processError = /* @__PURE__ */ __name$3((error52, path6 = []) => {
29507
+ for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
29508
+ else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
29509
+ else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
28817
29510
  else {
28818
- const fullpath = [...path5, ...issue2.path];
29511
+ const fullpath = [...path6, ...issue2.path];
28819
29512
  if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue2));
28820
29513
  else {
28821
29514
  let curr = fieldErrors;
@@ -28839,13 +29532,13 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
28839
29532
  __name$3(formatError, "formatError");
28840
29533
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
28841
29534
  const result = { errors: [] };
28842
- const processError = /* @__PURE__ */ __name$3((error52, path5 = []) => {
29535
+ const processError = /* @__PURE__ */ __name$3((error52, path6 = []) => {
28843
29536
  var _a3, _b;
28844
- for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
28845
- else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
28846
- else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
29537
+ for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
29538
+ else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
29539
+ else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
28847
29540
  else {
28848
- const fullpath = [...path5, ...issue2.path];
29541
+ const fullpath = [...path6, ...issue2.path];
28849
29542
  if (fullpath.length === 0) {
28850
29543
  result.errors.push(mapper(issue2));
28851
29544
  continue;
@@ -28875,8 +29568,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
28875
29568
  __name$3(treeifyError, "treeifyError");
28876
29569
  function toDotPath(_path) {
28877
29570
  const segs = [];
28878
- const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
28879
- for (const seg of path5) if (typeof seg === "number") segs.push(`[${seg}]`);
29571
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
29572
+ for (const seg of path6) if (typeof seg === "number") segs.push(`[${seg}]`);
28880
29573
  else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`);
28881
29574
  else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`);
28882
29575
  else {
@@ -41008,11 +41701,11 @@ function detectVersion(schema, defaultTarget) {
41008
41701
  __name$3(detectVersion, "detectVersion");
41009
41702
  function resolveRef(ref, ctx) {
41010
41703
  if (!ref.startsWith("#")) throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
41011
- const path5 = ref.slice(1).split("/").filter(Boolean);
41012
- if (path5.length === 0) return ctx.rootSchema;
41704
+ const path6 = ref.slice(1).split("/").filter(Boolean);
41705
+ if (path6.length === 0) return ctx.rootSchema;
41013
41706
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
41014
- if (path5[0] === defsKey) {
41015
- const key = path5[1];
41707
+ if (path6[0] === defsKey) {
41708
+ const key = path6[1];
41016
41709
  if (!key || !ctx.defs[key]) throw new Error(`Reference not found: ${ref}`);
41017
41710
  return ctx.defs[key];
41018
41711
  }
@@ -41401,9 +42094,9 @@ Please add "${field}" to "env.${envName}".`);
41401
42094
  return rawEnv[field] ?? defaultValue;
41402
42095
  }
41403
42096
  __name$3(notInheritable, "notInheritable");
41404
- function unwindPropertyPath(root, path5) {
42097
+ function unwindPropertyPath(root, path6) {
41405
42098
  let container = root;
41406
- const parts = path5.split(".");
42099
+ const parts = path6.split(".");
41407
42100
  for (let i = 0; i < parts.length - 1; i++) {
41408
42101
  if (!hasProperty(container, parts[i])) return;
41409
42102
  container = container[parts[i]];
@@ -42189,7 +42882,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
42189
42882
  warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
42190
42883
  errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
42191
42884
  const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
42192
- validateContainerExportLinks$1(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
42885
+ validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
42193
42886
  if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
42194
42887
  return environment;
42195
42888
  }
@@ -43481,7 +44174,6 @@ var validateBindingsHaveUniqueNames = /* @__PURE__ */ __name$3((diagnostics, con
43481
44174
  const bindingNamesArray = Object.entries(friendlyBindingNames);
43482
44175
  const bindingsGroupedByType = Object.fromEntries(bindingNamesArray.map(([bindingType, binding]) => [binding, getBindingNames(bindingType === "queues" ? config2[bindingType]?.producers : config2[bindingType])]));
43483
44176
  bindingsGroupedByType["Secret"] = config2.secrets?.required ?? [];
43484
- bindingsGroupedByType["Container images"] = [CONTAINER_IMAGES_BINDING];
43485
44177
  const bindingsGroupedByName = {};
43486
44178
  for (const bindingType in bindingsGroupedByType) {
43487
44179
  const bindingNames = bindingsGroupedByType[bindingType];
@@ -44452,7 +45144,7 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
44452
45144
  if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
44453
45145
  }
44454
45146
  __name$3(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
44455
- function validateContainerExportLinks$1(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
45147
+ function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
44456
45148
  if (containers !== void 0 && !Array.isArray(containers)) return;
44457
45149
  if (containers === void 0 && containersDeclaredElsewhere) return;
44458
45150
  const containersByName = /* @__PURE__ */ new Map();
@@ -44512,7 +45204,7 @@ function validateContainerExportLinks$1(diagnostics, containers, exports$1, cont
44512
45204
  if (referencedContainerName === void 0 && exportEntry !== void 0 && "storage" in exportEntry && exportEntry.storage === "legacy-kv") diagnostics.errors.push(`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.storage" is "legacy-kv". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`);
44513
45205
  }
44514
45206
  }
44515
- __name$3(validateContainerExportLinks$1, "validateContainerExportLinks");
45207
+ __name$3(validateContainerExportLinks, "validateContainerExportLinks");
44516
45208
  var validatePythonModules = /* @__PURE__ */ __name$3((diagnostics, field, value, topLevelEnv) => {
44517
45209
  if (value === void 0) return true;
44518
45210
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -46944,6 +47636,91 @@ function toUrlPath(filePath) {
46944
47636
  return filePath.replace(/\\/g, "/");
46945
47637
  }
46946
47638
  __name$3(toUrlPath, "toUrlPath");
47639
+ var import_minimatch = __toESM(require_minimatch());
47640
+ var DEFAULT_MIGRATIONS_DIR = "./migrations";
47641
+ function getD1MigrationFiles(options) {
47642
+ const migrationsDir = normalizeRelativePath(options.migrationsDir ?? DEFAULT_MIGRATIONS_DIR);
47643
+ const dirRelativePattern = stripDirPrefix(normalizeRelativePath(options.migrationsPattern ?? `${migrationsDir}/*.sql`), migrationsDir);
47644
+ const walkRoot = path.resolve(options.projectPath, migrationsDir);
47645
+ return listFilesRelative(walkRoot, new import_minimatch.Minimatch(dirRelativePattern, { dot: false })).map((name) => ({
47646
+ name,
47647
+ filePath: path.join(walkRoot, ...name.split("/"))
47648
+ }));
47649
+ }
47650
+ __name$3(getD1MigrationFiles, "getD1MigrationFiles");
47651
+ function normalizeRelativePath(p$1) {
47652
+ const forwardSlashed = p$1.replace(/\\/g, "/");
47653
+ const normalized = path.posix.normalize(forwardSlashed);
47654
+ if (normalized.endsWith("/")) return normalized.slice(0, -1);
47655
+ return normalized;
47656
+ }
47657
+ __name$3(normalizeRelativePath, "normalizeRelativePath");
47658
+ function stripDirPrefix(pattern, dir2) {
47659
+ if (dir2 === ".") return pattern;
47660
+ const prefix = `${dir2}/`;
47661
+ if (!pattern.startsWith(prefix)) throw new Error(`Expected migrations pattern ${JSON.stringify(pattern)} to start with ${JSON.stringify(prefix)}`);
47662
+ return pattern.slice(prefix.length);
47663
+ }
47664
+ __name$3(stripDirPrefix, "stripDirPrefix");
47665
+ function listFilesRelative(dir2, matcher) {
47666
+ const out = [];
47667
+ const stack = [{
47668
+ abs: dir2,
47669
+ rel: ""
47670
+ }];
47671
+ while (stack.length > 0) {
47672
+ const { abs, rel } = stack.pop();
47673
+ let entries;
47674
+ try {
47675
+ entries = fs.readdirSync(abs, { withFileTypes: true });
47676
+ } catch {
47677
+ continue;
47678
+ }
47679
+ for (const entry of entries) {
47680
+ const childRel = rel === "" ? entry.name : `${rel}/${entry.name}`;
47681
+ if (entry.isDirectory()) {
47682
+ if (matcher.match(childRel, true)) stack.push({
47683
+ abs: path.join(abs, entry.name),
47684
+ rel: childRel
47685
+ });
47686
+ } else if (entry.isFile() && matcher.match(childRel)) out.push(childRel);
47687
+ }
47688
+ }
47689
+ return out.sort(compareMigrationPaths);
47690
+ }
47691
+ __name$3(listFilesRelative, "listFilesRelative");
47692
+ function compareMigrationPaths(a, b) {
47693
+ const aSegments = a.split("/");
47694
+ const bSegments = b.split("/");
47695
+ const shared = Math.min(aSegments.length, bSegments.length);
47696
+ for (let i = 0; i < shared; i++) {
47697
+ const aSegment = aSegments[i];
47698
+ const bSegment = bSegments[i];
47699
+ if (aSegment === void 0 || bSegment === void 0) break;
47700
+ const cmp$2 = compareSegments(aSegment, bSegment);
47701
+ if (cmp$2 !== 0) return cmp$2;
47702
+ }
47703
+ return aSegments.length - bSegments.length;
47704
+ }
47705
+ __name$3(compareMigrationPaths, "compareMigrationPaths");
47706
+ function compareSegments(a, b) {
47707
+ const aNum = leadingMigrationNumber(a);
47708
+ const bNum = leadingMigrationNumber(b);
47709
+ if (aNum !== bNum) {
47710
+ if (Number.isFinite(aNum) && Number.isFinite(bNum)) return aNum - bNum;
47711
+ if (Number.isFinite(aNum)) return -1;
47712
+ if (Number.isFinite(bNum)) return 1;
47713
+ }
47714
+ if (a < b) return -1;
47715
+ if (a > b) return 1;
47716
+ return 0;
47717
+ }
47718
+ __name$3(compareSegments, "compareSegments");
47719
+ function leadingMigrationNumber(relativePath) {
47720
+ const firstSegment = relativePath.split("/")[0];
47721
+ return parseInt(firstSegment.split("_")[0], 10);
47722
+ }
47723
+ __name$3(leadingMigrationNumber, "leadingMigrationNumber");
46947
47724
 
46948
47725
  //#endregion
46949
47726
  //#region ../../node_modules/.pnpm/devalue@5.6.3/node_modules/devalue/src/utils.js
@@ -61073,7 +61850,7 @@ __name$1(createWorkerUploadForm, "createWorkerUploadForm");
61073
61850
  //#endregion
61074
61851
  //#region ../remote-bindings/dist/index.mjs
61075
61852
  var import_undici = require_undici();
61076
- var version = "0.0.28";
61853
+ var version = "0.0.29";
61077
61854
  var NoDefaultValueProvided = class extends UserError$1 {
61078
61855
  constructor() {
61079
61856
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -62301,7 +63078,6 @@ const ContainerObservabilityBaseSchema = z$1.strictObject({
62301
63078
  });
62302
63079
  const StandardContainerObservabilitySchema = z$1.union([ContainerObservabilityBaseSchema.extend({ targetInstancePercentage: z$1.number().min(0).max(100).optional() }), ContainerObservabilityBaseSchema.extend({ targetInstanceCount: z$1.number().int().nonnegative().optional() })]);
62303
63080
  const BaseContainerSchema = z$1.strictObject({
62304
- type: z$1.literal("container"),
62305
63081
  name: z$1.string().min(1),
62306
63082
  unsafe: z$1.record(z$1.string(), z$1.unknown()).optional()
62307
63083
  });
@@ -62358,14 +63134,13 @@ const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({
62358
63134
  observability: ContainerObservabilityBaseSchema.optional()
62359
63135
  });
62360
63136
  /**
62361
- * Input Container schema — validates user-authored `cloudflare.config.ts`
62362
- * Container exports. Dockerfiles are built by the consuming build tool.
63137
+ * Input Container schema — parses user-authored `cloudflare.config.ts`
63138
+ * Container objects. Dockerfiles are built by the consuming build tool.
62363
63139
  */
62364
63140
  const InputContainerSchema = z$1.union([StandardContainerBaseSchema.extend({ image: InputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: z$1.record(z$1.string(), InputContainerImageSchema).optional() })]);
62365
63141
  /**
62366
- * Output Container schema — validates Container configs in the Build Output
62367
- * Specification, after any Dockerfile has been built into a local or remote
62368
- * image reference.
63142
+ * Output Container schema — parses `container.config.json` files in the Build
63143
+ * Output Specification, after any Dockerfile has been built into a local image reference.
62369
63144
  */
62370
63145
  const OutputContainerSchema = z$1.union([StandardContainerBaseSchema.extend({ image: OutputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: z$1.record(z$1.string(), OutputContainerImageSchema).optional() })]);
62371
63146
  const DurableObjectCreatedExportSchema = z$1.strictObject({
@@ -62507,7 +63282,6 @@ const UnsafeSchema = z$1.strictObject({
62507
63282
  * (user-authored) and output (on-disk) Worker configs.
62508
63283
  */
62509
63284
  const BaseWorkerSchema = z$1.strictObject({
62510
- type: z$1.literal("worker"),
62511
63285
  name: z$1.string(),
62512
63286
  compatibilityDate: z$1.string(),
62513
63287
  compatibilityFlags: z$1.array(z$1.string()).optional(),
@@ -62528,75 +63302,37 @@ const BaseWorkerSchema = z$1.strictObject({
62528
63302
  exports: z$1.record(z$1.string(), ExportSchema).optional()
62529
63303
  });
62530
63304
  /**
62531
- * Input Worker schema — the shape that user-authored `cloudflare.config.ts`
62532
- * files are validated against. Adds an optional `entrypoint` field to the
62533
- * base schema.
63305
+ * Input Worker schema — parses Worker definitions from user-authored
63306
+ * `cloudflare.config.ts` files. Adds an optional `entrypoint` field to the base
63307
+ * schema.
62534
63308
  */
62535
63309
  const InputWorkerSchema = BaseWorkerSchema.extend({ entrypoint: z$1.union([z$1.string(), z$1.strictObject({ default: z$1.string() })]).transform((value) => typeof value === "string" ? value : value.default).optional() });
62536
63310
  /**
62537
- * Input settings schema — validates the named `settings` export of a
62538
- * `cloudflare.config.ts`. Holds account/deployment settings shared by the other exports.
63311
+ * Input settings schema — parses the account settings at the top level of
63312
+ * `cloudflare.config.ts`.
62539
63313
  */
62540
- const InputSettingsSchema = z$1.strictObject({
62541
- type: z$1.literal("settings"),
63314
+ const InputSettingsSchema = z$1.object({
62542
63315
  accountId: z$1.string().optional(),
62543
63316
  complianceRegion: z$1.enum(["public", "fedramp-high"]).optional()
62544
63317
  });
62545
- /**
62546
- * Output settings schema — the shape of the top-level `config.json` in the
62547
- * Build Output Specification. Adds the build mode and Preview intent.
62548
- */
62549
- const OutputSettingsSchema = InputSettingsSchema.extend({
62550
- isPreview: z$1.boolean().optional(),
63318
+ /** The resolved, user-authored project configuration. */
63319
+ const InputConfigSchema = z$1.strictObject({
63320
+ ...InputSettingsSchema.shape,
63321
+ worker: InputWorkerSchema.optional(),
63322
+ containers: z$1.array(InputContainerSchema).default([])
63323
+ });
63324
+ const BuildContextSchema = z$1.strictObject({
63325
+ isPreview: z$1.boolean(),
62551
63326
  mode: z$1.string().optional()
62552
63327
  });
62553
- const DEFAULT_EXPORT_NAME = "default";
62554
- const SETTINGS_EXPORT_NAME = "settings";
62555
- const SUPPORTED_EXPORT_TYPES = new Set([
62556
- "container",
62557
- "worker",
62558
- "settings"
62559
- ]);
62560
- function invalidConfigExportMessage(exportName) {
62561
- return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
62562
- }
62563
- const ConfigExportsTypeSchema = z$1.record(z$1.string(), z$1.unknown()).check((ctx) => {
62564
- for (const [key, value] of Object.entries(ctx.value)) {
62565
- const isObject$1 = typeof value === "object" && value !== null;
62566
- const type = isObject$1 && "type" in value ? value.type : void 0;
62567
- if (typeof type !== "string" || !SUPPORTED_EXPORT_TYPES.has(type)) {
62568
- ctx.issues.push({
62569
- code: "custom",
62570
- input: value,
62571
- path: isObject$1 ? [key, "type"] : [key],
62572
- message: invalidConfigExportMessage(key)
62573
- });
62574
- continue;
62575
- }
62576
- if (key === DEFAULT_EXPORT_NAME && type !== "worker") {
62577
- ctx.issues.push({
62578
- code: "custom",
62579
- input: value,
62580
- path: [key],
62581
- message: `The \`${DEFAULT_EXPORT_NAME}\` export is reserved for a \`worker\` config; found a \`${type}\` config.`
62582
- });
62583
- continue;
62584
- }
62585
- const isSettingsName = key === SETTINGS_EXPORT_NAME;
62586
- const isSettingsType = type === "settings";
62587
- if (isSettingsType && !isSettingsName) ctx.issues.push({
62588
- code: "custom",
62589
- input: value,
62590
- path: [key],
62591
- message: `A \`settings\` config is only allowed on the \`${SETTINGS_EXPORT_NAME}\` export; found one on the \`${key}\` export.`
62592
- });
62593
- else if (isSettingsName && !isSettingsType) ctx.issues.push({
62594
- code: "custom",
62595
- input: value,
62596
- path: [key],
62597
- message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${type}\` config.`
62598
- });
62599
- }
63328
+ /**
63329
+ * The shape of the root `config.json` in the Build Output Specification.
63330
+ * Account settings remain at the top level while build context is grouped
63331
+ * under `buildContext`.
63332
+ */
63333
+ const OutputRootConfigSchema = z$1.strictObject({
63334
+ ...InputSettingsSchema.shape,
63335
+ buildContext: BuildContextSchema
62600
63336
  });
62601
63337
  const ModuleTypeSchema = z$1.enum([
62602
63338
  "esm",
@@ -62628,9 +63364,9 @@ const ManifestSchema = z$1.strictObject({
62628
63364
  });
62629
63365
  });
62630
63366
  /**
62631
- * Output Worker schema — the shape of the Worker's `config.json` in the
62632
- * Build Output Specification. Adds an optional `manifest` field to the
62633
- * base schema.
63367
+ * Output Worker schema — the shape of the Worker's `worker.config.json` in the
63368
+ * Build Output Specification. Adds an optional `manifest` field to the base
63369
+ * schema.
62634
63370
  */
62635
63371
  const OutputWorkerSchema = BaseWorkerSchema.extend({ manifest: ManifestSchema.optional() });
62636
63372
  var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$1) => {
@@ -62738,27 +63474,25 @@ const ROLLOUT_KIND_MAP = {
62738
63474
  /**
62739
63475
  * Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
62740
63476
  *
62741
- * The caller is responsible for unwrapping any function/promise wrappers and
62742
- * validating the configs against their corresponding input schemas before
62743
- * passing them in.
63477
+ * The caller is responsible for resolving any function/promise wrappers and
63478
+ * parsing the configuration before passing it in.
62744
63479
  *
62745
- * @param workerConfig The parsed (post-validation) Worker config.
62746
- * @param settingsConfig The optional parsed settings config, whose fields
62747
- * are merged onto the result.
62748
- * @param containerExports The parsed Container exports to include in the
62749
- * result.
63480
+ * @param config The parsed configuration.
62750
63481
  * @returns The corresponding Wrangler `RawConfig`.
62751
63482
  */
62752
- function convertToWranglerConfig(workerConfig, settingsConfig, containerExports = []) {
63483
+ function convertToWranglerConfig(config$1) {
62753
63484
  const result = {};
62754
- convertTopLevel(workerConfig, result);
62755
- convertBindingsAndAssets(workerConfig, result);
62756
- convertExports(workerConfig, result);
62757
- convertDomains(workerConfig, result);
62758
- convertTriggers(workerConfig, result);
62759
- convertTailConsumers(workerConfig, result);
62760
- if (settingsConfig !== void 0) convertSettings(settingsConfig, result);
62761
- if (containerExports.length > 0) result.containers = containerExports.map((container) => convertContainer(container));
63485
+ const { worker, containers } = config$1;
63486
+ if (worker !== void 0) {
63487
+ convertTopLevel(worker, result);
63488
+ convertBindingsAndAssets(worker, result);
63489
+ convertExports(worker, result);
63490
+ convertDomains(worker, result);
63491
+ convertTriggers(worker, result);
63492
+ convertTailConsumers(worker, result);
63493
+ }
63494
+ convertSettings(config$1, result);
63495
+ if (containers.length > 0) result.containers = containers.map((container) => convertContainer(container));
62762
63496
  return result;
62763
63497
  }
62764
63498
  function convertContainer(container) {
@@ -63356,31 +64090,22 @@ const CF_NO_CACHE_QUERY_KEY = "cf-no-cache";
63356
64090
  const RE_NODE_MODULES = /[/\\]node_modules[/\\]/;
63357
64091
  const depsStore = new AsyncLocalStorage();
63358
64092
  /**
63359
- * Dynamically import a worker config file from disk.
64093
+ * Dynamically import a Cloudflare config file from disk.
63360
64094
  *
63361
- * Returns all of the module's exports (keyed by export name, including
63362
- * `default`), plus the set of file paths imported during resolution. Callers
63363
- * are responsible for unwrapping function/promise/definition wrappers around
63364
- * each export and validating them.
64095
+ * Returns the module's default export plus the set of file paths imported
64096
+ * during resolution.
63365
64097
  *
63366
64098
  * @param configPath Filesystem path to the config file. Relative paths are
63367
64099
  * resolved against `process.cwd()`.
63368
- * @param options.include When provided, only exports whose names are listed
63369
- * survive into the returned `exports` map. Filtering happens before any
63370
- * resolution or validation.
63371
64100
  */
63372
- async function loadConfig(configPath, options) {
64101
+ async function loadConfig(configPath) {
63373
64102
  registerConfigHooks();
63374
64103
  const url$2 = pathToFileURL(configPath).href;
63375
64104
  const dependencies = /* @__PURE__ */ new Set();
63376
64105
  const mod = await depsStore.run(dependencies, () => import(url$2, { with: { [CF_ATTR]: CF_NO_CACHE_VALUE } }));
63377
- const exports$2 = {};
63378
- for (const [name, value] of Object.entries(mod)) {
63379
- if (options?.include && !options.include.includes(name)) continue;
63380
- exports$2[name] = value;
63381
- }
64106
+ if (!("default" in mod)) throw new Error(`The config file "${configPath}" does not have a default export. Export your configuration with \`export default defineConfig({ ... })\`.`);
63382
64107
  return {
63383
- exports: exports$2,
64108
+ config: mod.default,
63384
64109
  dependencies
63385
64110
  };
63386
64111
  }
@@ -63472,11 +64197,8 @@ const CROSS_WORKER_BINDING_TYPES = new Set([
63472
64197
  function isRecord(value) {
63473
64198
  return typeof value === "object" && value !== null;
63474
64199
  }
63475
- function isConfigReference(value) {
63476
- return typeof value === "function" || isRecord(value);
63477
- }
63478
- function normalizeConfigReference(reference, resolved, expectedType) {
63479
- return isRecord(resolved) && resolved.type === expectedType && typeof resolved.name === "string" ? resolved.name : reference;
64200
+ function normalizeConfigReference(reference, resolved) {
64201
+ return isRecord(resolved) && typeof resolved.name === "string" ? resolved.name : reference;
63480
64202
  }
63481
64203
  function createDefinitionResolver(ctx) {
63482
64204
  const resolvedDefinitions = /* @__PURE__ */ new Map();
@@ -63494,11 +64216,11 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
63494
64216
  if (!isRecord(resolved) || !isRecord(resolved.env)) return resolved;
63495
64217
  const env$2 = { ...resolved.env };
63496
64218
  for (const [bindingName, binding] of Object.entries(env$2)) {
63497
- if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || !isConfigReference(binding.worker)) continue;
64219
+ if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || typeof binding.worker === "string") continue;
63498
64220
  const target = await resolveDefinition(binding.worker);
63499
64221
  env$2[bindingName] = {
63500
64222
  ...binding,
63501
- worker: normalizeConfigReference(binding.worker, target, "worker")
64223
+ worker: normalizeConfigReference(binding.worker, target)
63502
64224
  };
63503
64225
  }
63504
64226
  return {
@@ -63506,7 +64228,7 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
63506
64228
  env: env$2
63507
64229
  };
63508
64230
  }
63509
- async function normalizeContainerReferences(resolved, resolveDefinition, resolvedExports) {
64231
+ async function normalizeContainerReferences(resolved, resolveDefinition, containers) {
63510
64232
  const issues = [];
63511
64233
  if (!isRecord(resolved) || !isRecord(resolved.exports)) return {
63512
64234
  value: resolved,
@@ -63525,7 +64247,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
63525
64247
  exportName,
63526
64248
  "container"
63527
64249
  ],
63528
- message: "Container provided as a string. Reference an exported Container definition instead."
64250
+ message: "Container provided as a string. Reference a Container definition instead, for example `container: myContainer`."
63529
64251
  });
63530
64252
  workerExports[exportName] = {
63531
64253
  ...workerExport,
@@ -63534,7 +64256,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
63534
64256
  continue;
63535
64257
  }
63536
64258
  const target = await resolveDefinition(reference);
63537
- if (isRecord(target) && target.type === "container" && typeof target.name === "string" && !Object.values(resolvedExports).includes(target)) {
64259
+ if (isRecord(target) && typeof target.name === "string" && !containers.includes(target)) {
63538
64260
  issues.push({
63539
64261
  code: "custom",
63540
64262
  input: reference,
@@ -63543,7 +64265,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
63543
64265
  exportName,
63544
64266
  "container"
63545
64267
  ],
63546
- message: `The referenced Container "${target.name}" is not exported.`
64268
+ message: `The referenced Container "${target.name}" is not included in the \`containers\` array.`
63547
64269
  });
63548
64270
  workerExports[exportName] = {
63549
64271
  ...workerExport,
@@ -63553,7 +64275,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
63553
64275
  }
63554
64276
  workerExports[exportName] = {
63555
64277
  ...workerExport,
63556
- container: normalizeConfigReference(reference, target, "container")
64278
+ container: normalizeConfigReference(reference, target)
63557
64279
  };
63558
64280
  }
63559
64281
  return {
@@ -63564,8 +64286,8 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
63564
64286
  issues
63565
64287
  };
63566
64288
  }
63567
- async function normalizeConfigReferences(resolved, resolveDefinition, resolvedExports) {
63568
- return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition, resolvedExports);
64289
+ async function normalizeWorkerConfig(resolved, resolveDefinition, containers) {
64290
+ return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition, containers);
63569
64291
  }
63570
64292
  function prefixIssues(issues, prefix) {
63571
64293
  return issues.map((issue$1) => ({
@@ -63573,126 +64295,83 @@ function prefixIssues(issues, prefix) {
63573
64295
  path: [prefix, ...issue$1.path]
63574
64296
  }));
63575
64297
  }
63576
- function validateUniqueResourceNames(configExports) {
64298
+ function validateUniqueContainerNames(config$1) {
63577
64299
  const issues = [];
63578
- const exportNameByResourceName = {
63579
- container: /* @__PURE__ */ new Map(),
63580
- worker: /* @__PURE__ */ new Map()
63581
- };
63582
- for (const [exportName, config$1] of Object.entries(configExports)) {
63583
- if (config$1.type !== "container" && config$1.type !== "worker") continue;
63584
- const resourceType = config$1.type === "container" ? "Container" : "Worker";
63585
- const exportNames = exportNameByResourceName[config$1.type];
63586
- const previousExportName = exportNames.get(config$1.name);
63587
- if (previousExportName !== void 0) {
64300
+ const firstIndexByName = /* @__PURE__ */ new Map();
64301
+ for (const [index, container] of config$1.containers.entries()) {
64302
+ const firstIndex = firstIndexByName.get(container.name);
64303
+ if (firstIndex !== void 0) {
63588
64304
  issues.push({
63589
64305
  code: "custom",
63590
- input: config$1.name,
63591
- path: [exportName, "name"],
63592
- message: `The ${resourceType} name "${config$1.name}" is also used by the "${previousExportName}" export. ${resourceType} names must be unique.`
64306
+ input: container.name,
64307
+ path: [
64308
+ "containers",
64309
+ index,
64310
+ "name"
64311
+ ],
64312
+ message: `The Container name "${container.name}" is also used by \`containers[${firstIndex}]\`. Container names must be unique.`
63593
64313
  });
63594
64314
  continue;
63595
64315
  }
63596
- exportNames.set(config$1.name, exportName);
64316
+ firstIndexByName.set(container.name, index);
63597
64317
  }
63598
64318
  return issues;
63599
64319
  }
63600
- function validateContainerExportLinks(configExports) {
64320
+ function validateContainerLinks(config$1) {
63601
64321
  const issues = [];
63602
- const containerNames = /* @__PURE__ */ new Set();
63603
- for (const config$1 of Object.values(configExports)) if (config$1.type === "container") containerNames.add(config$1.name);
63604
- const firstReferenceByContainerName = /* @__PURE__ */ new Map();
63605
- for (const [workerExportName, config$1] of Object.entries(configExports)) {
63606
- if (config$1.type !== "worker") continue;
63607
- for (const [durableObjectExportName, workerExport] of Object.entries(config$1.exports ?? {})) {
63608
- if (workerExport.type !== "durable-object" || !("container" in workerExport) || workerExport.container === void 0) continue;
63609
- const containerName = workerExport.container;
63610
- const path$3 = [
63611
- workerExportName,
63612
- "exports",
63613
- durableObjectExportName,
63614
- "container"
63615
- ];
63616
- if (!containerNames.has(containerName)) {
63617
- issues.push({
63618
- code: "custom",
63619
- input: containerName,
63620
- path: path$3,
63621
- message: `The Container "${containerName}" is not exported from this configuration.`
63622
- });
63623
- continue;
63624
- }
63625
- const firstReference = firstReferenceByContainerName.get(containerName);
63626
- if (firstReference !== void 0) {
63627
- issues.push({
63628
- code: "custom",
63629
- input: containerName,
63630
- path: path$3,
63631
- message: `The Container "${containerName}" is already referenced by "${firstReference.workerExportName}.exports.${firstReference.durableObjectExportName}". A Container can only be linked to one Durable Object.`
63632
- });
63633
- continue;
63634
- }
63635
- firstReferenceByContainerName.set(containerName, {
63636
- workerExportName,
63637
- durableObjectExportName
64322
+ const firstExportByContainerName = /* @__PURE__ */ new Map();
64323
+ for (const [exportName, workerExport] of Object.entries(config$1.worker?.exports ?? {})) {
64324
+ if (workerExport.type !== "durable-object" || !("container" in workerExport) || workerExport.container === void 0) continue;
64325
+ const containerName = workerExport.container;
64326
+ const firstExportName = firstExportByContainerName.get(containerName);
64327
+ if (firstExportName !== void 0) {
64328
+ issues.push({
64329
+ code: "custom",
64330
+ input: containerName,
64331
+ path: [
64332
+ "worker",
64333
+ "exports",
64334
+ exportName,
64335
+ "container"
64336
+ ],
64337
+ message: `The Container "${containerName}" is already referenced by \`worker.exports.${firstExportName}\`. A Container can only be linked to one Durable Object.`
63638
64338
  });
64339
+ continue;
63639
64340
  }
64341
+ firstExportByContainerName.set(containerName, exportName);
63640
64342
  }
63641
64343
  return issues;
63642
64344
  }
63643
- /**
63644
- * Resolve and validate loaded `cloudflare.config.ts` exports.
63645
- *
63646
- * Config inputs are resolved once by identity. Top-level Worker and Container
63647
- * exports are also parsed once by identity. References are resolved only far
63648
- * enough to replace them with resource names, then Container links are
63649
- * validated across the exported resources.
63650
- */
63651
- async function resolveAndValidateConfigExports(exports$2, ctx) {
64345
+ /** Resolve and parse the default configuration export. */
64346
+ async function resolveAndParseConfig(input, ctx) {
63652
64347
  const resolveDefinition = createDefinitionResolver(ctx);
63653
- const parsedResources = /* @__PURE__ */ new Map();
63654
- const resolvedExports = {};
63655
- for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
63656
- const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
63657
- if (!typeResult.success) return typeResult;
63658
- const issues = [];
63659
- const data = {};
63660
- const resolvedSettings = resolvedExports.settings;
63661
- const settingsResult = resolvedSettings ? InputSettingsSchema.safeParse(resolvedSettings) : void 0;
63662
- if (settingsResult) if (settingsResult.success) data.settings = settingsResult.data;
63663
- else issues.push(...prefixIssues(settingsResult.error.issues, "settings"));
63664
- for (const [name, input] of Object.entries(exports$2)) {
63665
- const resolved = resolvedExports[name];
63666
- if (!isRecord(resolved)) continue;
63667
- if (resolved.type !== "worker" && resolved.type !== "container") continue;
63668
- let result = parsedResources.get(input);
63669
- if (!result) {
63670
- if (resolved.type === "worker") {
63671
- const normalized = await normalizeConfigReferences(resolved, resolveDefinition, resolvedExports);
63672
- issues.push(...prefixIssues(normalized.issues, name));
63673
- result = InputWorkerSchema.safeParse(normalized.value);
63674
- } else result = InputContainerSchema.safeParse(resolved);
63675
- parsedResources.set(input, result);
63676
- if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
63677
- }
63678
- if (result.success) data[name] = result.data;
63679
- }
63680
- issues.push(...validateUniqueResourceNames(data), ...validateContainerExportLinks(data));
64348
+ const resolved = await resolveDefinition(input);
64349
+ if (!isRecord(resolved)) return InputConfigSchema.safeParse(resolved);
64350
+ const containerInputs = Array.isArray(resolved.containers) ? resolved.containers : [];
64351
+ const containers = await Promise.all(containerInputs.map((container) => resolveDefinition(container)));
64352
+ const normalizedWorker = resolved.worker === void 0 ? {
64353
+ value: void 0,
64354
+ issues: []
64355
+ } : await normalizeWorkerConfig(await resolveDefinition(resolved.worker), resolveDefinition, containers);
64356
+ const candidate = {
64357
+ ...resolved,
64358
+ ...resolved.worker === void 0 ? {} : { worker: normalizedWorker.value },
64359
+ ...Array.isArray(resolved.containers) ? { containers } : {}
64360
+ };
64361
+ const result = InputConfigSchema.safeParse(candidate);
64362
+ const issues = [...prefixIssues(normalizedWorker.issues, "worker")];
64363
+ if (!result.success) issues.push(...result.error.issues);
64364
+ else issues.push(...validateUniqueContainerNames(result.data), ...validateContainerLinks(result.data));
63681
64365
  return issues.length > 0 ? {
63682
64366
  success: false,
63683
64367
  error: new z$1.ZodError(issues)
63684
- } : {
63685
- success: true,
63686
- data
63687
- };
64368
+ } : result;
63688
64369
  }
63689
- /**
63690
- * Load a `cloudflare.config.ts`, resolve all exports, and validate them.
63691
- */
63692
- async function loadAndValidateConfig(configPath, ctx, options) {
63693
- const { exports: exports$2, dependencies } = await loadConfig(configPath, options);
64370
+ /** Load and parse `cloudflare.config.ts`'s default export. */
64371
+ async function loadAndParseConfig(configPath, ctx) {
64372
+ const { config: config$1, dependencies } = await loadConfig(configPath);
63694
64373
  return {
63695
- result: await resolveAndValidateConfigExports(exports$2, ctx),
64374
+ result: await resolveAndParseConfig(config$1, ctx),
63696
64375
  dependencies
63697
64376
  };
63698
64377
  }
@@ -63708,7 +64387,7 @@ const NEW_CONFIG_FILENAME = "cloudflare.config.ts";
63708
64387
  * the project uses.
63709
64388
  *
63710
64389
  * This mirrors the `@cloudflare/vite-plugin` implementation of
63711
- * `experimental.newConfig`: load and validate via `@cloudflare/config`, convert
64390
+ * `experimental.newConfig`: load and parse via `@cloudflare/config`, convert
63712
64391
  * the result to a Wrangler `RawConfig`, then run it through the standard
63713
64392
  * Wrangler normalisation/validation pipeline.
63714
64393
  *
@@ -63718,14 +64397,13 @@ const NEW_CONFIG_FILENAME = "cloudflare.config.ts";
63718
64397
  */
63719
64398
  async function loadNewConfig(configPath, mode) {
63720
64399
  if (!existsSync(configPath)) throw new TypeError(`\`experimental.newConfig\` is enabled but no \`${NEW_CONFIG_FILENAME}\` was found at ${configPath}.`);
63721
- const { result } = await loadAndValidateConfig(configPath, {
64400
+ const { result } = await loadAndParseConfig(configPath, {
63722
64401
  isPreview: false,
63723
64402
  mode
63724
64403
  });
63725
64404
  if (!result.success) throw new TypeError(`Invalid \`${NEW_CONFIG_FILENAME}\`:\n${result.error.message}`);
63726
- const worker = result.data.default?.type === "worker" ? result.data.default : void 0;
63727
- if (worker === void 0) throw new TypeError(`\`${NEW_CONFIG_FILENAME}\` must have a default worker export.`);
63728
- const { config: config$1, diagnostics } = normalizeAndValidateConfig(convertToWranglerConfig(worker, result.data.settings?.type === "settings" ? result.data.settings : void 0), configPath, configPath, {});
64405
+ if (result.data.worker === void 0) throw new TypeError(`\`${NEW_CONFIG_FILENAME}\` must define a Worker using the \`worker\` property.`);
64406
+ const { config: config$1, diagnostics } = normalizeAndValidateConfig(convertToWranglerConfig(result.data), configPath, configPath, {});
63729
64407
  if (diagnostics.hasWarnings()) console.warn(diagnostics.renderWarnings());
63730
64408
  if (diagnostics.hasErrors()) throw new TypeError(diagnostics.renderErrors());
63731
64409
  return config$1;
@@ -64216,24 +64894,40 @@ function cloudflareTest(options) {
64216
64894
  //#endregion
64217
64895
  //#region src/pool/d1.ts
64218
64896
  /**
64219
- * Reads all migrations in `migrationsPath`, ordered by migration number.
64220
- * Each migration will have its contents split into an array of SQL queries.
64897
+ * Reads D1 migration files, ordered by migration number. Each migration has
64898
+ * its contents split into an array of SQL queries.
64899
+ *
64900
+ * Pass a directory path to keep the historical behaviour of reading top-level
64901
+ * `*.sql` files in that directory. Pass options to discover files the same way
64902
+ * Wrangler does, including nested layouts such as
64903
+ * `0001_init/migration.sql` via `migrationsPattern`.
64221
64904
  */
64222
- async function readD1Migrations(migrationsPath) {
64223
- if (typeof migrationsPath !== "string") throw new TypeError("Failed to execute 'readD1Migrations': parameter 1 is not of type 'string'.");
64905
+ async function readD1Migrations(migrationsPathOrOptions) {
64906
+ const files = listD1MigrationFiles(migrationsPathOrOptions);
64224
64907
  const { unstable_splitSqlQuery } = await import("wrangler");
64225
- const names = fs.readdirSync(migrationsPath).filter((name) => name.endsWith(".sql"));
64226
- names.sort((a, b) => {
64227
- return parseInt(a.split("_")[0]) - parseInt(b.split("_")[0]);
64228
- });
64229
- return names.map((name) => {
64230
- const migrationPath = path.join(migrationsPath, name);
64908
+ return files.map(({ name, filePath }) => {
64231
64909
  return {
64232
64910
  name,
64233
- queries: unstable_splitSqlQuery(fs.readFileSync(migrationPath, "utf8"))
64911
+ queries: unstable_splitSqlQuery(fs.readFileSync(filePath, "utf8"))
64234
64912
  };
64235
64913
  });
64236
64914
  }
64915
+ function listD1MigrationFiles(migrationsPathOrOptions) {
64916
+ if (typeof migrationsPathOrOptions === "string") {
64917
+ fs.readdirSync(migrationsPathOrOptions);
64918
+ return getD1MigrationFiles({
64919
+ projectPath: migrationsPathOrOptions,
64920
+ migrationsDir: ".",
64921
+ migrationsPattern: "*.sql"
64922
+ });
64923
+ }
64924
+ if (migrationsPathOrOptions !== null && typeof migrationsPathOrOptions === "object") return getD1MigrationFiles({
64925
+ projectPath: migrationsPathOrOptions.projectPath ?? process.cwd(),
64926
+ migrationsDir: migrationsPathOrOptions.migrationsDir,
64927
+ migrationsPattern: migrationsPathOrOptions.migrationsPattern
64928
+ });
64929
+ throw new TypeError("Failed to execute 'readD1Migrations': parameter 1 is not of type 'string' or 'object'.");
64930
+ }
64237
64931
 
64238
64932
  //#endregion
64239
64933
  //#region src/pool/index.ts