@cloudflare/vite-plugin 1.34.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +291 -256
- package/dist/index.mjs.map +1 -1
- package/dist/{package-dg3YhLY6.mjs → package-CY9M77Eh.mjs} +2 -2
- package/dist/{package-dg3YhLY6.mjs.map → package-CY9M77Eh.mjs.map} +1 -1
- package/dist/workers/asset-worker/index.js +16 -5
- package/dist/workers/router-worker/index.js +138 -107
- package/dist/workers/runner-worker/index.js +5 -4
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from "node:module";
|
|
2
2
|
import assert from "node:assert";
|
|
3
|
-
import { CoreHeaders, CorePaths, Log, LogLevel, Miniflare, Request as Request$1, Response as Response$1, buildPublicUrl, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey } from "miniflare";
|
|
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
|
|
6
|
+
import path, { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
7
7
|
import * as util$1 from "node:util";
|
|
8
8
|
import { format, inspect, promisify } from "node:util";
|
|
9
9
|
import * as vite from "vite";
|
|
@@ -24,7 +24,7 @@ import v8 from "node:v8";
|
|
|
24
24
|
import { defineEnv } from "unenv";
|
|
25
25
|
import * as nativeFs$1 from "fs";
|
|
26
26
|
import nativeFs from "fs";
|
|
27
|
-
import path, { basename, dirname as dirname$1, normalize, posix, relative as relative$1, resolve as resolve$1, sep } from "path";
|
|
27
|
+
import path$1, { basename, dirname as dirname$1, normalize, posix, relative as relative$1, resolve as resolve$1, sep } from "path";
|
|
28
28
|
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
29
29
|
import { createRequire as createRequire$1 } from "module";
|
|
30
30
|
import { WebSocketServer } from "ws";
|
|
@@ -1503,7 +1503,7 @@ async function assertWranglerVersion() {
|
|
|
1503
1503
|
* The default compatibility date to use when the user omits one.
|
|
1504
1504
|
* This value is injected at build time and remains fixed for each release.
|
|
1505
1505
|
*/
|
|
1506
|
-
const DEFAULT_COMPAT_DATE = "2026-
|
|
1506
|
+
const DEFAULT_COMPAT_DATE = "2026-05-05";
|
|
1507
1507
|
|
|
1508
1508
|
//#endregion
|
|
1509
1509
|
//#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@0.8.0/node_modules/@remix-run/node-fetch-server/dist/node-fetch-server.js
|
|
@@ -1997,7 +1997,7 @@ var MetricsRegistry = class {
|
|
|
1997
1997
|
};
|
|
1998
1998
|
|
|
1999
1999
|
//#endregion
|
|
2000
|
-
//#region ../workers-utils/dist/chunk-
|
|
2000
|
+
//#region ../workers-utils/dist/chunk-XXCQEG76.mjs
|
|
2001
2001
|
var UserError = class extends Error {
|
|
2002
2002
|
static {
|
|
2003
2003
|
__name(this, "UserError");
|
|
@@ -2006,7 +2006,7 @@ var UserError = class extends Error {
|
|
|
2006
2006
|
constructor(message, options) {
|
|
2007
2007
|
super(message, options);
|
|
2008
2008
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
2009
|
-
this.telemetryMessage = options?.telemetryMessage ===
|
|
2009
|
+
this.telemetryMessage = typeof options?.telemetryMessage === "string" ? options.telemetryMessage : options?.telemetryMessage ? message : void 0;
|
|
2010
2010
|
}
|
|
2011
2011
|
};
|
|
2012
2012
|
var DeprecationError = class extends UserError {
|
|
@@ -2019,13 +2019,14 @@ ${message}`, options);
|
|
|
2019
2019
|
}
|
|
2020
2020
|
};
|
|
2021
2021
|
var FatalError = class extends UserError {
|
|
2022
|
-
constructor(message, code, options) {
|
|
2023
|
-
super(message, options);
|
|
2024
|
-
this.code = code;
|
|
2025
|
-
}
|
|
2026
2022
|
static {
|
|
2027
2023
|
__name(this, "FatalError");
|
|
2028
2024
|
}
|
|
2025
|
+
code;
|
|
2026
|
+
constructor(message, options) {
|
|
2027
|
+
super(message, options);
|
|
2028
|
+
this.code = options.code;
|
|
2029
|
+
}
|
|
2029
2030
|
};
|
|
2030
2031
|
var CommandLineArgsError = class extends UserError {
|
|
2031
2032
|
static {
|
|
@@ -2033,10 +2034,6 @@ var CommandLineArgsError = class extends UserError {
|
|
|
2033
2034
|
}
|
|
2034
2035
|
};
|
|
2035
2036
|
var JsonFriendlyFatalError = class extends FatalError {
|
|
2036
|
-
constructor(message, code, options) {
|
|
2037
|
-
super(message, code, options);
|
|
2038
|
-
this.code = code;
|
|
2039
|
-
}
|
|
2040
2037
|
static {
|
|
2041
2038
|
__name(this, "JsonFriendlyFatalError");
|
|
2042
2039
|
}
|
|
@@ -2051,9 +2048,9 @@ var MissingConfigError = class extends Error {
|
|
|
2051
2048
|
this.telemetryMessage = `Missing config value for ${key}`;
|
|
2052
2049
|
}
|
|
2053
2050
|
};
|
|
2054
|
-
function createFatalError(message, isJson,
|
|
2055
|
-
if (isJson) return new JsonFriendlyFatalError(JSON.stringify(message),
|
|
2056
|
-
|
|
2051
|
+
function createFatalError(message, isJson, options) {
|
|
2052
|
+
if (isJson) return new JsonFriendlyFatalError(JSON.stringify(message), options);
|
|
2053
|
+
return new FatalError(`${message}`, options);
|
|
2057
2054
|
}
|
|
2058
2055
|
__name(createFatalError, "createFatalError");
|
|
2059
2056
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -4073,7 +4070,8 @@ function readFileSyncToBuffer(file2) {
|
|
|
4073
4070
|
const { message } = err;
|
|
4074
4071
|
throw new ParseError({
|
|
4075
4072
|
text: `Could not read file: ${file2}`,
|
|
4076
|
-
notes: [{ text: message.replace(file2, resolve(file2)) }]
|
|
4073
|
+
notes: [{ text: message.replace(file2, resolve(file2)) }],
|
|
4074
|
+
telemetryMessage: false
|
|
4077
4075
|
});
|
|
4078
4076
|
}
|
|
4079
4077
|
}
|
|
@@ -4332,7 +4330,7 @@ function resolveWranglerConfigPath({ config, script }, options) {
|
|
|
4332
4330
|
deployConfigPath: void 0,
|
|
4333
4331
|
redirected: false
|
|
4334
4332
|
};
|
|
4335
|
-
return findWranglerConfig$1(script !== void 0 ?
|
|
4333
|
+
return findWranglerConfig$1(script !== void 0 ? path.dirname(script) : process.cwd(), options);
|
|
4336
4334
|
}
|
|
4337
4335
|
__name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
4338
4336
|
function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -4363,28 +4361,31 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
4363
4361
|
const deployConfigFile = readFileSync$1(deployConfigPath);
|
|
4364
4362
|
try {
|
|
4365
4363
|
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
4366
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
4364
|
+
redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
|
|
4367
4365
|
} catch (e) {
|
|
4368
|
-
throw new UserError(`Failed to parse the deploy configuration file at ${
|
|
4366
|
+
throw new UserError(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
|
|
4367
|
+
cause: e,
|
|
4368
|
+
telemetryMessage: false
|
|
4369
|
+
});
|
|
4369
4370
|
}
|
|
4370
4371
|
if (!redirectedConfigPath) throw new UserError(esm_default`
|
|
4371
|
-
A deploy configuration file was found at "${
|
|
4372
|
+
A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
|
|
4372
4373
|
But this is not valid - the required "configPath" property was not found.
|
|
4373
4374
|
Instead this file contains:
|
|
4374
4375
|
\`\`\`
|
|
4375
4376
|
${deployConfigFile}
|
|
4376
4377
|
\`\`\`
|
|
4377
|
-
|
|
4378
|
+
`, { telemetryMessage: false });
|
|
4378
4379
|
if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default`
|
|
4379
|
-
There is a deploy configuration at "${
|
|
4380
|
-
But the redirected configuration path it points to, "${
|
|
4381
|
-
|
|
4380
|
+
There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
|
|
4381
|
+
But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
|
|
4382
|
+
`, { telemetryMessage: false });
|
|
4382
4383
|
if (userConfigPath) {
|
|
4383
|
-
if (
|
|
4384
|
-
Found both a user configuration file at "${
|
|
4385
|
-
and a deploy configuration file at "${
|
|
4384
|
+
if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
|
|
4385
|
+
Found both a user configuration file at "${path.relative(".", userConfigPath)}"
|
|
4386
|
+
and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
|
|
4386
4387
|
But these do not share the same base path so it is not clear which should be used.
|
|
4387
|
-
|
|
4388
|
+
`, { telemetryMessage: false });
|
|
4388
4389
|
}
|
|
4389
4390
|
return {
|
|
4390
4391
|
configPath: redirectedConfigPath,
|
|
@@ -5591,10 +5592,10 @@ var require_util$5 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
|
|
|
5591
5592
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
5592
5593
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
5593
5594
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
5594
|
-
let path$
|
|
5595
|
+
let path$2 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
5595
5596
|
if (origin[origin.length - 1] === "/") origin = origin.slice(0, origin.length - 1);
|
|
5596
|
-
if (path$
|
|
5597
|
-
return new URL(`${origin}${path$
|
|
5597
|
+
if (path$2 && path$2[0] !== "/") path$2 = `/${path$2}`;
|
|
5598
|
+
return new URL(`${origin}${path$2}`);
|
|
5598
5599
|
}
|
|
5599
5600
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
5600
5601
|
return url;
|
|
@@ -6469,8 +6470,8 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
6469
6470
|
debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$2, error.message);
|
|
6470
6471
|
});
|
|
6471
6472
|
diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
|
|
6472
|
-
const { request: { method, path: path$
|
|
6473
|
-
debugLog("sending request to %s %s%s", method, origin, path$
|
|
6473
|
+
const { request: { method, path: path$2, origin } } = evt;
|
|
6474
|
+
debugLog("sending request to %s %s%s", method, origin, path$2);
|
|
6474
6475
|
});
|
|
6475
6476
|
}
|
|
6476
6477
|
let isTrackingRequestEvents = false;
|
|
@@ -6482,16 +6483,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
6482
6483
|
}
|
|
6483
6484
|
isTrackingRequestEvents = true;
|
|
6484
6485
|
diagnosticsChannel$1.subscribe("undici:request:headers", (evt) => {
|
|
6485
|
-
const { request: { method, path: path$
|
|
6486
|
-
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$
|
|
6486
|
+
const { request: { method, path: path$2, origin }, response: { statusCode } } = evt;
|
|
6487
|
+
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$2, statusCode);
|
|
6487
6488
|
});
|
|
6488
6489
|
diagnosticsChannel$1.subscribe("undici:request:trailers", (evt) => {
|
|
6489
|
-
const { request: { method, path: path$
|
|
6490
|
-
debugLog("trailers received from %s %s%s", method, origin, path$
|
|
6490
|
+
const { request: { method, path: path$2, origin } } = evt;
|
|
6491
|
+
debugLog("trailers received from %s %s%s", method, origin, path$2);
|
|
6491
6492
|
});
|
|
6492
6493
|
diagnosticsChannel$1.subscribe("undici:request:error", (evt) => {
|
|
6493
|
-
const { request: { method, path: path$
|
|
6494
|
-
debugLog("request to %s %s%s errored - %s", method, origin, path$
|
|
6494
|
+
const { request: { method, path: path$2, origin }, error } = evt;
|
|
6495
|
+
debugLog("request to %s %s%s errored - %s", method, origin, path$2, error.message);
|
|
6495
6496
|
});
|
|
6496
6497
|
}
|
|
6497
6498
|
let isTrackingWebSocketEvents = false;
|
|
@@ -6544,10 +6545,10 @@ var require_request$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
6544
6545
|
const invalidPathRegex = /[^\u0021-\u00ff]/;
|
|
6545
6546
|
const kHandler = Symbol("handler");
|
|
6546
6547
|
var Request$6 = class {
|
|
6547
|
-
constructor(origin, { path: path$
|
|
6548
|
-
if (typeof path$
|
|
6549
|
-
else if (path$
|
|
6550
|
-
else if (invalidPathRegex.test(path$
|
|
6548
|
+
constructor(origin, { path: path$2, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
|
|
6549
|
+
if (typeof path$2 !== "string") throw new InvalidArgumentError$35("path must be a string");
|
|
6550
|
+
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");
|
|
6551
|
+
else if (invalidPathRegex.test(path$2)) throw new InvalidArgumentError$35("invalid request path");
|
|
6551
6552
|
if (typeof method !== "string") throw new InvalidArgumentError$35("method must be a string");
|
|
6552
6553
|
else if (normalizedMethodRecords$1[method] === void 0 && !isValidHTTPToken$2(method)) throw new InvalidArgumentError$35("invalid request method");
|
|
6553
6554
|
if (upgrade$1 && typeof upgrade$1 !== "string") throw new InvalidArgumentError$35("upgrade must be a string");
|
|
@@ -6588,7 +6589,7 @@ var require_request$1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
6588
6589
|
this.completed = false;
|
|
6589
6590
|
this.aborted = false;
|
|
6590
6591
|
this.upgrade = upgrade$1 || null;
|
|
6591
|
-
this.path = query ? serializePathWithQuery$3(path$
|
|
6592
|
+
this.path = query ? serializePathWithQuery$3(path$2, query) : path$2;
|
|
6592
6593
|
this.origin = origin;
|
|
6593
6594
|
this.protocol = getProtocolFromUrlString(origin);
|
|
6594
6595
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -11071,7 +11072,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
11071
11072
|
* @returns
|
|
11072
11073
|
*/
|
|
11073
11074
|
function writeH1(client, request$2) {
|
|
11074
|
-
const { method, path: path$
|
|
11075
|
+
const { method, path: path$2, host, upgrade: upgrade$1, blocking, reset } = request$2;
|
|
11075
11076
|
let { body, headers, contentLength } = request$2;
|
|
11076
11077
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
11077
11078
|
if (util$23.isFormDataLike(body)) {
|
|
@@ -11116,7 +11117,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
11116
11117
|
if (client[kMaxRequests$1] && socket[kCounter$1]++ >= client[kMaxRequests$1]) socket[kReset$1] = true;
|
|
11117
11118
|
if (blocking) socket[kBlocking] = true;
|
|
11118
11119
|
if (socket.setTypeOfService) socket.setTypeOfService(request$2.typeOfService);
|
|
11119
|
-
let header = `${method} ${path$
|
|
11120
|
+
let header = `${method} ${path$2} HTTP/1.1\r\n`;
|
|
11120
11121
|
if (typeof host === "string") header += `host: ${host}\r\n`;
|
|
11121
11122
|
else header += client[kHostHeader$1];
|
|
11122
11123
|
if (upgrade$1) header += `connection: upgrade\r\nupgrade: ${upgrade$1}\r\n`;
|
|
@@ -11652,7 +11653,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
11652
11653
|
function writeH2(client, request$2) {
|
|
11653
11654
|
const requestTimeout = request$2.bodyTimeout ?? client[kBodyTimeout$1];
|
|
11654
11655
|
const session = client[kHTTP2Session];
|
|
11655
|
-
const { method, path: path$
|
|
11656
|
+
const { method, path: path$2, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
|
|
11656
11657
|
let { body } = request$2;
|
|
11657
11658
|
if (upgrade$1 != null && upgrade$1 !== "websocket") {
|
|
11658
11659
|
util$22.errorRequest(client, request$2, new InvalidArgumentError$30(`Custom upgrade "${upgrade$1}" not supported over HTTP/2`));
|
|
@@ -11705,7 +11706,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
11705
11706
|
}
|
|
11706
11707
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
11707
11708
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
11708
|
-
headers[HTTP2_HEADER_PATH] = path$
|
|
11709
|
+
headers[HTTP2_HEADER_PATH] = path$2;
|
|
11709
11710
|
if (protocol === "ws:" || protocol === "wss:") headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
11710
11711
|
else headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
11711
11712
|
stream$2 = session.request(headers, {
|
|
@@ -11747,7 +11748,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm
|
|
|
11747
11748
|
stream$2.setTimeout(requestTimeout);
|
|
11748
11749
|
return true;
|
|
11749
11750
|
}
|
|
11750
|
-
headers[HTTP2_HEADER_PATH] = path$
|
|
11751
|
+
headers[HTTP2_HEADER_PATH] = path$2;
|
|
11751
11752
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
11752
11753
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
11753
11754
|
if (body && typeof body.read === "function") body.read(0);
|
|
@@ -13573,8 +13574,8 @@ var require_proxy_agent = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pn
|
|
|
13573
13574
|
}
|
|
13574
13575
|
if (onHeaders) onHeaders.call(this, statusCode, data$1, resume$1);
|
|
13575
13576
|
};
|
|
13576
|
-
const { origin, path: path$
|
|
13577
|
-
opts.path = origin + path$
|
|
13577
|
+
const { origin, path: path$2 = "/", headers = {} } = opts;
|
|
13578
|
+
opts.path = origin + path$2;
|
|
13578
13579
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
13579
13580
|
const { host } = new URL(origin);
|
|
13580
13581
|
headers.host = host;
|
|
@@ -15358,16 +15359,16 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
15358
15359
|
}
|
|
15359
15360
|
return normalizedQp;
|
|
15360
15361
|
}
|
|
15361
|
-
function safeUrl(path$
|
|
15362
|
-
if (typeof path$
|
|
15363
|
-
const pathSegments = path$
|
|
15364
|
-
if (pathSegments.length !== 2) return path$
|
|
15362
|
+
function safeUrl(path$2) {
|
|
15363
|
+
if (typeof path$2 !== "string") return path$2;
|
|
15364
|
+
const pathSegments = path$2.split("?", 3);
|
|
15365
|
+
if (pathSegments.length !== 2) return path$2;
|
|
15365
15366
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
15366
15367
|
qp.sort();
|
|
15367
15368
|
return [...pathSegments, qp.toString()].join("?");
|
|
15368
15369
|
}
|
|
15369
|
-
function matchKey(mockDispatch$1, { path: path$
|
|
15370
|
-
const pathMatch = matchValue$1(mockDispatch$1.path, path$
|
|
15370
|
+
function matchKey(mockDispatch$1, { path: path$2, method, body, headers }) {
|
|
15371
|
+
const pathMatch = matchValue$1(mockDispatch$1.path, path$2);
|
|
15371
15372
|
const methodMatch = matchValue$1(mockDispatch$1.method, method);
|
|
15372
15373
|
const bodyMatch = typeof mockDispatch$1.body !== "undefined" ? matchValue$1(mockDispatch$1.body, body) : true;
|
|
15373
15374
|
const headersMatch = matchHeaders(mockDispatch$1, headers);
|
|
@@ -15385,8 +15386,8 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
15385
15386
|
const basePath = key.query ? serializePathWithQuery$2(key.path, key.query) : key.path;
|
|
15386
15387
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
15387
15388
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
15388
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$
|
|
15389
|
-
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$
|
|
15389
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$2, ignoreTrailingSlash }) => {
|
|
15390
|
+
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$2)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path$2), resolvedPath);
|
|
15390
15391
|
});
|
|
15391
15392
|
if (matchedMockDispatches.length === 0) throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
15392
15393
|
matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue$1(method, key.method));
|
|
@@ -15429,15 +15430,15 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
15429
15430
|
/**
|
|
15430
15431
|
* @param {string} path Path to remove trailing slash from
|
|
15431
15432
|
*/
|
|
15432
|
-
function removeTrailingSlash(path$
|
|
15433
|
-
while (path$
|
|
15434
|
-
if (path$
|
|
15435
|
-
return path$
|
|
15433
|
+
function removeTrailingSlash(path$2) {
|
|
15434
|
+
while (path$2.endsWith("/")) path$2 = path$2.slice(0, -1);
|
|
15435
|
+
if (path$2.length === 0) path$2 = "/";
|
|
15436
|
+
return path$2;
|
|
15436
15437
|
}
|
|
15437
15438
|
function buildKey$1(opts) {
|
|
15438
|
-
const { path: path$
|
|
15439
|
+
const { path: path$2, method, body, headers, query } = opts;
|
|
15439
15440
|
return {
|
|
15440
|
-
path: path$
|
|
15441
|
+
path: path$2,
|
|
15441
15442
|
method,
|
|
15442
15443
|
body,
|
|
15443
15444
|
headers,
|
|
@@ -16004,10 +16005,10 @@ var require_pending_interceptors_formatter = /* @__PURE__ */ __commonJS$1({ "../
|
|
|
16004
16005
|
});
|
|
16005
16006
|
}
|
|
16006
16007
|
format(pendingInterceptors) {
|
|
16007
|
-
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$
|
|
16008
|
+
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$2, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
16008
16009
|
Method: method,
|
|
16009
16010
|
Origin: origin,
|
|
16010
|
-
Path: path$
|
|
16011
|
+
Path: path$2,
|
|
16011
16012
|
"Status code": statusCode,
|
|
16012
16013
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
16013
16014
|
Invocations: timesInvoked,
|
|
@@ -16065,8 +16066,8 @@ var require_mock_agent = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnp
|
|
|
16065
16066
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
16066
16067
|
const dispatchOpts = { ...opts };
|
|
16067
16068
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
16068
|
-
const [path$
|
|
16069
|
-
dispatchOpts.path = `${path$
|
|
16069
|
+
const [path$2, searchParams] = dispatchOpts.path.split("?");
|
|
16070
|
+
dispatchOpts.path = `${path$2}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
|
|
16070
16071
|
}
|
|
16071
16072
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
16072
16073
|
}
|
|
@@ -16543,10 +16544,10 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
|
|
|
16543
16544
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
16544
16545
|
*/
|
|
16545
16546
|
async loadSnapshots(filePath) {
|
|
16546
|
-
const path$
|
|
16547
|
-
if (!path$
|
|
16547
|
+
const path$2 = filePath || this.#snapshotPath;
|
|
16548
|
+
if (!path$2) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16548
16549
|
try {
|
|
16549
|
-
const data$1 = await readFile(resolve$3(path$
|
|
16550
|
+
const data$1 = await readFile(resolve$3(path$2), "utf8");
|
|
16550
16551
|
const parsed = JSON.parse(data$1);
|
|
16551
16552
|
if (Array.isArray(parsed)) {
|
|
16552
16553
|
this.#snapshots.clear();
|
|
@@ -16554,7 +16555,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
|
|
|
16554
16555
|
} else this.#snapshots = new Map(Object.entries(parsed));
|
|
16555
16556
|
} catch (error) {
|
|
16556
16557
|
if (error.code === "ENOENT") this.#snapshots.clear();
|
|
16557
|
-
else throw new UndiciError$1(`Failed to load snapshots from ${path$
|
|
16558
|
+
else throw new UndiciError$1(`Failed to load snapshots from ${path$2}`, { cause: error });
|
|
16558
16559
|
}
|
|
16559
16560
|
}
|
|
16560
16561
|
/**
|
|
@@ -16564,9 +16565,9 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$1({ "../../node_modul
|
|
|
16564
16565
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
16565
16566
|
*/
|
|
16566
16567
|
async saveSnapshots(filePath) {
|
|
16567
|
-
const path$
|
|
16568
|
-
if (!path$
|
|
16569
|
-
const resolvedPath = resolve$3(path$
|
|
16568
|
+
const path$2 = filePath || this.#snapshotPath;
|
|
16569
|
+
if (!path$2) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16570
|
+
const resolvedPath = resolve$3(path$2);
|
|
16570
16571
|
await mkdir(dirname$2(resolvedPath), { recursive: true });
|
|
16571
16572
|
const data$1 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
16572
16573
|
hash,
|
|
@@ -17133,11 +17134,11 @@ var require_redirect_handler = /* @__PURE__ */ __commonJS$1({ "../../node_module
|
|
|
17133
17134
|
return;
|
|
17134
17135
|
}
|
|
17135
17136
|
const { origin, pathname, search } = util$10.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
17136
|
-
const path$
|
|
17137
|
-
const redirectUrlString = `${origin}${path$
|
|
17137
|
+
const path$2 = search ? `${pathname}${search}` : pathname;
|
|
17138
|
+
const redirectUrlString = `${origin}${path$2}`;
|
|
17138
17139
|
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.`);
|
|
17139
17140
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
17140
|
-
this.opts.path = path$
|
|
17141
|
+
this.opts.path = path$2;
|
|
17141
17142
|
this.opts.origin = origin;
|
|
17142
17143
|
this.opts.query = null;
|
|
17143
17144
|
}
|
|
@@ -22095,10 +22096,10 @@ var require_fetch = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/und
|
|
|
22095
22096
|
const url = requestCurrentURL(request$2);
|
|
22096
22097
|
/** @type {import('../../..').Agent} */
|
|
22097
22098
|
const agent = fetchParams.controller.dispatcher;
|
|
22098
|
-
const path$
|
|
22099
|
+
const path$2 = url.pathname + url.search;
|
|
22099
22100
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
22100
22101
|
return new Promise((resolve$4, reject) => agent.dispatch({
|
|
22101
|
-
path: hasTrailingQuestionMark ? `${path$
|
|
22102
|
+
path: hasTrailingQuestionMark ? `${path$2}?` : path$2,
|
|
22102
22103
|
origin: url.origin,
|
|
22103
22104
|
method: request$2.method,
|
|
22104
22105
|
body: agent.isMockActive ? request$2.body && (request$2.body.source || request$2.body.stream) : body,
|
|
@@ -22880,9 +22881,9 @@ var require_util$2 = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
|
|
|
22880
22881
|
* path-value = <any CHAR except CTLs or ";">
|
|
22881
22882
|
* @param {string} path
|
|
22882
22883
|
*/
|
|
22883
|
-
function validateCookiePath(path$
|
|
22884
|
-
for (let i$1 = 0; i$1 < path$
|
|
22885
|
-
const code = path$
|
|
22884
|
+
function validateCookiePath(path$2) {
|
|
22885
|
+
for (let i$1 = 0; i$1 < path$2.length; ++i$1) {
|
|
22886
|
+
const code = path$2.charCodeAt(i$1);
|
|
22886
22887
|
if (code < 32 || code === 127 || code === 59) throw new Error("Invalid cookie path");
|
|
22887
22888
|
}
|
|
22888
22889
|
}
|
|
@@ -25990,9 +25991,9 @@ var require_undici = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/un
|
|
|
25990
25991
|
if (opts != null && typeof opts !== "object") throw new InvalidArgumentError("invalid opts");
|
|
25991
25992
|
if (opts && opts.path != null) {
|
|
25992
25993
|
if (typeof opts.path !== "string") throw new InvalidArgumentError("invalid opts.path");
|
|
25993
|
-
let path$
|
|
25994
|
-
if (!opts.path.startsWith("/")) path$
|
|
25995
|
-
url = new URL(util$3.parseOrigin(url).origin + path$
|
|
25994
|
+
let path$2 = opts.path;
|
|
25995
|
+
if (!opts.path.startsWith("/")) path$2 = `/${path$2}`;
|
|
25996
|
+
url = new URL(util$3.parseOrigin(url).origin + path$2);
|
|
25996
25997
|
} else {
|
|
25997
25998
|
if (!opts) opts = typeof url === "object" ? url : {};
|
|
25998
25999
|
url = util$3.parseURL(url);
|
|
@@ -30368,7 +30369,7 @@ __reExport(mod_esm_exports, __toESM(require_mod_cjs3(), 1));
|
|
|
30368
30369
|
var mod_esm_default = import_mod_cjs.default;
|
|
30369
30370
|
function getGlobalWranglerConfigPath() {
|
|
30370
30371
|
const configDir = mod_esm_default(".wrangler").config();
|
|
30371
|
-
const legacyConfigDir =
|
|
30372
|
+
const legacyConfigDir = path.join(os.homedir(), ".wrangler");
|
|
30372
30373
|
if (isDirectory(legacyConfigDir)) return legacyConfigDir;
|
|
30373
30374
|
else return configDir;
|
|
30374
30375
|
}
|
|
@@ -30379,7 +30380,7 @@ function getBooleanEnvironmentVariableFactory(options) {
|
|
|
30379
30380
|
switch (process.env[options.variableName]?.toLowerCase()) {
|
|
30380
30381
|
case "true": return true;
|
|
30381
30382
|
case "false": return false;
|
|
30382
|
-
default: throw new UserError(`Expected ${options.variableName} to be "true" or "false", but got ${JSON.stringify(process.env[options.variableName])}
|
|
30383
|
+
default: throw new UserError(`Expected ${options.variableName} to be "true" or "false", but got ${JSON.stringify(process.env[options.variableName])}`, { telemetryMessage: false });
|
|
30383
30384
|
}
|
|
30384
30385
|
};
|
|
30385
30386
|
}
|
|
@@ -30405,7 +30406,7 @@ function getProcessEnv(variableName, choices) {
|
|
|
30405
30406
|
}
|
|
30406
30407
|
__name(getProcessEnv, "getProcessEnv");
|
|
30407
30408
|
function assertOneOf(choices, value) {
|
|
30408
|
-
if (Array.isArray(choices) && !choices.includes(value)) throw new UserError(`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}
|
|
30409
|
+
if (Array.isArray(choices) && !choices.includes(value)) throw new UserError(`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}`, { telemetryMessage: false });
|
|
30409
30410
|
}
|
|
30410
30411
|
__name(assertOneOf, "assertOneOf");
|
|
30411
30412
|
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
|
@@ -30429,7 +30430,7 @@ var getCloudflareComplianceRegion = /* @__PURE__ */ __name((complianceConfig) =>
|
|
|
30429
30430
|
The compliance region has been set to different values in two places:
|
|
30430
30431
|
- \`CLOUDFLARE_COMPLIANCE_REGION\` environment variable: \`${complianceRegionFromEnv}\`
|
|
30431
30432
|
- \`compliance_region\` configuration property: \`${complianceConfig.compliance_region}\`
|
|
30432
|
-
|
|
30433
|
+
`, { telemetryMessage: false });
|
|
30433
30434
|
return complianceRegionFromEnv || complianceConfig?.compliance_region || "public";
|
|
30434
30435
|
}, "getCloudflareComplianceRegion");
|
|
30435
30436
|
var getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({
|
|
@@ -30464,7 +30465,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
|
|
|
30464
30465
|
var getRegistryPath = getEnvironmentVariableFactory({
|
|
30465
30466
|
variableName: "WRANGLER_REGISTRY_PATH",
|
|
30466
30467
|
defaultValue() {
|
|
30467
|
-
return
|
|
30468
|
+
return path.join(getGlobalWranglerConfigPath(), "registry");
|
|
30468
30469
|
}
|
|
30469
30470
|
});
|
|
30470
30471
|
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
|
|
@@ -30876,7 +30877,7 @@ function isPagesConfig(rawConfig) {
|
|
|
30876
30877
|
}
|
|
30877
30878
|
__name(isPagesConfig, "isPagesConfig");
|
|
30878
30879
|
function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
|
|
30879
|
-
const diagnostics = new Diagnostics(`Processing ${configPath ?
|
|
30880
|
+
const diagnostics = new Diagnostics(`Processing ${configPath ? path.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
|
|
30880
30881
|
validateOptionalProperty(diagnostics, "", "legacy_env", rawConfig.legacy_env, "boolean");
|
|
30881
30882
|
validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
|
|
30882
30883
|
validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
|
|
@@ -30967,7 +30968,7 @@ function applyPythonConfig(config, args) {
|
|
|
30967
30968
|
type: "PythonModule",
|
|
30968
30969
|
globs: ["**/*.py"]
|
|
30969
30970
|
});
|
|
30970
|
-
if (!config.compatibility_flags.includes("python_workers")) throw new UserError("The `python_workers` compatibility flag is required to use Python.");
|
|
30971
|
+
if (!config.compatibility_flags.includes("python_workers")) throw new UserError("The `python_workers` compatibility flag is required to use Python.", { telemetryMessage: false });
|
|
30971
30972
|
}
|
|
30972
30973
|
}
|
|
30973
30974
|
__name(applyPythonConfig, "applyPythonConfig");
|
|
@@ -30980,34 +30981,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
30980
30981
|
else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
|
|
30981
30982
|
return {
|
|
30982
30983
|
command,
|
|
30983
|
-
watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) =>
|
|
30984
|
+
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,
|
|
30984
30985
|
cwd
|
|
30985
30986
|
};
|
|
30986
30987
|
}
|
|
30987
30988
|
__name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
|
|
30988
30989
|
function normalizeAndValidateMainField(configPath, rawMain) {
|
|
30989
|
-
const configDir =
|
|
30990
|
+
const configDir = path.dirname(configPath ?? "wrangler.toml");
|
|
30990
30991
|
if (rawMain !== void 0) if (typeof rawMain === "string") {
|
|
30991
|
-
const directory =
|
|
30992
|
-
return
|
|
30992
|
+
const directory = path.resolve(configDir);
|
|
30993
|
+
return path.resolve(directory, rawMain);
|
|
30993
30994
|
} else return rawMain;
|
|
30994
30995
|
else return;
|
|
30995
30996
|
}
|
|
30996
30997
|
__name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
|
|
30997
30998
|
function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
30998
|
-
const configDir =
|
|
30999
|
+
const configDir = path.dirname(configPath ?? "wrangler.toml");
|
|
30999
31000
|
if (rawDir !== void 0) if (typeof rawDir === "string") {
|
|
31000
|
-
const directory =
|
|
31001
|
-
return
|
|
31001
|
+
const directory = path.resolve(configDir);
|
|
31002
|
+
return path.resolve(directory, rawDir);
|
|
31002
31003
|
} else return rawDir;
|
|
31003
31004
|
else return;
|
|
31004
31005
|
}
|
|
31005
31006
|
__name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
|
|
31006
31007
|
function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
31007
|
-
const configDir =
|
|
31008
|
+
const configDir = path.dirname(configPath ?? "wrangler.toml");
|
|
31008
31009
|
if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
|
|
31009
|
-
const directory =
|
|
31010
|
-
return
|
|
31010
|
+
const directory = path.resolve(configDir);
|
|
31011
|
+
return path.resolve(directory, rawPagesDir);
|
|
31011
31012
|
} else return rawPagesDir;
|
|
31012
31013
|
else return;
|
|
31013
31014
|
}
|
|
@@ -31060,7 +31061,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
|
|
|
31060
31061
|
validateOptionalProperty(diagnostics, "site", "entry-point", rawConfig.site["entry-point"], "string");
|
|
31061
31062
|
deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
|
|
31062
31063
|
\`\`\`
|
|
31063
|
-
main = "${
|
|
31064
|
+
main = "${path.join(String(rawConfig.site["entry-point"]) || "workers-site", path.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js")}"
|
|
31064
31065
|
\`\`\``, false, void 0, "warning");
|
|
31065
31066
|
let siteEntryPoint = rawConfig.site["entry-point"];
|
|
31066
31067
|
if (!mainEntryPoint && !siteEntryPoint) {
|
|
@@ -31073,7 +31074,7 @@ main = "workers-site/index.js"
|
|
|
31073
31074
|
} else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
|
|
31074
31075
|
They serve the same purpose: to point to the entry-point of your worker.
|
|
31075
31076
|
Delete the deprecated \`site.entry-point\` field from your config.`);
|
|
31076
|
-
if (configPath && siteEntryPoint) siteEntryPoint =
|
|
31077
|
+
if (configPath && siteEntryPoint) siteEntryPoint = path.relative(process.cwd(), path.join(path.dirname(configPath), siteEntryPoint));
|
|
31077
31078
|
return {
|
|
31078
31079
|
bucket,
|
|
31079
31080
|
"entry-point": siteEntryPoint,
|
|
@@ -31105,7 +31106,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
31105
31106
|
if (rawMapping === void 0) return;
|
|
31106
31107
|
const mapping = {};
|
|
31107
31108
|
for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
|
|
31108
|
-
if (configPath) mapping[name] = configPath ?
|
|
31109
|
+
if (configPath) mapping[name] = configPath ? path.relative(process.cwd(), path.join(path.dirname(configPath), filePath)) : filePath;
|
|
31109
31110
|
}
|
|
31110
31111
|
return mapping;
|
|
31111
31112
|
}
|
|
@@ -31263,7 +31264,6 @@ var validateStreamingTailConsumers = /* @__PURE__ */ __name((diagnostics, field,
|
|
|
31263
31264
|
function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, useServiceEnvironments, rawConfig) {
|
|
31264
31265
|
deprecated(diagnostics, rawEnv, "node_compat", `The "node_compat" field is no longer supported as of Wrangler v4. Instead, use the \`nodejs_compat\` compatibility flag. This includes the functionality from legacy \`node_compat\` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.`, true, "Removed", "error");
|
|
31265
31266
|
experimental(diagnostics, rawEnv, "unsafe");
|
|
31266
|
-
experimental(diagnostics, rawEnv, "secrets");
|
|
31267
31267
|
const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
|
|
31268
31268
|
const account_id = inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, mutateEmptyStringAccountIDValue(diagnostics, rawEnv), "account_id", isString$2, void 0, void 0);
|
|
31269
31269
|
const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
|
|
@@ -31354,7 +31354,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
31354
31354
|
__name(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
|
|
31355
31355
|
function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
|
|
31356
31356
|
const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
|
|
31357
|
-
return configPath && tsconfig ?
|
|
31357
|
+
return configPath && tsconfig ? path.relative(process.cwd(), path.join(path.dirname(configPath), tsconfig)) : tsconfig;
|
|
31358
31358
|
}
|
|
31359
31359
|
__name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
|
|
31360
31360
|
var validateAndNormalizeRules = /* @__PURE__ */ __name((diagnostics, topLevelEnv, rawEnv, envName) => {
|
|
@@ -31827,9 +31827,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
31827
31827
|
let resolvedBuildContextPath = void 0;
|
|
31828
31828
|
try {
|
|
31829
31829
|
if (isDockerfile(resolvedImage, configPath)) {
|
|
31830
|
-
const baseDir = configPath ?
|
|
31831
|
-
resolvedImage =
|
|
31832
|
-
resolvedBuildContextPath = containerAppOptional.image_build_context ?
|
|
31830
|
+
const baseDir = configPath ? path.dirname(configPath) : process.cwd();
|
|
31831
|
+
resolvedImage = path.resolve(baseDir, resolvedImage);
|
|
31832
|
+
resolvedBuildContextPath = containerAppOptional.image_build_context ? path.resolve(baseDir, containerAppOptional.image_build_context) : path.dirname(resolvedImage);
|
|
31833
31833
|
}
|
|
31834
31834
|
} catch (err) {
|
|
31835
31835
|
if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
|
|
@@ -32763,6 +32763,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
32763
32763
|
"secrets_store_secrets",
|
|
32764
32764
|
"artifacts",
|
|
32765
32765
|
"unsafe_hello_world",
|
|
32766
|
+
"flagship",
|
|
32766
32767
|
"worker_loaders",
|
|
32767
32768
|
"ratelimits",
|
|
32768
32769
|
"vpc_services",
|
|
@@ -32798,6 +32799,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
32798
32799
|
isValid2 = validateBindingArray(envName, validateSecretsStoreSecretBinding)(diagnostics, `${field}.secrets_store_secrets`, previews.secrets_store_secrets, void 0) && isValid2;
|
|
32799
32800
|
isValid2 = validateBindingArray(envName, validateArtifactsBinding)(diagnostics, `${field}.artifacts`, previews.artifacts, void 0) && isValid2;
|
|
32800
32801
|
isValid2 = validateBindingArray(envName, validateHelloWorldBinding)(diagnostics, `${field}.unsafe_hello_world`, previews.unsafe_hello_world, void 0) && isValid2;
|
|
32802
|
+
isValid2 = validateBindingArray(envName, validateFlagshipBinding)(diagnostics, `${field}.flagship`, previews.flagship, void 0) && isValid2;
|
|
32801
32803
|
isValid2 = validateBindingArray(envName, validateWorkerLoaderBinding)(diagnostics, `${field}.worker_loaders`, previews.worker_loaders, void 0) && isValid2;
|
|
32802
32804
|
isValid2 = validateBindingArray(envName, validateRateLimitBinding)(diagnostics, `${field}.ratelimits`, previews.ratelimits, void 0) && isValid2;
|
|
32803
32805
|
isValid2 = validateBindingArray(envName, validateVpcServiceBinding)(diagnostics, `${field}.vpc_services`, previews.vpc_services, void 0) && isValid2;
|
|
@@ -32963,10 +32965,10 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
|
|
|
32963
32965
|
}
|
|
32964
32966
|
__name(isRemoteValid, "isRemoteValid");
|
|
32965
32967
|
function isDockerfile(imagePath, configPath) {
|
|
32966
|
-
const baseDir = configPath ?
|
|
32967
|
-
const maybeDockerfile =
|
|
32968
|
+
const baseDir = configPath ? path.dirname(configPath) : process.cwd();
|
|
32969
|
+
const maybeDockerfile = path.resolve(baseDir, imagePath);
|
|
32968
32970
|
if (fs.existsSync(maybeDockerfile)) {
|
|
32969
|
-
if (isDirectory(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile
|
|
32971
|
+
if (isDirectory(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
|
|
32970
32972
|
return true;
|
|
32971
32973
|
}
|
|
32972
32974
|
const errorPrefix = `The image "${imagePath}" does not appear to be a valid path to a Dockerfile, or a valid image registry path:
|
|
@@ -32974,12 +32976,12 @@ function isDockerfile(imagePath, configPath) {
|
|
|
32974
32976
|
try {
|
|
32975
32977
|
new URL(`https://${imagePath}`);
|
|
32976
32978
|
} catch (e2) {
|
|
32977
|
-
if (e2 instanceof Error) throw new UserError(errorPrefix + e2.message);
|
|
32979
|
+
if (e2 instanceof Error) throw new UserError(errorPrefix + e2.message, { telemetryMessage: false });
|
|
32978
32980
|
throw e2;
|
|
32979
32981
|
}
|
|
32980
32982
|
const imageParts = imagePath.split("/");
|
|
32981
|
-
if (!imageParts[imageParts.length - 1]?.includes(":")) throw new UserError(errorPrefix + `If this is an image registry path, it needs to include at least a tag ':' (e.g: docker.io/httpd:1)
|
|
32982
|
-
if (imagePath.includes("://")) throw new UserError(errorPrefix + `Image reference should not include the protocol part (e.g: docker.io/httpd:1, not https://docker.io/httpd:1)
|
|
32983
|
+
if (!imageParts[imageParts.length - 1]?.includes(":")) throw new UserError(errorPrefix + `If this is an image registry path, it needs to include at least a tag ':' (e.g: docker.io/httpd:1)`, { telemetryMessage: false });
|
|
32984
|
+
if (imagePath.includes("://")) throw new UserError(errorPrefix + `Image reference should not include the protocol part (e.g: docker.io/httpd:1, not https://docker.io/httpd:1)`, { telemetryMessage: false });
|
|
32983
32985
|
return false;
|
|
32984
32986
|
}
|
|
32985
32987
|
__name(isDockerfile, "isDockerfile");
|
|
@@ -33016,7 +33018,7 @@ var supportedPagesConfigFields = [
|
|
|
33016
33018
|
];
|
|
33017
33019
|
function validatePagesConfig(config, envNames, projectName) {
|
|
33018
33020
|
if (!config.pages_build_output_dir) throw new FatalError(`Attempting to validate Pages configuration file, but "pages_build_output_dir" field was not found.
|
|
33019
|
-
"pages_build_output_dir" is required for Pages projects
|
|
33021
|
+
"pages_build_output_dir" is required for Pages projects.`, { telemetryMessage: false });
|
|
33020
33022
|
const diagnostics = new Diagnostics(`Running configuration file validation for Pages:`);
|
|
33021
33023
|
validateMainField(config, diagnostics);
|
|
33022
33024
|
validateProjectName(projectName, diagnostics);
|
|
@@ -33082,7 +33084,7 @@ function getGoArch() {
|
|
|
33082
33084
|
cloudflared supports: x64 (amd64), arm64, arm
|
|
33083
33085
|
|
|
33084
33086
|
You can manually install cloudflared and set the CLOUDFLARED_PATH environment variable.
|
|
33085
|
-
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
33087
|
+
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared unsupported architecture" });
|
|
33086
33088
|
}
|
|
33087
33089
|
}
|
|
33088
33090
|
__name(getGoArch, "getGoArch");
|
|
@@ -33096,7 +33098,7 @@ function getGoOS() {
|
|
|
33096
33098
|
cloudflared supports: darwin (macOS), linux, win32 (Windows)
|
|
33097
33099
|
|
|
33098
33100
|
You can manually install cloudflared and set the CLOUDFLARED_PATH environment variable.
|
|
33099
|
-
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
33101
|
+
Download instructions: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared unsupported platform" });
|
|
33100
33102
|
}
|
|
33101
33103
|
}
|
|
33102
33104
|
__name(getGoOS, "getGoOS");
|
|
@@ -33150,7 +33152,7 @@ The update service did not return results for ${goOS}/${goArch},
|
|
|
33150
33152
|
and the fallback query also failed.
|
|
33151
33153
|
|
|
33152
33154
|
You can manually install cloudflared from:
|
|
33153
|
-
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
33155
|
+
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared version lookup failed" });
|
|
33154
33156
|
const version$2 = fallback.version;
|
|
33155
33157
|
const filename = getAssetFilename(goOS, goArch);
|
|
33156
33158
|
return {
|
|
@@ -33225,7 +33227,7 @@ You can try:
|
|
|
33225
33227
|
errorMessage += ` 3. Manually installing cloudflared: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/
|
|
33226
33228
|
`;
|
|
33227
33229
|
errorMessage += ` 4. Setting CLOUDFLARED_PATH to point to your cloudflared binary`;
|
|
33228
|
-
throw new UserError(errorMessage);
|
|
33230
|
+
throw new UserError(errorMessage, { telemetryMessage: "tunnel cloudflared validation failed" });
|
|
33229
33231
|
}
|
|
33230
33232
|
}
|
|
33231
33233
|
__name(validateBinary, "validateBinary");
|
|
@@ -33319,14 +33321,14 @@ async function downloadCloudflared(versionInfo, binPath, options) {
|
|
|
33319
33321
|
Network error: ${e2 instanceof Error ? e2.message : String(e2)}
|
|
33320
33322
|
|
|
33321
33323
|
Please check your internet connection and try again.
|
|
33322
|
-
If you're behind a proxy, make sure it's configured correctly
|
|
33324
|
+
If you're behind a proxy, make sure it's configured correctly.`, { telemetryMessage: "tunnel cloudflared download network failed" });
|
|
33323
33325
|
}
|
|
33324
33326
|
if (!response.ok) throw new UserError(`[cloudflared] Failed to download cloudflared from ${url}
|
|
33325
33327
|
|
|
33326
33328
|
HTTP ${response.status}: ${response.statusText}
|
|
33327
33329
|
|
|
33328
33330
|
You can manually download cloudflared from:
|
|
33329
|
-
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads
|
|
33331
|
+
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared download response failed" });
|
|
33330
33332
|
try {
|
|
33331
33333
|
if (compressed) await downloadAndExtractTarball(response, checksum, binPath, cacheDir);
|
|
33332
33334
|
else await downloadBinary(response, checksum, binPath);
|
|
@@ -33339,7 +33341,7 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
|
|
|
33339
33341
|
|
|
33340
33342
|
Error: ${e2 instanceof Error ? e2.message : String(e2)}
|
|
33341
33343
|
|
|
33342
|
-
Please ensure you have write permissions to: ${cacheDir}
|
|
33344
|
+
Please ensure you have write permissions to: ${cacheDir}`, { telemetryMessage: "tunnel cloudflared save failed" });
|
|
33343
33345
|
}
|
|
33344
33346
|
if (process.platform !== "win32") chmodSync(binPath, 493);
|
|
33345
33347
|
logger?.log(`cloudflared ${version$2} installed`);
|
|
@@ -33354,7 +33356,7 @@ async function downloadAndExtractTarball(response, expectedChecksum, binPath, ca
|
|
|
33354
33356
|
if (actualSha256 !== expectedChecksum) throw new UserError(`[cloudflared] SHA256 mismatch for downloaded cloudflared tarball.
|
|
33355
33357
|
|
|
33356
33358
|
Expected: ${expectedChecksum}
|
|
33357
|
-
Actual: ${actualSha256}
|
|
33359
|
+
Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared tarball checksum mismatch" });
|
|
33358
33360
|
}
|
|
33359
33361
|
writeFileSync(tempTarPath, buffer$1);
|
|
33360
33362
|
try {
|
|
@@ -33380,7 +33382,7 @@ async function downloadBinary(response, expectedChecksum, binPath) {
|
|
|
33380
33382
|
if (actualSha256 !== expectedChecksum) throw new UserError(`[cloudflared] SHA256 mismatch for downloaded cloudflared binary.
|
|
33381
33383
|
|
|
33382
33384
|
Expected: ${expectedChecksum}
|
|
33383
|
-
Actual: ${actualSha256}
|
|
33385
|
+
Actual: ${actualSha256}`, { telemetryMessage: "tunnel cloudflared binary checksum mismatch" });
|
|
33384
33386
|
}
|
|
33385
33387
|
writeFileAtomic(binPath, buffer$1);
|
|
33386
33388
|
}
|
|
@@ -33391,7 +33393,7 @@ async function getCloudflaredPath(options) {
|
|
|
33391
33393
|
if (envPath) {
|
|
33392
33394
|
if (!existsSync(envPath)) throw new UserError(`CLOUDFLARED_PATH is set to "${envPath}" but the file does not exist.
|
|
33393
33395
|
|
|
33394
|
-
Please ensure the path points to a valid cloudflared binary
|
|
33396
|
+
Please ensure the path points to a valid cloudflared binary.`, { telemetryMessage: "tunnel cloudflared env path missing" });
|
|
33395
33397
|
logger?.debug(`Using cloudflared from CLOUDFLARED_PATH: ${envPath}`);
|
|
33396
33398
|
return envPath;
|
|
33397
33399
|
}
|
|
@@ -33417,7 +33419,7 @@ Please ensure the path points to a valid cloudflared binary.`);
|
|
|
33417
33419
|
You can install it manually from:
|
|
33418
33420
|
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/
|
|
33419
33421
|
|
|
33420
|
-
Then either add it to your PATH or set CLOUDFLARED_PATH
|
|
33422
|
+
Then either add it to your PATH or set CLOUDFLARED_PATH.`, { telemetryMessage: "tunnel cloudflared download declined" });
|
|
33421
33423
|
if (existsSync(binPath)) {
|
|
33422
33424
|
const cacheDir = removeCloudflaredCache(versionInfo.version);
|
|
33423
33425
|
if (cacheDir) logger?.log(`Removed cloudflared cache: ${cacheDir}`);
|
|
@@ -33623,7 +33625,7 @@ ${stderrOutput || "(no output)"}
|
|
|
33623
33625
|
|
|
33624
33626
|
The local dev server started at ${origin.href}.
|
|
33625
33627
|
` + (isQuickTunnelRateLimited ? "Cloudflare Quick Tunnel creation was rate limited. Try again in a few minutes, or use a named tunnel if you need more reliable access." : `Check the cloudflared output above for more details, and verify that ${origin.href} is reachable from this machine if this keeps happening.`);
|
|
33626
|
-
if (isQuickTunnelRateLimited) return new UserError(errorMessage);
|
|
33628
|
+
if (isQuickTunnelRateLimited) return new UserError(errorMessage, { telemetryMessage: false });
|
|
33627
33629
|
return new Error(errorMessage);
|
|
33628
33630
|
}
|
|
33629
33631
|
__name(createTunnelStartupError, "createTunnelStartupError");
|
|
@@ -34089,8 +34091,8 @@ const postfixRE = /[?#].*$/;
|
|
|
34089
34091
|
function cleanUrl(url) {
|
|
34090
34092
|
return url.replace(postfixRE, "");
|
|
34091
34093
|
}
|
|
34092
|
-
function withTrailingSlash(path$
|
|
34093
|
-
return path$
|
|
34094
|
+
function withTrailingSlash(path$2) {
|
|
34095
|
+
return path$2.endsWith("/") ? path$2 : `${path$2}/`;
|
|
34094
34096
|
}
|
|
34095
34097
|
function createRequestHandler(handler) {
|
|
34096
34098
|
return async (req, res, next) => {
|
|
@@ -39487,15 +39489,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
39487
39489
|
function withTrailingSlash$1(input = "", respectQueryAndFragment) {
|
|
39488
39490
|
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
|
|
39489
39491
|
if (hasTrailingSlash(input, true)) return input || "/";
|
|
39490
|
-
let path$
|
|
39492
|
+
let path$2 = input;
|
|
39491
39493
|
let fragment = "";
|
|
39492
39494
|
const fragmentIndex = input.indexOf("#");
|
|
39493
39495
|
if (fragmentIndex >= 0) {
|
|
39494
|
-
path$
|
|
39496
|
+
path$2 = input.slice(0, fragmentIndex);
|
|
39495
39497
|
fragment = input.slice(fragmentIndex);
|
|
39496
|
-
if (!path$
|
|
39498
|
+
if (!path$2) return fragment;
|
|
39497
39499
|
}
|
|
39498
|
-
const [s0, ...s] = path$
|
|
39500
|
+
const [s0, ...s] = path$2.split("?");
|
|
39499
39501
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
39500
39502
|
}
|
|
39501
39503
|
function isNonEmptyURL(url) {
|
|
@@ -39521,8 +39523,8 @@ const isAbsolute$1 = function(p$1) {
|
|
|
39521
39523
|
//#endregion
|
|
39522
39524
|
//#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
|
|
39523
39525
|
const BUILTIN_MODULES = new Set(builtinModules);
|
|
39524
|
-
function normalizeSlash(path$
|
|
39525
|
-
return path$
|
|
39526
|
+
function normalizeSlash(path$2) {
|
|
39527
|
+
return path$2.replace(/\\/g, "/");
|
|
39526
39528
|
}
|
|
39527
39529
|
/**
|
|
39528
39530
|
* @typedef ErrnoExceptionFields
|
|
@@ -39642,8 +39644,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
39642
39644
|
* @param {string} [base]
|
|
39643
39645
|
* @param {string} [message]
|
|
39644
39646
|
*/
|
|
39645
|
-
(path$
|
|
39646
|
-
return `Invalid package config ${path$
|
|
39647
|
+
(path$2, base, message) => {
|
|
39648
|
+
return `Invalid package config ${path$2}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
39647
39649
|
},
|
|
39648
39650
|
Error
|
|
39649
39651
|
);
|
|
@@ -39673,8 +39675,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
39673
39675
|
* @param {string} base
|
|
39674
39676
|
* @param {boolean} [exactUrl]
|
|
39675
39677
|
*/
|
|
39676
|
-
(path$
|
|
39677
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${path$
|
|
39678
|
+
(path$2, base, exactUrl = false) => {
|
|
39679
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path$2}' imported from ${base}`;
|
|
39678
39680
|
},
|
|
39679
39681
|
Error
|
|
39680
39682
|
);
|
|
@@ -39712,8 +39714,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
39712
39714
|
* @param {string} extension
|
|
39713
39715
|
* @param {string} path
|
|
39714
39716
|
*/
|
|
39715
|
-
(extension, path$
|
|
39716
|
-
return `Unknown file extension "${extension}" for ${path$
|
|
39717
|
+
(extension, path$2) => {
|
|
39718
|
+
return `Unknown file extension "${extension}" for ${path$2}`;
|
|
39717
39719
|
},
|
|
39718
39720
|
TypeError
|
|
39719
39721
|
);
|
|
@@ -39870,7 +39872,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
39870
39872
|
/** @type {string | undefined} */
|
|
39871
39873
|
let string;
|
|
39872
39874
|
try {
|
|
39873
|
-
string = fs.readFileSync(
|
|
39875
|
+
string = fs.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
|
|
39874
39876
|
} catch (error) {
|
|
39875
39877
|
const exception = error;
|
|
39876
39878
|
if (exception.code !== "ENOENT") throw exception;
|
|
@@ -40076,15 +40078,15 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
40076
40078
|
const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
|
|
40077
40079
|
const basePath = fileURLToPath(base);
|
|
40078
40080
|
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");
|
|
40079
|
-
else if (
|
|
40081
|
+
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");
|
|
40080
40082
|
}
|
|
40081
40083
|
/**
|
|
40082
40084
|
* @param {string} path
|
|
40083
40085
|
* @returns {Stats | undefined}
|
|
40084
40086
|
*/
|
|
40085
|
-
function tryStatSync(path$
|
|
40087
|
+
function tryStatSync(path$2) {
|
|
40086
40088
|
try {
|
|
40087
|
-
return statSync(path$
|
|
40089
|
+
return statSync(path$2);
|
|
40088
40090
|
} catch {}
|
|
40089
40091
|
}
|
|
40090
40092
|
/**
|
|
@@ -40183,7 +40185,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
40183
40185
|
{
|
|
40184
40186
|
const real = realpathSync(filePath);
|
|
40185
40187
|
const { search, hash } = resolved;
|
|
40186
|
-
resolved = pathToFileURL(real + (filePath.endsWith(
|
|
40188
|
+
resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : ""));
|
|
40187
40189
|
resolved.search = search;
|
|
40188
40190
|
resolved.hash = hash;
|
|
40189
40191
|
}
|
|
@@ -42560,9 +42562,9 @@ function constructHeaders({ headers, headersFile, logger }) {
|
|
|
42560
42562
|
|
|
42561
42563
|
//#endregion
|
|
42562
42564
|
//#region ../workers-shared/utils/configuration/validateURL.ts
|
|
42563
|
-
const extractPathname = (path$
|
|
42564
|
-
if (!path$
|
|
42565
|
-
const url = new URL(`//${path$
|
|
42565
|
+
const extractPathname = (path$2 = "/", includeSearch, includeHash) => {
|
|
42566
|
+
if (!path$2.startsWith("/")) path$2 = `/${path$2}`;
|
|
42567
|
+
const url = new URL(`//${path$2}`, "relative://");
|
|
42566
42568
|
return `${url.pathname}${includeSearch ? url.search : ""}${includeHash ? url.hash : ""}`;
|
|
42567
42569
|
};
|
|
42568
42570
|
const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
|
|
@@ -42597,6 +42599,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42597
42599
|
const rules = [];
|
|
42598
42600
|
const invalid = [];
|
|
42599
42601
|
let rule = void 0;
|
|
42602
|
+
let skipUntilNextPath = false;
|
|
42600
42603
|
for (let i$1 = 0; i$1 < lines.length; i$1++) {
|
|
42601
42604
|
const line = (lines[i$1] || "").trim();
|
|
42602
42605
|
if (line.length === 0 || line.startsWith("#")) continue;
|
|
@@ -42605,6 +42608,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42605
42608
|
continue;
|
|
42606
42609
|
}
|
|
42607
42610
|
if (LINE_IS_PROBABLY_A_PATH.test(line)) {
|
|
42611
|
+
skipUntilNextPath = false;
|
|
42608
42612
|
if (rules.length >= maxRules) {
|
|
42609
42613
|
invalid.push({ message: `Maximum number of rules supported is ${maxRules}. Skipping remaining ${lines.length - i$1} lines of file.` });
|
|
42610
42614
|
break;
|
|
@@ -42619,7 +42623,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42619
42623
|
lineNumber: i$1 + 1,
|
|
42620
42624
|
message: "No headers specified"
|
|
42621
42625
|
});
|
|
42622
|
-
const [path$
|
|
42626
|
+
const [path$2, pathError] = validateUrl(line, false, true);
|
|
42623
42627
|
if (pathError) {
|
|
42624
42628
|
invalid.push({
|
|
42625
42629
|
line,
|
|
@@ -42627,16 +42631,29 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42627
42631
|
message: pathError
|
|
42628
42632
|
});
|
|
42629
42633
|
rule = void 0;
|
|
42634
|
+
skipUntilNextPath = true;
|
|
42635
|
+
continue;
|
|
42636
|
+
}
|
|
42637
|
+
const wildcardError = validateNoMultipleWildcards(path$2);
|
|
42638
|
+
if (wildcardError) {
|
|
42639
|
+
invalid.push({
|
|
42640
|
+
line,
|
|
42641
|
+
lineNumber: i$1 + 1,
|
|
42642
|
+
message: wildcardError
|
|
42643
|
+
});
|
|
42644
|
+
rule = void 0;
|
|
42645
|
+
skipUntilNextPath = true;
|
|
42630
42646
|
continue;
|
|
42631
42647
|
}
|
|
42632
42648
|
rule = {
|
|
42633
|
-
path: path$
|
|
42649
|
+
path: path$2,
|
|
42634
42650
|
line,
|
|
42635
42651
|
headers: {},
|
|
42636
42652
|
unsetHeaders: []
|
|
42637
42653
|
};
|
|
42638
42654
|
continue;
|
|
42639
42655
|
}
|
|
42656
|
+
if (skipUntilNextPath) continue;
|
|
42640
42657
|
if (!line.includes(HEADER_SEPARATOR)) {
|
|
42641
42658
|
if (!rule) invalid.push({
|
|
42642
42659
|
line,
|
|
@@ -42706,6 +42723,18 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42706
42723
|
function isValidRule(rule) {
|
|
42707
42724
|
return Object.keys(rule.headers).length > 0 || rule.unsetHeaders.length > 0;
|
|
42708
42725
|
}
|
|
42726
|
+
/**
|
|
42727
|
+
* At runtime, `*` wildcards are converted to `:splat` placeholders. This means
|
|
42728
|
+
* a path with multiple wildcards, or a wildcard combined with an explicit
|
|
42729
|
+
* `:splat` placeholder, would result in duplicate `:splat` parameters which is
|
|
42730
|
+
* unsupported.
|
|
42731
|
+
*/
|
|
42732
|
+
function validateNoMultipleWildcards(path$2) {
|
|
42733
|
+
const wildcardCount = (path$2.match(SPLAT_REGEX) ?? []).length;
|
|
42734
|
+
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$2);
|
|
42735
|
+
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$2}.`;
|
|
42736
|
+
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$2}.`;
|
|
42737
|
+
}
|
|
42709
42738
|
|
|
42710
42739
|
//#endregion
|
|
42711
42740
|
//#region ../workers-shared/utils/configuration/parseRedirects.ts
|
|
@@ -42921,13 +42950,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
|
|
|
42921
42950
|
const throwError = (message, Ctor) => {
|
|
42922
42951
|
throw new Ctor(message);
|
|
42923
42952
|
};
|
|
42924
|
-
const checkPath = (path$
|
|
42925
|
-
if (!isString$1(path$
|
|
42926
|
-
if (!path$
|
|
42927
|
-
if (checkPath.isNotRelative(path$
|
|
42953
|
+
const checkPath = (path$2, originalPath, doThrow) => {
|
|
42954
|
+
if (!isString$1(path$2)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
42955
|
+
if (!path$2) return doThrow(`path must not be empty`, TypeError);
|
|
42956
|
+
if (checkPath.isNotRelative(path$2)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
|
|
42928
42957
|
return true;
|
|
42929
42958
|
};
|
|
42930
|
-
const isNotRelative = (path$
|
|
42959
|
+
const isNotRelative = (path$2) => REGEX_TEST_INVALID_PATH.test(path$2);
|
|
42931
42960
|
checkPath.isNotRelative = isNotRelative;
|
|
42932
42961
|
checkPath.convert = (p$1) => p$1;
|
|
42933
42962
|
var Ignore = class {
|
|
@@ -42963,13 +42992,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
|
|
|
42963
42992
|
addPattern(pattern) {
|
|
42964
42993
|
return this.add(pattern);
|
|
42965
42994
|
}
|
|
42966
|
-
_testOne(path$
|
|
42995
|
+
_testOne(path$2, checkUnignored) {
|
|
42967
42996
|
let ignored = false;
|
|
42968
42997
|
let unignored = false;
|
|
42969
42998
|
this._rules.forEach((rule) => {
|
|
42970
42999
|
const { negative } = rule;
|
|
42971
43000
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
|
|
42972
|
-
if (rule.regex.test(path$
|
|
43001
|
+
if (rule.regex.test(path$2)) {
|
|
42973
43002
|
ignored = !negative;
|
|
42974
43003
|
unignored = negative;
|
|
42975
43004
|
}
|
|
@@ -42980,33 +43009,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
|
|
|
42980
43009
|
};
|
|
42981
43010
|
}
|
|
42982
43011
|
_test(originalPath, cache$2, checkUnignored, slices) {
|
|
42983
|
-
const path$
|
|
42984
|
-
checkPath(path$
|
|
42985
|
-
return this._t(path$
|
|
43012
|
+
const path$2 = originalPath && checkPath.convert(originalPath);
|
|
43013
|
+
checkPath(path$2, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
43014
|
+
return this._t(path$2, cache$2, checkUnignored, slices);
|
|
42986
43015
|
}
|
|
42987
|
-
_t(path$
|
|
42988
|
-
if (path$
|
|
42989
|
-
if (!slices) slices = path$
|
|
43016
|
+
_t(path$2, cache$2, checkUnignored, slices) {
|
|
43017
|
+
if (path$2 in cache$2) return cache$2[path$2];
|
|
43018
|
+
if (!slices) slices = path$2.split(SLASH);
|
|
42990
43019
|
slices.pop();
|
|
42991
|
-
if (!slices.length) return cache$2[path$
|
|
43020
|
+
if (!slices.length) return cache$2[path$2] = this._testOne(path$2, checkUnignored);
|
|
42992
43021
|
const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
|
|
42993
|
-
return cache$2[path$
|
|
43022
|
+
return cache$2[path$2] = parent.ignored ? parent : this._testOne(path$2, checkUnignored);
|
|
42994
43023
|
}
|
|
42995
|
-
ignores(path$
|
|
42996
|
-
return this._test(path$
|
|
43024
|
+
ignores(path$2) {
|
|
43025
|
+
return this._test(path$2, this._ignoreCache, false).ignored;
|
|
42997
43026
|
}
|
|
42998
43027
|
createFilter() {
|
|
42999
|
-
return (path$
|
|
43028
|
+
return (path$2) => !this.ignores(path$2);
|
|
43000
43029
|
}
|
|
43001
43030
|
filter(paths) {
|
|
43002
43031
|
return makeArray(paths).filter(this.createFilter());
|
|
43003
43032
|
}
|
|
43004
|
-
test(path$
|
|
43005
|
-
return this._test(path$
|
|
43033
|
+
test(path$2) {
|
|
43034
|
+
return this._test(path$2, this._testCache, true);
|
|
43006
43035
|
}
|
|
43007
43036
|
};
|
|
43008
43037
|
const factory = (options) => new Ignore(options);
|
|
43009
|
-
const isPathValid = (path$
|
|
43038
|
+
const isPathValid = (path$2) => checkPath(path$2 && checkPath.convert(path$2), path$2, RETURN_FALSE);
|
|
43010
43039
|
factory.isPathValid = isPathValid;
|
|
43011
43040
|
factory.default = factory;
|
|
43012
43041
|
module.exports = factory;
|
|
@@ -43015,7 +43044,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/ig
|
|
|
43015
43044
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
43016
43045
|
checkPath.convert = makePosix;
|
|
43017
43046
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
43018
|
-
checkPath.isNotRelative = (path$
|
|
43047
|
+
checkPath.isNotRelative = (path$2) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$2) || isNotRelative(path$2);
|
|
43019
43048
|
}
|
|
43020
43049
|
}) });
|
|
43021
43050
|
|
|
@@ -44370,11 +44399,11 @@ var Mime = class {
|
|
|
44370
44399
|
}
|
|
44371
44400
|
return this;
|
|
44372
44401
|
}
|
|
44373
|
-
getType(path$
|
|
44374
|
-
if (typeof path$
|
|
44375
|
-
const last = path$
|
|
44402
|
+
getType(path$2) {
|
|
44403
|
+
if (typeof path$2 !== "string") return null;
|
|
44404
|
+
const last = path$2.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
44376
44405
|
const ext = last.replace(/^.*\./s, "").toLowerCase();
|
|
44377
|
-
const hasPath = last.length < path$
|
|
44406
|
+
const hasPath = last.length < path$2.length;
|
|
44378
44407
|
if (!(ext.length < last.length - 1) && hasPath) return null;
|
|
44379
44408
|
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
44380
44409
|
}
|
|
@@ -44708,8 +44737,8 @@ function getErrorMap() {
|
|
|
44708
44737
|
//#endregion
|
|
44709
44738
|
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
44710
44739
|
const makeIssue = (params) => {
|
|
44711
|
-
const { data: data$1, path: path$
|
|
44712
|
-
const fullPath = [...path$
|
|
44740
|
+
const { data: data$1, path: path$2, errorMaps, issueData } = params;
|
|
44741
|
+
const fullPath = [...path$2, ...issueData.path || []];
|
|
44713
44742
|
const fullIssue = {
|
|
44714
44743
|
...issueData,
|
|
44715
44744
|
path: fullPath
|
|
@@ -44821,11 +44850,11 @@ var errorUtil;
|
|
|
44821
44850
|
//#endregion
|
|
44822
44851
|
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
44823
44852
|
var ParseInputLazyPath = class {
|
|
44824
|
-
constructor(parent, value, path$
|
|
44853
|
+
constructor(parent, value, path$2, key) {
|
|
44825
44854
|
this._cachedPath = [];
|
|
44826
44855
|
this.parent = parent;
|
|
44827
44856
|
this.data = value;
|
|
44828
|
-
this._path = path$
|
|
44857
|
+
this._path = path$2;
|
|
44829
44858
|
this._key = key;
|
|
44830
44859
|
}
|
|
44831
44860
|
get path() {
|
|
@@ -48488,7 +48517,10 @@ const configPlugin = createPlugin("config", (ctx) => {
|
|
|
48488
48517
|
fs: { deny: [...[
|
|
48489
48518
|
".env",
|
|
48490
48519
|
".env.*",
|
|
48491
|
-
"
|
|
48520
|
+
".npmrc",
|
|
48521
|
+
".yarnrc",
|
|
48522
|
+
".yarnrc.yml",
|
|
48523
|
+
"*.{crt,pem,key,pfx,p12,p8,jks}",
|
|
48492
48524
|
"**/.git/**",
|
|
48493
48525
|
".dev.vars",
|
|
48494
48526
|
".dev.vars.*",
|
|
@@ -48841,11 +48873,11 @@ const getQueryString = (params) => {
|
|
|
48841
48873
|
};
|
|
48842
48874
|
const getUrl = (config, options) => {
|
|
48843
48875
|
const encoder$1 = config.ENCODE_PATH || encodeURI;
|
|
48844
|
-
const path$
|
|
48876
|
+
const path$2 = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
48845
48877
|
if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
|
|
48846
48878
|
return substring;
|
|
48847
48879
|
});
|
|
48848
|
-
const url = `${config.BASE}${path$
|
|
48880
|
+
const url = `${config.BASE}${path$2}`;
|
|
48849
48881
|
if (options.query) return `${url}${getQueryString(options.query)}`;
|
|
48850
48882
|
return url;
|
|
48851
48883
|
};
|
|
@@ -49435,7 +49467,7 @@ function dockerBuild(dockerPath, options) {
|
|
|
49435
49467
|
if (code === 0) resolve$4();
|
|
49436
49468
|
else if (!errorHandled) {
|
|
49437
49469
|
errorHandled = true;
|
|
49438
|
-
reject(new UserError(`Docker build exited with code: ${code}
|
|
49470
|
+
reject(new UserError(`Docker build exited with code: ${code}`, { telemetryMessage: false }));
|
|
49439
49471
|
}
|
|
49440
49472
|
});
|
|
49441
49473
|
child.on("error", (err) => {
|
|
@@ -49505,7 +49537,7 @@ async function dockerLoginImageRegistry(pathToDocker, domain) {
|
|
|
49505
49537
|
await new Promise((resolve$4, reject) => {
|
|
49506
49538
|
child.on("close", (code) => {
|
|
49507
49539
|
if (code === 0) resolve$4();
|
|
49508
|
-
else reject(new UserError(`Login failed with code: ${code}
|
|
49540
|
+
else reject(new UserError(`Login failed with code: ${code}`, { telemetryMessage: false }));
|
|
49509
49541
|
});
|
|
49510
49542
|
});
|
|
49511
49543
|
}
|
|
@@ -49544,7 +49576,7 @@ async function dockerImageInspect(dockerPath, options) {
|
|
|
49544
49576
|
proc.stdout.on("data", (chunk) => stdout += chunk);
|
|
49545
49577
|
proc.stderr.on("data", (chunk) => stderr += chunk);
|
|
49546
49578
|
proc.on("close", (code) => {
|
|
49547
|
-
if (code !== 0) return reject(new UserError(`failed inspecting image locally: ${stderr.trim()}
|
|
49579
|
+
if (code !== 0) return reject(new UserError(`failed inspecting image locally: ${stderr.trim()}`, { telemetryMessage: false }));
|
|
49548
49580
|
resolve$4(stdout.trim());
|
|
49549
49581
|
});
|
|
49550
49582
|
proc.on("error", (err) => reject(err));
|
|
@@ -49572,13 +49604,13 @@ const runDockerCmd = (dockerPath, args, stdio) => {
|
|
|
49572
49604
|
if (code === 0 || aborted) resolve$4({ aborted });
|
|
49573
49605
|
else if (!errorHandled) {
|
|
49574
49606
|
errorHandled = true;
|
|
49575
|
-
reject(new UserError(`Docker command exited with code: ${code}
|
|
49607
|
+
reject(new UserError(`Docker command exited with code: ${code}`, { telemetryMessage: false }));
|
|
49576
49608
|
}
|
|
49577
49609
|
});
|
|
49578
49610
|
child.on("error", (err) => {
|
|
49579
49611
|
if (!errorHandled) {
|
|
49580
49612
|
errorHandled = true;
|
|
49581
|
-
reject(new UserError(`Docker command failed: ${err.message}
|
|
49613
|
+
reject(new UserError(`Docker command failed: ${err.message}`, { telemetryMessage: false }));
|
|
49582
49614
|
}
|
|
49583
49615
|
});
|
|
49584
49616
|
return {
|
|
@@ -49596,7 +49628,7 @@ const runDockerCmdWithOutput = (dockerPath, args) => {
|
|
|
49596
49628
|
try {
|
|
49597
49629
|
return execFileSync(dockerPath, args, { encoding: "utf8" }).trim();
|
|
49598
49630
|
} catch (error) {
|
|
49599
|
-
throw new UserError(`Failed running docker command: ${error.message}. Command: ${dockerPath} ${args.join(" ")}
|
|
49631
|
+
throw new UserError(`Failed running docker command: ${error.message}. Command: ${dockerPath} ${args.join(" ")}`, { telemetryMessage: false });
|
|
49600
49632
|
}
|
|
49601
49633
|
};
|
|
49602
49634
|
/** Checks whether docker is running on the system */
|
|
@@ -49615,7 +49647,7 @@ const isDockerRunning = async (dockerPath) => {
|
|
|
49615
49647
|
/** throws when docker is not installed */
|
|
49616
49648
|
const verifyDockerInstalled = async (dockerPath, isDev = true) => {
|
|
49617
49649
|
if (!await isDockerRunning(dockerPath)) throw new UserError(`The Docker CLI could not be launched. Please ensure that the Docker CLI is installed and the daemon is running.
|
|
49618
|
-
Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so. You can specify an executable with the environment variable WRANGLER_DOCKER_BIN and a socket with DOCKER_HOST.${isDev ? "\nTo suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or passing in --enable-containers=false." : ""}
|
|
49650
|
+
Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so. You can specify an executable with the environment variable WRANGLER_DOCKER_BIN and a socket with DOCKER_HOST.${isDev ? "\nTo suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or passing in --enable-containers=false." : ""}`, { telemetryMessage: false });
|
|
49619
49651
|
};
|
|
49620
49652
|
/**
|
|
49621
49653
|
* Kills and removes any containers which come from the given image tag
|
|
@@ -49669,7 +49701,7 @@ async function checkExposedPorts(dockerPath, options) {
|
|
|
49669
49701
|
imageTag: options.image_tag,
|
|
49670
49702
|
formatString: "{{ len .Config.ExposedPorts }}"
|
|
49671
49703
|
}) === "0") throw new UserError(`The container "${options.class_name}" does not expose any ports. In your Dockerfile, please expose any ports you intend to connect to.\nFor additional information please see: https://developers.cloudflare.com/containers/local-dev/#exposing-ports.
|
|
49672
|
-
|
|
49704
|
+
`, { telemetryMessage: false });
|
|
49673
49705
|
}
|
|
49674
49706
|
/**
|
|
49675
49707
|
* Generates a random container build id
|
|
@@ -49786,7 +49818,7 @@ async function pullImage(dockerPath, options, logger) {
|
|
|
49786
49818
|
async function prepareContainerImagesForDev(args) {
|
|
49787
49819
|
const { dockerPath, containerOptions, onContainerImagePreparationStart, onContainerImagePreparationEnd } = args;
|
|
49788
49820
|
let aborted = false;
|
|
49789
|
-
if (process.platform === "win32") throw new UserError("Local development with containers is currently not supported on Windows. You should use WSL instead. You can also set `enable_containers` to false if you do not need to develop the container part of your application.");
|
|
49821
|
+
if (process.platform === "win32") throw new UserError("Local development with containers is currently not supported on Windows. You should use WSL instead. You can also set `enable_containers` to false if you do not need to develop the container part of your application.", { telemetryMessage: false });
|
|
49790
49822
|
await verifyDockerInstalled(dockerPath);
|
|
49791
49823
|
for (const options of containerOptions) {
|
|
49792
49824
|
if ("dockerfile" in options) {
|
|
@@ -49860,7 +49892,7 @@ function getContainerOptions(options) {
|
|
|
49860
49892
|
return containersConfig.map((container) => {
|
|
49861
49893
|
if (isDockerfile(container.image, configPath)) return {
|
|
49862
49894
|
dockerfile: container.image,
|
|
49863
|
-
image_build_context: container.image_build_context ??
|
|
49895
|
+
image_build_context: container.image_build_context ?? path.dirname(container.image),
|
|
49864
49896
|
image_vars: container.image_vars,
|
|
49865
49897
|
class_name: container.class_name,
|
|
49866
49898
|
image_tag: getDevContainerImageName(container.class_name, containerBuildId)
|
|
@@ -49876,26 +49908,26 @@ function getContainerOptions(options) {
|
|
|
49876
49908
|
//#endregion
|
|
49877
49909
|
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
|
|
49878
49910
|
var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
49879
|
-
function cleanPath(path$
|
|
49880
|
-
let normalized = normalize(path$
|
|
49911
|
+
function cleanPath(path$2) {
|
|
49912
|
+
let normalized = normalize(path$2);
|
|
49881
49913
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
49882
49914
|
return normalized;
|
|
49883
49915
|
}
|
|
49884
49916
|
const SLASHES_REGEX = /[\\/]/g;
|
|
49885
|
-
function convertSlashes(path$
|
|
49886
|
-
return path$
|
|
49917
|
+
function convertSlashes(path$2, separator) {
|
|
49918
|
+
return path$2.replace(SLASHES_REGEX, separator);
|
|
49887
49919
|
}
|
|
49888
49920
|
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
49889
|
-
function isRootDirectory(path$
|
|
49890
|
-
return path$
|
|
49921
|
+
function isRootDirectory(path$2) {
|
|
49922
|
+
return path$2 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$2);
|
|
49891
49923
|
}
|
|
49892
|
-
function normalizePath$1(path$
|
|
49924
|
+
function normalizePath$1(path$2, options) {
|
|
49893
49925
|
const { resolvePaths, normalizePath: normalizePath$1$1, pathSeparator } = options;
|
|
49894
|
-
const pathNeedsCleaning = process.platform === "win32" && path$
|
|
49895
|
-
if (resolvePaths) path$
|
|
49896
|
-
if (normalizePath$1$1 || pathNeedsCleaning) path$
|
|
49897
|
-
if (path$
|
|
49898
|
-
return convertSlashes(path$
|
|
49926
|
+
const pathNeedsCleaning = process.platform === "win32" && path$2.includes("/") || path$2.startsWith(".");
|
|
49927
|
+
if (resolvePaths) path$2 = resolve$1(path$2);
|
|
49928
|
+
if (normalizePath$1$1 || pathNeedsCleaning) path$2 = cleanPath(path$2);
|
|
49929
|
+
if (path$2 === ".") return "";
|
|
49930
|
+
return convertSlashes(path$2[path$2.length - 1] !== pathSeparator ? path$2 + pathSeparator : path$2, pathSeparator);
|
|
49899
49931
|
}
|
|
49900
49932
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
49901
49933
|
return directoryPath + filename;
|
|
@@ -49931,8 +49963,8 @@ const pushDirectory = (directoryPath, paths) => {
|
|
|
49931
49963
|
paths.push(directoryPath || ".");
|
|
49932
49964
|
};
|
|
49933
49965
|
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
49934
|
-
const path$
|
|
49935
|
-
if (filters.every((filter) => filter(path$
|
|
49966
|
+
const path$2 = directoryPath || ".";
|
|
49967
|
+
if (filters.every((filter) => filter(path$2, true))) paths.push(path$2);
|
|
49936
49968
|
};
|
|
49937
49969
|
const empty$2 = () => {};
|
|
49938
49970
|
function build$6(root, options) {
|
|
@@ -49981,26 +50013,26 @@ const empty = () => {};
|
|
|
49981
50013
|
function build$3(options) {
|
|
49982
50014
|
return options.group ? groupFiles : empty;
|
|
49983
50015
|
}
|
|
49984
|
-
const resolveSymlinksAsync = function(path$
|
|
50016
|
+
const resolveSymlinksAsync = function(path$2, state, callback$1) {
|
|
49985
50017
|
const { queue, fs: fs$3, options: { suppressErrors } } = state;
|
|
49986
50018
|
queue.enqueue();
|
|
49987
|
-
fs$3.realpath(path$
|
|
50019
|
+
fs$3.realpath(path$2, (error, resolvedPath) => {
|
|
49988
50020
|
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
49989
50021
|
fs$3.stat(resolvedPath, (error$1, stat) => {
|
|
49990
50022
|
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
49991
|
-
if (stat.isDirectory() && isRecursive(path$
|
|
50023
|
+
if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue.dequeue(null, state);
|
|
49992
50024
|
callback$1(stat, resolvedPath);
|
|
49993
50025
|
queue.dequeue(null, state);
|
|
49994
50026
|
});
|
|
49995
50027
|
});
|
|
49996
50028
|
};
|
|
49997
|
-
const resolveSymlinks = function(path$
|
|
50029
|
+
const resolveSymlinks = function(path$2, state, callback$1) {
|
|
49998
50030
|
const { queue, fs: fs$3, options: { suppressErrors } } = state;
|
|
49999
50031
|
queue.enqueue();
|
|
50000
50032
|
try {
|
|
50001
|
-
const resolvedPath = fs$3.realpathSync(path$
|
|
50033
|
+
const resolvedPath = fs$3.realpathSync(path$2);
|
|
50002
50034
|
const stat = fs$3.statSync(resolvedPath);
|
|
50003
|
-
if (stat.isDirectory() && isRecursive(path$
|
|
50035
|
+
if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return;
|
|
50004
50036
|
callback$1(stat, resolvedPath);
|
|
50005
50037
|
} catch (e) {
|
|
50006
50038
|
if (!suppressErrors) throw e;
|
|
@@ -50010,16 +50042,16 @@ function build$2(options, isSynchronous) {
|
|
|
50010
50042
|
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
50011
50043
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
50012
50044
|
}
|
|
50013
|
-
function isRecursive(path$
|
|
50045
|
+
function isRecursive(path$2, resolved, state) {
|
|
50014
50046
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
50015
|
-
let parent = dirname$1(path$
|
|
50047
|
+
let parent = dirname$1(path$2);
|
|
50016
50048
|
let depth$1 = 1;
|
|
50017
50049
|
while (parent !== state.root && depth$1 < 2) {
|
|
50018
50050
|
const resolvedPath = state.symlinks.get(parent);
|
|
50019
50051
|
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
|
|
50020
50052
|
else parent = dirname$1(parent);
|
|
50021
50053
|
}
|
|
50022
|
-
state.symlinks.set(path$
|
|
50054
|
+
state.symlinks.set(path$2, resolved);
|
|
50023
50055
|
return depth$1 > 1;
|
|
50024
50056
|
}
|
|
50025
50057
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -50200,19 +50232,19 @@ var Walker = class {
|
|
|
50200
50232
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
50201
50233
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
50202
50234
|
} else if (entry.isDirectory()) {
|
|
50203
|
-
let path$
|
|
50204
|
-
if (exclude && exclude(entry.name, path$
|
|
50205
|
-
this.pushDirectory(path$
|
|
50206
|
-
this.walkDirectory(this.state, path$
|
|
50235
|
+
let path$2 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
50236
|
+
if (exclude && exclude(entry.name, path$2)) continue;
|
|
50237
|
+
this.pushDirectory(path$2, paths, filters);
|
|
50238
|
+
this.walkDirectory(this.state, path$2, path$2, depth$1 - 1, this.walk);
|
|
50207
50239
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
50208
|
-
let path$
|
|
50209
|
-
this.resolveSymlink(path$
|
|
50240
|
+
let path$2 = joinPathWithBasePath(entry.name, directoryPath);
|
|
50241
|
+
this.resolveSymlink(path$2, this.state, (stat, resolvedPath) => {
|
|
50210
50242
|
if (stat.isDirectory()) {
|
|
50211
50243
|
resolvedPath = normalizePath$1(resolvedPath, this.state.options);
|
|
50212
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$
|
|
50213
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$
|
|
50244
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$2 + pathSeparator)) return;
|
|
50245
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$2 + pathSeparator, depth$1 - 1, this.walk);
|
|
50214
50246
|
} else {
|
|
50215
|
-
resolvedPath = useRealPaths ? resolvedPath : path$
|
|
50247
|
+
resolvedPath = useRealPaths ? resolvedPath : path$2;
|
|
50216
50248
|
const filename = basename(resolvedPath);
|
|
50217
50249
|
const directoryPath$1 = normalizePath$1(dirname$1(resolvedPath), this.state.options);
|
|
50218
50250
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
@@ -50377,7 +50409,7 @@ var Builder = class {
|
|
|
50377
50409
|
isMatch = globFn(patterns, ...options);
|
|
50378
50410
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
50379
50411
|
}
|
|
50380
|
-
this.options.filters.push((path$
|
|
50412
|
+
this.options.filters.push((path$2) => isMatch(path$2));
|
|
50381
50413
|
return this;
|
|
50382
50414
|
}
|
|
50383
50415
|
};
|
|
@@ -50588,8 +50620,8 @@ var require_utils = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/pic
|
|
|
50588
50620
|
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
50589
50621
|
return output;
|
|
50590
50622
|
};
|
|
50591
|
-
exports.basename = (path$
|
|
50592
|
-
const segs = path$
|
|
50623
|
+
exports.basename = (path$2, { windows } = {}) => {
|
|
50624
|
+
const segs = path$2.split(windows ? /[\\/]/ : "/");
|
|
50593
50625
|
const last = segs[segs.length - 1];
|
|
50594
50626
|
if (last === "") return segs[segs.length - 2];
|
|
50595
50627
|
return last;
|
|
@@ -52124,15 +52156,15 @@ function buildRelative(cwd, root) {
|
|
|
52124
52156
|
};
|
|
52125
52157
|
}
|
|
52126
52158
|
const splitPatternOptions = { parts: true };
|
|
52127
|
-
function splitPattern(path$1) {
|
|
52159
|
+
function splitPattern(path$1$1) {
|
|
52128
52160
|
var _result$parts;
|
|
52129
|
-
const result = import_picomatch.default.scan(path$1, splitPatternOptions);
|
|
52130
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
52161
|
+
const result = import_picomatch.default.scan(path$1$1, splitPatternOptions);
|
|
52162
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1$1];
|
|
52131
52163
|
}
|
|
52132
52164
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
52133
52165
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
52134
|
-
const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
52135
|
-
const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
52166
|
+
const escapePosixPath = (path$1$1) => path$1$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
52167
|
+
const escapeWin32Path = (path$1$1) => path$1$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
52136
52168
|
/**
|
|
52137
52169
|
* Escapes a path's special characters depending on the platform.
|
|
52138
52170
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -52167,7 +52199,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
52167
52199
|
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
52168
52200
|
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
52169
52201
|
const escapedCwd = escapePath(cwd);
|
|
52170
|
-
if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
|
|
52202
|
+
if (path$1.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
|
|
52171
52203
|
else result = posix.normalize(result);
|
|
52172
52204
|
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
52173
52205
|
const parts = splitPattern(result);
|
|
@@ -52226,15 +52258,15 @@ function processPatterns({ patterns = ["**/*"], ignore: ignore$1 = [], expandDir
|
|
|
52226
52258
|
}
|
|
52227
52259
|
function formatPaths(paths, relative$2) {
|
|
52228
52260
|
for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
|
|
52229
|
-
const path$1 = paths[i$1];
|
|
52230
|
-
paths[i$1] = relative$2(path$1);
|
|
52261
|
+
const path$1$1 = paths[i$1];
|
|
52262
|
+
paths[i$1] = relative$2(path$1$1);
|
|
52231
52263
|
}
|
|
52232
52264
|
return paths;
|
|
52233
52265
|
}
|
|
52234
52266
|
function normalizeCwd(cwd) {
|
|
52235
52267
|
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
52236
52268
|
if (cwd instanceof URL) return fileURLToPath$1(cwd).replace(BACKSLASHES, "/");
|
|
52237
|
-
return path.resolve(cwd).replace(BACKSLASHES, "/");
|
|
52269
|
+
return path$1.resolve(cwd).replace(BACKSLASHES, "/");
|
|
52238
52270
|
}
|
|
52239
52271
|
function getCrawler(patterns, inputOptions = {}) {
|
|
52240
52272
|
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
@@ -52279,9 +52311,9 @@ function getCrawler(patterns, inputOptions = {}) {
|
|
|
52279
52311
|
const formatExclude = options.absolute ? format$2 : buildFormat(cwd, props.root, true);
|
|
52280
52312
|
const fdirOptions = {
|
|
52281
52313
|
filters: [options.debug ? (p$1, isDirectory$1) => {
|
|
52282
|
-
const path$1 = format$2(p$1, isDirectory$1);
|
|
52283
|
-
const matches = matcher(path$1);
|
|
52284
|
-
if (matches) log(`matched ${path$1}`);
|
|
52314
|
+
const path$1$1 = format$2(p$1, isDirectory$1);
|
|
52315
|
+
const matches = matcher(path$1$1);
|
|
52316
|
+
if (matches) log(`matched ${path$1$1}`);
|
|
52285
52317
|
return matches;
|
|
52286
52318
|
} : (p$1, isDirectory$1) => matcher(format$2(p$1, isDirectory$1))],
|
|
52287
52319
|
exclude: options.debug ? (_, p$1) => {
|
|
@@ -52362,6 +52394,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
52362
52394
|
{
|
|
52363
52395
|
name: ROUTER_WORKER_NAME,
|
|
52364
52396
|
compatibilityDate: INTERNAL_WORKERS_COMPATIBILITY_DATE,
|
|
52397
|
+
compatibilityFlags: ["enable_ctx_exports"],
|
|
52365
52398
|
modulesRoot: miniflareModulesRoot,
|
|
52366
52399
|
modules: [{
|
|
52367
52400
|
type: "ESModule",
|
|
@@ -52550,7 +52583,9 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
52550
52583
|
...userWorkers
|
|
52551
52584
|
],
|
|
52552
52585
|
async unsafeModuleFallbackService(request$2) {
|
|
52553
|
-
const
|
|
52586
|
+
const parsed = await parseModuleFallbackRequest(request$2);
|
|
52587
|
+
if (!parsed) return new Response$1("Invalid module fallback request", { status: 400 });
|
|
52588
|
+
const rawSpecifier = parsed.rawSpecifier;
|
|
52554
52589
|
assert(rawSpecifier, `Unexpected error: no specifier in request to module fallback service.`);
|
|
52555
52590
|
const match = additionalModuleRE.exec(rawSpecifier);
|
|
52556
52591
|
assert(match, `Unexpected error: no match for module: ${rawSpecifier}.`);
|
|
@@ -52833,7 +52868,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
|
|
|
52833
52868
|
if ([...containerTagToOptionsMap.values()].some((opts) => "image_uri" in opts && new URL(`http://${opts.image_uri}`).hostname === getCloudflareContainerRegistry())) {
|
|
52834
52869
|
const apiToken = process.env.CLOUDFLARE_API_TOKEN;
|
|
52835
52870
|
const accountId = ctx.entryWorkerConfig?.account_id ?? process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
52836
|
-
if (!apiToken || !accountId) throw new UserError("To use images from the Cloudflare-managed registry with the Vite plugin, set the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.\nThe API token requires Containers:Edit and Workers Scripts:Edit permissions.\nAlternatively, use a Dockerfile that references the image via FROM.");
|
|
52871
|
+
if (!apiToken || !accountId) throw new UserError("To use images from the Cloudflare-managed registry with the Vite plugin, set the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.\nThe API token requires Containers:Edit and Workers Scripts:Edit permissions.\nAlternatively, use a Dockerfile that references the image via FROM.", { telemetryMessage: false });
|
|
52837
52872
|
configureOpenAPIForContainerPull(accountId, apiToken);
|
|
52838
52873
|
}
|
|
52839
52874
|
await prepareContainerImagesForDev({
|
|
@@ -53101,7 +53136,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
|
|
|
53101
53136
|
if ([...containerTagToOptionsMap.values()].some((opts) => "image_uri" in opts && new URL(`http://${opts.image_uri}`).hostname === getCloudflareContainerRegistry())) {
|
|
53102
53137
|
const apiToken = process.env.CLOUDFLARE_API_TOKEN;
|
|
53103
53138
|
const accountId = ctx.allWorkerConfigs[0]?.account_id ?? process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
53104
|
-
if (!apiToken || !accountId) throw new UserError("To use images from the Cloudflare-managed registry with the Vite plugin, set the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.\nThe API token requires Containers:Edit and Workers Scripts:Edit permissions.\nAlternatively, use a Dockerfile that references the image via FROM.");
|
|
53139
|
+
if (!apiToken || !accountId) throw new UserError("To use images from the Cloudflare-managed registry with the Vite plugin, set the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID environment variables.\nThe API token requires Containers:Edit and Workers Scripts:Edit permissions.\nAlternatively, use a Dockerfile that references the image via FROM.", { telemetryMessage: false });
|
|
53105
53140
|
configureOpenAPIForContainerPull(accountId, apiToken);
|
|
53106
53141
|
}
|
|
53107
53142
|
await prepareContainerImagesForDev({
|
|
@@ -53270,13 +53305,13 @@ const wslDefaultBrowser = async () => {
|
|
|
53270
53305
|
const { stdout } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
|
|
53271
53306
|
return stdout.trim();
|
|
53272
53307
|
};
|
|
53273
|
-
const convertWslPathToWindows = async (path$
|
|
53274
|
-
if (/^[a-z]+:\/\//i.test(path$
|
|
53308
|
+
const convertWslPathToWindows = async (path$2) => {
|
|
53309
|
+
if (/^[a-z]+:\/\//i.test(path$2)) return path$2;
|
|
53275
53310
|
try {
|
|
53276
|
-
const { stdout } = await execFile$1("wslpath", ["-aw", path$
|
|
53311
|
+
const { stdout } = await execFile$1("wslpath", ["-aw", path$2], { encoding: "utf8" });
|
|
53277
53312
|
return stdout.trim();
|
|
53278
53313
|
} catch {
|
|
53279
|
-
return path$
|
|
53314
|
+
return path$2;
|
|
53280
53315
|
}
|
|
53281
53316
|
};
|
|
53282
53317
|
|
|
@@ -53462,8 +53497,8 @@ var is_in_ssh_default = isInSsh;
|
|
|
53462
53497
|
//#endregion
|
|
53463
53498
|
//#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
53464
53499
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
53465
|
-
const __dirname = import.meta.url ?
|
|
53466
|
-
const localXdgOpenPath =
|
|
53500
|
+
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
53501
|
+
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
53467
53502
|
const { platform, arch: arch$1 } = process$1;
|
|
53468
53503
|
const tryEachApp = async (apps$1, opener) => {
|
|
53469
53504
|
if (apps$1.length === 0) return;
|