wrangler 3.112.0 → 3.113.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.
@@ -17536,7 +17536,7 @@ var require_XDG = __commonJS({
17536
17536
  exports2.__esModule = true;
17537
17537
  exports2.Adapt = void 0;
17538
17538
  function Adapt(adapter_) {
17539
- var env7 = adapter_.env, osPaths = adapter_.osPaths, path72 = adapter_.path;
17539
+ var env6 = adapter_.env, osPaths = adapter_.osPaths, path72 = adapter_.path;
17540
17540
  var isMacOS = /^darwin$/i.test(adapter_.process.platform);
17541
17541
  var isWinOS = /^win/i.test(adapter_.process.platform);
17542
17542
  function baseDir() {
@@ -17549,63 +17549,63 @@ var require_XDG = __commonJS({
17549
17549
  __name(valOrPath, "valOrPath");
17550
17550
  var linux = /* @__PURE__ */ __name(function() {
17551
17551
  var cache6 = /* @__PURE__ */ __name(function() {
17552
- return valOrPath(env7.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
17552
+ return valOrPath(env6.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
17553
17553
  }, "cache");
17554
17554
  var config = /* @__PURE__ */ __name(function() {
17555
- return valOrPath(env7.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
17555
+ return valOrPath(env6.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
17556
17556
  }, "config");
17557
17557
  var data = /* @__PURE__ */ __name(function() {
17558
- return valOrPath(env7.get("XDG_DATA_HOME"), [baseDir(), ".local", "share"]);
17558
+ return valOrPath(env6.get("XDG_DATA_HOME"), [baseDir(), ".local", "share"]);
17559
17559
  }, "data");
17560
17560
  var runtime = /* @__PURE__ */ __name(function() {
17561
- return env7.get("XDG_RUNTIME_DIR") || void 0;
17561
+ return env6.get("XDG_RUNTIME_DIR") || void 0;
17562
17562
  }, "runtime");
17563
17563
  var state2 = /* @__PURE__ */ __name(function() {
17564
- return valOrPath(env7.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
17564
+ return valOrPath(env6.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
17565
17565
  }, "state");
17566
17566
  return { cache: cache6, config, data, runtime, state: state2 };
17567
17567
  }, "linux");
17568
17568
  var macos = /* @__PURE__ */ __name(function() {
17569
17569
  var cache6 = /* @__PURE__ */ __name(function() {
17570
- return valOrPath(env7.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
17570
+ return valOrPath(env6.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
17571
17571
  }, "cache");
17572
17572
  var config = /* @__PURE__ */ __name(function() {
17573
- return valOrPath(env7.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
17573
+ return valOrPath(env6.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
17574
17574
  }, "config");
17575
17575
  var data = /* @__PURE__ */ __name(function() {
17576
- return valOrPath(env7.get("XDG_DATA_HOME"), [baseDir(), "Library", "Application Support"]);
17576
+ return valOrPath(env6.get("XDG_DATA_HOME"), [baseDir(), "Library", "Application Support"]);
17577
17577
  }, "data");
17578
17578
  var runtime = /* @__PURE__ */ __name(function() {
17579
- return env7.get("XDG_RUNTIME_DIR") || void 0;
17579
+ return env6.get("XDG_RUNTIME_DIR") || void 0;
17580
17580
  }, "runtime");
17581
17581
  var state2 = /* @__PURE__ */ __name(function() {
17582
- return valOrPath(env7.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
17582
+ return valOrPath(env6.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
17583
17583
  }, "state");
17584
17584
  return { cache: cache6, config, data, runtime, state: state2 };
17585
17585
  }, "macos");
17586
17586
  var windows = /* @__PURE__ */ __name(function() {
17587
17587
  function appData() {
17588
- return valOrPath(env7.get("APPDATA"), [baseDir(), "AppData", "Roaming"]);
17588
+ return valOrPath(env6.get("APPDATA"), [baseDir(), "AppData", "Roaming"]);
17589
17589
  }
17590
17590
  __name(appData, "appData");
17591
17591
  function localAppData() {
17592
- return valOrPath(env7.get("LOCALAPPDATA"), [baseDir(), "AppData", "Local"]);
17592
+ return valOrPath(env6.get("LOCALAPPDATA"), [baseDir(), "AppData", "Local"]);
17593
17593
  }
17594
17594
  __name(localAppData, "localAppData");
17595
17595
  var cache6 = /* @__PURE__ */ __name(function() {
17596
- return valOrPath(env7.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
17596
+ return valOrPath(env6.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
17597
17597
  }, "cache");
17598
17598
  var config = /* @__PURE__ */ __name(function() {
17599
- return valOrPath(env7.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
17599
+ return valOrPath(env6.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
17600
17600
  }, "config");
17601
17601
  var data = /* @__PURE__ */ __name(function() {
17602
- return valOrPath(env7.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
17602
+ return valOrPath(env6.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
17603
17603
  }, "data");
17604
17604
  var runtime = /* @__PURE__ */ __name(function() {
17605
- return env7.get("XDG_RUNTIME_DIR") || void 0;
17605
+ return env6.get("XDG_RUNTIME_DIR") || void 0;
17606
17606
  }, "runtime");
17607
17607
  var state2 = /* @__PURE__ */ __name(function() {
17608
- return valOrPath(env7.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
17608
+ return valOrPath(env6.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
17609
17609
  }, "state");
17610
17610
  return { cache: cache6, config, data, runtime, state: state2 };
17611
17611
  }, "windows");
@@ -17622,11 +17622,11 @@ var require_XDG = __commonJS({
17622
17622
  XDG.runtime = extension.runtime;
17623
17623
  XDG.state = extension.state;
17624
17624
  XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
17625
- var pathList = env7.get("XDG_CONFIG_DIRS");
17625
+ var pathList = env6.get("XDG_CONFIG_DIRS");
17626
17626
  return __spreadArray([extension.config()], pathList ? pathList.split(path72.delimiter) : []);
17627
17627
  }, "configDirs");
17628
17628
  XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
17629
- var pathList = env7.get("XDG_DATA_DIRS");
17629
+ var pathList = env6.get("XDG_DATA_DIRS");
17630
17630
  return __spreadArray([extension.data()], pathList ? pathList.split(path72.delimiter) : []);
17631
17631
  }, "dataDirs");
17632
17632
  return XDG;
@@ -17658,7 +17658,7 @@ var require_OSPaths = __commonJS({
17658
17658
  }
17659
17659
  __name(isEmpty, "isEmpty");
17660
17660
  function Adapt(adapter_) {
17661
- var env7 = adapter_.env, os12 = adapter_.os, path72 = adapter_.path;
17661
+ var env6 = adapter_.env, os12 = adapter_.os, path72 = adapter_.path;
17662
17662
  var isWinOS = /^win/i.test(adapter_.process.platform);
17663
17663
  function normalizePath2(path_) {
17664
17664
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
@@ -17666,14 +17666,14 @@ var require_OSPaths = __commonJS({
17666
17666
  __name(normalizePath2, "normalizePath");
17667
17667
  function home() {
17668
17668
  var posix2 = /* @__PURE__ */ __name(function() {
17669
- return normalizePath2((typeof os12.homedir === "function" ? os12.homedir() : void 0) || env7.get("HOME"));
17669
+ return normalizePath2((typeof os12.homedir === "function" ? os12.homedir() : void 0) || env6.get("HOME"));
17670
17670
  }, "posix");
17671
17671
  var windows = /* @__PURE__ */ __name(function() {
17672
17672
  var priorityList = [
17673
17673
  typeof os12.homedir === "function" ? os12.homedir() : void 0,
17674
- env7.get("USERPROFILE"),
17675
- env7.get("HOME"),
17676
- env7.get("HOMEDRIVE") || env7.get("HOMEPATH") ? path72.join(env7.get("HOMEDRIVE") || "", env7.get("HOMEPATH") || "") : void 0
17674
+ env6.get("USERPROFILE"),
17675
+ env6.get("HOME"),
17676
+ env6.get("HOMEDRIVE") || env6.get("HOMEPATH") ? path72.join(env6.get("HOMEDRIVE") || "", env6.get("HOMEPATH") || "") : void 0
17677
17677
  ];
17678
17678
  return normalizePath2(priorityList.find(function(v7) {
17679
17679
  return !isEmpty(v7);
@@ -17691,9 +17691,9 @@ var require_OSPaths = __commonJS({
17691
17691
  var fallback = "/tmp";
17692
17692
  var priorityList = [
17693
17693
  typeof os12.tmpdir === "function" ? os12.tmpdir() : void 0,
17694
- env7.get("TMPDIR"),
17695
- env7.get("TEMP"),
17696
- env7.get("TMP")
17694
+ env6.get("TMPDIR"),
17695
+ env6.get("TEMP"),
17696
+ env6.get("TMP")
17697
17697
  ];
17698
17698
  return normalizePath2(priorityList.find(function(v7) {
17699
17699
  return !isEmpty(v7);
@@ -17707,28 +17707,28 @@ var require_OSPaths = __commonJS({
17707
17707
  return void 0;
17708
17708
  },
17709
17709
  function() {
17710
- return env7.get("TEMP");
17710
+ return env6.get("TEMP");
17711
17711
  },
17712
17712
  function() {
17713
- return env7.get("TMP");
17713
+ return env6.get("TMP");
17714
17714
  },
17715
17715
  function() {
17716
- return joinPathToBase(env7.get("LOCALAPPDATA"), ["Temp"]);
17716
+ return joinPathToBase(env6.get("LOCALAPPDATA"), ["Temp"]);
17717
17717
  },
17718
17718
  function() {
17719
17719
  return joinPathToBase(home(), ["AppData", "Local", "Temp"]);
17720
17720
  },
17721
17721
  function() {
17722
- return joinPathToBase(env7.get("ALLUSERSPROFILE"), ["Temp"]);
17722
+ return joinPathToBase(env6.get("ALLUSERSPROFILE"), ["Temp"]);
17723
17723
  },
17724
17724
  function() {
17725
- return joinPathToBase(env7.get("SystemRoot"), ["Temp"]);
17725
+ return joinPathToBase(env6.get("SystemRoot"), ["Temp"]);
17726
17726
  },
17727
17727
  function() {
17728
- return joinPathToBase(env7.get("windir"), ["Temp"]);
17728
+ return joinPathToBase(env6.get("windir"), ["Temp"]);
17729
17729
  },
17730
17730
  function() {
17731
- return joinPathToBase(env7.get("SystemDrive"), ["\\", "Temp"]);
17731
+ return joinPathToBase(env6.get("SystemDrive"), ["\\", "Temp"]);
17732
17732
  }
17733
17733
  ];
17734
17734
  var v7 = priorityListLazy.find(function(v8) {
@@ -18504,15 +18504,15 @@ var require_supports_colors = __commonJS({
18504
18504
  init_import_meta_url();
18505
18505
  var os12 = require("os");
18506
18506
  var hasFlag3 = require_has_flag();
18507
- var env7 = process.env;
18507
+ var env6 = process.env;
18508
18508
  var forceColor = void 0;
18509
18509
  if (hasFlag3("no-color") || hasFlag3("no-colors") || hasFlag3("color=false")) {
18510
18510
  forceColor = false;
18511
18511
  } else if (hasFlag3("color") || hasFlag3("colors") || hasFlag3("color=true") || hasFlag3("color=always")) {
18512
18512
  forceColor = true;
18513
18513
  }
18514
- if ("FORCE_COLOR" in env7) {
18515
- forceColor = env7.FORCE_COLOR.length === 0 || parseInt(env7.FORCE_COLOR, 10) !== 0;
18514
+ if ("FORCE_COLOR" in env6) {
18515
+ forceColor = env6.FORCE_COLOR.length === 0 || parseInt(env6.FORCE_COLOR, 10) !== 0;
18516
18516
  }
18517
18517
  function translateLevel3(level) {
18518
18518
  if (level === 0) {
@@ -18547,20 +18547,20 @@ var require_supports_colors = __commonJS({
18547
18547
  }
18548
18548
  return 1;
18549
18549
  }
18550
- if ("CI" in env7) {
18550
+ if ("CI" in env6) {
18551
18551
  if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some(function(sign) {
18552
- return sign in env7;
18553
- }) || env7.CI_NAME === "codeship") {
18552
+ return sign in env6;
18553
+ }) || env6.CI_NAME === "codeship") {
18554
18554
  return 1;
18555
18555
  }
18556
18556
  return min;
18557
18557
  }
18558
- if ("TEAMCITY_VERSION" in env7) {
18559
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env7.TEAMCITY_VERSION) ? 1 : 0;
18558
+ if ("TEAMCITY_VERSION" in env6) {
18559
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env6.TEAMCITY_VERSION) ? 1 : 0;
18560
18560
  }
18561
- if ("TERM_PROGRAM" in env7) {
18562
- var version4 = parseInt((env7.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
18563
- switch (env7.TERM_PROGRAM) {
18561
+ if ("TERM_PROGRAM" in env6) {
18562
+ var version4 = parseInt((env6.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
18563
+ switch (env6.TERM_PROGRAM) {
18564
18564
  case "iTerm.app":
18565
18565
  return version4 >= 3 ? 3 : 2;
18566
18566
  case "Hyper":
@@ -18569,16 +18569,16 @@ var require_supports_colors = __commonJS({
18569
18569
  return 2;
18570
18570
  }
18571
18571
  }
18572
- if (/-256(color)?$/i.test(env7.TERM)) {
18572
+ if (/-256(color)?$/i.test(env6.TERM)) {
18573
18573
  return 2;
18574
18574
  }
18575
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env7.TERM)) {
18575
+ if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env6.TERM)) {
18576
18576
  return 1;
18577
18577
  }
18578
- if ("COLORTERM" in env7) {
18578
+ if ("COLORTERM" in env6) {
18579
18579
  return 1;
18580
18580
  }
18581
- if (env7.TERM === "dumb") {
18581
+ if (env6.TERM === "dumb") {
18582
18582
  return min;
18583
18583
  }
18584
18584
  return min;
@@ -22631,7 +22631,7 @@ var require_package = __commonJS({
22631
22631
  var require_main2 = __commonJS({
22632
22632
  "../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js"(exports2, module3) {
22633
22633
  init_import_meta_url();
22634
- var fs29 = require("fs");
22634
+ var fs27 = require("fs");
22635
22635
  var path72 = require("path");
22636
22636
  var os12 = require("os");
22637
22637
  var crypto8 = require("crypto");
@@ -22766,7 +22766,7 @@ var require_main2 = __commonJS({
22766
22766
  }
22767
22767
  }
22768
22768
  try {
22769
- const parsed = DotenvModule.parse(fs29.readFileSync(dotenvPath, { encoding }));
22769
+ const parsed = DotenvModule.parse(fs27.readFileSync(dotenvPath, { encoding }));
22770
22770
  let processEnv = process.env;
22771
22771
  if (options32 && options32.processEnv != null) {
22772
22772
  processEnv = options32.processEnv;
@@ -22786,7 +22786,7 @@ var require_main2 = __commonJS({
22786
22786
  if (_dotenvKey(options32).length === 0) {
22787
22787
  return DotenvModule.configDotenv(options32);
22788
22788
  }
22789
- if (!fs29.existsSync(vaultPath)) {
22789
+ if (!fs27.existsSync(vaultPath)) {
22790
22790
  _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
22791
22791
  return DotenvModule.configDotenv(options32);
22792
22792
  }
@@ -22933,8 +22933,8 @@ var require_picocolors = __commonJS({
22933
22933
  init_import_meta_url();
22934
22934
  var p6 = process || {};
22935
22935
  var argv = p6.argv || [];
22936
- var env7 = p6.env || {};
22937
- var isColorSupported = !(!!env7.NO_COLOR || argv.includes("--no-color")) && (!!env7.FORCE_COLOR || argv.includes("--color") || p6.platform === "win32" || (p6.stdout || {}).isTTY && env7.TERM !== "dumb" || !!env7.CI);
22936
+ var env6 = p6.env || {};
22937
+ var isColorSupported = !(!!env6.NO_COLOR || argv.includes("--no-color")) && (!!env6.FORCE_COLOR || argv.includes("--color") || p6.platform === "win32" || (p6.stdout || {}).isTTY && env6.TERM !== "dumb" || !!env6.CI);
22938
22938
  var formatter = /* @__PURE__ */ __name((open4, close2, replace = open4) => (input) => {
22939
22939
  let string = "" + input, index = string.indexOf(close2, open4.length);
22940
22940
  return ~index ? open4 + replaceClose(string, close2, replace, index) + close2 : open4 + string + close2;
@@ -23486,7 +23486,7 @@ var require_ci_info = __commonJS({
23486
23486
  "use strict";
23487
23487
  init_import_meta_url();
23488
23488
  var vendors = require_vendors();
23489
- var env7 = process.env;
23489
+ var env6 = process.env;
23490
23490
  Object.defineProperty(exports2, "_vendors", {
23491
23491
  value: vendors.map(function(v7) {
23492
23492
  return v7.constant;
@@ -23506,14 +23506,14 @@ var require_ci_info = __commonJS({
23506
23506
  exports2.name = vendor.name;
23507
23507
  switch (typeof vendor.pr) {
23508
23508
  case "string":
23509
- exports2.isPR = !!env7[vendor.pr];
23509
+ exports2.isPR = !!env6[vendor.pr];
23510
23510
  break;
23511
23511
  case "object":
23512
23512
  if ("env" in vendor.pr) {
23513
- exports2.isPR = vendor.pr.env in env7 && env7[vendor.pr.env] !== vendor.pr.ne;
23513
+ exports2.isPR = vendor.pr.env in env6 && env6[vendor.pr.env] !== vendor.pr.ne;
23514
23514
  } else if ("any" in vendor.pr) {
23515
23515
  exports2.isPR = vendor.pr.any.some(function(key) {
23516
- return !!env7[key];
23516
+ return !!env6[key];
23517
23517
  });
23518
23518
  } else {
23519
23519
  exports2.isPR = checkEnv(vendor.pr);
@@ -23523,30 +23523,30 @@ var require_ci_info = __commonJS({
23523
23523
  exports2.isPR = null;
23524
23524
  }
23525
23525
  });
23526
- exports2.isCI = !!(env7.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
23527
- (env7.BUILD_ID || // Jenkins, Cloudbees
23528
- env7.BUILD_NUMBER || // Jenkins, TeamCity
23529
- env7.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
23530
- env7.CI_APP_ID || // Appflow
23531
- env7.CI_BUILD_ID || // Appflow
23532
- env7.CI_BUILD_NUMBER || // Appflow
23533
- env7.CI_NAME || // Codeship and others
23534
- env7.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
23535
- env7.RUN_ID || // TaskCluster, dsari
23526
+ exports2.isCI = !!(env6.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
23527
+ (env6.BUILD_ID || // Jenkins, Cloudbees
23528
+ env6.BUILD_NUMBER || // Jenkins, TeamCity
23529
+ env6.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
23530
+ env6.CI_APP_ID || // Appflow
23531
+ env6.CI_BUILD_ID || // Appflow
23532
+ env6.CI_BUILD_NUMBER || // Appflow
23533
+ env6.CI_NAME || // Codeship and others
23534
+ env6.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
23535
+ env6.RUN_ID || // TaskCluster, dsari
23536
23536
  exports2.name || false));
23537
23537
  function checkEnv(obj) {
23538
23538
  if (typeof obj === "string")
23539
- return !!env7[obj];
23539
+ return !!env6[obj];
23540
23540
  if ("env" in obj) {
23541
- return env7[obj.env] && env7[obj.env].includes(obj.includes);
23541
+ return env6[obj.env] && env6[obj.env].includes(obj.includes);
23542
23542
  }
23543
23543
  if ("any" in obj) {
23544
23544
  return obj.any.some(function(k6) {
23545
- return !!env7[k6];
23545
+ return !!env6[k6];
23546
23546
  });
23547
23547
  }
23548
23548
  return Object.keys(obj).every(function(k6) {
23549
- return env7[k6] === obj[k6];
23549
+ return env6[k6] === obj[k6];
23550
23550
  });
23551
23551
  }
23552
23552
  __name(checkEnv, "checkEnv");
@@ -28718,11 +28718,11 @@ var require_is_docker = __commonJS({
28718
28718
  "../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports2, module3) {
28719
28719
  "use strict";
28720
28720
  init_import_meta_url();
28721
- var fs29 = require("fs");
28721
+ var fs27 = require("fs");
28722
28722
  var isDocker;
28723
28723
  function hasDockerEnv() {
28724
28724
  try {
28725
- fs29.statSync("/.dockerenv");
28725
+ fs27.statSync("/.dockerenv");
28726
28726
  return true;
28727
28727
  } catch (_4) {
28728
28728
  return false;
@@ -28731,7 +28731,7 @@ var require_is_docker = __commonJS({
28731
28731
  __name(hasDockerEnv, "hasDockerEnv");
28732
28732
  function hasDockerCGroup() {
28733
28733
  try {
28734
- return fs29.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
28734
+ return fs27.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
28735
28735
  } catch (_4) {
28736
28736
  return false;
28737
28737
  }
@@ -28752,7 +28752,7 @@ var require_is_wsl = __commonJS({
28752
28752
  "use strict";
28753
28753
  init_import_meta_url();
28754
28754
  var os12 = require("os");
28755
- var fs29 = require("fs");
28755
+ var fs27 = require("fs");
28756
28756
  var isDocker = require_is_docker();
28757
28757
  var isWsl = /* @__PURE__ */ __name(() => {
28758
28758
  if (process.platform !== "linux") {
@@ -28765,7 +28765,7 @@ var require_is_wsl = __commonJS({
28765
28765
  return true;
28766
28766
  }
28767
28767
  try {
28768
- return fs29.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
28768
+ return fs27.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
28769
28769
  } catch (_4) {
28770
28770
  return false;
28771
28771
  }
@@ -28808,7 +28808,7 @@ var require_open = __commonJS({
28808
28808
  init_import_meta_url();
28809
28809
  var path72 = require("path");
28810
28810
  var childProcess2 = require("child_process");
28811
- var { promises: fs29, constants: fsConstants } = require("fs");
28811
+ var { promises: fs27, constants: fsConstants } = require("fs");
28812
28812
  var isWsl = require_is_wsl();
28813
28813
  var isDocker = require_is_docker();
28814
28814
  var defineLazyProperty = require_define_lazy_prop();
@@ -28824,14 +28824,14 @@ var require_open = __commonJS({
28824
28824
  const configFilePath = "/etc/wsl.conf";
28825
28825
  let isConfigFileExists = false;
28826
28826
  try {
28827
- await fs29.access(configFilePath, fsConstants.F_OK);
28827
+ await fs27.access(configFilePath, fsConstants.F_OK);
28828
28828
  isConfigFileExists = true;
28829
28829
  } catch {
28830
28830
  }
28831
28831
  if (!isConfigFileExists) {
28832
28832
  return defaultMountPoint;
28833
28833
  }
28834
- const configContent = await fs29.readFile(configFilePath, { encoding: "utf8" });
28834
+ const configContent = await fs27.readFile(configFilePath, { encoding: "utf8" });
28835
28835
  const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
28836
28836
  if (!configMountPoint) {
28837
28837
  return defaultMountPoint;
@@ -28931,7 +28931,7 @@ var require_open = __commonJS({
28931
28931
  const isBundled = !__dirname || __dirname === "/";
28932
28932
  let exeLocalXdgOpen = false;
28933
28933
  try {
28934
- await fs29.access(localXdgOpenPath, fsConstants.X_OK);
28934
+ await fs27.access(localXdgOpenPath, fsConstants.X_OK);
28935
28935
  exeLocalXdgOpen = true;
28936
28936
  } catch {
28937
28937
  }
@@ -29624,14 +29624,14 @@ var require_is_core_module = __commonJS({
29624
29624
  var require_async = __commonJS({
29625
29625
  "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/async.js"(exports2, module3) {
29626
29626
  init_import_meta_url();
29627
- var fs29 = require("fs");
29627
+ var fs27 = require("fs");
29628
29628
  var getHomedir = require_homedir();
29629
29629
  var path72 = require("path");
29630
29630
  var caller = require_caller();
29631
29631
  var nodeModulesPaths = require_node_modules_paths();
29632
29632
  var normalizeOptions = require_normalize_options();
29633
29633
  var isCore = require_is_core_module();
29634
- var realpathFS = process.platform !== "win32" && fs29.realpath && typeof fs29.realpath.native === "function" ? fs29.realpath.native : fs29.realpath;
29634
+ var realpathFS = process.platform !== "win32" && fs27.realpath && typeof fs27.realpath.native === "function" ? fs27.realpath.native : fs27.realpath;
29635
29635
  var homedir3 = getHomedir();
29636
29636
  var defaultPaths = /* @__PURE__ */ __name(function() {
29637
29637
  return [
@@ -29640,7 +29640,7 @@ var require_async = __commonJS({
29640
29640
  ];
29641
29641
  }, "defaultPaths");
29642
29642
  var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb2) {
29643
- fs29.stat(file, function(err, stat8) {
29643
+ fs27.stat(file, function(err, stat8) {
29644
29644
  if (!err) {
29645
29645
  return cb2(null, stat8.isFile() || stat8.isFIFO());
29646
29646
  }
@@ -29650,7 +29650,7 @@ var require_async = __commonJS({
29650
29650
  });
29651
29651
  }, "isFile");
29652
29652
  var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb2) {
29653
- fs29.stat(dir, function(err, stat8) {
29653
+ fs27.stat(dir, function(err, stat8) {
29654
29654
  if (!err) {
29655
29655
  return cb2(null, stat8.isDirectory());
29656
29656
  }
@@ -29674,8 +29674,8 @@ var require_async = __commonJS({
29674
29674
  cb2(null, x6);
29675
29675
  }
29676
29676
  }, "maybeRealpath");
29677
- var defaultReadPackage = /* @__PURE__ */ __name(function defaultReadPackage2(readFile18, pkgfile, cb2) {
29678
- readFile18(pkgfile, function(readFileErr, body) {
29677
+ var defaultReadPackage = /* @__PURE__ */ __name(function defaultReadPackage2(readFile17, pkgfile, cb2) {
29678
+ readFile17(pkgfile, function(readFileErr, body) {
29679
29679
  if (readFileErr)
29680
29680
  cb2(readFileErr);
29681
29681
  else {
@@ -29711,7 +29711,7 @@ var require_async = __commonJS({
29711
29711
  opts = normalizeOptions(x6, opts);
29712
29712
  var isFile = opts.isFile || defaultIsFile;
29713
29713
  var isDirectory2 = opts.isDirectory || defaultIsDir;
29714
- var readFile18 = opts.readFile || fs29.readFile;
29714
+ var readFile17 = opts.readFile || fs27.readFile;
29715
29715
  var realpath2 = opts.realpath || defaultRealpath;
29716
29716
  var readPackage = opts.readPackage || defaultReadPackage;
29717
29717
  if (opts.readFile && opts.readPackage) {
@@ -29858,7 +29858,7 @@ var require_async = __commonJS({
29858
29858
  isFile(pkgfile, function(err2, ex) {
29859
29859
  if (!ex)
29860
29860
  return loadpkg(path72.dirname(dir), cb3);
29861
- readPackage(readFile18, pkgfile, function(err3, pkgParam) {
29861
+ readPackage(readFile17, pkgfile, function(err3, pkgParam) {
29862
29862
  if (err3)
29863
29863
  cb3(err3);
29864
29864
  var pkg = pkgParam;
@@ -29887,7 +29887,7 @@ var require_async = __commonJS({
29887
29887
  return cb3(err2);
29888
29888
  if (!ex)
29889
29889
  return loadAsFile(path72.join(x7, "index"), fpkg, cb3);
29890
- readPackage(readFile18, pkgfile, function(err3, pkgParam) {
29890
+ readPackage(readFile17, pkgfile, function(err3, pkgParam) {
29891
29891
  if (err3)
29892
29892
  return cb3(err3);
29893
29893
  var pkg = pkgParam;
@@ -30170,13 +30170,13 @@ var require_sync = __commonJS({
30170
30170
  "../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js"(exports2, module3) {
30171
30171
  init_import_meta_url();
30172
30172
  var isCore = require_is_core_module();
30173
- var fs29 = require("fs");
30173
+ var fs27 = require("fs");
30174
30174
  var path72 = require("path");
30175
30175
  var getHomedir = require_homedir();
30176
30176
  var caller = require_caller();
30177
30177
  var nodeModulesPaths = require_node_modules_paths();
30178
30178
  var normalizeOptions = require_normalize_options();
30179
- var realpathFS = process.platform !== "win32" && fs29.realpathSync && typeof fs29.realpathSync.native === "function" ? fs29.realpathSync.native : fs29.realpathSync;
30179
+ var realpathFS = process.platform !== "win32" && fs27.realpathSync && typeof fs27.realpathSync.native === "function" ? fs27.realpathSync.native : fs27.realpathSync;
30180
30180
  var homedir3 = getHomedir();
30181
30181
  var defaultPaths = /* @__PURE__ */ __name(function() {
30182
30182
  return [
@@ -30186,7 +30186,7 @@ var require_sync = __commonJS({
30186
30186
  }, "defaultPaths");
30187
30187
  var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
30188
30188
  try {
30189
- var stat8 = fs29.statSync(file, { throwIfNoEntry: false });
30189
+ var stat8 = fs27.statSync(file, { throwIfNoEntry: false });
30190
30190
  } catch (e7) {
30191
30191
  if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR"))
30192
30192
  return false;
@@ -30196,7 +30196,7 @@ var require_sync = __commonJS({
30196
30196
  }, "isFile");
30197
30197
  var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
30198
30198
  try {
30199
- var stat8 = fs29.statSync(dir, { throwIfNoEntry: false });
30199
+ var stat8 = fs27.statSync(dir, { throwIfNoEntry: false });
30200
30200
  } catch (e7) {
30201
30201
  if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR"))
30202
30202
  return false;
@@ -30220,8 +30220,8 @@ var require_sync = __commonJS({
30220
30220
  }
30221
30221
  return x6;
30222
30222
  }, "maybeRealpathSync");
30223
- var defaultReadPackageSync = /* @__PURE__ */ __name(function defaultReadPackageSync2(readFileSync27, pkgfile) {
30224
- var body = readFileSync27(pkgfile);
30223
+ var defaultReadPackageSync = /* @__PURE__ */ __name(function defaultReadPackageSync2(readFileSync28, pkgfile) {
30224
+ var body = readFileSync28(pkgfile);
30225
30225
  try {
30226
30226
  var pkg = JSON.parse(body);
30227
30227
  return pkg;
@@ -30241,7 +30241,7 @@ var require_sync = __commonJS({
30241
30241
  }
30242
30242
  var opts = normalizeOptions(x6, options32);
30243
30243
  var isFile = opts.isFile || defaultIsFile;
30244
- var readFileSync27 = opts.readFileSync || fs29.readFileSync;
30244
+ var readFileSync28 = opts.readFileSync || fs27.readFileSync;
30245
30245
  var isDirectory2 = opts.isDirectory || defaultIsDir;
30246
30246
  var realpathSync4 = opts.realpathSync || defaultRealpathSync;
30247
30247
  var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
@@ -30304,7 +30304,7 @@ var require_sync = __commonJS({
30304
30304
  if (!isFile(pkgfile)) {
30305
30305
  return loadpkg(path72.dirname(dir));
30306
30306
  }
30307
- var pkg = readPackageSync(readFileSync27, pkgfile);
30307
+ var pkg = readPackageSync(readFileSync28, pkgfile);
30308
30308
  if (pkg && opts.packageFilter) {
30309
30309
  pkg = opts.packageFilter(
30310
30310
  pkg,
@@ -30319,7 +30319,7 @@ var require_sync = __commonJS({
30319
30319
  var pkgfile = path72.join(maybeRealpathSync(realpathSync4, x7, opts), "/package.json");
30320
30320
  if (isFile(pkgfile)) {
30321
30321
  try {
30322
- var pkg = readPackageSync(readFileSync27, pkgfile);
30322
+ var pkg = readPackageSync(readFileSync28, pkgfile);
30323
30323
  } catch (e7) {
30324
30324
  }
30325
30325
  if (pkg && opts.packageFilter) {
@@ -30630,7 +30630,7 @@ var require_utils3 = __commonJS({
30630
30630
  "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports2) {
30631
30631
  "use strict";
30632
30632
  init_import_meta_url();
30633
- var fs29 = require("fs");
30633
+ var fs27 = require("fs");
30634
30634
  var ini = require_ini();
30635
30635
  var path72 = require("path");
30636
30636
  var stripJsonComments = require_strip_json_comments();
@@ -30649,7 +30649,7 @@ var require_utils3 = __commonJS({
30649
30649
  var file2 = path72.join.apply(null, args);
30650
30650
  var content;
30651
30651
  try {
30652
- return fs29.readFileSync(file2, "utf-8");
30652
+ return fs27.readFileSync(file2, "utf-8");
30653
30653
  } catch (err) {
30654
30654
  return;
30655
30655
  }
@@ -30658,11 +30658,11 @@ var require_utils3 = __commonJS({
30658
30658
  var content = file.apply(null, arguments);
30659
30659
  return content ? parse7(content) : null;
30660
30660
  };
30661
- var env7 = exports2.env = function(prefix, env8) {
30662
- env8 = env8 || process.env;
30661
+ var env6 = exports2.env = function(prefix, env7) {
30662
+ env7 = env7 || process.env;
30663
30663
  var obj = {};
30664
30664
  var l6 = prefix.length;
30665
- for (var k6 in env8) {
30665
+ for (var k6 in env7) {
30666
30666
  if (k6.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
30667
30667
  var keypath = k6.substring(l6).split("__");
30668
30668
  var _emptyStringIndex;
@@ -30674,7 +30674,7 @@ var require_utils3 = __commonJS({
30674
30674
  if (!_subkey || typeof cursor !== "object")
30675
30675
  return;
30676
30676
  if (i5 === keypath.length - 1)
30677
- cursor[_subkey] = env8[k6];
30677
+ cursor[_subkey] = env7[k6];
30678
30678
  if (cursor[_subkey] === void 0)
30679
30679
  cursor[_subkey] = {};
30680
30680
  cursor = cursor[_subkey];
@@ -30688,7 +30688,7 @@ var require_utils3 = __commonJS({
30688
30688
  function find2(start, rel2) {
30689
30689
  var file2 = path72.join(start, rel2);
30690
30690
  try {
30691
- fs29.statSync(file2);
30691
+ fs27.statSync(file2);
30692
30692
  return file2;
30693
30693
  } catch (err) {
30694
30694
  if (path72.dirname(start) !== start)
@@ -31020,7 +31020,7 @@ var require_rc = __commonJS({
31020
31020
  argv = require_minimist()(process.argv.slice(2));
31021
31021
  defaults = ("string" === typeof defaults ? cc2.json(defaults) : defaults) || {};
31022
31022
  parse7 = parse7 || cc2.parse;
31023
- var env7 = cc2.env(name2 + "_");
31023
+ var env6 = cc2.env(name2 + "_");
31024
31024
  var configs = [defaults];
31025
31025
  var configFiles = [];
31026
31026
  function addConfigFile(file) {
@@ -31046,12 +31046,12 @@ var require_rc = __commonJS({
31046
31046
  join23(home, "." + name2 + "rc")
31047
31047
  ].forEach(addConfigFile);
31048
31048
  addConfigFile(cc2.find("." + name2 + "rc"));
31049
- if (env7.config)
31050
- addConfigFile(env7.config);
31049
+ if (env6.config)
31050
+ addConfigFile(env6.config);
31051
31051
  if (argv.config)
31052
31052
  addConfigFile(argv.config);
31053
31053
  return deepExtend.apply(null, configs.concat([
31054
- env7,
31054
+ env6,
31055
31055
  argv,
31056
31056
  configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
31057
31057
  ]));
@@ -31258,19 +31258,19 @@ var require_update_check = __commonJS({
31258
31258
  init_import_meta_url();
31259
31259
  var { URL: URL7 } = require("url");
31260
31260
  var { join: join23 } = require("path");
31261
- var fs29 = require("fs");
31261
+ var fs27 = require("fs");
31262
31262
  var { promisify: promisify3 } = require("util");
31263
31263
  var { tmpdir } = require("os");
31264
31264
  var registryUrl = require_registry_url();
31265
- var writeFile12 = promisify3(fs29.writeFile);
31266
- var mkdir7 = promisify3(fs29.mkdir);
31267
- var readFile18 = promisify3(fs29.readFile);
31265
+ var writeFile12 = promisify3(fs27.writeFile);
31266
+ var mkdir7 = promisify3(fs27.mkdir);
31267
+ var readFile17 = promisify3(fs27.readFile);
31268
31268
  var compareVersions = /* @__PURE__ */ __name((a5, b6) => a5.localeCompare(b6, "en-US", { numeric: true }), "compareVersions");
31269
31269
  var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
31270
31270
  var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
31271
31271
  const rootDir = tmpdir();
31272
31272
  const subDir = join23(rootDir, "update-check");
31273
- if (!fs29.existsSync(subDir)) {
31273
+ if (!fs27.existsSync(subDir)) {
31274
31274
  await mkdir7(subDir);
31275
31275
  }
31276
31276
  let name2 = `${details.name}-${distTag}.json`;
@@ -31280,8 +31280,8 @@ var require_update_check = __commonJS({
31280
31280
  return join23(subDir, name2);
31281
31281
  }, "getFile");
31282
31282
  var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval) => {
31283
- if (fs29.existsSync(file)) {
31284
- const content = await readFile18(file, "utf8");
31283
+ if (fs27.existsSync(file)) {
31284
+ const content = await readFile17(file, "utf8");
31285
31285
  const { lastUpdate, latest } = JSON.parse(content);
31286
31286
  const nextCheck = lastUpdate + interval;
31287
31287
  if (nextCheck > time) {
@@ -53933,7 +53933,7 @@ var require_windows = __commonJS({
53933
53933
  init_import_meta_url();
53934
53934
  module3.exports = isexe;
53935
53935
  isexe.sync = sync;
53936
- var fs29 = require("fs");
53936
+ var fs27 = require("fs");
53937
53937
  function checkPathExt(path72, options32) {
53938
53938
  var pathext = options32.pathExt !== void 0 ? options32.pathExt : process.env.PATHEXT;
53939
53939
  if (!pathext) {
@@ -53960,13 +53960,13 @@ var require_windows = __commonJS({
53960
53960
  }
53961
53961
  __name(checkStat, "checkStat");
53962
53962
  function isexe(path72, options32, cb2) {
53963
- fs29.stat(path72, function(er, stat8) {
53963
+ fs27.stat(path72, function(er, stat8) {
53964
53964
  cb2(er, er ? false : checkStat(stat8, path72, options32));
53965
53965
  });
53966
53966
  }
53967
53967
  __name(isexe, "isexe");
53968
53968
  function sync(path72, options32) {
53969
- return checkStat(fs29.statSync(path72), path72, options32);
53969
+ return checkStat(fs27.statSync(path72), path72, options32);
53970
53970
  }
53971
53971
  __name(sync, "sync");
53972
53972
  }
@@ -53978,15 +53978,15 @@ var require_mode = __commonJS({
53978
53978
  init_import_meta_url();
53979
53979
  module3.exports = isexe;
53980
53980
  isexe.sync = sync;
53981
- var fs29 = require("fs");
53981
+ var fs27 = require("fs");
53982
53982
  function isexe(path72, options32, cb2) {
53983
- fs29.stat(path72, function(er, stat8) {
53983
+ fs27.stat(path72, function(er, stat8) {
53984
53984
  cb2(er, er ? false : checkStat(stat8, options32));
53985
53985
  });
53986
53986
  }
53987
53987
  __name(isexe, "isexe");
53988
53988
  function sync(path72, options32) {
53989
- return checkStat(fs29.statSync(path72), options32);
53989
+ return checkStat(fs27.statSync(path72), options32);
53990
53990
  }
53991
53991
  __name(sync, "sync");
53992
53992
  function checkStat(stat8, options32) {
@@ -54014,7 +54014,7 @@ var require_mode = __commonJS({
54014
54014
  var require_isexe = __commonJS({
54015
54015
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module3) {
54016
54016
  init_import_meta_url();
54017
- var fs29 = require("fs");
54017
+ var fs27 = require("fs");
54018
54018
  var core;
54019
54019
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
54020
54020
  core = require_windows();
@@ -54192,7 +54192,7 @@ var require_resolveCommand = __commonJS({
54192
54192
  var which = require_which();
54193
54193
  var getPathKey = require_path_key();
54194
54194
  function resolveCommandAttempt(parsed, withoutPathExt) {
54195
- const env7 = parsed.options.env || process.env;
54195
+ const env6 = parsed.options.env || process.env;
54196
54196
  const cwd2 = process.cwd();
54197
54197
  const hasCustomCwd = parsed.options.cwd != null;
54198
54198
  const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
@@ -54205,7 +54205,7 @@ var require_resolveCommand = __commonJS({
54205
54205
  let resolved;
54206
54206
  try {
54207
54207
  resolved = which.sync(parsed.command, {
54208
- path: env7[getPathKey({ env: env7 })],
54208
+ path: env6[getPathKey({ env: env6 })],
54209
54209
  pathExt: withoutPathExt ? path72.delimiter : void 0
54210
54210
  });
54211
54211
  } catch (e7) {
@@ -54291,16 +54291,16 @@ var require_readShebang = __commonJS({
54291
54291
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module3) {
54292
54292
  "use strict";
54293
54293
  init_import_meta_url();
54294
- var fs29 = require("fs");
54294
+ var fs27 = require("fs");
54295
54295
  var shebangCommand = require_shebang_command();
54296
54296
  function readShebang(command2) {
54297
54297
  const size = 150;
54298
54298
  const buffer = Buffer.alloc(size);
54299
54299
  let fd;
54300
54300
  try {
54301
- fd = fs29.openSync(command2, "r");
54302
- fs29.readSync(fd, buffer, 0, size, 0);
54303
- fs29.closeSync(fd);
54301
+ fd = fs27.openSync(command2, "r");
54302
+ fs27.readSync(fd, buffer, 0, size, 0);
54303
+ fs27.closeSync(fd);
54304
54304
  } catch (e7) {
54305
54305
  }
54306
54306
  return shebangCommand(buffer.toString());
@@ -54616,11 +54616,11 @@ var require_command_exists = __commonJS({
54616
54616
  init_import_meta_url();
54617
54617
  var exec3 = require("child_process").exec;
54618
54618
  var execSync4 = require("child_process").execSync;
54619
- var fs29 = require("fs");
54619
+ var fs27 = require("fs");
54620
54620
  var path72 = require("path");
54621
- var access3 = fs29.access;
54622
- var accessSync = fs29.accessSync;
54623
- var constants3 = fs29.constants || fs29;
54621
+ var access3 = fs27.access;
54622
+ var accessSync = fs27.accessSync;
54623
+ var constants3 = fs27.constants || fs27;
54624
54624
  var isUsingWindows = process.platform == "win32";
54625
54625
  var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
54626
54626
  access3(
@@ -54771,20 +54771,20 @@ var require_md5_file = __commonJS({
54771
54771
  "../../node_modules/.pnpm/md5-file@5.0.0/node_modules/md5-file/index.js"(exports2, module3) {
54772
54772
  init_import_meta_url();
54773
54773
  var crypto8 = require("crypto");
54774
- var fs29 = require("fs");
54774
+ var fs27 = require("fs");
54775
54775
  var BUFFER_SIZE = 8192;
54776
54776
  function md5FileSync(path72) {
54777
- const fd = fs29.openSync(path72, "r");
54777
+ const fd = fs27.openSync(path72, "r");
54778
54778
  const hash = crypto8.createHash("md5");
54779
54779
  const buffer = Buffer.alloc(BUFFER_SIZE);
54780
54780
  try {
54781
54781
  let bytesRead;
54782
54782
  do {
54783
- bytesRead = fs29.readSync(fd, buffer, 0, BUFFER_SIZE);
54783
+ bytesRead = fs27.readSync(fd, buffer, 0, BUFFER_SIZE);
54784
54784
  hash.update(buffer.slice(0, bytesRead));
54785
54785
  } while (bytesRead === BUFFER_SIZE);
54786
54786
  } finally {
54787
- fs29.closeSync(fd);
54787
+ fs27.closeSync(fd);
54788
54788
  }
54789
54789
  return hash.digest("hex");
54790
54790
  }
@@ -54792,7 +54792,7 @@ var require_md5_file = __commonJS({
54792
54792
  function md5File2(path72) {
54793
54793
  return new Promise((resolve24, reject) => {
54794
54794
  const output = crypto8.createHash("md5");
54795
- const input = fs29.createReadStream(path72);
54795
+ const input = fs27.createReadStream(path72);
54796
54796
  input.on("error", (err) => {
54797
54797
  reject(err);
54798
54798
  });
@@ -54876,8 +54876,8 @@ var require_parse4 = __commonJS({
54876
54876
  return matches;
54877
54877
  }
54878
54878
  __name(matchAll, "matchAll");
54879
- function getVar(env7, pre, key) {
54880
- var r7 = typeof env7 === "function" ? env7(key) : env7[key];
54879
+ function getVar(env6, pre, key) {
54880
+ var r7 = typeof env6 === "function" ? env6(key) : env6[key];
54881
54881
  if (typeof r7 === "undefined" && key != "") {
54882
54882
  r7 = "";
54883
54883
  } else if (typeof r7 === "undefined") {
@@ -54889,7 +54889,7 @@ var require_parse4 = __commonJS({
54889
54889
  return pre + r7;
54890
54890
  }
54891
54891
  __name(getVar, "getVar");
54892
- function parseInternal(string, env7, opts) {
54892
+ function parseInternal(string, env6, opts) {
54893
54893
  if (!opts) {
54894
54894
  opts = {};
54895
54895
  }
@@ -54904,8 +54904,8 @@ var require_parse4 = __commonJS({
54904
54904
  if (matches.length === 0) {
54905
54905
  return [];
54906
54906
  }
54907
- if (!env7) {
54908
- env7 = {};
54907
+ if (!env6) {
54908
+ env6 = {};
54909
54909
  }
54910
54910
  var commented = false;
54911
54911
  return matches.map(function(match2) {
@@ -54951,7 +54951,7 @@ var require_parse4 = __commonJS({
54951
54951
  i6 += varend.index - 1;
54952
54952
  }
54953
54953
  }
54954
- return getVar(env7, "", varname);
54954
+ return getVar(env6, "", varname);
54955
54955
  }
54956
54956
  __name(parseEnvVar, "parseEnvVar");
54957
54957
  for (i6 = 0; i6 < s5.length; i6++) {
@@ -55008,9 +55008,9 @@ var require_parse4 = __commonJS({
55008
55008
  }, []);
55009
55009
  }
55010
55010
  __name(parseInternal, "parseInternal");
55011
- module3.exports = /* @__PURE__ */ __name(function parse7(s5, env7, opts) {
55012
- var mapped = parseInternal(s5, env7, opts);
55013
- if (typeof env7 !== "function") {
55011
+ module3.exports = /* @__PURE__ */ __name(function parse7(s5, env6, opts) {
55012
+ var mapped = parseInternal(s5, env6, opts);
55013
+ if (typeof env6 !== "function") {
55014
55014
  return mapped;
55015
55015
  }
55016
55016
  return mapped.reduce(function(acc, s6) {
@@ -55851,15 +55851,15 @@ var require_minimatch = __commonJS({
55851
55851
  });
55852
55852
 
55853
55853
  // src/pages/hash.ts
55854
- var import_node_fs26, import_node_path49, import_blake3_wasm, hashFile;
55854
+ var import_node_fs24, import_node_path49, import_blake3_wasm, hashFile;
55855
55855
  var init_hash = __esm({
55856
55856
  "src/pages/hash.ts"() {
55857
55857
  init_import_meta_url();
55858
- import_node_fs26 = require("node:fs");
55858
+ import_node_fs24 = require("node:fs");
55859
55859
  import_node_path49 = require("node:path");
55860
55860
  import_blake3_wasm = require("blake3-wasm");
55861
55861
  hashFile = /* @__PURE__ */ __name((filepath) => {
55862
- const contents = (0, import_node_fs26.readFileSync)(filepath);
55862
+ const contents = (0, import_node_fs24.readFileSync)(filepath);
55863
55863
  const base64Contents = contents.toString("base64");
55864
55864
  const extension = (0, import_node_path49.extname)(filepath).substring(1);
55865
55865
  return (0, import_blake3_wasm.hash)(base64Contents + extension).toString("hex").slice(0, 32);
@@ -55992,7 +55992,7 @@ var require_ms = __commonJS({
55992
55992
  var require_common = __commonJS({
55993
55993
  "../../node_modules/.pnpm/debug@4.3.7_supports-color@9.2.2/node_modules/debug/src/common.js"(exports2, module3) {
55994
55994
  init_import_meta_url();
55995
- function setup(env7) {
55995
+ function setup(env6) {
55996
55996
  createDebug.debug = createDebug;
55997
55997
  createDebug.default = createDebug;
55998
55998
  createDebug.coerce = coerce2;
@@ -56001,8 +56001,8 @@ var require_common = __commonJS({
56001
56001
  createDebug.enabled = enabled;
56002
56002
  createDebug.humanize = require_ms();
56003
56003
  createDebug.destroy = destroy;
56004
- Object.keys(env7).forEach((key) => {
56005
- createDebug[key] = env7[key];
56004
+ Object.keys(env6).forEach((key) => {
56005
+ createDebug[key] = env6[key];
56006
56006
  });
56007
56007
  createDebug.names = [];
56008
56008
  createDebug.skips = [];
@@ -61787,9 +61787,9 @@ var init_resolveAwsSdkSigV4AConfig = __esm({
61787
61787
  return config;
61788
61788
  }, "resolveAwsSdkSigV4AConfig");
61789
61789
  NODE_SIGV4A_CONFIG_OPTIONS = {
61790
- environmentVariableSelector(env7) {
61791
- if (env7.AWS_SIGV4A_SIGNING_REGION_SET) {
61792
- return env7.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_4) => _4.trim());
61790
+ environmentVariableSelector(env6) {
61791
+ if (env6.AWS_SIGV4A_SIGNING_REGION_SET) {
61792
+ return env6.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_4) => _4.trim());
61793
61793
  }
61794
61794
  throw new ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
61795
61795
  tryNextLink: true
@@ -67338,7 +67338,7 @@ var init_NodeUseDualstackEndpointConfigOptions = __esm({
67338
67338
  ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
67339
67339
  CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
67340
67340
  NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
67341
- environmentVariableSelector: (env7) => booleanSelector(env7, ENV_USE_DUALSTACK_ENDPOINT, SelectorType2.ENV),
67341
+ environmentVariableSelector: (env6) => booleanSelector(env6, ENV_USE_DUALSTACK_ENDPOINT, SelectorType2.ENV),
67342
67342
  configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType2.CONFIG),
67343
67343
  default: false
67344
67344
  };
@@ -67354,7 +67354,7 @@ var init_NodeUseFipsEndpointConfigOptions = __esm({
67354
67354
  ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
67355
67355
  CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
67356
67356
  NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
67357
- environmentVariableSelector: (env7) => booleanSelector(env7, ENV_USE_FIPS_ENDPOINT, SelectorType2.ENV),
67357
+ environmentVariableSelector: (env6) => booleanSelector(env6, ENV_USE_FIPS_ENDPOINT, SelectorType2.ENV),
67358
67358
  configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType2.CONFIG),
67359
67359
  default: false
67360
67360
  };
@@ -67404,7 +67404,7 @@ var init_config2 = __esm({
67404
67404
  REGION_ENV_NAME = "AWS_REGION";
67405
67405
  REGION_INI_NAME = "region";
67406
67406
  NODE_REGION_CONFIG_OPTIONS = {
67407
- environmentVariableSelector: (env7) => env7[REGION_ENV_NAME],
67407
+ environmentVariableSelector: (env6) => env6[REGION_ENV_NAME],
67408
67408
  configFileSelector: (profile) => profile[REGION_INI_NAME],
67409
67409
  default: () => {
67410
67410
  throw new Error("Region is missing");
@@ -68116,12 +68116,12 @@ var init_getEndpointUrlConfig = __esm({
68116
68116
  ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
68117
68117
  CONFIG_ENDPOINT_URL = "endpoint_url";
68118
68118
  getEndpointUrlConfig = /* @__PURE__ */ __name((serviceId) => ({
68119
- environmentVariableSelector: (env7) => {
68119
+ environmentVariableSelector: (env6) => {
68120
68120
  const serviceSuffixParts = serviceId.split(" ").map((w6) => w6.toUpperCase());
68121
- const serviceEndpointUrl = env7[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
68121
+ const serviceEndpointUrl = env6[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
68122
68122
  if (serviceEndpointUrl)
68123
68123
  return serviceEndpointUrl;
68124
- const endpointUrl = env7[ENV_ENDPOINT_URL];
68124
+ const endpointUrl = env6[ENV_ENDPOINT_URL];
68125
68125
  if (endpointUrl)
68126
68126
  return endpointUrl;
68127
68127
  return void 0;
@@ -68942,8 +68942,8 @@ var init_configurations2 = __esm({
68942
68942
  ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
68943
68943
  CONFIG_MAX_ATTEMPTS = "max_attempts";
68944
68944
  NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
68945
- environmentVariableSelector: (env7) => {
68946
- const value = env7[ENV_MAX_ATTEMPTS];
68945
+ environmentVariableSelector: (env6) => {
68946
+ const value = env6[ENV_MAX_ATTEMPTS];
68947
68947
  if (!value)
68948
68948
  return void 0;
68949
68949
  const maxAttempt = parseInt(value);
@@ -68985,7 +68985,7 @@ var init_configurations2 = __esm({
68985
68985
  ENV_RETRY_MODE = "AWS_RETRY_MODE";
68986
68986
  CONFIG_RETRY_MODE = "retry_mode";
68987
68987
  NODE_RETRY_MODE_CONFIG_OPTIONS = {
68988
- environmentVariableSelector: (env7) => env7[ENV_RETRY_MODE],
68988
+ environmentVariableSelector: (env6) => env6[ENV_RETRY_MODE],
68989
68989
  configFileSelector: (profile) => profile[CONFIG_RETRY_MODE],
68990
68990
  default: DEFAULT_RETRY_MODE
68991
68991
  };
@@ -69404,7 +69404,7 @@ var init_EndpointConfigOptions = __esm({
69404
69404
  ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT";
69405
69405
  CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint";
69406
69406
  ENDPOINT_CONFIG_OPTIONS = {
69407
- environmentVariableSelector: (env7) => env7[ENV_ENDPOINT_NAME],
69407
+ environmentVariableSelector: (env6) => env6[ENV_ENDPOINT_NAME],
69408
69408
  configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME],
69409
69409
  default: void 0
69410
69410
  };
@@ -69432,7 +69432,7 @@ var init_EndpointModeConfigOptions = __esm({
69432
69432
  ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";
69433
69433
  CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode";
69434
69434
  ENDPOINT_MODE_CONFIG_OPTIONS = {
69435
- environmentVariableSelector: (env7) => env7[ENV_ENDPOINT_MODE_NAME],
69435
+ environmentVariableSelector: (env6) => env6[ENV_ENDPOINT_MODE_NAME],
69436
69436
  configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME],
69437
69437
  default: EndpointMode.IPv4
69438
69438
  };
@@ -69550,8 +69550,8 @@ var init_fromInstanceMetadata = __esm({
69550
69550
  let fallbackBlockedFromProfile = false;
69551
69551
  let fallbackBlockedFromProcessEnv = false;
69552
69552
  const configValue = await loadConfig({
69553
- environmentVariableSelector: (env7) => {
69554
- const envValue = env7[AWS_EC2_METADATA_V1_DISABLED];
69553
+ environmentVariableSelector: (env6) => {
69554
+ const envValue = env6[AWS_EC2_METADATA_V1_DISABLED];
69555
69555
  fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
69556
69556
  if (envValue === void 0) {
69557
69557
  throw new CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init2.logger });
@@ -70198,7 +70198,7 @@ var init_nodeAppIdConfigOptions = __esm({
70198
70198
  UA_APP_ID_INI_NAME = "sdk_ua_app_id";
70199
70199
  UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
70200
70200
  NODE_APP_ID_CONFIG_OPTIONS = {
70201
- environmentVariableSelector: (env7) => env7[UA_APP_ID_ENV_NAME],
70201
+ environmentVariableSelector: (env6) => env6[UA_APP_ID_ENV_NAME],
70202
70202
  configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED],
70203
70203
  default: DEFAULT_UA_APP_ID
70204
70204
  };
@@ -70414,8 +70414,8 @@ var init_defaultsModeConfig = __esm({
70414
70414
  AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
70415
70415
  AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
70416
70416
  NODE_DEFAULTS_MODE_CONFIG_OPTIONS = {
70417
- environmentVariableSelector: (env7) => {
70418
- return env7[AWS_DEFAULTS_MODE_ENV];
70417
+ environmentVariableSelector: (env6) => {
70418
+ return env6[AWS_DEFAULTS_MODE_ENV];
70419
70419
  },
70420
70420
  configFileSelector: (profile) => {
70421
70421
  return profile[AWS_DEFAULTS_MODE_CONFIG];
@@ -75609,7 +75609,7 @@ var init_dist_es54 = __esm({
75609
75609
  var require_common2 = __commonJS({
75610
75610
  "../../node_modules/.pnpm/debug@4.4.0_supports-color@9.2.2/node_modules/debug/src/common.js"(exports2, module3) {
75611
75611
  init_import_meta_url();
75612
- function setup(env7) {
75612
+ function setup(env6) {
75613
75613
  createDebug.debug = createDebug;
75614
75614
  createDebug.default = createDebug;
75615
75615
  createDebug.coerce = coerce2;
@@ -75618,8 +75618,8 @@ var require_common2 = __commonJS({
75618
75618
  createDebug.enabled = enabled;
75619
75619
  createDebug.humanize = require_ms();
75620
75620
  createDebug.destroy = destroy;
75621
- Object.keys(env7).forEach((key) => {
75622
- createDebug[key] = env7[key];
75621
+ Object.keys(env6).forEach((key) => {
75622
+ createDebug[key] = env6[key];
75623
75623
  });
75624
75624
  createDebug.names = [];
75625
75625
  createDebug.skips = [];
@@ -78987,13 +78987,13 @@ async function generateAssetsFetch(directory, log2) {
78987
78987
  const workerFile = (0, import_node_path64.join)(directory, "_worker.js");
78988
78988
  const ignoredFiles = [headersFile, redirectsFile, workerFile];
78989
78989
  let redirects;
78990
- if ((0, import_node_fs36.existsSync)(redirectsFile)) {
78991
- const contents = (0, import_node_fs36.readFileSync)(redirectsFile, "utf-8");
78990
+ if ((0, import_node_fs34.existsSync)(redirectsFile)) {
78991
+ const contents = (0, import_node_fs34.readFileSync)(redirectsFile, "utf-8");
78992
78992
  redirects = parseRedirects(contents);
78993
78993
  }
78994
78994
  let headers;
78995
- if ((0, import_node_fs36.existsSync)(headersFile)) {
78996
- const contents = (0, import_node_fs36.readFileSync)(headersFile, "utf-8");
78995
+ if ((0, import_node_fs34.existsSync)(headersFile)) {
78996
+ const contents = (0, import_node_fs34.readFileSync)(headersFile, "utf-8");
78997
78997
  headers = parseHeaders(contents);
78998
78998
  }
78999
78999
  let metadata = createMetadataObject({
@@ -79009,13 +79009,13 @@ async function generateAssetsFetch(directory, log2) {
79009
79009
  switch (path72) {
79010
79010
  case headersFile: {
79011
79011
  log2.log("_headers modified. Re-evaluating...");
79012
- const contents = (0, import_node_fs36.readFileSync)(headersFile).toString();
79012
+ const contents = (0, import_node_fs34.readFileSync)(headersFile).toString();
79013
79013
  headers = parseHeaders(contents);
79014
79014
  break;
79015
79015
  }
79016
79016
  case redirectsFile: {
79017
79017
  log2.log("_redirects modified. Re-evaluating...");
79018
- const contents = (0, import_node_fs36.readFileSync)(redirectsFile).toString();
79018
+ const contents = (0, import_node_fs34.readFileSync)(redirectsFile).toString();
79019
79019
  redirects = parseRedirects(contents);
79020
79020
  break;
79021
79021
  }
@@ -79041,7 +79041,7 @@ async function generateAssetsFetch(directory, log2) {
79041
79041
  if (!filepath.startsWith(directory)) {
79042
79042
  return null;
79043
79043
  }
79044
- if ((0, import_node_fs36.existsSync)(filepath) && (0, import_node_fs36.lstatSync)(filepath).isFile() && !ignoredFiles.includes(filepath)) {
79044
+ if ((0, import_node_fs34.existsSync)(filepath) && (0, import_node_fs34.lstatSync)(filepath).isFile() && !ignoredFiles.includes(filepath)) {
79045
79045
  const hash = hashFile(filepath);
79046
79046
  assetKeyEntryMap.set(hash, filepath);
79047
79047
  return hash;
@@ -79071,7 +79071,7 @@ async function generateAssetsFetch(directory, log2) {
79071
79071
  "Could not fetch asset. Please file an issue on GitHub (https://github.com/cloudflare/workers-sdk/issues/new/choose) with reproduction steps."
79072
79072
  );
79073
79073
  }
79074
- const body = (0, import_node_fs36.readFileSync)(filepath);
79074
+ const body = (0, import_node_fs34.readFileSync)(filepath);
79075
79075
  let contentType = (0, import_mime3.getType)(filepath) || "application/octet-stream";
79076
79076
  if (contentType.startsWith("text/") && !contentType.includes("charset")) {
79077
79077
  contentType = `${contentType}; charset=utf-8`;
@@ -79085,12 +79085,12 @@ async function generateAssetsFetch(directory, log2) {
79085
79085
  return await generateResponse(request4);
79086
79086
  };
79087
79087
  }
79088
- var import_node_assert26, import_node_fs36, import_node_path64, import_mime3, import_miniflare25, import_undici23, ProxyDispatcher, invalidAssetsFetch;
79088
+ var import_node_assert26, import_node_fs34, import_node_path64, import_mime3, import_miniflare25, import_undici23, ProxyDispatcher, invalidAssetsFetch;
79089
79089
  var init_assets = __esm({
79090
79090
  "src/miniflare-cli/assets.ts"() {
79091
79091
  init_import_meta_url();
79092
79092
  import_node_assert26 = __toESM(require("node:assert"));
79093
- import_node_fs36 = require("node:fs");
79093
+ import_node_fs34 = require("node:fs");
79094
79094
  import_node_path64 = require("node:path");
79095
79095
  init_createMetadataObject();
79096
79096
  init_parseHeaders();
@@ -79921,8 +79921,8 @@ var YargsParser = class {
79921
79921
  if (typeof envPrefix === "undefined")
79922
79922
  return;
79923
79923
  const prefix = typeof envPrefix === "string" ? envPrefix : "";
79924
- const env7 = mixin.env();
79925
- Object.keys(env7).forEach(function(envVar) {
79924
+ const env6 = mixin.env();
79925
+ Object.keys(env6).forEach(function(envVar) {
79926
79926
  if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
79927
79927
  const keys = envVar.split("__").map(function(key, i5) {
79928
79928
  if (i5 === 0) {
@@ -79931,7 +79931,7 @@ var YargsParser = class {
79931
79931
  return camelCase(key);
79932
79932
  });
79933
79933
  if ((configOnly && flags2.configs[keys.join(".")] || !configOnly) && !hasKey2(argv2, keys)) {
79934
- setArg(keys.join("."), env7[envVar]);
79934
+ setArg(keys.join("."), env6[envVar]);
79935
79935
  }
79936
79936
  }
79937
79937
  });
@@ -81430,7 +81430,7 @@ var import_undici3 = __toESM(require_undici());
81430
81430
 
81431
81431
  // package.json
81432
81432
  var name = "wrangler";
81433
- var version = "3.112.0";
81433
+ var version = "3.113.0";
81434
81434
 
81435
81435
  // src/environment-variables/misc-variables.ts
81436
81436
  init_import_meta_url();
@@ -81645,6 +81645,20 @@ function createPatternMatcher(patterns, exclude2) {
81645
81645
  }
81646
81646
  }
81647
81647
  __name(createPatternMatcher, "createPatternMatcher");
81648
+ function thrownIsDoesNotExistError(thrown) {
81649
+ return thrown instanceof Error && "code" in thrown && thrown.code === "ENOENT";
81650
+ }
81651
+ __name(thrownIsDoesNotExistError, "thrownIsDoesNotExistError");
81652
+ function maybeGetFile(filePath) {
81653
+ try {
81654
+ return (0, import_fs5.readFileSync)(filePath, "utf8");
81655
+ } catch (e7) {
81656
+ if (!thrownIsDoesNotExistError(e7)) {
81657
+ throw e7;
81658
+ }
81659
+ }
81660
+ }
81661
+ __name(maybeGetFile, "maybeGetFile");
81648
81662
 
81649
81663
  // src/utils/log-file.ts
81650
81664
  var getDebugFileDir = getEnvironmentVariableFactory({
@@ -83407,7 +83421,7 @@ function readFileSyncToBuffer(file) {
83407
83421
  }
83408
83422
  }
83409
83423
  __name(readFileSyncToBuffer, "readFileSyncToBuffer");
83410
- function readFileSync5(file) {
83424
+ function readFileSync6(file) {
83411
83425
  try {
83412
83426
  return fs2.readFileSync(file, { encoding: "utf-8" });
83413
83427
  } catch (err) {
@@ -83423,7 +83437,7 @@ function readFileSync5(file) {
83423
83437
  });
83424
83438
  }
83425
83439
  }
83426
- __name(readFileSync5, "readFileSync");
83440
+ __name(readFileSync6, "readFileSync");
83427
83441
  function indexLocation(file, index) {
83428
83442
  let lineText, line = 0, column = 0, cursor = 0;
83429
83443
  const { fileText = "" } = file;
@@ -83520,7 +83534,7 @@ init_import_meta_url();
83520
83534
  init_import_meta_url();
83521
83535
  var import_node_assert2 = __toESM(require("node:assert"));
83522
83536
  var import_node_crypto2 = require("node:crypto");
83523
- var import_node_fs5 = require("node:fs");
83537
+ var import_node_fs4 = require("node:fs");
83524
83538
  var import_node_http = __toESM(require("node:http"));
83525
83539
  var import_node_path10 = __toESM(require("node:path"));
83526
83540
  var import_node_url4 = __toESM(require("node:url"));
@@ -83530,7 +83544,6 @@ var import_undici2 = __toESM(require_undici());
83530
83544
 
83531
83545
  // src/config/index.ts
83532
83546
  init_import_meta_url();
83533
- var import_node_fs4 = __toESM(require("node:fs"));
83534
83547
  var import_node_path9 = __toESM(require("node:path"));
83535
83548
  var import_toml3 = __toESM(require_toml());
83536
83549
  var import_dotenv = __toESM(require_main2());
@@ -84104,7 +84117,7 @@ function findRedirectedWranglerConfig(cwd2, userConfigPath) {
84104
84117
  return userConfigPath;
84105
84118
  }
84106
84119
  let redirectedConfigPath;
84107
- const deployConfigFile = readFileSync5(deployConfigPath);
84120
+ const deployConfigFile = readFileSync6(deployConfigPath);
84108
84121
  try {
84109
84122
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
84110
84123
  redirectedConfigPath = deployConfig.configPath && import_node_path7.default.resolve(import_node_path7.default.dirname(deployConfigPath), deployConfig.configPath);
@@ -88233,9 +88246,9 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options32 = {}) =
88233
88246
  );
88234
88247
  let rawConfig = {};
88235
88248
  if (configPath?.endsWith("toml")) {
88236
- rawConfig = parseTOML(readFileSync5(configPath), configPath);
88249
+ rawConfig = parseTOML(readFileSync6(configPath), configPath);
88237
88250
  } else if (configPath?.endsWith("json") || configPath?.endsWith("jsonc")) {
88238
- rawConfig = parseJSONC(readFileSync5(configPath), configPath);
88251
+ rawConfig = parseJSONC(readFileSync6(configPath), configPath);
88239
88252
  }
88240
88253
  return { rawConfig, configPath, userConfigPath };
88241
88254
  }, "experimental_readRawConfig");
@@ -88247,27 +88260,28 @@ function withConfig(handler31, options32) {
88247
88260
  __name(withConfig, "withConfig");
88248
88261
  function tryLoadDotEnv(basePath) {
88249
88262
  try {
88250
- const parsed = import_dotenv.default.parse(import_node_fs4.default.readFileSync(basePath));
88251
- return { path: basePath, parsed };
88252
- } catch (e7) {
88253
- if (e7.code === "ENOENT") {
88263
+ const contents = maybeGetFile(basePath);
88264
+ if (contents === void 0) {
88254
88265
  logger.debug(
88255
88266
  `.env file not found at "${import_node_path9.default.relative(".", basePath)}". Continuing... For more details, refer to https://developers.cloudflare.com/workers/wrangler/system-environment-variables/`
88256
88267
  );
88257
- } else {
88258
- logger.debug(
88259
- `Failed to load .env file "${import_node_path9.default.relative(".", basePath)}":`,
88260
- e7
88261
- );
88268
+ return;
88262
88269
  }
88270
+ const parsed = import_dotenv.default.parse(contents);
88271
+ return { path: basePath, parsed };
88272
+ } catch (e7) {
88273
+ logger.debug(
88274
+ `Failed to load .env file "${import_node_path9.default.relative(".", basePath)}":`,
88275
+ e7
88276
+ );
88263
88277
  }
88264
88278
  }
88265
88279
  __name(tryLoadDotEnv, "tryLoadDotEnv");
88266
- function loadDotEnv(envPath, env7) {
88267
- if (env7 === void 0) {
88280
+ function loadDotEnv(envPath, env6) {
88281
+ if (env6 === void 0) {
88268
88282
  return tryLoadDotEnv(envPath);
88269
88283
  } else {
88270
- return tryLoadDotEnv(`${envPath}.${env7}`) ?? tryLoadDotEnv(envPath);
88284
+ return tryLoadDotEnv(`${envPath}.${env6}`) ?? tryLoadDotEnv(envPath);
88271
88285
  }
88272
88286
  }
88273
88287
  __name(loadDotEnv, "loadDotEnv");
@@ -90516,11 +90530,11 @@ var getRevokeUrlFromEnv = getEnvironmentVariableFactory({
90516
90530
  defaultValue: () => `https://${getAuthDomainFromEnv()}/oauth2/revoke`
90517
90531
  });
90518
90532
  var getCloudflareAccessToken = /* @__PURE__ */ __name(async () => {
90519
- const env7 = getEnvironmentVariableFactory({
90533
+ const env6 = getEnvironmentVariableFactory({
90520
90534
  variableName: "WRANGLER_CF_AUTHORIZATION_TOKEN"
90521
90535
  })();
90522
- if (env7 !== void 0) {
90523
- return env7;
90536
+ if (env6 !== void 0) {
90537
+ return env6;
90524
90538
  }
90525
90539
  return getAccessToken(getAuthDomainFromEnv());
90526
90540
  }, "getCloudflareAccessToken");
@@ -91157,17 +91171,17 @@ function getAuthConfigFilePath() {
91157
91171
  __name(getAuthConfigFilePath, "getAuthConfigFilePath");
91158
91172
  function writeAuthConfigFile(config) {
91159
91173
  const configPath = getAuthConfigFilePath();
91160
- (0, import_node_fs5.mkdirSync)(import_node_path10.default.dirname(configPath), {
91174
+ (0, import_node_fs4.mkdirSync)(import_node_path10.default.dirname(configPath), {
91161
91175
  recursive: true
91162
91176
  });
91163
- (0, import_node_fs5.writeFileSync)(import_node_path10.default.join(configPath), import_toml4.default.stringify(config), {
91177
+ (0, import_node_fs4.writeFileSync)(import_node_path10.default.join(configPath), import_toml4.default.stringify(config), {
91164
91178
  encoding: "utf-8"
91165
91179
  });
91166
91180
  reinitialiseAuthTokens();
91167
91181
  }
91168
91182
  __name(writeAuthConfigFile, "writeAuthConfigFile");
91169
91183
  function readAuthConfigFile() {
91170
- const toml = parseTOML(readFileSync5(getAuthConfigFilePath()));
91184
+ const toml = parseTOML(readFileSync6(getAuthConfigFilePath()));
91171
91185
  return toml;
91172
91186
  }
91173
91187
  __name(readAuthConfigFile, "readAuthConfigFile");
@@ -91360,7 +91374,7 @@ async function logout() {
91360
91374
  }
91361
91375
  });
91362
91376
  await response.text();
91363
- (0, import_node_fs5.rmSync)(getAuthConfigFilePath());
91377
+ (0, import_node_fs4.rmSync)(getAuthConfigFilePath());
91364
91378
  logger.log(`Successfully logged out.`);
91365
91379
  }
91366
91380
  __name(logout, "logout");
@@ -91712,7 +91726,7 @@ __name(AIFetcher, "AIFetcher");
91712
91726
  // src/deployment-bundle/module-collection.ts
91713
91727
  init_import_meta_url();
91714
91728
  var import_node_crypto3 = __toESM(require("node:crypto"));
91715
- var import_node_fs7 = require("node:fs");
91729
+ var import_node_fs6 = require("node:fs");
91716
91730
  var import_promises4 = require("node:fs/promises");
91717
91731
  var import_node_path13 = __toESM(require("node:path"));
91718
91732
  var import_glob_to_regexp2 = __toESM(require_glob_to_regexp());
@@ -91796,7 +91810,7 @@ __name(parseRules, "parseRules");
91796
91810
 
91797
91811
  // src/deployment-bundle/source-maps.ts
91798
91812
  init_import_meta_url();
91799
- var import_node_fs6 = __toESM(require("node:fs"));
91813
+ var import_node_fs5 = __toESM(require("node:fs"));
91800
91814
  var import_node_path11 = __toESM(require("node:path"));
91801
91815
  function loadSourceMaps(main2, modules, bundle) {
91802
91816
  const { sourceMapPath, sourceMapMetadata } = bundle;
@@ -91812,7 +91826,7 @@ function loadSourceMap({ name: name2, filePath }, sourceMapPath, { entryDirector
91812
91826
  return [];
91813
91827
  }
91814
91828
  const map2 = JSON.parse(
91815
- import_node_fs6.default.readFileSync(import_node_path11.default.join(entryDirectory, sourceMapPath), "utf8")
91829
+ import_node_fs5.default.readFileSync(import_node_path11.default.join(entryDirectory, sourceMapPath), "utf8")
91816
91830
  );
91817
91831
  map2.file = name2;
91818
91832
  if (map2.sourceRoot) {
@@ -91884,13 +91898,13 @@ function sourceMapForModule(module3) {
91884
91898
  return;
91885
91899
  }
91886
91900
  const sourcemapPath = import_node_path11.default.join(import_node_path11.default.dirname(module3.filePath), sourceMapUrl);
91887
- if (!import_node_fs6.default.existsSync(sourcemapPath)) {
91901
+ if (!import_node_fs5.default.existsSync(sourcemapPath)) {
91888
91902
  throw new Error(
91889
91903
  `Invalid source map path in ${module3.filePath}: ${sourcemapPath} does not exist.`
91890
91904
  );
91891
91905
  }
91892
91906
  const map2 = JSON.parse(
91893
- import_node_fs6.default.readFileSync(sourcemapPath, "utf8")
91907
+ import_node_fs5.default.readFileSync(sourcemapPath, "utf8")
91894
91908
  );
91895
91909
  map2.file = module3.name;
91896
91910
  if (map2.sourceRoot) {
@@ -92316,7 +92330,7 @@ function getWrangler1xLegacyModuleReferences(rootDirectory, entryPath) {
92316
92330
  return {
92317
92331
  rootDirectory,
92318
92332
  fileNames: new Set(
92319
- (0, import_node_fs7.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
92333
+ (0, import_node_fs6.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
92320
92334
  (dirEntry) => dirEntry.isFile() && dirEntry.name !== import_node_path13.default.basename(entryPath)
92321
92335
  ).map((dirEnt) => dirEnt.name)
92322
92336
  )
@@ -92568,20 +92582,8 @@ __name(imagesRemoteFetcher, "imagesRemoteFetcher");
92568
92582
  // src/sourcemap.ts
92569
92583
  init_import_meta_url();
92570
92584
  var import_node_assert4 = __toESM(require("node:assert"));
92571
- var import_node_fs8 = __toESM(require("node:fs"));
92572
92585
  var import_node_url5 = __toESM(require("node:url"));
92573
92586
  var import_miniflare4 = require("miniflare");
92574
- function maybeGetFile(filePath) {
92575
- try {
92576
- return import_node_fs8.default.readFileSync(filePath, "utf8");
92577
- } catch (e7) {
92578
- const notFound = typeof e7 === "object" && e7 !== null && "code" in e7 && e7.code === "ENOENT";
92579
- if (!notFound) {
92580
- throw e7;
92581
- }
92582
- }
92583
- }
92584
- __name(maybeGetFile, "maybeGetFile");
92585
92587
  function maybeRetrieveFileSourceMap(filePath) {
92586
92588
  if (filePath === void 0) {
92587
92589
  return null;
@@ -93478,7 +93480,7 @@ function buildAssetOptions(config) {
93478
93480
  assets: {
93479
93481
  directory: config.assets.directory,
93480
93482
  binding: config.assets.binding,
93481
- routingConfig: config.assets.routingConfig,
93483
+ routerConfig: config.assets.routerConfig,
93482
93484
  assetConfig: config.assets.assetConfig
93483
93485
  }
93484
93486
  };
@@ -94475,7 +94477,7 @@ var import_open2 = __toESM(require_open());
94475
94477
  // src/api/startDevWorker/bundle-allowed-paths.ts
94476
94478
  init_import_meta_url();
94477
94479
  var import_node_assert8 = __toESM(require("node:assert"));
94478
- var import_node_fs9 = __toESM(require("node:fs"));
94480
+ var import_node_fs7 = __toESM(require("node:fs"));
94479
94481
  var import_node_path17 = __toESM(require("node:path"));
94480
94482
  var import_node_url6 = require("node:url");
94481
94483
  function isAllowedSourcePath(bundle, filePath) {
@@ -94503,7 +94505,7 @@ function getBundleReferencedPaths(bundle) {
94503
94505
  }
94504
94506
  const sourceMappingPath = (0, import_node_url6.fileURLToPath)(sourceMappingURL);
94505
94507
  allowed.sourceMapPaths.add(sourceMappingPath);
94506
- const sourceMapData = import_node_fs9.default.readFileSync(sourceMappingPath, "utf8");
94508
+ const sourceMapData = import_node_fs7.default.readFileSync(sourceMappingPath, "utf8");
94507
94509
  const sourceMap = JSON.parse(sourceMapData);
94508
94510
  const sourceRoot = sourceMap.sourceRoot ?? "";
94509
94511
  for (const source of sourceMap.sources) {
@@ -94531,7 +94533,7 @@ function* getBundleSourcePaths(bundle) {
94531
94533
  }
94532
94534
  __name(getBundleSourcePaths, "getBundleSourcePaths");
94533
94535
  function maybeGetSourceMappingURL(sourcePath) {
94534
- const source = import_node_fs9.default.readFileSync(sourcePath, "utf8");
94536
+ const source = import_node_fs7.default.readFileSync(sourcePath, "utf8");
94535
94537
  const sourceMappingURLIndex = source.lastIndexOf("//# sourceMappingURL=");
94536
94538
  if (sourceMappingURLIndex === -1) {
94537
94539
  return;
@@ -94750,7 +94752,7 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
94750
94752
 
94751
94753
  // src/https-options.ts
94752
94754
  init_import_meta_url();
94753
- var fs9 = __toESM(require("node:fs"));
94755
+ var fs7 = __toESM(require("node:fs"));
94754
94756
  var path20 = __toESM(require("node:path"));
94755
94757
  var import_miniflare9 = require("miniflare");
94756
94758
  var CERT_EXPIRY_DAYS = 30;
@@ -94768,33 +94770,33 @@ function getHttpsOptions(customHttpsKeyPath = getHttpsKeyPathFromEnv(), customHt
94768
94770
  "Must specify both certificate path and key path to use a Custom Certificate."
94769
94771
  );
94770
94772
  }
94771
- if (!fs9.existsSync(customHttpsKeyPath)) {
94773
+ if (!fs7.existsSync(customHttpsKeyPath)) {
94772
94774
  throw new UserError(
94773
94775
  "Missing Custom Certificate Key at " + customHttpsKeyPath
94774
94776
  );
94775
94777
  }
94776
- if (!fs9.existsSync(customHttpsCertPath)) {
94778
+ if (!fs7.existsSync(customHttpsCertPath)) {
94777
94779
  throw new UserError(
94778
94780
  "Missing Custom Certificate File at " + customHttpsCertPath
94779
94781
  );
94780
94782
  }
94781
94783
  logger.log("Using custom certificate at ", customHttpsKeyPath);
94782
94784
  return {
94783
- key: fs9.readFileSync(customHttpsKeyPath, "utf8"),
94784
- cert: fs9.readFileSync(customHttpsCertPath, "utf8")
94785
+ key: fs7.readFileSync(customHttpsKeyPath, "utf8"),
94786
+ cert: fs7.readFileSync(customHttpsCertPath, "utf8")
94785
94787
  };
94786
94788
  }
94787
94789
  const certDirectory = path20.join(getGlobalWranglerConfigPath(), "local-cert");
94788
94790
  const keyPath = path20.join(certDirectory, "key.pem");
94789
94791
  const certPath = path20.join(certDirectory, "cert.pem");
94790
- const regenerate = !fs9.existsSync(keyPath) || !fs9.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
94792
+ const regenerate = !fs7.existsSync(keyPath) || !fs7.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
94791
94793
  if (regenerate) {
94792
94794
  logger.log("Generating new self-signed certificate...");
94793
94795
  const { key, cert } = generateCertificate();
94794
94796
  try {
94795
- fs9.mkdirSync(certDirectory, { recursive: true });
94796
- fs9.writeFileSync(keyPath, key, "utf8");
94797
- fs9.writeFileSync(certPath, cert, "utf8");
94797
+ fs7.mkdirSync(certDirectory, { recursive: true });
94798
+ fs7.writeFileSync(keyPath, key, "utf8");
94799
+ fs7.writeFileSync(certPath, cert, "utf8");
94798
94800
  } catch (e7) {
94799
94801
  const message = e7 instanceof Error ? e7.message : `${e7}`;
94800
94802
  logger.warn(
@@ -94808,15 +94810,15 @@ ${message}`
94808
94810
  return { key, cert };
94809
94811
  } else {
94810
94812
  return {
94811
- key: fs9.readFileSync(keyPath, "utf8"),
94812
- cert: fs9.readFileSync(certPath, "utf8")
94813
+ key: fs7.readFileSync(keyPath, "utf8"),
94814
+ cert: fs7.readFileSync(certPath, "utf8")
94813
94815
  };
94814
94816
  }
94815
94817
  }
94816
94818
  __name(getHttpsOptions, "getHttpsOptions");
94817
94819
  function hasCertificateExpired(keyPath, certPath) {
94818
- const keyStat = fs9.statSync(keyPath);
94819
- const certStat = fs9.statSync(certPath);
94820
+ const keyStat = fs7.statSync(keyPath);
94821
+ const certStat = fs7.statSync(certPath);
94820
94822
  const created = Math.max(keyStat.mtimeMs, certStat.mtimeMs);
94821
94823
  return Date.now() - created > (CERT_EXPIRY_DAYS - 2) * ONE_DAY_IN_MS;
94822
94824
  }
@@ -95297,7 +95299,7 @@ __name(NoOpProxyController, "NoOpProxyController");
95297
95299
  // src/assets.ts
95298
95300
  init_import_meta_url();
95299
95301
  var import_node_assert25 = __toESM(require("node:assert"));
95300
- var import_node_fs34 = require("node:fs");
95302
+ var import_node_fs32 = require("node:fs");
95301
95303
  var import_promises37 = require("node:fs/promises");
95302
95304
  var path65 = __toESM(require("node:path"));
95303
95305
 
@@ -99092,14 +99094,18 @@ var z2 = /* @__PURE__ */ Object.freeze({
99092
99094
  });
99093
99095
 
99094
99096
  // ../workers-shared/utils/types.ts
99095
- var RoutingConfigSchema = z2.object({
99096
- has_user_worker: z2.boolean().optional(),
99097
- invoke_user_worker_ahead_of_assets: z2.boolean().optional(),
99098
- // Used for analytics and reporting
99097
+ var InternalConfigSchema = z2.object({
99099
99098
  account_id: z2.number().optional(),
99100
99099
  script_id: z2.number().optional()
99101
99100
  });
99101
+ var RouterConfigSchema = z2.object({
99102
+ invoke_user_worker_ahead_of_assets: z2.boolean().optional(),
99103
+ has_user_worker: z2.boolean().optional(),
99104
+ ...InternalConfigSchema.shape
99105
+ });
99102
99106
  var AssetConfigSchema = z2.object({
99107
+ compatibility_date: z2.string().optional(),
99108
+ compatibility_flags: z2.array(z2.string()).optional(),
99103
99109
  html_handling: z2.enum([
99104
99110
  "auto-trailing-slash",
99105
99111
  "force-trailing-slash",
@@ -99107,16 +99113,6 @@ var AssetConfigSchema = z2.object({
99107
99113
  "none"
99108
99114
  ]).optional(),
99109
99115
  not_found_handling: z2.enum(["single-page-application", "404-page", "none"]).optional(),
99110
- serve_directly: z2.boolean().optional(),
99111
- run_worker_first: z2.boolean().optional()
99112
- });
99113
- var InternalConfigSchema = z2.object({
99114
- // Used for analytics and reporting
99115
- account_id: z2.number().optional(),
99116
- script_id: z2.number().optional()
99117
- });
99118
- var AssetWorkerConfigShema = z2.object({
99119
- ...AssetConfigSchema.shape,
99120
99116
  ...InternalConfigSchema.shape
99121
99117
  });
99122
99118
 
@@ -99716,7 +99712,7 @@ var import_undici22 = __toESM(require_undici());
99716
99712
  // src/deploy/deploy.ts
99717
99713
  init_import_meta_url();
99718
99714
  var import_node_assert24 = __toESM(require("node:assert"));
99719
- var import_node_fs33 = require("node:fs");
99715
+ var import_node_fs31 = require("node:fs");
99720
99716
  var import_node_path61 = __toESM(require("node:path"));
99721
99717
  var import_node_url11 = require("node:url");
99722
99718
  var import_undici21 = __toESM(require_undici());
@@ -100227,7 +100223,7 @@ var import_undici5 = __toESM(require_undici());
100227
100223
 
100228
100224
  // src/package-manager.ts
100229
100225
  init_import_meta_url();
100230
- var import_node_fs10 = require("node:fs");
100226
+ var import_node_fs8 = require("node:fs");
100231
100227
  var import_node_path23 = require("node:path");
100232
100228
  var import_node_process10 = require("node:process");
100233
100229
 
@@ -100264,13 +100260,13 @@ var import_node_url9 = __toESM(require("node:url"), 1);
100264
100260
  init_import_meta_url();
100265
100261
  function pathKey(options32 = {}) {
100266
100262
  const {
100267
- env: env7 = process.env,
100263
+ env: env6 = process.env,
100268
100264
  platform: platform3 = process.platform
100269
100265
  } = options32;
100270
100266
  if (platform3 !== "win32") {
100271
100267
  return "PATH";
100272
100268
  }
100273
- return Object.keys(env7).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
100269
+ return Object.keys(env6).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
100274
100270
  }
100275
100271
  __name(pathKey, "pathKey");
100276
100272
 
@@ -100294,12 +100290,12 @@ function npmRunPath(options32 = {}) {
100294
100290
  return [...result, path_].join(import_node_path21.default.delimiter);
100295
100291
  }
100296
100292
  __name(npmRunPath, "npmRunPath");
100297
- function npmRunPathEnv({ env: env7 = import_node_process8.default.env, ...options32 } = {}) {
100298
- env7 = { ...env7 };
100299
- const path72 = pathKey({ env: env7 });
100300
- options32.path = env7[path72];
100301
- env7[path72] = npmRunPath(options32);
100302
- return env7;
100293
+ function npmRunPathEnv({ env: env6 = import_node_process8.default.env, ...options32 } = {}) {
100294
+ env6 = { ...env6 };
100295
+ const path72 = pathKey({ env: env6 });
100296
+ options32.path = env6[path72];
100297
+ env6[path72] = npmRunPath(options32);
100298
+ return env6;
100303
100299
  }
100304
100300
  __name(npmRunPathEnv, "npmRunPathEnv");
100305
100301
 
@@ -101065,11 +101061,11 @@ var parseCommand = /* @__PURE__ */ __name((command2) => {
101065
101061
  // ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
101066
101062
  var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
101067
101063
  var getEnv = /* @__PURE__ */ __name(({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
101068
- const env7 = extendEnv ? { ...import_node_process9.default.env, ...envOption } : envOption;
101064
+ const env6 = extendEnv ? { ...import_node_process9.default.env, ...envOption } : envOption;
101069
101065
  if (preferLocal) {
101070
- return npmRunPathEnv({ env: env7, cwd: localDir, execPath });
101066
+ return npmRunPathEnv({ env: env6, cwd: localDir, execPath });
101071
101067
  }
101072
- return env7;
101068
+ return env6;
101073
101069
  }, "getEnv");
101074
101070
  var handleArguments = /* @__PURE__ */ __name((file, args, options32 = {}) => {
101075
101071
  const parsed = import_cross_spawn.default._parse(file, args, options32);
@@ -101255,9 +101251,9 @@ async function getPackageManager(cwd2) {
101255
101251
  supportsNpm(),
101256
101252
  supportsPnpm()
101257
101253
  ]);
101258
- const hasYarnLock = (0, import_node_fs10.existsSync)((0, import_node_path23.join)(cwd2, "yarn.lock"));
101259
- const hasNpmLock = (0, import_node_fs10.existsSync)((0, import_node_path23.join)(cwd2, "package-lock.json"));
101260
- const hasPnpmLock = (0, import_node_fs10.existsSync)((0, import_node_path23.join)(cwd2, "pnpm-lock.yaml"));
101254
+ const hasYarnLock = (0, import_node_fs8.existsSync)((0, import_node_path23.join)(cwd2, "yarn.lock"));
101255
+ const hasNpmLock = (0, import_node_fs8.existsSync)((0, import_node_path23.join)(cwd2, "package-lock.json"));
101256
+ const hasPnpmLock = (0, import_node_fs8.existsSync)((0, import_node_path23.join)(cwd2, "pnpm-lock.yaml"));
101261
101257
  const userAgent = sniffUserAgent();
101262
101258
  if (hasNpmLock) {
101263
101259
  if (hasNpm) {
@@ -101453,7 +101449,7 @@ __name(getNodeVersion, "getNodeVersion");
101453
101449
  // src/metrics/metrics-config.ts
101454
101450
  init_import_meta_url();
101455
101451
  var import_node_crypto8 = require("node:crypto");
101456
- var import_node_fs11 = require("node:fs");
101452
+ var import_node_fs9 = require("node:fs");
101457
101453
  var import_node_path24 = __toESM(require("node:path"));
101458
101454
  var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
101459
101455
  function getMetricsConfig({
@@ -101493,8 +101489,8 @@ function getMetricsConfig({
101493
101489
  }
101494
101490
  __name(getMetricsConfig, "getMetricsConfig");
101495
101491
  function writeMetricsConfig(config) {
101496
- (0, import_node_fs11.mkdirSync)(import_node_path24.default.dirname(getMetricsConfigPath()), { recursive: true });
101497
- (0, import_node_fs11.writeFileSync)(
101492
+ (0, import_node_fs9.mkdirSync)(import_node_path24.default.dirname(getMetricsConfigPath()), { recursive: true });
101493
+ (0, import_node_fs9.writeFileSync)(
101498
101494
  getMetricsConfigPath(),
101499
101495
  JSON.stringify(
101500
101496
  config,
@@ -101506,7 +101502,7 @@ function writeMetricsConfig(config) {
101506
101502
  __name(writeMetricsConfig, "writeMetricsConfig");
101507
101503
  function readMetricsConfig() {
101508
101504
  try {
101509
- const config = (0, import_node_fs11.readFileSync)(getMetricsConfigPath(), "utf8");
101505
+ const config = (0, import_node_fs9.readFileSync)(getMetricsConfigPath(), "utf8");
101510
101506
  return JSON.parse(
101511
101507
  config,
101512
101508
  (key, value) => key === "date" ? new Date(value) : value
@@ -101794,7 +101790,7 @@ __name(getMetricsUsageHeaders, "getMetricsUsageHeaders");
101794
101790
 
101795
101791
  // src/r2/helpers.ts
101796
101792
  init_import_meta_url();
101797
- var fs10 = __toESM(require("node:fs"));
101793
+ var fs8 = __toESM(require("node:fs"));
101798
101794
  var import_web = require("node:stream/web");
101799
101795
  var import_miniflare14 = require("miniflare");
101800
101796
 
@@ -102804,7 +102800,7 @@ function isValidR2BucketName(name2) {
102804
102800
  __name(isValidR2BucketName, "isValidR2BucketName");
102805
102801
  var CHUNK_SIZE = 1024;
102806
102802
  async function createFileReadableStream(filePath) {
102807
- const handle = await fs10.promises.open(filePath, "r");
102803
+ const handle = await fs8.promises.open(filePath, "r");
102808
102804
  let position = 0;
102809
102805
  return new import_web.ReadableStream({
102810
102806
  async pull(controller) {
@@ -103230,14 +103226,14 @@ __name(runProvisioningFlow, "runProvisioningFlow");
103230
103226
 
103231
103227
  // src/deployment-bundle/bundle.ts
103232
103228
  init_import_meta_url();
103233
- var fs13 = __toESM(require("node:fs"));
103229
+ var fs11 = __toESM(require("node:fs"));
103234
103230
  var path28 = __toESM(require("node:path"));
103235
103231
  var esbuild = __toESM(require("esbuild"));
103236
103232
 
103237
103233
  // src/paths.ts
103238
103234
  init_import_meta_url();
103239
103235
  var import_node_console = require("node:console");
103240
- var import_node_fs12 = __toESM(require("node:fs"));
103236
+ var import_node_fs10 = __toESM(require("node:fs"));
103241
103237
  var import_node_path25 = __toESM(require("node:path"));
103242
103238
  var import_signal_exit4 = __toESM(require_signal_exit());
103243
103239
  function toUrlPath(filePath) {
@@ -103268,13 +103264,13 @@ __name(getBasePath, "getBasePath");
103268
103264
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
103269
103265
  projectRoot ??= process.cwd();
103270
103266
  const tmpRoot = import_node_path25.default.join(projectRoot, ".wrangler", "tmp");
103271
- import_node_fs12.default.mkdirSync(tmpRoot, { recursive: true });
103267
+ import_node_fs10.default.mkdirSync(tmpRoot, { recursive: true });
103272
103268
  const tmpPrefix = import_node_path25.default.join(tmpRoot, `${prefix}-`);
103273
- const tmpDir = import_node_fs12.default.realpathSync(import_node_fs12.default.mkdtempSync(tmpPrefix));
103269
+ const tmpDir = import_node_fs10.default.realpathSync(import_node_fs10.default.mkdtempSync(tmpPrefix));
103274
103270
  const removeDir = /* @__PURE__ */ __name(() => {
103275
103271
  if (cleanup) {
103276
103272
  try {
103277
- return import_node_fs12.default.rmSync(tmpDir, { recursive: true, force: true });
103273
+ return import_node_fs10.default.rmSync(tmpDir, { recursive: true, force: true });
103278
103274
  } catch (e7) {
103279
103275
  }
103280
103276
  }
@@ -103292,7 +103288,7 @@ __name(getWranglerTmpDir, "getWranglerTmpDir");
103292
103288
 
103293
103289
  // src/deployment-bundle/apply-middleware.ts
103294
103290
  init_import_meta_url();
103295
- var fs12 = __toESM(require("node:fs"));
103291
+ var fs10 = __toESM(require("node:fs"));
103296
103292
  var path27 = __toESM(require("node:path"));
103297
103293
 
103298
103294
  // src/utils/dedent.ts
@@ -103326,7 +103322,7 @@ __name(dedent2, "dedent");
103326
103322
 
103327
103323
  // src/deployment-bundle/apply-middleware.ts
103328
103324
  async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
103329
- tmpDirPath = fs12.realpathSync(tmpDirPath);
103325
+ tmpDirPath = fs10.realpathSync(tmpDirPath);
103330
103326
  const middlewareIdentifiers = middleware.map((m6, index) => [
103331
103327
  `__MIDDLEWARE_${index}__`,
103332
103328
  path27.resolve(getBasePath(), m6.path)
@@ -103345,7 +103341,7 @@ async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
103345
103341
  ).join("\n");
103346
103342
  const middlewareFns = middlewareIdentifiers.map(([m6]) => `${m6}.default`).join(",");
103347
103343
  if (entry.format === "modules") {
103348
- await fs12.promises.writeFile(
103344
+ await fs10.promises.writeFile(
103349
103345
  dynamicFacadePath,
103350
103346
  dedent2`
103351
103347
  import worker, * as OTHER_EXPORTS from "${prepareFilePath(entry.file)}";
@@ -103368,14 +103364,14 @@ async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
103368
103364
  getBasePath(),
103369
103365
  "templates/middleware/loader-modules.ts"
103370
103366
  );
103371
- const baseLoader = await fs12.promises.readFile(loaderPath, "utf-8");
103367
+ const baseLoader = await fs10.promises.readFile(loaderPath, "utf-8");
103372
103368
  const transformedLoader = baseLoader.replaceAll("__ENTRY_POINT__", prepareFilePath(dynamicFacadePath)).replace(
103373
103369
  "./common",
103374
103370
  prepareFilePath(
103375
103371
  path27.resolve(getBasePath(), "templates/middleware/common.ts")
103376
103372
  )
103377
103373
  );
103378
- await fs12.promises.writeFile(targetPathLoader, transformedLoader);
103374
+ await fs10.promises.writeFile(targetPathLoader, transformedLoader);
103379
103375
  return {
103380
103376
  entry: {
103381
103377
  ...entry,
@@ -103387,7 +103383,7 @@ async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
103387
103383
  getBasePath(),
103388
103384
  "templates/middleware/loader-sw.ts"
103389
103385
  );
103390
- await fs12.promises.writeFile(
103386
+ await fs10.promises.writeFile(
103391
103387
  dynamicFacadePath,
103392
103388
  dedent2`
103393
103389
  import { __facade_registerInternal__ } from "${prepareFilePath(loaderSwPath)}";
@@ -103575,18 +103571,22 @@ init_import_meta_url();
103575
103571
  var import_node_assert13 = __toESM(require("node:assert"));
103576
103572
  var import_node_module2 = require("node:module");
103577
103573
  var import_node_path26 = __toESM(require("node:path"));
103578
- var import_unenv = require("unenv");
103579
103574
  var REQUIRED_NODE_BUILT_IN_NAMESPACE = "node-built-in-modules";
103580
103575
  var REQUIRED_UNENV_ALIAS_NAMESPACE = "required-unenv-alias";
103581
- function nodejsHybridPlugin(_unenvResolvePaths) {
103582
- const { alias, inject, external } = (0, import_unenv.env)(import_unenv.nodeless, import_unenv.cloudflare);
103576
+ async function nodejsHybridPlugin(_unenvResolvePaths) {
103577
+ const { defineEnv } = await import("unenv");
103578
+ const { cloudflare } = await import("@cloudflare/unenv-preset");
103579
+ const { alias, inject, external, polyfill: polyfill2 } = defineEnv({
103580
+ presets: [cloudflare],
103581
+ npmShims: true
103582
+ }).env;
103583
103583
  return {
103584
103584
  name: "hybrid-nodejs_compat",
103585
103585
  setup(build5) {
103586
103586
  errorOnServiceWorkerFormat(build5);
103587
103587
  handleRequireCallsToNodeJSBuiltins(build5);
103588
103588
  handleUnenvAliasedPackages(build5, alias, external);
103589
- handleNodeJSGlobals(build5, inject);
103589
+ handleNodeJSGlobals(build5, inject, polyfill2);
103590
103590
  }
103591
103591
  };
103592
103592
  }
@@ -103647,7 +103647,7 @@ function handleUnenvAliasedPackages(build5, alias, external) {
103647
103647
  const aliasAbsolute = {};
103648
103648
  for (const [module3, unresolvedAlias] of Object.entries(alias)) {
103649
103649
  try {
103650
- aliasAbsolute[module3] = require.resolve(unresolvedAlias).replace(/\.cjs$/, ".mjs");
103650
+ aliasAbsolute[module3] = require.resolve(unresolvedAlias);
103651
103651
  } catch (e7) {
103652
103652
  }
103653
103653
  }
@@ -103656,7 +103656,7 @@ function handleUnenvAliasedPackages(build5, alias, external) {
103656
103656
  );
103657
103657
  build5.onResolve({ filter: UNENV_ALIAS_RE }, (args) => {
103658
103658
  const unresolvedAlias = alias[args.path];
103659
- if (args.kind === "require-call" && (unresolvedAlias.startsWith("unenv/runtime/npm/") || unresolvedAlias.startsWith("unenv/runtime/mock/"))) {
103659
+ if (args.kind === "require-call" && (unresolvedAlias.startsWith("unenv/npm/") || unresolvedAlias.startsWith("unenv/mock/"))) {
103660
103660
  return {
103661
103661
  path: args.path,
103662
103662
  namespace: REQUIRED_UNENV_ALIAS_NAMESPACE
@@ -103686,8 +103686,8 @@ function handleUnenvAliasedPackages(build5, alias, external) {
103686
103686
  );
103687
103687
  }
103688
103688
  __name(handleUnenvAliasedPackages, "handleUnenvAliasedPackages");
103689
- function handleNodeJSGlobals(build5, inject) {
103690
- const UNENV_GLOBALS_RE = /_virtual_unenv_global_polyfill-(.+)$/;
103689
+ function handleNodeJSGlobals(build5, inject, polyfill2) {
103690
+ const UNENV_VIRTUAL_MODULE_RE = /_virtual_unenv_global_polyfill-(.+)$/;
103691
103691
  const prefix = import_node_path26.default.resolve(
103692
103692
  getBasePath(),
103693
103693
  "_virtual_unenv_global_polyfill-"
@@ -103707,10 +103707,15 @@ function handleNodeJSGlobals(build5, inject) {
103707
103707
  }
103708
103708
  build5.initialOptions.inject = [
103709
103709
  ...build5.initialOptions.inject ?? [],
103710
- ...virtualModulePathToSpecifier.keys()
103710
+ // Inject the virtual modules
103711
+ ...virtualModulePathToSpecifier.keys(),
103712
+ // Inject the polyfills - needs an absolute path
103713
+ ...polyfill2.map((m6) => require.resolve(m6))
103711
103714
  ];
103712
- build5.onResolve({ filter: UNENV_GLOBALS_RE }, ({ path: path72 }) => ({ path: path72 }));
103713
- build5.onLoad({ filter: UNENV_GLOBALS_RE }, ({ path: path72 }) => {
103715
+ build5.onResolve({ filter: UNENV_VIRTUAL_MODULE_RE }, ({ path: path72 }) => ({
103716
+ path: path72
103717
+ }));
103718
+ build5.onLoad({ filter: UNENV_VIRTUAL_MODULE_RE }, ({ path: path72 }) => {
103714
103719
  const module3 = virtualModulePathToSpecifier.get(path72);
103715
103720
  (0, import_node_assert13.default)(module3, `Expected ${path72} to be mapped to a module specifier`);
103716
103721
  const injects = injectsByModule.get(module3);
@@ -103839,7 +103844,7 @@ var standardURLPlugin = /* @__PURE__ */ __name(() => ({
103839
103844
  }), "standardURLPlugin");
103840
103845
 
103841
103846
  // src/deployment-bundle/esbuild-plugins/nodejs-plugins.ts
103842
- function getNodeJSCompatPlugins({
103847
+ async function getNodeJSCompatPlugins({
103843
103848
  mode,
103844
103849
  unenvResolvePaths
103845
103850
  }) {
@@ -103856,7 +103861,7 @@ function getNodeJSCompatPlugins({
103856
103861
  case "v1":
103857
103862
  return [nodejsCompatPlugin(mode)];
103858
103863
  case "v2":
103859
- return [nodejsHybridPlugin(unenvResolvePaths)];
103864
+ return [await nodejsHybridPlugin(unenvResolvePaths)];
103860
103865
  case null:
103861
103866
  return [nodejsCompatPlugin(mode)];
103862
103867
  }
@@ -103984,10 +103989,10 @@ async function bundleWorker(entry, destination, {
103984
103989
  const inject = injectOption ?? [];
103985
103990
  if (checkFetch) {
103986
103991
  const checkedFetchFileToInject = path28.join(tmpDir.path, "checked-fetch.js");
103987
- if (checkFetch && !fs13.existsSync(checkedFetchFileToInject)) {
103988
- fs13.writeFileSync(
103992
+ if (checkFetch && !fs11.existsSync(checkedFetchFileToInject)) {
103993
+ fs11.writeFileSync(
103989
103994
  checkedFetchFileToInject,
103990
- fs13.readFileSync(
103995
+ fs11.readFileSync(
103991
103996
  path28.resolve(getBasePath(), "templates/checked-fetch.js")
103992
103997
  )
103993
103998
  );
@@ -104087,7 +104092,7 @@ async function bundleWorker(entry, destination, {
104087
104092
  plugins: [
104088
104093
  aliasPlugin,
104089
104094
  moduleCollector.plugin,
104090
- ...getNodeJSCompatPlugins({
104095
+ ...await getNodeJSCompatPlugins({
104091
104096
  mode: nodejsCompatMode ?? null,
104092
104097
  unenvResolvePaths
104093
104098
  }),
@@ -104252,19 +104257,19 @@ __name(printOffendingDependencies, "printOffendingDependencies");
104252
104257
  // src/deployment-bundle/create-worker-upload-form.ts
104253
104258
  init_import_meta_url();
104254
104259
  var import_node_assert14 = __toESM(require("node:assert"));
104255
- var import_node_fs14 = require("node:fs");
104260
+ var import_node_fs12 = require("node:fs");
104256
104261
  var import_node_path28 = __toESM(require("node:path"));
104257
104262
  var import_undici6 = __toESM(require_undici());
104258
104263
 
104259
104264
  // src/deployment-bundle/capnp.ts
104260
104265
  init_import_meta_url();
104261
104266
  var import_node_child_process2 = require("node:child_process");
104262
- var import_node_fs13 = require("node:fs");
104267
+ var import_node_fs11 = require("node:fs");
104263
104268
  var import_node_path27 = require("node:path");
104264
104269
  var import_command_exists = __toESM(require_command_exists2());
104265
104270
  function handleUnsafeCapnp(capnp) {
104266
104271
  if (capnp.compiled_schema) {
104267
- return (0, import_node_fs13.readFileSync)((0, import_node_path27.resolve)(capnp.compiled_schema));
104272
+ return (0, import_node_fs11.readFileSync)((0, import_node_path27.resolve)(capnp.compiled_schema));
104268
104273
  }
104269
104274
  const { base_path, source_schemas } = capnp;
104270
104275
  const capnpSchemas = (source_schemas ?? []).map(
@@ -104343,18 +104348,14 @@ function createWorkerUploadForm(worker) {
104343
104348
  assets,
104344
104349
  observability
104345
104350
  } = worker;
104346
- let runWorkerFirst = void 0;
104347
- if (assets?.assetConfig?.run_worker_first !== void 0) {
104348
- runWorkerFirst = assets.assetConfig?.run_worker_first;
104349
- } else if (assets?.assetConfig?.serve_directly !== void 0) {
104350
- runWorkerFirst = !assets?.assetConfig?.serve_directly;
104351
- }
104352
104351
  const assetConfig = {
104353
104352
  html_handling: assets?.assetConfig?.html_handling,
104354
104353
  not_found_handling: assets?.assetConfig?.not_found_handling,
104355
- run_worker_first: runWorkerFirst
104354
+ run_worker_first: assets?.routerConfig.invoke_user_worker_ahead_of_assets,
104355
+ _redirects: assets?._redirects,
104356
+ _headers: assets?._headers
104356
104357
  };
104357
- if (assets && !assets.routingConfig.has_user_worker) {
104358
+ if (assets && !assets.routerConfig.has_user_worker) {
104358
104359
  formData.set(
104359
104360
  "metadata",
104360
104361
  JSON.stringify({
@@ -104552,7 +104553,7 @@ function createWorkerUploadForm(worker) {
104552
104553
  formData.set(
104553
104554
  name2,
104554
104555
  new import_undici6.File(
104555
- [typeof source === "string" ? (0, import_node_fs14.readFileSync)(source) : source],
104556
+ [typeof source === "string" ? (0, import_node_fs12.readFileSync)(source) : source],
104556
104557
  typeof source === "string" ? source : name2,
104557
104558
  {
104558
104559
  type: "application/wasm"
@@ -104600,7 +104601,7 @@ function createWorkerUploadForm(worker) {
104600
104601
  if (name2 !== "__STATIC_CONTENT_MANIFEST") {
104601
104602
  formData.set(
104602
104603
  name2,
104603
- new import_undici6.File([(0, import_node_fs14.readFileSync)(filePath)], filePath, {
104604
+ new import_undici6.File([(0, import_node_fs12.readFileSync)(filePath)], filePath, {
104604
104605
  type: "text/plain"
104605
104606
  })
104606
104607
  );
@@ -104615,7 +104616,7 @@ function createWorkerUploadForm(worker) {
104615
104616
  formData.set(
104616
104617
  name2,
104617
104618
  new import_undici6.File(
104618
- [typeof source === "string" ? (0, import_node_fs14.readFileSync)(source) : source],
104619
+ [typeof source === "string" ? (0, import_node_fs12.readFileSync)(source) : source],
104619
104620
  typeof source === "string" ? source : name2,
104620
104621
  {
104621
104622
  type: "application/octet-stream"
@@ -105427,16 +105428,22 @@ function getHostFromRoute(route2) {
105427
105428
  return host;
105428
105429
  }
105429
105430
  __name(getHostFromRoute, "getHostFromRoute");
105430
- async function getZoneForRoute(from) {
105431
+ async function getZoneForRoute(from, zoneIdCache = /* @__PURE__ */ new Map()) {
105431
105432
  const { route: route2, accountId } = from;
105432
105433
  const host = getHostFromRoute(route2);
105433
105434
  let id;
105434
105435
  if (typeof route2 === "object" && "zone_id" in route2) {
105435
105436
  id = route2.zone_id;
105436
105437
  } else if (typeof route2 === "object" && "zone_name" in route2) {
105437
- id = await getZoneIdFromHost({ host: route2.zone_name, accountId });
105438
+ id = await getZoneIdFromHost(
105439
+ {
105440
+ host: route2.zone_name,
105441
+ accountId
105442
+ },
105443
+ zoneIdCache
105444
+ );
105438
105445
  } else if (host) {
105439
- id = await getZoneIdFromHost({ host, accountId });
105446
+ id = await getZoneIdFromHost({ host, accountId }, zoneIdCache);
105440
105447
  }
105441
105448
  return id && host ? { id, host } : void 0;
105442
105449
  }
@@ -105457,14 +105464,21 @@ function getHostFromUrl(urlLike) {
105457
105464
  }
105458
105465
  __name(getHostFromUrl, "getHostFromUrl");
105459
105466
  async function getZoneIdForPreview(from) {
105467
+ const zoneIdCache = /* @__PURE__ */ new Map();
105460
105468
  const { host, routes, accountId } = from;
105461
105469
  let zoneId;
105462
105470
  if (host) {
105463
- zoneId = await getZoneIdFromHost({ host, accountId });
105471
+ zoneId = await getZoneIdFromHost({ host, accountId }, zoneIdCache);
105464
105472
  }
105465
105473
  if (!zoneId && routes) {
105466
105474
  const firstRoute = routes[0];
105467
- const zone = await getZoneForRoute({ route: firstRoute, accountId });
105475
+ const zone = await getZoneForRoute(
105476
+ {
105477
+ route: firstRoute,
105478
+ accountId
105479
+ },
105480
+ zoneIdCache
105481
+ );
105468
105482
  if (zone) {
105469
105483
  zoneId = zone.id;
105470
105484
  }
@@ -105472,19 +105486,26 @@ async function getZoneIdForPreview(from) {
105472
105486
  return zoneId;
105473
105487
  }
105474
105488
  __name(getZoneIdForPreview, "getZoneIdForPreview");
105475
- async function getZoneIdFromHost(from) {
105489
+ async function getZoneIdFromHost(from, zoneIdCache) {
105476
105490
  const hostPieces = from.host.split(".");
105477
105491
  while (hostPieces.length > 1) {
105478
- const zones = await fetchListResult(
105479
- `/zones`,
105480
- {},
105481
- new URLSearchParams({
105482
- name: hostPieces.join("."),
105483
- "account.id": from.accountId
105484
- })
105485
- );
105486
- if (zones.length > 0) {
105487
- return zones[0].id;
105492
+ const cacheKey = `${from.accountId}:${hostPieces.join(".")}`;
105493
+ if (!zoneIdCache.has(cacheKey)) {
105494
+ zoneIdCache.set(
105495
+ cacheKey,
105496
+ fetchListResult(
105497
+ `/zones`,
105498
+ {},
105499
+ new URLSearchParams({
105500
+ name: hostPieces.join("."),
105501
+ "account.id": from.accountId
105502
+ })
105503
+ ).then((zones) => zones[0]?.id ?? null)
105504
+ );
105505
+ }
105506
+ const cachedZone = await zoneIdCache.get(cacheKey);
105507
+ if (cachedZone) {
105508
+ return cachedZone;
105488
105509
  }
105489
105510
  hostPieces.shift();
105490
105511
  }
@@ -105639,22 +105660,32 @@ async function triggersDeploy(props) {
105639
105660
  }
105640
105661
  if (!deployToWorkersDev && deploymentInSync && routes.length !== 0) {
105641
105662
  const routesWithOtherBindings = {};
105663
+ const queue = new PQueue({ concurrency: 10 });
105664
+ const zoneRoutesCache = /* @__PURE__ */ new Map();
105665
+ const zoneIdCache = /* @__PURE__ */ new Map();
105642
105666
  for (const route2 of routes) {
105643
- const zone = await getZoneForRoute({ route: route2, accountId });
105644
- if (!zone) {
105645
- continue;
105646
- }
105647
- const routePattern = typeof route2 === "string" ? route2 : route2.pattern;
105648
- const routesInZone = await fetchListResult(`/zones/${zone.id}/workers/routes`);
105649
- routesInZone.forEach(({ script, pattern }) => {
105650
- if (pattern === routePattern && script !== scriptName) {
105651
- if (!(script in routesWithOtherBindings)) {
105652
- routesWithOtherBindings[script] = [];
105653
- }
105654
- routesWithOtherBindings[script].push(pattern);
105667
+ void queue.add(async () => {
105668
+ const zone = await getZoneForRoute({ route: route2, accountId }, zoneIdCache);
105669
+ if (!zone) {
105670
+ return;
105671
+ }
105672
+ const routePattern = typeof route2 === "string" ? route2 : route2.pattern;
105673
+ let routesInZone = zoneRoutesCache.get(zone.id);
105674
+ if (!routesInZone) {
105675
+ routesInZone = fetchListResult(`/zones/${zone.id}/workers/routes`);
105676
+ zoneRoutesCache.set(zone.id, routesInZone);
105655
105677
  }
105678
+ (await routesInZone).forEach(({ script, pattern }) => {
105679
+ if (pattern === routePattern && script !== scriptName) {
105680
+ if (!(script in routesWithOtherBindings)) {
105681
+ routesWithOtherBindings[script] = [];
105682
+ }
105683
+ routesWithOtherBindings[script].push(pattern);
105684
+ }
105685
+ });
105656
105686
  });
105657
105687
  }
105688
+ await queue.onIdle();
105658
105689
  if (Object.keys(routesWithOtherBindings).length > 0) {
105659
105690
  let errorMessage = "Can't deploy routes that are assigned to another worker.\n";
105660
105691
  for (const worker in routesWithOtherBindings) {
@@ -109349,8 +109380,8 @@ var ErrorMTlsCertificateManyNamesMatch = class extends UserError {
109349
109380
  __name(ErrorMTlsCertificateManyNamesMatch, "ErrorMTlsCertificateManyNamesMatch");
109350
109381
  async function uploadMTlsCertificateFromFs(accountId, details) {
109351
109382
  return await uploadMTlsCertificate(accountId, {
109352
- certificateChain: readFileSync5(details.certificateChainFilename),
109353
- privateKey: readFileSync5(details.privateKeyFilename),
109383
+ certificateChain: readFileSync6(details.certificateChainFilename),
109384
+ privateKey: readFileSync6(details.privateKeyFilename),
109354
109385
  name: details.name
109355
109386
  });
109356
109387
  }
@@ -109360,7 +109391,7 @@ async function uploadCaCertificateFromFs(accountId, details) {
109360
109391
  method: "POST",
109361
109392
  body: JSON.stringify({
109362
109393
  name: details.name,
109363
- certificates: readFileSync5(details.certificates),
109394
+ certificates: readFileSync6(details.certificates),
109364
109395
  ca: details.ca
109365
109396
  })
109366
109397
  });
@@ -111171,7 +111202,7 @@ function renderDeploymentConfiguration(action, {
111171
111202
  memory,
111172
111203
  environmentVariables,
111173
111204
  labels,
111174
- env: env7,
111205
+ env: env6,
111175
111206
  network
111176
111207
  }) {
111177
111208
  let environmentVariablesText = "[]";
@@ -111181,7 +111212,7 @@ function renderDeploymentConfiguration(action, {
111181
111212
  }
111182
111213
  } else if (action === "create") {
111183
111214
  environmentVariablesText = `
111184
- No environment variables added! You can set some under [${env7 ? "env." + env7 + "." : ""}vars] and via command line`;
111215
+ No environment variables added! You can set some under [${env6 ? "env." + env6 + "." : ""}vars] and via command line`;
111185
111216
  }
111186
111217
  let labelsText = "[]";
111187
111218
  if (labels !== void 0 && labels.length !== 0) {
@@ -111265,11 +111296,11 @@ function collectEnvironmentVariables(deploymentEnv, config, envArgs) {
111265
111296
  if (envMap.size === 0) {
111266
111297
  return void 0;
111267
111298
  }
111268
- const env7 = Array.from(envMap).map(
111299
+ const env6 = Array.from(envMap).map(
111269
111300
  ([name2, value]) => ({ name: name2, value })
111270
111301
  );
111271
- sortEnvironmentVariables(env7);
111272
- return env7;
111302
+ sortEnvironmentVariables(env6);
111303
+ return env6;
111273
111304
  }
111274
111305
  __name(collectEnvironmentVariables, "collectEnvironmentVariables");
111275
111306
  async function promptForEnvironmentVariables(environmentVariables, initiallySelected, allowSkipping) {
@@ -118032,7 +118063,7 @@ async function executeLocally({
118032
118063
  d1Databases: { DATABASE: id }
118033
118064
  });
118034
118065
  const db = await mf.getD1Database("DATABASE");
118035
- const sql = input.file ? readFileSync5(input.file) : input.command;
118066
+ const sql = input.file ? readFileSync6(input.file) : input.command;
118036
118067
  const queries = splitSqlQuery(sql);
118037
118068
  let results;
118038
118069
  try {
@@ -118764,12 +118795,12 @@ init_import_meta_url();
118764
118795
  // src/d1/migrations/apply.ts
118765
118796
  init_import_meta_url();
118766
118797
  var import_node_assert19 = __toESM(require("node:assert"));
118767
- var import_node_fs16 = __toESM(require("node:fs"));
118798
+ var import_node_fs14 = __toESM(require("node:fs"));
118768
118799
  var import_path10 = __toESM(require("path"));
118769
118800
 
118770
118801
  // src/d1/migrations/helpers.ts
118771
118802
  init_import_meta_url();
118772
- var import_node_fs15 = __toESM(require("node:fs"));
118803
+ var import_node_fs13 = __toESM(require("node:fs"));
118773
118804
  var import_path9 = __toESM(require("path"));
118774
118805
  async function getMigrationsPath({
118775
118806
  projectPath,
@@ -118778,13 +118809,13 @@ async function getMigrationsPath({
118778
118809
  configPath
118779
118810
  }) {
118780
118811
  const dir = import_path9.default.resolve(projectPath, migrationsFolderPath);
118781
- if (import_node_fs15.default.existsSync(dir)) {
118812
+ if (import_node_fs13.default.existsSync(dir)) {
118782
118813
  return dir;
118783
118814
  }
118784
118815
  const warning = `No migrations folder found.${migrationsFolderPath === DEFAULT_MIGRATION_PATH ? ` Set \`migrations_dir\` in your ${configFileName(configPath)} file to choose a different path.` : ""}`;
118785
118816
  if (createIfMissing && await confirm(`${warning}
118786
118817
  Ok to create ${dir}?`)) {
118787
- import_node_fs15.default.mkdirSync(dir, { recursive: true });
118818
+ import_node_fs13.default.mkdirSync(dir, { recursive: true });
118788
118819
  return dir;
118789
118820
  } else {
118790
118821
  logger.warn(warning);
@@ -118853,7 +118884,7 @@ var listAppliedMigrations = /* @__PURE__ */ __name(async ({
118853
118884
  }, "listAppliedMigrations");
118854
118885
  function getMigrationNames(migrationsPath) {
118855
118886
  const migrations = [];
118856
- const dir = import_node_fs15.default.opendirSync(migrationsPath);
118887
+ const dir = import_node_fs13.default.opendirSync(migrationsPath);
118857
118888
  let dirent;
118858
118889
  while ((dirent = dir.readSync()) !== null) {
118859
118890
  if (dirent.name.endsWith(".sql")) {
@@ -119018,7 +119049,7 @@ Your database may not be available to serve requests during the migration, conti
119018
119049
  }
119019
119050
  }
119020
119051
  for (const migration of unappliedMigrations) {
119021
- let query = import_node_fs16.default.readFileSync(
119052
+ let query = import_node_fs14.default.readFileSync(
119022
119053
  `${migrationsPath}/${migration.name}`,
119023
119054
  "utf8"
119024
119055
  );
@@ -119087,7 +119118,7 @@ Your database may not be available to serve requests during the migration, conti
119087
119118
 
119088
119119
  // src/d1/migrations/create.ts
119089
119120
  init_import_meta_url();
119090
- var import_node_fs17 = __toESM(require("node:fs"));
119121
+ var import_node_fs15 = __toESM(require("node:fs"));
119091
119122
  var import_path11 = __toESM(require("path"));
119092
119123
  function CreateOptions2(yargs) {
119093
119124
  return Database(yargs).positional("message", {
@@ -119118,7 +119149,7 @@ var CreateHandler2 = withConfig(
119118
119149
  const nextMigrationNumber = pad(getNextMigrationNumber(migrationsPath), 4);
119119
119150
  const migrationName = message.replaceAll(" ", "_");
119120
119151
  const newMigrationName = `${nextMigrationNumber}_${migrationName}.sql`;
119121
- import_node_fs17.default.writeFileSync(
119152
+ import_node_fs15.default.writeFileSync(
119122
119153
  `${migrationsPath}/${newMigrationName}`,
119123
119154
  `-- Migration number: ${nextMigrationNumber} ${(/* @__PURE__ */ new Date()).toISOString()}
119124
119155
  `
@@ -119778,7 +119809,7 @@ __name(resolveEntryWithAssets, "resolveEntryWithAssets");
119778
119809
 
119779
119810
  // src/deployment-bundle/run-custom-build.ts
119780
119811
  init_import_meta_url();
119781
- var import_node_fs18 = require("node:fs");
119812
+ var import_node_fs16 = require("node:fs");
119782
119813
  var import_node_path32 = __toESM(require("node:path"));
119783
119814
  async function runCustomBuild(expectedEntryAbsolute, expectedEntryRelative, build5, configPath) {
119784
119815
  if (build5.command) {
@@ -119828,7 +119859,7 @@ function assertEntryPointExists(expectedEntryAbsolute, expectedEntryRelative, er
119828
119859
  }
119829
119860
  __name(assertEntryPointExists, "assertEntryPointExists");
119830
119861
  function getMissingEntryPointMessage(message, absoluteEntryPointPath, relativeEntryPointPath) {
119831
- if ((0, import_node_fs18.existsSync)(absoluteEntryPointPath) && (0, import_node_fs18.statSync)(absoluteEntryPointPath).isDirectory()) {
119862
+ if ((0, import_node_fs16.existsSync)(absoluteEntryPointPath) && (0, import_node_fs16.statSync)(absoluteEntryPointPath).isDirectory()) {
119832
119863
  message += `
119833
119864
  The provided entry-point path, "${relativeEntryPointPath}", points to a directory, rather than a file.
119834
119865
  `;
@@ -119860,11 +119891,11 @@ __name(getMissingEntryPointMessage, "getMissingEntryPointMessage");
119860
119891
  function fileExists(filePath) {
119861
119892
  const SOURCE_FILE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"];
119862
119893
  if (import_node_path32.default.extname(filePath) !== "") {
119863
- return (0, import_node_fs18.existsSync)(filePath);
119894
+ return (0, import_node_fs16.existsSync)(filePath);
119864
119895
  }
119865
119896
  const base = import_node_path32.default.join(import_node_path32.default.dirname(filePath), import_node_path32.default.basename(filePath));
119866
119897
  for (const ext of SOURCE_FILE_EXTENSIONS) {
119867
- if ((0, import_node_fs18.existsSync)(base + ext)) {
119898
+ if ((0, import_node_fs16.existsSync)(base + ext)) {
119868
119899
  return true;
119869
119900
  }
119870
119901
  }
@@ -120016,7 +120047,7 @@ __name(verifyWorkerMatchesCITag, "verifyWorkerMatchesCITag");
120016
120047
  // src/output.ts
120017
120048
  init_import_meta_url();
120018
120049
  var import_node_crypto9 = require("node:crypto");
120019
- var import_node_fs19 = require("node:fs");
120050
+ var import_node_fs17 = require("node:fs");
120020
120051
  var import_node_path34 = require("node:path");
120021
120052
  function writeOutput(entry) {
120022
120053
  if (outputFilePath === void 0) {
@@ -120028,7 +120059,7 @@ function writeOutput(entry) {
120028
120059
  ...entry,
120029
120060
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
120030
120061
  });
120031
- (0, import_node_fs19.appendFileSync)(outputFilePath, entryJSON + "\n");
120062
+ (0, import_node_fs17.appendFileSync)(outputFilePath, entryJSON + "\n");
120032
120063
  }
120033
120064
  }
120034
120065
  __name(writeOutput, "writeOutput");
@@ -120831,12 +120862,12 @@ var docs = createCommand({
120831
120862
 
120832
120863
  // src/generate/index.ts
120833
120864
  init_import_meta_url();
120834
- var import_node_fs21 = __toESM(require("node:fs"));
120865
+ var import_node_fs19 = __toESM(require("node:fs"));
120835
120866
  var import_node_path38 = __toESM(require("node:path"));
120836
120867
 
120837
120868
  // src/git-client.ts
120838
120869
  init_import_meta_url();
120839
- var import_node_fs20 = __toESM(require("node:fs"));
120870
+ var import_node_fs18 = __toESM(require("node:fs"));
120840
120871
  var import_node_os7 = __toESM(require("node:os"));
120841
120872
  var import_node_path36 = __toESM(require("node:path"));
120842
120873
 
@@ -120907,7 +120938,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
120907
120938
  args.push("-b", remote.substring(tagIndex + 1));
120908
120939
  args.push(remote.substring(0, tagIndex));
120909
120940
  }
120910
- const tempDir = import_node_fs20.default.mkdtempSync(
120941
+ const tempDir = import_node_fs18.default.mkdtempSync(
120911
120942
  import_node_path36.default.join(import_node_os7.default.tmpdir(), `wrangler-generate-repo-`)
120912
120943
  );
120913
120944
  args.push(tempDir);
@@ -120919,15 +120950,15 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
120919
120950
  }
120920
120951
  const templatePath = subdirectory !== void 0 ? import_node_path36.default.join(tempDir, subdirectory) : tempDir;
120921
120952
  try {
120922
- import_node_fs20.default.renameSync(templatePath, targetDirectory);
120953
+ import_node_fs18.default.renameSync(templatePath, targetDirectory);
120923
120954
  } catch (err) {
120924
120955
  if (err.code !== "EXDEV") {
120925
120956
  logger.debug(err);
120926
120957
  throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
120927
120958
  }
120928
120959
  try {
120929
- import_node_fs20.default.cpSync(templatePath, targetDirectory, { recursive: true });
120930
- import_node_fs20.default.rmSync(templatePath, {
120960
+ import_node_fs18.default.cpSync(templatePath, targetDirectory, { recursive: true });
120961
+ import_node_fs18.default.rmSync(templatePath, {
120931
120962
  recursive: true,
120932
120963
  force: true
120933
120964
  });
@@ -120936,7 +120967,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
120936
120967
  throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
120937
120968
  }
120938
120969
  }
120939
- import_node_fs20.default.rmSync(import_node_path36.default.join(targetDirectory, ".git"), {
120970
+ import_node_fs18.default.rmSync(import_node_path36.default.join(targetDirectory, ".git"), {
120940
120971
  recursive: true,
120941
120972
  force: true
120942
120973
  });
@@ -120945,7 +120976,7 @@ __name(cloneIntoDirectory, "cloneIntoDirectory");
120945
120976
 
120946
120977
  // src/init.ts
120947
120978
  init_import_meta_url();
120948
- var fs22 = __toESM(require("node:fs"));
120979
+ var fs20 = __toESM(require("node:fs"));
120949
120980
  var import_promises12 = require("node:fs/promises");
120950
120981
  var import_node_path37 = __toESM(require("node:path"));
120951
120982
  var import_toml6 = __toESM(require_toml());
@@ -120966,11 +120997,11 @@ var quote = /* @__PURE__ */ __name(function(args) {
120966
120997
  const stringArgs = args.map((arg) => String(arg));
120967
120998
  return import_shell_quote.default.quote(stringArgs);
120968
120999
  }, "quote");
120969
- function parse4(cmd, env7) {
121000
+ function parse4(cmd, env6) {
120970
121001
  if (process.platform === "win32") {
120971
121002
  cmd = cmd.replaceAll("\\", "\\\\");
120972
121003
  }
120973
- const entries = import_shell_quote.default.parse(cmd, env7);
121004
+ const entries = import_shell_quote.default.parse(cmd, env6);
120974
121005
  const argv = [];
120975
121006
  for (const entry of entries) {
120976
121007
  if (typeof entry === "string") {
@@ -121086,7 +121117,7 @@ async function initHandler(args) {
121086
121117
  }
121087
121118
  }
121088
121119
  }
121089
- if (fs22.existsSync(wranglerTomlDestination)) {
121120
+ if (fs20.existsSync(wranglerTomlDestination)) {
121090
121121
  let shouldContinue = false;
121091
121122
  logger.warn(
121092
121123
  `${import_node_path37.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
@@ -121164,7 +121195,7 @@ ${err.message ?? err}`
121164
121195
  await initializeGit(creationDirectory);
121165
121196
  await (0, import_promises12.writeFile)(
121166
121197
  import_node_path37.default.join(creationDirectory, ".gitignore"),
121167
- readFileSync5(import_node_path37.default.join(getBasePath(), "templates/gitignore"))
121198
+ readFileSync6(import_node_path37.default.join(getBasePath(), "templates/gitignore"))
121168
121199
  );
121169
121200
  logger.log(
121170
121201
  args.name && args.name !== "." ? `\u2728 Initialized git repository at ${import_node_path37.default.relative(
@@ -121211,7 +121242,7 @@ ${err.message ?? err}`
121211
121242
  }
121212
121243
  } else {
121213
121244
  const packageJson = parsePackageJSON(
121214
- readFileSync5(pathToPackageJson),
121245
+ readFileSync6(pathToPackageJson),
121215
121246
  pathToPackageJson
121216
121247
  );
121217
121248
  if (!(packageJson.devDependencies?.wrangler || packageJson.dependencies?.wrangler)) {
@@ -121238,7 +121269,7 @@ ${err.message ?? err}`
121238
121269
  isTypescriptProject = true;
121239
121270
  await (0, import_promises12.writeFile)(
121240
121271
  import_node_path37.default.join(creationDirectory, "./tsconfig.json"),
121241
- readFileSync5(import_node_path37.default.join(getBasePath(), "templates/tsconfig.init.json"))
121272
+ readFileSync6(import_node_path37.default.join(getBasePath(), "templates/tsconfig.init.json"))
121242
121273
  );
121243
121274
  devDepsToInstall.push("@cloudflare/workers-types");
121244
121275
  devDepsToInstall.push("typescript");
@@ -121250,7 +121281,7 @@ ${err.message ?? err}`
121250
121281
  } else {
121251
121282
  isTypescriptProject = true;
121252
121283
  const packageJson = parsePackageJSON(
121253
- readFileSync5(pathToPackageJson),
121284
+ readFileSync6(pathToPackageJson),
121254
121285
  pathToPackageJson
121255
121286
  );
121256
121287
  if (!(packageJson.devDependencies?.["@cloudflare/workers-types"] || packageJson.dependencies?.["@cloudflare/workers-types"])) {
@@ -121270,7 +121301,7 @@ ${err.message ?? err}`
121270
121301
  }
121271
121302
  }
121272
121303
  const packageJsonContent = parsePackageJSON(
121273
- readFileSync5(pathToPackageJson),
121304
+ readFileSync6(pathToPackageJson),
121274
121305
  pathToPackageJson
121275
121306
  );
121276
121307
  const shouldWritePackageJsonScripts = !packageJsonContent.scripts?.start && !packageJsonContent.scripts?.publish && shouldCreatePackageJson;
@@ -121288,7 +121319,7 @@ ${err.message ?? err}`
121288
121319
  }
121289
121320
  if (isCreatingWranglerToml) {
121290
121321
  const parsedWranglerToml = parseTOML(
121291
- readFileSync5(wranglerTomlDestination)
121322
+ readFileSync6(wranglerTomlDestination)
121292
121323
  );
121293
121324
  const newToml = {
121294
121325
  name: parsedWranglerToml.name,
@@ -121296,7 +121327,7 @@ ${err.message ?? err}`
121296
121327
  compatibility_date: parsedWranglerToml.compatibility_date,
121297
121328
  ...extraToml
121298
121329
  };
121299
- fs22.writeFileSync(wranglerTomlDestination, import_toml6.default.stringify(newToml));
121330
+ fs20.writeFileSync(wranglerTomlDestination, import_toml6.default.stringify(newToml));
121300
121331
  }
121301
121332
  const isNamedWorker = isCreatingWranglerToml && import_node_path37.default.dirname(packagePath) !== process.cwd();
121302
121333
  const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
@@ -121339,7 +121370,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
121339
121370
  }
121340
121371
  __name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
121341
121372
  if (isTypescriptProject) {
121342
- if (!fs22.existsSync(import_node_path37.default.join(creationDirectory, "./src/index.ts"))) {
121373
+ if (!fs20.existsSync(import_node_path37.default.join(creationDirectory, "./src/index.ts"))) {
121343
121374
  const newWorkerFilename = import_node_path37.default.relative(
121344
121375
  process.cwd(),
121345
121376
  import_node_path37.default.join(creationDirectory, "./src/index.ts")
@@ -121352,7 +121383,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
121352
121383
  });
121353
121384
  await (0, import_promises12.writeFile)(
121354
121385
  import_node_path37.default.join(creationDirectory, "./src/index.ts"),
121355
- readFileSync5(import_node_path37.default.join(getBasePath(), `templates/${template}`))
121386
+ readFileSync6(import_node_path37.default.join(getBasePath(), `templates/${template}`))
121356
121387
  );
121357
121388
  logger.log(
121358
121389
  `\u2728 Created ${import_node_path37.default.relative(
@@ -121371,7 +121402,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
121371
121402
  devDepsToInstall.push(newWorkerTestType);
121372
121403
  await (0, import_promises12.writeFile)(
121373
121404
  import_node_path37.default.join(creationDirectory, "./src/index.test.ts"),
121374
- readFileSync5(
121405
+ readFileSync6(
121375
121406
  import_node_path37.default.join(
121376
121407
  getBasePath(),
121377
121408
  `templates/init-tests/test-${newWorkerTestType}-new-worker.ts`
@@ -121397,7 +121428,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
121397
121428
  }
121398
121429
  }
121399
121430
  } else {
121400
- if (!fs22.existsSync(import_node_path37.default.join(creationDirectory, "./src/index.js"))) {
121431
+ if (!fs20.existsSync(import_node_path37.default.join(creationDirectory, "./src/index.js"))) {
121401
121432
  const newWorkerFilename = import_node_path37.default.relative(
121402
121433
  process.cwd(),
121403
121434
  import_node_path37.default.join(creationDirectory, "./src/index.js")
@@ -121445,7 +121476,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
121445
121476
  });
121446
121477
  await (0, import_promises12.writeFile)(
121447
121478
  import_node_path37.default.join(creationDirectory, "./src/index.js"),
121448
- readFileSync5(import_node_path37.default.join(getBasePath(), `templates/${template}`))
121479
+ readFileSync6(import_node_path37.default.join(getBasePath(), `templates/${template}`))
121449
121480
  );
121450
121481
  logger.log(
121451
121482
  `\u2728 Created ${import_node_path37.default.relative(
@@ -121459,7 +121490,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
121459
121490
  devDepsToInstall.push(newWorkerTestType);
121460
121491
  await (0, import_promises12.writeFile)(
121461
121492
  import_node_path37.default.join(creationDirectory, "./src/index.test.js"),
121462
- readFileSync5(
121493
+ readFileSync6(
121463
121494
  import_node_path37.default.join(
121464
121495
  getBasePath(),
121465
121496
  `templates/init-tests/test-${newWorkerTestType}-new-worker.js`
@@ -121582,7 +121613,7 @@ function getNewWorkerToml(workerType) {
121582
121613
  __name(getNewWorkerToml, "getNewWorkerToml");
121583
121614
  async function findPath(isolatedInit, cwd2, basename7) {
121584
121615
  if (isolatedInit) {
121585
- return fs22.existsSync(import_node_path37.default.resolve(cwd2, basename7)) ? import_node_path37.default.resolve(cwd2, basename7) : void 0;
121616
+ return fs20.existsSync(import_node_path37.default.resolve(cwd2, basename7)) ? import_node_path37.default.resolve(cwd2, basename7) : void 0;
121586
121617
  } else {
121587
121618
  return await findUp(basename7, {
121588
121619
  cwd: cwd2
@@ -122088,7 +122119,7 @@ __name(generateHandler, "generateHandler");
122088
122119
  function generateWorkerDirectoryName(workerName) {
122089
122120
  let workerDirectoryPath = import_node_path38.default.resolve(process.cwd(), workerName);
122090
122121
  let i5 = 1;
122091
- while (import_node_fs21.default.existsSync(workerDirectoryPath)) {
122122
+ while (import_node_fs19.default.existsSync(workerDirectoryPath)) {
122092
122123
  workerDirectoryPath = import_node_path38.default.resolve(process.cwd(), `${workerName}-${i5}`);
122093
122124
  i5++;
122094
122125
  }
@@ -123129,7 +123160,7 @@ var kvBulkPutCommand = createCommand({
123129
123160
  async handler({ filename, ...args }) {
123130
123161
  const config = readConfig(args);
123131
123162
  const namespaceId = getKVNamespaceId(args, config);
123132
- const content = parseJSON(readFileSync5(filename), filename);
123163
+ const content = parseJSON(readFileSync6(filename), filename);
123133
123164
  if (!Array.isArray(content)) {
123134
123165
  throw new UserError(
123135
123166
  `Unexpected JSON input from "${filename}".
@@ -123257,7 +123288,7 @@ var kvBulkDeleteCommand = createCommand({
123257
123288
  return;
123258
123289
  }
123259
123290
  }
123260
- const content = parseJSON(readFileSync5(filename), filename);
123291
+ const content = parseJSON(readFileSync6(filename), filename);
123261
123292
  if (!Array.isArray(content)) {
123262
123293
  throw new UserError(
123263
123294
  `Unexpected JSON input from "${filename}".
@@ -123496,13 +123527,13 @@ init_import_meta_url();
123496
123527
  // src/pages/build.ts
123497
123528
  init_import_meta_url();
123498
123529
  var import_node_crypto11 = require("node:crypto");
123499
- var import_node_fs24 = require("node:fs");
123530
+ var import_node_fs22 = require("node:fs");
123500
123531
  var import_promises17 = require("node:fs/promises");
123501
123532
  var import_node_path47 = __toESM(require("node:path"));
123502
123533
 
123503
123534
  // src/api/pages/create-worker-bundle-contents.ts
123504
123535
  init_import_meta_url();
123505
- var import_node_fs22 = require("node:fs");
123536
+ var import_node_fs20 = require("node:fs");
123506
123537
  var import_node_path39 = __toESM(require("node:path"));
123507
123538
  var import_undici12 = __toESM(require_undici());
123508
123539
  async function createUploadWorkerBundleContents(workerBundle, config) {
@@ -123519,7 +123550,7 @@ function createWorkerBundleFormData(workerBundle, config) {
123519
123550
  const mainModule = {
123520
123551
  name: import_node_path39.default.basename(workerBundle.resolvedEntryPointPath),
123521
123552
  filePath: workerBundle.resolvedEntryPointPath,
123522
- content: (0, import_node_fs22.readFileSync)(workerBundle.resolvedEntryPointPath, {
123553
+ content: (0, import_node_fs20.readFileSync)(workerBundle.resolvedEntryPointPath, {
123523
123554
  encoding: "utf-8"
123524
123555
  }),
123525
123556
  type: workerBundle.bundleType || "esm"
@@ -123549,7 +123580,7 @@ __name(createWorkerBundleFormData, "createWorkerBundleFormData");
123549
123580
 
123550
123581
  // src/pages/buildFunctions.ts
123551
123582
  init_import_meta_url();
123552
- var import_node_fs23 = require("node:fs");
123583
+ var import_node_fs21 = require("node:fs");
123553
123584
  var import_node_path46 = require("node:path");
123554
123585
 
123555
123586
  // src/pages/functions/buildPlugin.ts
@@ -124547,10 +124578,10 @@ async function buildFunctions({
124547
124578
  }
124548
124579
  if (routesOutputPath) {
124549
124580
  const routesJSON = convertRoutesToRoutesJSONSpec(config.routes);
124550
- (0, import_node_fs23.writeFileSync)(routesOutputPath, JSON.stringify(routesJSON, null, 2));
124581
+ (0, import_node_fs21.writeFileSync)(routesOutputPath, JSON.stringify(routesJSON, null, 2));
124551
124582
  }
124552
124583
  if (outputConfigPath) {
124553
- (0, import_node_fs23.writeFileSync)(
124584
+ (0, import_node_fs21.writeFileSync)(
124554
124585
  outputConfigPath,
124555
124586
  JSON.stringify({ ...config, baseURL }, null, 2)
124556
124587
  );
@@ -124749,7 +124780,7 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
124749
124780
  }
124750
124781
  }
124751
124782
  if (outfile && outfile !== bundle.resolvedEntryPointPath) {
124752
- (0, import_node_fs24.writeFileSync)(
124783
+ (0, import_node_fs22.writeFileSync)(
124753
124784
  outfile,
124754
124785
  `export { default } from './${(0, import_node_path47.relative)(
124755
124786
  (0, import_node_path47.dirname)(outfile),
@@ -124780,7 +124811,7 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
124780
124811
  external
124781
124812
  } = validatedArgs;
124782
124813
  if (workerScriptPath) {
124783
- if ((0, import_node_fs24.lstatSync)(workerScriptPath).isDirectory()) {
124814
+ if ((0, import_node_fs22.lstatSync)(workerScriptPath).isDirectory()) {
124784
124815
  bundle = await produceWorkerBundleForWorkerJSDirectory({
124785
124816
  workerJSDirectory: workerScriptPath,
124786
124817
  bundle: true,
@@ -124842,14 +124873,14 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
124842
124873
  bundle,
124843
124874
  config
124844
124875
  );
124845
- (0, import_node_fs24.mkdirSync)((0, import_node_path47.dirname)(outfile), { recursive: true });
124846
- (0, import_node_fs24.writeFileSync)(
124876
+ (0, import_node_fs22.mkdirSync)((0, import_node_path47.dirname)(outfile), { recursive: true });
124877
+ (0, import_node_fs22.writeFileSync)(
124847
124878
  outfile,
124848
124879
  Buffer.from(await workerBundleContents.arrayBuffer())
124849
124880
  );
124850
124881
  }
124851
124882
  if (buildMetadataPath && buildMetadata) {
124852
- (0, import_node_fs24.writeFileSync)(buildMetadataPath, JSON.stringify(buildMetadata));
124883
+ (0, import_node_fs22.writeFileSync)(buildMetadataPath, JSON.stringify(buildMetadata));
124853
124884
  }
124854
124885
  }
124855
124886
  sendMetricsEvent("build pages functions");
@@ -124861,7 +124892,7 @@ async function maybeReadPagesConfig(args) {
124861
124892
  const { configPath } = findWranglerConfig(args.projectDirectory, {
124862
124893
  useRedirectIfAvailable: true
124863
124894
  });
124864
- if (!configPath || !(0, import_node_fs24.existsSync)(configPath)) {
124895
+ if (!configPath || !(0, import_node_fs22.existsSync)(configPath)) {
124865
124896
  return void 0;
124866
124897
  }
124867
124898
  try {
@@ -124952,10 +124983,10 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
124952
124983
  args.buildOutputDirectory,
124953
124984
  "_worker.js"
124954
124985
  );
124955
- const foundWorkerScript = (0, import_node_fs24.existsSync)(prospectiveWorkerScriptPath);
124986
+ const foundWorkerScript = (0, import_node_fs22.existsSync)(prospectiveWorkerScriptPath);
124956
124987
  if (foundWorkerScript) {
124957
124988
  workerScriptPath = prospectiveWorkerScriptPath;
124958
- } else if (!foundWorkerScript && !(0, import_node_fs24.existsSync)(args.directory)) {
124989
+ } else if (!foundWorkerScript && !(0, import_node_fs22.existsSync)(args.directory)) {
124959
124990
  throw new FatalError(
124960
124991
  `Could not find anything to build.
124961
124992
  We first looked inside the build output directory (${(0, import_node_path47.basename)(
@@ -124968,7 +124999,7 @@ We first looked inside the build output directory (${(0, import_node_path47.base
124968
124999
  EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR
124969
125000
  );
124970
125001
  }
124971
- } else if (!(0, import_node_fs24.existsSync)(args.directory)) {
125002
+ } else if (!(0, import_node_fs22.existsSync)(args.directory)) {
124972
125003
  throw new FatalError(
124973
125004
  `Could not find anything to build.
124974
125005
  We looked for the Functions directory (${(0, import_node_path47.basename)(
@@ -124997,7 +125028,7 @@ We looked for the Functions directory (${(0, import_node_path47.basename)(
124997
125028
 
124998
125029
  // src/pages/build-env.ts
124999
125030
  init_import_meta_url();
125000
- var import_node_fs25 = require("node:fs");
125031
+ var import_node_fs23 = require("node:fs");
125001
125032
  var import_node_path48 = __toESM(require("node:path"));
125002
125033
  function Options9(yargs) {
125003
125034
  return yargs.positional("projectDir", {
@@ -125024,7 +125055,7 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
125024
125055
  const { configPath } = findWranglerConfig(args.projectDir, {
125025
125056
  useRedirectIfAvailable: true
125026
125057
  });
125027
- if (!configPath || !(0, import_node_fs25.existsSync)(configPath)) {
125058
+ if (!configPath || !(0, import_node_fs23.existsSync)(configPath)) {
125028
125059
  logger.debug("No Wrangler configuration file found. Exiting.");
125029
125060
  process.exitCode = EXIT_CODE_NO_CONFIG_FOUND;
125030
125061
  return;
@@ -125060,7 +125091,7 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
125060
125091
  config.pages_build_output_dir
125061
125092
  )
125062
125093
  };
125063
- (0, import_node_fs25.writeFileSync)(args.outfile, JSON.stringify(buildConfiguration));
125094
+ (0, import_node_fs23.writeFileSync)(args.outfile, JSON.stringify(buildConfiguration));
125064
125095
  logger.debug(`Build configuration written to ${args.outfile}`);
125065
125096
  logger.debug(JSON.stringify(buildConfiguration), null, 2);
125066
125097
  const vars = Object.entries(buildConfiguration.vars);
@@ -125083,7 +125114,7 @@ var import_node_path53 = __toESM(require("node:path"));
125083
125114
  // src/api/pages/deploy.ts
125084
125115
  init_import_meta_url();
125085
125116
  var import_node_crypto12 = require("node:crypto");
125086
- var import_node_fs27 = require("node:fs");
125117
+ var import_node_fs25 = require("node:fs");
125087
125118
  var import_promises20 = require("node:fs/promises");
125088
125119
  var import_node_path52 = __toESM(require("node:path"));
125089
125120
  var import_node_process11 = require("node:process");
@@ -125482,21 +125513,21 @@ async function deploy2({
125482
125513
  bundle = bundle ?? true;
125483
125514
  const _workerPath = (0, import_node_path52.resolve)(directory, "_worker.js");
125484
125515
  try {
125485
- _headers = (0, import_node_fs27.readFileSync)((0, import_node_path52.join)(directory, "_headers"), "utf-8");
125516
+ _headers = (0, import_node_fs25.readFileSync)((0, import_node_path52.join)(directory, "_headers"), "utf-8");
125486
125517
  } catch {
125487
125518
  }
125488
125519
  try {
125489
- _redirects = (0, import_node_fs27.readFileSync)((0, import_node_path52.join)(directory, "_redirects"), "utf-8");
125520
+ _redirects = (0, import_node_fs25.readFileSync)((0, import_node_path52.join)(directory, "_redirects"), "utf-8");
125490
125521
  } catch {
125491
125522
  }
125492
125523
  try {
125493
- _routesCustom = (0, import_node_fs27.readFileSync)((0, import_node_path52.join)(directory, "_routes.json"), "utf-8");
125524
+ _routesCustom = (0, import_node_fs25.readFileSync)((0, import_node_path52.join)(directory, "_routes.json"), "utf-8");
125494
125525
  } catch {
125495
125526
  }
125496
125527
  try {
125497
- _workerJSIsDirectory = (0, import_node_fs27.lstatSync)(_workerPath).isDirectory();
125528
+ _workerJSIsDirectory = (0, import_node_fs25.lstatSync)(_workerPath).isDirectory();
125498
125529
  if (!_workerJSIsDirectory) {
125499
- _workerJS = (0, import_node_fs27.readFileSync)(_workerPath, "utf-8");
125530
+ _workerJS = (0, import_node_fs25.readFileSync)(_workerPath, "utf-8");
125500
125531
  }
125501
125532
  } catch {
125502
125533
  }
@@ -125507,12 +125538,12 @@ async function deploy2({
125507
125538
  if (branch) {
125508
125539
  isProduction = project.production_branch === branch;
125509
125540
  }
125510
- const env7 = isProduction ? "production" : "preview";
125511
- const deploymentConfig = project.deployment_configs[env7];
125541
+ const env6 = isProduction ? "production" : "preview";
125542
+ const deploymentConfig = project.deployment_configs[env6];
125512
125543
  let config;
125513
125544
  try {
125514
125545
  config = readPagesConfig(
125515
- { ...args, env: env7 },
125546
+ { ...args, env: env6 },
125516
125547
  { useRedirectIfAvailable: true }
125517
125548
  );
125518
125549
  } catch (err) {
@@ -125539,9 +125570,9 @@ async function deploy2({
125539
125570
  let builtFunctions = void 0;
125540
125571
  let workerBundle = void 0;
125541
125572
  const functionsDirectory = customFunctionsDirectory || (0, import_node_path52.join)((0, import_node_process11.cwd)(), "functions");
125542
- const routesOutputPath = !(0, import_node_fs27.existsSync)((0, import_node_path52.join)(directory, "_routes.json")) ? (0, import_node_path52.join)(getPagesTmpDir(), `_routes-${Math.random()}.json`) : void 0;
125573
+ const routesOutputPath = !(0, import_node_fs25.existsSync)((0, import_node_path52.join)(directory, "_routes.json")) ? (0, import_node_path52.join)(getPagesTmpDir(), `_routes-${Math.random()}.json`) : void 0;
125543
125574
  let filepathRoutingConfig;
125544
- if (!_workerJS && (0, import_node_fs27.existsSync)(functionsDirectory)) {
125575
+ if (!_workerJS && (0, import_node_fs25.existsSync)(functionsDirectory)) {
125545
125576
  const outputConfigPath = (0, import_node_path52.join)(
125546
125577
  getPagesTmpDir(),
125547
125578
  `functions-filepath-routing-config-${Math.random()}.json`
@@ -125560,11 +125591,11 @@ async function deploy2({
125560
125591
  defineNavigatorUserAgent,
125561
125592
  checkFetch
125562
125593
  });
125563
- builtFunctions = (0, import_node_fs27.readFileSync)(
125594
+ builtFunctions = (0, import_node_fs25.readFileSync)(
125564
125595
  workerBundle.resolvedEntryPointPath,
125565
125596
  "utf-8"
125566
125597
  );
125567
- filepathRoutingConfig = (0, import_node_fs27.readFileSync)(outputConfigPath, "utf-8");
125598
+ filepathRoutingConfig = (0, import_node_fs25.readFileSync)(outputConfigPath, "utf-8");
125568
125599
  } catch (e7) {
125569
125600
  if (e7 instanceof FunctionsNoRoutesError) {
125570
125601
  logger.warn(
@@ -125715,7 +125746,7 @@ async function deploy2({
125715
125746
  }
125716
125747
  } else if (routesOutputPath) {
125717
125748
  try {
125718
- _routesGenerated = (0, import_node_fs27.readFileSync)(routesOutputPath, "utf-8");
125749
+ _routesGenerated = (0, import_node_fs25.readFileSync)(routesOutputPath, "utf-8");
125719
125750
  if (_routesGenerated) {
125720
125751
  formData.append(
125721
125752
  "_routes.json",
@@ -126638,12 +126669,12 @@ __name(prettifyOutcome, "prettifyOutcome");
126638
126669
 
126639
126670
  // src/tail/createTail.ts
126640
126671
  var TRACE_VERSION = "trace-v1";
126641
- function makeCreateTailUrl(accountId, workerName, env7) {
126642
- return env7 ? `/accounts/${accountId}/workers/services/${workerName}/environments/${env7}/tails` : `/accounts/${accountId}/workers/scripts/${workerName}/tails`;
126672
+ function makeCreateTailUrl(accountId, workerName, env6) {
126673
+ return env6 ? `/accounts/${accountId}/workers/services/${workerName}/environments/${env6}/tails` : `/accounts/${accountId}/workers/scripts/${workerName}/tails`;
126643
126674
  }
126644
126675
  __name(makeCreateTailUrl, "makeCreateTailUrl");
126645
- function makeDeleteTailUrl(accountId, workerName, tailId, env7) {
126646
- return env7 ? `/accounts/${accountId}/workers/services/${workerName}/environments/${env7}/tails/${tailId}` : `/accounts/${accountId}/workers/scripts/${workerName}/tails/${tailId}`;
126676
+ function makeDeleteTailUrl(accountId, workerName, tailId, env6) {
126677
+ return env6 ? `/accounts/${accountId}/workers/services/${workerName}/environments/${env6}/tails/${tailId}` : `/accounts/${accountId}/workers/scripts/${workerName}/tails/${tailId}`;
126647
126678
  }
126648
126679
  __name(makeDeleteTailUrl, "makeDeleteTailUrl");
126649
126680
  async function createPagesTail({
@@ -126687,8 +126718,8 @@ async function createPagesTail({
126687
126718
  return { tail, deleteTail, expiration: tailRecord.expires_at };
126688
126719
  }
126689
126720
  __name(createPagesTail, "createPagesTail");
126690
- async function createTail(accountId, workerName, filters, debug, env7) {
126691
- const createTailUrl = makeCreateTailUrl(accountId, workerName, env7);
126721
+ async function createTail(accountId, workerName, filters, debug, env6) {
126722
+ const createTailUrl = makeCreateTailUrl(accountId, workerName, env6);
126692
126723
  const {
126693
126724
  id: tailId,
126694
126725
  url: websocketUrl,
@@ -126697,7 +126728,7 @@ async function createTail(accountId, workerName, filters, debug, env7) {
126697
126728
  method: "POST",
126698
126729
  body: JSON.stringify(filters)
126699
126730
  });
126700
- const deleteUrl = makeDeleteTailUrl(accountId, workerName, tailId, env7);
126731
+ const deleteUrl = makeDeleteTailUrl(accountId, workerName, tailId, env6);
126701
126732
  async function deleteTail() {
126702
126733
  await fetchResult(deleteUrl, { method: "DELETE" });
126703
126734
  }
@@ -126993,7 +127024,7 @@ __name(ListHandler4, "ListHandler");
126993
127024
  init_import_meta_url();
126994
127025
  var import_node_child_process5 = require("node:child_process");
126995
127026
  var import_node_events3 = __toESM(require("node:events"));
126996
- var import_node_fs28 = require("node:fs");
127027
+ var import_node_fs26 = require("node:fs");
126997
127028
  var import_node_path54 = __toESM(require("node:path"));
126998
127029
  init_esm2();
126999
127030
  var esbuild3 = __toESM(require("esbuild"));
@@ -127276,11 +127307,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
127276
127307
  );
127277
127308
  const singleWorkerScriptPath = args.scriptPath ?? DEFAULT_SCRIPT_PATH;
127278
127309
  const workerScriptPath = directory !== void 0 ? (0, import_node_path54.join)(directory, singleWorkerScriptPath) : (0, import_node_path54.resolve)(singleWorkerScriptPath);
127279
- const usingWorkerDirectory = (0, import_node_fs28.existsSync)(workerScriptPath) && (0, import_node_fs28.lstatSync)(workerScriptPath).isDirectory();
127280
- const usingWorkerScript = (0, import_node_fs28.existsSync)(workerScriptPath);
127310
+ const usingWorkerDirectory = (0, import_node_fs26.existsSync)(workerScriptPath) && (0, import_node_fs26.lstatSync)(workerScriptPath).isDirectory();
127311
+ const usingWorkerScript = (0, import_node_fs26.existsSync)(workerScriptPath);
127281
127312
  const enableBundling = args.bundle ?? !args.noBundle;
127282
127313
  const functionsDirectory = "./functions";
127283
- let usingFunctions = !usingWorkerScript && (0, import_node_fs28.existsSync)(functionsDirectory);
127314
+ let usingFunctions = !usingWorkerScript && (0, import_node_fs26.existsSync)(functionsDirectory);
127284
127315
  let scriptPath3 = "";
127285
127316
  const nodejsCompatMode = validateNodeCompatMode(
127286
127317
  args.compatibilityDate ?? config.compatibility_date,
@@ -127488,7 +127519,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
127488
127519
  let scriptEntrypoint = scriptPath3;
127489
127520
  if (directory && (usingFunctions || usingWorkerScript || usingWorkerDirectory)) {
127490
127521
  const routesJSONPath = (0, import_node_path54.join)(directory, "_routes.json");
127491
- if ((0, import_node_fs28.existsSync)(routesJSONPath)) {
127522
+ if ((0, import_node_fs26.existsSync)(routesJSONPath)) {
127492
127523
  let routesJSONContents;
127493
127524
  const runBuild2 = /* @__PURE__ */ __name(async (entrypointFile, outfile, routes) => {
127494
127525
  await esbuild3.build({
@@ -127514,7 +127545,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
127514
127545
  });
127515
127546
  }, "runBuild");
127516
127547
  try {
127517
- routesJSONContents = (0, import_node_fs28.readFileSync)(routesJSONPath, "utf-8");
127548
+ routesJSONContents = (0, import_node_fs26.readFileSync)(routesJSONPath, "utf-8");
127518
127549
  validateRoutes(JSON.parse(routesJSONContents), directory);
127519
127550
  scriptEntrypoint = (0, import_node_path54.join)(
127520
127551
  getPagesTmpDir(),
@@ -127539,7 +127570,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
127539
127570
  if (event === "unlink") {
127540
127571
  return;
127541
127572
  }
127542
- routesJSONContents = (0, import_node_fs28.readFileSync)(routesJSONPath, "utf-8");
127573
+ routesJSONContents = (0, import_node_fs26.readFileSync)(routesJSONPath, "utf-8");
127543
127574
  validateRoutes(JSON.parse(routesJSONContents), directory);
127544
127575
  await runBuild2(scriptPath3, scriptEntrypoint, routesJSONContents);
127545
127576
  } catch (err) {
@@ -128133,7 +128164,7 @@ var Handler15 = /* @__PURE__ */ __name(async ({ projectName, force }) => {
128133
128164
 
128134
128165
  // src/pages/functions.ts
128135
128166
  init_import_meta_url();
128136
- var import_node_fs29 = require("node:fs");
128167
+ var import_node_fs27 = require("node:fs");
128137
128168
  var import_node_path55 = __toESM(require("node:path"));
128138
128169
  function OptimizeRoutesOptions(yargs) {
128139
128170
  return yargs.options({
@@ -128157,20 +128188,20 @@ async function OptimizeRoutesHandler({
128157
128188
  }) {
128158
128189
  let routesFileContents;
128159
128190
  const routesOutputDirectory = import_node_path55.default.dirname(outputRoutesPath);
128160
- if (!(0, import_node_fs29.existsSync)(routesPath)) {
128191
+ if (!(0, import_node_fs27.existsSync)(routesPath)) {
128161
128192
  throw new FatalError(
128162
128193
  `Oops! File ${routesPath} does not exist. Please make sure --routes-path is a valid file path (for example "/public/_routes.json").`,
128163
128194
  1
128164
128195
  );
128165
128196
  }
128166
- if (!(0, import_node_fs29.existsSync)(routesOutputDirectory) || !(0, import_node_fs29.lstatSync)(routesOutputDirectory).isDirectory()) {
128197
+ if (!(0, import_node_fs27.existsSync)(routesOutputDirectory) || !(0, import_node_fs27.lstatSync)(routesOutputDirectory).isDirectory()) {
128167
128198
  throw new FatalError(
128168
128199
  `Oops! Folder ${routesOutputDirectory} does not exist. Please make sure --output-routes-path is a valid file path (for example "/public/_routes.json").`,
128169
128200
  1
128170
128201
  );
128171
128202
  }
128172
128203
  try {
128173
- routesFileContents = (0, import_node_fs29.readFileSync)(routesPath, "utf-8");
128204
+ routesFileContents = (0, import_node_fs27.readFileSync)(routesPath, "utf-8");
128174
128205
  } catch (err) {
128175
128206
  throw new FatalError(`Error while reading ${routesPath} file: ${err}`);
128176
128207
  }
@@ -128179,7 +128210,7 @@ async function OptimizeRoutesHandler({
128179
128210
  const optimizedRoutes = optimizeRoutesJSONSpec(routes);
128180
128211
  const optimizedRoutesContents = JSON.stringify(optimizedRoutes);
128181
128212
  try {
128182
- (0, import_node_fs29.writeFileSync)(outputRoutesPath, optimizedRoutesContents);
128213
+ (0, import_node_fs27.writeFileSync)(outputRoutesPath, optimizedRoutesContents);
128183
128214
  } catch (err) {
128184
128215
  throw new FatalError(
128185
128216
  `Error writing to ${outputRoutesPath} file: ${err}`,
@@ -128661,7 +128692,7 @@ async function parseBulkInputToObject(input) {
128661
128692
  if (input) {
128662
128693
  const jsonFilePath = import_node_path56.default.resolve(input);
128663
128694
  try {
128664
- const fileContent = readFileSync5(jsonFilePath);
128695
+ const fileContent = readFileSync6(jsonFilePath);
128665
128696
  try {
128666
128697
  content = parseJSON(fileContent);
128667
128698
  } catch (e7) {
@@ -128700,15 +128731,15 @@ async function parseBulkInputToObject(input) {
128700
128731
  __name(parseBulkInputToObject, "parseBulkInputToObject");
128701
128732
 
128702
128733
  // src/pages/secret/index.ts
128703
- function isPagesEnv(env7) {
128704
- return ["production", "preview"].includes(env7);
128734
+ function isPagesEnv(env6) {
128735
+ return ["production", "preview"].includes(env6);
128705
128736
  }
128706
128737
  __name(isPagesEnv, "isPagesEnv");
128707
- async function pagesProject(env7, cliProjectName) {
128708
- env7 ??= "production";
128709
- if (!isPagesEnv(env7)) {
128738
+ async function pagesProject(env6, cliProjectName) {
128739
+ env6 ??= "production";
128740
+ if (!isPagesEnv(env6)) {
128710
128741
  throw new FatalError(
128711
- `Pages does not support the "${env7}" named environment. Please specify "production" (default) or "preview"`,
128742
+ `Pages does not support the "${env6}" named environment. Please specify "production" (default) or "preview"`,
128712
128743
  1
128713
128744
  );
128714
128745
  }
@@ -128749,7 +128780,7 @@ Ignoring configuration file for now.`
128749
128780
  } else {
128750
128781
  throw new FatalError("Must specify a project name.", 1);
128751
128782
  }
128752
- return { env: env7, project, accountId, config };
128783
+ return { env: env6, project, accountId, config };
128753
128784
  }
128754
128785
  __name(pagesProject, "pagesProject");
128755
128786
  var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
@@ -128768,7 +128799,7 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128768
128799
  },
128769
128800
  async (args) => {
128770
128801
  await printWranglerBanner();
128771
- const { env: env7, project, accountId, config } = await pagesProject(
128802
+ const { env: env6, project, accountId, config } = await pagesProject(
128772
128803
  args.env,
128773
128804
  args.projectName
128774
128805
  );
@@ -128776,7 +128807,7 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128776
128807
  isInteractive2() ? await prompt("Enter a secret value:", { isSecret: true }) : await readFromStdin()
128777
128808
  );
128778
128809
  logger.log(
128779
- `\u{1F300} Creating the secret for the Pages project "${project.name}" (${env7})`
128810
+ `\u{1F300} Creating the secret for the Pages project "${project.name}" (${env6})`
128780
128811
  );
128781
128812
  await fetchResult(
128782
128813
  `/accounts/${accountId}/pages/projects/${project.name}`,
@@ -128784,14 +128815,14 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128784
128815
  method: "PATCH",
128785
128816
  body: JSON.stringify({
128786
128817
  deployment_configs: {
128787
- [env7]: {
128818
+ [env6]: {
128788
128819
  env_vars: {
128789
128820
  [args.key]: {
128790
128821
  value: secretValue,
128791
128822
  type: "secret_text"
128792
128823
  }
128793
128824
  },
128794
- wrangler_config_hash: project.deployment_configs[env7].wrangler_config_hash
128825
+ wrangler_config_hash: project.deployment_configs[env6].wrangler_config_hash
128795
128826
  }
128796
128827
  }
128797
128828
  })
@@ -128817,12 +128848,12 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128817
128848
  },
128818
128849
  async (args) => {
128819
128850
  await printWranglerBanner();
128820
- const { env: env7, project, accountId } = await pagesProject(
128851
+ const { env: env6, project, accountId } = await pagesProject(
128821
128852
  args.env,
128822
128853
  args.projectName
128823
128854
  );
128824
128855
  logger.log(
128825
- `\u{1F300} Creating the secrets for the Pages project "${project.name}" (${env7})`
128856
+ `\u{1F300} Creating the secrets for the Pages project "${project.name}" (${env6})`
128826
128857
  );
128827
128858
  const content = await parseBulkInputToObject(args.json);
128828
128859
  if (!content) {
@@ -128846,11 +128877,11 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128846
128877
  method: "PATCH",
128847
128878
  body: JSON.stringify({
128848
128879
  deployment_configs: {
128849
- [env7]: {
128880
+ [env6]: {
128850
128881
  env_vars: {
128851
128882
  ...upsertBindings
128852
128883
  },
128853
- wrangler_config_hash: project.deployment_configs[env7].wrangler_config_hash
128884
+ wrangler_config_hash: project.deployment_configs[env6].wrangler_config_hash
128854
128885
  }
128855
128886
  }
128856
128887
  })
@@ -128883,15 +128914,15 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128883
128914
  },
128884
128915
  async (args) => {
128885
128916
  await printWranglerBanner();
128886
- const { env: env7, project, accountId, config } = await pagesProject(
128917
+ const { env: env6, project, accountId, config } = await pagesProject(
128887
128918
  args.env,
128888
128919
  args.projectName
128889
128920
  );
128890
128921
  if (await confirm(
128891
- `Are you sure you want to permanently delete the secret ${args.key} on the Pages project ${project.name} (${env7})?`
128922
+ `Are you sure you want to permanently delete the secret ${args.key} on the Pages project ${project.name} (${env6})?`
128892
128923
  )) {
128893
128924
  logger.log(
128894
- `\u{1F300} Deleting the secret ${args.key} on the Pages project ${project.name} (${env7})`
128925
+ `\u{1F300} Deleting the secret ${args.key} on the Pages project ${project.name} (${env6})`
128895
128926
  );
128896
128927
  await fetchResult(
128897
128928
  `/accounts/${accountId}/pages/projects/${project.name}`,
@@ -128899,11 +128930,11 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128899
128930
  method: "PATCH",
128900
128931
  body: JSON.stringify({
128901
128932
  deployment_configs: {
128902
- [env7]: {
128933
+ [env6]: {
128903
128934
  env_vars: {
128904
128935
  [args.key]: null
128905
128936
  },
128906
- wrangler_config_hash: project.deployment_configs[env7].wrangler_config_hash
128937
+ wrangler_config_hash: project.deployment_configs[env6].wrangler_config_hash
128907
128938
  }
128908
128939
  }
128909
128940
  })
@@ -128927,16 +128958,16 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
128927
128958
  },
128928
128959
  async (args) => {
128929
128960
  await printWranglerBanner();
128930
- const { env: env7, project, config } = await pagesProject(
128961
+ const { env: env6, project, config } = await pagesProject(
128931
128962
  args.env,
128932
128963
  args.projectName
128933
128964
  );
128934
128965
  const secrets = Object.entries(
128935
- project.deployment_configs[env7].env_vars ?? {}
128966
+ project.deployment_configs[env6].env_vars ?? {}
128936
128967
  ).filter(([_4, val2]) => val2?.type === "secret_text");
128937
128968
  const message = [
128938
128969
  `The "${source_default.blue(
128939
- env7
128970
+ env6
128940
128971
  )}" environment of your Pages project "${source_default.blue(
128941
128972
  project.name
128942
128973
  )}" has access to the following secrets:`,
@@ -129146,7 +129177,7 @@ var stringUnionSelector = /* @__PURE__ */ __name((obj, key, union, type) => {
129146
129177
  var ENV_REQUEST_CHECKSUM_CALCULATION = "AWS_REQUEST_CHECKSUM_CALCULATION";
129147
129178
  var CONFIG_REQUEST_CHECKSUM_CALCULATION = "request_checksum_calculation";
129148
129179
  var NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS = {
129149
- environmentVariableSelector: (env7) => stringUnionSelector(env7, ENV_REQUEST_CHECKSUM_CALCULATION, RequestChecksumCalculation, SelectorType.ENV),
129180
+ environmentVariableSelector: (env6) => stringUnionSelector(env6, ENV_REQUEST_CHECKSUM_CALCULATION, RequestChecksumCalculation, SelectorType.ENV),
129150
129181
  configFileSelector: (profile) => stringUnionSelector(profile, CONFIG_REQUEST_CHECKSUM_CALCULATION, RequestChecksumCalculation, SelectorType.CONFIG),
129151
129182
  default: DEFAULT_REQUEST_CHECKSUM_CALCULATION
129152
129183
  };
@@ -129156,7 +129187,7 @@ init_import_meta_url();
129156
129187
  var ENV_RESPONSE_CHECKSUM_VALIDATION = "AWS_RESPONSE_CHECKSUM_VALIDATION";
129157
129188
  var CONFIG_RESPONSE_CHECKSUM_VALIDATION = "response_checksum_validation";
129158
129189
  var NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS = {
129159
- environmentVariableSelector: (env7) => stringUnionSelector(env7, ENV_RESPONSE_CHECKSUM_VALIDATION, ResponseChecksumValidation, SelectorType.ENV),
129190
+ environmentVariableSelector: (env6) => stringUnionSelector(env6, ENV_RESPONSE_CHECKSUM_VALIDATION, ResponseChecksumValidation, SelectorType.ENV),
129160
129191
  configFileSelector: (profile) => stringUnionSelector(profile, CONFIG_RESPONSE_CHECKSUM_VALIDATION, ResponseChecksumValidation, SelectorType.CONFIG),
129161
129192
  default: DEFAULT_RESPONSE_CHECKSUM_VALIDATION
129162
129193
  };
@@ -130334,7 +130365,7 @@ var SESSION_TOKEN_HEADER = SESSION_TOKEN_QUERY_PARAM.toLowerCase();
130334
130365
  var NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME = "AWS_S3_DISABLE_EXPRESS_SESSION_AUTH";
130335
130366
  var NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME = "s3_disable_express_session_auth";
130336
130367
  var NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS = {
130337
- environmentVariableSelector: (env7) => booleanSelector(env7, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME, SelectorType2.ENV),
130368
+ environmentVariableSelector: (env6) => booleanSelector(env6, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_ENV_NAME, SelectorType2.ENV),
130338
130369
  configFileSelector: (profile) => booleanSelector(profile, NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_INI_NAME, SelectorType2.CONFIG),
130339
130370
  default: false
130340
130371
  };
@@ -131831,7 +131862,7 @@ init_dist_es24();
131831
131862
  var NODE_USE_ARN_REGION_ENV_NAME = "AWS_S3_USE_ARN_REGION";
131832
131863
  var NODE_USE_ARN_REGION_INI_NAME = "s3_use_arn_region";
131833
131864
  var NODE_USE_ARN_REGION_CONFIG_OPTIONS = {
131834
- environmentVariableSelector: (env7) => booleanSelector(env7, NODE_USE_ARN_REGION_ENV_NAME, SelectorType2.ENV),
131865
+ environmentVariableSelector: (env6) => booleanSelector(env6, NODE_USE_ARN_REGION_ENV_NAME, SelectorType2.ENV),
131835
131866
  configFileSelector: (profile) => booleanSelector(profile, NODE_USE_ARN_REGION_INI_NAME, SelectorType2.CONFIG),
131836
131867
  default: false
131837
131868
  };
@@ -132781,8 +132812,8 @@ async function generateR2ServiceToken(accountId, bucketName, pipelineName) {
132781
132812
  });
132782
132813
  server.listen(8976, "localhost");
132783
132814
  });
132784
- const env7 = getCloudflareApiEnvironmentFromEnv();
132785
- const oauthDomain = env7 === "staging" ? "oauth.pipelines-staging.cloudflare.com" : "oauth.pipelines.cloudflare.com";
132815
+ const env6 = getCloudflareApiEnvironmentFromEnv();
132816
+ const oauthDomain = env6 === "staging" ? "oauth.pipelines-staging.cloudflare.com" : "oauth.pipelines.cloudflare.com";
132786
132817
  const urlToOpen = `https://${oauthDomain}/oauth/login?accountId=${accountId}&bucketName=${bucketName}&pipelineName=${pipelineName}`;
132787
132818
  logger.log(`Opening a link in your default browser: ${urlToOpen}`);
132788
132819
  await openInBrowser(urlToOpen);
@@ -133460,8 +133491,8 @@ async function authorizeR2Bucket(pipelineName, accountId, bucketName) {
133460
133491
  }
133461
133492
  __name(authorizeR2Bucket, "authorizeR2Bucket");
133462
133493
  function getAccountR2Endpoint(accountId) {
133463
- const env7 = getCloudflareApiEnvironmentFromEnv();
133464
- if (env7 === "staging") {
133494
+ const env6 = getCloudflareApiEnvironmentFromEnv();
133495
+ if (env6 === "staging") {
133465
133496
  return `https://${accountId}.r2-staging.cloudflarestorage.com`;
133466
133497
  }
133467
133498
  return `https://${accountId}.r2.cloudflarestorage.com`;
@@ -135085,7 +135116,7 @@ var r2BucketCORSSetCommand = createCommand({
135085
135116
  async handler({ bucket, file, jurisdiction, force }, { config }) {
135086
135117
  const accountId = await requireAuth(config);
135087
135118
  const jsonFilePath = import_node_path57.default.resolve(file);
135088
- const corsConfig = parseJSON(readFileSync5(jsonFilePath), jsonFilePath);
135119
+ const corsConfig = parseJSON(readFileSync6(jsonFilePath), jsonFilePath);
135089
135120
  if (!corsConfig.rules || !Array.isArray(corsConfig.rules)) {
135090
135121
  throw new UserError(
135091
135122
  `The CORS configuration file must contain a 'rules' array as expected by the request body of the CORS API: https://developers.cloudflare.com/api/operations/r2-put-bucket-cors-policy`
@@ -135752,7 +135783,7 @@ var r2BucketLifecycleSetCommand = createCommand({
135752
135783
  const { bucket, file, jurisdiction, force } = args;
135753
135784
  let lifecyclePolicy;
135754
135785
  try {
135755
- lifecyclePolicy = JSON.parse(readFileSync5(file));
135786
+ lifecyclePolicy = JSON.parse(readFileSync6(file));
135756
135787
  } catch (e7) {
135757
135788
  if (e7 instanceof Error) {
135758
135789
  throw new UserError(
@@ -136074,7 +136105,7 @@ var r2BucketLockSetCommand = createCommand({
136074
136105
  const { bucket, file, jurisdiction, force } = args;
136075
136106
  let lockRule;
136076
136107
  try {
136077
- lockRule = JSON.parse(readFileSync5(file));
136108
+ lockRule = JSON.parse(readFileSync6(file));
136078
136109
  } catch (e7) {
136079
136110
  if (e7 instanceof Error) {
136080
136111
  throw new ParseError({
@@ -136285,7 +136316,7 @@ var r2BucketNotificationDeleteCommand = createCommand({
136285
136316
  // src/r2/object.ts
136286
136317
  init_import_meta_url();
136287
136318
  var import_node_buffer5 = require("node:buffer");
136288
- var fs27 = __toESM(require("node:fs"));
136319
+ var fs25 = __toESM(require("node:fs"));
136289
136320
  var path59 = __toESM(require("node:path"));
136290
136321
  var stream = __toESM(require("node:stream"));
136291
136322
  var r2ObjectNamespace = createNamespace({
@@ -136352,8 +136383,8 @@ var r2ObjectGetCommand = createCommand({
136352
136383
  }
136353
136384
  let output;
136354
136385
  if (file) {
136355
- fs27.mkdirSync(path59.dirname(file), { recursive: true });
136356
- output = fs27.createWriteStream(file);
136386
+ fs25.mkdirSync(path59.dirname(file), { recursive: true });
136387
+ output = fs25.createWriteStream(file);
136357
136388
  } else {
136358
136389
  output = process.stdout;
136359
136390
  }
@@ -136487,7 +136518,7 @@ var r2ObjectPutCommand = createCommand({
136487
136518
  let objectSize;
136488
136519
  if (file) {
136489
136520
  object = await createFileReadableStream(file);
136490
- const stats = fs27.statSync(file);
136521
+ const stats = fs25.statSync(file);
136491
136522
  objectSize = stats.size;
136492
136523
  } else {
136493
136524
  const buffer = await new Promise((resolve24, reject) => {
@@ -136943,7 +136974,7 @@ var r2BucketSippyEnableCommand = createCommand({
136943
136974
  } else if (args.provider === "GCS") {
136944
136975
  if (args.serviceAccountKeyFile) {
136945
136976
  const serviceAccount = JSON.parse(
136946
- readFileSync5(args.serviceAccountKeyFile)
136977
+ readFileSync6(args.serviceAccountKeyFile)
136947
136978
  );
136948
136979
  if ("client_email" in serviceAccount && "private_key" in serviceAccount) {
136949
136980
  args.clientEmail = serviceAccount.client_email;
@@ -141837,17 +141868,17 @@ var BaseClient = class {
141837
141868
  */
141838
141869
  sendEvent(event, hint = {}) {
141839
141870
  this.emit("beforeSendEvent", event, hint);
141840
- let env7 = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
141871
+ let env6 = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
141841
141872
  for (const attachment of hint.attachments || []) {
141842
- env7 = addItemToEnvelope(
141843
- env7,
141873
+ env6 = addItemToEnvelope(
141874
+ env6,
141844
141875
  createAttachmentEnvelopeItem(
141845
141876
  attachment,
141846
141877
  this._options.transportOptions && this._options.transportOptions.textEncoder
141847
141878
  )
141848
141879
  );
141849
141880
  }
141850
- const promise = this._sendEnvelope(env7);
141881
+ const promise = this._sendEnvelope(env6);
141851
141882
  if (promise) {
141852
141883
  promise.then((sendResponse) => this.emit("afterSendEvent", event, sendResponse), null);
141853
141884
  }
@@ -141856,8 +141887,8 @@ var BaseClient = class {
141856
141887
  * @inheritDoc
141857
141888
  */
141858
141889
  sendSession(session) {
141859
- const env7 = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
141860
- void this._sendEnvelope(env7);
141890
+ const env6 = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
141891
+ void this._sendEnvelope(env6);
141861
141892
  }
141862
141893
  /**
141863
141894
  * @inheritDoc
@@ -146444,19 +146475,19 @@ __name(triggersDeployHandler, "triggersDeployHandler");
146444
146475
 
146445
146476
  // src/type-generation/index.ts
146446
146477
  init_import_meta_url();
146447
- var fs28 = __toESM(require("node:fs"));
146478
+ var fs26 = __toESM(require("node:fs"));
146448
146479
  var import_node_path58 = require("node:path");
146449
146480
  var import_miniflare21 = require("miniflare");
146450
146481
 
146451
146482
  // src/dev/dev-vars.ts
146452
146483
  init_import_meta_url();
146453
146484
  var path60 = __toESM(require("node:path"));
146454
- function getVarsForDev(config, env7, silent = false) {
146485
+ function getVarsForDev(config, env6, silent = false) {
146455
146486
  const configDir = path60.resolve(
146456
146487
  config.userConfigPath ? path60.dirname(config.userConfigPath) : "."
146457
146488
  );
146458
146489
  const devVarsPath = path60.resolve(configDir, ".dev.vars");
146459
- const loaded = loadDotEnv(devVarsPath, env7);
146490
+ const loaded = loadDotEnv(devVarsPath, env6);
146460
146491
  if (loaded !== void 0) {
146461
146492
  const devVarsRelativePath = path60.relative(process.cwd(), loaded.path);
146462
146493
  if (!silent) {
@@ -146488,16 +146519,10 @@ async function generateRuntimeTypes({
146488
146519
  }
146489
146520
  await ensureDirectoryExists(outFile);
146490
146521
  const header = `// Runtime types generated with workerd@${import_workerd.version} ${compatibility_date} ${compatibility_flags.join(",")}`;
146491
- try {
146492
- const existingTypes = await (0, import_promises31.readFile)(outFile, "utf8");
146493
- if (existingTypes.split("\n")[0] === header) {
146494
- logger.debug("Using cached runtime types: ", header);
146495
- return { outFile };
146496
- }
146497
- } catch (e7) {
146498
- if (e7.code !== "ENOENT") {
146499
- throw e7;
146500
- }
146522
+ const existingTypes = maybeGetFile(outFile);
146523
+ if (existingTypes !== void 0 && existingTypes.split("\n")[0] === header) {
146524
+ logger.debug("Using cached runtime types: ", header);
146525
+ return { outFile };
146501
146526
  }
146502
146527
  const types = await generate({
146503
146528
  compatibilityDate: compatibility_date,
@@ -146646,7 +146671,7 @@ var typesCommand = createCommand({
146646
146671
  },
146647
146672
  async handler(args, { config }) {
146648
146673
  const { envInterface, path: outputPath } = args;
146649
- if (!config.configPath || !fs28.existsSync(config.configPath) || fs28.statSync(config.configPath).isDirectory()) {
146674
+ if (!config.configPath || !fs26.existsSync(config.configPath) || fs26.statSync(config.configPath).isDirectory()) {
146650
146675
  logger.warn(
146651
146676
  `No config file detected${args.config ? ` (at ${args.config})` : ""}, aborting`
146652
146677
  );
@@ -146705,6 +146730,7 @@ var typesCommand = createCommand({
146705
146730
  hyperdrive: config.hyperdrive,
146706
146731
  mtls_certificates: config.mtls_certificates,
146707
146732
  browser: config.browser,
146733
+ images: config.images,
146708
146734
  ai: config.ai,
146709
146735
  version_metadata: config.version_metadata,
146710
146736
  secrets,
@@ -146908,6 +146934,12 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
146908
146934
  if (configToDTS.ai) {
146909
146935
  envTypeStructure.push([constructTypeKey(configToDTS.ai.binding), "Ai"]);
146910
146936
  }
146937
+ if (configToDTS.images) {
146938
+ envTypeStructure.push([
146939
+ constructTypeKey(configToDTS.images.binding),
146940
+ "ImagesBinding"
146941
+ ]);
146942
+ }
146911
146943
  if (configToDTS.version_metadata) {
146912
146944
  envTypeStructure.push([
146913
146945
  configToDTS.version_metadata.binding,
@@ -146962,7 +146994,7 @@ function writeDTSFile({
146962
146994
  }) {
146963
146995
  const wranglerOverrideDTSPath = findUpSync(path72);
146964
146996
  try {
146965
- if (wranglerOverrideDTSPath !== void 0 && !fs28.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
146997
+ if (wranglerOverrideDTSPath !== void 0 && !fs26.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
146966
146998
  throw new UserError(
146967
146999
  `A non-wrangler ${(0, import_node_path58.basename)(path72)} already exists, please rename and try again.`
146968
147000
  );
@@ -146981,7 +147013,7 @@ function writeDTSFile({
146981
147013
  envTypeStructure.map(([key, value]) => `${key}: ${value};`),
146982
147014
  modulesTypeStructure
146983
147015
  );
146984
- fs28.writeFileSync(
147016
+ fs26.writeFileSync(
146985
147017
  path72,
146986
147018
  [
146987
147019
  `// Generated by Wrangler by running \`${wranglerCommandUsed}\``,
@@ -147021,12 +147053,12 @@ ${modulesContent}`
147021
147053
  }
147022
147054
  __name(generateTypeStrings, "generateTypeStrings");
147023
147055
  function readTsconfigTypes(tsconfigPath) {
147024
- if (!fs28.existsSync(tsconfigPath)) {
147056
+ if (!fs26.existsSync(tsconfigPath)) {
147025
147057
  return [];
147026
147058
  }
147027
147059
  try {
147028
147060
  const tsconfig = parseJSONC(
147029
- fs28.readFileSync(tsconfigPath, "utf-8")
147061
+ fs26.readFileSync(tsconfigPath, "utf-8")
147030
147062
  );
147031
147063
  return tsconfig.compilerOptions?.types || [];
147032
147064
  } catch (e7) {
@@ -147059,8 +147091,8 @@ function collectAllVars(args) {
147059
147091
  __name(collectEnvironmentVars, "collectEnvironmentVars");
147060
147092
  const { rawConfig } = experimental_readRawConfig(args);
147061
147093
  collectEnvironmentVars(rawConfig.vars);
147062
- Object.entries(rawConfig.env ?? {}).forEach(([_envName, env7]) => {
147063
- collectEnvironmentVars(env7.vars);
147094
+ Object.entries(rawConfig.env ?? {}).forEach(([_envName, env6]) => {
147095
+ collectEnvironmentVars(env6.vars);
147064
147096
  });
147065
147097
  return Object.fromEntries(
147066
147098
  Object.entries(varsInfo).map(([key, value]) => [key, [...value]])
@@ -147914,7 +147946,7 @@ __name(handler25, "handler");
147914
147946
 
147915
147947
  // src/vectorize/insert.ts
147916
147948
  init_import_meta_url();
147917
- var import_node_fs30 = require("node:fs");
147949
+ var import_node_fs28 = require("node:fs");
147918
147950
  var import_node_readline3 = require("node:readline");
147919
147951
  var import_undici18 = __toESM(require_undici());
147920
147952
  function options27(yargs) {
@@ -147948,7 +147980,7 @@ function options27(yargs) {
147948
147980
  __name(options27, "options");
147949
147981
  async function handler26(args) {
147950
147982
  const config = readConfig(args);
147951
- const rl = (0, import_node_readline3.createInterface)({ input: (0, import_node_fs30.createReadStream)(args.file) });
147983
+ const rl = (0, import_node_readline3.createInterface)({ input: (0, import_node_fs28.createReadStream)(args.file) });
147952
147984
  if (args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_V1_MAX_BATCH_SIZE) {
147953
147985
  logger.error(
147954
147986
  `\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_V1_MAX_BATCH_SIZE} records at a time.`
@@ -148270,7 +148302,7 @@ __name(validateQueryFilter, "validateQueryFilter");
148270
148302
 
148271
148303
  // src/vectorize/upsert.ts
148272
148304
  init_import_meta_url();
148273
- var import_node_fs31 = require("node:fs");
148305
+ var import_node_fs29 = require("node:fs");
148274
148306
  var import_node_readline4 = require("node:readline");
148275
148307
  var import_undici19 = __toESM(require_undici());
148276
148308
  function options31(yargs) {
@@ -148299,7 +148331,7 @@ function options31(yargs) {
148299
148331
  __name(options31, "options");
148300
148332
  async function handler30(args) {
148301
148333
  const config = readConfig(args);
148302
- const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs31.createReadStream)(args.file) });
148334
+ const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs29.createReadStream)(args.file) });
148303
148335
  if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
148304
148336
  logger.error(
148305
148337
  `\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits`
@@ -150000,7 +150032,7 @@ var versionsSecretPutCommand = createCommand({
150000
150032
  // src/versions/upload.ts
150001
150033
  init_import_meta_url();
150002
150034
  var import_node_assert23 = __toESM(require("node:assert"));
150003
- var import_node_fs32 = require("node:fs");
150035
+ var import_node_fs30 = require("node:fs");
150004
150036
  var import_node_path59 = __toESM(require("node:path"));
150005
150037
 
150006
150038
  // src/utils/retry.ts
@@ -150402,9 +150434,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
150402
150434
  );
150403
150435
  }
150404
150436
  if (props.outDir) {
150405
- (0, import_node_fs32.mkdirSync)(props.outDir, { recursive: true });
150437
+ (0, import_node_fs30.mkdirSync)(props.outDir, { recursive: true });
150406
150438
  const readmePath = import_node_path59.default.join(props.outDir, "README.md");
150407
- (0, import_node_fs32.writeFileSync)(
150439
+ (0, import_node_fs30.writeFileSync)(
150408
150440
  readmePath,
150409
150441
  `This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
150410
150442
  );
@@ -150433,10 +150465,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
150433
150465
  try {
150434
150466
  if (props.noBundle) {
150435
150467
  const destinationDir = typeof destination === "string" ? destination : destination.path;
150436
- (0, import_node_fs32.mkdirSync)(destinationDir, { recursive: true });
150437
- (0, import_node_fs32.writeFileSync)(
150468
+ (0, import_node_fs30.mkdirSync)(destinationDir, { recursive: true });
150469
+ (0, import_node_fs30.writeFileSync)(
150438
150470
  import_node_path59.default.join(destinationDir, import_node_path59.default.basename(props.entry.file)),
150439
- (0, import_node_fs32.readFileSync)(props.entry.file, "utf-8")
150471
+ (0, import_node_fs30.readFileSync)(props.entry.file, "utf-8")
150440
150472
  );
150441
150473
  }
150442
150474
  const entryDirectory = import_node_path59.default.dirname(props.entry.file);
@@ -150506,7 +150538,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
150506
150538
  const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
150507
150539
  dependencies[modulePath] = { bytesInOutput };
150508
150540
  }
150509
- const content = (0, import_node_fs32.readFileSync)(resolvedEntryPointPath, {
150541
+ const content = (0, import_node_fs30.readFileSync)(resolvedEntryPointPath, {
150510
150542
  encoding: "utf-8"
150511
150543
  });
150512
150544
  const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
@@ -150551,8 +150583,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
150551
150583
  },
150552
150584
  assets: props.assetsOptions && assetsJwt ? {
150553
150585
  jwt: assetsJwt,
150554
- routingConfig: props.assetsOptions.routingConfig,
150555
- assetConfig: props.assetsOptions.assetConfig
150586
+ routerConfig: props.assetsOptions.routerConfig,
150587
+ assetConfig: props.assetsOptions.assetConfig,
150588
+ _redirects: props.assetsOptions._redirects,
150589
+ _headers: props.assetsOptions._headers
150556
150590
  } : void 0,
150557
150591
  logpush: void 0,
150558
150592
  // both logpush and observability are not supported in versions upload
@@ -150633,9 +150667,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
150633
150667
  }
150634
150668
  }
150635
150669
  if (props.outFile) {
150636
- (0, import_node_fs32.mkdirSync)(import_node_path59.default.dirname(props.outFile), { recursive: true });
150670
+ (0, import_node_fs30.mkdirSync)(import_node_path59.default.dirname(props.outFile), { recursive: true });
150637
150671
  const serializedFormData = await new Response(workerBundle).arrayBuffer();
150638
- (0, import_node_fs32.writeFileSync)(props.outFile, Buffer.from(serializedFormData));
150672
+ (0, import_node_fs30.writeFileSync)(props.outFile, Buffer.from(serializedFormData));
150639
150673
  }
150640
150674
  } finally {
150641
150675
  if (typeof destination !== "string") {
@@ -153405,7 +153439,7 @@ var validateRoutes3 = /* @__PURE__ */ __name((routes, assets) => {
153405
153439
  }
153406
153440
  } else if (
153407
153441
  // If we have Assets but we're not always hitting the Worker then validate
153408
- assets?.directory !== void 0 && assets.assetConfig.run_worker_first !== true
153442
+ assets?.directory !== void 0 && assets.routerConfig.invoke_user_worker_ahead_of_assets !== true
153409
153443
  ) {
153410
153444
  const pattern = typeof route2 === "string" ? route2 : route2.pattern;
153411
153445
  const components = pattern.split("/");
@@ -153434,7 +153468,7 @@ ${mountedAssetRoutes.map((route2) => {
153434
153468
  routeNoScheme.substring(routeNoScheme.indexOf("/"))
153435
153469
  );
153436
153470
  return ` \u2022 ${route2} (Will match assets: ${assetPath})`;
153437
- }).join("\n")}` + (assets?.routingConfig.has_user_worker ? "\n\nRequests not matching an asset will be forwarded to the Worker's code." : "")
153471
+ }).join("\n")}` + (assets?.routerConfig.has_user_worker ? "\n\nRequests not matching an asset will be forwarded to the Worker's code." : "")
153438
153472
  );
153439
153473
  }
153440
153474
  }, "validateRoutes");
@@ -153610,9 +153644,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
153610
153644
  "A [site] definition requires a `bucket` field with a path to the site's assets directory."
153611
153645
  );
153612
153646
  if (props.outDir) {
153613
- (0, import_node_fs33.mkdirSync)(props.outDir, { recursive: true });
153647
+ (0, import_node_fs31.mkdirSync)(props.outDir, { recursive: true });
153614
153648
  const readmePath = import_node_path61.default.join(props.outDir, "README.md");
153615
- (0, import_node_fs33.writeFileSync)(
153649
+ (0, import_node_fs31.writeFileSync)(
153616
153650
  readmePath,
153617
153651
  `This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
153618
153652
  );
@@ -153656,10 +153690,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
153656
153690
  try {
153657
153691
  if (props.noBundle) {
153658
153692
  const destinationDir = typeof destination === "string" ? destination : destination.path;
153659
- (0, import_node_fs33.mkdirSync)(destinationDir, { recursive: true });
153660
- (0, import_node_fs33.writeFileSync)(
153693
+ (0, import_node_fs31.mkdirSync)(destinationDir, { recursive: true });
153694
+ (0, import_node_fs31.writeFileSync)(
153661
153695
  import_node_path61.default.join(destinationDir, import_node_path61.default.basename(props.entry.file)),
153662
- (0, import_node_fs33.readFileSync)(props.entry.file, "utf-8")
153696
+ (0, import_node_fs31.readFileSync)(props.entry.file, "utf-8")
153663
153697
  );
153664
153698
  }
153665
153699
  const entryDirectory = import_node_path61.default.dirname(props.entry.file);
@@ -153731,7 +153765,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
153731
153765
  const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
153732
153766
  dependencies[modulePath] = { bytesInOutput };
153733
153767
  }
153734
- const content = (0, import_node_fs33.readFileSync)(resolvedEntryPointPath, {
153768
+ const content = (0, import_node_fs31.readFileSync)(resolvedEntryPointPath, {
153735
153769
  encoding: "utf-8"
153736
153770
  });
153737
153771
  const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
@@ -153806,8 +153840,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
153806
153840
  limits: config.limits,
153807
153841
  assets: props.assetsOptions && assetsJwt ? {
153808
153842
  jwt: assetsJwt,
153809
- routingConfig: props.assetsOptions.routingConfig,
153810
- assetConfig: props.assetsOptions.assetConfig
153843
+ routerConfig: props.assetsOptions.routerConfig,
153844
+ assetConfig: props.assetsOptions.assetConfig,
153845
+ _redirects: props.assetsOptions._redirects,
153846
+ _headers: props.assetsOptions._headers
153811
153847
  } : void 0,
153812
153848
  observability: config.observability
153813
153849
  };
@@ -153965,9 +154001,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
153965
154001
  }
153966
154002
  }
153967
154003
  if (props.outFile) {
153968
- (0, import_node_fs33.mkdirSync)(import_node_path61.default.dirname(props.outFile), { recursive: true });
154004
+ (0, import_node_fs31.mkdirSync)(import_node_path61.default.dirname(props.outFile), { recursive: true });
153969
154005
  const serializedFormData = await new import_undici21.Response(workerBundle).arrayBuffer();
153970
- (0, import_node_fs33.writeFileSync)(props.outFile, Buffer.from(serializedFormData));
154006
+ (0, import_node_fs31.writeFileSync)(props.outFile, Buffer.from(serializedFormData));
153971
154007
  }
153972
154008
  } finally {
153973
154009
  if (typeof destination !== "string") {
@@ -154049,36 +154085,44 @@ async function publishRoutesFallback(routes, {
154049
154085
  "The current authentication token does not have 'All Zones' permissions.\nFalling back to using the zone-based API endpoint to update each route individually.\nNote that there is no access to routes associated with zones that the API token does not have permission for.\nExisting routes for this Worker in such zones will not be deleted."
154050
154086
  );
154051
154087
  const deployedRoutes = [];
154088
+ const queue = new PQueue({ concurrency: 10 });
154089
+ const zoneIdCache = /* @__PURE__ */ new Map();
154052
154090
  const activeZones = /* @__PURE__ */ new Map();
154053
154091
  const routesToDeploy = /* @__PURE__ */ new Map();
154054
154092
  for (const route2 of routes) {
154055
- const zone = await getZoneForRoute({ route: route2, accountId });
154056
- if (zone) {
154057
- activeZones.set(zone.id, zone.host);
154058
- routesToDeploy.set(
154059
- typeof route2 === "string" ? route2 : route2.pattern,
154060
- zone.id
154061
- );
154062
- }
154093
+ void queue.add(async () => {
154094
+ const zone = await getZoneForRoute({ route: route2, accountId }, zoneIdCache);
154095
+ if (zone) {
154096
+ activeZones.set(zone.id, zone.host);
154097
+ routesToDeploy.set(
154098
+ typeof route2 === "string" ? route2 : route2.pattern,
154099
+ zone.id
154100
+ );
154101
+ }
154102
+ });
154063
154103
  }
154104
+ await queue.onIdle();
154064
154105
  const allRoutes = /* @__PURE__ */ new Map();
154065
154106
  const alreadyDeployedRoutes = /* @__PURE__ */ new Set();
154066
154107
  for (const [zone, host] of activeZones) {
154067
- try {
154068
- for (const { pattern, script } of await fetchListResult(`/zones/${zone}/workers/routes`)) {
154069
- allRoutes.set(pattern, script);
154070
- if (script === scriptName) {
154071
- alreadyDeployedRoutes.add(pattern);
154108
+ void queue.add(async () => {
154109
+ try {
154110
+ for (const { pattern, script } of await fetchListResult(`/zones/${zone}/workers/routes`)) {
154111
+ allRoutes.set(pattern, script);
154112
+ if (script === scriptName) {
154113
+ alreadyDeployedRoutes.add(pattern);
154114
+ }
154072
154115
  }
154116
+ } catch (e7) {
154117
+ if (isAuthenticationError(e7)) {
154118
+ e7.notes.push({
154119
+ text: `This could be because the API token being used does not have permission to access the zone "${host}" (${zone}).`
154120
+ });
154121
+ }
154122
+ throw e7;
154073
154123
  }
154074
- } catch (e7) {
154075
- if (isAuthenticationError(e7)) {
154076
- e7.notes.push({
154077
- text: `This could be because the API token being used does not have permission to access the zone "${host}" (${zone}).`
154078
- });
154079
- }
154080
- throw e7;
154081
- }
154124
+ });
154125
+ await queue.onIdle();
154082
154126
  }
154083
154127
  for (const [routePattern, zoneId] of routesToDeploy.entries()) {
154084
154128
  if (allRoutes.has(routePattern)) {
@@ -154389,10 +154433,10 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
154389
154433
  const files = await (0, import_promises37.readdir)(dir, { recursive: true });
154390
154434
  const manifest = {};
154391
154435
  let counter = 0;
154392
- const ignoreFn = await createAssetIgnoreFunction(dir);
154436
+ const { assetsIgnoreFunction, assetsIgnoreFilePresent } = await createAssetsIgnoreFunction(dir);
154393
154437
  await Promise.all(
154394
154438
  files.map(async (relativeFilepath) => {
154395
- if (ignoreFn?.(relativeFilepath)) {
154439
+ if (assetsIgnoreFunction(relativeFilepath)) {
154396
154440
  logger.debug("Ignoring asset:", relativeFilepath);
154397
154441
  return;
154398
154442
  }
@@ -154401,7 +154445,10 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
154401
154445
  if (filestat.isSymbolicLink() || filestat.isDirectory()) {
154402
154446
  return;
154403
154447
  } else {
154404
- errorOnLegacyPagesWorkerJSAsset(relativeFilepath, !!ignoreFn);
154448
+ errorOnLegacyPagesWorkerJSAsset(
154449
+ relativeFilepath,
154450
+ assetsIgnoreFilePresent
154451
+ );
154405
154452
  if (counter >= MAX_ASSET_COUNT2) {
154406
154453
  throw new UserError(
154407
154454
  `Maximum number of assets exceeded.
@@ -154475,7 +154522,7 @@ function getAssetsOptions(args, config) {
154475
154522
  }
154476
154523
  const assetsBasePath = getAssetsBasePath(config, args.assets);
154477
154524
  const resolvedAssetsPath = path65.resolve(assetsBasePath, directory);
154478
- if (!(0, import_node_fs34.existsSync)(resolvedAssetsPath)) {
154525
+ if (!(0, import_node_fs32.existsSync)(resolvedAssetsPath)) {
154479
154526
  const sourceOfTruthMessage = args.assets ? '"--assets" command line argument' : '"assets.directory" field in your configuration file';
154480
154527
  throw new UserError(
154481
154528
  `The directory specified by the ${sourceOfTruthMessage} does not exist:
@@ -154485,21 +154532,49 @@ ${resolvedAssetsPath}`,
154485
154532
  }
154486
154533
  );
154487
154534
  }
154488
- const routingConfig = {
154535
+ const routerConfig = {
154489
154536
  has_user_worker: Boolean(args.script || config.main),
154490
- invoke_user_worker_ahead_of_assets: config.assets?.run_worker_first || false
154537
+ invoke_user_worker_ahead_of_assets: config.assets?.run_worker_first
154491
154538
  };
154539
+ if (config.assets?.experimental_serve_directly !== void 0) {
154540
+ if (routerConfig.invoke_user_worker_ahead_of_assets === void 0) {
154541
+ routerConfig.invoke_user_worker_ahead_of_assets = !config.assets?.experimental_serve_directly;
154542
+ } else {
154543
+ throw new UserError(
154544
+ "run_worker_first and experimental_serve_directly specified.\nOnly one of these configuration options may be provided."
154545
+ );
154546
+ }
154547
+ }
154548
+ if (routerConfig.invoke_user_worker_ahead_of_assets && !config?.assets?.binding) {
154549
+ logger.warn(
154550
+ "run_worker_first=true set without an assets binding\nSetting run_worker_first to true will always invoke your Worker script.\nTo fetch your assets from your Worker, please set the [assets.binding] key in your configuration file.\n\nRead more: https://developers.cloudflare.com/workers/static-assets/binding/#binding"
154551
+ );
154552
+ }
154553
+ if (!routerConfig.has_user_worker && routerConfig.invoke_user_worker_ahead_of_assets === true) {
154554
+ if (config.assets?.experimental_serve_directly !== void 0) {
154555
+ throw new UserError(
154556
+ "Cannot set experimental_serve_directly=false without a Worker script.\nPlease remove experimental_serve_directly from your configuration file, or provide a Worker script in your configuration file (`main`)."
154557
+ );
154558
+ } else {
154559
+ throw new UserError(
154560
+ "Cannot set run_worker_first=true without a Worker script.\nPlease remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (`main`)."
154561
+ );
154562
+ }
154563
+ }
154564
+ const redirects = maybeGetFile(path65.join(directory, "_redirects"));
154565
+ const headers = maybeGetFile(path65.join(directory, "_headers"));
154492
154566
  const assetConfig = {
154493
154567
  html_handling: config.assets?.html_handling,
154494
- not_found_handling: config.assets?.not_found_handling,
154495
- run_worker_first: config.assets?.run_worker_first,
154496
- serve_directly: config.assets?.experimental_serve_directly
154568
+ not_found_handling: config.assets?.not_found_handling
154569
+ // TODO: Parse redirects and headers
154497
154570
  };
154498
154571
  return {
154499
154572
  directory: resolvedAssetsPath,
154500
154573
  binding,
154501
- routingConfig,
154502
- assetConfig
154574
+ routerConfig,
154575
+ assetConfig,
154576
+ _redirects: redirects,
154577
+ _headers: headers
154503
154578
  };
154504
154579
  }
154505
154580
  __name(getAssetsOptions, "getAssetsOptions");
@@ -154532,43 +154607,42 @@ function validateAssetsArgsAndConfig(args, config) {
154532
154607
  "Turning on Smart Placement in a Worker that is using assets and run_worker_first set to true means that your entire Worker could be moved to run closer to your data source, and all requests will go to that Worker before serving assets.\nThis could result in poor performance as round trip times could increase when serving assets.\n\nRead more: https://developers.cloudflare.com/workers/static-assets/binding/#smart-placement"
154533
154608
  );
154534
154609
  }
154535
- if ("legacy" in args ? args.assets?.assetConfig?.run_worker_first !== void 0 && args.assets?.assetConfig.serve_directly !== void 0 : config?.assets?.run_worker_first !== void 0 && config?.assets?.experimental_serve_directly !== void 0) {
154536
- throw new UserError(
154537
- "run_worker_first and experimental_serve_directly specified.\nOnly one of these configuration options may be provided."
154538
- );
154539
- }
154540
- if ("legacy" in args ? args.assets?.assetConfig?.run_worker_first === true && !args.assets?.binding : config?.assets?.run_worker_first === true && !config?.assets?.binding) {
154541
- logger.warn(
154542
- "run_worker_first=true set without an assets binding\nSetting run_worker_first to true will always invoke your Worker script.\nTo fetch your assets from your Worker, please set the [assets.binding] key in your configuration file.\n\nRead more: https://developers.cloudflare.com/workers/static-assets/binding/#binding"
154543
- );
154544
- }
154545
- if ("legacy" in args ? args.entrypoint === noOpEntrypoint && args.assets?.assetConfig?.run_worker_first === true : !config?.main && config?.assets?.run_worker_first === true) {
154546
- throw new UserError(
154547
- "Cannot set run_worker_first=true without a Worker script.\nPlease remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (`main`)."
154548
- );
154549
- }
154550
154610
  }
154551
154611
  __name(validateAssetsArgsAndConfig, "validateAssetsArgsAndConfig");
154552
154612
  var CF_ASSETS_IGNORE_FILENAME = ".assetsignore";
154553
- async function createAssetIgnoreFunction(dir) {
154613
+ var REDIRECTS_FILENAME = "_redirects";
154614
+ var HEADERS_FILENAME = "_headers";
154615
+ async function createAssetsIgnoreFunction(dir) {
154554
154616
  const cfAssetIgnorePath = path65.resolve(dir, CF_ASSETS_IGNORE_FILENAME);
154555
- if (!(0, import_node_fs34.existsSync)(cfAssetIgnorePath)) {
154556
- return null;
154617
+ const ignorePatterns = [
154618
+ // Ignore the `.assetsignore` file and other metafiles by default.
154619
+ // The ignore lib expects unix-style paths for its patterns
154620
+ `/${CF_ASSETS_IGNORE_FILENAME}`,
154621
+ `/${REDIRECTS_FILENAME}`,
154622
+ `/${HEADERS_FILENAME}`
154623
+ ];
154624
+ let assetsIgnoreFilePresent = false;
154625
+ const assetsIgnore = maybeGetFile(cfAssetIgnorePath);
154626
+ if (assetsIgnore !== void 0) {
154627
+ assetsIgnoreFilePresent = true;
154628
+ ignorePatterns.push(...assetsIgnore.split("\n"));
154557
154629
  }
154558
- const ignorePatterns = (await (0, import_promises37.readFile)(cfAssetIgnorePath, { encoding: "utf8" })).split("\n");
154559
- ignorePatterns.push(CF_ASSETS_IGNORE_FILENAME);
154560
- return createPatternMatcher(ignorePatterns, true);
154630
+ return {
154631
+ assetsIgnoreFunction: createPatternMatcher(ignorePatterns, true),
154632
+ assetsIgnoreFilePresent
154633
+ };
154561
154634
  }
154562
- __name(createAssetIgnoreFunction, "createAssetIgnoreFunction");
154635
+ __name(createAssetsIgnoreFunction, "createAssetsIgnoreFunction");
154636
+ var WORKER_JS_FILENAME = "_worker.js";
154563
154637
  function errorOnLegacyPagesWorkerJSAsset(file, hasAssetsIgnoreFile) {
154564
154638
  if (!hasAssetsIgnoreFile) {
154565
- const workerJsType = file === "_worker.js" ? "file" : file.startsWith("_worker.js") ? "directory" : null;
154639
+ const workerJsType = file === WORKER_JS_FILENAME ? "file" : file.startsWith(WORKER_JS_FILENAME) ? "directory" : null;
154566
154640
  if (workerJsType !== null) {
154567
154641
  throw new UserError(
154568
154642
  dedent2`
154569
- Uploading a Pages _worker.js ${workerJsType} as an asset.
154643
+ Uploading a Pages ${WORKER_JS_FILENAME} ${workerJsType} as an asset.
154570
154644
  This could expose your private server-side code to the public Internet. Is this intended?
154571
- If you do not want to upload this ${workerJsType}, either remove it or add an "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, containing "_worker.js" to avoid uploading.
154645
+ If you do not want to upload this ${workerJsType}, either remove it or add an "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, containing "${WORKER_JS_FILENAME}" to avoid uploading.
154572
154646
  If you do want to upload this ${workerJsType}, you can add an empty "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, to hide this error.
154573
154647
  `,
154574
154648
  { telemetryMessage: true }
@@ -154583,7 +154657,7 @@ init_import_meta_url();
154583
154657
 
154584
154658
  // src/dev-registry/file-registry.ts
154585
154659
  init_import_meta_url();
154586
- var import_node_fs35 = require("node:fs");
154660
+ var import_node_fs33 = require("node:fs");
154587
154661
  var import_promises38 = require("node:fs/promises");
154588
154662
  var import_node_path62 = __toESM(require("node:path"));
154589
154663
  var util3 = __toESM(require("node:util"));
@@ -154667,7 +154741,7 @@ async function registerWorker(name2, definition) {
154667
154741
  heartbeats.set(
154668
154742
  name2,
154669
154743
  setInterval(() => {
154670
- (0, import_node_fs35.utimesSync)(import_node_path62.default.join(DEV_REGISTRY_PATH, name2), /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
154744
+ (0, import_node_fs33.utimesSync)(import_node_path62.default.join(DEV_REGISTRY_PATH, name2), /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
154671
154745
  }, 3e4)
154672
154746
  );
154673
154747
  return;
@@ -155672,7 +155746,7 @@ function getResolvedLegacyAssetPaths(args, configParam) {
155672
155746
  return legacyAssetPaths;
155673
155747
  }
155674
155748
  __name(getResolvedLegacyAssetPaths, "getResolvedLegacyAssetPaths");
155675
- function getBindings2(configParam, env7, local, args) {
155749
+ function getBindings2(configParam, env6, local, args) {
155676
155750
  const kvConfig = (configParam.kv_namespaces || []).map(
155677
155751
  ({ binding, preview_id, id }) => {
155678
155752
  if (!preview_id && !local) {
@@ -155767,7 +155841,7 @@ function getBindings2(configParam, env7, local, args) {
155767
155841
  // non-inheritable fields
155768
155842
  vars: {
155769
155843
  // Use a copy of combinedVars since we're modifying it later
155770
- ...getVarsForDev(configParam, env7),
155844
+ ...getVarsForDev(configParam, env6),
155771
155845
  ...args.vars
155772
155846
  },
155773
155847
  durable_objects: {
@@ -156011,7 +156085,7 @@ init_esm2();
156011
156085
  // src/dev/use-esbuild.ts
156012
156086
  init_import_meta_url();
156013
156087
  var import_node_assert28 = __toESM(require("node:assert"));
156014
- var import_node_fs37 = require("node:fs");
156088
+ var import_node_fs35 = require("node:fs");
156015
156089
  var import_node_path66 = __toESM(require("node:path"));
156016
156090
  init_esm2();
156017
156091
  function runBuild({
@@ -156073,7 +156147,7 @@ function runBuild({
156073
156147
  ]);
156074
156148
  return {
156075
156149
  ...previousBundle,
156076
- entrypointSource: (0, import_node_fs37.readFileSync)(previousBundle.path, "utf8"),
156150
+ entrypointSource: (0, import_node_fs35.readFileSync)(previousBundle.path, "utf8"),
156077
156151
  id: previousBundle.id + 1
156078
156152
  };
156079
156153
  });
@@ -156133,7 +156207,7 @@ function runBuild({
156133
156207
  });
156134
156208
  stopWatching = /* @__PURE__ */ __name(() => watcher.close(), "stopWatching");
156135
156209
  }
156136
- const entrypointPath = (0, import_node_fs37.realpathSync)(
156210
+ const entrypointPath = (0, import_node_fs35.realpathSync)(
156137
156211
  bundleResult?.resolvedEntryPointPath ?? entry.file
156138
156212
  );
156139
156213
  setBundle(() => ({
@@ -156145,7 +156219,7 @@ function runBuild({
156145
156219
  dependencies: bundleResult?.dependencies ?? {},
156146
156220
  sourceMapPath: bundleResult?.sourceMapPath,
156147
156221
  sourceMapMetadata: bundleResult?.sourceMapMetadata,
156148
- entrypointSource: (0, import_node_fs37.readFileSync)(entrypointPath, "utf8")
156222
+ entrypointSource: (0, import_node_fs35.readFileSync)(entrypointPath, "utf8")
156149
156223
  }));
156150
156224
  }
156151
156225
  __name(build5, "build");
@@ -157214,8 +157288,10 @@ async function createRemoteWorkerInit(props) {
157214
157288
  sourceMaps: void 0,
157215
157289
  assets: props.assets && assetsJwt ? {
157216
157290
  jwt: assetsJwt,
157217
- routingConfig: props.assets.routingConfig,
157218
- assetConfig: props.assets.assetConfig
157291
+ routerConfig: props.assets.routerConfig,
157292
+ assetConfig: props.assets.assetConfig,
157293
+ _redirects: props.assets._redirects,
157294
+ _headers: props.assets._headers
157219
157295
  } : void 0,
157220
157296
  placement: void 0,
157221
157297
  // no placement in dev
@@ -157834,10 +157910,10 @@ __name(maybeGetRegisteredWorkers, "maybeGetRegisteredWorkers");
157834
157910
 
157835
157911
  // src/api/integrations/platform/index.ts
157836
157912
  async function getPlatformProxy(options32 = {}) {
157837
- const env7 = options32.environment;
157913
+ const env6 = options32.environment;
157838
157914
  const rawConfig = readConfig({
157839
157915
  config: options32.configPath,
157840
- env: env7
157916
+ env: env6
157841
157917
  });
157842
157918
  const miniflareOptions = await run(
157843
157919
  {
@@ -157845,7 +157921,7 @@ async function getPlatformProxy(options32 = {}) {
157845
157921
  RESOURCES_PROVISION: false,
157846
157922
  ASSETS_RPC: false
157847
157923
  },
157848
- () => getMiniflareOptionsFromConfig(rawConfig, env7, options32)
157924
+ () => getMiniflareOptionsFromConfig(rawConfig, env6, options32)
157849
157925
  );
157850
157926
  const mf = new import_miniflare28.Miniflare({
157851
157927
  script: "",
@@ -157864,8 +157940,8 @@ async function getPlatformProxy(options32 = {}) {
157864
157940
  };
157865
157941
  }
157866
157942
  __name(getPlatformProxy, "getPlatformProxy");
157867
- async function getMiniflareOptionsFromConfig(rawConfig, env7, options32) {
157868
- const bindings = getBindings2(rawConfig, env7, true, {});
157943
+ async function getMiniflareOptionsFromConfig(rawConfig, env6, options32) {
157944
+ const bindings = getBindings2(rawConfig, env6, true, {});
157869
157945
  const workerDefinitions = await getBoundRegisteredWorkers({
157870
157946
  name: rawConfig.name,
157871
157947
  services: bindings.services,
@@ -157931,14 +158007,14 @@ function deepFreeze(obj) {
157931
158007
  });
157932
158008
  }
157933
158009
  __name(deepFreeze, "deepFreeze");
157934
- function unstable_getMiniflareWorkerOptions(configOrConfigPath, env7) {
157935
- const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env: env7 }) : configOrConfigPath;
158010
+ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6) {
158011
+ const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env: env6 }) : configOrConfigPath;
157936
158012
  const modulesRules = config.rules.concat(DEFAULT_MODULE_RULES).map((rule) => ({
157937
158013
  type: rule.type,
157938
158014
  include: rule.globs,
157939
158015
  fallthrough: rule.fallthrough
157940
158016
  }));
157941
- const bindings = getBindings2(config, env7, true, {});
158017
+ const bindings = getBindings2(config, env6, true, {});
157942
158018
  const { bindingOptions } = buildMiniflareBindingOptions({
157943
158019
  name: void 0,
157944
158020
  bindings,
@@ -157995,9 +158071,9 @@ init_import_meta_url();
157995
158071
  // src/api/integrations/deprecated/getBindingsProxy.ts
157996
158072
  init_import_meta_url();
157997
158073
  async function getBindingsProxy(options32 = {}) {
157998
- const { env: env7, ...restOfPlatformProxy } = await getPlatformProxy(options32);
158074
+ const { env: env6, ...restOfPlatformProxy } = await getPlatformProxy(options32);
157999
158075
  return {
158000
- bindings: env7,
158076
+ bindings: env6,
158001
158077
  ...restOfPlatformProxy
158002
158078
  };
158003
158079
  }
@@ -158008,7 +158084,7 @@ init_import_meta_url();
158008
158084
  var import_fs24 = require("fs");
158009
158085
  var import_toml8 = __toESM(require_toml());
158010
158086
  var experimental_patchConfig = /* @__PURE__ */ __name((configPath, patch, isArrayInsertion = true) => {
158011
- let configString = readFileSync5(configPath);
158087
+ let configString = readFileSync6(configPath);
158012
158088
  if (configPath.endsWith("toml")) {
158013
158089
  if (configString.includes("#")) {
158014
158090
  throw new PatchConfigError(