@cloudflare/vite-plugin 1.38.0 → 1.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,28 +3,29 @@ 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 path, { dirname, isAbsolute, join, relative, resolve } from "node:path";
6
+ import path3, { 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";
10
10
  import { normalizePath, version } from "vite";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
- import * as fs$2 from "node:fs";
13
- import fs, { accessSync, chmodSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
12
+ import * as fs$1 from "node:fs";
13
+ import fs2, { accessSync, chmodSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
14
14
  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
18
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
19
19
  import * as fsp from "node:fs/promises";
20
- import fs$1, { constants as constants$1 } from "node:fs/promises";
20
+ import fs, { constants as constants$1 } from "node:fs/promises";
21
+ import * as timersPromises from "node:timers/promises";
21
22
  import { getCloudflarePreset, nonPrefixedNodeModules } from "@cloudflare/unenv-preset";
22
23
  import process$1 from "node:process";
23
24
  import v8 from "node:v8";
24
25
  import { defineEnv } from "unenv";
25
- import * as nativeFs$1 from "fs";
26
- import nativeFs from "fs";
27
- import path$1, { basename, dirname as dirname$1, normalize, posix, relative as relative$1, resolve as resolve$1, sep } from "path";
26
+ import * as nativeFs from "fs";
27
+ import { readdir, readdirSync, realpath, realpathSync as realpathSync$1, stat, statSync as statSync$1 } from "fs";
28
+ import { basename, dirname as dirname$1, isAbsolute as isAbsolute$1, normalize, posix, relative as relative$1, resolve as resolve$1, sep } from "path";
28
29
  import { fileURLToPath as fileURLToPath$1 } from "url";
29
30
  import { createRequire as createRequire$1 } from "module";
30
31
  import { WebSocketServer } from "ws";
@@ -1503,7 +1504,7 @@ async function assertWranglerVersion() {
1503
1504
  * The default compatibility date to use when the user omits one.
1504
1505
  * This value is injected at build time and remains fixed for each release.
1505
1506
  */
1506
- const DEFAULT_COMPAT_DATE = "2026-05-22";
1507
+ const DEFAULT_COMPAT_DATE = "2026-06-01";
1507
1508
 
1508
1509
  //#endregion
1509
1510
  //#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@0.8.0/node_modules/@remix-run/node-fetch-server/dist/node-fetch-server.js
@@ -3958,7 +3959,7 @@ function resolveWranglerConfigPath({ config, script }, options) {
3958
3959
  deployConfigPath: void 0,
3959
3960
  redirected: false
3960
3961
  };
3961
- return findWranglerConfig$1(script !== void 0 ? path.dirname(script) : process.cwd(), options);
3962
+ return findWranglerConfig$1(script !== void 0 ? path3.dirname(script) : process.cwd(), options);
3962
3963
  }
3963
3964
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
3964
3965
  function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -3989,15 +3990,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
3989
3990
  const deployConfigFile = readFileSync$1(deployConfigPath);
3990
3991
  try {
3991
3992
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
3992
- redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
3993
+ redirectedConfigPath = deployConfig.configPath && path3.resolve(path3.dirname(deployConfigPath), deployConfig.configPath);
3993
3994
  } catch (e) {
3994
- throw new UserError(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
3995
+ throw new UserError(`Failed to parse the deploy configuration file at ${path3.relative(".", deployConfigPath)}`, {
3995
3996
  cause: e,
3996
3997
  telemetryMessage: false
3997
3998
  });
3998
3999
  }
3999
4000
  if (!redirectedConfigPath) throw new UserError(esm_default`
4000
- A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
4001
+ A deploy configuration file was found at "${path3.relative(".", deployConfigPath)}".
4001
4002
  But this is not valid - the required "configPath" property was not found.
4002
4003
  Instead this file contains:
4003
4004
  \`\`\`
@@ -4005,13 +4006,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
4005
4006
  \`\`\`
4006
4007
  `, { telemetryMessage: false });
4007
4008
  if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default`
4008
- There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
4009
- But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
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.
4010
4011
  `, { telemetryMessage: false });
4011
4012
  if (userConfigPath) {
4012
- if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
4013
- Found both a user configuration file at "${path.relative(".", userConfigPath)}"
4014
- and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
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)}".
4015
4016
  But these do not share the same base path so it is not clear which should be used.
4016
4017
  `, { telemetryMessage: false });
4017
4018
  }
@@ -4055,11 +4056,11 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
4055
4056
  }
4056
4057
  __name(formatConfigSnippet, "formatConfigSnippet");
4057
4058
  function isDirectory(path2) {
4058
- return fs.statSync(path2, { throwIfNoEntry: false })?.isDirectory() ?? false;
4059
+ return fs2.statSync(path2, { throwIfNoEntry: false })?.isDirectory() ?? false;
4059
4060
  }
4060
4061
  __name(isDirectory, "isDirectory");
4061
4062
  function removeDir(dirPath, { fireAndForget = false } = {}) {
4062
- const result = fs.promises.rm(dirPath, {
4063
+ const result = fs2.promises.rm(dirPath, {
4063
4064
  recursive: true,
4064
4065
  force: true,
4065
4066
  maxRetries: 5,
@@ -4070,7 +4071,7 @@ function removeDir(dirPath, { fireAndForget = false } = {}) {
4070
4071
  }
4071
4072
  __name(removeDir, "removeDir");
4072
4073
  function removeDirSync(dirPath) {
4073
- fs.rmSync(dirPath, {
4074
+ fs2.rmSync(dirPath, {
4074
4075
  recursive: true,
4075
4076
  force: true,
4076
4077
  maxRetries: 5,
@@ -5227,10 +5228,10 @@ var require_util$5 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
5227
5228
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
5228
5229
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
5229
5230
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
5230
- let path$2 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
5231
+ let path = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
5231
5232
  if (origin[origin.length - 1] === "/") origin = origin.slice(0, origin.length - 1);
5232
- if (path$2 && path$2[0] !== "/") path$2 = `/${path$2}`;
5233
- return new URL(`${origin}${path$2}`);
5233
+ if (path && path[0] !== "/") path = `/${path}`;
5234
+ return new URL(`${origin}${path}`);
5234
5235
  }
5235
5236
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
5236
5237
  return url;
@@ -6105,8 +6106,8 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
6105
6106
  debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$2, error.message);
6106
6107
  });
6107
6108
  diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
6108
- const { request: { method, path: path$2, origin } } = evt;
6109
- debugLog("sending request to %s %s%s", method, origin, path$2);
6109
+ const { request: { method, path, origin } } = evt;
6110
+ debugLog("sending request to %s %s%s", method, origin, path);
6110
6111
  });
6111
6112
  }
6112
6113
  let isTrackingRequestEvents = false;
@@ -6118,16 +6119,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
6118
6119
  }
6119
6120
  isTrackingRequestEvents = true;
6120
6121
  diagnosticsChannel$1.subscribe("undici:request:headers", (evt) => {
6121
- const { request: { method, path: path$2, origin }, response: { statusCode } } = evt;
6122
- debugLog("received response to %s %s%s - HTTP %d", method, origin, path$2, statusCode);
6122
+ const { request: { method, path, origin }, response: { statusCode } } = evt;
6123
+ debugLog("received response to %s %s%s - HTTP %d", method, origin, path, statusCode);
6123
6124
  });
6124
6125
  diagnosticsChannel$1.subscribe("undici:request:trailers", (evt) => {
6125
- const { request: { method, path: path$2, origin } } = evt;
6126
- debugLog("trailers received from %s %s%s", method, origin, path$2);
6126
+ const { request: { method, path, origin } } = evt;
6127
+ debugLog("trailers received from %s %s%s", method, origin, path);
6127
6128
  });
6128
6129
  diagnosticsChannel$1.subscribe("undici:request:error", (evt) => {
6129
- const { request: { method, path: path$2, origin }, error } = evt;
6130
- debugLog("request to %s %s%s errored - %s", method, origin, path$2, error.message);
6130
+ const { request: { method, path, origin }, error } = evt;
6131
+ debugLog("request to %s %s%s errored - %s", method, origin, path, error.message);
6131
6132
  });
6132
6133
  }
6133
6134
  let isTrackingWebSocketEvents = false;
@@ -6180,10 +6181,10 @@ var require_request$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
6180
6181
  const invalidPathRegex = /[^\u0021-\u00ff]/;
6181
6182
  const kHandler = Symbol("handler");
6182
6183
  var Request$6 = class {
6183
- constructor(origin, { path: path$2, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
6184
- if (typeof path$2 !== "string") throw new InvalidArgumentError$35("path must be a string");
6185
- else if (path$2[0] !== "/" && !(path$2.startsWith("http://") || path$2.startsWith("https://")) && method !== "CONNECT") throw new InvalidArgumentError$35("path must be an absolute URL or start with a slash");
6186
- else if (invalidPathRegex.test(path$2)) throw new InvalidArgumentError$35("invalid request path");
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");
6187
6188
  if (typeof method !== "string") throw new InvalidArgumentError$35("method must be a string");
6188
6189
  else if (normalizedMethodRecords$1[method] === void 0 && !isValidHTTPToken$2(method)) throw new InvalidArgumentError$35("invalid request method");
6189
6190
  if (upgrade$1 && typeof upgrade$1 !== "string") throw new InvalidArgumentError$35("upgrade must be a string");
@@ -6224,7 +6225,7 @@ var require_request$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
6224
6225
  this.completed = false;
6225
6226
  this.aborted = false;
6226
6227
  this.upgrade = upgrade$1 || null;
6227
- this.path = query ? serializePathWithQuery$3(path$2, query) : path$2;
6228
+ this.path = query ? serializePathWithQuery$3(path, query) : path;
6228
6229
  this.origin = origin;
6229
6230
  this.protocol = getProtocolFromUrlString(origin);
6230
6231
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -6784,7 +6785,7 @@ var require_connect = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
6784
6785
 
6785
6786
  //#endregion
6786
6787
  //#region ../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/llhttp/utils.js
6787
- var require_utils$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/llhttp/utils.js": ((exports) => {
6788
+ var require_utils$2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/llhttp/utils.js": ((exports) => {
6788
6789
  Object.defineProperty(exports, "__esModule", { value: true });
6789
6790
  exports.enumToMap = enumToMap;
6790
6791
  function enumToMap(obj, filter = [], exceptions = []) {
@@ -6801,7 +6802,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/u
6801
6802
  var require_constants$4 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/undici@7.24.8/node_modules/undici/lib/llhttp/constants.js": ((exports) => {
6802
6803
  Object.defineProperty(exports, "__esModule", { value: true });
6803
6804
  exports.SPECIAL_HEADERS = exports.MINOR = exports.MAJOR = exports.HTAB_SP_VCHAR_OBS_TEXT = exports.QUOTED_STRING = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.HEX = exports.URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.STATUSES_HTTP = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.HEADER_STATE = exports.FINISH = exports.STATUSES = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0;
6804
- const utils_1 = require_utils$1();
6805
+ const utils_1 = require_utils$2();
6805
6806
  exports.ERROR = {
6806
6807
  OK: 0,
6807
6808
  INTERNAL: 1,
@@ -10707,7 +10708,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
10707
10708
  * @returns
10708
10709
  */
10709
10710
  function writeH1(client, request$2) {
10710
- const { method, path: path$2, host, upgrade: upgrade$1, blocking, reset } = request$2;
10711
+ const { method, path, host, upgrade: upgrade$1, blocking, reset } = request$2;
10711
10712
  let { body, headers, contentLength } = request$2;
10712
10713
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
10713
10714
  if (util$23.isFormDataLike(body)) {
@@ -10752,7 +10753,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
10752
10753
  if (client[kMaxRequests$1] && socket[kCounter$1]++ >= client[kMaxRequests$1]) socket[kReset$1] = true;
10753
10754
  if (blocking) socket[kBlocking] = true;
10754
10755
  if (socket.setTypeOfService) socket.setTypeOfService(request$2.typeOfService);
10755
- let header = `${method} ${path$2} HTTP/1.1\r\n`;
10756
+ let header = `${method} ${path} HTTP/1.1\r\n`;
10756
10757
  if (typeof host === "string") header += `host: ${host}\r\n`;
10757
10758
  else header += client[kHostHeader$1];
10758
10759
  if (upgrade$1) header += `connection: upgrade\r\nupgrade: ${upgrade$1}\r\n`;
@@ -11288,7 +11289,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
11288
11289
  function writeH2(client, request$2) {
11289
11290
  const requestTimeout = request$2.bodyTimeout ?? client[kBodyTimeout$1];
11290
11291
  const session = client[kHTTP2Session];
11291
- const { method, path: path$2, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
11292
+ const { method, path, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
11292
11293
  let { body } = request$2;
11293
11294
  if (upgrade$1 != null && upgrade$1 !== "websocket") {
11294
11295
  util$22.errorRequest(client, request$2, new InvalidArgumentError$30(`Custom upgrade "${upgrade$1}" not supported over HTTP/2`));
@@ -11341,7 +11342,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
11341
11342
  }
11342
11343
  headers[HTTP2_HEADER_METHOD] = "CONNECT";
11343
11344
  headers[HTTP2_HEADER_PROTOCOL] = "websocket";
11344
- headers[HTTP2_HEADER_PATH] = path$2;
11345
+ headers[HTTP2_HEADER_PATH] = path;
11345
11346
  if (protocol === "ws:" || protocol === "wss:") headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
11346
11347
  else headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
11347
11348
  stream$2 = session.request(headers, {
@@ -11383,7 +11384,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
11383
11384
  stream$2.setTimeout(requestTimeout);
11384
11385
  return true;
11385
11386
  }
11386
- headers[HTTP2_HEADER_PATH] = path$2;
11387
+ headers[HTTP2_HEADER_PATH] = path;
11387
11388
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
11388
11389
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
11389
11390
  if (body && typeof body.read === "function") body.read(0);
@@ -13209,8 +13210,8 @@ var require_proxy_agent = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
13209
13210
  }
13210
13211
  if (onHeaders) onHeaders.call(this, statusCode, data$1, resume$1);
13211
13212
  };
13212
- const { origin, path: path$2 = "/", headers = {} } = opts;
13213
- opts.path = origin + path$2;
13213
+ const { origin, path = "/", headers = {} } = opts;
13214
+ opts.path = origin + path;
13214
13215
  if (!("host" in headers) && !("Host" in headers)) {
13215
13216
  const { host } = new URL(origin);
13216
13217
  headers.host = host;
@@ -14994,16 +14995,16 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
14994
14995
  }
14995
14996
  return normalizedQp;
14996
14997
  }
14997
- function safeUrl(path$2) {
14998
- if (typeof path$2 !== "string") return path$2;
14999
- const pathSegments = path$2.split("?", 3);
15000
- if (pathSegments.length !== 2) return path$2;
14998
+ function safeUrl(path) {
14999
+ if (typeof path !== "string") return path;
15000
+ const pathSegments = path.split("?", 3);
15001
+ if (pathSegments.length !== 2) return path;
15001
15002
  const qp = new URLSearchParams(pathSegments.pop());
15002
15003
  qp.sort();
15003
15004
  return [...pathSegments, qp.toString()].join("?");
15004
15005
  }
15005
- function matchKey(mockDispatch$1, { path: path$2, method, body, headers }) {
15006
- const pathMatch = matchValue$1(mockDispatch$1.path, path$2);
15006
+ function matchKey(mockDispatch$1, { path, method, body, headers }) {
15007
+ const pathMatch = matchValue$1(mockDispatch$1.path, path);
15007
15008
  const methodMatch = matchValue$1(mockDispatch$1.method, method);
15008
15009
  const bodyMatch = typeof mockDispatch$1.body !== "undefined" ? matchValue$1(mockDispatch$1.body, body) : true;
15009
15010
  const headersMatch = matchHeaders(mockDispatch$1, headers);
@@ -15021,8 +15022,8 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
15021
15022
  const basePath = key.query ? serializePathWithQuery$2(key.path, key.query) : key.path;
15022
15023
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
15023
15024
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
15024
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$2, ignoreTrailingSlash }) => {
15025
- return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$2)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path$2), 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);
15026
15027
  });
15027
15028
  if (matchedMockDispatches.length === 0) throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
15028
15029
  matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue$1(method, key.method));
@@ -15065,15 +15066,15 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
15065
15066
  /**
15066
15067
  * @param {string} path Path to remove trailing slash from
15067
15068
  */
15068
- function removeTrailingSlash(path$2) {
15069
- while (path$2.endsWith("/")) path$2 = path$2.slice(0, -1);
15070
- if (path$2.length === 0) path$2 = "/";
15071
- return path$2;
15069
+ function removeTrailingSlash(path) {
15070
+ while (path.endsWith("/")) path = path.slice(0, -1);
15071
+ if (path.length === 0) path = "/";
15072
+ return path;
15072
15073
  }
15073
15074
  function buildKey$1(opts) {
15074
- const { path: path$2, method, body, headers, query } = opts;
15075
+ const { path, method, body, headers, query } = opts;
15075
15076
  return {
15076
- path: path$2,
15077
+ path,
15077
15078
  method,
15078
15079
  body,
15079
15080
  headers,
@@ -15640,10 +15641,10 @@ var require_pending_interceptors_formatter = /* @__PURE__ */ __commonJS$1({ "../
15640
15641
  });
15641
15642
  }
15642
15643
  format(pendingInterceptors) {
15643
- const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$2, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
15644
+ const withPrettyHeaders = pendingInterceptors.map(({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
15644
15645
  Method: method,
15645
15646
  Origin: origin,
15646
- Path: path$2,
15647
+ Path: path,
15647
15648
  "Status code": statusCode,
15648
15649
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
15649
15650
  Invocations: timesInvoked,
@@ -15701,8 +15702,8 @@ var require_mock_agent = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
15701
15702
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
15702
15703
  const dispatchOpts = { ...opts };
15703
15704
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
15704
- const [path$2, searchParams] = dispatchOpts.path.split("?");
15705
- dispatchOpts.path = `${path$2}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
15705
+ const [path, searchParams] = dispatchOpts.path.split("?");
15706
+ dispatchOpts.path = `${path}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
15706
15707
  }
15707
15708
  return this[kAgent].dispatch(dispatchOpts, handler);
15708
15709
  }
@@ -16179,10 +16180,10 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16179
16180
  * @return {Promise<void>} - Resolves when snapshots are loaded
16180
16181
  */
16181
16182
  async loadSnapshots(filePath) {
16182
- const path$2 = filePath || this.#snapshotPath;
16183
- if (!path$2) throw new InvalidArgumentError$6("Snapshot path is required");
16183
+ const path = filePath || this.#snapshotPath;
16184
+ if (!path) throw new InvalidArgumentError$6("Snapshot path is required");
16184
16185
  try {
16185
- const data$1 = await readFile(resolve$3(path$2), "utf8");
16186
+ const data$1 = await readFile(resolve$3(path), "utf8");
16186
16187
  const parsed = JSON.parse(data$1);
16187
16188
  if (Array.isArray(parsed)) {
16188
16189
  this.#snapshots.clear();
@@ -16190,7 +16191,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16190
16191
  } else this.#snapshots = new Map(Object.entries(parsed));
16191
16192
  } catch (error) {
16192
16193
  if (error.code === "ENOENT") this.#snapshots.clear();
16193
- else throw new UndiciError$1(`Failed to load snapshots from ${path$2}`, { cause: error });
16194
+ else throw new UndiciError$1(`Failed to load snapshots from ${path}`, { cause: error });
16194
16195
  }
16195
16196
  }
16196
16197
  /**
@@ -16200,9 +16201,9 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
16200
16201
  * @returns {Promise<void>} - Resolves when snapshots are saved
16201
16202
  */
16202
16203
  async saveSnapshots(filePath) {
16203
- const path$2 = filePath || this.#snapshotPath;
16204
- if (!path$2) throw new InvalidArgumentError$6("Snapshot path is required");
16205
- const resolvedPath = resolve$3(path$2);
16204
+ const path = filePath || this.#snapshotPath;
16205
+ if (!path) throw new InvalidArgumentError$6("Snapshot path is required");
16206
+ const resolvedPath = resolve$3(path);
16206
16207
  await mkdir(dirname$2(resolvedPath), { recursive: true });
16207
16208
  const data$1 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
16208
16209
  hash,
@@ -16769,11 +16770,11 @@ var require_redirect_handler = /* @__PURE__ */ __commonJS$1({ "../../node_module
16769
16770
  return;
16770
16771
  }
16771
16772
  const { origin, pathname, search } = util$10.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
16772
- const path$2 = search ? `${pathname}${search}` : pathname;
16773
- const redirectUrlString = `${origin}${path$2}`;
16773
+ const path = search ? `${pathname}${search}` : pathname;
16774
+ const redirectUrlString = `${origin}${path}`;
16774
16775
  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.`);
16775
16776
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
16776
- this.opts.path = path$2;
16777
+ this.opts.path = path;
16777
16778
  this.opts.origin = origin;
16778
16779
  this.opts.query = null;
16779
16780
  }
@@ -21731,10 +21732,10 @@ var require_fetch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/und
21731
21732
  const url = requestCurrentURL(request$2);
21732
21733
  /** @type {import('../../..').Agent} */
21733
21734
  const agent = fetchParams.controller.dispatcher;
