@cloudflare/vite-plugin 1.39.1 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import assert from "node:assert";
3
3
  import { CoreHeaders, CorePaths, Log, LogLevel, Miniflare, Request as Request$1, Response as Response$1, buildPublicUrl, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
4
4
  import * as wrangler from "wrangler";
5
5
  import * as nodePath from "node:path";
6
- import path3, { dirname, isAbsolute, join, relative, resolve } from "node:path";
6
+ import path, { dirname, isAbsolute, join, relative, resolve } from "node:path";
7
7
  import * as util$1 from "node:util";
8
8
  import { format, inspect, promisify } from "node:util";
9
9
  import * as vite from "vite";
@@ -15,10 +15,11 @@ import os, { arch } from "node:os";
15
15
  import childProcess, { execFile, execFileSync, spawn } from "node:child_process";
16
16
  import net from "node:net";
17
17
  import { Buffer as Buffer$1 } from "node:buffer";
18
- import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
18
+ import { URL as URL$1, URLSearchParams as URLSearchParams$1, fileURLToPath, pathToFileURL } from "node:url";
19
19
  import * as fsp from "node:fs/promises";
20
20
  import fs, { constants as constants$1 } from "node:fs/promises";
21
21
  import * as timersPromises from "node:timers/promises";
22
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
22
23
  import { getCloudflarePreset, nonPrefixedNodeModules } from "@cloudflare/unenv-preset";
23
24
  import process$1 from "node:process";
24
25
  import v8 from "node:v8";
@@ -1504,7 +1505,7 @@ async function assertWranglerVersion() {
1504
1505
  * The default compatibility date to use when the user omits one.
1505
1506
  * This value is injected at build time and remains fixed for each release.
1506
1507
  */
1507
- const DEFAULT_COMPAT_DATE = "2026-06-01";
1508
+ const DEFAULT_COMPAT_DATE = "2026-06-04";
1508
1509
 
1509
1510
  //#endregion
1510
1511
  //#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@0.8.0/node_modules/@remix-run/node-fetch-server/dist/node-fetch-server.js
@@ -1580,11 +1581,6 @@ const VITE_PROXY_WORKER_NAME = "__vite_proxy_worker__";
1580
1581
  const PROXY_SHARED_SECRET = randomUUID();
1581
1582
  const kRequestType = Symbol("kRequestType");
1582
1583
 
1583
- //#endregion
1584
- //#region ../workers-utils/dist/chunk-OZQVB3L3.mjs
1585
- var INHERIT_SYMBOL = Symbol.for("inherit_binding");
1586
- var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
1587
-
1588
1584
  //#endregion
1589
1585
  //#region ../workers-utils/dist/chunk-DCOBXSFB.mjs
1590
1586
  var __create = Object.create;
@@ -1626,7 +1622,7 @@ var __toESM = (mod$1, isNodeMode, target$1) => (target$1 = mod$1 != null ? __cre
1626
1622
  }) : target$1, mod$1));
1627
1623
 
1628
1624
  //#endregion
1629
- //#region ../workers-utils/dist/chunk-GMTGAG26.mjs
1625
+ //#region ../workers-utils/dist/chunk-ULVYGN52.mjs
1630
1626
  var UserError = class extends Error {
1631
1627
  static {
1632
1628
  __name(this, "UserError");
@@ -3893,6 +3889,8 @@ function removeBOMAndValidate(buffer$1, file2) {
3893
3889
  return content;
3894
3890
  }
3895
3891
  __name(removeBOMAndValidate, "removeBOMAndValidate");
3892
+ var INHERIT_SYMBOL = Symbol.for("inherit_binding");
3893
+ var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
3896
3894
  function absolute(input, root) {
3897
3895
  return isAbsolute(input) ? input : resolve(root || ".", input);
3898
3896
  }
@@ -3959,7 +3957,7 @@ function resolveWranglerConfigPath({ config, script }, options) {
3959
3957
  deployConfigPath: void 0,
3960
3958
  redirected: false
3961
3959
  };
3962
- return findWranglerConfig$1(script !== void 0 ? path3.dirname(script) : process.cwd(), options);
3960
+ return findWranglerConfig$1(script !== void 0 ? path.dirname(script) : process.cwd(), options);
3963
3961
  }
3964
3962
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
3965
3963
  function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -3990,15 +3988,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
3990
3988
  const deployConfigFile = readFileSync$1(deployConfigPath);
3991
3989
  try {
3992
3990
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
3993
- redirectedConfigPath = deployConfig.configPath && path3.resolve(path3.dirname(deployConfigPath), deployConfig.configPath);
3991
+ redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
3994
3992
  } catch (e) {
3995
- throw new UserError(`Failed to parse the deploy configuration file at ${path3.relative(".", deployConfigPath)}`, {
3993
+ throw new UserError(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
3996
3994
  cause: e,
3997
3995
  telemetryMessage: false
3998
3996
  });
3999
3997
  }
4000
3998
  if (!redirectedConfigPath) throw new UserError(esm_default`
4001
- A deploy configuration file was found at "${path3.relative(".", deployConfigPath)}".
3999
+ A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
4002
4000
  But this is not valid - the required "configPath" property was not found.
4003
4001
  Instead this file contains:
4004
4002
  \`\`\`
@@ -4006,13 +4004,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
4006
4004
  \`\`\`
4007
4005
  `, { telemetryMessage: false });
4008
4006
  if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default`
4009
- There is a deploy configuration at "${path3.relative(".", deployConfigPath)}".
4010
- But the redirected configuration path it points to, "${path3.relative(".", redirectedConfigPath)}", does not exist.
4007
+ There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
4008
+ But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
4011
4009
  `, { telemetryMessage: false });
4012
4010
  if (userConfigPath) {
4013
- if (path3.join(path3.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
4014
- Found both a user configuration file at "${path3.relative(".", userConfigPath)}"
4015
- and a deploy configuration file at "${path3.relative(".", deployConfigPath)}".
4011
+ if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
4012
+ Found both a user configuration file at "${path.relative(".", userConfigPath)}"
4013
+ and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
4016
4014
  But these do not share the same base path so it is not clear which should be used.
4017
4015
  `, { telemetryMessage: false });
4018
4016
  }
@@ -5228,10 +5226,10 @@ var require_util$5 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
5228
5226
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
5229
5227
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
5230
5228
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
5231
- let path = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
5229
+ let path$1 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
5232
5230
  if (origin[origin.length - 1] === "/") origin = origin.slice(0, origin.length - 1);
5233
- if (path && path[0] !== "/") path = `/${path}`;
5234
- return new URL(`${origin}${path}`);
5231
+ if (path$1 && path$1[0] !== "/") path$1 = `/${path$1}`;
5232
+ return new URL(`${origin}${path$1}`);
5235
5233
  }
5236
5234
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
5237
5235
  return url;
@@ -6106,8 +6104,8 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
6106
6104
  debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$2, error.message);
6107
6105
  });
6108
6106
  diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
6109
- const { request: { method, path, origin } } = evt;
6110
- debugLog("sending request to %s %s%s", method, origin, path);
6107
+ const { request: { method, path: path$1, origin } } = evt;
6108
+ debugLog("sending request to %s %s%s", method, origin, path$1);
6111
6109
  });
6112
6110
  }
6113
6111
  let isTrackingRequestEvents = false;
@@ -6119,16 +6117,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
6119
6117
  }
6120
6118
  isTrackingRequestEvents = true;
6121
6119
  diagnosticsChannel$1.subscribe("undici:request:headers", (evt) => {
6122
- const { request: { method, path, origin }, response: { statusCode } } = evt;
6123
- debugLog("received response to %s %s%s - HTTP %d", method, origin, path, statusCode);
6120
+ const { request: { method, path: path$1, origin }, response: { statusCode } } = evt;
6121
+ debugLog("received response to %s %s%s - HTTP %d", method, origin, path$1, statusCode);
6124
6122
  });
6125
6123
  diagnosticsChannel$1.subscribe("undici:request:trailers", (evt) => {
6126
- const { request: { method, path, origin } } = evt;
6127
- debugLog("trailers received from %s %s%s", method, origin, path);
6124
+ const { request: { method, path: path$1, origin } } = evt;
6125
+ debugLog("trailers received from %s %s%s", method, origin, path$1);
6128
6126
  });
6129
6127
  diagnosticsChannel$1.subscribe("undici:request:error", (evt) => {
6130
- const { request: { method, path, origin }, error } = evt;
6131
- debugLog("request to %s %s%s errored - %s", method, origin, path, error.message);
6128
+ const { request: { method, path: path$1, origin }, error } = evt;
6129
+ debugLog("request to %s %s%s errored - %s", method, origin, path$1, error.message);
6132
6130
  });
6133
6131
  }
6134
6132
  let isTrackingWebSocketEvents = false;
@@ -6181,10 +6179,10 @@ var require_request$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
6181
6179
  const invalidPathRegex = /[^\u0021-\u00ff]/;
6182
6180
  const kHandler = Symbol("handler");
6183
6181
  var Request$6 = class {
6184
- constructor(origin, { path, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
6185
- if (typeof path !== "string") throw new InvalidArgumentError$35("path must be a string");
6186
- else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") throw new InvalidArgumentError$35("path must be an absolute URL or start with a slash");
6187
- else if (invalidPathRegex.test(path)) throw new InvalidArgumentError$35("invalid request path");
6182
+ constructor(origin, { path: path$1, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
6183
+ if (typeof path$1 !== "string") throw new InvalidArgumentError$35("path must be a string");
6184
+ else if (path$1[0] !== "/" && !(path$1.startsWith("http://") || path$1.startsWith("https://")) && method !== "CONNECT") throw new InvalidArgumentError$35("path must be an absolute URL or start with a slash");
6185
+ else if (invalidPathRegex.test(path$1)) throw new InvalidArgumentError$35("invalid request path");
6188
6186
  if (typeof method !== "string") throw new InvalidArgumentError$35("method must be a string");
6189
6187
  else if (normalizedMethodRecords$1[method] === void 0 && !isValidHTTPToken$2(method)) throw new InvalidArgumentError$35("invalid request method");
6190
6188
  if (upgrade$1 && typeof upgrade$1 !== "string") throw new InvalidArgumentError$35("upgrade must be a string");
@@ -6225,7 +6223,7 @@ var require_request$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
6225
6223
  this.completed = false;
6226
6224
  this.aborted = false;
6227
6225
  this.upgrade = upgrade$1 || null;
6228
- this.path = query ? serializePathWithQuery$3(path, query) : path;
6226
+ this.path = query ? serializePathWithQuery$3(path$1, query) : path$1;
6229
6227
  this.origin = origin;
6230
6228
  this.protocol = getProtocolFromUrlString(origin);
6231
6229
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -9469,7 +9467,7 @@ var require_formdata = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
9469
9467
  const { kEnumerableProperty: kEnumerableProperty$10 } = require_util$5();
9470
9468
  const { webidl: webidl$14 } = require_webidl();
9471
9469
  const nodeUtil$2 = __require$2("node:util");
9472
- var FormData$2 = class FormData$2 {
9470
+ var FormData$3 = class FormData$3 {
9473
9471
  #state = [];
9474
9472
  constructor(form = void 0) {
9475
9473
  webidl$14.util.markAsUncloneable(this);
@@ -9480,7 +9478,7 @@ var require_formdata = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
9480
9478
  });
9481
9479
  }
9482
9480
  append(name, value, filename = void 0) {
9483
- webidl$14.brandCheck(this, FormData$2);
9481
+ webidl$14.brandCheck(this, FormData$3);
9484
9482
  const prefix = "FormData.append";
9485
9483
  webidl$14.argumentLengthCheck(arguments, 2, prefix);
9486
9484
  name = webidl$14.converters.USVString(name);
@@ -9492,13 +9490,13 @@ var require_formdata = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
9492
9490
  this.#state.push(entry);
9493
9491
  }
9494
9492
  delete(name) {
9495
- webidl$14.brandCheck(this, FormData$2);
9493
+ webidl$14.brandCheck(this, FormData$3);
9496
9494
  webidl$14.argumentLengthCheck(arguments, 1, "FormData.delete");
9497
9495
  name = webidl$14.converters.USVString(name);
9498
9496
  this.#state = this.#state.filter((entry) => entry.name !== name);
9499
9497
  }
9500
9498
  get(name) {
9501
- webidl$14.brandCheck(this, FormData$2);
9499
+ webidl$14.brandCheck(this, FormData$3);
9502
9500
  webidl$14.argumentLengthCheck(arguments, 1, "FormData.get");
9503
9501
  name = webidl$14.converters.USVString(name);
9504
9502
  const idx = this.#state.findIndex((entry) => entry.name === name);
@@ -9506,19 +9504,19 @@ var require_formdata = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
9506
9504
  return this.#state[idx].value;
9507
9505
  }
9508
9506
  getAll(name) {
9509
- webidl$14.brandCheck(this, FormData$2);
9507
+ webidl$14.brandCheck(this, FormData$3);
9510
9508
  webidl$14.argumentLengthCheck(arguments, 1, "FormData.getAll");
9511
9509
  name = webidl$14.converters.USVString(name);
9512
9510
  return this.#state.filter((entry) => entry.name === name).map((entry) => entry.value);
9513
9511
  }
9514
9512
  has(name) {
9515
- webidl$14.brandCheck(this, FormData$2);
9513
+ webidl$14.brandCheck(this, FormData$3);
9516
9514
  webidl$14.argumentLengthCheck(arguments, 1, "FormData.has");
9517
9515
  name = webidl$14.converters.USVString(name);
9518
9516
  return this.#state.findIndex((entry) => entry.name === name) !== -1;
9519
9517
  }
9520
9518
  set(name, value, filename = void 0) {
9521
- webidl$14.brandCheck(this, FormData$2);
9519
+ webidl$14.brandCheck(this, FormData$3);
9522
9520
  const prefix = "FormData.set";
9523
9521
  webidl$14.argumentLengthCheck(arguments, 2, prefix);
9524
9522
  name = webidl$14.converters.USVString(name);
@@ -9561,11 +9559,11 @@ var require_formdata = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
9561
9559
  formData.#state = newState;
9562
9560
  }
9563
9561
  };
9564
- const { getFormDataState, setFormDataState: setFormDataState$1 } = FormData$2;
9565
- Reflect.deleteProperty(FormData$2, "getFormDataState");
9566
- Reflect.deleteProperty(FormData$2, "setFormDataState");
9567
- iteratorMixin$1("FormData", FormData$2, getFormDataState, "name", "value");
9568
- Object.defineProperties(FormData$2.prototype, {
9562
+ const { getFormDataState, setFormDataState: setFormDataState$1 } = FormData$3;
9563
+ Reflect.deleteProperty(FormData$3, "getFormDataState");
9564
+ Reflect.deleteProperty(FormData$3, "setFormDataState");
9565
+ iteratorMixin$1("FormData", FormData$3, getFormDataState, "name", "value");
9566
+ Object.defineProperties(FormData$3.prototype, {
9569
9567
  append: kEnumerableProperty$10,
9570
9568
  delete: kEnumerableProperty$10,
9571
9569
  get: kEnumerableProperty$10,
@@ -9601,9 +9599,9 @@ var require_formdata = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
9601
9599
  value
9602
9600
  };
9603
9601
  }
9604
- webidl$14.is.FormData = webidl$14.util.MakeTypeAssertion(FormData$2);
9602
+ webidl$14.is.FormData = webidl$14.util.MakeTypeAssertion(FormData$3);
9605
9603
  module.exports = {
9606
- FormData: FormData$2,
9604
+ FormData: FormData$3,
9607
9605
  makeEntry: makeEntry$1,
9608
9606
  setFormDataState: setFormDataState$1
9609
9607
  };
@@ -9883,7 +9881,7 @@ var require_promise = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
9883
9881
  var require_body = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/web/fetch/body.js": ((exports, module) => {
9884
9882
  const util$24 = require_util$5();
9885
9883
  const { ReadableStreamFrom: ReadableStreamFrom$1, readableStreamClose: readableStreamClose$1, fullyReadBody: fullyReadBody$1, extractMimeType: extractMimeType$1 } = require_util$4();
9886
- const { FormData: FormData$1, setFormDataState } = require_formdata();
9884
+ const { FormData: FormData$2, setFormDataState } = require_formdata();
9887
9885
  const { webidl: webidl$12 } = require_webidl();
9888
9886
  const assert$25 = __require$2("node:assert");
9889
9887
  const { isErrored: isErrored$1, isDisturbed: isDisturbed$2 } = __require$2("node:stream");
@@ -10053,13 +10051,13 @@ Content-Type: ${value.type || "application/octet-stream"}\r\n\r\n`);
10053
10051
  if (mimeType !== null) switch (mimeType.essence) {
10054
10052
  case "multipart/form-data": {
10055
10053
  const parsed = multipartFormDataParser(value, mimeType);
10056
- const fd = new FormData$1();
10054
+ const fd = new FormData$2();
10057
10055
  setFormDataState(fd, parsed);
10058
10056
  return fd;
10059
10057
  }
10060
10058
  case "application/x-www-form-urlencoded": {
10061
10059
  const entries = new URLSearchParams(value.toString());
10062
- const fd = new FormData$1();
10060
+ const fd = new FormData$2();
10063
10061
  for (const [name, value$1] of entries) fd.append(name, value$1);
10064
10062
  return fd;
10065
10063
  }
@@ -10708,7 +10706,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
10708
10706
  * @returns
10709
10707
  */
10710
10708
  function writeH1(client, request$2) {
10711
- const { method, path, host, upgrade: upgrade$1, blocking, reset } = request$2;
10709
+ const { method, path: path$1, host, upgrade: upgrade$1, blocking, reset } = request$2;
10712
10710
  let { body, headers, contentLength } = request$2;
10713
10711
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
10714
10712
  if (util$23.isFormDataLike(body)) {
@@ -10753,7 +10751,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
10753
10751
  if (client[kMaxRequests$1] && socket[kCounter$1]++ >= client[kMaxRequests$1]) socket[kReset$1] = true;
10754
10752
  if (blocking) socket[kBlocking] = true;
10755
10753
  if (socket.setTypeOfService) socket.setTypeOfService(request$2.typeOfService);
10756
- let header = `${method} ${path} HTTP/1.1\r\n`;
10754
+ let header = `${method} ${path$1} HTTP/1.1\r\n`;
10757
10755
  if (typeof host === "string") header += `host: ${host}\r\n`;
10758
10756
  else header += client[kHostHeader$1];
10759
10757
  if (upgrade$1) header += `connection: upgrade\r\nupgrade: ${upgrade$1}\r\n`;
@@ -11289,7 +11287,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
11289
11287
  function writeH2(client, request$2) {
11290
11288
  const requestTimeout = request$2.bodyTimeout ?? client[kBodyTimeout$1];
11291
11289
  const session = client[kHTTP2Session];
11292
- const { method, path, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
11290
+ const { method, path: path$1, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
11293
11291
  let { body } = request$2;
11294
11292
  if (upgrade$1 != null && upgrade$1 !== "websocket") {
11295
11293
  util$22.errorRequest(client, request$2, new InvalidArgumentError$30(`Custom upgrade "${upgrade$1}" not supported over HTTP/2`));
@@ -11342,7 +11340,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
11342
11340
  }
11343
11341
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
11344
11342
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
11345
- headers[HTTP2_HEADER_PATH] = path;
11343
+ headers[HTTP2_HEADER_PATH] = path$1;
11346
11344
  if (protocol === "ws:" || protocol === "wss:") headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
11347
11345
  else headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
11348
11346
  stream$2 = session.request(headers, {
@@ -11384,7 +11382,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
11384
11382
  stream$2.setTimeout(requestTimeout);
11385
11383
  return true;
11386
11384
  }
11387
- headers[HTTP2_HEADER_PATH] = path;
11385
+ headers[HTTP2_HEADER_PATH] = path$1;
11388
11386
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
11389
11387
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
11390
11388
  if (body && typeof body.read === "function") body.read(0);
@@ -13210,8 +13208,8 @@ var require_proxy_agent = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
13210
13208
  }
13211
13209
  if (onHeaders) onHeaders.call(this, statusCode, data$1, resume$1);
13212
13210
  };
13213
- const { origin, path = "/", headers = {} } = opts;
13214
- opts.path = origin + path;
13211
+ const { origin, path: path$1 = "/", headers = {} } = opts;
13212
+ opts.path = origin + path$1;
13215
13213
  if (!("host" in headers) && !("Host" in headers)) {
13216
13214
  const { host } = new URL(origin);
13217
13215
  headers.host = host;
@@ -14995,16 +14993,16 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
14995
14993
  }
14996
14994
  return normalizedQp;
14997
14995
  }
14998
- function safeUrl(path) {
14999
- if (typeof path !== "string") return path;
15000
- const pathSegments = path.split("?", 3);
15001
- if (pathSegments.length !== 2) return path;
14996
+ function safeUrl(path$1) {
14997
+ if (typeof path$1 !== "string") return path$1;
14998
+ const pathSegments = path$1.split("?", 3);
14999
+ if (pathSegments.length !== 2) return path$1;
15002
15000
  const qp = new URLSearchParams(pathSegments.pop());
15003
15001
  qp.sort();
15004
15002
  return [...pathSegments, qp.toString()].join("?");
15005
15003
  }
15006
- function matchKey(mockDispatch$1, { path, method, body, headers }) {
15007
- const pathMatch = matchValue$1(mockDispatch$1.path, path);
15004
+ function matchKey(mockDispatch$1, { path: path$1, method, body, headers }) {
15005
+ const pathMatch = matchValue$1(mockDispatch$1.path, path$1);
15008
15006
  const methodMatch = matchValue$1(mockDispatch$1.method, method);
15009
15007
  const bodyMatch = typeof mockDispatch$1.body !== "undefined" ? matchValue$1(mockDispatch$1.body, body) : true;
15010
15008
  const headersMatch = matchHeaders(mockDispatch$1, headers);
@@ -15022,8 +15020,8 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
15022
15020
  const basePath = key.query ? serializePathWithQuery$2(key.path, key.query) : key.path;
15023
15021
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
15024
15022
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
15025
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path, ignoreTrailingSlash }) => {
15026
- return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path), resolvedPath);
15023
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$1, ignoreTrailingSlash }) => {
15024
+ return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$1)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path$1), resolvedPath);
15027
15025
  });
15028
15026
  if (matchedMockDispatches.length === 0) throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
15029
15027
  matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue$1(method, key.method));