21734
- const path$2 = url.pathname + url.search;
21735
+ const path = url.pathname + url.search;
21735
21736
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
21736
21737
  return new Promise((resolve$4, reject) => agent.dispatch({
21737
- path: hasTrailingQuestionMark ? `${path$2}?` : path$2,
21738
+ path: hasTrailingQuestionMark ? `${path}?` : path,
21738
21739
  origin: url.origin,
21739
21740
  method: request$2.method,
21740
21741
  body: agent.isMockActive ? request$2.body && (request$2.body.source || request$2.body.stream) : body,
@@ -22516,9 +22517,9 @@ var require_util$2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
22516
22517
  * path-value = <any CHAR except CTLs or ";">
22517
22518
  * @param {string} path
22518
22519
  */
22519
- function validateCookiePath(path$2) {
22520
- for (let i$1 = 0; i$1 < path$2.length; ++i$1) {
22521
- const code = path$2.charCodeAt(i$1);
22520
+ function validateCookiePath(path) {
22521
+ for (let i$1 = 0; i$1 < path.length; ++i$1) {
22522
+ const code = path.charCodeAt(i$1);
22522
22523
  if (code < 32 || code === 127 || code === 59) throw new Error("Invalid cookie path");
22523
22524
  }
22524
22525
  }
@@ -25626,9 +25627,9 @@ var require_undici = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
25626
25627
  if (opts != null && typeof opts !== "object") throw new InvalidArgumentError("invalid opts");
25627
25628
  if (opts && opts.path != null) {
25628
25629
  if (typeof opts.path !== "string") throw new InvalidArgumentError("invalid opts.path");
25629
- let path$2 = opts.path;
25630
- if (!opts.path.startsWith("/")) path$2 = `/${path$2}`;
25631
- url = new URL(util$3.parseOrigin(url).origin + path$2);
25630
+ let path = opts.path;
25631
+ if (!opts.path.startsWith("/")) path = `/${path}`;
25632
+ url = new URL(util$3.parseOrigin(url).origin + path);
25632
25633
  } else {
25633
25634
  if (!opts) opts = typeof url === "object" ? url : {};
25634
25635
  url = util$3.parseURL(url);
@@ -25745,7 +25746,7 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
25745
25746
  }
25746
25747
  __name(typeOf, "typeOf");
25747
25748
  function Adapt(adapter_) {
25748
- var meta = adapter_.meta, path4 = adapter_.path, xdg = adapter_.xdg;
25749
+ var meta = adapter_.meta, path5 = adapter_.path, xdg = adapter_.xdg;
25749
25750
  return { XDGAppPaths: new (/* @__PURE__ */ function() {
25750
25751
  function XDGAppPaths_2(options_) {
25751
25752
  if (options_ === void 0) options_ = {};
@@ -25763,7 +25764,7 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
25763
25764
  meta.pkgMainFilename(),
25764
25765
  meta.mainFilename()
25765
25766
  ];
25766
- var name = path4.parse(((_c = namePriorityList.find(function(e2) {
25767
+ var name = path5.parse(((_c = namePriorityList.find(function(e2) {
25767
25768
  return isString2(e2);
25768
25769
  })) !== null && _c !== void 0 ? _c : "$eval") + suffix).name;
25769
25770
  XDGAppPaths.$name = /* @__PURE__ */ __name(function $name() {
@@ -25783,28 +25784,28 @@ var require_XDGAppPaths = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8
25783
25784
  }
25784
25785
  __name(finalPathSegment, "finalPathSegment");
25785
25786
  XDGAppPaths.cache = /* @__PURE__ */ __name(function cache$2(dirOptions) {
25786
- return path4.join(xdg.cache(), finalPathSegment(dirOptions));
25787
+ return path5.join(xdg.cache(), finalPathSegment(dirOptions));
25787
25788
  }, "cache");
25788
25789
  XDGAppPaths.config = /* @__PURE__ */ __name(function config(dirOptions) {
25789
- return path4.join(xdg.config(), finalPathSegment(dirOptions));
25790
+ return path5.join(xdg.config(), finalPathSegment(dirOptions));
25790
25791
  }, "config");
25791
25792
  XDGAppPaths.data = /* @__PURE__ */ __name(function data$1(dirOptions) {
25792
- return path4.join(xdg.data(), finalPathSegment(dirOptions));
25793
+ return path5.join(xdg.data(), finalPathSegment(dirOptions));
25793
25794
  }, "data");
25794
25795
  XDGAppPaths.runtime = /* @__PURE__ */ __name(function runtime(dirOptions) {
25795
- return xdg.runtime() ? path4.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
25796
+ return xdg.runtime() ? path5.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
25796
25797
  }, "runtime");
25797
25798
  XDGAppPaths.state = /* @__PURE__ */ __name(function state(dirOptions) {
25798
- return path4.join(xdg.state(), finalPathSegment(dirOptions));
25799
+ return path5.join(xdg.state(), finalPathSegment(dirOptions));
25799
25800
  }, "state");
25800
25801
  XDGAppPaths.configDirs = /* @__PURE__ */ __name(function configDirs(dirOptions) {
25801
25802
  return xdg.configDirs().map(function(s) {
25802
- return path4.join(s, finalPathSegment(dirOptions));
25803
+ return path5.join(s, finalPathSegment(dirOptions));
25803
25804
  });
25804
25805
  }, "configDirs");
25805
25806
  XDGAppPaths.dataDirs = /* @__PURE__ */ __name(function dataDirs(dirOptions) {
25806
25807
  return xdg.dataDirs().map(function(s) {
25807
- return path4.join(s, finalPathSegment(dirOptions));
25808
+ return path5.join(s, finalPathSegment(dirOptions));
25808
25809
  });
25809
25810
  }, "dataDirs");
25810
25811
  return XDGAppPaths;
@@ -25824,7 +25825,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
25824
25825
  exports$1.__esModule = true;
25825
25826
  exports$1.Adapt = void 0;
25826
25827
  function Adapt(adapter_) {
25827
- var env$1 = adapter_.env, osPaths = adapter_.osPaths, path4 = adapter_.path;
25828
+ var env$1 = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
25828
25829
  var isMacOS = /^darwin$/i.test(adapter_.process.platform);
25829
25830
  var isWinOS = /^win/i.test(adapter_.process.platform);
25830
25831
  function baseDir() {
@@ -25832,7 +25833,7 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
25832
25833
  }
25833
25834
  __name(baseDir, "baseDir");
25834
25835
  function valOrPath(val, pathSegments) {
25835
- return val || path4.join.apply(path4, pathSegments);
25836
+ return val || path5.join.apply(path5, pathSegments);
25836
25837
  }
25837
25838
  __name(valOrPath, "valOrPath");
25838
25839
  var linux = /* @__PURE__ */ __name(function() {
@@ -25946,11 +25947,11 @@ var require_XDG = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/nod
25946
25947
  XDG.state = extension.state;
25947
25948
  XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
25948
25949
  var pathList = env$1.get("XDG_CONFIG_DIRS");
25949
- return __spreadArray([extension.config()], pathList ? pathList.split(path4.delimiter) : []);
25950
+ return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
25950
25951
  }, "configDirs");
25951
25952
  XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
25952
25953
  var pathList = env$1.get("XDG_DATA_DIRS");
25953
- return __spreadArray([extension.data()], pathList ? pathList.split(path4.delimiter) : []);
25954
+ return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
25954
25955
  }, "dataDirs");
25955
25956
  return XDG;
25956
25957
  }
@@ -25973,7 +25974,7 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
25973
25974
  }
25974
25975
  __name(isEmpty, "isEmpty");
25975
25976
  function Adapt(adapter_) {
25976
- var env$1 = adapter_.env, os2 = adapter_.os, path4 = adapter_.path;
25977
+ var env$1 = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
25977
25978
  var isWinOS = /^win/i.test(adapter_.process.platform);
25978
25979
  function normalizePath$2(path_) {
25979
25980
  return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
@@ -25985,7 +25986,7 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
25985
25986
  typeof os2.homedir === "function" ? os2.homedir() : void 0,
25986
25987
  env$1.get("USERPROFILE"),
25987
25988
  env$1.get("HOME"),
25988
- env$1.get("HOMEDRIVE") || env$1.get("HOMEPATH") ? path4.join(env$1.get("HOMEDRIVE") || "", env$1.get("HOMEPATH") || "") : void 0
25989
+ env$1.get("HOMEDRIVE") || env$1.get("HOMEPATH") ? path5.join(env$1.get("HOMEDRIVE") || "", env$1.get("HOMEPATH") || "") : void 0
25989
25990
  ].find(function(v) {
25990
25991
  return !isEmpty(v);
25991
25992
  }));
@@ -25996,7 +25997,7 @@ var require_OSPaths = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node
25996
25997
  __name(home, "home");
25997
25998
  function temp() {
25998
25999
  function joinPathToBase(base, segments) {
25999
- return base ? path4.join.apply(path4, __spreadArray([base], segments)) : void 0;
26000
+ return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
26000
26001
  }
26001
26002
  __name(joinPathToBase, "joinPathToBase");
26002
26003
  function posix$1() {
@@ -26101,14 +26102,14 @@ var require_node = __commonJS({ "../../node_modules/.pnpm/os-paths@7.4.0/node_mo
26101
26102
  exports$1.__esModule = true;
26102
26103
  exports$1.adapter = void 0;
26103
26104
  var os2 = __importStar(__require$1("os"));
26104
- var path4 = __importStar(__require$1("path"));
26105
+ var path5 = __importStar(__require$1("path"));
26105
26106
  exports$1.adapter = {
26106
26107
  atImportPermissions: { env: true },
26107
26108
  env: { get: /* @__PURE__ */ __name(function(s) {
26108
26109
  return process.env[s];
26109
26110
  }, "get") },
26110
26111
  os: os2,
26111
- path: path4,
26112
+ path: path5,
26112
26113
  process
26113
26114
  };
26114
26115
  } });
@@ -26152,7 +26153,7 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
26152
26153
  };
26153
26154
  exports$1.__esModule = true;
26154
26155
  exports$1.adapter = void 0;
26155
- var path4 = __importStar(__require$1("path"));
26156
+ var path5 = __importStar(__require$1("path"));
26156
26157
  var os_paths_1 = __importDefault(require_mod_cjs());
26157
26158
  exports$1.adapter = {
26158
26159
  atImportPermissions: { env: true },
@@ -26160,7 +26161,7 @@ var require_node2 = __commonJS({ "../../node_modules/.pnpm/xdg-portable@10.6.0/n
26160
26161
  return process.env[s];
26161
26162
  }, "get") },
26162
26163
  osPaths: os_paths_1["default"],
26163
- path: path4,
26164
+ path: path5,
26164
26165
  process
26165
26166
  };
26166
26167
  } });
@@ -26204,7 +26205,7 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
26204
26205
  };
26205
26206
  exports$1.__esModule = true;
26206
26207
  exports$1.adapter = void 0;
26207
- var path4 = __importStar(__require$1("path"));
26208
+ var path5 = __importStar(__require$1("path"));
26208
26209
  var xdg_portable_1 = __importDefault(require_mod_cjs2());
26209
26210
  exports$1.adapter = {
26210
26211
  atImportPermissions: {
@@ -26220,7 +26221,7 @@ var require_node3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/n
26220
26221
  return process.pkg ? process.execPath : void 0;
26221
26222
  }, "pkgMainFilename")
26222
26223
  },
26223
- path: path4,
26224
+ path: path5,
26224
26225
  process,
26225
26226
  xdg: xdg_portable_1["default"]
26226
26227
  };
@@ -26230,14 +26231,147 @@ var require_mod_cjs3 = __commonJS({ "../../node_modules/.pnpm/xdg-app-paths@8.3.
26230
26231
  var node_js_1 = require_node3();
26231
26232
  module$1.exports = XDGAppPaths_js_1.Adapt(node_js_1.adapter).XDGAppPaths;
26232
26233
  } });
26234
+ var require_signals = __commonJS({ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports$1, module$1) {
26235
+ module$1.exports = [
26236
+ "SIGABRT",
26237
+ "SIGALRM",
26238
+ "SIGHUP",
26239
+ "SIGINT",
26240
+ "SIGTERM"
26241
+ ];
26242
+ if (process.platform !== "win32") module$1.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
26243
+ if (process.platform === "linux") module$1.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
26244
+ } });
26245
+ var require_signal_exit = __commonJS({ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports$1, module$1) {
26246
+ var process2 = global.process;
26247
+ var processOk = /* @__PURE__ */ __name(function(process3) {
26248
+ return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
26249
+ }, "processOk");
26250
+ if (!processOk(process2)) module$1.exports = function() {
26251
+ return function() {};
26252
+ };
26253
+ else {
26254
+ assert2 = __require$1("assert");
26255
+ signals = require_signals();
26256
+ isWin$1 = /^win/i.test(process2.platform);
26257
+ EE$3 = __require$1("events");
26258
+ if (typeof EE$3 !== "function") EE$3 = EE$3.EventEmitter;
26259
+ if (process2.__signal_exit_emitter__) emitter = process2.__signal_exit_emitter__;
26260
+ else {
26261
+ emitter = process2.__signal_exit_emitter__ = new EE$3();
26262
+ emitter.count = 0;
26263
+ emitter.emitted = {};
26264
+ }
26265
+ if (!emitter.infinite) {
26266
+ emitter.setMaxListeners(Infinity);
26267
+ emitter.infinite = true;
26268
+ }
26269
+ module$1.exports = function(cb, opts) {
26270
+ if (!processOk(global.process)) return function() {};
26271
+ assert2.equal(typeof cb, "function", "a callback must be provided for exit handler");
26272
+ if (loaded === false) load();
26273
+ var ev = "exit";
26274
+ if (opts && opts.alwaysLast) ev = "afterexit";
26275
+ var remove = /* @__PURE__ */ __name(function() {
26276
+ emitter.removeListener(ev, cb);
26277
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) unload();
26278
+ }, "remove");
26279
+ emitter.on(ev, cb);
26280
+ return remove;
26281
+ };
26282
+ unload = /* @__PURE__ */ __name(function unload2() {
26283
+ if (!loaded || !processOk(global.process)) return;
26284
+ loaded = false;
26285
+ signals.forEach(function(sig) {
26286
+ try {
26287
+ process2.removeListener(sig, sigListeners[sig]);
26288
+ } catch (er) {}
26289
+ });
26290
+ process2.emit = originalProcessEmit;
26291
+ process2.reallyExit = originalProcessReallyExit;
26292
+ emitter.count -= 1;
26293
+ }, "unload");
26294
+ module$1.exports.unload = unload;
26295
+ emit = /* @__PURE__ */ __name(function emit2(event, code, signal) {
26296
+ if (emitter.emitted[event]) return;
26297
+ emitter.emitted[event] = true;
26298
+ emitter.emit(event, code, signal);
26299
+ }, "emit");
26300
+ sigListeners = {};
26301
+ signals.forEach(function(sig) {
26302
+ sigListeners[sig] = /* @__PURE__ */ __name(function listener() {
26303
+ if (!processOk(global.process)) return;
26304
+ if (process2.listeners(sig).length === emitter.count) {
26305
+ unload();
26306
+ emit("exit", null, sig);
26307
+ emit("afterexit", null, sig);
26308
+ if (isWin$1 && sig === "SIGHUP") sig = "SIGINT";
26309
+ process2.kill(process2.pid, sig);
26310
+ }
26311
+ }, "listener");
26312
+ });
26313
+ module$1.exports.signals = function() {
26314
+ return signals;
26315
+ };
26316
+ loaded = false;
26317
+ load = /* @__PURE__ */ __name(function load2() {
26318
+ if (loaded || !processOk(global.process)) return;
26319
+ loaded = true;
26320
+ emitter.count += 1;
26321
+ signals = signals.filter(function(sig) {
26322
+ try {
26323
+ process2.on(sig, sigListeners[sig]);
26324
+ return true;
26325
+ } catch (er) {
26326
+ return false;
26327
+ }
26328
+ });
26329
+ process2.emit = processEmit;
26330
+ process2.reallyExit = processReallyExit;
26331
+ }, "load");
26332
+ module$1.exports.load = load;
26333
+ originalProcessReallyExit = process2.reallyExit;
26334
+ processReallyExit = /* @__PURE__ */ __name(function processReallyExit2(code) {
26335
+ if (!processOk(global.process)) return;
26336
+ process2.exitCode = code || 0;
26337
+ emit("exit", process2.exitCode, null);
26338
+ emit("afterexit", process2.exitCode, null);
26339
+ originalProcessReallyExit.call(process2, process2.exitCode);
26340
+ }, "processReallyExit");
26341
+ originalProcessEmit = process2.emit;
26342
+ processEmit = /* @__PURE__ */ __name(function processEmit2(ev, arg) {
26343
+ if (ev === "exit" && processOk(global.process)) {
26344
+ if (arg !== void 0) process2.exitCode = arg;
26345
+ var ret = originalProcessEmit.apply(this, arguments);
26346
+ emit("exit", process2.exitCode, null);
26347
+ emit("afterexit", process2.exitCode, null);
26348
+ return ret;
26349
+ } else return originalProcessEmit.apply(this, arguments);
26350
+ }, "processEmit");
26351
+ }
26352
+ var assert2;
26353
+ var signals;
26354
+ var isWin$1;
26355
+ var EE$3;
26356
+ var emitter;
26357
+ var unload;
26358
+ var emit;
26359
+ var sigListeners;
26360
+ var loaded;
26361
+ var load;
26362
+ var originalProcessReallyExit;
26363
+ var processReallyExit;
26364
+ var originalProcessEmit;
26365
+ var processEmit;
26366
+ } });
26233
26367
  var require_command_exists = __commonJS({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module$1) {
26234
26368
  var exec = __require$1("child_process").exec;
26235
26369
  var execSync = __require$1("child_process").execSync;
26236
- var fs2 = __require$1("fs");
26237
- var path4 = __require$1("path");
26238
- var access = fs2.access;
26239
- var accessSync2 = fs2.accessSync;
26240
- var constants2 = fs2.constants || fs2;
26370
+ var fs3 = __require$1("fs");
26371
+ var path5 = __require$1("path");
26372
+ var access = fs3.access;
26373
+ var accessSync2 = fs3.accessSync;
26374
+ var constants2 = fs3.constants || fs3;
26241
26375
  var isUsingWindows = process.platform == "win32";
26242
26376
  var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback$1) {
26243
26377
  access(commandName, constants2.F_OK, function(err) {
@@ -26311,8 +26445,8 @@ var require_command_exists = __commonJS({ "../../node_modules/.pnpm/command-exis
26311
26445
  }, "cleanInput");
26312
26446
  if (isUsingWindows) cleanInput = /* @__PURE__ */ __name(function(s) {
26313
26447
  if (/[\\]/.test(s)) {
26314
- var dirname2 = "\"" + path4.dirname(s) + "\"";
26315
- var basename$1 = "\"" + path4.basename(s) + "\"";
26448
+ var dirname2 = "\"" + path5.dirname(s) + "\"";
26449
+ var basename$1 = "\"" + path5.basename(s) + "\"";
26316
26450
  return dirname2 + ":" + basename$1;
26317
26451
  }
26318
26452
  return "\"" + s + "\"";
@@ -26337,6 +26471,799 @@ var require_command_exists = __commonJS({ "../../node_modules/.pnpm/command-exis
26337
26471
  var require_command_exists2 = __commonJS({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module$1) {
26338
26472
  module$1.exports = require_command_exists();
26339
26473
  } });
26474
+ var require_ini = __commonJS({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
26475
+ exports$1.parse = exports$1.decode = decode;
26476
+ exports$1.stringify = exports$1.encode = encode$2;
26477
+ exports$1.safe = safe;
26478
+ exports$1.unsafe = unsafe;
26479
+ var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
26480
+ function encode$2(obj, opt) {
26481
+ var children = [];
26482
+ var out = "";
26483
+ if (typeof opt === "string") opt = {
26484
+ section: opt,
26485
+ whitespace: false
26486
+ };
26487
+ else {
26488
+ opt = opt || {};
26489
+ opt.whitespace = opt.whitespace === true;
26490
+ }
26491
+ var separator = opt.whitespace ? " = " : "=";
26492
+ Object.keys(obj).forEach(function(k, _2, __) {
26493
+ var val = obj[k];
26494
+ if (val && Array.isArray(val)) val.forEach(function(item) {
26495
+ out += safe(k + "[]") + separator + safe(item) + "\n";
26496
+ });
26497
+ else if (val && typeof val === "object") children.push(k);
26498
+ else out += safe(k) + separator + safe(val) + eol;
26499
+ });
26500
+ if (opt.section && out.length) out = "[" + safe(opt.section) + "]" + eol + out;
26501
+ children.forEach(function(k, _2, __) {
26502
+ var nk = dotSplit(k).join("\\.");
26503
+ var section = (opt.section ? opt.section + "." : "") + nk;
26504
+ var child = encode$2(obj[k], {
26505
+ section,
26506
+ whitespace: opt.whitespace
26507
+ });
26508
+ if (out.length && child.length) out += eol;
26509
+ out += child;
26510
+ });
26511
+ return out;
26512
+ }
26513
+ __name(encode$2, "encode");
26514
+ function dotSplit(str) {
26515
+ return str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map(function(part) {
26516
+ return part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "");
26517
+ });
26518
+ }
26519
+ __name(dotSplit, "dotSplit");
26520
+ function decode(str) {
26521
+ var out = {};
26522
+ var p$1 = out;
26523
+ var section = null;
26524
+ var re$5 = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
26525
+ str.split(/[\r\n]+/g).forEach(function(line, _2, __) {
26526
+ if (!line || line.match(/^\s*[;#]/)) return;
26527
+ var match = line.match(re$5);
26528
+ if (!match) return;
26529
+ if (match[1] !== void 0) {
26530
+ section = unsafe(match[1]);
26531
+ if (section === "__proto__") {
26532
+ p$1 = {};
26533
+ return;
26534
+ }
26535
+ p$1 = out[section] = out[section] || {};
26536
+ return;
26537
+ }
26538
+ var key = unsafe(match[2]);
26539
+ if (key === "__proto__") return;
26540
+ var value = match[3] ? unsafe(match[4]) : true;
26541
+ switch (value) {
26542
+ case "true":
26543
+ case "false":
26544
+ case "null": value = JSON.parse(value);
26545
+ }
26546
+ if (key.length > 2 && key.slice(-2) === "[]") {
26547
+ key = key.substring(0, key.length - 2);
26548
+ if (key === "__proto__") return;
26549
+ if (!p$1[key]) p$1[key] = [];
26550
+ else if (!Array.isArray(p$1[key])) p$1[key] = [p$1[key]];
26551
+ }
26552
+ if (Array.isArray(p$1[key])) p$1[key].push(value);
26553
+ else p$1[key] = value;
26554
+ });
26555
+ Object.keys(out).filter(function(k, _2, __) {
26556
+ if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k])) return false;
26557
+ var parts = dotSplit(k);
26558
+ var p2 = out;
26559
+ var l = parts.pop();
26560
+ var nl = l.replace(/\\\./g, ".");
26561
+ parts.forEach(function(part, _3, __2) {
26562
+ if (part === "__proto__") return;
26563
+ if (!p2[part] || typeof p2[part] !== "object") p2[part] = {};
26564
+ p2 = p2[part];
26565
+ });
26566
+ if (p2 === out && nl === l) return false;
26567
+ p2[nl] = out[k];
26568
+ return true;
26569
+ }).forEach(function(del, _2, __) {
26570
+ delete out[del];
26571
+ });
26572
+ return out;
26573
+ }
26574
+ __name(decode, "decode");
26575
+ function isQuoted(val) {
26576
+ return val.charAt(0) === "\"" && val.slice(-1) === "\"" || val.charAt(0) === "'" && val.slice(-1) === "'";
26577
+ }
26578
+ __name(isQuoted, "isQuoted");
26579
+ function safe(val) {
26580
+ return typeof val !== "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim() ? JSON.stringify(val) : val.replace(/;/g, "\\;").replace(/#/g, "\\#");
26581
+ }
26582
+ __name(safe, "safe");
26583
+ function unsafe(val, doUnesc) {
26584
+ val = (val || "").trim();
26585
+ if (isQuoted(val)) {
26586
+ if (val.charAt(0) === "'") val = val.substr(1, val.length - 2);
26587
+ try {
26588
+ val = JSON.parse(val);
26589
+ } catch (_2) {}
26590
+ } else {
26591
+ var esc = false;
26592
+ var unesc = "";
26593
+ for (var i$1 = 0, l = val.length; i$1 < l; i$1++) {
26594
+ var c = val.charAt(i$1);
26595
+ if (esc) {
26596
+ if ("\\;#".indexOf(c) !== -1) unesc += c;
26597
+ else unesc += "\\" + c;
26598
+ esc = false;
26599
+ } else if (";#".indexOf(c) !== -1) break;
26600
+ else if (c === "\\") esc = true;
26601
+ else unesc += c;
26602
+ }
26603
+ if (esc) unesc += "\\";
26604
+ return unesc.trim();
26605
+ }
26606
+ return val;
26607
+ }
26608
+ __name(unsafe, "unsafe");
26609
+ } });
26610
+ var require_strip_json_comments = __commonJS({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1, module$1) {
26611
+ var singleComment = 1;
26612
+ var multiComment = 2;
26613
+ function stripWithoutWhitespace() {
26614
+ return "";
26615
+ }
26616
+ __name(stripWithoutWhitespace, "stripWithoutWhitespace");
26617
+ function stripWithWhitespace(str, start, end) {
26618
+ return str.slice(start, end).replace(/\S/g, " ");
26619
+ }
26620
+ __name(stripWithWhitespace, "stripWithWhitespace");
26621
+ module$1.exports = function(str, opts) {
26622
+ opts = opts || {};
26623
+ var currentChar;
26624
+ var nextChar;
26625
+ var insideString = false;
26626
+ var insideComment = false;
26627
+ var offset = 0;
26628
+ var ret = "";
26629
+ var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
26630
+ for (var i$1 = 0; i$1 < str.length; i$1++) {
26631
+ currentChar = str[i$1];
26632
+ nextChar = str[i$1 + 1];
26633
+ if (!insideComment && currentChar === "\"") {
26634
+ if (!(str[i$1 - 1] === "\\" && str[i$1 - 2] !== "\\")) insideString = !insideString;
26635
+ }
26636
+ if (insideString) continue;
26637
+ if (!insideComment && currentChar + nextChar === "//") {
26638
+ ret += str.slice(offset, i$1);
26639
+ offset = i$1;
26640
+ insideComment = singleComment;
26641
+ i$1++;
26642
+ } else if (insideComment === singleComment && currentChar + nextChar === "\r\n") {
26643
+ i$1++;
26644
+ insideComment = false;
26645
+ ret += strip(str, offset, i$1);
26646
+ offset = i$1;
26647
+ continue;
26648
+ } else if (insideComment === singleComment && currentChar === "\n") {
26649
+ insideComment = false;
26650
+ ret += strip(str, offset, i$1);
26651
+ offset = i$1;
26652
+ } else if (!insideComment && currentChar + nextChar === "/*") {
26653
+ ret += str.slice(offset, i$1);
26654
+ offset = i$1;
26655
+ insideComment = multiComment;
26656
+ i$1++;
26657
+ continue;
26658
+ } else if (insideComment === multiComment && currentChar + nextChar === "*/") {
26659
+ i$1++;
26660
+ insideComment = false;
26661
+ ret += strip(str, offset, i$1 + 1);
26662
+ offset = i$1 + 1;
26663
+ continue;
26664
+ }
26665
+ }
26666
+ return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
26667
+ };
26668
+ } });
26669
+ var require_utils$1 = __commonJS({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
26670
+ var fs3 = __require$1("fs");
26671
+ var ini = require_ini();
26672
+ var path5 = __require$1("path");
26673
+ var stripJsonComments = require_strip_json_comments();
26674
+ var parse$10 = exports$1.parse = function(content) {
26675
+ if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
26676
+ return ini.parse(content);
26677
+ };
26678
+ var file$1 = exports$1.file = function() {
26679
+ var args = [].slice.call(arguments).filter(function(arg) {
26680
+ return arg != null;
26681
+ });
26682
+ for (var i$1 in args) if ("string" !== typeof args[i$1]) return;
26683
+ var file2 = path5.join.apply(null, args);
26684
+ try {
26685
+ return fs3.readFileSync(file2, "utf-8");
26686
+ } catch (err) {
26687
+ return;
26688
+ }
26689
+ };
26690
+ exports$1.json = function() {
26691
+ var content = file$1.apply(null, arguments);
26692
+ return content ? parse$10(content) : null;
26693
+ };
26694
+ exports$1.env = function(prefix, env2) {
26695
+ env2 = env2 || process.env;
26696
+ var obj = {};
26697
+ var l = prefix.length;
26698
+ for (var k in env2) if (k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
26699
+ var keypath = k.substring(l).split("__");
26700
+ var _emptyStringIndex;
26701
+ while ((_emptyStringIndex = keypath.indexOf("")) > -1) keypath.splice(_emptyStringIndex, 1);
26702
+ var cursor = obj;
26703
+ keypath.forEach(/* @__PURE__ */ __name(function _buildSubObj(_subkey, i$1) {
26704
+ if (!_subkey || typeof cursor !== "object") return;
26705
+ if (i$1 === keypath.length - 1) cursor[_subkey] = env2[k];
26706
+ if (cursor[_subkey] === void 0) cursor[_subkey] = {};
26707
+ cursor = cursor[_subkey];
26708
+ }, "_buildSubObj"));
26709
+ }
26710
+ return obj;
26711
+ };
26712
+ exports$1.find = function() {
26713
+ var rel = path5.join.apply(null, [].slice.call(arguments));
26714
+ function find2(start, rel2) {
26715
+ var file2 = path5.join(start, rel2);
26716
+ try {
26717
+ fs3.statSync(file2);
26718
+ return file2;
26719
+ } catch (err) {
26720
+ if (path5.dirname(start) !== start) return find2(path5.dirname(start), rel2);
26721
+ }
26722
+ }
26723
+ __name(find2, "find");
26724
+ return find2(process.cwd(), rel);
26725
+ };
26726
+ } });
26727
+ var require_deep_extend = __commonJS({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1, module$1) {
26728
+ function isSpecificValue(val) {
26729
+ return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
26730
+ }
26731
+ __name(isSpecificValue, "isSpecificValue");
26732
+ function cloneSpecificValue(val) {
26733
+ if (val instanceof Buffer) {
26734
+ var x = Buffer.alloc ? Buffer.alloc(val.length) : new Buffer(val.length);
26735
+ val.copy(x);
26736
+ return x;
26737
+ } else if (val instanceof Date) return new Date(val.getTime());
26738
+ else if (val instanceof RegExp) return new RegExp(val);
26739
+ else throw new Error("Unexpected situation");
26740
+ }
26741
+ __name(cloneSpecificValue, "cloneSpecificValue");
26742
+ function deepCloneArray(arr) {
26743
+ var clone = [];
26744
+ arr.forEach(function(item, index) {
26745
+ if (typeof item === "object" && item !== null) if (Array.isArray(item)) clone[index] = deepCloneArray(item);
26746
+ else if (isSpecificValue(item)) clone[index] = cloneSpecificValue(item);
26747
+ else clone[index] = deepExtend({}, item);
26748
+ else clone[index] = item;
26749
+ });
26750
+ return clone;
26751
+ }
26752
+ __name(deepCloneArray, "deepCloneArray");
26753
+ function safeGetProperty(object, property) {
26754
+ return property === "__proto__" ? void 0 : object[property];
26755
+ }
26756
+ __name(safeGetProperty, "safeGetProperty");
26757
+ var deepExtend = module$1.exports = function() {
26758
+ if (arguments.length < 1 || typeof arguments[0] !== "object") return false;
26759
+ if (arguments.length < 2) return arguments[0];
26760
+ var target$1 = arguments[0];
26761
+ var args = Array.prototype.slice.call(arguments, 1);
26762
+ var val, src$1;
26763
+ args.forEach(function(obj) {
26764
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) return;
26765
+ Object.keys(obj).forEach(function(key) {
26766
+ src$1 = safeGetProperty(target$1, key);
26767
+ val = safeGetProperty(obj, key);
26768
+ if (val === target$1) return;
26769
+ else if (typeof val !== "object" || val === null) {
26770
+ target$1[key] = val;
26771
+ return;
26772
+ } else if (Array.isArray(val)) {
26773
+ target$1[key] = deepCloneArray(val);
26774
+ return;
26775
+ } else if (isSpecificValue(val)) {
26776
+ target$1[key] = cloneSpecificValue(val);
26777
+ return;
26778
+ } else if (typeof src$1 !== "object" || src$1 === null || Array.isArray(src$1)) {
26779
+ target$1[key] = deepExtend({}, val);
26780
+ return;
26781
+ } else {
26782
+ target$1[key] = deepExtend(src$1, val);
26783
+ return;
26784
+ }
26785
+ });
26786
+ });
26787
+ return target$1;
26788
+ };
26789
+ } });
26790
+ var require_minimist = __commonJS({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1, module$1) {
26791
+ module$1.exports = function(args, opts) {
26792
+ if (!opts) opts = {};
26793
+ var flags = {
26794
+ bools: {},
26795
+ strings: {},
26796
+ unknownFn: null
26797
+ };
26798
+ if (typeof opts["unknown"] === "function") flags.unknownFn = opts["unknown"];
26799
+ if (typeof opts["boolean"] === "boolean" && opts["boolean"]) flags.allBools = true;
26800
+ else [].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
26801
+ flags.bools[key2] = true;
26802
+ });
26803
+ var aliases = {};
26804
+ Object.keys(opts.alias || {}).forEach(function(key2) {
26805
+ aliases[key2] = [].concat(opts.alias[key2]);
26806
+ aliases[key2].forEach(function(x) {
26807
+ aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
26808
+ return x !== y;
26809
+ }));
26810
+ });
26811
+ });
26812
+ [].concat(opts.string).filter(Boolean).forEach(function(key2) {
26813
+ flags.strings[key2] = true;
26814
+ if (aliases[key2]) flags.strings[aliases[key2]] = true;
26815
+ });
26816
+ var defaults = opts["default"] || {};
26817
+ var argv$1 = { _: [] };
26818
+ Object.keys(flags.bools).forEach(function(key2) {
26819
+ setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
26820
+ });
26821
+ var notFlags = [];
26822
+ if (args.indexOf("--") !== -1) {
26823
+ notFlags = args.slice(args.indexOf("--") + 1);
26824
+ args = args.slice(0, args.indexOf("--"));
26825
+ }
26826
+ function argDefined(key2, arg2) {
26827
+ return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
26828
+ }
26829
+ __name(argDefined, "argDefined");
26830
+ function setArg(key2, val, arg2) {
26831
+ if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
26832
+ if (flags.unknownFn(arg2) === false) return;
26833
+ }
26834
+ var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
26835
+ setKey(argv$1, key2.split("."), value2);
26836
+ (aliases[key2] || []).forEach(function(x) {
26837
+ setKey(argv$1, x.split("."), value2);
26838
+ });
26839
+ }
26840
+ __name(setArg, "setArg");
26841
+ function setKey(obj, keys, value2) {
26842
+ var o = obj;
26843
+ for (var i2 = 0; i2 < keys.length - 1; i2++) {
26844
+ var key2 = keys[i2];
26845
+ if (isConstructorOrProto(o, key2)) return;
26846
+ if (o[key2] === void 0) o[key2] = {};
26847
+ if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) o[key2] = {};
26848
+ if (o[key2] === Array.prototype) o[key2] = [];
26849
+ o = o[key2];
26850
+ }
26851
+ var key2 = keys[keys.length - 1];
26852
+ if (isConstructorOrProto(o, key2)) return;
26853
+ if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {};
26854
+ if (o === Array.prototype) o = [];
26855
+ if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") o[key2] = value2;
26856
+ else if (Array.isArray(o[key2])) o[key2].push(value2);
26857
+ else o[key2] = [o[key2], value2];
26858
+ }
26859
+ __name(setKey, "setKey");
26860
+ function aliasIsBoolean(key2) {
26861
+ return aliases[key2].some(function(x) {
26862
+ return flags.bools[x];
26863
+ });
26864
+ }
26865
+ __name(aliasIsBoolean, "aliasIsBoolean");
26866
+ for (var i$1 = 0; i$1 < args.length; i$1++) {
26867
+ var arg = args[i$1];
26868
+ if (/^--.+=/.test(arg)) {
26869
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
26870
+ var key = m[1];
26871
+ var value = m[2];
26872
+ if (flags.bools[key]) value = value !== "false";
26873
+ setArg(key, value, arg);
26874
+ } else if (/^--no-.+/.test(arg)) {
26875
+ var key = arg.match(/^--no-(.+)/)[1];
26876
+ setArg(key, false, arg);
26877
+ } else if (/^--.+/.test(arg)) {
26878
+ var key = arg.match(/^--(.+)/)[1];
26879
+ var next = args[i$1 + 1];
26880
+ if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
26881
+ setArg(key, next, arg);
26882
+ i$1++;
26883
+ } else if (/^(true|false)$/.test(next)) {
26884
+ setArg(key, next === "true", arg);
26885
+ i$1++;
26886
+ } else setArg(key, flags.strings[key] ? "" : true, arg);
26887
+ } else if (/^-[^-]+/.test(arg)) {
26888
+ var letters = arg.slice(1, -1).split("");
26889
+ var broken = false;
26890
+ for (var j = 0; j < letters.length; j++) {
26891
+ var next = arg.slice(j + 2);
26892
+ if (next === "-") {
26893
+ setArg(letters[j], next, arg);
26894
+ continue;
26895
+ }
26896
+ if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
26897
+ setArg(letters[j], next.split("=")[1], arg);
26898
+ broken = true;
26899
+ break;
26900
+ }
26901
+ if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
26902
+ setArg(letters[j], next, arg);
26903
+ broken = true;
26904
+ break;
26905
+ }
26906
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
26907
+ setArg(letters[j], arg.slice(j + 2), arg);
26908
+ broken = true;
26909
+ break;
26910
+ } else setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
26911
+ }
26912
+ var key = arg.slice(-1)[0];
26913
+ if (!broken && key !== "-") if (args[i$1 + 1] && !/^(-|--)[^-]/.test(args[i$1 + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
26914
+ setArg(key, args[i$1 + 1], arg);
26915
+ i$1++;
26916
+ } else if (args[i$1 + 1] && /^(true|false)$/.test(args[i$1 + 1])) {
26917
+ setArg(key, args[i$1 + 1] === "true", arg);
26918
+ i$1++;
26919
+ } else setArg(key, flags.strings[key] ? "" : true, arg);
26920
+ } else {
26921
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) argv$1._.push(flags.strings["_"] || !isNumber(arg) ? arg : Number(arg));
26922
+ if (opts.stopEarly) {
26923
+ argv$1._.push.apply(argv$1._, args.slice(i$1 + 1));
26924
+ break;
26925
+ }
26926
+ }
26927
+ }
26928
+ Object.keys(defaults).forEach(function(key2) {
26929
+ if (!hasKey(argv$1, key2.split("."))) {
26930
+ setKey(argv$1, key2.split("."), defaults[key2]);
26931
+ (aliases[key2] || []).forEach(function(x) {
26932
+ setKey(argv$1, x.split("."), defaults[key2]);
26933
+ });
26934
+ }
26935
+ });
26936
+ if (opts["--"]) {
26937
+ argv$1["--"] = new Array();
26938
+ notFlags.forEach(function(key2) {
26939
+ argv$1["--"].push(key2);
26940
+ });
26941
+ } else notFlags.forEach(function(key2) {
26942
+ argv$1._.push(key2);
26943
+ });
26944
+ return argv$1;
26945
+ };
26946
+ function hasKey(obj, keys) {
26947
+ var o = obj;
26948
+ keys.slice(0, -1).forEach(function(key2) {
26949
+ o = o[key2] || {};
26950
+ });
26951
+ return keys[keys.length - 1] in o;
26952
+ }
26953
+ __name(hasKey, "hasKey");
26954
+ function isNumber(x) {
26955
+ if (typeof x === "number") return true;
26956
+ if (/^0x[0-9a-f]+$/i.test(x)) return true;
26957
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
26958
+ }
26959
+ __name(isNumber, "isNumber");
26960
+ function isConstructorOrProto(obj, key) {
26961
+ return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
26962
+ }
26963
+ __name(isConstructorOrProto, "isConstructorOrProto");
26964
+ } });
26965
+ var require_rc = __commonJS({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1, module$1) {
26966
+ var cc = require_utils$1();
26967
+ var join2 = __require$1("path").join;
26968
+ var deepExtend = require_deep_extend();
26969
+ var etc = "/etc";
26970
+ var win = process.platform === "win32";
26971
+ var home = win ? process.env.USERPROFILE : process.env.HOME;
26972
+ module$1.exports = function(name, defaults, argv$1, parse$10) {
26973
+ if ("string" !== typeof name) throw new Error("rc(name): name *must* be string");
26974
+ if (!argv$1) argv$1 = require_minimist()(process.argv.slice(2));
26975
+ defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
26976
+ parse$10 = parse$10 || cc.parse;
26977
+ var env$1 = cc.env(name + "_");
26978
+ var configs = [defaults];
26979
+ var configFiles = [];
26980
+ function addConfigFile(file$1) {
26981
+ if (configFiles.indexOf(file$1) >= 0) return;
26982
+ var fileConfig = cc.file(file$1);
26983
+ if (fileConfig) {
26984
+ configs.push(parse$10(fileConfig));
26985
+ configFiles.push(file$1);
26986
+ }
26987
+ }
26988
+ __name(addConfigFile, "addConfigFile");
26989
+ if (!win) [join2(etc, name, "config"), join2(etc, name + "rc")].forEach(addConfigFile);
26990
+ if (home) [
26991
+ join2(home, ".config", name, "config"),
26992
+ join2(home, ".config", name),
26993
+ join2(home, "." + name, "config"),
26994
+ join2(home, "." + name + "rc")
26995
+ ].forEach(addConfigFile);
26996
+ addConfigFile(cc.find("." + name + "rc"));
26997
+ if (env$1.config) addConfigFile(env$1.config);
26998
+ if (argv$1.config) addConfigFile(argv$1.config);
26999
+ return deepExtend.apply(null, configs.concat([
27000
+ env$1,
27001
+ argv$1,
27002
+ configFiles.length ? {
27003
+ configs: configFiles,
27004
+ config: configFiles[configFiles.length - 1]
27005
+ } : void 0
27006
+ ]));
27007
+ };
27008
+ } });
27009
+ var require_registry_url = __commonJS({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1, module$1) {
27010
+ module$1.exports = function(scope) {
27011
+ var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
27012
+ var url = rc[scope + ":registry"] || rc.registry;
27013
+ return url.slice(-1) === "/" ? url : url + "/";
27014
+ };
27015
+ } });
27016
+ var require_safe_buffer = __commonJS({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1, module$1) {
27017
+ var buffer$1 = __require$1("buffer");
27018
+ var Buffer2 = buffer$1.Buffer;
27019
+ function copyProps(src$1, dst) {
27020
+ for (var key in src$1) dst[key] = src$1[key];
27021
+ }
27022
+ __name(copyProps, "copyProps");
27023
+ if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) module$1.exports = buffer$1;
27024
+ else {
27025
+ copyProps(buffer$1, exports$1);
27026
+ exports$1.Buffer = SafeBuffer;
27027
+ }
27028
+ function SafeBuffer(arg, encodingOrOffset, length) {
27029
+ return Buffer2(arg, encodingOrOffset, length);
27030
+ }
27031
+ __name(SafeBuffer, "SafeBuffer");
27032
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
27033
+ copyProps(Buffer2, SafeBuffer);
27034
+ SafeBuffer.from = function(arg, encodingOrOffset, length) {
27035
+ if (typeof arg === "number") throw new TypeError("Argument must not be a number");
27036
+ return Buffer2(arg, encodingOrOffset, length);
27037
+ };
27038
+ SafeBuffer.alloc = function(size, fill$2, encoding) {
27039
+ if (typeof size !== "number") throw new TypeError("Argument must be a number");
27040
+ var buf = Buffer2(size);
27041
+ if (fill$2 !== void 0) if (typeof encoding === "string") buf.fill(fill$2, encoding);
27042
+ else buf.fill(fill$2);
27043
+ else buf.fill(0);
27044
+ return buf;
27045
+ };
27046
+ SafeBuffer.allocUnsafe = function(size) {
27047
+ if (typeof size !== "number") throw new TypeError("Argument must be a number");
27048
+ return Buffer2(size);
27049
+ };
27050
+ SafeBuffer.allocUnsafeSlow = function(size) {
27051
+ if (typeof size !== "number") throw new TypeError("Argument must be a number");
27052
+ return buffer$1.SlowBuffer(size);
27053
+ };
27054
+ } });
27055
+ var require_base64 = __commonJS({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1, module$1) {
27056
+ var safeBuffer = require_safe_buffer().Buffer;
27057
+ function decodeBase64(base64$1) {
27058
+ return safeBuffer.from(base64$1, "base64").toString("utf8");
27059
+ }
27060
+ __name(decodeBase64, "decodeBase64");
27061
+ function encodeBase64(string) {
27062
+ return safeBuffer.from(string, "utf8").toString("base64");
27063
+ }
27064
+ __name(encodeBase64, "encodeBase64");
27065
+ module$1.exports = {
27066
+ decodeBase64,
27067
+ encodeBase64
27068
+ };
27069
+ } });
27070
+ var require_registry_auth_token = __commonJS({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1, module$1) {
27071
+ var url = __require$1("url");
27072
+ var base64$1 = require_base64();
27073
+ var decodeBase64 = base64$1.decodeBase64;
27074
+ var encodeBase64 = base64$1.encodeBase64;
27075
+ var tokenKey = ":_authToken";
27076
+ var userKey = ":username";
27077
+ var passwordKey = ":_password";
27078
+ module$1.exports = function() {
27079
+ var checkUrl;
27080
+ var options;
27081
+ if (arguments.length >= 2) {
27082
+ checkUrl = arguments[0];
27083
+ options = arguments[1];
27084
+ } else if (typeof arguments[0] === "string") checkUrl = arguments[0];
27085
+ else options = arguments[0];
27086
+ options = options || {};
27087
+ options.npmrc = options.npmrc || require_rc()("npm", { registry: "https://registry.npmjs.org/" });
27088
+ checkUrl = checkUrl || options.npmrc.registry;
27089
+ return getRegistryAuthInfo(checkUrl, options) || getLegacyAuthInfo(options.npmrc);
27090
+ };
27091
+ function getRegistryAuthInfo(checkUrl, options) {
27092
+ var parsed = url.parse(checkUrl, false, true);
27093
+ var pathname;
27094
+ while (pathname !== "/" && parsed.pathname !== pathname) {
27095
+ pathname = parsed.pathname || "/";
27096
+ var authInfo = getAuthInfoForUrl("//" + parsed.host + pathname.replace(/\/$/, ""), options.npmrc);
27097
+ if (authInfo) return authInfo;
27098
+ if (!options.recursive) return /\/$/.test(checkUrl) ? void 0 : getRegistryAuthInfo(url.resolve(checkUrl, "."), options);
27099
+ parsed.pathname = url.resolve(normalizePath$2(pathname), "..") || "/";
27100
+ }
27101
+ }
27102
+ __name(getRegistryAuthInfo, "getRegistryAuthInfo");
27103
+ function getLegacyAuthInfo(npmrc) {
27104
+ if (npmrc._auth) return {
27105
+ token: npmrc._auth,
27106
+ type: "Basic"
27107
+ };
27108
+ }
27109
+ __name(getLegacyAuthInfo, "getLegacyAuthInfo");
27110
+ function normalizePath$2(path5) {
27111
+ return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
27112
+ }
27113
+ __name(normalizePath$2, "normalizePath");
27114
+ function getAuthInfoForUrl(regUrl, npmrc) {
27115
+ var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
27116
+ if (bearerAuth) return bearerAuth;
27117
+ var basicAuth = getTokenForUsernameAndPassword(npmrc[regUrl + userKey] || npmrc[regUrl + "/" + userKey], npmrc[regUrl + passwordKey] || npmrc[regUrl + "/" + passwordKey]);
27118
+ if (basicAuth) return basicAuth;
27119
+ }
27120
+ __name(getAuthInfoForUrl, "getAuthInfoForUrl");
27121
+ function getBearerToken(tok) {
27122
+ if (!tok) return;
27123
+ return {
27124
+ token: tok.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
27125
+ return process.env[envVar];
27126
+ }),
27127
+ type: "Bearer"
27128
+ };
27129
+ }
27130
+ __name(getBearerToken, "getBearerToken");
27131
+ function getTokenForUsernameAndPassword(username, password) {
27132
+ if (!username || !password) return;
27133
+ var pass = decodeBase64(password.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
27134
+ return process.env[envVar];
27135
+ }));
27136
+ return {
27137
+ token: encodeBase64(username + ":" + pass),
27138
+ type: "Basic",
27139
+ password: pass,
27140
+ username
27141
+ };
27142
+ }
27143
+ __name(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
27144
+ } });
27145
+ var require_update_check = __commonJS({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
27146
+ var { URL: URL2 } = __require$1("url");
27147
+ var { join: join2 } = __require$1("path");
27148
+ var fs3 = __require$1("fs");
27149
+ var { promisify: promisify$3 } = __require$1("util");
27150
+ var { tmpdir } = __require$1("os");
27151
+ var registryUrl = require_registry_url();
27152
+ var writeFile$1 = promisify$3(fs3.writeFile);
27153
+ var mkdir$1 = promisify$3(fs3.mkdir);
27154
+ var readFile$1 = promisify$3(fs3.readFile);
27155
+ var compareVersions = /* @__PURE__ */ __name((a, b) => a.localeCompare(b, "en-US", { numeric: true }), "compareVersions");
27156
+ var encode$2 = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
27157
+ var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
27158
+ const subDir = join2(tmpdir(), "update-check");
27159
+ if (!fs3.existsSync(subDir)) await mkdir$1(subDir);
27160
+ let name = `${details.name}-${distTag}.json`;
27161
+ if (details.scope) name = `${details.scope}-${name}`;
27162
+ return join2(subDir, name);
27163
+ }, "getFile");
27164
+ var evaluateCache = /* @__PURE__ */ __name(async (file$1, time, interval) => {
27165
+ if (fs3.existsSync(file$1)) {
27166
+ const content = await readFile$1(file$1, "utf8");
27167
+ const { lastUpdate, latest } = JSON.parse(content);
27168
+ if (lastUpdate + interval > time) return {
27169
+ shouldCheck: false,
27170
+ latest
27171
+ };
27172
+ }
27173
+ return {
27174
+ shouldCheck: true,
27175
+ latest: null
27176
+ };
27177
+ }, "evaluateCache");
27178
+ var updateCache = /* @__PURE__ */ __name(async (file$1, latest, lastUpdate) => {
27179
+ await writeFile$1(file$1, JSON.stringify({
27180
+ latest,
27181
+ lastUpdate
27182
+ }), "utf8");
27183
+ }, "updateCache");
27184
+ var loadPackage = /* @__PURE__ */ __name((url, authInfo) => new Promise((resolve$4, reject) => {
27185
+ const options = {
27186
+ host: url.hostname,
27187
+ path: url.pathname,
27188
+ port: url.port,
27189
+ headers: { accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*" },
27190
+ timeout: 2e3
27191
+ };
27192
+ if (authInfo) options.headers.authorization = `${authInfo.type} ${authInfo.token}`;
27193
+ const { get } = url.protocol === "https:" ? __require$1("https") : __require$1("http");
27194
+ get(options, (response) => {
27195
+ const { statusCode } = response;
27196
+ if (statusCode !== 200) {
27197
+ const error = /* @__PURE__ */ new Error(`Request failed with code ${statusCode}`);
27198
+ error.code = statusCode;
27199
+ reject(error);
27200
+ response.resume();
27201
+ return;
27202
+ }
27203
+ let rawData = "";
27204
+ response.setEncoding("utf8");
27205
+ response.on("data", (chunk) => {
27206
+ rawData += chunk;
27207
+ });
27208
+ response.on("end", () => {
27209
+ try {
27210
+ resolve$4(JSON.parse(rawData));
27211
+ } catch (e2) {
27212
+ reject(e2);
27213
+ }
27214
+ });
27215
+ }).on("error", reject).on("timeout", reject);
27216
+ }), "loadPackage");
27217
+ var getMostRecent = /* @__PURE__ */ __name(async ({ full, scope }, distTag) => {
27218
+ const regURL = registryUrl(scope);
27219
+ const url = new URL2(full, regURL);
27220
+ let spec = null;
27221
+ try {
27222
+ spec = await loadPackage(url);
27223
+ } catch (err) {
27224
+ if (err.code && String(err.code).startsWith(4)) spec = await loadPackage(url, require_registry_auth_token()(regURL, { recursive: true }));
27225
+ else throw err;
27226
+ }
27227
+ const version$2 = spec["dist-tags"][distTag];
27228
+ if (!version$2) throw new Error(`Distribution tag ${distTag} is not available`);
27229
+ return version$2;
27230
+ }, "getMostRecent");
27231
+ var defaultConfig = {
27232
+ interval: 36e5,
27233
+ distTag: "latest"
27234
+ };
27235
+ var getDetails = /* @__PURE__ */ __name((name) => {
27236
+ const spec = { full: encode$2(name) };
27237
+ if (name.includes("/")) {
27238
+ const parts = name.split("/");
27239
+ spec.scope = parts[0];
27240
+ spec.name = parts[1];
27241
+ } else {
27242
+ spec.scope = null;
27243
+ spec.name = name;
27244
+ }
27245
+ return spec;
27246
+ }, "getDetails");
27247
+ module$1.exports = async (pkg, config) => {
27248
+ if (typeof pkg !== "object") throw new Error("The first parameter should be your package.json file content");
27249
+ const details = getDetails(pkg.name);
27250
+ const time = Date.now();
27251
+ const { distTag, interval } = Object.assign({}, defaultConfig, config);
27252
+ const file$1 = await getFile(details, distTag);
27253
+ let latest = null;
27254
+ let shouldCheck = true;
27255
+ ({shouldCheck, latest} = await evaluateCache(file$1, time, interval));
27256
+ if (shouldCheck) {
27257
+ latest = await getMostRecent(details, distTag);
27258
+ await updateCache(file$1, latest, time);
27259
+ }
27260
+ if (compareVersions(pkg.version, latest) === -1) return {
27261
+ latest,
27262
+ fromCache: !shouldCheck
27263
+ };
27264
+ return null;
27265
+ };
27266
+ } });
26340
27267
  var defaultWranglerConfig = {
26341
27268
  configPath: void 0,
26342
27269
  userConfigPath: void 0,
@@ -26374,6 +27301,8 @@ var defaultWranglerConfig = {
26374
27301
  vectorize: [],
26375
27302
  ai_search_namespaces: [],
26376
27303
  ai_search: [],
27304
+ web_search: void 0,
27305
+ agent_memory: [],
26377
27306
  hyperdrive: [],
26378
27307
  workflows: [],
26379
27308
  secrets_store_secrets: [],
@@ -26728,8 +27657,8 @@ function getErrorMap$1() {
26728
27657
  }
26729
27658
  __name(getErrorMap$1, "getErrorMap");
26730
27659
  var makeIssue$1 = /* @__PURE__ */ __name((params) => {
26731
- const { data: data$1, path: path4, errorMaps, issueData } = params;
26732
- const fullPath = [...path4, ...issueData.path || []];
27660
+ const { data: data$1, path: path5, errorMaps, issueData } = params;
27661
+ const fullPath = [...path5, ...issueData.path || []];
26733
27662
  const fullIssue = {
26734
27663
  ...issueData,
26735
27664
  path: fullPath
@@ -26833,11 +27762,11 @@ var ParseInputLazyPath$1 = class {
26833
27762
  static {
26834
27763
  __name(this, "ParseInputLazyPath");
26835
27764
  }
26836
- constructor(parent, value, path4, key) {
27765
+ constructor(parent, value, path5, key) {
26837
27766
  this._cachedPath = [];
26838
27767
  this.parent = parent;
26839
27768
  this.data = value;
26840
- this._path = path4;
27769
+ this._path = path5;
26841
27770
  this._key = key;
26842
27771
  }
26843
27772
  get path() {
@@ -30004,7 +30933,7 @@ __reExport(mod_esm_exports, __toESM(require_mod_cjs3(), 1));
30004
30933
  var mod_esm_default = import_mod_cjs.default;
30005
30934
  function getGlobalWranglerConfigPath() {
30006
30935
  const configDir = mod_esm_default(".wrangler").config();
30007
- const legacyConfigDir = path.join(os.homedir(), ".wrangler");
30936
+ const legacyConfigDir = path3.join(os.homedir(), ".wrangler");
30008
30937
  if (isDirectory(legacyConfigDir)) return legacyConfigDir;
30009
30938
  else return configDir;
30010
30939
  }
@@ -30049,7 +30978,10 @@ var getC3CommandFromEnv = getEnvironmentVariableFactory({
30049
30978
  defaultValue: /* @__PURE__ */ __name(() => "create cloudflare", "defaultValue")
30050
30979
  });
30051
30980
  var getWranglerSendMetricsFromEnv = getBooleanEnvironmentVariableFactory({ variableName: "WRANGLER_SEND_METRICS" });
30052
- var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({ variableName: "WRANGLER_SEND_ERROR_REPORTS" });
30981
+ var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
30982
+ variableName: "WRANGLER_SEND_ERROR_REPORTS",
30983
+ defaultValue: false
30984
+ });
30053
30985
  var getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory({
30054
30986
  variableName: "WRANGLER_API_ENVIRONMENT",
30055
30987
  defaultValue: /* @__PURE__ */ __name(() => "production", "defaultValue"),
@@ -30100,7 +31032,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
30100
31032
  var getRegistryPath = getEnvironmentVariableFactory({
30101
31033
  variableName: "WRANGLER_REGISTRY_PATH",
30102
31034
  defaultValue() {
30103
- return path.join(getGlobalWranglerConfigPath(), "registry");
31035
+ return path3.join(getGlobalWranglerConfigPath(), "registry");
30104
31036
  }
30105
31037
  });
30106
31038
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
@@ -30242,9 +31174,9 @@ Please add "${field}" to "env.${envName}".`);
30242
31174
  return rawEnv[field] ?? defaultValue;
30243
31175
  }
30244
31176
  __name(notInheritable, "notInheritable");
30245
- function unwindPropertyPath(root, path4) {
31177
+ function unwindPropertyPath(root, path5) {
30246
31178
  let container = root;
30247
- const parts = path4.split(".");
31179
+ const parts = path5.split(".");
30248
31180
  for (let i$1 = 0; i$1 < parts.length - 1; i$1++) {
30249
31181
  if (!hasProperty(container, parts[i$1])) return;
30250
31182
  container = container[parts[i$1]];
@@ -30419,6 +31351,8 @@ var friendlyBindingNames = {
30419
31351
  vectorize: "Vectorize Index",
30420
31352
  ai_search_namespaces: "AI Search Namespace",
30421
31353
  ai_search: "AI Search Instance",
31354
+ web_search: "Web Search",
31355
+ agent_memory: "Agent Memory",
30422
31356
  hyperdrive: "Hyperdrive Config",
30423
31357
  r2_buckets: "R2 Bucket",
30424
31358
  logfwdr: "logfwdr",
@@ -30470,6 +31404,8 @@ var bindingTypeFriendlyNames = {
30470
31404
  vectorize: "Vectorize Index",
30471
31405
  ai_search_namespace: "AI Search Namespace",
30472
31406
  ai_search: "AI Search Instance",
31407
+ web_search: "Web Search",
31408
+ agent_memory: "Agent Memory",
30473
31409
  hyperdrive: "Hyperdrive Config",
30474
31410
  service: "Worker",
30475
31411
  fetcher: "Service Binding",
@@ -30512,7 +31448,7 @@ function isPagesConfig(rawConfig) {
30512
31448
  }
30513
31449
  __name(isPagesConfig, "isPagesConfig");
30514
31450
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
30515
- const diagnostics = new Diagnostics(`Processing ${configPath ? path.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31451
+ const diagnostics = new Diagnostics(`Processing ${configPath ? path3.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
30516
31452
  validateOptionalProperty(diagnostics, "", "legacy_env", rawConfig.legacy_env, "boolean");
30517
31453
  validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
30518
31454
  validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
@@ -30616,34 +31552,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
30616
31552
  else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
30617
31553
  return {
30618
31554
  command,
30619
- 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,
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,
30620
31556
  cwd
30621
31557
  };
30622
31558
  }
30623
31559
  __name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
30624
31560
  function normalizeAndValidateMainField(configPath, rawMain) {
30625
- const configDir = path.dirname(configPath ?? "wrangler.toml");
31561
+ const configDir = path3.dirname(configPath ?? "wrangler.toml");
30626
31562
  if (rawMain !== void 0) if (typeof rawMain === "string") {
30627
- const directory = path.resolve(configDir);
30628
- return path.resolve(directory, rawMain);
31563
+ const directory = path3.resolve(configDir);
31564
+ return path3.resolve(directory, rawMain);
30629
31565
  } else return rawMain;
30630
31566
  else return;
30631
31567
  }
30632
31568
  __name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
30633
31569
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
30634
- const configDir = path.dirname(configPath ?? "wrangler.toml");
31570
+ const configDir = path3.dirname(configPath ?? "wrangler.toml");
30635
31571
  if (rawDir !== void 0) if (typeof rawDir === "string") {
30636
- const directory = path.resolve(configDir);
30637
- return path.resolve(directory, rawDir);
31572
+ const directory = path3.resolve(configDir);
31573
+ return path3.resolve(directory, rawDir);
30638
31574
  } else return rawDir;
30639
31575
  else return;
30640
31576
  }
30641
31577
  __name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
30642
31578
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
30643
- const configDir = path.dirname(configPath ?? "wrangler.toml");
31579
+ const configDir = path3.dirname(configPath ?? "wrangler.toml");
30644
31580
  if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
30645
- const directory = path.resolve(configDir);
30646
- return path.resolve(directory, rawPagesDir);
31581
+ const directory = path3.resolve(configDir);
31582
+ return path3.resolve(directory, rawPagesDir);
30647
31583
  } else return rawPagesDir;
30648
31584
  else return;
30649
31585
  }
@@ -30696,7 +31632,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
30696
31632
  validateOptionalProperty(diagnostics, "site", "entry-point", rawConfig.site["entry-point"], "string");
30697
31633
  deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
30698
31634
  \`\`\`
30699
- main = "${path.join(String(rawConfig.site["entry-point"]) || "workers-site", path.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js")}"
31635
+ main = "${path3.join(String(rawConfig.site["entry-point"]) || "workers-site", path3.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js")}"
30700
31636
  \`\`\``, false, void 0, "warning");
30701
31637
  let siteEntryPoint = rawConfig.site["entry-point"];
30702
31638
  if (!mainEntryPoint && !siteEntryPoint) {
@@ -30709,7 +31645,7 @@ main = "workers-site/index.js"
30709
31645
  } else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
30710
31646
  They serve the same purpose: to point to the entry-point of your worker.
30711
31647
  Delete the deprecated \`site.entry-point\` field from your config.`);
30712
- if (configPath && siteEntryPoint) siteEntryPoint = path.relative(process.cwd(), path.join(path.dirname(configPath), siteEntryPoint));
31648
+ if (configPath && siteEntryPoint) siteEntryPoint = path3.relative(process.cwd(), path3.join(path3.dirname(configPath), siteEntryPoint));
30713
31649
  return {
30714
31650
  bucket,
30715
31651
  "entry-point": siteEntryPoint,
@@ -30741,7 +31677,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
30741
31677
  if (rawMapping === void 0) return;
30742
31678
  const mapping = {};
30743
31679
  for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
30744
- if (configPath) mapping[name] = configPath ? path.relative(process.cwd(), path.join(path.dirname(configPath), filePath)) : filePath;
31680
+ if (configPath) mapping[name] = configPath ? path3.relative(process.cwd(), path3.join(path3.dirname(configPath), filePath)) : filePath;
30745
31681
  }
30746
31682
  return mapping;
30747
31683
  }
@@ -30946,6 +31882,8 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
30946
31882
  vectorize: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vectorize", validateBindingArray(envName, validateVectorizeBinding), []),
30947
31883
  ai_search_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search_namespaces", validateBindingArray(envName, validateAISearchNamespaceBinding), []),
30948
31884
  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),
31886
+ agent_memory: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "agent_memory", validateBindingArray(envName, validateAgentMemoryBinding), []),
30949
31887
  hyperdrive: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "hyperdrive", validateBindingArray(envName, validateHyperdriveBinding), []),
30950
31888
  services: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "services", validateBindingArray(envName, validateServiceBinding), []),
30951
31889
  analytics_engine_datasets: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "analytics_engine_datasets", validateBindingArray(envName, validateAnalyticsEngineBinding), []),
@@ -30989,7 +31927,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
30989
31927
  __name(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
30990
31928
  function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
30991
31929
  const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
30992
- return configPath && tsconfig ? path.relative(process.cwd(), path.join(path.dirname(configPath), tsconfig)) : tsconfig;
31930
+ return configPath && tsconfig ? path3.relative(process.cwd(), path3.join(path3.dirname(configPath), tsconfig)) : tsconfig;
30993
31931
  }
30994
31932
  __name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
30995
31933
  var validateAndNormalizeRules = /* @__PURE__ */ __name((diagnostics, topLevelEnv, rawEnv, envName) => {
@@ -31245,24 +32183,24 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
31245
32183
  diagnostics.errors.push(`"${field}" bindings should, optionally, have a boolean "remote" field but got ${JSON.stringify(value)}.`);
31246
32184
  isValid2 = false;
31247
32185
  }
31248
- if (hasProperty(value, "schedule") && value.schedule !== void 0) if (typeof value.schedule === "string") {
31249
- if (value.schedule.length === 0) {
31250
- diagnostics.errors.push(`"${field}" bindings "schedule" field must not be an empty string.`);
32186
+ if (hasProperty(value, "schedules") && value.schedules !== void 0) if (typeof value.schedules === "string") {
32187
+ if (value.schedules.length === 0) {
32188
+ diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty string.`);
31251
32189
  isValid2 = false;
31252
32190
  }
31253
- } else if (Array.isArray(value.schedule)) {
31254
- if (value.schedule.length === 0) {
31255
- diagnostics.errors.push(`"${field}" bindings "schedule" field must not be an empty array.`);
32191
+ } else if (Array.isArray(value.schedules)) {
32192
+ if (value.schedules.length === 0) {
32193
+ diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty array.`);
31256
32194
  isValid2 = false;
31257
- } else if (!value.schedule.every((s) => typeof s === "string")) {
31258
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedule" field but got ${JSON.stringify(value)}.`);
32195
+ } else if (!value.schedules.every((s) => typeof s === "string")) {
32196
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
31259
32197
  isValid2 = false;
31260
- } else if (value.schedule.some((s) => s === "")) {
31261
- diagnostics.errors.push(`"${field}" bindings "schedule" field must not contain empty strings.`);
32198
+ } else if (value.schedules.some((s) => s === "")) {
32199
+ diagnostics.errors.push(`"${field}" bindings "schedules" field must not contain empty strings.`);
31262
32200
  isValid2 = false;
31263
32201
  }
31264
32202
  } else {
31265
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedule" field but got ${JSON.stringify(value)}.`);
32203
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
31266
32204
  isValid2 = false;
31267
32205
  }
31268
32206
  if (hasProperty(value, "limits") && value.limits !== void 0) if (typeof value.limits !== "object" || value.limits === null || Array.isArray(value.limits)) {
@@ -31285,7 +32223,7 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
31285
32223
  "script_name",
31286
32224
  "remote",
31287
32225
  "limits",
31288
- "schedule"
32226
+ "schedules"
31289
32227
  ]);
31290
32228
  return isValid2;
31291
32229
  }, "validateWorkflowBinding");
@@ -31413,6 +32351,8 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
31413
32351
  "ai",
31414
32352
  "ai_search_namespace",
31415
32353
  "ai_search",
32354
+ "web_search",
32355
+ "agent_memory",
31416
32356
  "kv_namespace",
31417
32357
  "durable_object_namespace",
31418
32358
  "d1_database",
@@ -31487,9 +32427,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
31487
32427
  let resolvedBuildContextPath = void 0;
31488
32428
  try {
31489
32429
  if (isDockerfile(resolvedImage, configPath)) {
31490
- const baseDir = configPath ? path.dirname(configPath) : process.cwd();
31491
- resolvedImage = path.resolve(baseDir, resolvedImage);
31492
- resolvedBuildContextPath = containerAppOptional.image_build_context ? path.resolve(baseDir, containerAppOptional.image_build_context) : path.dirname(resolvedImage);
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);
31493
32433
  }
31494
32434
  } catch (err) {
31495
32435
  if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
@@ -31921,6 +32861,28 @@ var validateAISearchBinding = /* @__PURE__ */ __name((diagnostics, field, value)
31921
32861
  ]);
31922
32862
  return isValid2;
31923
32863
  }, "validateAISearchBinding");
32864
+ var validateAgentMemoryBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
32865
+ if (typeof value !== "object" || value === null) {
32866
+ diagnostics.errors.push(`"agent_memory" bindings should be objects, but got ${JSON.stringify(value)}`);
32867
+ return false;
32868
+ }
32869
+ let isValid2 = true;
32870
+ if (!isRequiredProperty(value, "binding", "string")) {
32871
+ diagnostics.errors.push(`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(value)}.`);
32872
+ isValid2 = false;
32873
+ }
32874
+ if (!isRequiredProperty(value, "namespace", "string")) {
32875
+ diagnostics.errors.push(`"${field}" bindings must have a "namespace" field but got ${JSON.stringify(value)}.`);
32876
+ isValid2 = false;
32877
+ }
32878
+ if (!isRemoteValid(value, field, diagnostics)) isValid2 = false;
32879
+ validateAdditionalProperties(diagnostics, field, Object.keys(value), [
32880
+ "binding",
32881
+ "namespace",
32882
+ "remote"
32883
+ ]);
32884
+ return isValid2;
32885
+ }, "validateAgentMemoryBinding");
31924
32886
  var validateHyperdriveBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
31925
32887
  if (typeof value !== "object" || value === null) {
31926
32888
  diagnostics.errors.push(`"hyperdrive" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -32231,13 +33193,19 @@ var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value)
32231
33193
  diagnostics.errors.push(`"${field}" bindings must have a string "binding" field but got ${JSON.stringify(value)}.`);
32232
33194
  isValid2 = false;
32233
33195
  }
32234
- if (!isRequiredProperty(value, "pipeline", "string")) {
32235
- diagnostics.errors.push(`"${field}" bindings must have a string "pipeline" field but got ${JSON.stringify(value)}.`);
33196
+ const hasStream = isOptionalProperty(value, "stream", "string");
33197
+ const hasPipeline = isOptionalProperty(value, "pipeline", "string");
33198
+ const v = value;
33199
+ if (hasStream && v.stream);
33200
+ else if (hasPipeline && v.pipeline) diagnostics.warnings.push(`The "pipeline" field in "${field}" bindings is deprecated. Use "stream" instead.`);
33201
+ else {
33202
+ diagnostics.errors.push(`"${field}" bindings must have a string "stream" field but got ${JSON.stringify(value)}.`);
32236
33203
  isValid2 = false;
32237
33204
  }
32238
33205
  if (!isRemoteValid(value, field, diagnostics)) isValid2 = false;
32239
33206
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
32240
33207
  "binding",
33208
+ "stream",
32241
33209
  "pipeline",
32242
33210
  "remote"
32243
33211
  ]);
@@ -32628,9 +33596,9 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
32628
33596
  }
32629
33597
  __name(isRemoteValid, "isRemoteValid");
32630
33598
  function isDockerfile(imagePath, configPath) {
32631
- const baseDir = configPath ? path.dirname(configPath) : process.cwd();
32632
- const maybeDockerfile = path.resolve(baseDir, imagePath);
32633
- if (fs.existsSync(maybeDockerfile)) {
33599
+ const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
33600
+ const maybeDockerfile = path3.resolve(baseDir, imagePath);
33601
+ if (fs2.existsSync(maybeDockerfile)) {
32634
33602
  if (isDirectory(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
32635
33603
  return true;
32636
33604
  }
@@ -32648,6 +33616,55 @@ function isDockerfile(imagePath, configPath) {
32648
33616
  return false;
32649
33617
  }
32650
33618
  __name(isDockerfile, "isDockerfile");
33619
+ var BINDING_LOCAL_SUPPORT = {
33620
+ plain_text: "local-only",
33621
+ secret_text: "local-only",
33622
+ json: "local-only",
33623
+ wasm_module: "local-only",
33624
+ text_blob: "local-only",
33625
+ data_blob: "local-only",
33626
+ version_metadata: "local-only",
33627
+ inherit: "local-only",
33628
+ logfwdr: "local-only",
33629
+ assets: "local-only",
33630
+ unsafe_hello_world: "local-only",
33631
+ durable_object_namespace: "local-only",
33632
+ hyperdrive: "local-only",
33633
+ fetcher: "local-only",
33634
+ analytics_engine: "local-only",
33635
+ secrets_store_secret: "local-only",
33636
+ ratelimit: "local-only",
33637
+ worker_loader: "local-only",
33638
+ kv_namespace: "local-and-remote",
33639
+ r2_bucket: "local-and-remote",
33640
+ d1: "local-and-remote",
33641
+ workflow: "local-and-remote",
33642
+ browser: "local-and-remote",
33643
+ images: "local-and-remote",
33644
+ stream: "local-and-remote",
33645
+ send_email: "local-and-remote",
33646
+ pipeline: "local-and-remote",
33647
+ service: "local-and-remote",
33648
+ queue: "local-and-remote",
33649
+ vectorize: "remote",
33650
+ mtls_certificate: "remote",
33651
+ dispatch_namespace: "remote",
33652
+ ai: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33653
+ ai_search: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33654
+ ai_search_namespace: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33655
+ media: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33656
+ artifacts: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33657
+ flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33658
+ vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
33659
+ 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",
33661
+ agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
33662
+ };
33663
+ function getBindingLocalSupport(type) {
33664
+ if (type in BINDING_LOCAL_SUPPORT) return BINDING_LOCAL_SUPPORT[type];
33665
+ return "local-only";
33666
+ }
33667
+ __name(getBindingLocalSupport, "getBindingLocalSupport");
32651
33668
  var supportedPagesConfigFields = [
32652
33669
  "pages_build_output_dir",
32653
33670
  "name",
@@ -32729,6 +33746,54 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
32729
33746
  }
32730
33747
  }
32731
33748
  __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
33749
+ var import_signal_exit = __toESM(require_signal_exit());
33750
+ function getWranglerHiddenDirPath(projectRoot) {
33751
+ projectRoot ??= process.cwd();
33752
+ return path3.join(projectRoot, ".wrangler");
33753
+ }
33754
+ __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
33755
+ var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
33756
+ var sweptTmpRoots = /* @__PURE__ */ new Set();
33757
+ function sweepStaleWranglerTmpDirs(tmpRoot) {
33758
+ if (sweptTmpRoots.has(tmpRoot)) return;
33759
+ sweptTmpRoots.add(tmpRoot);
33760
+ let entries;
33761
+ try {
33762
+ entries = fs2.readdirSync(tmpRoot, { withFileTypes: true });
33763
+ } catch {
33764
+ return;
33765
+ }
33766
+ const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
33767
+ for (const entry of entries) {
33768
+ if (!entry.isDirectory()) continue;
33769
+ const entryPath = path3.join(tmpRoot, entry.name);
33770
+ try {
33771
+ if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync(entryPath);
33772
+ } catch {}
33773
+ }
33774
+ }
33775
+ __name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
33776
+ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
33777
+ const tmpRoot = path3.join(getWranglerHiddenDirPath(projectRoot), "tmp");
33778
+ fs2.mkdirSync(tmpRoot, { recursive: true });
33779
+ sweepStaleWranglerTmpDirs(tmpRoot);
33780
+ const tmpPrefix = path3.join(tmpRoot, `${prefix}-`);
33781
+ const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
33782
+ const cleanupDir = /* @__PURE__ */ __name(() => {
33783
+ if (cleanup) try {
33784
+ removeDirSync(tmpDir);
33785
+ } catch {}
33786
+ }, "cleanupDir");
33787
+ const removeExitListener = (0, import_signal_exit.default)(cleanupDir);
33788
+ return {
33789
+ path: tmpDir,
33790
+ remove() {
33791
+ removeExitListener();
33792
+ cleanupDir();
33793
+ }
33794
+ };
33795
+ }
33796
+ __name(getWranglerTmpDir, "getWranglerTmpDir");
32732
33797
  var import_command_exists = __toESM(require_command_exists2());
32733
33798
  var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
32734
33799
  var CLOUDFLARED_VERSION_PATTERN = /^\d{4}\.\d+\.\d+$/;
@@ -33013,15 +34078,7 @@ Please ensure you have write permissions to: ${cacheDir}`, { telemetryMessage: "
33013
34078
  __name(downloadCloudflared, "downloadCloudflared");
33014
34079
  async function downloadAndExtractTarball(response, expectedChecksum, binPath, cacheDir) {
33015
34080
  const tempTarPath = join(cacheDir, "cloudflared.tgz");
33016
- const buffer$1 = Buffer.from(await response.arrayBuffer());
33017
- if (expectedChecksum) {
33018
- const actualSha256 = sha256Hex(buffer$1);
33019
- if (actualSha256 !== expectedChecksum) throw new UserError(`[cloudflared] SHA256 mismatch for downloaded cloudflared tarball.
33020
-
33021
- Expected: ${expectedChecksum}
33022
- Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared tarball checksum mismatch" });
33023
- }
33024
- writeFileSync(tempTarPath, buffer$1);
34081
+ writeFileSync(tempTarPath, Buffer.from(await response.arrayBuffer()));
33025
34082
  try {
33026
34083
  execFileSync("tar", [
33027
34084
  "-xzf",
@@ -33031,6 +34088,13 @@ Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared tarball chec
33031
34088
  ], { stdio: "ignore" });
33032
34089
  const extractedPath = join(cacheDir, "cloudflared");
33033
34090
  if (extractedPath !== binPath && existsSync(extractedPath)) renameSync(extractedPath, binPath);
34091
+ if (expectedChecksum) {
34092
+ const actualSha256 = sha256Hex(readFileSync(binPath));
34093
+ if (actualSha256 !== expectedChecksum) throw new UserError(`[cloudflared] SHA256 mismatch for downloaded cloudflared binary.
34094
+
34095
+ Expected: ${expectedChecksum}
34096
+ Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared extracted binary checksum mismatch" });
34097
+ }
33034
34098
  } finally {
33035
34099
  try {
33036
34100
  if (existsSync(tempTarPath)) unlinkSync(tempTarPath);
@@ -33305,6 +34369,27 @@ The local dev server started at ${origin.href}.
33305
34369
  return new Error(errorMessage);
33306
34370
  }
33307
34371
  __name(createTunnelStartupError, "createTunnelStartupError");
34372
+ var import_update_check = __toESM(require_update_check());
34373
+ var UPDATE_CHECK_TIMEOUT_MS = 3e3;
34374
+ var TIMED_OUT = Symbol("timed_out");
34375
+ async function fetchLatestNpmVersion(name, version$2) {
34376
+ let result = null;
34377
+ try {
34378
+ result = await Promise.race([(0, import_update_check.default)({
34379
+ name,
34380
+ version: version$2
34381
+ }, { distTag: version$2.startsWith("0.0.0") ? "beta" : "latest" }), timersPromises.setTimeout(UPDATE_CHECK_TIMEOUT_MS, TIMED_OUT, { ref: false })]);
34382
+ } catch {
34383
+ return { status: "failed" };
34384
+ }
34385
+ if (result === TIMED_OUT) return { status: "failed" };
34386
+ if (result === null) return { status: "up-to-date" };
34387
+ return {
34388
+ status: "update-available",
34389
+ latest: result.latest
34390
+ };
34391
+ }
34392
+ __name(fetchLatestNpmVersion, "fetchLatestNpmVersion");
33308
34393
 
33309
34394
  //#endregion
33310
34395
  //#region ../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js
@@ -35271,6 +36356,7 @@ Add \`${QUICK_TUNNEL_ALLOWED_HOST}\` to \`preview.allowedHosts\` in your Vite co
35271
36356
  }
35272
36357
  dispose() {
35273
36358
  const tunnel = this.#tunnel;
36359
+ const wasTunnelStarted = this.#origin !== void 0;
35274
36360
  this.#abortController?.abort();
35275
36361
  this.#origin = void 0;
35276
36362
  this.#publicUrls = void 0;
@@ -35279,7 +36365,7 @@ Add \`${QUICK_TUNNEL_ALLOWED_HOST}\` to \`preview.allowedHosts\` in your Vite co
35279
36365
  this.#hasWarnedAboutSse = false;
35280
36366
  debuglog("Disposing tunnel...");
35281
36367
  if (tunnel) tunnel.dispose();
35282
- this.#logger.info(" ➜ Tunnel closed");
36368
+ if (wasTunnelStarted) this.#logger.info(" ➜ Tunnel closed");
35283
36369
  }
35284
36370
  disposeOnExit() {
35285
36371
  try {
@@ -35533,8 +36619,8 @@ const postfixRE = /[?#].*$/;
35533
36619
  function cleanUrl(url) {
35534
36620
  return url.replace(postfixRE, "");
35535
36621
  }
35536
- function withTrailingSlash(path$2) {
35537
- return path$2.endsWith("/") ? path$2 : `${path$2}/`;
36622
+ function withTrailingSlash(path) {
36623
+ return path.endsWith("/") ? path : `${path}/`;
35538
36624
  }
35539
36625
  function createRequestHandler(handler) {
35540
36626
  return async (req, res, next) => {
@@ -35910,53 +36996,34 @@ function getDeployConfigPath(root) {
35910
36996
  }
35911
36997
  function getWorkerConfigs(root, isPrerender) {
35912
36998
  const deployConfigPath = getDeployConfigPath(root);
35913
- const deployConfig = JSON.parse(fs$2.readFileSync(deployConfigPath, "utf-8"));
35914
- return [
35915
- ...isPrerender && deployConfig.prerenderWorkerConfigPath ? [{ configPath: deployConfig.prerenderWorkerConfigPath }] : [],
35916
- { configPath: deployConfig.configPath },
35917
- ...deployConfig.auxiliaryWorkers
35918
- ].map(({ configPath }) => {
36999
+ const deployConfig = JSON.parse(fs$1.readFileSync(deployConfigPath, "utf-8"));
37000
+ return [...isPrerender && deployConfig.prerenderWorkerConfigPath ? [{ configPath: deployConfig.prerenderWorkerConfigPath }] : [{ configPath: deployConfig.configPath }], ...deployConfig.auxiliaryWorkers].map(({ configPath }) => {
35919
37001
  const resolvedConfigPath = nodePath.resolve(nodePath.dirname(deployConfigPath), configPath);
35920
37002
  return wrangler.unstable_readConfig({ config: resolvedConfigPath });
35921
37003
  });
35922
37004
  }
35923
- function getRelativePathToWorkerConfig(deployConfigDirectory, root, outputDirectory) {
35924
- return nodePath.relative(deployConfigDirectory, nodePath.resolve(root, outputDirectory, "wrangler.json"));
35925
- }
35926
- function writeDeployConfig(resolvedPluginConfig, resolvedViteConfig) {
37005
+ function writeDeployConfig(resolvedPluginConfig, resolvedViteConfig, isAssetsOnly) {
35927
37006
  const deployConfigPath = getDeployConfigPath(resolvedViteConfig.root);
35928
37007
  const deployConfigDirectory = nodePath.dirname(deployConfigPath);
35929
- fs$2.mkdirSync(deployConfigDirectory, { recursive: true });
35930
- if (resolvedPluginConfig.type === "assets-only") {
35931
- const clientOutputDirectory = resolvedViteConfig.environments.client?.build.outDir;
35932
- assert(clientOutputDirectory, "Unexpected error: client environment output directory is undefined");
35933
- const prerenderOutputDirectory = resolvedPluginConfig.prerenderWorkerEnvironmentName ? resolvedViteConfig.environments[resolvedPluginConfig.prerenderWorkerEnvironmentName]?.build.outDir : void 0;
35934
- const deployConfig = {
35935
- configPath: getRelativePathToWorkerConfig(deployConfigDirectory, resolvedViteConfig.root, clientOutputDirectory),
35936
- auxiliaryWorkers: [],
35937
- prerenderWorkerConfigPath: prerenderOutputDirectory ? getRelativePathToWorkerConfig(deployConfigDirectory, resolvedViteConfig.root, prerenderOutputDirectory) : void 0
35938
- };
35939
- fs$2.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
35940
- } else {
35941
- let entryWorkerConfigPath;
35942
- let prerenderWorkerConfigPath;
35943
- const auxiliaryWorkers = [];
35944
- for (const environmentName of resolvedPluginConfig.environmentNameToWorkerMap.keys()) {
35945
- const outputDirectory = resolvedViteConfig.environments[environmentName]?.build.outDir;
35946
- assert(outputDirectory, `Unexpected error: ${environmentName} environment output directory is undefined`);
35947
- const configPath = getRelativePathToWorkerConfig(deployConfigDirectory, resolvedViteConfig.root, outputDirectory);
35948
- if (environmentName === resolvedPluginConfig.entryWorkerEnvironmentName) entryWorkerConfigPath = configPath;
35949
- else if (environmentName === resolvedPluginConfig.prerenderWorkerEnvironmentName) prerenderWorkerConfigPath = configPath;
35950
- else auxiliaryWorkers.push({ configPath });
35951
- }
35952
- assert(entryWorkerConfigPath, `Unexpected error: entryWorkerConfigPath is undefined`);
35953
- const deployConfig = {
35954
- configPath: entryWorkerConfigPath,
35955
- auxiliaryWorkers,
35956
- prerenderWorkerConfigPath
35957
- };
35958
- fs$2.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
37008
+ fs$1.mkdirSync(deployConfigDirectory, { recursive: true });
37009
+ const resolveConfigPath = (environmentName) => {
37010
+ const outputDirectory = resolvedViteConfig.environments[environmentName]?.build.outDir;
37011
+ assert(outputDirectory, `Unexpected error: ${environmentName} environment output directory is undefined`);
37012
+ return nodePath.relative(deployConfigDirectory, nodePath.resolve(resolvedViteConfig.root, outputDirectory, "wrangler.json"));
37013
+ };
37014
+ const auxiliaryWorkerEnvironmentNames = resolvedPluginConfig.type === "workers" ? [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([name, worker]) => name !== resolvedPluginConfig.entryWorkerEnvironmentName && name !== resolvedPluginConfig.prerenderWorkerEnvironmentName && !resolveDevOnly(worker.devOnly)).map(([name]) => name) : [];
37015
+ let entryEnvironmentName;
37016
+ if (isAssetsOnly) entryEnvironmentName = "client";
37017
+ else {
37018
+ assert(resolvedPluginConfig.type === "workers", `Unexpected error: expected workers config but got ${resolvedPluginConfig.type}`);
37019
+ entryEnvironmentName = resolvedPluginConfig.entryWorkerEnvironmentName;
35959
37020
  }
37021
+ const deployConfig = {
37022
+ configPath: resolveConfigPath(entryEnvironmentName),
37023
+ auxiliaryWorkers: auxiliaryWorkerEnvironmentNames.map((name) => ({ configPath: resolveConfigPath(name) })),
37024
+ prerenderWorkerConfigPath: resolvedPluginConfig.prerenderWorkerEnvironmentName ? resolveConfigPath(resolvedPluginConfig.prerenderWorkerEnvironmentName) : void 0
37025
+ };
37026
+ fs$1.writeFileSync(deployConfigPath, JSON.stringify(deployConfig));
35960
37027
  }
35961
37028
 
35962
37029
  //#endregion
@@ -37175,7 +38242,7 @@ function getLineInfo(input, offset) {
37175
38242
  cur = nextBreak;
37176
38243
  }
37177
38244
  }
37178
- var defaultOptions = {
38245
+ var defaultOptions$1 = {
37179
38246
  ecmaVersion: null,
37180
38247
  sourceType: "script",
37181
38248
  onInsertedSemicolon: null,
@@ -37197,9 +38264,9 @@ var defaultOptions = {
37197
38264
  preserveParens: false
37198
38265
  };
37199
38266
  var warnedAboutEcmaVersion = false;
37200
- function getOptions(opts) {
38267
+ function getOptions$1(opts) {
37201
38268
  var options = {};
37202
- for (var opt in defaultOptions) options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
38269
+ for (var opt in defaultOptions$1) options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions$1[opt];
37203
38270
  if (options.ecmaVersion === "latest") options.ecmaVersion = 1e8;
37204
38271
  else if (options.ecmaVersion == null) {
37205
38272
  if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
@@ -37239,7 +38306,7 @@ function functionFlags(async, generator) {
37239
38306
  }
37240
38307
  var BIND_NONE = 0, BIND_VAR = 1, BIND_LEXICAL = 2, BIND_FUNCTION = 3, BIND_SIMPLE_CATCH = 4, BIND_OUTSIDE = 5;
37241
38308
  var Parser = function Parser$2(options, input, startPos) {
37242
- this.options = options = getOptions(options);
38309
+ this.options = options = getOptions$1(options);
37243
38310
  this.sourceFile = options.sourceFile;
37244
38311
  this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
37245
38312
  var reserved = "";
@@ -41024,7 +42091,7 @@ var version$1 = "8.16.0";
41024
42091
  Parser.acorn = {
41025
42092
  Parser,
41026
42093
  version: version$1,
41027
- defaultOptions,
42094
+ defaultOptions: defaultOptions$1,
41028
42095
  Position,
41029
42096
  SourceLocation,
41030
42097
  getLineInfo,
@@ -41055,15 +42122,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
41055
42122
  function withTrailingSlash$1(input = "", respectQueryAndFragment) {
41056
42123
  if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
41057
42124
  if (hasTrailingSlash(input, true)) return input || "/";
41058
- let path$2 = input;
42125
+ let path = input;
41059
42126
  let fragment = "";
41060
42127
  const fragmentIndex = input.indexOf("#");
41061
42128
  if (fragmentIndex >= 0) {
41062
- path$2 = input.slice(0, fragmentIndex);
42129
+ path = input.slice(0, fragmentIndex);
41063
42130
  fragment = input.slice(fragmentIndex);
41064
- if (!path$2) return fragment;
42131
+ if (!path) return fragment;
41065
42132
  }
41066
- const [s0, ...s] = path$2.split("?");
42133
+ const [s0, ...s] = path.split("?");
41067
42134
  return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
41068
42135
  }
41069
42136
  function isNonEmptyURL(url) {
@@ -41082,15 +42149,15 @@ const protocolRelative = Symbol.for("ufo:protocolRelative");
41082
42149
  //#endregion
41083
42150
  //#region ../../node_modules/.pnpm/pathe@2.0.1/node_modules/pathe/dist/shared/pathe.BLwDEnA5.mjs
41084
42151
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
41085
- const isAbsolute$1 = function(p$1) {
42152
+ const isAbsolute$2 = function(p$1) {
41086
42153
  return _IS_ABSOLUTE_RE.test(p$1);
41087
42154
  };
41088
42155
 
41089
42156
  //#endregion
41090
42157
  //#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
41091
42158
  const BUILTIN_MODULES = new Set(builtinModules);
41092
- function normalizeSlash(path$2) {
41093
- return path$2.replace(/\\/g, "/");
42159
+ function normalizeSlash(path) {
42160
+ return path.replace(/\\/g, "/");
41094
42161
  }
41095
42162
  /**
41096
42163
  * @typedef ErrnoExceptionFields
@@ -41210,8 +42277,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
41210
42277
  * @param {string} [base]
41211
42278
  * @param {string} [message]
41212
42279
  */
41213
- (path$2, base, message) => {
41214
- return `Invalid package config ${path$2}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
42280
+ (path, base, message) => {
42281
+ return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
41215
42282
  },
41216
42283
  Error
41217
42284
  );
@@ -41241,8 +42308,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
41241
42308
  * @param {string} base
41242
42309
  * @param {boolean} [exactUrl]
41243
42310
  */
41244
- (path$2, base, exactUrl = false) => {
41245
- return `Cannot find ${exactUrl ? "module" : "package"} '${path$2}' imported from ${base}`;
42311
+ (path, base, exactUrl = false) => {
42312
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
41246
42313
  },
41247
42314
  Error
41248
42315
  );
@@ -41280,8 +42347,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
41280
42347
  * @param {string} extension
41281
42348
  * @param {string} path
41282
42349
  */
41283
- (extension, path$2) => {
41284
- return `Unknown file extension "${extension}" for ${path$2}`;
42350
+ (extension, path) => {
42351
+ return `Unknown file extension "${extension}" for ${path}`;
41285
42352
  },
41286
42353
  TypeError
41287
42354
  );
@@ -41438,7 +42505,7 @@ function read(jsonPath, { base, specifier }) {
41438
42505
  /** @type {string | undefined} */
41439
42506
  let string;
41440
42507
  try {
41441
- string = fs.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
42508
+ string = fs2.readFileSync(path3.toNamespacedPath(jsonPath), "utf8");
41442
42509
  } catch (error) {
41443
42510
  const exception = error;
41444
42511
  if (exception.code !== "ENOENT") throw exception;
@@ -41644,15 +42711,15 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
41644
42711
  const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
41645
42712
  const basePath = fileURLToPath(base);
41646
42713
  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");
41647
- 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");
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");
41648
42715
  }
41649
42716
  /**
41650
42717
  * @param {string} path
41651
42718
  * @returns {Stats | undefined}
41652
42719
  */
41653
- function tryStatSync(path$2) {
42720
+ function tryStatSync(path) {
41654
42721
  try {
41655
- return statSync(path$2);
42722
+ return statSync(path);
41656
42723
  } catch {}
41657
42724
  }
41658
42725
  /**
@@ -41751,7 +42818,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
41751
42818
  {
41752
42819
  const real = realpathSync(filePath);
41753
42820
  const { search, hash } = resolved;
41754
- resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : ""));
42821
+ resolved = pathToFileURL(real + (filePath.endsWith(path3.sep) ? "/" : ""));
41755
42822
  resolved.search = search;
41756
42823
  resolved.hash = hash;
41757
42824
  }
@@ -42092,8 +43159,8 @@ function packageResolve(specifier, base, conditions) {
42092
43159
  /** @type {string} */
42093
43160
  let lastPath;
42094
43161
  do {
42095
- const stat = tryStatSync(packageJsonPath.slice(0, -13));
42096
- if (!stat || !stat.isDirectory()) {
43162
+ const stat$1 = tryStatSync(packageJsonPath.slice(0, -13));
43163
+ if (!stat$1 || !stat$1.isDirectory()) {
42097
43164
  lastPath = packageJsonPath;
42098
43165
  packageJsonUrl = new URL$1((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl);
42099
43166
  packageJsonPath = fileURLToPath(packageJsonUrl);
@@ -42210,7 +43277,7 @@ function _resolve(id, options = {}) {
42210
43277
  if (/(node|data|http|https):/.test(id)) return id;
42211
43278
  if (BUILTIN_MODULES.has(id)) return "node:" + id;
42212
43279
  if (id.startsWith("file://")) id = fileURLToPath$2(id);
42213
- if (isAbsolute$1(id)) try {
43280
+ if (isAbsolute$2(id)) try {
42214
43281
  if (statSync(id).isFile()) return pathToFileURL$1(id);
42215
43282
  } catch (error) {
42216
43283
  if (error?.code !== "ENOENT") throw error;
@@ -42745,7 +43812,7 @@ function maybeResolveMain(main, configPath, root) {
42745
43812
  const baseDir = configPath ? nodePath.dirname(configPath) : root;
42746
43813
  if (!baseDir) return main;
42747
43814
  const resolvedMain = nodePath.resolve(baseDir, main);
42748
- if (!fs$2.existsSync(resolvedMain)) throw new Error(`The provided Wrangler config main field (${resolvedMain}) doesn't point to an existing file`);
43815
+ if (!fs$1.existsSync(resolvedMain)) throw new Error(`The provided Wrangler config main field (${resolvedMain}) doesn't point to an existing file`);
42749
43816
  return resolvedMain;
42750
43817
  }
42751
43818
  /**
@@ -42766,7 +43833,7 @@ function getValidatedWranglerConfigPath(root, requestedConfigPath, isForAuxiliar
42766
43833
  const foundExtensionMessage = !fileExtension ? "no extension found" : `"${fileExtension}" found`;
42767
43834
  throw new Error(`${errorMessagePrefix} doesn't point to a file with the correct file extension. It should point to a jsonc, json or toml file (${foundExtensionMessage} instead)`);
42768
43835
  }
42769
- const mainStat = fs$2.statSync(configPath, { throwIfNoEntry: false });
43836
+ const mainStat = fs$1.statSync(configPath, { throwIfNoEntry: false });
42770
43837
  if (!mainStat) throw new Error(`${errorMessagePrefix} doesn't point to an existing file`);
42771
43838
  if (mainStat.isDirectory()) throw new Error(`${errorMessagePrefix} points to a directory. It should point to a file.`);
42772
43839
  return configPath;
@@ -42777,7 +43844,7 @@ function getValidatedWranglerConfigPath(root, requestedConfigPath, isForAuxiliar
42777
43844
  function findWranglerConfig(root) {
42778
43845
  for (const extension of allowedWranglerConfigExtensions) {
42779
43846
  const configPath = nodePath.join(root, `wrangler.${extension}`);
42780
- if (fs$2.existsSync(configPath)) return configPath;
43847
+ if (fs$1.existsSync(configPath)) return configPath;
42781
43848
  }
42782
43849
  }
42783
43850
  const allowedWranglerConfigExtensions = [
@@ -42877,7 +43944,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
42877
43944
  });
42878
43945
  prerenderWorkerEnvironmentName = prerenderWorkerConfig.viteEnvironment?.name ?? workerNameToEnvironmentName(workerResolvedConfig.config.topLevelName);
42879
43946
  validateAndAddEnvironmentName(prerenderWorkerEnvironmentName);
42880
- environmentNameToWorkerMap.set(prerenderWorkerEnvironmentName, resolveWorker(workerResolvedConfig.config));
43947
+ environmentNameToWorkerMap.set(prerenderWorkerEnvironmentName, resolveWorker(workerResolvedConfig.config, void 0));
42881
43948
  const prerenderWorkerChildEnvironments = prerenderWorkerConfig.viteEnvironment?.childEnvironments;
42882
43949
  if (prerenderWorkerChildEnvironments) {
42883
43950
  for (const childName of prerenderWorkerChildEnvironments) validateAndAddEnvironmentName(childName);
@@ -42900,7 +43967,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
42900
43967
  if (Array.isArray(entryWorkerResolvedConfig.config.assets?.run_worker_first)) staticRouting = parseStaticRouting(entryWorkerResolvedConfig.config.assets.run_worker_first);
42901
43968
  const entryWorkerEnvironmentName = pluginConfig.viteEnvironment?.name ?? workerNameToEnvironmentName(entryWorkerResolvedConfig.config.topLevelName);
42902
43969
  validateAndAddEnvironmentName(entryWorkerEnvironmentName);
42903
- environmentNameToWorkerMap.set(entryWorkerEnvironmentName, resolveWorker(entryWorkerResolvedConfig.config));
43970
+ environmentNameToWorkerMap.set(entryWorkerEnvironmentName, resolveWorker(entryWorkerResolvedConfig.config, pluginConfig.assetsOnly));
42904
43971
  const entryWorkerChildEnvironments = pluginConfig.viteEnvironment?.childEnvironments;
42905
43972
  if (entryWorkerChildEnvironments) {
42906
43973
  for (const childName of entryWorkerChildEnvironments) validateAndAddEnvironmentName(childName);
@@ -42920,7 +43987,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
42920
43987
  auxiliaryWorkersResolvedConfigs.push(workerResolvedConfig);
42921
43988
  const workerEnvironmentName = auxiliaryWorker.viteEnvironment?.name ?? workerNameToEnvironmentName(workerResolvedConfig.config.topLevelName);
42922
43989
  validateAndAddEnvironmentName(workerEnvironmentName);
42923
- environmentNameToWorkerMap.set(workerEnvironmentName, resolveWorker(workerResolvedConfig.config));
43990
+ environmentNameToWorkerMap.set(workerEnvironmentName, resolveWorker(workerResolvedConfig.config, auxiliaryWorker.devOnly));
42924
43991
  const auxiliaryWorkerChildEnvironments = auxiliaryWorker.viteEnvironment?.childEnvironments;
42925
43992
  if (auxiliaryWorkerChildEnvironments) {
42926
43993
  for (const childName of auxiliaryWorkerChildEnvironments) validateAndAddEnvironmentName(childName);
@@ -42955,10 +44022,19 @@ function createEnvironmentNameValidator() {
42955
44022
  usedNames.add(name);
42956
44023
  };
42957
44024
  }
42958
- function resolveWorker(workerConfig) {
44025
+ /**
44026
+ * Evaluates the `devOnly` value. Should be called lazily at build time
44027
+ * to allow frameworks to provide the value after initialization.
44028
+ */
44029
+ function resolveDevOnly(devOnly) {
44030
+ if (typeof devOnly === "function") return devOnly();
44031
+ return devOnly ?? false;
44032
+ }
44033
+ function resolveWorker(workerConfig, devOnly) {
42959
44034
  return {
42960
44035
  config: workerConfig,
42961
- nodeJsCompat: hasNodeJsCompat(workerConfig) ? new NodeJsCompat(workerConfig) : void 0
44036
+ nodeJsCompat: hasNodeJsCompat(workerConfig) ? new NodeJsCompat(workerConfig) : void 0,
44037
+ devOnly
42962
44038
  };
42963
44039
  }
42964
44040
 
@@ -44131,9 +45207,9 @@ function constructHeaders({ headers, headersFile, logger }) {
44131
45207
 
44132
45208
  //#endregion
44133
45209
  //#region ../workers-shared/utils/configuration/validateURL.ts
44134
- const extractPathname = (path$2 = "/", includeSearch, includeHash) => {
44135
- if (!path$2.startsWith("/")) path$2 = `/${path$2}`;
44136
- const url = new URL(`//${path$2}`, "relative://");
45210
+ const extractPathname = (path = "/", includeSearch, includeHash) => {
45211
+ if (!path.startsWith("/")) path = `/${path}`;
45212
+ const url = new URL(`//${path}`, "relative://");
44137
45213
  return `${url.pathname}${includeSearch ? url.search : ""}${includeHash ? url.hash : ""}`;
44138
45214
  };
44139
45215
  const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
@@ -44192,7 +45268,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
44192
45268
  lineNumber: i$1 + 1,
44193
45269
  message: "No headers specified"
44194
45270
  });
44195
- const [path$2, pathError] = validateUrl(line, false, true);
45271
+ const [path, pathError] = validateUrl(line, false, true);
44196
45272
  if (pathError) {
44197
45273
  invalid.push({
44198
45274
  line,
@@ -44203,7 +45279,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
44203
45279
  skipUntilNextPath = true;
44204
45280
  continue;
44205
45281
  }
44206
- const wildcardError = validateNoMultipleWildcards(path$2);
45282
+ const wildcardError = validateNoMultipleWildcards(path);
44207
45283
  if (wildcardError) {
44208
45284
  invalid.push({
44209
45285
  line,
@@ -44215,7 +45291,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
44215
45291
  continue;
44216
45292
  }
44217
45293
  rule = {
44218
- path: path$2,
45294
+ path,
44219
45295
  line,
44220
45296
  headers: {},
44221
45297
  unsetHeaders: []
@@ -44298,11 +45374,11 @@ function isValidRule(rule) {
44298
45374
  * `:splat` placeholder, would result in duplicate `:splat` parameters which is
44299
45375
  * unsupported.
44300
45376
  */
44301
- function validateNoMultipleWildcards(path$2) {
44302
- const wildcardCount = (path$2.match(SPLAT_REGEX) ?? []).length;
44303
- const hasSplatPlaceholder = /:splat(?!\w)/.test(path$2);
44304
- if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$2}.`;
44305
- if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$2}.`;
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}.`;
44306
45382
  }
44307
45383
 
44308
45384
  //#endregion
@@ -44519,13 +45595,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
44519
45595
  const throwError = (message, Ctor) => {
44520
45596
  throw new Ctor(message);
44521
45597
  };
44522
- const checkPath = (path$2, originalPath, doThrow) => {
44523
- if (!isString$1(path$2)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
44524
- if (!path$2) return doThrow(`path must not be empty`, TypeError);
44525
- if (checkPath.isNotRelative(path$2)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
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);
44526
45602
  return true;
44527
45603
  };
44528
- const isNotRelative = (path$2) => REGEX_TEST_INVALID_PATH.test(path$2);
45604
+ const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
44529
45605
  checkPath.isNotRelative = isNotRelative;
44530
45606
  checkPath.convert = (p$1) => p$1;
44531
45607
  var Ignore = class {
@@ -44561,13 +45637,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
44561
45637
  addPattern(pattern) {
44562
45638
  return this.add(pattern);
44563
45639
  }
44564
- _testOne(path$2, checkUnignored) {
45640
+ _testOne(path, checkUnignored) {
44565
45641
  let ignored = false;
44566
45642
  let unignored = false;
44567
45643
  this._rules.forEach((rule) => {
44568
45644
  const { negative } = rule;
44569
45645
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
44570
- if (rule.regex.test(path$2)) {
45646
+ if (rule.regex.test(path)) {
44571
45647
  ignored = !negative;
44572
45648
  unignored = negative;
44573
45649
  }
@@ -44578,33 +45654,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
44578
45654
  };
44579
45655
  }
44580
45656
  _test(originalPath, cache$2, checkUnignored, slices) {
44581
- const path$2 = originalPath && checkPath.convert(originalPath);
44582
- checkPath(path$2, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
44583
- return this._t(path$2, 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);
44584
45660
  }
44585
- _t(path$2, cache$2, checkUnignored, slices) {
44586
- if (path$2 in cache$2) return cache$2[path$2];
44587
- if (!slices) slices = path$2.split(SLASH);
45661
+ _t(path, cache$2, checkUnignored, slices) {
45662
+ if (path in cache$2) return cache$2[path];
45663
+ if (!slices) slices = path.split(SLASH);
44588
45664
  slices.pop();
44589
- if (!slices.length) return cache$2[path$2] = this._testOne(path$2, checkUnignored);
45665
+ if (!slices.length) return cache$2[path] = this._testOne(path, checkUnignored);
44590
45666
  const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
44591
- return cache$2[path$2] = parent.ignored ? parent : this._testOne(path$2, checkUnignored);
45667
+ return cache$2[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
44592
45668
  }
44593
- ignores(path$2) {
44594
- return this._test(path$2, this._ignoreCache, false).ignored;
45669
+ ignores(path) {
45670
+ return this._test(path, this._ignoreCache, false).ignored;
44595
45671
  }
44596
45672
  createFilter() {
44597
- return (path$2) => !this.ignores(path$2);
45673
+ return (path) => !this.ignores(path);
44598
45674
  }
44599
45675
  filter(paths) {
44600
45676
  return makeArray(paths).filter(this.createFilter());
44601
45677
  }
44602
- test(path$2) {
44603
- return this._test(path$2, this._testCache, true);
45678
+ test(path) {
45679
+ return this._test(path, this._testCache, true);
44604
45680
  }
44605
45681
  };
44606
45682
  const factory = (options) => new Ignore(options);
44607
- const isPathValid = (path$2) => checkPath(path$2 && checkPath.convert(path$2), path$2, RETURN_FALSE);
45683
+ const isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
44608
45684
  factory.isPathValid = isPathValid;
44609
45685
  factory.default = factory;
44610
45686
  module.exports = factory;
@@ -44613,7 +45689,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
44613
45689
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
44614
45690
  checkPath.convert = makePosix;
44615
45691
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
44616
- checkPath.isNotRelative = (path$2) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$2) || isNotRelative(path$2);
45692
+ checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
44617
45693
  }
44618
45694
  }) });
44619
45695
 
@@ -45968,11 +47044,11 @@ var Mime = class {
45968
47044
  }
45969
47045
  return this;
45970
47046
  }
45971
- getType(path$2) {
45972
- if (typeof path$2 !== "string") return null;
45973
- const last = path$2.replace(/^.*[/\\]/s, "").toLowerCase();
47047
+ getType(path) {
47048
+ if (typeof path !== "string") return null;
47049
+ const last = path.replace(/^.*[/\\]/s, "").toLowerCase();
45974
47050
  const ext = last.replace(/^.*\./s, "").toLowerCase();
45975
- const hasPath = last.length < path$2.length;
47051
+ const hasPath = last.length < path.length;
45976
47052
  if (!(ext.length < last.length - 1) && hasPath) return null;
45977
47053
  return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
45978
47054
  }
@@ -46306,8 +47382,8 @@ function getErrorMap() {
46306
47382
  //#endregion
46307
47383
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
46308
47384
  const makeIssue = (params) => {
46309
- const { data: data$1, path: path$2, errorMaps, issueData } = params;
46310
- const fullPath = [...path$2, ...issueData.path || []];
47385
+ const { data: data$1, path, errorMaps, issueData } = params;
47386
+ const fullPath = [...path, ...issueData.path || []];
46311
47387
  const fullIssue = {
46312
47388
  ...issueData,
46313
47389
  path: fullPath
@@ -46419,11 +47495,11 @@ var errorUtil;
46419
47495
  //#endregion
46420
47496
  //#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
46421
47497
  var ParseInputLazyPath = class {
46422
- constructor(parent, value, path$2, key) {
47498
+ constructor(parent, value, path, key) {
46423
47499
  this._cachedPath = [];
46424
47500
  this.parent = parent;
46425
47501
  this.data = value;
46426
- this._path = path$2;
47502
+ this._path = path;
46427
47503
  this._key = key;
46428
47504
  }
46429
47505
  get path() {
@@ -49709,14 +50785,14 @@ function createBuildApp(resolvedPluginConfig) {
49709
50785
  const clientEnvironment = builder.environments.client;
49710
50786
  assert(clientEnvironment, `No "client" environment`);
49711
50787
  const defaultHtmlPath = nodePath.resolve(builder.config.root, "index.html");
49712
- const hasClientEntry = clientEnvironment.config.build.rollupOptions.input || fs$2.existsSync(defaultHtmlPath);
49713
- const workerEnvironments = [...resolvedPluginConfig.environmentNameToWorkerMap.keys()].map((environmentName) => {
50788
+ const hasClientEntry = clientEnvironment.config.build.rollupOptions.input || fs$1.existsSync(defaultHtmlPath);
50789
+ const workerEnvironments = [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
49714
50790
  const environment = builder.environments[environmentName];
49715
50791
  assert(environment, `"${environmentName}" environment not found`);
49716
50792
  return environment;
49717
50793
  });
49718
50794
  await Promise.all(workerEnvironments.map((environment) => builder.build(environment)));
49719
- if (resolvedPluginConfig.type === "assets-only") {
50795
+ if (resolvedPluginConfig.type === "assets-only" || !workerEnvironments.some((environment) => environment.name === resolvedPluginConfig.entryWorkerEnvironmentName)) {
49720
50796
  if (hasClientEntry) await builder.build(clientEnvironment);
49721
50797
  else if (getHasPublicAssets(builder.config) || resolvedPluginConfig.prerenderWorkerEnvironmentName) await fallbackBuild(builder, clientEnvironment);
49722
50798
  return;
@@ -49737,12 +50813,12 @@ function createBuildApp(resolvedPluginConfig) {
49737
50813
  for (const assetPath of importedAssetPaths) {
49738
50814
  const src$1 = nodePath.join(entryWorkerBuildDirectory, assetPath);
49739
50815
  const dest = nodePath.join(clientBuildDirectory, assetPath);
49740
- if (!fs$2.existsSync(src$1)) continue;
49741
- if (fs$2.existsSync(dest)) fs$2.unlinkSync(src$1);
50816
+ if (!fs$1.existsSync(src$1)) continue;
50817
+ if (fs$1.existsSync(dest)) fs$1.unlinkSync(src$1);
49742
50818
  else {
49743
50819
  const destDir = nodePath.dirname(dest);
49744
- fs$2.mkdirSync(destDir, { recursive: true });
49745
- fs$2.renameSync(src$1, dest);
50820
+ fs$1.mkdirSync(destDir, { recursive: true });
50821
+ fs$1.renameSync(src$1, dest);
49746
50822
  movedAssetPaths.push(dest);
49747
50823
  }
49748
50824
  }
@@ -49752,7 +50828,7 @@ function createBuildApp(resolvedPluginConfig) {
49752
50828
  function getHasPublicAssets({ publicDir }) {
49753
50829
  let hasPublicAssets = false;
49754
50830
  if (publicDir) try {
49755
- if (fs$2.readdirSync(publicDir).length) hasPublicAssets = true;
50831
+ if (fs$1.readdirSync(publicDir).length) hasPublicAssets = true;
49756
50832
  } catch {}
49757
50833
  return hasPublicAssets;
49758
50834
  }
@@ -49764,10 +50840,10 @@ async function fallbackBuild(builder, environment) {
49764
50840
  };
49765
50841
  await builder.build(environment);
49766
50842
  const fallbackEntryPath = nodePath.resolve(builder.config.root, environment.config.build.outDir, CLIENT_FALLBACK_ENTRY_NAME);
49767
- fs$2.unlinkSync(fallbackEntryPath);
50843
+ fs$1.unlinkSync(fallbackEntryPath);
49768
50844
  }
49769
50845
  function loadViteManifest(directory) {
49770
- const contents = fs$2.readFileSync(nodePath.resolve(directory, ".vite", "manifest.json"), "utf-8");
50846
+ const contents = fs$1.readFileSync(nodePath.resolve(directory, ".vite", "manifest.json"), "utf-8");
49771
50847
  return JSON.parse(contents);
49772
50848
  }
49773
50849
  function getImportedAssetPaths(viteManifest) {
@@ -49779,9 +50855,9 @@ function getImportedAssetPaths(viteManifest) {
49779
50855
  */
49780
50856
  function removeAssetsField(entryWorkerBuildDirectory) {
49781
50857
  const entryWorkerConfigPath = nodePath.join(entryWorkerBuildDirectory, "wrangler.json");
49782
- const workerConfig = JSON.parse(fs$2.readFileSync(entryWorkerConfigPath, "utf-8"));
50858
+ const workerConfig = JSON.parse(fs$1.readFileSync(entryWorkerConfigPath, "utf-8"));
49783
50859
  workerConfig.assets = void 0;
49784
- fs$2.writeFileSync(entryWorkerConfigPath, JSON.stringify(workerConfig));
50860
+ fs$1.writeFileSync(entryWorkerConfigPath, JSON.stringify(workerConfig));
49785
50861
  }
49786
50862
 
49787
50863
  //#endregion
@@ -50136,7 +51212,7 @@ const configPlugin = createPlugin("config", (ctx) => {
50136
51212
  order: "post",
50137
51213
  async handler(builder) {
50138
51214
  if (ctx.resolvedPluginConfig.type !== "workers") return;
50139
- const workerEnvironments = [...ctx.resolvedPluginConfig.environmentNameToWorkerMap.keys()].map((environmentName) => {
51215
+ const workerEnvironments = [...ctx.resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
50140
51216
  const environment = builder.environments[environmentName];
50141
51217
  assert(environment, `"${environmentName}" environment not found`);
50142
51218
  return environment;
@@ -50145,8 +51221,27 @@ const configPlugin = createPlugin("config", (ctx) => {
50145
51221
  const { entryWorkerEnvironmentName } = ctx.resolvedPluginConfig;
50146
51222
  const entryWorkerEnvironment = builder.environments[entryWorkerEnvironmentName];
50147
51223
  assert(entryWorkerEnvironment, `No "${entryWorkerEnvironmentName}" environment`);
50148
- const entryWorkerBuildDirectory = nodePath.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir);
50149
- if (!builder.environments.client?.isBuilt) removeAssetsField(entryWorkerBuildDirectory);
51224
+ if (entryWorkerEnvironment.isBuilt) {
51225
+ if (!builder.environments.client?.isBuilt) removeAssetsField(nodePath.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir));
51226
+ } else {
51227
+ const clientEnvironment = builder.environments.client;
51228
+ assert(clientEnvironment, "No \"client\" environment");
51229
+ if (!clientEnvironment.isBuilt) throw new Error("If `assetsOnly` is set to `true`, the client environment must be built");
51230
+ const entryWorkerConfig = ctx.getWorkerConfig(entryWorkerEnvironmentName);
51231
+ assert(entryWorkerConfig, `No config found for "${entryWorkerEnvironmentName}" environment`);
51232
+ const outputConfig = {
51233
+ ...entryWorkerConfig,
51234
+ main: void 0,
51235
+ assets: {
51236
+ ...entryWorkerConfig.assets,
51237
+ directory: ".",
51238
+ binding: void 0
51239
+ }
51240
+ };
51241
+ if (outputConfig.unsafe && Object.keys(outputConfig.unsafe).length === 0) outputConfig.unsafe = void 0;
51242
+ fs$1.writeFileSync(nodePath.resolve(builder.config.root, clientEnvironment.config.build.outDir, "wrangler.json"), JSON.stringify(outputConfig));
51243
+ writeDeployConfig(ctx.resolvedPluginConfig, ctx.resolvedViteConfig, true);
51244
+ }
50150
51245
  }
50151
51246
  }
50152
51247
  };
@@ -50455,11 +51550,11 @@ const getQueryString = (params) => {
50455
51550
  };
50456
51551
  const getUrl = (config, options) => {
50457
51552
  const encoder$1 = config.ENCODE_PATH || encodeURI;
50458
- const path$2 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
51553
+ const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
50459
51554
  if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
50460
51555
  return substring;
50461
51556
  });
50462
- const url = `${config.BASE}${path$2}`;
51557
+ const url = `${config.BASE}${path}`;
50463
51558
  if (options.query) return `${url}${getQueryString(options.query)}`;
50464
51559
  return url;
50465
51560
  };
@@ -51510,7 +52605,7 @@ function getContainerOptions(options) {
51510
52605
  return containersConfig.map((container) => {
51511
52606
  if (isDockerfile(container.image, configPath)) return {
51512
52607
  dockerfile: container.image,
51513
- image_build_context: container.image_build_context ?? path.dirname(container.image),
52608
+ image_build_context: container.image_build_context ?? path3.dirname(container.image),
51514
52609
  image_vars: container.image_vars,
51515
52610
  class_name: container.class_name,
51516
52611
  image_tag: getDevContainerImageName(container.class_name, containerBuildId)
@@ -51524,28 +52619,28 @@ function getContainerOptions(options) {
51524
52619
  }
51525
52620
 
51526
52621
  //#endregion
51527
- //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
52622
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs
51528
52623
  var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
51529
- function cleanPath(path$2) {
51530
- let normalized = normalize(path$2);
52624
+ function cleanPath(path) {
52625
+ let normalized = normalize(path);
51531
52626
  if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
51532
52627
  return normalized;
51533
52628
  }
51534
52629
  const SLASHES_REGEX = /[\\/]/g;
51535
- function convertSlashes(path$2, separator) {
51536
- return path$2.replace(SLASHES_REGEX, separator);
52630
+ function convertSlashes(path, separator) {
52631
+ return path.replace(SLASHES_REGEX, separator);
51537
52632
  }
51538
52633
  const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
51539
- function isRootDirectory(path$2) {
51540
- return path$2 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$2);
52634
+ function isRootDirectory(path) {
52635
+ return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
51541
52636
  }
51542
- function normalizePath$1(path$2, options) {
52637
+ function normalizePath$1(path, options) {
51543
52638
  const { resolvePaths, normalizePath: normalizePath$1$1, pathSeparator } = options;
51544
- const pathNeedsCleaning = process.platform === "win32" && path$2.includes("/") || path$2.startsWith(".");
51545
- if (resolvePaths) path$2 = resolve$1(path$2);
51546
- if (normalizePath$1$1 || pathNeedsCleaning) path$2 = cleanPath(path$2);
51547
- if (path$2 === ".") return "";
51548
- return convertSlashes(path$2[path$2.length - 1] !== pathSeparator ? path$2 + pathSeparator : path$2, pathSeparator);
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);
51549
52644
  }
51550
52645
  function joinPathWithBasePath(filename, directoryPath) {
51551
52646
  return directoryPath + filename;
@@ -51581,8 +52676,8 @@ const pushDirectory = (directoryPath, paths) => {
51581
52676
  paths.push(directoryPath || ".");
51582
52677
  };
51583
52678
  const pushDirectoryFilter = (directoryPath, paths, filters) => {
51584
- const path$2 = directoryPath || ".";
51585
- if (filters.every((filter) => filter(path$2, true))) paths.push(path$2);
52679
+ const path = directoryPath || ".";
52680
+ if (filters.every((filter) => filter(path, true))) paths.push(path);
51586
52681
  };
51587
52682
  const empty$2 = () => {};
51588
52683
  function build$6(root, options) {
@@ -51631,27 +52726,27 @@ const empty = () => {};
51631
52726
  function build$3(options) {
51632
52727
  return options.group ? groupFiles : empty;
51633
52728
  }
51634
- const resolveSymlinksAsync = function(path$2, state, callback$1) {
51635
- const { queue, fs: fs$3, options: { suppressErrors } } = state;
52729
+ const resolveSymlinksAsync = function(path, state, callback$1) {
52730
+ const { queue, fs: fs$2, options: { suppressErrors } } = state;
51636
52731
  queue.enqueue();
51637
- fs$3.realpath(path$2, (error, resolvedPath) => {
52732
+ fs$2.realpath(path, (error, resolvedPath) => {
51638
52733
  if (error) return queue.dequeue(suppressErrors ? null : error, state);
51639
- fs$3.stat(resolvedPath, (error$1, stat) => {
52734
+ fs$2.stat(resolvedPath, (error$1, stat$1) => {
51640
52735
  if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
51641
- if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue.dequeue(null, state);
51642
- callback$1(stat, resolvedPath);
52736
+ if (stat$1.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
52737
+ callback$1(stat$1, resolvedPath);
51643
52738
  queue.dequeue(null, state);
51644
52739
  });
51645
52740
  });
51646
52741
  };
51647
- const resolveSymlinks = function(path$2, state, callback$1) {
51648
- const { queue, fs: fs$3, options: { suppressErrors } } = state;
52742
+ const resolveSymlinks = function(path, state, callback$1) {
52743
+ const { queue, fs: fs$2, options: { suppressErrors } } = state;
51649
52744
  queue.enqueue();
51650
52745
  try {
51651
- const resolvedPath = fs$3.realpathSync(path$2);
51652
- const stat = fs$3.statSync(resolvedPath);
51653
- if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return;
51654
- callback$1(stat, resolvedPath);
52746
+ const resolvedPath = fs$2.realpathSync(path);
52747
+ const stat$1 = fs$2.statSync(resolvedPath);
52748
+ if (stat$1.isDirectory() && isRecursive(path, resolvedPath, state)) return;
52749
+ callback$1(stat$1, resolvedPath);
51655
52750
  } catch (e) {
51656
52751
  if (!suppressErrors) throw e;
51657
52752
  }
@@ -51660,16 +52755,16 @@ function build$2(options, isSynchronous) {
51660
52755
  if (!options.resolveSymlinks || options.excludeSymlinks) return null;
51661
52756
  return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
51662
52757
  }
51663
- function isRecursive(path$2, resolved, state) {
52758
+ function isRecursive(path, resolved, state) {
51664
52759
  if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
51665
- let parent = dirname$1(path$2);
52760
+ let parent = dirname$1(path);
51666
52761
  let depth$1 = 1;
51667
52762
  while (parent !== state.root && depth$1 < 2) {
51668
52763
  const resolvedPath = state.symlinks.get(parent);
51669
52764
  if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
51670
52765
  else parent = dirname$1(parent);
51671
52766
  }
51672
- state.symlinks.set(path$2, resolved);
52767
+ state.symlinks.set(path, resolved);
51673
52768
  return depth$1 > 1;
51674
52769
  }
51675
52770
  function isRecursiveUsingRealPaths(resolved, state) {
@@ -51718,22 +52813,22 @@ const readdirOpts = { withFileTypes: true };
51718
52813
  const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
51719
52814
  state.queue.enqueue();
51720
52815
  if (currentDepth < 0) return state.queue.dequeue(null, state);
51721
- const { fs: fs$3 } = state;
52816
+ const { fs: fs$2 } = state;
51722
52817
  state.visited.push(crawlPath);
51723
52818
  state.counts.directories++;
51724
- fs$3.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
52819
+ fs$2.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
51725
52820
  callback$1(entries, directoryPath, currentDepth);
51726
52821
  state.queue.dequeue(state.options.suppressErrors ? null : error, state);
51727
52822
  });
51728
52823
  };
51729
52824
  const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
51730
- const { fs: fs$3 } = state;
52825
+ const { fs: fs$2 } = state;
51731
52826
  if (currentDepth < 0) return;
51732
52827
  state.visited.push(crawlPath);
51733
52828
  state.counts.directories++;
51734
52829
  let entries = [];
51735
52830
  try {
51736
- entries = fs$3.readdirSync(crawlPath || ".", readdirOpts);
52831
+ entries = fs$2.readdirSync(crawlPath || ".", readdirOpts);
51737
52832
  } catch (e) {
51738
52833
  if (!state.options.suppressErrors) throw e;
51739
52834
  }
@@ -51825,7 +52920,7 @@ var Walker = class {
51825
52920
  symlinks: /* @__PURE__ */ new Map(),
51826
52921
  visited: [""].slice(0, 0),
51827
52922
  controller: new Aborter(),
51828
- fs: options.fs || nativeFs$1
52923
+ fs: options.fs || nativeFs
51829
52924
  };
51830
52925
  this.joinPath = build$7(this.root, options);
51831
52926
  this.pushDirectory = build$6(this.root, options);
@@ -51850,19 +52945,19 @@ var Walker = class {
51850
52945
  const filename = this.joinPath(entry.name, directoryPath);
51851
52946
  this.pushFile(filename, files, this.state.counts, filters);
51852
52947
  } else if (entry.isDirectory()) {
51853
- let path$2 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
51854
- if (exclude && exclude(entry.name, path$2)) continue;
51855
- this.pushDirectory(path$2, paths, filters);
51856
- this.walkDirectory(this.state, path$2, path$2, depth$1 - 1, this.walk);
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);
51857
52952
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
51858
- let path$2 = joinPathWithBasePath(entry.name, directoryPath);
51859
- this.resolveSymlink(path$2, this.state, (stat, resolvedPath) => {
51860
- if (stat.isDirectory()) {
52953
+ let path = joinPathWithBasePath(entry.name, directoryPath);
52954
+ this.resolveSymlink(path, this.state, (stat$1, resolvedPath) => {
52955
+ if (stat$1.isDirectory()) {
51861
52956
  resolvedPath = normalizePath$1(resolvedPath, this.state.options);
51862
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$2 + pathSeparator)) return;
51863
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$2 + pathSeparator, depth$1 - 1, this.walk);
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);
51864
52959
  } else {
51865
- resolvedPath = useRealPaths ? resolvedPath : path$2;
52960
+ resolvedPath = useRealPaths ? resolvedPath : path;
51866
52961
  const filename = basename(resolvedPath);
51867
52962
  const directoryPath$1 = normalizePath$1(dirname$1(resolvedPath), this.state.options);
51868
52963
  resolvedPath = this.joinPath(filename, directoryPath$1);
@@ -52027,16 +53122,17 @@ var Builder = class {
52027
53122
  isMatch = globFn(patterns, ...options);
52028
53123
  this.globCache[patterns.join("\0")] = isMatch;
52029
53124
  }
52030
- this.options.filters.push((path$2) => isMatch(path$2));
53125
+ this.options.filters.push((path) => isMatch(path));
52031
53126
  return this;
52032
53127
  }
52033
53128
  };
52034
53129
 
52035
53130
  //#endregion
52036
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
52037
- var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js": ((exports, module) => {
53131
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
53132
+ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js": ((exports, module) => {
52038
53133
  const WIN_SLASH = "\\\\/";
52039
53134
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
53135
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
52040
53136
  /**
52041
53137
  * Posix glob regex
52042
53138
  */
@@ -52089,6 +53185,7 @@ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
52089
53185
  * POSIX Bracket Regex
52090
53186
  */
52091
53187
  const POSIX_REGEX_SOURCE$1 = {
53188
+ __proto__: null,
52092
53189
  alnum: "a-zA-Z0-9",
52093
53190
  alpha: "a-zA-Z",
52094
53191
  ascii: "\\x00-\\x7F",
@@ -52105,6 +53202,7 @@ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
52105
53202
  xdigit: "A-Fa-f0-9"
52106
53203
  };
52107
53204
  module.exports = {
53205
+ DEFAULT_MAX_EXTGLOB_RECURSION,
52108
53206
  MAX_LENGTH: 1024 * 64,
52109
53207
  POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
52110
53208
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
@@ -52198,8 +53296,8 @@ var require_constants = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
52198
53296
  }) });
52199
53297
 
52200
53298
  //#endregion
52201
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
52202
- var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js": ((exports) => {
53299
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
53300
+ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js": ((exports) => {
52203
53301
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
52204
53302
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
52205
53303
  exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
@@ -52238,8 +53336,8 @@ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
52238
53336
  if (state.negated === true) output = `(?:^(?!${output}).*$)`;
52239
53337
  return output;
52240
53338
  };
52241
- exports.basename = (path$2, { windows } = {}) => {
52242
- const segs = path$2.split(windows ? /[\\/]/ : "/");
53339
+ exports.basename = (path, { windows } = {}) => {
53340
+ const segs = path.split(windows ? /[\\/]/ : "/");
52243
53341
  const last = segs[segs.length - 1];
52244
53342
  if (last === "") return segs[segs.length - 2];
52245
53343
  return last;
@@ -52247,8 +53345,8 @@ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
52247
53345
  }) });
52248
53346
 
52249
53347
  //#endregion
52250
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
52251
- var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js": ((exports, module) => {
53348
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
53349
+ var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js": ((exports, module) => {
52252
53350
  const utils$3 = require_utils();
52253
53351
  const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
52254
53352
  const isPathSeparator = (code) => {
@@ -52535,8 +53633,8 @@ var require_scan = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pico
52535
53633
  }) });
52536
53634
 
52537
53635
  //#endregion
52538
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
52539
- var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js": ((exports, module) => {
53636
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
53637
+ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js": ((exports, module) => {
52540
53638
  const constants$3 = require_constants();
52541
53639
  const utils$2 = require_utils();
52542
53640
  /**
@@ -52563,6 +53661,177 @@ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
52563
53661
  const syntaxError = (type, char) => {
52564
53662
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
52565
53663
  };
53664
+ const splitTopLevel = (input) => {
53665
+ const parts = [];
53666
+ let bracket = 0;
53667
+ let paren = 0;
53668
+ let quote = 0;
53669
+ let value = "";
53670
+ let escaped = false;
53671
+ for (const ch of input) {
53672
+ if (escaped === true) {
53673
+ value += ch;
53674
+ escaped = false;
53675
+ continue;
53676
+ }
53677
+ if (ch === "\\") {
53678
+ value += ch;
53679
+ escaped = true;
53680
+ continue;
53681
+ }
53682
+ if (ch === "\"") {
53683
+ quote = quote === 1 ? 0 : 1;
53684
+ value += ch;
53685
+ continue;
53686
+ }
53687
+ if (quote === 0) {
53688
+ if (ch === "[") bracket++;
53689
+ else if (ch === "]" && bracket > 0) bracket--;
53690
+ else if (bracket === 0) {
53691
+ if (ch === "(") paren++;
53692
+ else if (ch === ")" && paren > 0) paren--;
53693
+ else if (ch === "|" && paren === 0) {
53694
+ parts.push(value);
53695
+ value = "";
53696
+ continue;
53697
+ }
53698
+ }
53699
+ }
53700
+ value += ch;
53701
+ }
53702
+ parts.push(value);
53703
+ return parts;
53704
+ };
53705
+ const isPlainBranch = (branch) => {
53706
+ let escaped = false;
53707
+ for (const ch of branch) {
53708
+ if (escaped === true) {
53709
+ escaped = false;
53710
+ continue;
53711
+ }
53712
+ if (ch === "\\") {
53713
+ escaped = true;
53714
+ continue;
53715
+ }
53716
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
53717
+ }
53718
+ return true;
53719
+ };
53720
+ const normalizeSimpleBranch = (branch) => {
53721
+ let value = branch.trim();
53722
+ let changed = true;
53723
+ while (changed === true) {
53724
+ changed = false;
53725
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
53726
+ value = value.slice(2, -1);
53727
+ changed = true;
53728
+ }
53729
+ }
53730
+ if (!isPlainBranch(value)) return;
53731
+ return value.replace(/\\(.)/g, "$1");
53732
+ };
53733
+ const hasRepeatedCharPrefixOverlap = (branches) => {
53734
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
53735
+ for (let i$1 = 0; i$1 < values.length; i$1++) for (let j = i$1 + 1; j < values.length; j++) {
53736
+ const a = values[i$1];
53737
+ const b = values[j];
53738
+ const char = a[0];
53739
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
53740
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
53741
+ }
53742
+ return false;
53743
+ };
53744
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
53745
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
53746
+ let bracket = 0;
53747
+ let paren = 0;
53748
+ let quote = 0;
53749
+ let escaped = false;
53750
+ for (let i$1 = 1; i$1 < pattern.length; i$1++) {
53751
+ const ch = pattern[i$1];
53752
+ if (escaped === true) {
53753
+ escaped = false;
53754
+ continue;
53755
+ }
53756
+ if (ch === "\\") {
53757
+ escaped = true;
53758
+ continue;
53759
+ }
53760
+ if (ch === "\"") {
53761
+ quote = quote === 1 ? 0 : 1;
53762
+ continue;
53763
+ }
53764
+ if (quote === 1) continue;
53765
+ if (ch === "[") {
53766
+ bracket++;
53767
+ continue;
53768
+ }
53769
+ if (ch === "]" && bracket > 0) {
53770
+ bracket--;
53771
+ continue;
53772
+ }
53773
+ if (bracket > 0) continue;
53774
+ if (ch === "(") {
53775
+ paren++;
53776
+ continue;
53777
+ }
53778
+ if (ch === ")") {
53779
+ paren--;
53780
+ if (paren === 0) {
53781
+ if (requireEnd === true && i$1 !== pattern.length - 1) return;
53782
+ return {
53783
+ type: pattern[0],
53784
+ body: pattern.slice(2, i$1),
53785
+ end: i$1
53786
+ };
53787
+ }
53788
+ }
53789
+ }
53790
+ };
53791
+ const getStarExtglobSequenceOutput = (pattern) => {
53792
+ let index = 0;
53793
+ const chars$1 = [];
53794
+ while (index < pattern.length) {
53795
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
53796
+ if (!match || match.type !== "*") return;
53797
+ const branches = splitTopLevel(match.body).map((branch$1) => branch$1.trim());
53798
+ if (branches.length !== 1) return;
53799
+ const branch = normalizeSimpleBranch(branches[0]);
53800
+ if (!branch || branch.length !== 1) return;
53801
+ chars$1.push(branch);
53802
+ index += match.end + 1;
53803
+ }
53804
+ if (chars$1.length < 1) return;
53805
+ return `${chars$1.length === 1 ? utils$2.escapeRegex(chars$1[0]) : `[${chars$1.map((ch) => utils$2.escapeRegex(ch)).join("")}]`}*`;
53806
+ };
53807
+ const repeatedExtglobRecursion = (pattern) => {
53808
+ let depth$1 = 0;
53809
+ let value = pattern.trim();
53810
+ let match = parseRepeatedExtglob(value);
53811
+ while (match) {
53812
+ depth$1++;
53813
+ value = match.body.trim();
53814
+ match = parseRepeatedExtglob(value);
53815
+ }
53816
+ return depth$1;
53817
+ };
53818
+ const analyzeRepeatedExtglob = (body, options) => {
53819
+ if (options.maxExtglobRecursion === false) return { risky: false };
53820
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants$3.DEFAULT_MAX_EXTGLOB_RECURSION;
53821
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
53822
+ if (branches.length > 1) {
53823
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
53824
+ }
53825
+ for (const branch of branches) {
53826
+ const safeOutput = getStarExtglobSequenceOutput(branch);
53827
+ if (safeOutput) return {
53828
+ risky: true,
53829
+ safeOutput
53830
+ };
53831
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
53832
+ }
53833
+ return { risky: false };
53834
+ };
52566
53835
  /**
52567
53836
  * Parse the given input string.
52568
53837
  * @param {String} input
@@ -52692,6 +53961,8 @@ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
52692
53961
  token.prev = prev;
52693
53962
  token.parens = state.parens;
52694
53963
  token.output = state.output;
53964
+ token.startIndex = state.index;
53965
+ token.tokensIndex = tokens.length;
52695
53966
  const output = (opts.capture ? "(" : "") + token.open;
52696
53967
  increment("parens");
52697
53968
  push({
@@ -52708,6 +53979,30 @@ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
52708
53979
  extglobs.push(token);
52709
53980
  };
52710
53981
  const extglobClose = (token) => {
53982
+ const literal$1 = input.slice(token.startIndex, state.index + 1);
53983
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
53984
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
53985
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR$1) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
53986
+ const open$1 = tokens[token.tokensIndex];
53987
+ open$1.type = "text";
53988
+ open$1.value = literal$1;
53989
+ open$1.output = safeOutput || utils$2.escapeRegex(literal$1);
53990
+ for (let i$1 = token.tokensIndex + 1; i$1 < tokens.length; i$1++) {
53991
+ tokens[i$1].value = "";
53992
+ tokens[i$1].output = "";
53993
+ delete tokens[i$1].suffix;
53994
+ }
53995
+ state.output = token.output + open$1.output;
53996
+ state.backtrack = true;
53997
+ push({
53998
+ type: "paren",
53999
+ extglob: true,
54000
+ value,
54001
+ output: ""
54002
+ });
54003
+ decrement("parens");
54004
+ return;
54005
+ }
52711
54006
  let output = token.close + (opts.capture ? ")" : "");
52712
54007
  let rest;
52713
54008
  if (token.type === "negate") {
@@ -53394,8 +54689,8 @@ var require_parse = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
53394
54689
  }) });
53395
54690
 
53396
54691
  //#endregion
53397
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
53398
- var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
54692
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
54693
+ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
53399
54694
  const scan = require_scan();
53400
54695
  const parse = require_parse();
53401
54696
  const utils$1 = require_utils();
@@ -53604,6 +54899,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
53604
54899
  * Compile a regular expression from the `state` object returned by the
53605
54900
  * [parse()](#parse) method.
53606
54901
  *
54902
+ * ```js
54903
+ * const picomatch = require('picomatch');
54904
+ * const state = picomatch.parse('*.js');
54905
+ * // picomatch.compileRe(state[, options]);
54906
+ *
54907
+ * console.log(picomatch.compileRe(state));
54908
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
54909
+ * ```
53607
54910
  * @param {Object} `state`
53608
54911
  * @param {Object} `options`
53609
54912
  * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
@@ -53627,10 +54930,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
53627
54930
  *
53628
54931
  * ```js
53629
54932
  * const picomatch = require('picomatch');
53630
- * const state = picomatch.parse('*.js');
53631
- * // picomatch.compileRe(state[, options]);
54933
+ * // picomatch.makeRe(state[, options]);
53632
54934
  *
53633
- * console.log(picomatch.compileRe(state));
54935
+ * const result = picomatch.makeRe('*.js');
54936
+ * console.log(result);
53634
54937
  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
53635
54938
  * ```
53636
54939
  * @param {String} `state` The object returned from the `.parse` method.
@@ -53687,8 +54990,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
53687
54990
  }) });
53688
54991
 
53689
54992
  //#endregion
53690
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
53691
- var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js": ((exports, module) => {
54993
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
54994
+ var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js": ((exports, module) => {
53692
54995
  const pico = require_picomatch$1();
53693
54996
  const utils = require_utils();
53694
54997
  function picomatch$1(glob, options, returnState = false) {
@@ -53703,38 +55006,39 @@ var require_picomatch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
53703
55006
  }) });
53704
55007
 
53705
55008
  //#endregion
53706
- //#region ../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
55009
+ //#region ../../node_modules/.pnpm/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.mjs
53707
55010
  var import_picomatch = /* @__PURE__ */ __toESM$1(require_picomatch(), 1);
53708
55011
  const isReadonlyArray = Array.isArray;
55012
+ const BACKSLASHES = /\\/g;
53709
55013
  const isWin = process.platform === "win32";
53710
55014
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
53711
55015
  function getPartialMatcher(patterns, options = {}) {
53712
55016
  const patternsCount = patterns.length;
53713
55017
  const patternsParts = Array(patternsCount);
53714
55018
  const matchers = Array(patternsCount);
53715
- const globstarEnabled = !options.noglobstar;
53716
- for (let i$1 = 0; i$1 < patternsCount; i$1++) {
55019
+ let i$1, j;
55020
+ for (i$1 = 0; i$1 < patternsCount; i$1++) {
53717
55021
  const parts = splitPattern(patterns[i$1]);
53718
55022
  patternsParts[i$1] = parts;
53719
55023
  const partsCount = parts.length;
53720
55024
  const partMatchers = Array(partsCount);
53721
- for (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
55025
+ for (j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
53722
55026
  matchers[i$1] = partMatchers;
53723
55027
  }
53724
55028
  return (input) => {
53725
55029
  const inputParts = input.split("/");
53726
55030
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
53727
- for (let i$1 = 0; i$1 < patterns.length; i$1++) {
55031
+ for (i$1 = 0; i$1 < patternsCount; i$1++) {
53728
55032
  const patternParts = patternsParts[i$1];
53729
55033
  const matcher = matchers[i$1];
53730
55034
  const inputPatternCount = inputParts.length;
53731
55035
  const minParts = Math.min(inputPatternCount, patternParts.length);
53732
- let j = 0;
55036
+ j = 0;
53733
55037
  while (j < minParts) {
53734
55038
  const part = patternParts[j];
53735
55039
  if (part.includes("/")) return true;
53736
55040
  if (!matcher[j](inputParts[j])) break;
53737
- if (globstarEnabled && part === "**") return true;
55041
+ if (!options.noglobstar && part === "**") return true;
53738
55042
  j++;
53739
55043
  }
53740
55044
  if (j === inputPatternCount) return true;
@@ -53748,7 +55052,7 @@ const isRoot = isWin ? (p$1) => WIN32_ROOT_DIR.test(p$1) : (p$1) => p$1 === "/";
53748
55052
  function buildFormat(cwd, root, absolute$1) {
53749
55053
  if (cwd === root || root.startsWith(`${cwd}/`)) {
53750
55054
  if (absolute$1) {
53751
- const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
55055
+ const start = cwd.length + +!isRoot(cwd);
53752
55056
  return (p$1, isDir) => p$1.slice(start, isDir ? -1 : void 0) || ".";
53753
55057
  }
53754
55058
  const prefix = root.slice(cwd.length + 1);
@@ -53769,20 +55073,19 @@ function buildRelative(cwd, root) {
53769
55073
  }
53770
55074
  return (p$1) => {
53771
55075
  const result = posix.relative(cwd, `${root}/${p$1}`);
53772
- if (p$1.endsWith("/") && result !== "") return `${result}/`;
53773
- return result || ".";
55076
+ return p$1[p$1.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
53774
55077
  };
53775
55078
  }
53776
55079
  const splitPatternOptions = { parts: true };
53777
- function splitPattern(path$1$1) {
55080
+ function splitPattern(path) {
53778
55081
  var _result$parts;
53779
- const result = import_picomatch.default.scan(path$1$1, splitPatternOptions);
53780
- return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1$1];
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];
53781
55084
  }
53782
55085
  const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
53783
55086
  const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
53784
- const escapePosixPath = (path$1$1) => path$1$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
53785
- const escapeWin32Path = (path$1$1) => path$1$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
55087
+ const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
55088
+ const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
53786
55089
  /**
53787
55090
  * Escapes a path's special characters depending on the platform.
53788
55091
  * @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
@@ -53809,28 +55112,31 @@ function isDynamicPattern(pattern, options) {
53809
55112
  function log(...tasks) {
53810
55113
  console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
53811
55114
  }
55115
+ function ensureStringArray(value) {
55116
+ return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
55117
+ }
53812
55118
  const PARENT_DIRECTORY = /^(\/?\.\.)+/;
53813
55119
  const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
53814
- const BACKSLASHES = /\\/g;
53815
- function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
55120
+ function normalizePattern(pattern, opts, props, isIgnore) {
55121
+ var _PARENT_DIRECTORY$exe;
55122
+ const cwd = opts.cwd;
53816
55123
  let result = pattern;
53817
- if (pattern.endsWith("/")) result = pattern.slice(0, -1);
53818
- if (!result.endsWith("*") && expandDirectories) result += "/**";
55124
+ if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
55125
+ if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
53819
55126
  const escapedCwd = escapePath(cwd);
53820
- if (path$1.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
53821
- else result = posix.normalize(result);
53822
- const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
55127
+ result = isAbsolute$1(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
55128
+ const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
53823
55129
  const parts = splitPattern(result);
53824
- if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
53825
- const n$1 = (parentDirectoryMatch[0].length + 1) / 3;
55130
+ if (parentDir) {
55131
+ const n$1 = (parentDir.length + 1) / 3;
53826
55132
  let i$1 = 0;
53827
55133
  const cwdParts = escapedCwd.split("/");
53828
55134
  while (i$1 < n$1 && parts[i$1 + n$1] === cwdParts[cwdParts.length + i$1 - n$1]) {
53829
55135
  result = result.slice(0, (n$1 - i$1 - 1) * 3) + result.slice((n$1 - i$1) * 3 + parts[i$1 + n$1].length + 1) || ".";
53830
55136
  i$1++;
53831
55137
  }
53832
- const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i$1 * 3));
53833
- if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
55138
+ const potentialRoot = posix.join(cwd, parentDir.slice(i$1 * 3));
55139
+ if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
53834
55140
  props.root = potentialRoot;
53835
55141
  props.depthOffset = -n$1 + i$1;
53836
55142
  }
@@ -53846,7 +55152,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
53846
55152
  newCommonPath.pop();
53847
55153
  break;
53848
55154
  }
53849
- if (part !== props.commonPath[i$1] || isDynamicPattern(part) || i$1 === parts.length - 1) break;
55155
+ if (i$1 === parts.length - 1 || part !== props.commonPath[i$1] || isDynamicPattern(part)) break;
53850
55156
  newCommonPath.push(part);
53851
55157
  }
53852
55158
  props.depthOffset = newCommonPath.length;
@@ -53855,135 +55161,150 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
53855
55161
  }
53856
55162
  return result;
53857
55163
  }
53858
- function processPatterns({ patterns = ["**/*"], ignore: ignore$1 = [], expandDirectories = true }, cwd, props) {
53859
- if (typeof patterns === "string") patterns = [patterns];
53860
- if (typeof ignore$1 === "string") ignore$1 = [ignore$1];
55164
+ function processPatterns(options, patterns, props) {
53861
55165
  const matchPatterns = [];
53862
55166
  const ignorePatterns = [];
53863
- for (const pattern of ignore$1) {
55167
+ for (const pattern of options.ignore) {
53864
55168
  if (!pattern) continue;
53865
- if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
55169
+ if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
53866
55170
  }
53867
55171
  for (const pattern of patterns) {
53868
55172
  if (!pattern) continue;
53869
- if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
53870
- else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
55173
+ if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
55174
+ else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
53871
55175
  }
53872
55176
  return {
53873
55177
  match: matchPatterns,
53874
55178
  ignore: ignorePatterns
53875
55179
  };
53876
55180
  }
53877
- function formatPaths(paths, relative$2) {
53878
- for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
53879
- const path$1$1 = paths[i$1];
53880
- paths[i$1] = relative$2(path$1$1);
53881
- }
53882
- return paths;
53883
- }
53884
- function normalizeCwd(cwd) {
53885
- if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
53886
- if (cwd instanceof URL) return fileURLToPath$1(cwd).replace(BACKSLASHES, "/");
53887
- return path$1.resolve(cwd).replace(BACKSLASHES, "/");
53888
- }
53889
- function getCrawler(patterns, inputOptions = {}) {
53890
- const options = process.env.TINYGLOBBY_DEBUG ? {
53891
- ...inputOptions,
53892
- debug: true
53893
- } : inputOptions;
53894
- const cwd = normalizeCwd(options.cwd);
53895
- if (options.debug) log("globbing with:", {
53896
- patterns,
53897
- options,
53898
- cwd
53899
- });
53900
- if (Array.isArray(patterns) && patterns.length === 0) return [{
53901
- sync: () => [],
53902
- withPromise: async () => []
53903
- }, false];
55181
+ function buildCrawler(options, patterns) {
55182
+ const cwd = options.cwd;
53904
55183
  const props = {
53905
55184
  root: cwd,
53906
- commonPath: null,
53907
55185
  depthOffset: 0
53908
55186
  };
53909
- const processed = processPatterns({
53910
- ...options,
53911
- patterns
53912
- }, cwd, props);
55187
+ const processed = processPatterns(options, patterns, props);
53913
55188
  if (options.debug) log("internal processing patterns:", processed);
55189
+ const { absolute: absolute$1, caseSensitiveMatch: caseSensitiveMatch$1, debug: debug$7, dot, followSymbolicLinks, onlyDirectories } = options;
55190
+ const root = props.root.replace(BACKSLASHES, "");
53914
55191
  const matchOptions = {
53915
- dot: options.dot,
55192
+ dot,
53916
55193
  nobrace: options.braceExpansion === false,
53917
- nocase: options.caseSensitiveMatch === false,
55194
+ nocase: !caseSensitiveMatch$1,
53918
55195
  noextglob: options.extglob === false,
53919
55196
  noglobstar: options.globstar === false,
53920
55197
  posix: true
53921
55198
  };
53922
- const matcher = (0, import_picomatch.default)(processed.match, {
53923
- ...matchOptions,
53924
- ignore: processed.ignore
53925
- });
55199
+ const matcher = (0, import_picomatch.default)(processed.match, matchOptions);
53926
55200
  const ignore$1 = (0, import_picomatch.default)(processed.ignore, matchOptions);
53927
55201
  const partialMatcher = getPartialMatcher(processed.match, matchOptions);
53928
- const format$2 = buildFormat(cwd, props.root, options.absolute);
53929
- const formatExclude = options.absolute ? format$2 : buildFormat(cwd, props.root, true);
53930
- const fdirOptions = {
53931
- filters: [options.debug ? (p$1, isDirectory$1) => {
53932
- const path$1$1 = format$2(p$1, isDirectory$1);
53933
- const matches = matcher(path$1$1);
53934
- if (matches) log(`matched ${path$1$1}`);
55202
+ const format$2 = buildFormat(cwd, root, absolute$1);
55203
+ const excludeFormatter = absolute$1 ? format$2 : buildFormat(cwd, root, true);
55204
+ const excludePredicate = (_, p$1) => {
55205
+ const relativePath = excludeFormatter(p$1, true);
55206
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
55207
+ };
55208
+ let maxDepth;
55209
+ if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
55210
+ const crawler = new Builder({
55211
+ 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}`);
53935
55215
  return matches;
53936
- } : (p$1, isDirectory$1) => matcher(format$2(p$1, isDirectory$1))],
53937
- exclude: options.debug ? (_, p$1) => {
53938
- const relativePath = formatExclude(p$1, true);
53939
- const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
53940
- if (skipped) log(`skipped ${p$1}`);
53941
- else log(`crawling ${p$1}`);
55216
+ } : (p$1, isDirectory$1) => {
55217
+ const path = format$2(p$1, isDirectory$1);
55218
+ return matcher(path) && !ignore$1(path);
55219
+ }],
55220
+ exclude: debug$7 ? (_, p$1) => {
55221
+ const skipped = excludePredicate(_, p$1);
55222
+ log(`${skipped ? "skipped" : "crawling"} ${p$1}`);
53942
55223
  return skipped;
53943
- } : (_, p$1) => {
53944
- const relativePath = formatExclude(p$1, true);
53945
- return relativePath !== "." && !partialMatcher(relativePath) || ignore$1(relativePath);
53946
- },
53947
- fs: options.fs ? {
53948
- readdir: options.fs.readdir || nativeFs.readdir,
53949
- readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
53950
- realpath: options.fs.realpath || nativeFs.realpath,
53951
- realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
53952
- stat: options.fs.stat || nativeFs.stat,
53953
- statSync: options.fs.statSync || nativeFs.statSync
53954
- } : void 0,
55224
+ } : excludePredicate,
55225
+ fs: options.fs,
53955
55226
  pathSeparator: "/",
53956
- relativePaths: true,
53957
- resolveSymlinks: true,
55227
+ relativePaths: !absolute$1,
55228
+ resolvePaths: absolute$1,
55229
+ includeBasePath: absolute$1,
55230
+ resolveSymlinks: followSymbolicLinks,
55231
+ excludeSymlinks: !followSymbolicLinks,
55232
+ excludeFiles: onlyDirectories,
55233
+ includeDirs: onlyDirectories || !options.onlyFiles,
55234
+ maxDepth,
53958
55235
  signal: options.signal
55236
+ }).crawl(root);
55237
+ if (options.debug) log("internal properties:", {
55238
+ ...props,
55239
+ root
55240
+ });
55241
+ return [crawler, cwd !== root && !absolute$1 && buildRelative(cwd, root)];
55242
+ }
55243
+ function formatPaths(paths, mapper) {
55244
+ if (mapper) for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) paths[i$1] = mapper(paths[i$1]);
55245
+ return paths;
55246
+ }
55247
+ const defaultOptions = {
55248
+ caseSensitiveMatch: true,
55249
+ cwd: process.cwd(),
55250
+ debug: !!process.env.TINYGLOBBY_DEBUG,
55251
+ expandDirectories: true,
55252
+ followSymbolicLinks: true,
55253
+ onlyFiles: true
55254
+ };
55255
+ function getOptions(options) {
55256
+ const opts = {
55257
+ ...defaultOptions,
55258
+ ...options
53959
55259
  };
53960
- if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
53961
- if (options.absolute) {
53962
- fdirOptions.relativePaths = false;
53963
- fdirOptions.resolvePaths = true;
53964
- fdirOptions.includeBasePath = true;
53965
- }
53966
- if (options.followSymbolicLinks === false) {
53967
- fdirOptions.resolveSymlinks = false;
53968
- fdirOptions.excludeSymlinks = true;
53969
- }
53970
- if (options.onlyDirectories) {
53971
- fdirOptions.excludeFiles = true;
53972
- fdirOptions.includeDirs = true;
53973
- } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
53974
- props.root = props.root.replace(BACKSLASHES, "");
53975
- const root = props.root;
53976
- if (options.debug) log("internal properties:", props);
53977
- const relative$2 = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
53978
- return [new Builder(fdirOptions).crawl(root), relative$2];
55260
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve$1(opts.cwd)).replace(BACKSLASHES, "/");
55261
+ opts.ignore = ensureStringArray(opts.ignore);
55262
+ opts.fs && (opts.fs = {
55263
+ readdir: opts.fs.readdir || readdir,
55264
+ readdirSync: opts.fs.readdirSync || readdirSync,
55265
+ realpath: opts.fs.realpath || realpath,
55266
+ realpathSync: opts.fs.realpathSync || realpathSync$1,
55267
+ stat: opts.fs.stat || stat,
55268
+ statSync: opts.fs.statSync || statSync$1
55269
+ });
55270
+ if (opts.debug) log("globbing with options:", opts);
55271
+ return opts;
55272
+ }
55273
+ function getCrawler(globInput, inputOptions = {}) {
55274
+ var _ref;
55275
+ if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
55276
+ const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
55277
+ const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
55278
+ const options = getOptions(isModern ? inputOptions : globInput);
55279
+ return patterns.length > 0 ? buildCrawler(options, patterns) : [];
53979
55280
  }
53980
- function globSync(patternsOrOptions, options) {
53981
- if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
53982
- const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
53983
- const opts = isModern ? options : patternsOrOptions;
53984
- const [crawler, relative$2] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
53985
- if (!relative$2) return crawler.sync();
53986
- return formatPaths(crawler.sync(), relative$2);
55281
+ function globSync(globInput, options) {
55282
+ const [crawler, relative$2] = getCrawler(globInput, options);
55283
+ return crawler ? formatPaths(crawler.sync(), relative$2) : [];
55284
+ }
55285
+
55286
+ //#endregion
55287
+ //#region src/update-check.ts
55288
+ let updateCheckPromise;
55289
+ /**
55290
+ * Checks if a newer version of `@cloudflare/vite-plugin` is available on npm.
55291
+ *
55292
+ * The result is memoised so the check is only performed once per process
55293
+ * lifetime — callers can invoke this freely without worrying about redundant
55294
+ * network requests.
55295
+ *
55296
+ * @returns A discriminated result indicating whether an update is available,
55297
+ * the package is already up-to-date, or the check failed
55298
+ */
55299
+ function checkForNpmUpdate() {
55300
+ return updateCheckPromise ??= (async () => {
55301
+ try {
55302
+ const pkg = (await import("../package.json", { with: { type: "json" } })).default;
55303
+ return fetchLatestNpmVersion(pkg.name, pkg.version);
55304
+ } catch {
55305
+ return { status: "failed" };
55306
+ }
55307
+ })();
53987
55308
  }
53988
55309
 
53989
55310
  //#endregion
@@ -54017,7 +55338,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
54017
55338
  modules: [{
54018
55339
  type: "ESModule",
54019
55340
  path: nodePath.join(miniflareModulesRoot, ROUTER_WORKER_PATH),
54020
- contents: fs$2.readFileSync(fileURLToPath(new URL(ROUTER_WORKER_PATH, import.meta.url)))
55341
+ contents: fs$1.readFileSync(fileURLToPath(new URL(ROUTER_WORKER_PATH, import.meta.url)))
54021
55342
  }],
54022
55343
  bindings: { CONFIG: { has_user_worker: resolvedPluginConfig.type === "workers" } },
54023
55344
  serviceBindings: {
@@ -54032,7 +55353,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
54032
55353
  modules: [{
54033
55354
  type: "ESModule",
54034
55355
  path: nodePath.join(miniflareModulesRoot, ASSET_WORKER_PATH),
54035
- contents: fs$2.readFileSync(fileURLToPath(new URL(ASSET_WORKER_PATH, import.meta.url)))
55356
+ contents: fs$1.readFileSync(fileURLToPath(new URL(ASSET_WORKER_PATH, import.meta.url)))
54036
55357
  }],
54037
55358
  bindings: {
54038
55359
  CONFIG: assetsConfig,
@@ -54076,7 +55397,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
54076
55397
  modules: [{
54077
55398
  type: "ESModule",
54078
55399
  path: nodePath.join(miniflareModulesRoot, VITE_PROXY_WORKER_PATH),
54079
- contents: fs$2.readFileSync(fileURLToPath(new URL(VITE_PROXY_WORKER_PATH, import.meta.url)))
55400
+ contents: fs$1.readFileSync(fileURLToPath(new URL(VITE_PROXY_WORKER_PATH, import.meta.url)))
54080
55401
  }],
54081
55402
  serviceBindings: {
54082
55403
  ...entryWorkerConfig ? { ENTRY_USER_WORKER: entryWorkerConfig.name } : {},
@@ -54137,12 +55458,12 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
54137
55458
  {
54138
55459
  type: "ESModule",
54139
55460
  path: nodePath.join(miniflareModulesRoot, RUNNER_PATH),
54140
- contents: fs$2.readFileSync(fileURLToPath(new URL(RUNNER_PATH, import.meta.url)))
55461
+ contents: fs$1.readFileSync(fileURLToPath(new URL(RUNNER_PATH, import.meta.url)))
54141
55462
  },
54142
55463
  {
54143
55464
  type: "ESModule",
54144
55465
  path: nodePath.join(miniflareModulesRoot, "workers/runner-worker/vite/module-runner"),
54145
- contents: fs$2.readFileSync(fileURLToPath(new URL(satisfiesMinimumViteVersion("7.2.0") ? MODULE_RUNNER_PATH : MODULE_RUNNER_LEGACY_PATH, import.meta.url)))
55466
+ contents: fs$1.readFileSync(fileURLToPath(new URL(satisfiesMinimumViteVersion("7.2.0") ? MODULE_RUNNER_PATH : MODULE_RUNNER_LEGACY_PATH, import.meta.url)))
54146
55467
  }
54147
55468
  ],
54148
55469
  unsafeUseModuleFallbackService: true,
@@ -54313,6 +55634,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
54313
55634
  * A Miniflare logger that forwards messages onto a Vite logger.
54314
55635
  */
54315
55636
  var ViteMiniflareLogger = class extends Log {
55637
+ #warnedCompatibilityDateFallback = false;
54316
55638
  logger;
54317
55639
  constructor(config) {
54318
55640
  super(miniflareLogLevelFromViteLogLevel(config.logLevel));
@@ -54325,6 +55647,18 @@ var ViteMiniflareLogger = class extends Log {
54325
55647
  case LogLevel.INFO: return this.logger.info(message);
54326
55648
  }
54327
55649
  }
55650
+ warn(message) {
55651
+ if (!message.startsWith("The latest compatibility date supported by")) {
55652
+ this.logger.warn(message);
55653
+ return;
55654
+ }
55655
+ if (this.#warnedCompatibilityDateFallback) return;
55656
+ this.#warnedCompatibilityDateFallback = true;
55657
+ checkForNpmUpdate().then((result) => {
55658
+ if (result.status !== "update-available") return;
55659
+ this.logger.warn(`${message}\nFeatures enabled by your requested compatibility date may not be available.\nUpgrade to \`@cloudflare/vite-plugin@${result.latest}\` to remove this warning.`);
55660
+ });
55661
+ }
54328
55662
  logReady() {}
54329
55663
  };
54330
55664
  function miniflareLogLevelFromViteLogLevel(level = "info") {
@@ -54704,12 +56038,12 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
54704
56038
  },
54705
56039
  writeBundle() {
54706
56040
  assertIsNotPreview(ctx);
54707
- if (this.environment.name === (ctx.resolvedPluginConfig.type === "workers" ? ctx.resolvedPluginConfig.entryWorkerEnvironmentName : "client")) writeDeployConfig(ctx.resolvedPluginConfig, ctx.resolvedViteConfig);
56041
+ if (this.environment.name === (ctx.resolvedPluginConfig.type === "workers" ? ctx.resolvedPluginConfig.entryWorkerEnvironmentName : "client")) writeDeployConfig(ctx.resolvedPluginConfig, ctx.resolvedViteConfig, ctx.resolvedPluginConfig.type === "assets-only");
54708
56042
  }
54709
56043
  };
54710
56044
  });
54711
56045
  function readAssetsIgnoreFile(assetsIgnorePath) {
54712
- const content = existsSync(assetsIgnorePath) ? readFileSync(assetsIgnorePath, "utf-8") : "";
56046
+ const content = fs$1.existsSync(assetsIgnorePath) ? fs$1.readFileSync(assetsIgnorePath, "utf-8") : "";
54713
56047
  if (content.length === 0) return "";
54714
56048
  return content.at(-1) === "\n" ? content : `${content}\n`;
54715
56049
  }
@@ -54797,7 +56131,7 @@ const rscPlugin = createPlugin("rsc", () => {
54797
56131
  let isDockerCached;
54798
56132
  function hasDockerEnv() {
54799
56133
  try {
54800
- fs.statSync("/.dockerenv");
56134
+ fs2.statSync("/.dockerenv");
54801
56135
  return true;
54802
56136
  } catch {
54803
56137
  return false;
@@ -54805,7 +56139,7 @@ function hasDockerEnv() {
54805
56139
  }
54806
56140
  function hasDockerCGroup() {
54807
56141
  try {
54808
- return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
56142
+ return fs2.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
54809
56143
  } catch {
54810
56144
  return false;
54811
56145
  }
@@ -54820,7 +56154,7 @@ function isDocker() {
54820
56154
  let cachedResult;
54821
56155
  const hasContainerEnv = () => {
54822
56156
  try {
54823
- fs.statSync("/run/.containerenv");
56157
+ fs2.statSync("/run/.containerenv");
54824
56158
  return true;
54825
56159
  } catch {
54826
56160
  return false;
@@ -54840,7 +56174,7 @@ const isWsl = () => {
54840
56174
  return true;
54841
56175
  }
54842
56176
  try {
54843
- return fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
56177
+ return fs2.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
54844
56178
  } catch {
54845
56179
  return false;
54846
56180
  }
@@ -54891,11 +56225,11 @@ const wslDrivesMountPoint = (() => {
54891
56225
  const configFilePath = "/etc/wsl.conf";
54892
56226
  let isConfigFileExists = false;
54893
56227
  try {
54894
- await fs$1.access(configFilePath, constants$1.F_OK);
56228
+ await fs.access(configFilePath, constants$1.F_OK);
54895
56229
  isConfigFileExists = true;
54896
56230
  } catch {}
54897
56231
  if (!isConfigFileExists) return defaultMountPoint;
54898
- const parsedMountPoint = parseMountPointFromConfig(await fs$1.readFile(configFilePath, { encoding: "utf8" }));
56232
+ const parsedMountPoint = parseMountPointFromConfig(await fs.readFile(configFilePath, { encoding: "utf8" }));
54899
56233
  if (parsedMountPoint === void 0) return defaultMountPoint;
54900
56234
  mountPoint = parsedMountPoint;
54901
56235
  mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
@@ -54911,7 +56245,7 @@ const canAccessPowerShell = async () => {
54911
56245
  canAccessPowerShellPromise ??= (async () => {
54912
56246
  try {
54913
56247
  const psPath = await powerShellPath();
54914
- await fs$1.access(psPath, constants$1.X_OK);
56248
+ await fs.access(psPath, constants$1.X_OK);
54915
56249
  return true;
54916
56250
  } catch {
54917
56251
  return false;
@@ -54924,13 +56258,13 @@ const wslDefaultBrowser = async () => {
54924
56258
  const { stdout } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
54925
56259
  return stdout.trim();
54926
56260
  };
54927
- const convertWslPathToWindows = async (path$2) => {
54928
- if (/^[a-z]+:\/\//i.test(path$2)) return path$2;
56261
+ const convertWslPathToWindows = async (path) => {
56262
+ if (/^[a-z]+:\/\//i.test(path)) return path;
54929
56263
  try {
54930
- const { stdout } = await execFile$1("wslpath", ["-aw", path$2], { encoding: "utf8" });
56264
+ const { stdout } = await execFile$1("wslpath", ["-aw", path], { encoding: "utf8" });
54931
56265
  return stdout.trim();
54932
56266
  } catch {
54933
- return path$2;
56267
+ return path;
54934
56268
  }
54935
56269
  };
54936
56270
 
@@ -55116,8 +56450,8 @@ var is_in_ssh_default = isInSsh;
55116
56450
  //#endregion
55117
56451
  //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
55118
56452
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
55119
- const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
55120
- const localXdgOpenPath = path.join(__dirname, "xdg-open");
56453
+ const __dirname = import.meta.url ? path3.dirname(fileURLToPath(import.meta.url)) : "";
56454
+ const localXdgOpenPath = path3.join(__dirname, "xdg-open");
55121
56455
  const { platform, arch: arch$1 } = process$1;
55122
56456
  const tryEachApp = async (apps$1, opener) => {
55123
56457
  if (apps$1.length === 0) return;
@@ -55228,7 +56562,7 @@ const baseOpen = async (options) => {
55228
56562
  const isBundled = !__dirname || __dirname === "/";
55229
56563
  let exeLocalXdgOpen = false;
55230
56564
  try {
55231
- await fs$1.access(localXdgOpenPath, constants$1.X_OK);
56565
+ await fs.access(localXdgOpenPath, constants$1.X_OK);
55232
56566
  exeLocalXdgOpen = true;
55233
56567
  } catch {}
55234
56568
  command = process$1.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;