@@ -15066,15 +15064,15 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
15066
15064
  /**
15067
15065
  * @param {string} path Path to remove trailing slash from
15068
15066
  */
15069
- function removeTrailingSlash(path) {
15070
- while (path.endsWith("/")) path = path.slice(0, -1);
15071
- if (path.length === 0) path = "/";
15072
- return path;
15067
+ function removeTrailingSlash(path$1) {
15068
+ while (path$1.endsWith("/")) path$1 = path$1.slice(0, -1);
15069
+ if (path$1.length === 0) path$1 = "/";
15070
+ return path$1;
15073
15071
  }
15074
15072
  function buildKey$1(opts) {
15075
- const { path, method, body, headers, query } = opts;
15073
+ const { path: path$1, method, body, headers, query } = opts;
15076
15074
  return {
15077
- path,
15075
+ path: path$1,
15078
15076
  method,
15079
15077
  body,
15080
15078
  headers,
@@ -15641,10 +15639,10 @@ var require_pending_interceptors_formatter = /* @__PURE__ */ __commonJS$1({ "../
15641
15639
  });
15642
15640
  }
15643
15641
  format(pendingInterceptors) {
15644
- const withPrettyHeaders = pendingInterceptors.map(({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
15642
+ const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$1, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
15645
15643
  Method: method,
15646
15644
  Origin: origin,
15647
- Path: path,
15645
+ Path: path$1,
15648
15646
  "Status code": statusCode,
15649
15647
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
15650
15648
  Invocations: timesInvoked,
@@ -15702,8 +15700,8 @@ var require_mock_agent = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
15702
15700
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
15703
15701
  const dispatchOpts = { ...opts };
15704
15702
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
15705
- const [path, searchParams] = dispatchOpts.path.split("?");
15706
- dispatchOpts.path = `${path}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
15703
+ const [path$1, searchParams] = dispatchOpts.path.split("?");
15704
+ dispatchOpts.path = `${path$1}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
15707
15705
  }
15708
15706
  return this[kAgent].dispatch(dispatchOpts, handler);
15709
15707
  }
@@ -15919,7 +15917,7 @@ var require_snapshot_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/
15919
15917
  var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/mock/snapshot-recorder.js": ((exports, module) => {
15920
15918
  const { writeFile, readFile, mkdir } = __require$2("node:fs/promises");
15921
15919
  const { dirname: dirname$2, resolve: resolve$3 } = __require$2("node:path");
15922
- const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = __require$2("node:timers");
15920
+ const { setTimeout: setTimeout$2, clearTimeout: clearTimeout$1 } = __require$2("node:timers");
15923
15921
  const { InvalidArgumentError: InvalidArgumentError$6, UndiciError: UndiciError$1 } = require_errors();
15924
15922
  const { hashId, isUrlExcludedFactory, normalizeHeaders: normalizeHeaders$4, createHeaderFilters } = require_snapshot_utils();
15925
15923
  /**
@@ -16180,10 +16178,10 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16180
16178
  * @return {Promise<void>} - Resolves when snapshots are loaded
16181
16179
  */
16182
16180
  async loadSnapshots(filePath) {
16183
- const path = filePath || this.#snapshotPath;
16184
- if (!path) throw new InvalidArgumentError$6("Snapshot path is required");
16181
+ const path$1 = filePath || this.#snapshotPath;
16182
+ if (!path$1) throw new InvalidArgumentError$6("Snapshot path is required");
16185
16183
  try {
16186
- const data$1 = await readFile(resolve$3(path), "utf8");
16184
+ const data$1 = await readFile(resolve$3(path$1), "utf8");
16187
16185
  const parsed = JSON.parse(data$1);
16188
16186
  if (Array.isArray(parsed)) {
16189
16187
  this.#snapshots.clear();
@@ -16191,7 +16189,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16191
16189
  } else this.#snapshots = new Map(Object.entries(parsed));
16192
16190
  } catch (error) {
16193
16191
  if (error.code === "ENOENT") this.#snapshots.clear();
16194
- else throw new UndiciError$1(`Failed to load snapshots from ${path}`, { cause: error });
16192
+ else throw new UndiciError$1(`Failed to load snapshots from ${path$1}`, { cause: error });
16195
16193
  }
16196
16194
  }
16197
16195
  /**
@@ -16201,9 +16199,9 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16201
16199
  * @returns {Promise<void>} - Resolves when snapshots are saved
16202
16200
  */
16203
16201
  async saveSnapshots(filePath) {
16204
- const path = filePath || this.#snapshotPath;
16205
- if (!path) throw new InvalidArgumentError$6("Snapshot path is required");
16206
- const resolvedPath = resolve$3(path);
16202
+ const path$1 = filePath || this.#snapshotPath;
16203
+ if (!path$1) throw new InvalidArgumentError$6("Snapshot path is required");
16204
+ const resolvedPath = resolve$3(path$1);
16207
16205
  await mkdir(dirname$2(resolvedPath), { recursive: true });
16208
16206
  const data$1 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
16209
16207
  hash,
@@ -16297,7 +16295,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16297
16295
  * Schedules a flush (debounced to avoid excessive writes)
16298
16296
  */
16299
16297
  #scheduleFlush() {
16300
- this.#flushTimeout = setTimeout$1(() => {
16298
+ this.#flushTimeout = setTimeout$2(() => {
16301
16299
  this.saveSnapshots().catch(() => {});
16302
16300
  if (this.#autoFlush) this.#flushTimeout?.refresh();
16303
16301
  else this.#flushTimeout = null;
@@ -16770,11 +16768,11 @@ var require_redirect_handler = /* @__PURE__ */ __commonJS$1({ "../../node_module
16770
16768
  return;
16771
16769
  }
16772
16770
  const { origin, pathname, search } = util$10.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
16773
- const path = search ? `${pathname}${search}` : pathname;
16774
- const redirectUrlString = `${origin}${path}`;
16771
+ const path$1 = search ? `${pathname}${search}` : pathname;
16772
+ const redirectUrlString = `${origin}${path$1}`;
16775
16773
  for (const historyUrl of this.history) if (historyUrl.toString() === redirectUrlString) throw new InvalidArgumentError$3(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
16776
16774
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
16777
- this.opts.path = path;
16775
+ this.opts.path = path$1;
16778
16776
  this.opts.origin = origin;
16779
16777
  this.opts.query = null;
16780
16778
  }
@@ -19860,7 +19858,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19860
19858
  }
19861
19859
  }
19862
19860
  };
19863
- var Headers$5 = class Headers$5 {
19861
+ var Headers$6 = class Headers$6 {
19864
19862
  #guard;
19865
19863
  /**
19866
19864
  * @type {HeadersList}
@@ -19881,7 +19879,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19881
19879
  }
19882
19880
  }
19883
19881
  append(name, value) {
19884
- webidl$11.brandCheck(this, Headers$5);
19882
+ webidl$11.brandCheck(this, Headers$6);
19885
19883
  webidl$11.argumentLengthCheck(arguments, 2, "Headers.append");
19886
19884
  const prefix = "Headers.append";
19887
19885
  name = webidl$11.converters.ByteString(name, prefix, "name");
@@ -19889,7 +19887,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19889
19887
  return appendHeader(this, name, value);
19890
19888
  }
19891
19889
  delete(name) {
19892
- webidl$11.brandCheck(this, Headers$5);
19890
+ webidl$11.brandCheck(this, Headers$6);
19893
19891
  webidl$11.argumentLengthCheck(arguments, 1, "Headers.delete");
19894
19892
  name = webidl$11.converters.ByteString(name, "Headers.delete", "name");
19895
19893
  if (!isValidHeaderName$1(name)) throw webidl$11.errors.invalidArgument({
@@ -19902,7 +19900,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19902
19900
  this.#headersList.delete(name, false);
19903
19901
  }
19904
19902
  get(name) {
19905
- webidl$11.brandCheck(this, Headers$5);
19903
+ webidl$11.brandCheck(this, Headers$6);
19906
19904
  webidl$11.argumentLengthCheck(arguments, 1, "Headers.get");
19907
19905
  const prefix = "Headers.get";
19908
19906
  name = webidl$11.converters.ByteString(name, prefix, "name");
@@ -19914,7 +19912,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19914
19912
  return this.#headersList.get(name, false);
19915
19913
  }
19916
19914
  has(name) {
19917
- webidl$11.brandCheck(this, Headers$5);
19915
+ webidl$11.brandCheck(this, Headers$6);
19918
19916
  webidl$11.argumentLengthCheck(arguments, 1, "Headers.has");
19919
19917
  const prefix = "Headers.has";
19920
19918
  name = webidl$11.converters.ByteString(name, prefix, "name");
@@ -19926,7 +19924,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19926
19924
  return this.#headersList.contains(name, false);
19927
19925
  }
19928
19926
  set(name, value) {
19929
- webidl$11.brandCheck(this, Headers$5);
19927
+ webidl$11.brandCheck(this, Headers$6);
19930
19928
  webidl$11.argumentLengthCheck(arguments, 2, "Headers.set");
19931
19929
  const prefix = "Headers.set";
19932
19930
  name = webidl$11.converters.ByteString(name, prefix, "name");
@@ -19946,7 +19944,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19946
19944
  this.#headersList.set(name, value, false);
19947
19945
  }
19948
19946
  getSetCookie() {
19949
- webidl$11.brandCheck(this, Headers$5);
19947
+ webidl$11.brandCheck(this, Headers$6);
19950
19948
  const list$1 = this.#headersList.cookies;
19951
19949
  if (list$1) return [...list$1];
19952
19950
  return [];
@@ -19975,13 +19973,13 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19975
19973
  target$1.#headersList = list$1;
19976
19974
  }
19977
19975
  };
19978
- const { getHeadersGuard: getHeadersGuard$2, setHeadersGuard: setHeadersGuard$2, getHeadersList: getHeadersList$2, setHeadersList: setHeadersList$2 } = Headers$5;
19979
- Reflect.deleteProperty(Headers$5, "getHeadersGuard");
19980
- Reflect.deleteProperty(Headers$5, "setHeadersGuard");
19981
- Reflect.deleteProperty(Headers$5, "getHeadersList");
19982
- Reflect.deleteProperty(Headers$5, "setHeadersList");
19983
- iteratorMixin("Headers", Headers$5, headersListSortAndCombine, 0, 1);
19984
- Object.defineProperties(Headers$5.prototype, {
19976
+ const { getHeadersGuard: getHeadersGuard$2, setHeadersGuard: setHeadersGuard$2, getHeadersList: getHeadersList$2, setHeadersList: setHeadersList$2 } = Headers$6;
19977
+ Reflect.deleteProperty(Headers$6, "getHeadersGuard");
19978
+ Reflect.deleteProperty(Headers$6, "setHeadersGuard");
19979
+ Reflect.deleteProperty(Headers$6, "getHeadersList");
19980
+ Reflect.deleteProperty(Headers$6, "setHeadersList");
19981
+ iteratorMixin("Headers", Headers$6, headersListSortAndCombine, 0, 1);
19982
+ Object.defineProperties(Headers$6.prototype, {
19985
19983
  append: kEnumerableProperty$9,
19986
19984
  delete: kEnumerableProperty$9,
19987
19985
  get: kEnumerableProperty$9,
@@ -19997,7 +19995,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
19997
19995
  webidl$11.converters.HeadersInit = function(V, prefix, argument) {
19998
19996
  if (webidl$11.util.Type(V) === webidl$11.util.Types.OBJECT) {
19999
19997
  const iterator = Reflect.get(V, Symbol.iterator);
20000
- if (!util$6.types.isProxy(V) && iterator === Headers$5.prototype.entries) try {
19998
+ if (!util$6.types.isProxy(V) && iterator === Headers$6.prototype.entries) try {
20001
19999
  return getHeadersList$2(V).entriesList;
20002
20000
  } catch {}
20003
20001
  if (typeof iterator === "function") return webidl$11.converters["sequence<sequence<ByteString>>"](V, prefix, argument, iterator.bind(V));
@@ -20012,7 +20010,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
20012
20010
  module.exports = {
20013
20011
  fill: fill$1,
20014
20012
  compareHeaderName,
20015
- Headers: Headers$5,
20013
+ Headers: Headers$6,
20016
20014
  HeadersList: HeadersList$3,
20017
20015
  getHeadersGuard: getHeadersGuard$2,
20018
20016
  setHeadersGuard: setHeadersGuard$2,
@@ -20024,7 +20022,7 @@ var require_headers = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
20024
20022
  //#endregion
20025
20023
  //#region ../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/web/fetch/response.js
20026
20024
  var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/web/fetch/response.js": ((exports, module) => {
20027
- const { Headers: Headers$4, HeadersList: HeadersList$2, fill, getHeadersGuard: getHeadersGuard$1, setHeadersGuard: setHeadersGuard$1, setHeadersList: setHeadersList$1 } = require_headers();
20025
+ const { Headers: Headers$5, HeadersList: HeadersList$2, fill, getHeadersGuard: getHeadersGuard$1, setHeadersGuard: setHeadersGuard$1, setHeadersList: setHeadersList$1 } = require_headers();
20028
20026
  const { extractBody: extractBody$2, cloneBody: cloneBody$1, mixinBody: mixinBody$1, streamRegistry, bodyUnusable: bodyUnusable$1 } = require_body();
20029
20027
  const util$5 = require_util$5();
20030
20028
  const nodeUtil$1 = __require$2("node:util");
@@ -20037,7 +20035,7 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20037
20035
  const assert$9 = __require$2("node:assert");
20038
20036
  const { isomorphicEncode: isomorphicEncode$1, serializeJavascriptValueToJSONString } = require_infra();
20039
20037
  const textEncoder = new TextEncoder("utf-8");
20040
- var Response$2 = class Response$2 {
20038
+ var Response$3 = class Response$3 {
20041
20039
  /** @type {Headers} */
20042
20040
  #headers;
20043
20041
  #state;
@@ -20078,7 +20076,7 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20078
20076
  if (body !== null) body = webidl$10.converters.BodyInit(body, "Response", "body");
20079
20077
  init = webidl$10.converters.ResponseInit(init);
20080
20078
  this.#state = makeResponse$1({});
20081
- this.#headers = new Headers$4(kConstruct$6);
20079
+ this.#headers = new Headers$5(kConstruct$6);
20082
20080
  setHeadersGuard$1(this.#headers, "response");
20083
20081
  setHeadersList$1(this.#headers, this.#state.headersList);
20084
20082
  let bodyWithType = null;
@@ -20092,46 +20090,46 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20092
20090
  initializeResponse(this, init, bodyWithType);
20093
20091
  }
20094
20092
  get type() {
20095
- webidl$10.brandCheck(this, Response$2);
20093
+ webidl$10.brandCheck(this, Response$3);
20096
20094
  return this.#state.type;
20097
20095
  }
20098
20096
  get url() {
20099
- webidl$10.brandCheck(this, Response$2);
20097
+ webidl$10.brandCheck(this, Response$3);
20100
20098
  const urlList = this.#state.urlList;
20101
20099
  const url = urlList[urlList.length - 1] ?? null;
20102
20100
  if (url === null) return "";
20103
20101
  return URLSerializer$3(url, true);
20104
20102
  }
20105
20103
  get redirected() {
20106
- webidl$10.brandCheck(this, Response$2);
20104
+ webidl$10.brandCheck(this, Response$3);
20107
20105
  return this.#state.urlList.length > 1;
20108
20106
  }
20109
20107
  get status() {
20110
- webidl$10.brandCheck(this, Response$2);
20108
+ webidl$10.brandCheck(this, Response$3);
20111
20109
  return this.#state.status;
20112
20110
  }
20113
20111
  get ok() {
20114
- webidl$10.brandCheck(this, Response$2);
20112
+ webidl$10.brandCheck(this, Response$3);
20115
20113
  return this.#state.status >= 200 && this.#state.status <= 299;
20116
20114
  }
20117
20115
  get statusText() {
20118
- webidl$10.brandCheck(this, Response$2);
20116
+ webidl$10.brandCheck(this, Response$3);
20119
20117
  return this.#state.statusText;
20120
20118
  }
20121
20119
  get headers() {
20122
- webidl$10.brandCheck(this, Response$2);
20120
+ webidl$10.brandCheck(this, Response$3);
20123
20121
  return this.#headers;
20124
20122
  }
20125
20123
  get body() {
20126
- webidl$10.brandCheck(this, Response$2);
20124
+ webidl$10.brandCheck(this, Response$3);
20127
20125
  return this.#state.body ? this.#state.body.stream : null;
20128
20126
  }
20129
20127
  get bodyUsed() {
20130
- webidl$10.brandCheck(this, Response$2);
20128
+ webidl$10.brandCheck(this, Response$3);
20131
20129
  return !!this.#state.body && util$5.isDisturbed(this.#state.body.stream);
20132
20130
  }
20133
20131
  clone() {
20134
- webidl$10.brandCheck(this, Response$2);
20132
+ webidl$10.brandCheck(this, Response$3);
20135
20133
  if (bodyUnusable$1(this.#state)) throw webidl$10.errors.exception({
20136
20134
  header: "Response.clone",
20137
20135
  message: "Body has already been consumed."
@@ -20183,13 +20181,13 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20183
20181
  response.#state = newState;
20184
20182
  }
20185
20183
  };
20186
- const { getResponseHeaders, setResponseHeaders, getResponseState: getResponseState$2, setResponseState } = Response$2;
20187
- Reflect.deleteProperty(Response$2, "getResponseHeaders");
20188
- Reflect.deleteProperty(Response$2, "setResponseHeaders");
20189
- Reflect.deleteProperty(Response$2, "getResponseState");
20190
- Reflect.deleteProperty(Response$2, "setResponseState");
20191
- mixinBody$1(Response$2, getResponseState$2);
20192
- Object.defineProperties(Response$2.prototype, {
20184
+ const { getResponseHeaders, setResponseHeaders, getResponseState: getResponseState$2, setResponseState } = Response$3;
20185
+ Reflect.deleteProperty(Response$3, "getResponseHeaders");
20186
+ Reflect.deleteProperty(Response$3, "setResponseHeaders");
20187
+ Reflect.deleteProperty(Response$3, "getResponseState");
20188
+ Reflect.deleteProperty(Response$3, "setResponseState");
20189
+ mixinBody$1(Response$3, getResponseState$2);
20190
+ Object.defineProperties(Response$3.prototype, {
20193
20191
  type: kEnumerableProperty$8,
20194
20192
  url: kEnumerableProperty$8,
20195
20193
  status: kEnumerableProperty$8,
@@ -20205,7 +20203,7 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20205
20203
  configurable: true
20206
20204
  }
20207
20205
  });
20208
- Object.defineProperties(Response$2, {
20206
+ Object.defineProperties(Response$3, {
20209
20207
  json: kEnumerableProperty$8,
20210
20208
  redirect: kEnumerableProperty$8,
20211
20209
  error: kEnumerableProperty$8
@@ -20315,9 +20313,9 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20315
20313
  * @returns {Response}
20316
20314
  */
20317
20315
  function fromInnerResponse$2(innerResponse, guard) {
20318
- const response = new Response$2(kConstruct$6);
20316
+ const response = new Response$3(kConstruct$6);
20319
20317
  setResponseState(response, innerResponse);
20320
- const headers = new Headers$4(kConstruct$6);
20318
+ const headers = new Headers$5(kConstruct$6);
20321
20319
  setResponseHeaders(response, headers);
20322
20320
  setHeadersList$1(headers, innerResponse.headersList);
20323
20321
  setHeadersGuard$1(headers, guard);
@@ -20353,14 +20351,14 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20353
20351
  converter: webidl$10.converters.HeadersInit
20354
20352
  }
20355
20353
  ]);
20356
- webidl$10.is.Response = webidl$10.util.MakeTypeAssertion(Response$2);
20354
+ webidl$10.is.Response = webidl$10.util.MakeTypeAssertion(Response$3);
20357
20355
  module.exports = {
20358
20356
  isNetworkError: isNetworkError$1,
20359
20357
  makeNetworkError: makeNetworkError$1,
20360
20358
  makeResponse: makeResponse$1,
20361
20359
  makeAppropriateNetworkError: makeAppropriateNetworkError$1,
20362
20360
  filterResponse: filterResponse$1,
20363
- Response: Response$2,
20361
+ Response: Response$3,
20364
20362
  cloneResponse: cloneResponse$1,
20365
20363
  fromInnerResponse: fromInnerResponse$2,
20366
20364
  getResponseState: getResponseState$2
@@ -20371,7 +20369,7 @@ var require_response = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
20371
20369
  //#region ../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/web/fetch/request.js
20372
20370
  var require_request = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/web/fetch/request.js": ((exports, module) => {
20373
20371
  const { extractBody: extractBody$1, mixinBody, cloneBody, bodyUnusable } = require_body();
20374
- const { Headers: Headers$3, fill: fillHeaders, HeadersList: HeadersList$1, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList: getHeadersList$1 } = require_headers();
20372
+ const { Headers: Headers$4, fill: fillHeaders, HeadersList: HeadersList$1, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList: getHeadersList$1 } = require_headers();
20375
20373
  const util$4 = require_util$5();
20376
20374
  const nodeUtil = __require$2("node:util");
20377
20375
  const { isValidHTTPToken, sameOrigin: sameOrigin$1, environmentSettingsObject: environmentSettingsObject$3 } = require_util$4();
@@ -20547,7 +20545,7 @@ var require_request = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
20547
20545
  abort: abort$1
20548
20546
  }, abort$1);
20549
20547
  }
20550
- this.#headers = new Headers$3(kConstruct$5);
20548
+ this.#headers = new Headers$4(kConstruct$5);
20551
20549
  setHeadersList(this.#headers, request$2.headersList);
20552
20550
  setHeadersGuard(this.#headers, "request");
20553
20551
  if (mode === "no-cors") {
@@ -20820,7 +20818,7 @@ var require_request = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
20820
20818
  setRequestState(request$2, innerRequest);
20821
20819
  setRequestDispatcher(request$2, dispatcher);
20822
20820
  setRequestSignal(request$2, signal);
20823
- const headers = new Headers$3(kConstruct$5);
20821
+ const headers = new Headers$4(kConstruct$5);
20824
20822
  setRequestHeaders(request$2, headers);
20825
20823
  setHeadersList(headers, innerRequest.headersList);
20826
20824
  setHeadersGuard(headers, guard);
@@ -21732,10 +21730,10 @@ var require_fetch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/und
21732
21730
  const url = requestCurrentURL(request$2);
21733
21731
  /** @type {import('../../..').Agent} */
21734
21732
  const agent = fetchParams.controller.dispatcher;
21735
- const path = url.pathname + url.search;
21733
+ const path$1 = url.pathname + url.search;
21736
21734
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
21737
21735
  return new Promise((resolve$4, reject) => agent.dispatch({
21738
- path: hasTrailingQuestionMark ? `${path}?` : path,
21736
+ path: hasTrailingQuestionMark ? `${path$1}?` : path$1,
21739
21737
  origin: url.origin,
21740
21738
  method: request$2.method,
21741
21739
  body: agent.isMockActive ? request$2.body && (request$2.body.source || request$2.body.stream) : body,
@@ -22517,9 +22515,9 @@ var require_util$2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
22517
22515
  * path-value = <any CHAR except CTLs or ";">
22518
22516
  * @param {string} path
22519
22517
  */
22520
- function validateCookiePath(path) {
22521
- for (let i$1 = 0; i$1 < path.length; ++i$1) {
22522
- const code = path.charCodeAt(i$1);
22518
+ function validateCookiePath(path$1) {
22519
+ for (let i$1 = 0; i$1 < path$1.length; ++i$1) {
22520
+ const code = path$1.charCodeAt(i$1);
22523
22521
  if (code < 32 || code === 127 || code === 59) throw new Error("Invalid cookie path");
22524
22522
  }
22525
22523
  }
@@ -22770,8 +22768,8 @@ var require_cookies = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
22770
22768
  const { parseSetCookie } = require_parse$1();
22771
22769
  const { stringify } = require_util$2();
22772
22770
  const { webidl: webidl$5 } = require_webidl();
22773
- const { Headers: Headers$2 } = require_headers();
22774
- const brandChecks = webidl$5.brandCheckMultiple([Headers$2, globalThis.Headers].filter(Boolean));
22771
+ const { Headers: Headers$3 } = require_headers();
22772
+ const brandChecks = webidl$5.brandCheckMultiple([Headers$3, globalThis.Headers].filter(Boolean));
22775
22773
  /**
22776
22774
  * @typedef {Object} Cookie
22777
22775
  * @property {string} name
@@ -23630,7 +23628,7 @@ var require_connection = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
23630
23628
  const { parseExtensions, isClosed: isClosed$1, isClosing: isClosing$1, isEstablished: isEstablished$2, isConnecting: isConnecting$1, validateCloseCodeAndReason: validateCloseCodeAndReason$1 } = require_util$1();
23631
23629
  const { makeRequest: makeRequest$1 } = require_request();
23632
23630
  const { fetching: fetching$1 } = require_fetch();
23633
- const { Headers: Headers$1, getHeadersList } = require_headers();
23631
+ const { Headers: Headers$2, getHeadersList } = require_headers();
23634
23632
  const { getDecodeSplit } = require_util$4();
23635
23633
  const { WebsocketFrameSend: WebsocketFrameSend$4 } = require_frame();
23636
23634
  const assert$2 = __require$2("node:assert");
@@ -23658,7 +23656,7 @@ var require_connection = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
23658
23656
  redirect: "error",
23659
23657
  useURLCredentials: true
23660
23658
  });
23661
- if (options.headers) request$2.headersList = getHeadersList(new Headers$1(options.headers));
23659
+ if (options.headers) request$2.headersList = getHeadersList(new Headers$2(options.headers));
23662
23660
  const keyValue = crypto.randomBytes(16).toString("base64");
23663
23661
  request$2.headersList.append("sec-websocket-key", keyValue, true);
23664
23662
  request$2.headersList.append("sec-websocket-version", "13", true);
@@ -25627,9 +25625,9 @@ var require_undici = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
25627
25625
  if (opts != null && typeof opts !== "object") throw new InvalidArgumentError("invalid opts");
25628
25626
  if (opts && opts.path != null) {
25629
25627
  if (typeof opts.path !== "string") throw new InvalidArgumentError("invalid opts.path");
25630
- let path = opts.path;
25631
- if (!opts.path.startsWith("/")) path = `/${path}`;
25632
- url = new URL(util$3.parseOrigin(url).origin + path);
25628
+ let path$1 = opts.path;
25629
+ if (!opts.path.startsWith("/")) path$1 = `/${path$1}`;
25630
+ url = new URL(util$3.parseOrigin(url).origin + path$1);
25633
25631
  } else {
25634
25632
  if (!opts) opts = typeof url === "object" ? url : {};
25635
25633
  url = util$3.parseURL(url);
@@ -26251,7 +26249,7 @@ var require_signal_exit = __commonJS({ "../../node_modules/.pnpm/signal-exit@3.0
26251
26249
  return function() {};
26252
26250
  };
26253
26251
  else {
26254
- assert2 = __require$1("assert");
26252
+ assert3 = __require$1("assert");
26255
26253
  signals = require_signals();
26256
26254
  isWin$1 = /^win/i.test(process2.platform);
26257
26255
  EE$3 = __require$1("events");
@@ -26268,7 +26266,7 @@ var require_signal_exit = __commonJS({ "../../node_modules/.pnpm/signal-exit@3.0
26268
26266
  }
26269
26267
  module$1.exports = function(cb, opts) {
26270
26268
  if (!processOk(global.process)) return function() {};
26271
- assert2.equal(typeof cb, "function", "a callback must be provided for exit handler");
26269
+ assert3.equal(typeof cb, "function", "a callback must be provided for exit handler");
26272
26270
  if (loaded === false) load();
26273
26271
  var ev = "exit";
26274
26272
  if (opts && opts.alwaysLast) ev = "afterexit";
@@ -26349,7 +26347,7 @@ var require_signal_exit = __commonJS({ "../../node_modules/.pnpm/signal-exit@3.0
26349
26347
  } else return originalProcessEmit.apply(this, arguments);
26350
26348
  }, "processEmit");
26351
26349
  }
26352
- var assert2;
26350
+ var assert3;
26353
26351
  var signals;
26354
26352
  var isWin$1;
26355
26353
  var EE$3;
@@ -27301,7 +27299,7 @@ var defaultWranglerConfig = {
27301
27299
  vectorize: [],
27302
27300
  ai_search_namespaces: [],
27303
27301
  ai_search: [],
27304
- web_search: void 0,
27302
+ websearch: void 0,
27305
27303
  agent_memory: [],
27306
27304
  hyperdrive: [],
27307
27305
  workflows: [],
@@ -30933,7 +30931,7 @@ __reExport(mod_esm_exports, __toESM(require_mod_cjs3(), 1));
30933
30931
  var mod_esm_default = import_mod_cjs.default;
30934
30932
  function getGlobalWranglerConfigPath() {
30935
30933
  const configDir = mod_esm_default(".wrangler").config();
30936
- const legacyConfigDir = path3.join(os.homedir(), ".wrangler");
30934
+ const legacyConfigDir = path.join(os.homedir(), ".wrangler");
30937
30935
  if (isDirectory(legacyConfigDir)) return legacyConfigDir;
30938
30936
  else return configDir;
30939
30937
  }
@@ -31004,6 +31002,7 @@ var getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({
31004
31002
  variableName: "CLOUDFLARE_API_BASE_URL",
31005
31003
  deprecatedName: "CF_API_BASE_URL"
31006
31004
  });
31005
+ var getCloudflareApiBaseUrl = /* @__PURE__ */ __name((complianceConfig) => getCloudflareApiBaseUrlFromEnv() ?? `https://api${getComplianceRegionSubdomain(complianceConfig)}${getStagingSubdomain()}.cloudflare.com/client/v4`, "getCloudflareApiBaseUrl");
31007
31006
  function getComplianceRegionSubdomain(complianceConfig) {
31008
31007
  return getCloudflareComplianceRegion(complianceConfig) === "fedramp_high" ? ".fed" : "";
31009
31008
  }
@@ -31032,7 +31031,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
31032
31031
  var getRegistryPath = getEnvironmentVariableFactory({
31033
31032
  variableName: "WRANGLER_REGISTRY_PATH",
31034
31033
  defaultValue() {
31035
- return path3.join(getGlobalWranglerConfigPath(), "registry");
31034
+ return path.join(getGlobalWranglerConfigPath(), "registry");
31036
31035
  }
31037
31036
  });
31038
31037
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
@@ -31351,7 +31350,7 @@ var friendlyBindingNames = {
31351
31350
  vectorize: "Vectorize Index",
31352
31351
  ai_search_namespaces: "AI Search Namespace",
31353
31352
  ai_search: "AI Search Instance",
31354
- web_search: "Web Search",
31353
+ websearch: "Web Search",
31355
31354
  agent_memory: "Agent Memory",
31356
31355
  hyperdrive: "Hyperdrive Config",
31357
31356
  r2_buckets: "R2 Bucket",
@@ -31404,7 +31403,7 @@ var bindingTypeFriendlyNames = {
31404
31403
  vectorize: "Vectorize Index",
31405
31404
  ai_search_namespace: "AI Search Namespace",
31406
31405
  ai_search: "AI Search Instance",
31407
- web_search: "Web Search",
31406
+ websearch: "Web Search",
31408
31407
  agent_memory: "Agent Memory",
31409
31408
  hyperdrive: "Hyperdrive Config",
31410
31409
  service: "Worker",
@@ -31448,7 +31447,7 @@ function isPagesConfig(rawConfig) {
31448
31447
  }
31449
31448
  __name(isPagesConfig, "isPagesConfig");
31450
31449
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
31451
- const diagnostics = new Diagnostics(`Processing ${configPath ? path3.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31450
+ const diagnostics = new Diagnostics(`Processing ${configPath ? path.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31452
31451
  validateOptionalProperty(diagnostics, "", "legacy_env", rawConfig.legacy_env, "boolean");
31453
31452
  validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
31454
31453
  validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
@@ -31552,34 +31551,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
31552
31551
  else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
31553
31552
  return {
31554
31553
  command,
31555
- watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) => path3.relative(process.cwd(), path3.join(path3.dirname(configPath), `${dir}`))) : path3.relative(process.cwd(), path3.join(path3.dirname(configPath), `${watch_dir}`)) : watch_dir,
31554
+ watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) => path.relative(process.cwd(), path.join(path.dirname(configPath), `${dir}`))) : path.relative(process.cwd(), path.join(path.dirname(configPath), `${watch_dir}`)) : watch_dir,
31556
31555
  cwd
31557
31556
  };
31558
31557
  }
31559
31558
  __name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
31560
31559
  function normalizeAndValidateMainField(configPath, rawMain) {
31561
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
31560
+ const configDir = path.dirname(configPath ?? "wrangler.toml");
31562
31561
  if (rawMain !== void 0) if (typeof rawMain === "string") {
31563
- const directory = path3.resolve(configDir);
31564
- return path3.resolve(directory, rawMain);
31562
+ const directory = path.resolve(configDir);
31563
+ return path.resolve(directory, rawMain);
31565
31564
  } else return rawMain;
31566
31565
  else return;
31567
31566
  }
31568
31567
  __name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
31569
31568
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
31570
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
31569
+ const configDir = path.dirname(configPath ?? "wrangler.toml");
31571
31570
  if (rawDir !== void 0) if (typeof rawDir === "string") {
31572
- const directory = path3.resolve(configDir);
31573
- return path3.resolve(directory, rawDir);
31571
+ const directory = path.resolve(configDir);
31572
+ return path.resolve(directory, rawDir);
31574
31573
  } else return rawDir;
31575
31574
  else return;
31576
31575
  }
31577
31576
  __name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
31578
31577
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
31579
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
31578
+ const configDir = path.dirname(configPath ?? "wrangler.toml");
31580
31579
  if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
31581
- const directory = path3.resolve(configDir);
31582
- return path3.resolve(directory, rawPagesDir);
31580
+ const directory = path.resolve(configDir);
31581
+ return path.resolve(directory, rawPagesDir);
31583
31582
  } else return rawPagesDir;
31584
31583
  else return;
31585
31584
  }
@@ -31632,7 +31631,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
31632
31631
  validateOptionalProperty(diagnostics, "site", "entry-point", rawConfig.site["entry-point"], "string");
31633
31632
  deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
31634
31633
  \`\`\`
31635
- main = "${path3.join(String(rawConfig.site["entry-point"]) || "workers-site", path3.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js")}"
31634
+ main = "${path.join(String(rawConfig.site["entry-point"]) || "workers-site", path.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js")}"
31636
31635
  \`\`\``, false, void 0, "warning");
31637
31636
  let siteEntryPoint = rawConfig.site["entry-point"];
31638
31637
  if (!mainEntryPoint && !siteEntryPoint) {
@@ -31645,7 +31644,7 @@ main = "workers-site/index.js"
31645
31644
  } else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
31646
31645
  They serve the same purpose: to point to the entry-point of your worker.
31647
31646
  Delete the deprecated \`site.entry-point\` field from your config.`);
31648
- if (configPath && siteEntryPoint) siteEntryPoint = path3.relative(process.cwd(), path3.join(path3.dirname(configPath), siteEntryPoint));
31647
+ if (configPath && siteEntryPoint) siteEntryPoint = path.relative(process.cwd(), path.join(path.dirname(configPath), siteEntryPoint));
31649
31648
  return {
31650
31649
  bucket,
31651
31650
  "entry-point": siteEntryPoint,
@@ -31677,7 +31676,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
31677
31676
  if (rawMapping === void 0) return;
31678
31677
  const mapping = {};
31679
31678
  for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
31680
- if (configPath) mapping[name] = configPath ? path3.relative(process.cwd(), path3.join(path3.dirname(configPath), filePath)) : filePath;
31679
+ if (configPath) mapping[name] = configPath ? path.relative(process.cwd(), path.join(path.dirname(configPath), filePath)) : filePath;
31681
31680
  }
31682
31681
  return mapping;
31683
31682
  }
@@ -31746,8 +31745,16 @@ function normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv) {
31746
31745
  return inheritable(diagnostics, topLevelEnv, mutateEmptyStringRouteValue(diagnostics, rawEnv), "route", isRoute, void 0);
31747
31746
  }
31748
31747
  __name(normalizeAndValidateRoute, "normalizeAndValidateRoute");
31749
- function validateRoutes(diagnostics, topLevelEnv, rawEnv) {
31750
- return inheritable(diagnostics, topLevelEnv, rawEnv, "routes", all(isRouteArray, isMutuallyExclusiveWith(rawEnv, "route")), void 0);
31748
+ function validateRoutes(diagnostics, topLevelEnv, rawEnv, envName) {
31749
+ const result = inheritable(diagnostics, topLevelEnv, rawEnv, "routes", all(isRouteArray, isMutuallyExclusiveWith(rawEnv, "route")), void 0);
31750
+ if (topLevelEnv !== void 0 && envName !== void 0 && rawEnv.routes === void 0) {
31751
+ const customDomainRoutes = topLevelEnv.routes?.filter((r2) => typeof r2 === "object" && r2 !== null && r2.custom_domain === true);
31752
+ if (customDomainRoutes && customDomainRoutes.length > 0) {
31753
+ const customDomains = customDomainRoutes.map((r2) => r2.pattern).join(", ");
31754
+ diagnostics.warnings.push(`The "env.${envName}" environment inherits the top-level \`routes\` configuration, which includes the custom domain(s): ${customDomains}. Deploying this environment will reassign these custom domains away from the top-level Worker. Add \`"routes": []\` to "env.${envName}" to prevent inheritance, or copy the route configuration from the top level to hide this warning.`);
31755
+ }
31756
+ }
31757
+ return result;
31751
31758
  }
31752
31759
  __name(validateRoutes, "validateRoutes");
31753
31760
  function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
@@ -31837,7 +31844,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31837
31844
  if (topLevelEnv === void 0 || rawConfig?.unsafe === void 0) experimental(diagnostics, rawEnv, "unsafe");
31838
31845
  const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
31839
31846
  const account_id = inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, mutateEmptyStringAccountIDValue(diagnostics, rawEnv), "account_id", isString$2, void 0, void 0);
31840
- const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
31847
+ const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv, topLevelEnv === void 0 ? void 0 : envName);
31841
31848
  const workers_dev = inheritable(diagnostics, topLevelEnv, rawEnv, "workers_dev", isBoolean, void 0);
31842
31849
  const preview_urls = inheritable(diagnostics, topLevelEnv, rawEnv, "preview_urls", isBoolean, void 0);
31843
31850
  const build$8 = normalizeAndValidateBuild(diagnostics, rawEnv, rawEnv.build ?? topLevelEnv?.build ?? {}, configPath);
@@ -31882,7 +31889,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31882
31889
  vectorize: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vectorize", validateBindingArray(envName, validateVectorizeBinding), []),
31883
31890
  ai_search_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search_namespaces", validateBindingArray(envName, validateAISearchNamespaceBinding), []),
31884
31891
  ai_search: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search", validateBindingArray(envName, validateAISearchBinding), []),
31885
- web_search: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "web_search", validateNamedSimpleBinding(envName), void 0),
31892
+ websearch: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "websearch", validateNamedSimpleBinding(envName), void 0),
31886
31893
  agent_memory: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "agent_memory", validateBindingArray(envName, validateAgentMemoryBinding), []),
31887
31894
  hyperdrive: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "hyperdrive", validateBindingArray(envName, validateHyperdriveBinding), []),
31888
31895
  services: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "services", validateBindingArray(envName, validateServiceBinding), []),
@@ -31927,7 +31934,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31927
31934
  __name(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
31928
31935
  function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
31929
31936
  const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
31930
- return configPath && tsconfig ? path3.relative(process.cwd(), path3.join(path3.dirname(configPath), tsconfig)) : tsconfig;
31937
+ return configPath && tsconfig ? path.relative(process.cwd(), path.join(path.dirname(configPath), tsconfig)) : tsconfig;
31931
31938
  }
31932
31939
  __name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
31933
31940
  var validateAndNormalizeRules = /* @__PURE__ */ __name((diagnostics, topLevelEnv, rawEnv, envName) => {
@@ -32351,7 +32358,7 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
32351
32358
  "ai",
32352
32359
  "ai_search_namespace",
32353
32360
  "ai_search",
32354
- "web_search",
32361
+ "websearch",
32355
32362
  "agent_memory",
32356
32363
  "kv_namespace",
32357
32364
  "durable_object_namespace",
@@ -32427,9 +32434,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
32427
32434
  let resolvedBuildContextPath = void 0;
32428
32435
  try {
32429
32436
  if (isDockerfile(resolvedImage, configPath)) {
32430
- const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
32431
- resolvedImage = path3.resolve(baseDir, resolvedImage);
32432
- resolvedBuildContextPath = containerAppOptional.image_build_context ? path3.resolve(baseDir, containerAppOptional.image_build_context) : path3.dirname(resolvedImage);
32437
+ const baseDir = configPath ? path.dirname(configPath) : process.cwd();
32438
+ resolvedImage = path.resolve(baseDir, resolvedImage);
32439
+ resolvedBuildContextPath = containerAppOptional.image_build_context ? path.resolve(baseDir, containerAppOptional.image_build_context) : path.dirname(resolvedImage);
32433
32440
  }
32434
32441
  } catch (err) {
32435
32442
  if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
@@ -32783,12 +32790,17 @@ var validateD1Binding = /* @__PURE__ */ __name((diagnostics, field, value) => {
32783
32790
  isValid2 = false;
32784
32791
  }
32785
32792
  if (!isRemoteValid(value, field, diagnostics)) isValid2 = false;
32793
+ if (!isOptionalProperty(value, "migrations_pattern", "string")) {
32794
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "migrations_pattern" field but got ${JSON.stringify(value)}.`);
32795
+ isValid2 = false;
32796
+ }
32786
32797
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
32787
32798
  "binding",
32788
32799
  "database_id",
32789
32800
  "database_internal_env",
32790
32801
  "database_name",
32791
32802
  "migrations_dir",
32803
+ "migrations_pattern",
32792
32804
  "migrations_table",
32793
32805
  "preview_database_id",
32794
32806
  "remote"
@@ -33596,8 +33608,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
33596
33608
  }
33597
33609
  __name(isRemoteValid, "isRemoteValid");
33598
33610
  function isDockerfile(imagePath, configPath) {
33599
- const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
33600
- const maybeDockerfile = path3.resolve(baseDir, imagePath);
33611
+ const baseDir = configPath ? path.dirname(configPath) : process.cwd();
33612
+ const maybeDockerfile = path.resolve(baseDir, imagePath);
33601
33613
  if (fs2.existsSync(maybeDockerfile)) {
33602
33614
  if (isDirectory(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
33603
33615
  return true;
@@ -33657,7 +33669,7 @@ var BINDING_LOCAL_SUPPORT = {
33657
33669
  flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33658
33670
  vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33659
33671
  vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33660
- web_search: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33672
+ websearch: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33661
33673
  agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
33662
33674
  };
33663
33675
  function getBindingLocalSupport(type) {
@@ -33749,7 +33761,7 @@ __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
33749
33761
  var import_signal_exit = __toESM(require_signal_exit());
33750
33762
  function getWranglerHiddenDirPath(projectRoot) {
33751
33763
  projectRoot ??= process.cwd();
33752
- return path3.join(projectRoot, ".wrangler");
33764
+ return path.join(projectRoot, ".wrangler");
33753
33765
  }
33754
33766
  __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
33755
33767
  var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
@@ -33766,7 +33778,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
33766
33778
  const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
33767
33779
  for (const entry of entries) {
33768
33780
  if (!entry.isDirectory()) continue;
33769
- const entryPath = path3.join(tmpRoot, entry.name);
33781
+ const entryPath = path.join(tmpRoot, entry.name);
33770
33782
  try {
33771
33783
  if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync(entryPath);
33772
33784
  } catch {}
@@ -33774,10 +33786,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
33774
33786
  }
33775
33787
  __name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
33776
33788
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
33777
- const tmpRoot = path3.join(getWranglerHiddenDirPath(projectRoot), "tmp");
33789
+ const tmpRoot = path.join(getWranglerHiddenDirPath(projectRoot), "tmp");
33778
33790
  fs2.mkdirSync(tmpRoot, { recursive: true });
33779
33791
  sweepStaleWranglerTmpDirs(tmpRoot);
33780
- const tmpPrefix = path3.join(tmpRoot, `${prefix}-`);
33792
+ const tmpPrefix = path.join(tmpRoot, `${prefix}-`);
33781
33793
  const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
33782
33794
  const cleanupDir = /* @__PURE__ */ __name(() => {
33783
33795
  if (cleanup) try {
@@ -34254,7 +34266,7 @@ function startTunnel(options) {
34254
34266
  if (disposed) return;
34255
34267
  const remainingMs = expiresAt - Date.now();
34256
34268
  if (remainingMs <= 0) return;
34257
- logger?.log(`${publicURL ? `The tunnel is still open at ${publicURL}.` : "The tunnel is still open."} It expires in ${formatTunnelDuration(remainingMs)}. ${options.extendHint ?? ""}`);
34269
+ logger?.log(`${publicURL ? `Tunnel still open, expires in ${formatTunnelDuration(remainingMs)}: ${publicURL}` : `The tunnel is still open. It expires in ${formatTunnelDuration(remainingMs)}.`}${options.extendHint ? ` ${options.extendHint}` : ""}`);
34258
34270
  }, reminderIntervalMs);
34259
34271
  reminderInterval.unref?.();
34260
34272
  }
@@ -34363,12 +34375,237 @@ function createTunnelStartupError(message, stderrOutput, origin) {
34363
34375
  cloudflared output:
34364
34376
  ${stderrOutput || "(no output)"}
34365
34377
 
34366
- The local dev server started at ${origin.href}.
34378
+ The local dev server started at ${origin.href}
34367
34379
  ` + (isQuickTunnelRateLimited ? "Cloudflare Quick Tunnel creation was rate limited. Try again in a few minutes, or use a named tunnel if you need more reliable access." : `Check the cloudflared output above for more details, and verify that ${origin.href} is reachable from this machine if this keeps happening.`);
34368
34380
  if (isQuickTunnelRateLimited) return new UserError(errorMessage, { telemetryMessage: false });
34369
34381
  return new Error(errorMessage);
34370
34382
  }
34371
34383
  __name(createTunnelStartupError, "createTunnelStartupError");
34384
+ function buildDetailedError(message, ...extra) {
34385
+ return new ParseError({
34386
+ text: message,
34387
+ notes: extra.map((text) => ({ text })),
34388
+ telemetryMessage: false
34389
+ });
34390
+ }
34391
+ __name(buildDetailedError, "buildDetailedError");
34392
+ function maybeThrowFriendlyError(error) {
34393
+ if (error.message === "workers.api.error.email_verification_required") throw buildDetailedError("Please verify your account's email address and try again.", "Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one.");
34394
+ }
34395
+ __name(maybeThrowFriendlyError, "maybeThrowFriendlyError");
34396
+ function logHeaders(headers, logger) {
34397
+ const clone = cloneHeaders(headers);
34398
+ clone.delete("Authorization");
34399
+ logger.debugWithSanitization("HEADERS:", JSON.stringify(Object.fromEntries(clone), null, 2));
34400
+ }
34401
+ __name(logHeaders, "logHeaders");
34402
+ async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
34403
+ assert(credentials, "credentials are required for performApiFetch");
34404
+ const method = init.method ?? "GET";
34405
+ assert(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
34406
+ const headers = cloneHeaders(new import_undici.Headers(init.headers));
34407
+ addAuthorizationHeader(headers, credentials);
34408
+ headers.set("User-Agent", userAgent);
34409
+ maybeAddTraceHeader(headers);
34410
+ const queryString = queryParams ? `?${queryParams.toString()}` : "";
34411
+ logger.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
34412
+ logger.debugWithSanitization("QUERY STRING:", queryString);
34413
+ logHeaders(headers, logger);
34414
+ logger.debugWithSanitization("INIT:", JSON.stringify({ ...init }, null, 2));
34415
+ if (init.body instanceof import_undici.FormData) logger.debugWithSanitization("BODY:", await new import_undici.Response(init.body).text(), null, 2);
34416
+ logger.debug("-- END CF API REQUEST");
34417
+ return await (0, import_undici.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
34418
+ method,
34419
+ ...init,
34420
+ headers,
34421
+ signal: abortSignal
34422
+ });
34423
+ }
34424
+ __name(performApiFetchBase, "performApiFetchBase");
34425
+ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
34426
+ const method = init.method ?? "GET";
34427
+ const response = await performApiFetchBase(complianceConfig, resource, init, userAgent, logger, queryParams, abortSignal, credentials);
34428
+ const jsonText = await response.text();
34429
+ logger.debug("-- START CF API RESPONSE:", response.statusText, response.status);
34430
+ logHeaders(response.headers, logger);
34431
+ logger.debugWithSanitization("RESPONSE:", jsonText);
34432
+ logger.debug("-- END CF API RESPONSE");
34433
+ if (!jsonText && (response.status === 204 || response.status === 205)) return {
34434
+ response: {
34435
+ result: {},
34436
+ success: true,
34437
+ errors: [],
34438
+ messages: []
34439
+ },
34440
+ status: response.status
34441
+ };
34442
+ if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText);
34443
+ try {
34444
+ return {
34445
+ response: parseJSON(jsonText),
34446
+ status: response.status
34447
+ };
34448
+ } catch {
34449
+ const rayId = extractWAFBlockRayId(response.headers);
34450
+ throw new APIError({
34451
+ text: "Received a malformed response from the API",
34452
+ notes: [
34453
+ { text: truncate(jsonText, 100) },
34454
+ { text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
34455
+ ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
34456
+ ],
34457
+ status: response.status,
34458
+ telemetryMessage: false
34459
+ });
34460
+ }
34461
+ }
34462
+ __name(fetchInternalBase, "fetchInternalBase");
34463
+ async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
34464
+ const { response: json, status } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger, queryParams, abortSignal, credentials);
34465
+ if (json.success) return json.result;
34466
+ else throwFetchError(resource, json, status);
34467
+ }
34468
+ __name(fetchResultBase, "fetchResultBase");
34469
+ async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, credentials) {
34470
+ const results = [];
34471
+ let getMoreResults = true;
34472
+ let cursor;
34473
+ while (getMoreResults) {
34474
+ if (cursor) {
34475
+ queryParams = new URLSearchParams$1(queryParams);
34476
+ queryParams.set("cursor", cursor);
34477
+ }
34478
+ const { response: json, status } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger, queryParams, void 0, credentials);
34479
+ if (json.success) {
34480
+ results.push(...json.result);
34481
+ if (hasCursor(json.result_info)) cursor = json.result_info?.cursor;
34482
+ else getMoreResults = false;
34483
+ } else throwFetchError(resource, json, status);
34484
+ }
34485
+ return results;
34486
+ }
34487
+ __name(fetchListResultBase, "fetchListResultBase");
34488
+ function truncate(text, maxLength) {
34489
+ const { length } = text;
34490
+ if (length <= maxLength) return text;
34491
+ return `${text.substring(0, maxLength)}... (length = ${length})`;
34492
+ }
34493
+ __name(truncate, "truncate");
34494
+ function isWAFBlockResponse(headers) {
34495
+ return headers.get("cf-mitigated") === "challenge";
34496
+ }
34497
+ __name(isWAFBlockResponse, "isWAFBlockResponse");
34498
+ function extractWAFBlockRayId(headers) {
34499
+ return headers.get("cf-ray") ?? void 0;
34500
+ }
34501
+ __name(extractWAFBlockRayId, "extractWAFBlockRayId");
34502
+ function extractAccountTag(resource) {
34503
+ return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
34504
+ }
34505
+ __name(extractAccountTag, "extractAccountTag");
34506
+ function hasMorePages(result_info) {
34507
+ const page = result_info?.page;
34508
+ const per_page = result_info?.per_page;
34509
+ const total = result_info?.total_count;
34510
+ return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
34511
+ }
34512
+ __name(hasMorePages, "hasMorePages");
34513
+ function renderError(err, level = 0) {
34514
+ const indent = " ".repeat(level);
34515
+ const message = err.message ?? "";
34516
+ const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
34517
+
34518
+ ${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
34519
+ return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
34520
+ ${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
34521
+ }
34522
+ __name(renderError, "renderError");
34523
+ function addAuthorizationHeader(headers, auth, overrideExisting = false) {
34524
+ if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
34525
+ const authorizationHeader = `Bearer ${auth.apiToken}`;
34526
+ validateAuthorizationHeaderValue(authorizationHeader);
34527
+ headers.set("Authorization", authorizationHeader);
34528
+ } else {
34529
+ headers.set("X-Auth-Key", auth.authKey);
34530
+ headers.set("X-Auth-Email", auth.authEmail);
34531
+ }
34532
+ }
34533
+ __name(addAuthorizationHeader, "addAuthorizationHeader");
34534
+ function validateAuthorizationHeaderValue(value) {
34535
+ for (const character of value) {
34536
+ const codePoint = character.codePointAt(0);
34537
+ if (codePoint === void 0 || codePoint > 255) throw new UserError(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
34538
+ }
34539
+ }
34540
+ __name(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
34541
+ function formatAuthorizationHeaderCharacter(character, codePoint) {
34542
+ if (codePoint === void 0) return "\"\\u{unknown}\"";
34543
+ const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
34544
+ return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
34545
+ }
34546
+ __name(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
34547
+ function isPrintableCharacter(character) {
34548
+ return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
34549
+ }
34550
+ __name(isPrintableCharacter, "isPrintableCharacter");
34551
+ function escapeCharacter(character) {
34552
+ return Array.from(character).map((c) => {
34553
+ const codePoint = c.codePointAt(0);
34554
+ if (codePoint === void 0) return "";
34555
+ return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
34556
+ }).join("");
34557
+ }
34558
+ __name(escapeCharacter, "escapeCharacter");
34559
+ function throwFetchError(resource, response, status) {
34560
+ const errors$1 = response.errors ?? [];
34561
+ for (const error2 of errors$1) maybeThrowFriendlyError(error2);
34562
+ const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
34563
+ if (notes.length === 0) {
34564
+ const raw = response;
34565
+ const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
34566
+ if (fallbackMessage) notes.push({ text: fallbackMessage });
34567
+ }
34568
+ const error = new APIError({
34569
+ text: `A request to the Cloudflare API (${resource}) failed.`,
34570
+ notes,
34571
+ status,
34572
+ telemetryMessage: false
34573
+ });
34574
+ const code = errors$1[0]?.code;
34575
+ if (code) error.code = code;
34576
+ error.accountTag = extractAccountTag(resource);
34577
+ throw error;
34578
+ }
34579
+ __name(throwFetchError, "throwFetchError");
34580
+ function throwWAFBlockError(headers, method, resource, status, statusText) {
34581
+ const rayId = extractWAFBlockRayId(headers);
34582
+ throw new APIError({
34583
+ text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
34584
+ notes: [
34585
+ { text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
34586
+ ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
34587
+ { text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser." },
34588
+ { text: `${method} ${resource} -> ${status} ${statusText}` }
34589
+ ],
34590
+ status,
34591
+ telemetryMessage: false
34592
+ });
34593
+ }
34594
+ __name(throwWAFBlockError, "throwWAFBlockError");
34595
+ function hasCursor(result_info) {
34596
+ const cursor = result_info?.cursor;
34597
+ return cursor !== void 0 && cursor !== null && cursor !== "";
34598
+ }
34599
+ __name(hasCursor, "hasCursor");
34600
+ function maybeAddTraceHeader(headers) {
34601
+ const traceHeader = getTraceHeader();
34602
+ if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
34603
+ }
34604
+ __name(maybeAddTraceHeader, "maybeAddTraceHeader");
34605
+ function cloneHeaders(headers) {
34606
+ return new import_undici.Headers(headers);
34607
+ }
34608
+ __name(cloneHeaders, "cloneHeaders");
34372
34609
  var import_update_check = __toESM(require_update_check());
34373
34610
  var UPDATE_CHECK_TIMEOUT_MS = 3e3;
34374
34611
  var TIMED_OUT = Symbol("timed_out");
@@ -34390,6 +34627,53 @@ async function fetchLatestNpmVersion(name, version$2) {
34390
34627
  };
34391
34628
  }
34392
34629
  __name(fetchLatestNpmVersion, "fetchLatestNpmVersion");
34630
+ var MAX_ATTEMPTS = 3;
34631
+ async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
34632
+ try {
34633
+ return await action();
34634
+ } catch (err) {
34635
+ if (err instanceof APIError) {
34636
+ if (!err.isRetryable()) throw err;
34637
+ } else if (err instanceof DOMException && err.name === "TimeoutError");
34638
+ else if (!(err instanceof TypeError)) throw err;
34639
+ logger.debug(`Retrying API call after error...`);
34640
+ logger.debug(err);
34641
+ if (attempts <= 1) throw err;
34642
+ await setTimeout$1(backoff, void 0, { signal: abortSignal });
34643
+ return retryOnAPIFailure(action, logger, backoff + 1e3, attempts - 1, abortSignal);
34644
+ }
34645
+ }
34646
+ __name(retryOnAPIFailure, "retryOnAPIFailure");
34647
+ function formatTime(duration) {
34648
+ return `(${(duration / 1e3).toFixed(2)} sec)`;
34649
+ }
34650
+ __name(formatTime, "formatTime");
34651
+ function getHostFromRoute(route) {
34652
+ let host;
34653
+ if (typeof route === "string") host = getHostFromUrl(route);
34654
+ else if (typeof route === "object") {
34655
+ host = getHostFromUrl(route.pattern);
34656
+ if (host === void 0 && "zone_name" in route) host = getHostFromUrl(route.zone_name);
34657
+ }
34658
+ return host;
34659
+ }
34660
+ __name(getHostFromRoute, "getHostFromRoute");
34661
+ function getZoneFromRoute(route) {
34662
+ if (typeof route === "object" && "zone_name" in route && route.zone_name) return route.zone_name;
34663
+ return getHostFromRoute(route);
34664
+ }
34665
+ __name(getZoneFromRoute, "getZoneFromRoute");
34666
+ function getHostFromUrl(urlLike) {
34667
+ if (urlLike.startsWith("*/") || urlLike.startsWith("http://*/") || urlLike.startsWith("https://*/")) return;
34668
+ urlLike = urlLike.replace(/\*(\.)?/g, "");
34669
+ if (!(urlLike.startsWith("http://") || urlLike.startsWith("https://"))) urlLike = "http://" + urlLike;
34670
+ try {
34671
+ return new URL(urlLike).host;
34672
+ } catch {
34673
+ return;
34674
+ }
34675
+ }
34676
+ __name(getHostFromUrl, "getHostFromUrl");
34393
34677
 
34394
34678
  //#endregion
34395
34679
  //#region ../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
@@ -36619,8 +36903,8 @@ const postfixRE = /[?#].*$/;
36619
36903
  function cleanUrl(url) {
36620
36904
  return url.replace(postfixRE, "");
36621
36905
  }
36622
- function withTrailingSlash(path) {
36623
- return path.endsWith("/") ? path : `${path}/`;
36906
+ function withTrailingSlash(path$1) {
36907
+ return path$1.endsWith("/") ? path$1 : `${path$1}/`;
36624
36908
  }
36625
36909
  function createRequestHandler(handler) {
36626
36910
  return async (req, res, next) => {
@@ -42122,15 +42406,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
42122
42406
  function withTrailingSlash$1(input = "", respectQueryAndFragment) {
42123
42407
  if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
42124
42408
  if (hasTrailingSlash(input, true)) return input || "/";
42125
- let path = input;
42409
+ let path$1 = input;
42126
42410
  let fragment = "";
42127
42411
  const fragmentIndex = input.indexOf("#");
42128
42412
  if (fragmentIndex >= 0) {
42129
- path = input.slice(0, fragmentIndex);
42413
+ path$1 = input.slice(0, fragmentIndex);
42130
42414
  fragment = input.slice(fragmentIndex);
42131
- if (!path) return fragment;
42415
+ if (!path$1) return fragment;
42132
42416
  }
42133
- const [s0, ...s] = path.split("?");
42417
+ const [s0, ...s] = path$1.split("?");
42134
42418
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
42135
42419
  }
42136
42420
  function isNonEmptyURL(url) {
@@ -42156,8 +42440,8 @@ const isAbsolute$2 = function(p$1) {
42156
42440
  //#endregion
42157
42441
  //#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
42158
42442
  const BUILTIN_MODULES = new Set(builtinModules);
42159
- function normalizeSlash(path) {
42160
- return path.replace(/\\/g, "/");
42443
+ function normalizeSlash(path$1) {
42444
+ return path$1.replace(/\\/g, "/");
42161
42445
  }
42162
42446
  /**
42163
42447
  * @typedef ErrnoExceptionFields
@@ -42277,8 +42561,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
42277
42561
  * @param {string} [base]
42278
42562
  * @param {string} [message]
42279
42563
  */
42280
- (path, base, message) => {
42281
- return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
42564
+ (path$1, base, message) => {
42565
+ return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
42282
42566
  },
42283
42567
  Error
42284
42568
  );
@@ -42308,8 +42592,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
42308
42592
  * @param {string} base
42309
42593
  * @param {boolean} [exactUrl]
42310
42594
  */
42311
- (path, base, exactUrl = false) => {
42312
- return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
42595
+ (path$1, base, exactUrl = false) => {
42596
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`;
42313
42597
  },
42314
42598
  Error
42315
42599
  );
@@ -42347,8 +42631,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
42347
42631
  * @param {string} extension
42348
42632
  * @param {string} path
42349
42633
  */
42350
- (extension, path) => {
42351
- return `Unknown file extension "${extension}" for ${path}`;
42634
+ (extension, path$1) => {
42635
+ return `Unknown file extension "${extension}" for ${path$1}`;
42352
42636
  },
42353
42637
  TypeError
42354
42638
  );
@@ -42505,7 +42789,7 @@ function read(jsonPath, { base, specifier }) {
42505
42789
  /** @type {string | undefined} */
42506
42790
  let string;
42507
42791
  try {
42508
- string = fs2.readFileSync(path3.toNamespacedPath(jsonPath), "utf8");
42792
+ string = fs2.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
42509
42793
  } catch (error) {
42510
42794
  const exception = error;
42511
42795
  if (exception.code !== "ENOENT") throw exception;
@@ -42711,15 +42995,15 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
42711
42995
  const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
42712
42996
  const basePath = fileURLToPath(base);
42713
42997
  if (!main) process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
42714
- else if (path3.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
42998
+ else if (path.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
42715
42999
  }
42716
43000
  /**
42717
43001
  * @param {string} path
42718
43002
  * @returns {Stats | undefined}
42719
43003
  */
42720
- function tryStatSync(path) {
43004
+ function tryStatSync(path$1) {
42721
43005
  try {
42722
- return statSync(path);
43006
+ return statSync(path$1);
42723
43007
  } catch {}
42724
43008
  }
42725
43009
  /**
@@ -42818,7 +43102,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
42818
43102
  {
42819
43103
  const real = realpathSync(filePath);
42820
43104
  const { search, hash } = resolved;
42821
- resolved = pathToFileURL(real + (filePath.endsWith(path3.sep) ? "/" : ""));
43105
+ resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : ""));
42822
43106
  resolved.search = search;
42823
43107
  resolved.hash = hash;
42824
43108
  }
@@ -43673,16 +43957,17 @@ const nullableNonApplicable = [
43673
43957
  "site",
43674
43958
  "tsconfig"
43675
43959
  ];
43676
- function readWorkerConfig(configPath, env$1) {
43960
+ /**
43961
+ * Apply the Vite-specific sanitization to a normalized Worker config, tracking
43962
+ * any fields that are non-applicable when running under Vite.
43963
+ */
43964
+ function processNormalizedWorkerConfig(normalized) {
43677
43965
  const nonApplicable = {
43678
43966
  replacedByVite: /* @__PURE__ */ new Set(),
43679
43967
  notRelevant: /* @__PURE__ */ new Set(),
43680
43968
  notSupportedOnAuxiliary: /* @__PURE__ */ new Set()
43681
43969
  };
43682
- const config = wrangler.unstable_readConfig({
43683
- config: configPath,
43684
- env: env$1
43685
- }, { preserveOriginalMain: true });
43970
+ const config = normalized;
43686
43971
  const raw = structuredClone(config);
43687
43972
  nullableNonApplicable.forEach((prop) => {
43688
43973
  if (config[prop] !== void 0) {
@@ -43702,6 +43987,24 @@ function readWorkerConfig(configPath, env$1) {
43702
43987
  config
43703
43988
  };
43704
43989
  }
43990
+ function readWorkerConfig(configPath, env$1) {
43991
+ return processNormalizedWorkerConfig(wrangler.unstable_readConfig({
43992
+ config: configPath,
43993
+ env: env$1
43994
+ }, { preserveOriginalMain: true }));
43995
+ }
43996
+ /**
43997
+ * Normalise a `RawConfig` produced in-memory (for example by
43998
+ * `convertToWranglerConfig` from `@cloudflare/config`) using the same
43999
+ * validation pipeline as on-disk Wrangler config files, then apply the
44000
+ * Vite-specific sanitization.
44001
+ */
44002
+ function readWorkerConfigFromRaw(rawConfig) {
44003
+ const { config, diagnostics } = normalizeAndValidateConfig(rawConfig, void 0, void 0, {}, true);
44004
+ if (diagnostics.hasWarnings()) console.warn(diagnostics.renderWarnings());
44005
+ if (diagnostics.hasErrors()) throw new Error(diagnostics.renderErrors());
44006
+ return processNormalizedWorkerConfig(config);
44007
+ }
43705
44008
  function getWarningForWorkersConfigs(configs) {
43706
44009
  if (!("auxiliaryWorkers" in configs) || configs.auxiliaryWorkers.length === 0) {
43707
44010
  const nonApplicableLines = getWorkerNonApplicableWarnLines(configs.entryWorker, ` - `);
@@ -43855,6 +44158,11 @@ const allowedWranglerConfigExtensions = [
43855
44158
 
43856
44159
  //#endregion
43857
44160
  //#region src/plugin-config.ts
44161
+ function normalizeNewConfig(option) {
44162
+ if (option === void 0 || option === false) return;
44163
+ if (option === true) return { types: { generate: true } };
44164
+ return { types: { generate: option.types?.generate ?? true } };
44165
+ }
43858
44166
  function filterEntryWorkerConfig(config) {
43859
44167
  const { topLevelName: _topLevelName, name: _name,...filteredConfig } = config;
43860
44168
  return filteredConfig;
@@ -43872,7 +44180,8 @@ function resolveWorkerConfig(options) {
43872
44180
  let workerConfig;
43873
44181
  let raw;
43874
44182
  let nonApplicable;
43875
- if (options.configPath) ({raw, config: workerConfig, nonApplicable} = readWorkerConfigFromFile(options.configPath, options.env, { visitedConfigPaths: options.visitedConfigPaths }));
44183
+ if (options.rawConfigOverride) ({raw, config: workerConfig, nonApplicable} = readWorkerConfigFromRaw(options.rawConfigOverride));
44184
+ else if (options.configPath) ({raw, config: workerConfig, nonApplicable} = readWorkerConfigFromFile(options.configPath, options.env, { visitedConfigPaths: options.visitedConfigPaths }));
43876
44185
  else {
43877
44186
  workerConfig = { ...wrangler.unstable_defaultWranglerConfig };
43878
44187
  raw = structuredClone(workerConfig);
@@ -43900,7 +44209,8 @@ function resolveWorkerConfig(options) {
43900
44209
  env: options.env
43901
44210
  });
43902
44211
  }
43903
- function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
44212
+ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
44213
+ const resolvedNewConfig = normalizeNewConfig(pluginConfig.experimental?.newConfig);
43904
44214
  const shared = {
43905
44215
  persistState: pluginConfig.persistState ?? true,
43906
44216
  inspectorPort: pluginConfig.inspectorPort,
@@ -43908,26 +44218,46 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
43908
44218
  autoStart: pluginConfig.tunnel?.autoStart ?? false,
43909
44219
  name: pluginConfig.tunnel?.name
43910
44220
  },
43911
- experimental: { headersAndRedirectsDevModeSupport: pluginConfig.experimental?.headersAndRedirectsDevModeSupport }
44221
+ experimental: {
44222
+ headersAndRedirectsDevModeSupport: pluginConfig.experimental?.headersAndRedirectsDevModeSupport,
44223
+ newConfig: resolvedNewConfig
44224
+ }
43912
44225
  };
43913
44226
  const root = userConfig.root ? nodePath.resolve(userConfig.root) : process.cwd();
43914
44227
  const prefixedEnv = vite.loadEnv(viteEnv.mode, root, ["CLOUDFLARE_", "WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_"]);
43915
44228
  Object.assign(process.env, prefixedEnv);
44229
+ const remoteBindings = prefixedEnv.CLOUDFLARE_VITE_FORCE_LOCAL === "true" ? false : pluginConfig.remoteBindings ?? true;
43916
44230
  if (viteEnv.isPreview) return {
43917
44231
  ...shared,
43918
- remoteBindings: pluginConfig.remoteBindings ?? true,
44232
+ remoteBindings,
43919
44233
  type: "preview",
43920
44234
  workers: getWorkerConfigs(root, !!process.env.CLOUDFLARE_VITE_BUILD)
43921
44235
  };
43922
44236
  const configPaths = /* @__PURE__ */ new Set();
43923
44237
  const cloudflareEnv = prefixedEnv.CLOUDFLARE_ENV;
43924
44238
  const validateAndAddEnvironmentName = createEnvironmentNameValidator();
44239
+ let configPath;
44240
+ let rawConfigOverride;
44241
+ if (resolvedNewConfig) {
44242
+ if (pluginConfig.configPath) throw new Error("`configPath` cannot be used together with `experimental.newConfig`. Configure the entry Worker via `cloudflare.config.ts` instead.");
44243
+ if (pluginConfig.auxiliaryWorkers?.length) throw new Error("`auxiliaryWorkers` are not yet supported when `experimental.newConfig` is enabled.");
44244
+ const result = await loadNewConfig({
44245
+ root,
44246
+ mode: viteEnv.mode,
44247
+ generateTypes: resolvedNewConfig.types.generate
44248
+ });
44249
+ configPath = result.configPath;
44250
+ rawConfigOverride = result.rawConfig;
44251
+ configPaths.add(result.configPath);
44252
+ for (const dep of result.dependencies) configPaths.add(dep);
44253
+ } else configPath = getValidatedWranglerConfigPath(root, pluginConfig.configPath ?? prefixedEnv.CLOUDFLARE_VITE_WRANGLER_CONFIG_PATH);
43925
44254
  const entryWorkerResolvedConfig = resolveWorkerConfig({
43926
44255
  root,
43927
- configPath: getValidatedWranglerConfigPath(root, pluginConfig.configPath ?? prefixedEnv.CLOUDFLARE_VITE_WRANGLER_CONFIG_PATH),
44256
+ configPath: resolvedNewConfig ? void 0 : configPath,
43928
44257
  env: cloudflareEnv,
43929
44258
  configCustomizer: pluginConfig.config,
43930
- visitedConfigPaths: configPaths
44259
+ visitedConfigPaths: configPaths,
44260
+ rawConfigOverride
43931
44261
  });
43932
44262
  const environmentNameToWorkerMap = /* @__PURE__ */ new Map();
43933
44263
  const environmentNameToChildEnvironmentNamesMap = /* @__PURE__ */ new Map();
@@ -43960,7 +44290,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
43960
44290
  environmentNameToChildEnvironmentNamesMap,
43961
44291
  prerenderWorkerEnvironmentName,
43962
44292
  configPaths,
43963
- remoteBindings: pluginConfig.remoteBindings ?? true,
44293
+ remoteBindings,
43964
44294
  rawConfigs: { entryWorker: entryWorkerResolvedConfig }
43965
44295
  };
43966
44296
  let staticRouting;
@@ -44004,7 +44334,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
44004
44334
  prerenderWorkerEnvironmentName,
44005
44335
  entryWorkerEnvironmentName,
44006
44336
  staticRouting,
44007
- remoteBindings: pluginConfig.remoteBindings ?? true,
44337
+ remoteBindings,
44008
44338
  rawConfigs: {
44009
44339
  entryWorker: entryWorkerResolvedConfig,
44010
44340
  auxiliaryWorkers: auxiliaryWorkersResolvedConfigs
@@ -44037,6 +44367,59 @@ function resolveWorker(workerConfig, devOnly) {
44037
44367
  devOnly
44038
44368
  };
44039
44369
  }
44370
+ const NEW_CONFIG_FILENAME = "cloudflare.config.ts";
44371
+ const TYPES_OUTPUT_FILENAME = "worker-configuration.d.ts";
44372
+ const EXPERIMENTAL_CONFIG_PKG = "@cloudflare/vite-plugin/experimental-config";
44373
+ /**
44374
+ * Load and convert a `cloudflare.config.ts` file via `@cloudflare/config`. Returns
44375
+ * the resulting Wrangler `RawConfig`, the absolute path of the loaded file,
44376
+ * and the set of files imported while resolving the config (for watch-mode).
44377
+ *
44378
+ * If `generateTypes` is true, also writes `worker-configuration.d.ts` next to
44379
+ * the config when the generated content differs from what's already on disk.
44380
+ */
44381
+ async function loadNewConfig(options) {
44382
+ const configPath = nodePath.resolve(options.root, NEW_CONFIG_FILENAME);
44383
+ if (!fs$1.existsSync(configPath)) throw new Error(`\`experimental.newConfig\` is enabled but no \`${NEW_CONFIG_FILENAME}\` was found at ${configPath}.`);
44384
+ const { loadConfig, ConfigSchema, convertToWranglerConfig, generateTypes: generateTypesFn, resolveWorkerDefinition } = await import("./dist-MawCthRW.mjs");
44385
+ const { config: rawExport, dependencies } = await loadConfig(configPath);
44386
+ const resolved = await resolveWorkerDefinition(rawExport, { mode: options.mode });
44387
+ const parsed = ConfigSchema.safeParse(resolved);
44388
+ if (!parsed.success) throw new Error(`Invalid \`${NEW_CONFIG_FILENAME}\`:\n${parsed.error.message}`);
44389
+ const rawConfig = convertToWranglerConfig(parsed.data);
44390
+ if (options.generateTypes) writeWorkerConfigurationDts({
44391
+ root: options.root,
44392
+ configPath,
44393
+ generateTypes: generateTypesFn
44394
+ });
44395
+ return {
44396
+ rawConfig,
44397
+ configPath,
44398
+ dependencies
44399
+ };
44400
+ }
44401
+ /**
44402
+ * Write `worker-configuration.d.ts` to the project root using
44403
+ * `@cloudflare/config`'s `generateTypes`, targeting the vite-plugin's
44404
+ * `experimental-config` subpath (so users don't need a direct dependency on
44405
+ * `@cloudflare/config`).
44406
+ *
44407
+ * Reads the existing file first and only writes if the content differs, to
44408
+ * avoid touching mtimes unnecessarily.
44409
+ */
44410
+ function writeWorkerConfigurationDts(options) {
44411
+ const outputPath = nodePath.resolve(options.root, TYPES_OUTPUT_FILENAME);
44412
+ const relativeConfigPath = "./" + nodePath.relative(options.root, options.configPath);
44413
+ const content = options.generateTypes({
44414
+ configPath: relativeConfigPath,
44415
+ packageName: EXPERIMENTAL_CONFIG_PKG
44416
+ });
44417
+ let existing;
44418
+ try {
44419
+ existing = fs$1.readFileSync(outputPath, "utf8");
44420
+ } catch {}
44421
+ if (existing !== content) fs$1.writeFileSync(outputPath, content);
44422
+ }
44040
44423
 
44041
44424
  //#endregion
44042
44425
  //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
@@ -45207,9 +45590,9 @@ function constructHeaders({ headers, headersFile, logger }) {
45207
45590
 
45208
45591
  //#endregion
45209
45592
  //#region ../workers-shared/utils/configuration/validateURL.ts
45210
- const extractPathname = (path = "/", includeSearch, includeHash) => {
45211
- if (!path.startsWith("/")) path = `/${path}`;
45212
- const url = new URL(`//${path}`, "relative://");
45593
+ const extractPathname = (path$1 = "/", includeSearch, includeHash) => {
45594
+ if (!path$1.startsWith("/")) path$1 = `/${path$1}`;
45595
+ const url = new URL(`//${path$1}`, "relative://");
45213
45596
  return `${url.pathname}${includeSearch ? url.search : ""}${includeHash ? url.hash : ""}`;
45214
45597
  };
45215
45598
  const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
@@ -45268,7 +45651,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
45268
45651
  lineNumber: i$1 + 1,
45269
45652
  message: "No headers specified"
45270
45653
  });
45271
- const [path, pathError] = validateUrl(line, false, true);
45654
+ const [path$1, pathError] = validateUrl(line, false, true);
45272
45655
  if (pathError) {
45273
45656
  invalid.push({
45274
45657
  line,
@@ -45279,7 +45662,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
45279
45662
  skipUntilNextPath = true;
45280
45663
  continue;
45281
45664
  }
45282
- const wildcardError = validateNoMultipleWildcards(path);
45665
+ const wildcardError = validateNoMultipleWildcards(path$1);
45283
45666
  if (wildcardError) {
45284
45667
  invalid.push({
45285
45668
  line,
@@ -45291,7 +45674,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
45291
45674
  continue;
45292
45675
  }
45293
45676
  rule = {
45294
- path,
45677
+ path: path$1,
45295
45678
  line,
45296
45679
  headers: {},
45297
45680
  unsetHeaders: []
@@ -45374,11 +45757,11 @@ function isValidRule(rule) {
45374
45757
  * `:splat` placeholder, would result in duplicate `:splat` parameters which is
45375
45758
  * unsupported.
45376
45759
  */
45377
- function validateNoMultipleWildcards(path) {
45378
- const wildcardCount = (path.match(SPLAT_REGEX) ?? []).length;
45379
- const hasSplatPlaceholder = /:splat(?!\w)/.test(path);
45380
- if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path}.`;
45381
- if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path}.`;
45760
+ function validateNoMultipleWildcards(path$1) {
45761
+ const wildcardCount = (path$1.match(SPLAT_REGEX) ?? []).length;
45762
+ const hasSplatPlaceholder = /:splat(?!\w)/.test(path$1);
45763
+ if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$1}.`;
45764
+ if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$1}.`;
45382
45765
  }
45383
45766
 
45384
45767
  //#endregion
@@ -45595,13 +45978,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
45595
45978
  const throwError = (message, Ctor) => {
45596
45979
  throw new Ctor(message);
45597
45980
  };
45598
- const checkPath = (path, originalPath, doThrow) => {
45599
- if (!isString$1(path)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
45600
- if (!path) return doThrow(`path must not be empty`, TypeError);
45601
- if (checkPath.isNotRelative(path)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
45981
+ const checkPath = (path$1, originalPath, doThrow) => {
45982
+ if (!isString$1(path$1)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
45983
+ if (!path$1) return doThrow(`path must not be empty`, TypeError);
45984
+ if (checkPath.isNotRelative(path$1)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
45602
45985
  return true;
45603
45986
  };
45604
- const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
45987
+ const isNotRelative = (path$1) => REGEX_TEST_INVALID_PATH.test(path$1);
45605
45988
  checkPath.isNotRelative = isNotRelative;
45606
45989
  checkPath.convert = (p$1) => p$1;
45607
45990
  var Ignore = class {
@@ -45637,13 +46020,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
45637
46020
  addPattern(pattern) {
45638
46021
  return this.add(pattern);
45639
46022
  }
45640
- _testOne(path, checkUnignored) {
46023
+ _testOne(path$1, checkUnignored) {
45641
46024
  let ignored = false;
45642
46025
  let unignored = false;
45643
46026
  this._rules.forEach((rule) => {
45644
46027
  const { negative } = rule;
45645
46028
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
45646
- if (rule.regex.test(path)) {
46029
+ if (rule.regex.test(path$1)) {
45647
46030
  ignored = !negative;
45648
46031
  unignored = negative;
45649
46032
  }
@@ -45654,33 +46037,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
45654
46037
  };
45655
46038
  }
45656
46039
  _test(originalPath, cache$2, checkUnignored, slices) {
45657
- const path = originalPath && checkPath.convert(originalPath);
45658
- checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
45659
- return this._t(path, cache$2, checkUnignored, slices);
46040
+ const path$1 = originalPath && checkPath.convert(originalPath);
46041
+ checkPath(path$1, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
46042
+ return this._t(path$1, cache$2, checkUnignored, slices);
45660
46043
  }
45661
- _t(path, cache$2, checkUnignored, slices) {
45662
- if (path in cache$2) return cache$2[path];
45663
- if (!slices) slices = path.split(SLASH);
46044
+ _t(path$1, cache$2, checkUnignored, slices) {
46045
+ if (path$1 in cache$2) return cache$2[path$1];
46046
+ if (!slices) slices = path$1.split(SLASH);
45664
46047
  slices.pop();
45665
- if (!slices.length) return cache$2[path] = this._testOne(path, checkUnignored);
46048
+ if (!slices.length) return cache$2[path$1] = this._testOne(path$1, checkUnignored);
45666
46049
  const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
45667
- return cache$2[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
46050
+ return cache$2[path$1] = parent.ignored ? parent : this._testOne(path$1, checkUnignored);
45668
46051
  }
45669
- ignores(path) {
45670
- return this._test(path, this._ignoreCache, false).ignored;
46052
+ ignores(path$1) {
46053
+ return this._test(path$1, this._ignoreCache, false).ignored;
45671
46054
  }
45672
46055
  createFilter() {
45673
- return (path) => !this.ignores(path);
46056
+ return (path$1) => !this.ignores(path$1);
45674
46057
  }
45675
46058
  filter(paths) {
45676
46059
  return makeArray(paths).filter(this.createFilter());
45677
46060
  }
45678
- test(path) {
45679
- return this._test(path, this._testCache, true);
46061
+ test(path$1) {
46062
+ return this._test(path$1, this._testCache, true);
45680
46063
  }
45681
46064
  };
45682
46065
  const factory = (options) => new Ignore(options);
45683
- const isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
46066
+ const isPathValid = (path$1) => checkPath(path$1 && checkPath.convert(path$1), path$1, RETURN_FALSE);
45684
46067
  factory.isPathValid = isPathValid;
45685
46068
  factory.default = factory;
45686
46069
  module.exports = factory;
@@ -45689,7 +46072,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
45689
46072
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
45690
46073
  checkPath.convert = makePosix;
45691
46074
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
45692
- checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
46075
+ checkPath.isNotRelative = (path$1) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$1) || isNotRelative(path$1);
45693
46076
  }
45694
46077
  }) });
45695
46078
 
@@ -47044,11 +47427,11 @@ var Mime = class {
47044
47427
  }
47045
47428
  return this;
47046
47429
  }
47047
- getType(path) {
47048
- if (typeof path !== "string") return null;
47049
- const last = path.replace(/^.*[/\\]/s, "").toLowerCase();
47430
+ getType(path$1) {
47431
+ if (typeof path$1 !== "string") return null;
47432
+ const last = path$1.replace(/^.*[/\\]/s, "").toLowerCase();
47050
47433
  const ext = last.replace(/^.*\./s, "").toLowerCase();
47051
- const hasPath = last.length < path.length;
47434
+ const hasPath = last.length < path$1.length;
47052
47435
  if (!(ext.length < last.length - 1) && hasPath) return null;
47053
47436
  return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
47054
47437
  }
@@ -47382,8 +47765,8 @@ function getErrorMap() {
47382
47765
  //#endregion
47383
47766
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
47384
47767
  const makeIssue = (params) => {
47385
- const { data: data$1, path, errorMaps, issueData } = params;
47386
- const fullPath = [...path, ...issueData.path || []];
47768
+ const { data: data$1, path: path$1, errorMaps, issueData } = params;
47769
+ const fullPath = [...path$1, ...issueData.path || []];
47387
47770
  const fullIssue = {
47388
47771
  ...issueData,
47389
47772
  path: fullPath
@@ -47495,11 +47878,11 @@ var errorUtil;
47495
47878
  //#endregion
47496
47879
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
47497
47880
  var ParseInputLazyPath = class {
47498
- constructor(parent, value, path, key) {
47881
+ constructor(parent, value, path$1, key) {
47499
47882
  this._cachedPath = [];
47500
47883
  this.parent = parent;
47501
47884
  this.data = value;
47502
- this._path = path;
47885
+ this._path = path$1;
47503
47886
  this._key = key;
47504
47887
  }
47505
47888
  get path() {
@@ -51550,11 +51933,11 @@ const getQueryString = (params) => {
51550
51933
  };
51551
51934
  const getUrl = (config, options) => {
51552
51935
  const encoder$1 = config.ENCODE_PATH || encodeURI;
51553
- const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
51936
+ const path$1 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
51554
51937
  if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
51555
51938
  return substring;
51556
51939
  });
51557
- const url = `${config.BASE}${path}`;
51940
+ const url = `${config.BASE}${path$1}`;
51558
51941
  if (options.query) return `${url}${getQueryString(options.query)}`;
51559
51942
  return url;
51560
51943
  };
@@ -51717,9 +52100,9 @@ const request = (config, options) => {
51717
52100
  };
51718
52101
  const debugLogRequest = async (config, url, headers, body) => {
51719
52102
  config.LOGGER?.debug(`-- START CF API REQUEST: ${url}`);
51720
- const logHeaders = new Headers(headers);
51721
- logHeaders.delete("Authorization");
51722
- config.LOGGER?.debugWithSanitization("HEADERS:", JSON.stringify(logHeaders, null, 2));
52103
+ const logHeaders$1 = new Headers(headers);
52104
+ logHeaders$1.delete("Authorization");
52105
+ config.LOGGER?.debugWithSanitization("HEADERS:", JSON.stringify(logHeaders$1, null, 2));
51723
52106
  config.LOGGER?.debugWithSanitization("BODY:", JSON.stringify(body instanceof FormData ? await new Response(body).text() : body, null, 2));
51724
52107
  config.LOGGER?.debug("-- END CF API REQUEST");
51725
52108
  };
@@ -52605,7 +52988,7 @@ function getContainerOptions(options) {
52605
52988
  return containersConfig.map((container) => {
52606
52989
  if (isDockerfile(container.image, configPath)) return {
52607
52990
  dockerfile: container.image,
52608
- image_build_context: container.image_build_context ?? path3.dirname(container.image),
52991
+ image_build_context: container.image_build_context ?? path.dirname(container.image),
52609
52992
  image_vars: container.image_vars,
52610
52993
  class_name: container.class_name,
52611
52994
  image_tag: getDevContainerImageName(container.class_name, containerBuildId)
@@ -52621,26 +53004,26 @@ function getContainerOptions(options) {
52621
53004
  //#endregion
52622
53005
  //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs
52623
53006
  var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
52624
- function cleanPath(path) {
52625
- let normalized = normalize(path);
53007
+ function cleanPath(path$1) {
53008
+ let normalized = normalize(path$1);
52626
53009
  if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
52627
53010
  return normalized;
52628
53011
  }
52629
53012
  const SLASHES_REGEX = /[\\/]/g;
52630
- function convertSlashes(path, separator) {
52631
- return path.replace(SLASHES_REGEX, separator);
53013
+ function convertSlashes(path$1, separator) {
53014
+ return path$1.replace(SLASHES_REGEX, separator);
52632
53015
  }
52633
53016
  const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
52634
- function isRootDirectory(path) {
52635
- return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
53017
+ function isRootDirectory(path$1) {
53018
+ return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
52636
53019
  }
52637
- function normalizePath$1(path, options) {
53020
+ function normalizePath$1(path$1, options) {
52638
53021
  const { resolvePaths, normalizePath: normalizePath$1$1, pathSeparator } = options;
52639
- const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith(".");
52640
- if (resolvePaths) path = resolve$1(path);
52641
- if (normalizePath$1$1 || pathNeedsCleaning) path = cleanPath(path);
52642
- if (path === ".") return "";
52643
- return convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
53022
+ const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
53023
+ if (resolvePaths) path$1 = resolve$1(path$1);
53024
+ if (normalizePath$1$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
53025
+ if (path$1 === ".") return "";
53026
+ return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
52644
53027
  }
52645
53028
  function joinPathWithBasePath(filename, directoryPath) {
52646
53029
  return directoryPath + filename;
@@ -52676,8 +53059,8 @@ const pushDirectory = (directoryPath, paths) => {
52676
53059
  paths.push(directoryPath || ".");
52677
53060
  };
52678
53061
  const pushDirectoryFilter = (directoryPath, paths, filters) => {
52679
- const path = directoryPath || ".";
52680
- if (filters.every((filter) => filter(path, true))) paths.push(path);
53062
+ const path$1 = directoryPath || ".";
53063
+ if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
52681
53064
  };
52682
53065
  const empty$2 = () => {};
52683
53066
  function build$6(root, options) {
@@ -52726,26 +53109,26 @@ const empty = () => {};
52726
53109
  function build$3(options) {
52727
53110
  return options.group ? groupFiles : empty;
52728
53111
  }
52729
- const resolveSymlinksAsync = function(path, state, callback$1) {
53112
+ const resolveSymlinksAsync = function(path$1, state, callback$1) {
52730
53113
  const { queue, fs: fs$2, options: { suppressErrors } } = state;
52731
53114
  queue.enqueue();
52732
- fs$2.realpath(path, (error, resolvedPath) => {
53115
+ fs$2.realpath(path$1, (error, resolvedPath) => {
52733
53116
  if (error) return queue.dequeue(suppressErrors ? null : error, state);
52734
53117
  fs$2.stat(resolvedPath, (error$1, stat$1) => {
52735
53118
  if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
52736
- if (stat$1.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
53119
+ if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
52737
53120
  callback$1(stat$1, resolvedPath);
52738
53121
  queue.dequeue(null, state);
52739
53122
  });
52740
53123
  });
52741
53124
  };
52742
- const resolveSymlinks = function(path, state, callback$1) {
53125
+ const resolveSymlinks = function(path$1, state, callback$1) {
52743
53126
  const { queue, fs: fs$2, options: { suppressErrors } } = state;
52744
53127
  queue.enqueue();
52745
53128
  try {
52746
- const resolvedPath = fs$2.realpathSync(path);
53129
+ const resolvedPath = fs$2.realpathSync(path$1);
52747
53130
  const stat$1 = fs$2.statSync(resolvedPath);
52748
- if (stat$1.isDirectory() && isRecursive(path, resolvedPath, state)) return;
53131
+ if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
52749
53132
  callback$1(stat$1, resolvedPath);
52750
53133
  } catch (e) {
52751
53134
  if (!suppressErrors) throw e;
@@ -52755,16 +53138,16 @@ function build$2(options, isSynchronous) {
52755
53138
  if (!options.resolveSymlinks || options.excludeSymlinks) return null;
52756
53139
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
52757
53140
  }
52758
- function isRecursive(path, resolved, state) {
53141
+ function isRecursive(path$1, resolved, state) {
52759
53142
  if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
52760
- let parent = dirname$1(path);
53143
+ let parent = dirname$1(path$1);
52761
53144
  let depth$1 = 1;
52762
53145
  while (parent !== state.root && depth$1 < 2) {
52763
53146
  const resolvedPath = state.symlinks.get(parent);
52764
53147
  if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
52765
53148
  else parent = dirname$1(parent);
52766
53149
  }
52767
- state.symlinks.set(path, resolved);
53150
+ state.symlinks.set(path$1, resolved);
52768
53151
  return depth$1 > 1;
52769
53152
  }
52770
53153
  function isRecursiveUsingRealPaths(resolved, state) {
@@ -52945,19 +53328,19 @@ var Walker = class {
52945
53328
  const filename = this.joinPath(entry.name, directoryPath);
52946
53329
  this.pushFile(filename, files, this.state.counts, filters);
52947
53330
  } else if (entry.isDirectory()) {
52948
- let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
52949
- if (exclude && exclude(entry.name, path)) continue;
52950
- this.pushDirectory(path, paths, filters);
52951
- this.walkDirectory(this.state, path, path, depth$1 - 1, this.walk);
53331
+ let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
53332
+ if (exclude && exclude(entry.name, path$1)) continue;
53333
+ this.pushDirectory(path$1, paths, filters);
53334
+ this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
52952
53335
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
52953
- let path = joinPathWithBasePath(entry.name, directoryPath);
52954
- this.resolveSymlink(path, this.state, (stat$1, resolvedPath) => {
53336
+ let path$1 = joinPathWithBasePath(entry.name, directoryPath);
53337
+ this.resolveSymlink(path$1, this.state, (stat$1, resolvedPath) => {
52955
53338
  if (stat$1.isDirectory()) {
52956
53339
  resolvedPath = normalizePath$1(resolvedPath, this.state.options);
52957
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
52958
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth$1 - 1, this.walk);
53340
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
53341
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
52959
53342
  } else {
52960
- resolvedPath = useRealPaths ? resolvedPath : path;
53343
+ resolvedPath = useRealPaths ? resolvedPath : path$1;
52961
53344
  const filename = basename(resolvedPath);
52962
53345
  const directoryPath$1 = normalizePath$1(dirname$1(resolvedPath), this.state.options);
52963
53346
  resolvedPath = this.joinPath(filename, directoryPath$1);
@@ -53122,7 +53505,7 @@ var Builder = class {
53122
53505
  isMatch = globFn(patterns, ...options);
53123
53506
  this.globCache[patterns.join("\0")] = isMatch;
53124
53507
  }
53125
- this.options.filters.push((path) => isMatch(path));
53508
+ this.options.filters.push((path$1) => isMatch(path$1));
53126
53509
  return this;
53127
53510
  }
53128
53511
  };
@@ -53336,8 +53719,8 @@ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
53336
53719
  if (state.negated === true) output = `(?:^(?!${output}).*$)`;
53337
53720
  return output;
53338
53721
  };
53339
- exports.basename = (path, { windows } = {}) => {
53340
- const segs = path.split(windows ? /[\\/]/ : "/");
53722
+ exports.basename = (path$1, { windows } = {}) => {
53723
+ const segs = path$1.split(windows ? /[\\/]/ : "/");
53341
53724
  const last = segs[segs.length - 1];
53342
53725
  if (last === "") return segs[segs.length - 2];
53343
53726
  return last;
@@ -55077,15 +55460,15 @@ function buildRelative(cwd, root) {
55077
55460
  };
55078
55461
  }
55079
55462
  const splitPatternOptions = { parts: true };
55080
- function splitPattern(path) {
55463
+ function splitPattern(path$1) {
55081
55464
  var _result$parts;
55082
- const result = import_picomatch.default.scan(path, splitPatternOptions);
55083
- return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path];
55465
+ const result = import_picomatch.default.scan(path$1, splitPatternOptions);
55466
+ return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
55084
55467
  }
55085
55468
  const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
55086
55469
  const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
55087
- const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
55088
- const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
55470
+ const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
55471
+ const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
55089
55472
  /**
55090
55473
  * Escapes a path's special characters depending on the platform.
55091
55474
  * @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
@@ -55209,13 +55592,13 @@ function buildCrawler(options, patterns) {
55209
55592
  if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
55210
55593
  const crawler = new Builder({
55211
55594
  filters: [debug$7 ? (p$1, isDirectory$1) => {
55212
- const path = format$2(p$1, isDirectory$1);
55213
- const matches = matcher(path) && !ignore$1(path);
55214
- if (matches) log(`matched ${path}`);
55595
+ const path$1 = format$2(p$1, isDirectory$1);
55596
+ const matches = matcher(path$1) && !ignore$1(path$1);
55597
+ if (matches) log(`matched ${path$1}`);
55215
55598
  return matches;
55216
55599
  } : (p$1, isDirectory$1) => {
55217
- const path = format$2(p$1, isDirectory$1);
55218
- return matcher(path) && !ignore$1(path);
55600
+ const path$1 = format$2(p$1, isDirectory$1);
55601
+ return matcher(path$1) && !ignore$1(path$1);
55219
55602
  }],
55220
55603
  exclude: debug$7 ? (_, p$1) => {
55221
55604
  const skipped = excludePredicate(_, p$1);
@@ -55690,6 +56073,12 @@ function getStructuredLogsLogger(logger) {
55690
56073
  */
55691
56074
  function handleWebSocket(httpServer, miniflare, entryWorkerName) {
55692
56075
  const nodeWebSocket = new WebSocketServer({ noServer: true });
56076
+ const workerResponseHeaders = /* @__PURE__ */ new WeakMap();
56077
+ nodeWebSocket.on("headers", (responseHeaders, request$2) => {
56078
+ const extra = workerResponseHeaders.get(request$2);
56079
+ workerResponseHeaders.delete(request$2);
56080
+ if (extra) appendWorkerResponseHeaders(responseHeaders, extra);
56081
+ });
55693
56082
  httpServer.on("upgrade", async (request$2, socket, head) => {
55694
56083
  socket.on("error", () => socket.destroy());
55695
56084
  const rawHost = request$2.headers.host ?? UNKNOWN_HOST;
@@ -55701,14 +56090,16 @@ function handleWebSocket(httpServer, miniflare, entryWorkerName) {
55701
56090
  if (isViteRequest && !isSandboxRequest) return;
55702
56091
  const headers = createHeaders(request$2);
55703
56092
  if (entryWorkerName) headers.set(CoreHeaders.ROUTE_OVERRIDE, entryWorkerName);
55704
- const workerWebSocket = (await miniflare.dispatchFetch(url, {
56093
+ const response = await miniflare.dispatchFetch(url, {
55705
56094
  headers,
55706
56095
  method: request$2.method
55707
- })).webSocket;
56096
+ });
56097
+ const workerWebSocket = response.webSocket;
55708
56098
  if (!workerWebSocket) {
55709
56099
  socket.destroy();
55710
56100
  return;
55711
56101
  }
56102
+ workerResponseHeaders.set(request$2, response.headers);
55712
56103
  nodeWebSocket.handleUpgrade(request$2, socket, head, async (clientWebSocket) => {
55713
56104
  coupleWebSocket(clientWebSocket, workerWebSocket);
55714
56105
  nodeWebSocket.emit("connection", clientWebSocket, request$2);
@@ -55716,6 +56107,29 @@ function handleWebSocket(httpServer, miniflare, entryWorkerName) {
55716
56107
  });
55717
56108
  }
55718
56109
  /**
56110
+ * Headers that must not be forwarded on the 101 upgrade response — they are
56111
+ * either part of the WebSocket handshake managed by `ws` or irrelevant on a
56112
+ * response with no body.
56113
+ */
56114
+ const EXCLUDED_RESPONSE_HEADERS = new Set([
56115
+ "connection",
56116
+ "content-length",
56117
+ "sec-websocket-accept",
56118
+ "sec-websocket-extensions",
56119
+ "sec-websocket-protocol",
56120
+ "transfer-encoding",
56121
+ "upgrade"
56122
+ ]);
56123
+ function appendWorkerResponseHeaders(responseHeaders, workerHeaders) {
56124
+ if (typeof workerHeaders.getSetCookie === "function") for (const cookie of workerHeaders.getSetCookie()) responseHeaders.push(`Set-Cookie: ${cookie}`);
56125
+ workerHeaders.forEach((value, name) => {
56126
+ const lower = name.toLowerCase();
56127
+ if (lower === "set-cookie") return;
56128
+ if (EXCLUDED_RESPONSE_HEADERS.has(lower)) return;
56129
+ responseHeaders.push(`${name}: ${value}`);
56130
+ });
56131
+ }
56132
+ /**
55719
56133
  * Matches the origin of a Sandbox SDK preview URL.
55720
56134
  * See: https://developers.cloudflare.com/sandbox/concepts/preview-urls/
55721
56135
  *
@@ -56258,13 +56672,13 @@ const wslDefaultBrowser = async () => {
56258
56672
  const { stdout } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
56259
56673
  return stdout.trim();
56260
56674
  };
56261
- const convertWslPathToWindows = async (path) => {
56262
- if (/^[a-z]+:\/\//i.test(path)) return path;
56675
+ const convertWslPathToWindows = async (path$1) => {
56676
+ if (/^[a-z]+:\/\//i.test(path$1)) return path$1;
56263
56677
  try {
56264
- const { stdout } = await execFile$1("wslpath", ["-aw", path], { encoding: "utf8" });
56678
+ const { stdout } = await execFile$1("wslpath", ["-aw", path$1], { encoding: "utf8" });
56265
56679
  return stdout.trim();
56266
56680
  } catch {
56267
- return path;
56681
+ return path$1;
56268
56682
  }
56269
56683
  };
56270
56684
 
@@ -56450,8 +56864,8 @@ var is_in_ssh_default = isInSsh;
56450
56864
  //#endregion
56451
56865
  //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
56452
56866
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
56453
- const __dirname = import.meta.url ? path3.dirname(fileURLToPath(import.meta.url)) : "";
56454
- const localXdgOpenPath = path3.join(__dirname, "xdg-open");
56867
+ const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
56868
+ const localXdgOpenPath = path.join(__dirname, "xdg-open");
56455
56869
  const { platform, arch: arch$1 } = process$1;
56456
56870
  const tryEachApp = async (apps$1, opener) => {
56457
56871
  if (apps$1.length === 0) return;
@@ -56839,8 +57253,8 @@ function cloudflare(pluginConfig = {}) {
56839
57253
  {
56840
57254
  name: "vite-plugin-cloudflare",
56841
57255
  sharedDuringBuild: true,
56842
- config(userConfig, env$1) {
56843
- ctx.setResolvedPluginConfig(resolvePluginConfig(pluginConfig, userConfig, env$1));
57256
+ async config(userConfig, env$1) {
57257
+ ctx.setResolvedPluginConfig(await resolvePluginConfig(pluginConfig, userConfig, env$1));
56844
57258
  if (env$1.command === "build") process.env.CLOUDFLARE_VITE_BUILD = "true";
56845
57259
  },
56846
57260
  async configureServer(viteDevServer) {