@cloudflare/vite-plugin 1.42.3 → 1.43.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/experimental-config.d.mts +128 -40
- package/dist/experimental-config.d.mts.map +1 -1
- package/dist/experimental-config.mjs +21 -5
- package/dist/experimental-config.mjs.map +1 -1
- package/dist/index.mjs +769 -426
- package/dist/index.mjs.map +1 -1
- package/dist/{package-5od-l3GL.mjs → package-BAfwsu0Q.mjs} +2 -2
- package/dist/{package-5od-l3GL.mjs.map → package-BAfwsu0Q.mjs.map} +1 -1
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import assert from "node:assert";
|
|
|
3
3
|
import { CoreHeaders, CorePaths, Log, LogLevel, Miniflare, Request as Request$1, Response as Response$1, buildPublicUrl, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
|
|
4
4
|
import * as wrangler from "wrangler";
|
|
5
5
|
import * as nodePath from "node:path";
|
|
6
|
-
import
|
|
6
|
+
import path, { basename, 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";
|
|
@@ -1506,7 +1506,7 @@ async function assertWranglerVersion() {
|
|
|
1506
1506
|
* The default compatibility date to use when the user omits one.
|
|
1507
1507
|
* This value is injected at build time and remains fixed for each release.
|
|
1508
1508
|
*/
|
|
1509
|
-
const DEFAULT_COMPAT_DATE = "2026-
|
|
1509
|
+
const DEFAULT_COMPAT_DATE = "2026-07-02";
|
|
1510
1510
|
|
|
1511
1511
|
//#endregion
|
|
1512
1512
|
//#region src/build-output-env.ts
|
|
@@ -1635,7 +1635,17 @@ var __toESM = (mod$1, isNodeMode, target$1) => (target$1 = mod$1 != null ? __cre
|
|
|
1635
1635
|
}) : target$1, mod$1));
|
|
1636
1636
|
|
|
1637
1637
|
//#endregion
|
|
1638
|
-
//#region ../workers-utils/dist/chunk-
|
|
1638
|
+
//#region ../workers-utils/dist/chunk-66IS76LR.mjs
|
|
1639
|
+
function partitionExports$1(exports$2) {
|
|
1640
|
+
const partitioned = {
|
|
1641
|
+
"durable-object": {},
|
|
1642
|
+
worker: {}
|
|
1643
|
+
};
|
|
1644
|
+
if (exports$2 === void 0) return partitioned;
|
|
1645
|
+
for (const [name, entry] of Object.entries(exports$2)) partitioned[entry.type][name] = entry;
|
|
1646
|
+
return partitioned;
|
|
1647
|
+
}
|
|
1648
|
+
__name$1(partitionExports$1, "partitionExports");
|
|
1639
1649
|
var UserError = class extends Error {
|
|
1640
1650
|
static {
|
|
1641
1651
|
__name$1(this, "UserError");
|
|
@@ -3629,6 +3639,12 @@ var APIError = class extends ParseError$1 {
|
|
|
3629
3639
|
#status;
|
|
3630
3640
|
code;
|
|
3631
3641
|
accountTag;
|
|
3642
|
+
/**
|
|
3643
|
+
* Optional structured metadata hoisted from the first `FetchError.meta`
|
|
3644
|
+
* on the v4 response envelope. Consumers can inspect this to render
|
|
3645
|
+
* endpoint-specific structured error payloads.
|
|
3646
|
+
*/
|
|
3647
|
+
meta;
|
|
3632
3648
|
constructor({ status,...rest }) {
|
|
3633
3649
|
super(rest);
|
|
3634
3650
|
this.name = this.constructor.name;
|
|
@@ -3970,7 +3986,7 @@ function resolveWranglerConfigPath$1({ config: config$1, script }, options) {
|
|
|
3970
3986
|
deployConfigPath: void 0,
|
|
3971
3987
|
redirected: false
|
|
3972
3988
|
};
|
|
3973
|
-
return findWranglerConfig$2(script !== void 0 ?
|
|
3989
|
+
return findWranglerConfig$2(script !== void 0 ? path.dirname(script) : process.cwd(), options);
|
|
3974
3990
|
}
|
|
3975
3991
|
__name$1(resolveWranglerConfigPath$1, "resolveWranglerConfigPath");
|
|
3976
3992
|
function findWranglerConfig$2(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -4001,15 +4017,15 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
|
|
|
4001
4017
|
const deployConfigFile = readFileSync$2(deployConfigPath);
|
|
4002
4018
|
try {
|
|
4003
4019
|
const deployConfig = parseJSONC$1(deployConfigFile, deployConfigPath);
|
|
4004
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
4020
|
+
redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
|
|
4005
4021
|
} catch (e) {
|
|
4006
|
-
throw new UserError(`Failed to parse the deploy configuration file at ${
|
|
4022
|
+
throw new UserError(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
|
|
4007
4023
|
cause: e,
|
|
4008
4024
|
telemetryMessage: false
|
|
4009
4025
|
});
|
|
4010
4026
|
}
|
|
4011
4027
|
if (!redirectedConfigPath) throw new UserError(esm_default$1`
|
|
4012
|
-
A deploy configuration file was found at "${
|
|
4028
|
+
A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
|
|
4013
4029
|
But this is not valid - the required "configPath" property was not found.
|
|
4014
4030
|
Instead this file contains:
|
|
4015
4031
|
\`\`\`
|
|
@@ -4017,13 +4033,13 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
|
|
|
4017
4033
|
\`\`\`
|
|
4018
4034
|
`, { telemetryMessage: false });
|
|
4019
4035
|
if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default$1`
|
|
4020
|
-
There is a deploy configuration at "${
|
|
4021
|
-
But the redirected configuration path it points to, "${
|
|
4036
|
+
There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
|
|
4037
|
+
But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
|
|
4022
4038
|
`, { telemetryMessage: false });
|
|
4023
4039
|
if (userConfigPath) {
|
|
4024
|
-
if (
|
|
4025
|
-
Found both a user configuration file at "${
|
|
4026
|
-
and a deploy configuration file at "${
|
|
4040
|
+
if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG$1) !== deployConfigPath) throw new UserError(esm_default$1`
|
|
4041
|
+
Found both a user configuration file at "${path.relative(".", userConfigPath)}"
|
|
4042
|
+
and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
|
|
4027
4043
|
But these do not share the same base path so it is not clear which should be used.
|
|
4028
4044
|
`, { telemetryMessage: false });
|
|
4029
4045
|
}
|
|
@@ -5239,10 +5255,10 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
5239
5255
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
5240
5256
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
5241
5257
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
5242
|
-
let path = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
5258
|
+
let path$1 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
5243
5259
|
if (origin[origin.length - 1] === "/") origin = origin.slice(0, origin.length - 1);
|
|
5244
|
-
if (path && path[0] !== "/") path = `/${path}`;
|
|
5245
|
-
return new URL(`${origin}${path}`);
|
|
5260
|
+
if (path$1 && path$1[0] !== "/") path$1 = `/${path$1}`;
|
|
5261
|
+
return new URL(`${origin}${path$1}`);
|
|
5246
5262
|
}
|
|
5247
5263
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
5248
5264
|
return url;
|
|
@@ -6117,8 +6133,8 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
|
|
|
6117
6133
|
debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$3, error.message);
|
|
6118
6134
|
});
|
|
6119
6135
|
diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
|
|
6120
|
-
const { request: { method, path, origin } } = evt;
|
|
6121
|
-
debugLog("sending request to %s %s%s", method, origin, path);
|
|
6136
|
+
const { request: { method, path: path$1, origin } } = evt;
|
|
6137
|
+
debugLog("sending request to %s %s%s", method, origin, path$1);
|
|
6122
6138
|
});
|
|
6123
6139
|
}
|
|
6124
6140
|
let isTrackingRequestEvents = false;
|
|
@@ -6130,16 +6146,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
|
|
|
6130
6146
|
}
|
|
6131
6147
|
isTrackingRequestEvents = true;
|
|
6132
6148
|
diagnosticsChannel$1.subscribe("undici:request:headers", (evt) => {
|
|
6133
|
-
const { request: { method, path, origin }, response: { statusCode } } = evt;
|
|
6134
|
-
debugLog("received response to %s %s%s - HTTP %d", method, origin, path, statusCode);
|
|
6149
|
+
const { request: { method, path: path$1, origin }, response: { statusCode } } = evt;
|
|
6150
|
+
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$1, statusCode);
|
|
6135
6151
|
});
|
|
6136
6152
|
diagnosticsChannel$1.subscribe("undici:request:trailers", (evt) => {
|
|
6137
|
-
const { request: { method, path, origin } } = evt;
|
|
6138
|
-
debugLog("trailers received from %s %s%s", method, origin, path);
|
|
6153
|
+
const { request: { method, path: path$1, origin } } = evt;
|
|
6154
|
+
debugLog("trailers received from %s %s%s", method, origin, path$1);
|
|
6139
6155
|
});
|
|
6140
6156
|
diagnosticsChannel$1.subscribe("undici:request:error", (evt) => {
|
|
6141
|
-
const { request: { method, path, origin }, error } = evt;
|
|
6142
|
-
debugLog("request to %s %s%s errored - %s", method, origin, path, error.message);
|
|
6157
|
+
const { request: { method, path: path$1, origin }, error } = evt;
|
|
6158
|
+
debugLog("request to %s %s%s errored - %s", method, origin, path$1, error.message);
|
|
6143
6159
|
});
|
|
6144
6160
|
}
|
|
6145
6161
|
let isTrackingWebSocketEvents = false;
|
|
@@ -6200,10 +6216,10 @@ var require_request$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
6200
6216
|
}
|
|
6201
6217
|
const kHandler = Symbol("handler");
|
|
6202
6218
|
var Request$6 = class {
|
|
6203
|
-
constructor(origin, { path, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
|
|
6204
|
-
if (typeof path !== "string") throw new InvalidArgumentError$35("path must be a string");
|
|
6205
|
-
else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") throw new InvalidArgumentError$35("path must be an absolute URL or start with a slash");
|
|
6206
|
-
else if (invalidPathRegex.test(path)) throw new InvalidArgumentError$35("invalid request path");
|
|
6219
|
+
constructor(origin, { path: path$1, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
|
|
6220
|
+
if (typeof path$1 !== "string") throw new InvalidArgumentError$35("path must be a string");
|
|
6221
|
+
else if (path$1[0] !== "/" && !(path$1.startsWith("http://") || path$1.startsWith("https://")) && method !== "CONNECT") throw new InvalidArgumentError$35("path must be an absolute URL or start with a slash");
|
|
6222
|
+
else if (invalidPathRegex.test(path$1)) throw new InvalidArgumentError$35("invalid request path");
|
|
6207
6223
|
if (typeof method !== "string") throw new InvalidArgumentError$35("method must be a string");
|
|
6208
6224
|
else if (normalizedMethodRecords$1[method] === void 0 && !isValidHTTPToken$2(method)) throw new InvalidArgumentError$35("invalid request method");
|
|
6209
6225
|
if (upgrade$1 && typeof upgrade$1 !== "string") throw new InvalidArgumentError$35("upgrade must be a string");
|
|
@@ -6244,7 +6260,7 @@ var require_request$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
6244
6260
|
this.completed = false;
|
|
6245
6261
|
this.aborted = false;
|
|
6246
6262
|
this.upgrade = upgrade$1 || null;
|
|
6247
|
-
this.path = query ? serializePathWithQuery$3(path, query) : path;
|
|
6263
|
+
this.path = query ? serializePathWithQuery$3(path$1, query) : path$1;
|
|
6248
6264
|
this.origin = origin;
|
|
6249
6265
|
this.protocol = getProtocolFromUrlString(origin);
|
|
6250
6266
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -10843,7 +10859,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
10843
10859
|
* @returns
|
|
10844
10860
|
*/
|
|
10845
10861
|
function writeH1(client, request$2) {
|
|
10846
|
-
const { method, path, host, upgrade: upgrade$1, blocking, reset } = request$2;
|
|
10862
|
+
const { method, path: path$1, host, upgrade: upgrade$1, blocking, reset } = request$2;
|
|
10847
10863
|
let { body, headers, contentLength } = request$2;
|
|
10848
10864
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
10849
10865
|
if (util$23.isFormDataLike(body)) {
|
|
@@ -10889,7 +10905,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
10889
10905
|
if (client[kMaxRequests$1] && socket[kCounter$1]++ >= client[kMaxRequests$1]) socket[kReset$1] = true;
|
|
10890
10906
|
if (blocking) socket[kBlocking] = true;
|
|
10891
10907
|
if (socket.setTypeOfService) socket.setTypeOfService(request$2.typeOfService);
|
|
10892
|
-
let header = `${method} ${path} HTTP/1.1\r\n`;
|
|
10908
|
+
let header = `${method} ${path$1} HTTP/1.1\r\n`;
|
|
10893
10909
|
if (typeof host === "string") header += `host: ${host}\r\n`;
|
|
10894
10910
|
else header += client[kHostHeader$1];
|
|
10895
10911
|
if (upgrade$1) header += `connection: upgrade\r\nupgrade: ${upgrade$1}\r\n`;
|
|
@@ -11425,7 +11441,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11425
11441
|
function writeH2(client, request$2) {
|
|
11426
11442
|
const requestTimeout = request$2.bodyTimeout ?? client[kBodyTimeout$1];
|
|
11427
11443
|
const session = client[kHTTP2Session];
|
|
11428
|
-
const { method, path, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
|
|
11444
|
+
const { method, path: path$1, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
|
|
11429
11445
|
let { body } = request$2;
|
|
11430
11446
|
if (upgrade$1 != null && upgrade$1 !== "websocket") {
|
|
11431
11447
|
util$22.errorRequest(client, request$2, new InvalidArgumentError$30(`Custom upgrade "${upgrade$1}" not supported over HTTP/2`));
|
|
@@ -11478,7 +11494,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11478
11494
|
}
|
|
11479
11495
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
11480
11496
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
11481
|
-
headers[HTTP2_HEADER_PATH] = path;
|
|
11497
|
+
headers[HTTP2_HEADER_PATH] = path$1;
|
|
11482
11498
|
if (protocol === "ws:" || protocol === "wss:") headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
11483
11499
|
else headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
11484
11500
|
stream$2 = session.request(headers, {
|
|
@@ -11520,7 +11536,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11520
11536
|
stream$2.setTimeout(requestTimeout);
|
|
11521
11537
|
return true;
|
|
11522
11538
|
}
|
|
11523
|
-
headers[HTTP2_HEADER_PATH] = path;
|
|
11539
|
+
headers[HTTP2_HEADER_PATH] = path$1;
|
|
11524
11540
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
11525
11541
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
11526
11542
|
if (body && typeof body.read === "function") body.read(0);
|
|
@@ -13385,8 +13401,8 @@ var require_proxy_agent = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
|
|
|
13385
13401
|
}
|
|
13386
13402
|
if (onHeaders) onHeaders.call(this, statusCode, data$1, resume$1);
|
|
13387
13403
|
};
|
|
13388
|
-
const { origin, path = "/", headers = {} } = opts;
|
|
13389
|
-
opts.path = origin + path;
|
|
13404
|
+
const { origin, path: path$1 = "/", headers = {} } = opts;
|
|
13405
|
+
opts.path = origin + path$1;
|
|
13390
13406
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
13391
13407
|
const { host } = new URL(origin);
|
|
13392
13408
|
headers.host = host;
|
|
@@ -15171,16 +15187,16 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15171
15187
|
}
|
|
15172
15188
|
return normalizedQp;
|
|
15173
15189
|
}
|
|
15174
|
-
function safeUrl(path) {
|
|
15175
|
-
if (typeof path !== "string") return path;
|
|
15176
|
-
const pathSegments = path.split("?", 3);
|
|
15177
|
-
if (pathSegments.length !== 2) return path;
|
|
15190
|
+
function safeUrl(path$1) {
|
|
15191
|
+
if (typeof path$1 !== "string") return path$1;
|
|
15192
|
+
const pathSegments = path$1.split("?", 3);
|
|
15193
|
+
if (pathSegments.length !== 2) return path$1;
|
|
15178
15194
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
15179
15195
|
qp.sort();
|
|
15180
15196
|
return [...pathSegments, qp.toString()].join("?");
|
|
15181
15197
|
}
|
|
15182
|
-
function matchKey(mockDispatch$1, { path, method, body, headers }) {
|
|
15183
|
-
const pathMatch = matchValue$1(mockDispatch$1.path, path);
|
|
15198
|
+
function matchKey(mockDispatch$1, { path: path$1, method, body, headers }) {
|
|
15199
|
+
const pathMatch = matchValue$1(mockDispatch$1.path, path$1);
|
|
15184
15200
|
const methodMatch = matchValue$1(mockDispatch$1.method, method);
|
|
15185
15201
|
const bodyMatch = typeof mockDispatch$1.body !== "undefined" ? matchValue$1(mockDispatch$1.body, body) : true;
|
|
15186
15202
|
const headersMatch = matchHeaders(mockDispatch$1, headers);
|
|
@@ -15198,8 +15214,8 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15198
15214
|
const basePath = key.query ? serializePathWithQuery$2(key.path, key.query) : key.path;
|
|
15199
15215
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
15200
15216
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
15201
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path, ignoreTrailingSlash }) => {
|
|
15202
|
-
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path), resolvedPath);
|
|
15217
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$1, ignoreTrailingSlash }) => {
|
|
15218
|
+
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$1)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path$1), resolvedPath);
|
|
15203
15219
|
});
|
|
15204
15220
|
if (matchedMockDispatches.length === 0) throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
15205
15221
|
matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue$1(method, key.method));
|
|
@@ -15242,15 +15258,15 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15242
15258
|
/**
|
|
15243
15259
|
* @param {string} path Path to remove trailing slash from
|
|
15244
15260
|
*/
|
|
15245
|
-
function removeTrailingSlash(path) {
|
|
15246
|
-
while (path.endsWith("/")) path = path.slice(0, -1);
|
|
15247
|
-
if (path.length === 0) path = "/";
|
|
15248
|
-
return path;
|
|
15261
|
+
function removeTrailingSlash(path$1) {
|
|
15262
|
+
while (path$1.endsWith("/")) path$1 = path$1.slice(0, -1);
|
|
15263
|
+
if (path$1.length === 0) path$1 = "/";
|
|
15264
|
+
return path$1;
|
|
15249
15265
|
}
|
|
15250
15266
|
function buildKey$1(opts) {
|
|
15251
|
-
const { path, method, body, headers, query } = opts;
|
|
15267
|
+
const { path: path$1, method, body, headers, query } = opts;
|
|
15252
15268
|
return {
|
|
15253
|
-
path,
|
|
15269
|
+
path: path$1,
|
|
15254
15270
|
method,
|
|
15255
15271
|
body,
|
|
15256
15272
|
headers,
|
|
@@ -15817,10 +15833,10 @@ var require_pending_interceptors_formatter = /* @__PURE__ */ __commonJS$2({ "../
|
|
|
15817
15833
|
});
|
|
15818
15834
|
}
|
|
15819
15835
|
format(pendingInterceptors) {
|
|
15820
|
-
const withPrettyHeaders = pendingInterceptors.map(({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
15836
|
+
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$1, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
15821
15837
|
Method: method,
|
|
15822
15838
|
Origin: origin,
|
|
15823
|
-
Path: path,
|
|
15839
|
+
Path: path$1,
|
|
15824
15840
|
"Status code": statusCode,
|
|
15825
15841
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
15826
15842
|
Invocations: timesInvoked,
|
|
@@ -15878,8 +15894,8 @@ var require_mock_agent = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15878
15894
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
15879
15895
|
const dispatchOpts = { ...opts };
|
|
15880
15896
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
15881
|
-
const [path, searchParams] = dispatchOpts.path.split("?");
|
|
15882
|
-
dispatchOpts.path = `${path}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
|
|
15897
|
+
const [path$1, searchParams] = dispatchOpts.path.split("?");
|
|
15898
|
+
dispatchOpts.path = `${path$1}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
|
|
15883
15899
|
}
|
|
15884
15900
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
15885
15901
|
}
|
|
@@ -16356,10 +16372,10 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../node_modul
|
|
|
16356
16372
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
16357
16373
|
*/
|
|
16358
16374
|
async loadSnapshots(filePath) {
|
|
16359
|
-
const path = filePath || this.#snapshotPath;
|
|
16360
|
-
if (!path) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16375
|
+
const path$1 = filePath || this.#snapshotPath;
|
|
16376
|
+
if (!path$1) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16361
16377
|
try {
|
|
16362
|
-
const data$1 = await readFile(resolve$3(path), "utf8");
|
|
16378
|
+
const data$1 = await readFile(resolve$3(path$1), "utf8");
|
|
16363
16379
|
const parsed = JSON.parse(data$1);
|
|
16364
16380
|
if (Array.isArray(parsed)) {
|
|
16365
16381
|
this.#snapshots.clear();
|
|
@@ -16367,7 +16383,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../node_modul
|
|
|
16367
16383
|
} else this.#snapshots = new Map(Object.entries(parsed));
|
|
16368
16384
|
} catch (error) {
|
|
16369
16385
|
if (error.code === "ENOENT") this.#snapshots.clear();
|
|
16370
|
-
else throw new UndiciError$1(`Failed to load snapshots from ${path}`, { cause: error });
|
|
16386
|
+
else throw new UndiciError$1(`Failed to load snapshots from ${path$1}`, { cause: error });
|
|
16371
16387
|
}
|
|
16372
16388
|
}
|
|
16373
16389
|
/**
|
|
@@ -16377,9 +16393,9 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../node_modul
|
|
|
16377
16393
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
16378
16394
|
*/
|
|
16379
16395
|
async saveSnapshots(filePath) {
|
|
16380
|
-
const path = filePath || this.#snapshotPath;
|
|
16381
|
-
if (!path) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16382
|
-
const resolvedPath = resolve$3(path);
|
|
16396
|
+
const path$1 = filePath || this.#snapshotPath;
|
|
16397
|
+
if (!path$1) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16398
|
+
const resolvedPath = resolve$3(path$1);
|
|
16383
16399
|
await mkdir(dirname$2(resolvedPath), { recursive: true });
|
|
16384
16400
|
const data$1 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
16385
16401
|
hash,
|
|
@@ -16953,11 +16969,11 @@ var require_redirect_handler = /* @__PURE__ */ __commonJS$2({ "../../node_module
|
|
|
16953
16969
|
return;
|
|
16954
16970
|
}
|
|
16955
16971
|
const { origin, pathname, search } = util$10.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
16956
|
-
const path = search ? `${pathname}${search}` : pathname;
|
|
16957
|
-
const redirectUrlString = `${origin}${path}`;
|
|
16972
|
+
const path$1 = search ? `${pathname}${search}` : pathname;
|
|
16973
|
+
const redirectUrlString = `${origin}${path$1}`;
|
|
16958
16974
|
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.`);
|
|
16959
16975
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
16960
|
-
this.opts.path = path;
|
|
16976
|
+
this.opts.path = path$1;
|
|
16961
16977
|
this.opts.origin = origin;
|
|
16962
16978
|
this.opts.query = null;
|
|
16963
16979
|
}
|
|
@@ -21923,10 +21939,10 @@ var require_fetch = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/und
|
|
|
21923
21939
|
const url = requestCurrentURL(request$2);
|
|
21924
21940
|
/** @type {import('../../..').Agent} */
|
|
21925
21941
|
const agent = fetchParams.controller.dispatcher;
|
|
21926
|
-
const path = url.pathname + url.search;
|
|
21942
|
+
const path$1 = url.pathname + url.search;
|
|
21927
21943
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
21928
21944
|
return new Promise((resolve$4, reject) => agent.dispatch({
|
|
21929
|
-
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
21945
|
+
path: hasTrailingQuestionMark ? `${path$1}?` : path$1,
|
|
21930
21946
|
origin: url.origin,
|
|
21931
21947
|
method: request$2.method,
|
|
21932
21948
|
body: agent.isMockActive ? request$2.body && (request$2.body.source || request$2.body.stream) : body,
|
|
@@ -22708,9 +22724,9 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
22708
22724
|
* path-value = <any CHAR except CTLs or ";">
|
|
22709
22725
|
* @param {string} path
|
|
22710
22726
|
*/
|
|
22711
|
-
function validateCookiePath(path) {
|
|
22712
|
-
for (let i$1 = 0; i$1 < path.length; ++i$1) {
|
|
22713
|
-
const code = path.charCodeAt(i$1);
|
|
22727
|
+
function validateCookiePath(path$1) {
|
|
22728
|
+
for (let i$1 = 0; i$1 < path$1.length; ++i$1) {
|
|
22729
|
+
const code = path$1.charCodeAt(i$1);
|
|
22714
22730
|
if (code < 32 || code === 127 || code === 59) throw new Error("Invalid cookie path");
|
|
22715
22731
|
}
|
|
22716
22732
|
}
|
|
@@ -25838,9 +25854,9 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
25838
25854
|
if (opts != null && typeof opts !== "object") throw new InvalidArgumentError("invalid opts");
|
|
25839
25855
|
if (opts && opts.path != null) {
|
|
25840
25856
|
if (typeof opts.path !== "string") throw new InvalidArgumentError("invalid opts.path");
|
|
25841
|
-
let path = opts.path;
|
|
25842
|
-
if (!opts.path.startsWith("/")) path = `/${path}`;
|
|
25843
|
-
url = new URL(util$3.parseOrigin(url).origin + path);
|
|
25857
|
+
let path$1 = opts.path;
|
|
25858
|
+
if (!opts.path.startsWith("/")) path$1 = `/${path$1}`;
|
|
25859
|
+
url = new URL(util$3.parseOrigin(url).origin + path$1);
|
|
25844
25860
|
} else {
|
|
25845
25861
|
if (!opts) opts = typeof url === "object" ? url : {};
|
|
25846
25862
|
url = util$3.parseURL(url);
|
|
@@ -27475,6 +27491,14 @@ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check
|
|
|
27475
27491
|
return null;
|
|
27476
27492
|
};
|
|
27477
27493
|
} });
|
|
27494
|
+
function getDurableObjectExports(exports$2) {
|
|
27495
|
+
return partitionExports$1(exports$2)["durable-object"];
|
|
27496
|
+
}
|
|
27497
|
+
__name$1(getDurableObjectExports, "getDurableObjectExports");
|
|
27498
|
+
function hasDurableObjectExports(exports$2) {
|
|
27499
|
+
return Object.keys(getDurableObjectExports(exports$2)).length > 0;
|
|
27500
|
+
}
|
|
27501
|
+
__name$1(hasDurableObjectExports, "hasDurableObjectExports");
|
|
27478
27502
|
var defaultWranglerConfig = {
|
|
27479
27503
|
configPath: void 0,
|
|
27480
27504
|
userConfigPath: void 0,
|
|
@@ -27549,6 +27573,7 @@ var defaultWranglerConfig = {
|
|
|
27549
27573
|
jsx_factory: "React.createElement",
|
|
27550
27574
|
jsx_fragment: "React.Fragment",
|
|
27551
27575
|
migrations: [],
|
|
27576
|
+
exports: {},
|
|
27552
27577
|
triggers: { crons: void 0 },
|
|
27553
27578
|
rules: [],
|
|
27554
27579
|
build: {
|
|
@@ -31146,7 +31171,7 @@ function getGlobalConfigPath({ appName = "wrangler", leadingDot = true, useLegac
|
|
|
31146
31171
|
const dirName = `${leadingDot ? "." : ""}${appName}`;
|
|
31147
31172
|
const configDir = mod_esm_default(dirName).config();
|
|
31148
31173
|
if (useLegacyHomeDir) {
|
|
31149
|
-
const legacyConfigDir =
|
|
31174
|
+
const legacyConfigDir = path.join(os.homedir(), dirName);
|
|
31150
31175
|
if (isDirectory$1(legacyConfigDir)) return legacyConfigDir;
|
|
31151
31176
|
}
|
|
31152
31177
|
return configDir;
|
|
@@ -31251,7 +31276,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
|
|
|
31251
31276
|
var getRegistryPath = getEnvironmentVariableFactory({
|
|
31252
31277
|
variableName: "WRANGLER_REGISTRY_PATH",
|
|
31253
31278
|
defaultValue() {
|
|
31254
|
-
return
|
|
31279
|
+
return path.join(getGlobalConfigPath(), "registry");
|
|
31255
31280
|
}
|
|
31256
31281
|
});
|
|
31257
31282
|
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
|
|
@@ -31667,7 +31692,7 @@ function isPagesConfig(rawConfig) {
|
|
|
31667
31692
|
}
|
|
31668
31693
|
__name$1(isPagesConfig, "isPagesConfig");
|
|
31669
31694
|
function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
|
|
31670
|
-
const diagnostics = new Diagnostics(`Processing ${configPath ?
|
|
31695
|
+
const diagnostics = new Diagnostics(`Processing ${configPath ? path.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
|
|
31671
31696
|
validateOptionalProperty(diagnostics, "", "legacy_env", rawConfig.legacy_env, "boolean");
|
|
31672
31697
|
validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
|
|
31673
31698
|
validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
|
|
@@ -31771,34 +31796,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
31771
31796
|
else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
|
|
31772
31797
|
return {
|
|
31773
31798
|
command,
|
|
31774
|
-
watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) =>
|
|
31799
|
+
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,
|
|
31775
31800
|
cwd
|
|
31776
31801
|
};
|
|
31777
31802
|
}
|
|
31778
31803
|
__name$1(normalizeAndValidateBuild, "normalizeAndValidateBuild");
|
|
31779
31804
|
function normalizeAndValidateMainField(configPath, rawMain) {
|
|
31780
|
-
const configDir =
|
|
31805
|
+
const configDir = path.dirname(configPath ?? "wrangler.toml");
|
|
31781
31806
|
if (rawMain !== void 0) if (typeof rawMain === "string") {
|
|
31782
|
-
const directory =
|
|
31783
|
-
return
|
|
31807
|
+
const directory = path.resolve(configDir);
|
|
31808
|
+
return path.resolve(directory, rawMain);
|
|
31784
31809
|
} else return rawMain;
|
|
31785
31810
|
else return;
|
|
31786
31811
|
}
|
|
31787
31812
|
__name$1(normalizeAndValidateMainField, "normalizeAndValidateMainField");
|
|
31788
31813
|
function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
31789
|
-
const configDir =
|
|
31814
|
+
const configDir = path.dirname(configPath ?? "wrangler.toml");
|
|
31790
31815
|
if (rawDir !== void 0) if (typeof rawDir === "string") {
|
|
31791
|
-
const directory =
|
|
31792
|
-
return
|
|
31816
|
+
const directory = path.resolve(configDir);
|
|
31817
|
+
return path.resolve(directory, rawDir);
|
|
31793
31818
|
} else return rawDir;
|
|
31794
31819
|
else return;
|
|
31795
31820
|
}
|
|
31796
31821
|
__name$1(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
|
|
31797
31822
|
function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
31798
|
-
const configDir =
|
|
31823
|
+
const configDir = path.dirname(configPath ?? "wrangler.toml");
|
|
31799
31824
|
if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
|
|
31800
|
-
const directory =
|
|
31801
|
-
return
|
|
31825
|
+
const directory = path.resolve(configDir);
|
|
31826
|
+
return path.resolve(directory, rawPagesDir);
|
|
31802
31827
|
} else return rawPagesDir;
|
|
31803
31828
|
else return;
|
|
31804
31829
|
}
|
|
@@ -31848,12 +31873,13 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
|
|
|
31848
31873
|
validateRequiredProperty(diagnostics, "site", "bucket", bucket, "string");
|
|
31849
31874
|
validateTypedArray(diagnostics, "sites.include", include, "string");
|
|
31850
31875
|
validateTypedArray(diagnostics, "sites.exclude", exclude, "string");
|
|
31851
|
-
|
|
31876
|
+
const legacySiteEntryPoint = rawConfig.site["entry-point"];
|
|
31877
|
+
validateOptionalProperty(diagnostics, "site", "entry-point", legacySiteEntryPoint, "string");
|
|
31852
31878
|
deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
|
|
31853
31879
|
\`\`\`
|
|
31854
|
-
main = "${
|
|
31880
|
+
main = "${path.join(String(legacySiteEntryPoint) || "workers-site", path.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js")}"
|
|
31855
31881
|
\`\`\``, false, void 0, "warning");
|
|
31856
|
-
let siteEntryPoint =
|
|
31882
|
+
let siteEntryPoint = legacySiteEntryPoint;
|
|
31857
31883
|
if (!mainEntryPoint && !siteEntryPoint) {
|
|
31858
31884
|
diagnostics.warnings.push(`Because you've defined a [site] configuration, we're defaulting to "workers-site" for the deprecated \`site.entry-point\`field.
|
|
31859
31885
|
Add the top level \`main\` field to your configuration file:
|
|
@@ -31864,7 +31890,7 @@ main = "workers-site/index.js"
|
|
|
31864
31890
|
} else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
|
|
31865
31891
|
They serve the same purpose: to point to the entry-point of your worker.
|
|
31866
31892
|
Delete the deprecated \`site.entry-point\` field from your config.`);
|
|
31867
|
-
if (configPath && siteEntryPoint) siteEntryPoint =
|
|
31893
|
+
if (configPath && siteEntryPoint) siteEntryPoint = path.relative(process.cwd(), path.join(path.dirname(configPath), siteEntryPoint));
|
|
31868
31894
|
return {
|
|
31869
31895
|
bucket,
|
|
31870
31896
|
"entry-point": siteEntryPoint,
|
|
@@ -31896,7 +31922,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
31896
31922
|
if (rawMapping === void 0) return;
|
|
31897
31923
|
const mapping = {};
|
|
31898
31924
|
for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
|
|
31899
|
-
if (configPath) mapping[name] = configPath ?
|
|
31925
|
+
if (configPath) mapping[name] = configPath ? path.relative(process.cwd(), path.join(path.dirname(configPath), filePath)) : filePath;
|
|
31900
31926
|
}
|
|
31901
31927
|
return mapping;
|
|
31902
31928
|
}
|
|
@@ -32096,6 +32122,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
32096
32122
|
durable_objects: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "durable_objects", validateBindingsProperty(envName, validateDurableObjectBinding), { bindings: [] }),
|
|
32097
32123
|
workflows: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "workflows", all(validateBindingArray(envName, validateWorkflowBinding), validateUniqueNameProperty), []),
|
|
32098
32124
|
migrations: inheritable(diagnostics, topLevelEnv, rawEnv, "migrations", validateMigrations, []),
|
|
32125
|
+
exports: inheritable(diagnostics, topLevelEnv, rawEnv, "exports", validateExports, {}),
|
|
32099
32126
|
kv_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "kv_namespaces", validateBindingArray(envName, validateKVBinding), []),
|
|
32100
32127
|
cloudchamber: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "cloudchamber", validateCloudchamberConfig, {}),
|
|
32101
32128
|
containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name, configPath), void 0),
|
|
@@ -32147,14 +32174,15 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
32147
32174
|
python_modules: inheritable(diagnostics, topLevelEnv, rawEnv, "python_modules", validatePythonModules, { exclude: ["**/*.pyc"] }),
|
|
32148
32175
|
previews: inheritable(diagnostics, topLevelEnv, rawEnv, "previews", validatePreviewsConfig(envName), void 0)
|
|
32149
32176
|
};
|
|
32150
|
-
|
|
32177
|
+
warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
|
|
32178
|
+
errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
|
|
32151
32179
|
if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
|
|
32152
32180
|
return environment;
|
|
32153
32181
|
}
|
|
32154
32182
|
__name$1(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
|
|
32155
32183
|
function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
|
|
32156
32184
|
const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
|
|
32157
|
-
return configPath && tsconfig ?
|
|
32185
|
+
return configPath && tsconfig ? path.relative(process.cwd(), path.join(path.dirname(configPath), tsconfig)) : tsconfig;
|
|
32158
32186
|
}
|
|
32159
32187
|
__name$1(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
|
|
32160
32188
|
var validateAndNormalizeRules = /* @__PURE__ */ __name$1((diagnostics, topLevelEnv, rawEnv, envName) => {
|
|
@@ -32654,9 +32682,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
32654
32682
|
let resolvedBuildContextPath = void 0;
|
|
32655
32683
|
try {
|
|
32656
32684
|
if (isDockerfile(resolvedImage, configPath)) {
|
|
32657
|
-
const baseDir = configPath ?
|
|
32658
|
-
resolvedImage =
|
|
32659
|
-
resolvedBuildContextPath = containerAppOptional.image_build_context ?
|
|
32685
|
+
const baseDir = configPath ? path.dirname(configPath) : process.cwd();
|
|
32686
|
+
resolvedImage = path.resolve(baseDir, resolvedImage);
|
|
32687
|
+
resolvedBuildContextPath = containerAppOptional.image_build_context ? path.resolve(baseDir, containerAppOptional.image_build_context) : path.dirname(resolvedImage);
|
|
32660
32688
|
}
|
|
32661
32689
|
} catch (err) {
|
|
32662
32690
|
if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
|
|
@@ -33735,6 +33763,138 @@ var validateMigrations = /* @__PURE__ */ __name$1((diagnostics, field, value) =>
|
|
|
33735
33763
|
}
|
|
33736
33764
|
return valid$2;
|
|
33737
33765
|
}, "validateMigrations");
|
|
33766
|
+
var VALID_EXPORT_STORAGES = /* @__PURE__ */ new Set(["sqlite", "legacy-kv"]);
|
|
33767
|
+
var JS_IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
33768
|
+
function validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, allowedProperties) {
|
|
33769
|
+
let valid$2 = true;
|
|
33770
|
+
for (const key of Object.keys(durableObjectExport)) if (!allowedProperties.includes(key)) {
|
|
33771
|
+
diagnostics.errors.push(`"exports.${className}.${key}" is forbidden on state "${durableObjectExport.state ?? "created"}".`);
|
|
33772
|
+
valid$2 = false;
|
|
33773
|
+
}
|
|
33774
|
+
if (!valid$2) diagnostics.errors.push(`Allowed properties are: ${ENGLISH.format(allowedProperties)}.`);
|
|
33775
|
+
return valid$2;
|
|
33776
|
+
}
|
|
33777
|
+
__name$1(validateDurableObjectExportProperties, "validateDurableObjectExportProperties");
|
|
33778
|
+
function validateDurableObjectExport(diagnostics, className, durableObjectExport) {
|
|
33779
|
+
let valid$2 = true;
|
|
33780
|
+
if (className === "") {
|
|
33781
|
+
diagnostics.errors.push(`"export" keys cannot be the empty string.`);
|
|
33782
|
+
valid$2 = false;
|
|
33783
|
+
}
|
|
33784
|
+
switch (durableObjectExport.state) {
|
|
33785
|
+
case void 0:
|
|
33786
|
+
case "created":
|
|
33787
|
+
if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
|
|
33788
|
+
diagnostics.errors.push(`"exports.${className}.storage" is required for state "created" and must be one of ${ENGLISH.format(VALID_EXPORT_STORAGES)}, but got ${JSON.stringify(durableObjectExport.storage)}`);
|
|
33789
|
+
valid$2 = false;
|
|
33790
|
+
}
|
|
33791
|
+
valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
|
|
33792
|
+
"type",
|
|
33793
|
+
"state",
|
|
33794
|
+
"storage"
|
|
33795
|
+
]) && valid$2;
|
|
33796
|
+
break;
|
|
33797
|
+
case "deleted":
|
|
33798
|
+
valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, ["type", "state"]) && valid$2;
|
|
33799
|
+
break;
|
|
33800
|
+
case "renamed":
|
|
33801
|
+
if (typeof durableObjectExport.renamed_to !== "string" || durableObjectExport.renamed_to === "") {
|
|
33802
|
+
diagnostics.errors.push(`"exports.${className}.renamed_to" is required for state "renamed" and must be a non-empty string.`);
|
|
33803
|
+
valid$2 = false;
|
|
33804
|
+
} else {
|
|
33805
|
+
if (!JS_IDENTIFIER_RE.test(durableObjectExport.renamed_to)) {
|
|
33806
|
+
diagnostics.errors.push(`"exports.${className}.renamed_to" must be a valid JavaScript identifier (got "${durableObjectExport.renamed_to}").`);
|
|
33807
|
+
valid$2 = false;
|
|
33808
|
+
}
|
|
33809
|
+
if (durableObjectExport.renamed_to === className) {
|
|
33810
|
+
diagnostics.errors.push(`"exports.${className}.renamed_to" cannot equal the source class name "${className}".`);
|
|
33811
|
+
valid$2 = false;
|
|
33812
|
+
}
|
|
33813
|
+
}
|
|
33814
|
+
valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
|
|
33815
|
+
"type",
|
|
33816
|
+
"state",
|
|
33817
|
+
"renamed_to"
|
|
33818
|
+
]) && valid$2;
|
|
33819
|
+
break;
|
|
33820
|
+
case "transferred":
|
|
33821
|
+
if (typeof durableObjectExport.transferred_to !== "string" || durableObjectExport.transferred_to === "") {
|
|
33822
|
+
diagnostics.errors.push(`"exports.${className}.transferred_to" is required for state "transferred" and must be a non-empty string.`);
|
|
33823
|
+
valid$2 = false;
|
|
33824
|
+
}
|
|
33825
|
+
valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
|
|
33826
|
+
"type",
|
|
33827
|
+
"state",
|
|
33828
|
+
"transferred_to"
|
|
33829
|
+
]) && valid$2;
|
|
33830
|
+
break;
|
|
33831
|
+
case "expecting-transfer":
|
|
33832
|
+
if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
|
|
33833
|
+
diagnostics.errors.push(`"exports.${className}.storage" is required for state "expecting-transfer" and must be one of ${ENGLISH.format(VALID_EXPORT_STORAGES)}, but got ${JSON.stringify(durableObjectExport.storage)}`);
|
|
33834
|
+
valid$2 = false;
|
|
33835
|
+
}
|
|
33836
|
+
if (typeof durableObjectExport.transfer_from !== "string" || durableObjectExport.transfer_from === "") {
|
|
33837
|
+
diagnostics.errors.push(`"exports.${className}.transfer_from" is required for state "expecting-transfer" and must be a non-empty string.`);
|
|
33838
|
+
valid$2 = false;
|
|
33839
|
+
}
|
|
33840
|
+
valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
|
|
33841
|
+
"type",
|
|
33842
|
+
"state",
|
|
33843
|
+
"storage",
|
|
33844
|
+
"transfer_from"
|
|
33845
|
+
]) && valid$2;
|
|
33846
|
+
break;
|
|
33847
|
+
default: {
|
|
33848
|
+
const state = durableObjectExport.state;
|
|
33849
|
+
diagnostics.errors.push(`"exports.${className}.state" must be one of "created", "deleted", "renamed", "transferred", or "expecting-transfer" but got ${JSON.stringify(state)}.`);
|
|
33850
|
+
valid$2 = false;
|
|
33851
|
+
}
|
|
33852
|
+
}
|
|
33853
|
+
return valid$2;
|
|
33854
|
+
}
|
|
33855
|
+
__name$1(validateDurableObjectExport, "validateDurableObjectExport");
|
|
33856
|
+
function validateWorkerExport(diagnostics, exportName, workerExport) {
|
|
33857
|
+
let valid$2 = true;
|
|
33858
|
+
valid$2 = validateAdditionalProperties(diagnostics, `exports.${exportName}`, Object.keys(workerExport), ["type", "cache"]) && valid$2;
|
|
33859
|
+
valid$2 = validateWorkerExportCache(diagnostics, `exports.${exportName}.cache`, workerExport.cache) && valid$2;
|
|
33860
|
+
return valid$2;
|
|
33861
|
+
}
|
|
33862
|
+
__name$1(validateWorkerExport, "validateWorkerExport");
|
|
33863
|
+
function validateWorkerExportCache(diagnostics, field, value) {
|
|
33864
|
+
if (value === void 0) return true;
|
|
33865
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
33866
|
+
diagnostics.errors.push(`"${field}" should be an object but got ${JSON.stringify(value)}.`);
|
|
33867
|
+
return false;
|
|
33868
|
+
}
|
|
33869
|
+
const cache$2 = value;
|
|
33870
|
+
let valid$2 = true;
|
|
33871
|
+
valid$2 = validateRequiredProperty(diagnostics, field, "enabled", cache$2.enabled, "boolean") && valid$2;
|
|
33872
|
+
valid$2 = validateAdditionalProperties(diagnostics, field, Object.keys(cache$2), ["enabled"]) && valid$2;
|
|
33873
|
+
return valid$2;
|
|
33874
|
+
}
|
|
33875
|
+
__name$1(validateWorkerExportCache, "validateWorkerExportCache");
|
|
33876
|
+
var validateExports = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
|
|
33877
|
+
if (value === void 0 || value === null) return true;
|
|
33878
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
33879
|
+
diagnostics.errors.push(`The optional "${field}" field should be an object keyed by class name, but got ${JSON.stringify(value)}`);
|
|
33880
|
+
return false;
|
|
33881
|
+
}
|
|
33882
|
+
let valid$2 = true;
|
|
33883
|
+
for (const [exportName, exportConfig] of Object.entries(value)) {
|
|
33884
|
+
if (typeof exportConfig !== "object" || exportConfig === null) {
|
|
33885
|
+
diagnostics.errors.push(`"exports.${exportName}" should be an object but got ${JSON.stringify(exportConfig)}.`);
|
|
33886
|
+
valid$2 = false;
|
|
33887
|
+
continue;
|
|
33888
|
+
}
|
|
33889
|
+
if (exportConfig.type === "durable-object") valid$2 = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid$2;
|
|
33890
|
+
else if (exportConfig.type === "worker") valid$2 = validateWorkerExport(diagnostics, exportName, exportConfig) && valid$2;
|
|
33891
|
+
else {
|
|
33892
|
+
valid$2 = false;
|
|
33893
|
+
diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`);
|
|
33894
|
+
}
|
|
33895
|
+
}
|
|
33896
|
+
return valid$2;
|
|
33897
|
+
}, "validateExports");
|
|
33738
33898
|
var validateObservability = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
|
|
33739
33899
|
if (value === void 0) return true;
|
|
33740
33900
|
if (typeof value !== "object") {
|
|
@@ -33808,31 +33968,40 @@ var validateCache = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
|
|
|
33808
33968
|
const val = value;
|
|
33809
33969
|
let isValid2 = true;
|
|
33810
33970
|
isValid2 = validateRequiredProperty(diagnostics, field, "enabled", val.enabled, "boolean") && isValid2;
|
|
33811
|
-
isValid2 =
|
|
33971
|
+
isValid2 = validateOptionalProperty(diagnostics, field, "cross_version_cache", val.cross_version_cache, "boolean") && isValid2;
|
|
33972
|
+
isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled", "cross_version_cache"]) && isValid2;
|
|
33812
33973
|
return isValid2;
|
|
33813
33974
|
}, "validateCache");
|
|
33814
|
-
function
|
|
33815
|
-
if (Array.isArray(durableObjects.bindings)
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
|
|
33821
|
-
|
|
33822
|
-
|
|
33823
|
-
|
|
33824
|
-
|
|
33825
|
-
|
|
33826
|
-
|
|
33827
|
-
|
|
33828
|
-
|
|
33975
|
+
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$2, configPath) {
|
|
33976
|
+
if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) return;
|
|
33977
|
+
const exportedDurableObjects = durableObjects.bindings.filter((binding) => !binding.script_name);
|
|
33978
|
+
const exportsCovers = /* @__PURE__ */ __name$1((className) => {
|
|
33979
|
+
const entry = exports$2?.[className];
|
|
33980
|
+
if (entry === void 0 || entry.type !== "durable-object") return false;
|
|
33981
|
+
const state = entry.state ?? "created";
|
|
33982
|
+
return state === "created" || state === "expecting-transfer";
|
|
33983
|
+
}, "exportsCovers");
|
|
33984
|
+
const uncoveredByExports = exportedDurableObjects.filter((binding) => typeof binding.class_name !== "string" || !exportsCovers(binding.class_name));
|
|
33985
|
+
if (uncoveredByExports.length === 0 || migrations.length > 0) return;
|
|
33986
|
+
if (uncoveredByExports.some((exportedDurableObject) => typeof exportedDurableObject.class_name !== "string")) return;
|
|
33987
|
+
const durableObjectClassnames = uncoveredByExports.map((durable) => durable.class_name);
|
|
33988
|
+
const suggestedExports = {};
|
|
33989
|
+
for (const className of durableObjectClassnames) suggestedExports[className] = {
|
|
33990
|
+
type: "durable-object",
|
|
33991
|
+
storage: "sqlite"
|
|
33992
|
+
};
|
|
33993
|
+
diagnostics.warnings.push(dedent`
|
|
33994
|
+
In your ${configFileName$1(configPath)} file, you have configured \`durable_objects\` exported by this Worker (${durableObjectClassnames.join(", ")}), but no live \`exports\` entry for them. This may not work as expected until you add a live \`durable-object\` entry to \`exports\` for each. Add the following configuration:
|
|
33829
33995
|
|
|
33830
|
-
|
|
33831
|
-
|
|
33832
|
-
|
|
33833
|
-
}
|
|
33996
|
+
\`\`\`
|
|
33997
|
+
${formatConfigSnippet$1({ exports: suggestedExports }, configPath)}
|
|
33998
|
+
\`\`\``);
|
|
33834
33999
|
}
|
|
33835
|
-
__name$1(
|
|
34000
|
+
__name$1(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
|
|
34001
|
+
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$2) {
|
|
34002
|
+
if (migrations.length > 0 && exports$2 !== void 0 && Object.values(exports$2).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
|
|
34003
|
+
}
|
|
34004
|
+
__name$1(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
33836
34005
|
var validatePythonModules = /* @__PURE__ */ __name$1((diagnostics, field, value, topLevelEnv) => {
|
|
33837
34006
|
if (value === void 0) return true;
|
|
33838
34007
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -33853,8 +34022,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
|
|
|
33853
34022
|
}
|
|
33854
34023
|
__name$1(isRemoteValid, "isRemoteValid");
|
|
33855
34024
|
function isDockerfile(imagePath, configPath) {
|
|
33856
|
-
const baseDir = configPath ?
|
|
33857
|
-
const maybeDockerfile =
|
|
34025
|
+
const baseDir = configPath ? path.dirname(configPath) : process.cwd();
|
|
34026
|
+
const maybeDockerfile = path.resolve(baseDir, imagePath);
|
|
33858
34027
|
if (fs2.existsSync(maybeDockerfile)) {
|
|
33859
34028
|
if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
|
|
33860
34029
|
return true;
|
|
@@ -34006,7 +34175,7 @@ __name$1(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
|
34006
34175
|
var import_signal_exit = __toESM(require_signal_exit());
|
|
34007
34176
|
function getWranglerHiddenDirPath(projectRoot) {
|
|
34008
34177
|
projectRoot ??= process.cwd();
|
|
34009
|
-
return
|
|
34178
|
+
return path.join(projectRoot, ".wrangler");
|
|
34010
34179
|
}
|
|
34011
34180
|
__name$1(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
|
34012
34181
|
var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
|
|
@@ -34023,7 +34192,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
34023
34192
|
const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
|
|
34024
34193
|
for (const entry of entries) {
|
|
34025
34194
|
if (!entry.isDirectory()) continue;
|
|
34026
|
-
const entryPath =
|
|
34195
|
+
const entryPath = path.join(tmpRoot, entry.name);
|
|
34027
34196
|
try {
|
|
34028
34197
|
if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync$1(entryPath);
|
|
34029
34198
|
} catch {}
|
|
@@ -34031,10 +34200,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
34031
34200
|
}
|
|
34032
34201
|
__name$1(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
|
|
34033
34202
|
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
34034
|
-
const tmpRoot =
|
|
34203
|
+
const tmpRoot = path.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
|
34035
34204
|
fs2.mkdirSync(tmpRoot, { recursive: true });
|
|
34036
34205
|
sweepStaleWranglerTmpDirs(tmpRoot);
|
|
34037
|
-
const tmpPrefix =
|
|
34206
|
+
const tmpPrefix = path.join(tmpRoot, `${prefix}-`);
|
|
34038
34207
|
const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
|
|
34039
34208
|
const cleanupDir = /* @__PURE__ */ __name$1(() => {
|
|
34040
34209
|
if (cleanup) try {
|
|
@@ -34152,7 +34321,7 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
|
|
|
34152
34321
|
}
|
|
34153
34322
|
__name$1(getLatestVersionInfo, "getLatestVersionInfo");
|
|
34154
34323
|
function getCacheDir(version$3) {
|
|
34155
|
-
return join(
|
|
34324
|
+
return join(getGlobalConfigPath(), "cloudflared", version$3);
|
|
34156
34325
|
}
|
|
34157
34326
|
__name$1(getCacheDir, "getCacheDir");
|
|
34158
34327
|
function getCloudflaredBinPath(version$3) {
|
|
@@ -34201,7 +34370,7 @@ On Linux, make sure you have the required dependencies:
|
|
|
34201
34370
|
errorMessage += ` - For Debian/Ubuntu: sudo apt-get install libc6
|
|
34202
34371
|
`;
|
|
34203
34372
|
}
|
|
34204
|
-
const cacheDir = join(
|
|
34373
|
+
const cacheDir = join(getGlobalConfigPath(), "cloudflared");
|
|
34205
34374
|
errorMessage += `
|
|
34206
34375
|
You can try:
|
|
34207
34376
|
`;
|
|
@@ -34431,7 +34600,7 @@ async function spawnCloudflared(args, options) {
|
|
|
34431
34600
|
}
|
|
34432
34601
|
__name$1(spawnCloudflared, "spawnCloudflared");
|
|
34433
34602
|
function removeCloudflaredCache(version$3) {
|
|
34434
|
-
const cacheDir = version$3 ? getCacheDir(version$3) : join(
|
|
34603
|
+
const cacheDir = version$3 ? getCacheDir(version$3) : join(getGlobalConfigPath(), "cloudflared");
|
|
34435
34604
|
if (existsSync(cacheDir)) {
|
|
34436
34605
|
removeDirSync$1(cacheDir);
|
|
34437
34606
|
return cacheDir;
|
|
@@ -34818,6 +34987,8 @@ function throwFetchError(resource, response, status) {
|
|
|
34818
34987
|
});
|
|
34819
34988
|
const code = errors$1[0]?.code;
|
|
34820
34989
|
if (code) error.code = code;
|
|
34990
|
+
const meta$2 = errors$1[0]?.meta;
|
|
34991
|
+
if (meta$2) error.meta = meta$2;
|
|
34821
34992
|
error.accountTag = extractAccountTag(resource);
|
|
34822
34993
|
throw error;
|
|
34823
34994
|
}
|
|
@@ -37207,8 +37378,8 @@ const postfixRE = /[?#].*$/;
|
|
|
37207
37378
|
function cleanUrl(url) {
|
|
37208
37379
|
return url.replace(postfixRE, "");
|
|
37209
37380
|
}
|
|
37210
|
-
function withTrailingSlash(path) {
|
|
37211
|
-
return path.endsWith("/") ? path : `${path}/`;
|
|
37381
|
+
function withTrailingSlash(path$1) {
|
|
37382
|
+
return path$1.endsWith("/") ? path$1 : `${path$1}/`;
|
|
37212
37383
|
}
|
|
37213
37384
|
function createRequestHandler(handler) {
|
|
37214
37385
|
return async (req, res, next) => {
|
|
@@ -37272,7 +37443,7 @@ function getWorkerNameToWorkerEntrypointExportsMap(workers) {
|
|
|
37272
37443
|
return workerNameToWorkerEntrypointExportsMap;
|
|
37273
37444
|
}
|
|
37274
37445
|
function getWorkerNameToDurableObjectExportsMap(workers) {
|
|
37275
|
-
const workerNameToDurableObjectExportsMap = new Map(workers.map((worker) => [worker.config.name, new Set(wrangler.unstable_getDurableObjectClassNameToUseSQLiteMap(worker.config.migrations).keys())]));
|
|
37446
|
+
const workerNameToDurableObjectExportsMap = new Map(workers.map((worker) => [worker.config.name, new Set(wrangler.unstable_getDurableObjectClassNameToUseSQLiteMap(worker.config.migrations, worker.config.exports).keys())]));
|
|
37276
37447
|
for (const worker of workers) for (const value of worker.config.durable_objects.bindings) if (value.script_name) workerNameToDurableObjectExportsMap.get(value.script_name)?.add(value.class_name);
|
|
37277
37448
|
else workerNameToDurableObjectExportsMap.get(worker.config.name)?.add(value.class_name);
|
|
37278
37449
|
return workerNameToDurableObjectExportsMap;
|
|
@@ -37468,7 +37639,7 @@ function assertIsPreview(ctx) {
|
|
|
37468
37639
|
}
|
|
37469
37640
|
|
|
37470
37641
|
//#endregion
|
|
37471
|
-
//#region ../config/dist/public-
|
|
37642
|
+
//#region ../config/dist/public-CFHebTo4.mjs
|
|
37472
37643
|
const CONFIG = Symbol.for("@cloudflare/config:worker-config");
|
|
37473
37644
|
async function resolveWorkerDefinition(def, ctx) {
|
|
37474
37645
|
const raw = typeof def === "object" && def !== null && CONFIG in def ? def[CONFIG] : def;
|
|
@@ -37826,11 +37997,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
37826
37997
|
for (let i$1 = startIndex; i$1 < x.issues.length; i$1++) if (x.issues[i$1]?.continue === false) return true;
|
|
37827
37998
|
return false;
|
|
37828
37999
|
}
|
|
37829
|
-
function prefixIssues(path, issues) {
|
|
38000
|
+
function prefixIssues(path$1, issues) {
|
|
37830
38001
|
return issues.map((iss) => {
|
|
37831
38002
|
var _a$2;
|
|
37832
38003
|
(_a$2 = iss).path ?? (_a$2.path = []);
|
|
37833
|
-
iss.path.unshift(path);
|
|
38004
|
+
iss.path.unshift(path$1);
|
|
37834
38005
|
return iss;
|
|
37835
38006
|
});
|
|
37836
38007
|
}
|
|
@@ -37895,12 +38066,12 @@ function flattenError(error, mapper = (issue$1) => issue$1.message) {
|
|
|
37895
38066
|
}
|
|
37896
38067
|
function formatError(error, mapper = (issue$1) => issue$1.message) {
|
|
37897
38068
|
const fieldErrors = { _errors: [] };
|
|
37898
|
-
const processError = (error$1, path = []) => {
|
|
37899
|
-
for (const issue$1 of error$1.issues) if (issue$1.code === "invalid_union" && issue$1.errors.length) issue$1.errors.map((issues) => processError({ issues }, [...path, ...issue$1.path]));
|
|
37900
|
-
else if (issue$1.code === "invalid_key") processError({ issues: issue$1.issues }, [...path, ...issue$1.path]);
|
|
37901
|
-
else if (issue$1.code === "invalid_element") processError({ issues: issue$1.issues }, [...path, ...issue$1.path]);
|
|
38069
|
+
const processError = (error$1, path$1 = []) => {
|
|
38070
|
+
for (const issue$1 of error$1.issues) if (issue$1.code === "invalid_union" && issue$1.errors.length) issue$1.errors.map((issues) => processError({ issues }, [...path$1, ...issue$1.path]));
|
|
38071
|
+
else if (issue$1.code === "invalid_key") processError({ issues: issue$1.issues }, [...path$1, ...issue$1.path]);
|
|
38072
|
+
else if (issue$1.code === "invalid_element") processError({ issues: issue$1.issues }, [...path$1, ...issue$1.path]);
|
|
37902
38073
|
else {
|
|
37903
|
-
const fullpath = [...path, ...issue$1.path];
|
|
38074
|
+
const fullpath = [...path$1, ...issue$1.path];
|
|
37904
38075
|
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue$1));
|
|
37905
38076
|
else {
|
|
37906
38077
|
let curr = fieldErrors;
|
|
@@ -41975,6 +42146,16 @@ var __name = (target$1, value) => __defProp(target$1, "name", {
|
|
|
41975
42146
|
value,
|
|
41976
42147
|
configurable: true
|
|
41977
42148
|
});
|
|
42149
|
+
function partitionExports(exports$2) {
|
|
42150
|
+
const partitioned = {
|
|
42151
|
+
"durable-object": {},
|
|
42152
|
+
worker: {}
|
|
42153
|
+
};
|
|
42154
|
+
if (exports$2 === void 0) return partitioned;
|
|
42155
|
+
for (const [name, entry] of Object.entries(exports$2)) partitioned[entry.type][name] = entry;
|
|
42156
|
+
return partitioned;
|
|
42157
|
+
}
|
|
42158
|
+
__name(partitionExports, "partitionExports");
|
|
41978
42159
|
var UserError$1 = class extends Error {
|
|
41979
42160
|
static {
|
|
41980
42161
|
__name(this, "UserError");
|
|
@@ -43968,6 +44149,12 @@ var ParseError = class extends UserError$1 {
|
|
|
43968
44149
|
#status;
|
|
43969
44150
|
code;
|
|
43970
44151
|
accountTag;
|
|
44152
|
+
/**
|
|
44153
|
+
* Optional structured metadata hoisted from the first `FetchError.meta`
|
|
44154
|
+
* on the v4 response envelope. Consumers can inspect this to render
|
|
44155
|
+
* endpoint-specific structured error payloads.
|
|
44156
|
+
*/
|
|
44157
|
+
meta;
|
|
43971
44158
|
constructor({ status,...rest }) {
|
|
43972
44159
|
super(rest);
|
|
43973
44160
|
this.name = this.constructor.name;
|
|
@@ -44308,7 +44495,7 @@ function resolveWranglerConfigPath({ config: config$1, script }, options) {
|
|
|
44308
44495
|
deployConfigPath: void 0,
|
|
44309
44496
|
redirected: false
|
|
44310
44497
|
};
|
|
44311
|
-
return findWranglerConfig$1(script !== void 0 ?
|
|
44498
|
+
return findWranglerConfig$1(script !== void 0 ? path.dirname(script) : process.cwd(), options);
|
|
44312
44499
|
}
|
|
44313
44500
|
__name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
44314
44501
|
function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -44339,15 +44526,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
44339
44526
|
const deployConfigFile = readFileSync$1(deployConfigPath);
|
|
44340
44527
|
try {
|
|
44341
44528
|
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
44342
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
44529
|
+
redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
|
|
44343
44530
|
} catch (e) {
|
|
44344
|
-
throw new UserError$1(`Failed to parse the deploy configuration file at ${
|
|
44531
|
+
throw new UserError$1(`Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`, {
|
|
44345
44532
|
cause: e,
|
|
44346
44533
|
telemetryMessage: false
|
|
44347
44534
|
});
|
|
44348
44535
|
}
|
|
44349
44536
|
if (!redirectedConfigPath) throw new UserError$1(esm_default`
|
|
44350
|
-
A deploy configuration file was found at "${
|
|
44537
|
+
A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
|
|
44351
44538
|
But this is not valid - the required "configPath" property was not found.
|
|
44352
44539
|
Instead this file contains:
|
|
44353
44540
|
\`\`\`
|
|
@@ -44355,13 +44542,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
44355
44542
|
\`\`\`
|
|
44356
44543
|
`, { telemetryMessage: false });
|
|
44357
44544
|
if (!existsSync(redirectedConfigPath)) throw new UserError$1(esm_default`
|
|
44358
|
-
There is a deploy configuration at "${
|
|
44359
|
-
But the redirected configuration path it points to, "${
|
|
44545
|
+
There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
|
|
44546
|
+
But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
|
|
44360
44547
|
`, { telemetryMessage: false });
|
|
44361
44548
|
if (userConfigPath) {
|
|
44362
|
-
if (
|
|
44363
|
-
Found both a user configuration file at "${
|
|
44364
|
-
and a deploy configuration file at "${
|
|
44549
|
+
if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError$1(esm_default`
|
|
44550
|
+
Found both a user configuration file at "${path.relative(".", userConfigPath)}"
|
|
44551
|
+
and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
|
|
44365
44552
|
But these do not share the same base path so it is not clear which should be used.
|
|
44366
44553
|
`, { telemetryMessage: false });
|
|
44367
44554
|
}
|
|
@@ -44703,7 +44890,10 @@ const BindingSchema = unknown().transform((value, ctx) => {
|
|
|
44703
44890
|
function isParsedUnsafeBinding(binding) {
|
|
44704
44891
|
return binding.type.startsWith("unsafe:");
|
|
44705
44892
|
}
|
|
44706
|
-
const CacheSchema = strictObject({
|
|
44893
|
+
const CacheSchema = strictObject({
|
|
44894
|
+
enabled: boolean(),
|
|
44895
|
+
crossVersionCache: boolean().optional()
|
|
44896
|
+
});
|
|
44707
44897
|
/**
|
|
44708
44898
|
* Binding types that can only be defined once per worker.
|
|
44709
44899
|
*/
|
|
@@ -44733,10 +44923,37 @@ const EnvSchema = record(string(), BindingSchema).superRefine((env$1, ctx) => {
|
|
|
44733
44923
|
message: `${listFormatter.format([...duplicates].sort())} bindings can only be defined once`
|
|
44734
44924
|
});
|
|
44735
44925
|
}).optional();
|
|
44736
|
-
const ExportSchema =
|
|
44737
|
-
|
|
44738
|
-
|
|
44739
|
-
|
|
44926
|
+
const ExportSchema = union([
|
|
44927
|
+
strictObject({
|
|
44928
|
+
type: literal$1("durable-object"),
|
|
44929
|
+
state: literal$1("created").optional(),
|
|
44930
|
+
storage: _enum(["sqlite", "legacy-kv"])
|
|
44931
|
+
}),
|
|
44932
|
+
strictObject({
|
|
44933
|
+
type: literal$1("durable-object"),
|
|
44934
|
+
state: literal$1("deleted")
|
|
44935
|
+
}),
|
|
44936
|
+
strictObject({
|
|
44937
|
+
type: literal$1("durable-object"),
|
|
44938
|
+
state: literal$1("renamed"),
|
|
44939
|
+
renamedTo: string()
|
|
44940
|
+
}),
|
|
44941
|
+
strictObject({
|
|
44942
|
+
type: literal$1("durable-object"),
|
|
44943
|
+
state: literal$1("transferred"),
|
|
44944
|
+
transferredTo: string()
|
|
44945
|
+
}),
|
|
44946
|
+
strictObject({
|
|
44947
|
+
type: literal$1("durable-object"),
|
|
44948
|
+
state: literal$1("expecting-transfer"),
|
|
44949
|
+
storage: _enum(["sqlite", "legacy-kv"]),
|
|
44950
|
+
transferFrom: string()
|
|
44951
|
+
}),
|
|
44952
|
+
strictObject({
|
|
44953
|
+
type: literal$1("worker"),
|
|
44954
|
+
cache: strictObject({ enabled: boolean() }).optional()
|
|
44955
|
+
})
|
|
44956
|
+
]);
|
|
44740
44957
|
const LimitsSchema = strictObject({
|
|
44741
44958
|
cpuMs: number().optional(),
|
|
44742
44959
|
subrequests: number().optional()
|
|
@@ -44979,7 +45196,11 @@ function convertTopLevel(config$1, result) {
|
|
|
44979
45196
|
result.limits = limits;
|
|
44980
45197
|
}
|
|
44981
45198
|
if (config$1.observability !== void 0) result.observability = convertObservability(config$1.observability);
|
|
44982
|
-
if (config$1.cache !== void 0)
|
|
45199
|
+
if (config$1.cache !== void 0) {
|
|
45200
|
+
const cache$2 = { enabled: config$1.cache.enabled };
|
|
45201
|
+
if (config$1.cache.crossVersionCache !== void 0) cache$2.cross_version_cache = config$1.cache.crossVersionCache;
|
|
45202
|
+
result.cache = cache$2;
|
|
45203
|
+
}
|
|
44983
45204
|
if (config$1.unsafe !== void 0) result.unsafe = convertUnsafeTopLevel(config$1.unsafe);
|
|
44984
45205
|
}
|
|
44985
45206
|
function convertObservability(observability) {
|
|
@@ -45336,10 +45557,60 @@ function convertBindingsAndAssets(config$1, result) {
|
|
|
45336
45557
|
result.assets = assets;
|
|
45337
45558
|
}
|
|
45338
45559
|
}
|
|
45339
|
-
function convertExports(config$1,
|
|
45560
|
+
function convertExports(config$1, result) {
|
|
45340
45561
|
const exports$2 = config$1.exports;
|
|
45341
45562
|
if (!exports$2) return;
|
|
45342
|
-
|
|
45563
|
+
const converted = {};
|
|
45564
|
+
const unknownExports = {};
|
|
45565
|
+
for (const [exportName, value] of Object.entries(exports$2)) {
|
|
45566
|
+
if (value.type === "worker") {
|
|
45567
|
+
converted[exportName] = value;
|
|
45568
|
+
continue;
|
|
45569
|
+
}
|
|
45570
|
+
if (value.type !== "durable-object") {
|
|
45571
|
+
unknownExports[exportName] = value;
|
|
45572
|
+
continue;
|
|
45573
|
+
}
|
|
45574
|
+
switch (value.state) {
|
|
45575
|
+
case void 0:
|
|
45576
|
+
case "created":
|
|
45577
|
+
converted[exportName] = {
|
|
45578
|
+
type: "durable-object",
|
|
45579
|
+
storage: value.storage
|
|
45580
|
+
};
|
|
45581
|
+
break;
|
|
45582
|
+
case "deleted":
|
|
45583
|
+
converted[exportName] = {
|
|
45584
|
+
type: "durable-object",
|
|
45585
|
+
state: "deleted"
|
|
45586
|
+
};
|
|
45587
|
+
break;
|
|
45588
|
+
case "renamed":
|
|
45589
|
+
converted[exportName] = {
|
|
45590
|
+
type: "durable-object",
|
|
45591
|
+
state: "renamed",
|
|
45592
|
+
renamed_to: value.renamedTo
|
|
45593
|
+
};
|
|
45594
|
+
break;
|
|
45595
|
+
case "transferred":
|
|
45596
|
+
converted[exportName] = {
|
|
45597
|
+
type: "durable-object",
|
|
45598
|
+
state: "transferred",
|
|
45599
|
+
transferred_to: value.transferredTo
|
|
45600
|
+
};
|
|
45601
|
+
break;
|
|
45602
|
+
case "expecting-transfer":
|
|
45603
|
+
converted[exportName] = {
|
|
45604
|
+
type: "durable-object",
|
|
45605
|
+
state: "expecting-transfer",
|
|
45606
|
+
storage: value.storage,
|
|
45607
|
+
transfer_from: value.transferFrom
|
|
45608
|
+
};
|
|
45609
|
+
break;
|
|
45610
|
+
}
|
|
45611
|
+
}
|
|
45612
|
+
if (Object.keys(unknownExports).length > 0) throw new UserError$1("Unknown export types found: " + Object.entries(unknownExports).map(([exportName, { type }]) => `- ${exportName} : ${type}`).join("\n"), { telemetryMessage: "Unknown export types found" });
|
|
45613
|
+
if (Object.keys(converted).length > 0) result.exports = converted;
|
|
45343
45614
|
}
|
|
45344
45615
|
function convertTriggers(config$1, result) {
|
|
45345
45616
|
const triggers$1 = config$1.triggers;
|
|
@@ -50813,15 +51084,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
50813
51084
|
function withTrailingSlash$1(input = "", respectQueryAndFragment) {
|
|
50814
51085
|
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
|
|
50815
51086
|
if (hasTrailingSlash(input, true)) return input || "/";
|
|
50816
|
-
let path = input;
|
|
51087
|
+
let path$1 = input;
|
|
50817
51088
|
let fragment = "";
|
|
50818
51089
|
const fragmentIndex = input.indexOf("#");
|
|
50819
51090
|
if (fragmentIndex >= 0) {
|
|
50820
|
-
path = input.slice(0, fragmentIndex);
|
|
51091
|
+
path$1 = input.slice(0, fragmentIndex);
|
|
50821
51092
|
fragment = input.slice(fragmentIndex);
|
|
50822
|
-
if (!path) return fragment;
|
|
51093
|
+
if (!path$1) return fragment;
|
|
50823
51094
|
}
|
|
50824
|
-
const [s0, ...s] = path.split("?");
|
|
51095
|
+
const [s0, ...s] = path$1.split("?");
|
|
50825
51096
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
50826
51097
|
}
|
|
50827
51098
|
function isNonEmptyURL(url) {
|
|
@@ -50847,8 +51118,8 @@ const isAbsolute$2 = function(p$1) {
|
|
|
50847
51118
|
//#endregion
|
|
50848
51119
|
//#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
|
|
50849
51120
|
const BUILTIN_MODULES = new Set(builtinModules);
|
|
50850
|
-
function normalizeSlash(path) {
|
|
50851
|
-
return path.replace(/\\/g, "/");
|
|
51121
|
+
function normalizeSlash(path$1) {
|
|
51122
|
+
return path$1.replace(/\\/g, "/");
|
|
50852
51123
|
}
|
|
50853
51124
|
/**
|
|
50854
51125
|
* @typedef ErrnoExceptionFields
|
|
@@ -50968,8 +51239,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
50968
51239
|
* @param {string} [base]
|
|
50969
51240
|
* @param {string} [message]
|
|
50970
51241
|
*/
|
|
50971
|
-
(path, base, message) => {
|
|
50972
|
-
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
51242
|
+
(path$1, base, message) => {
|
|
51243
|
+
return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
50973
51244
|
},
|
|
50974
51245
|
Error
|
|
50975
51246
|
);
|
|
@@ -50999,8 +51270,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
50999
51270
|
* @param {string} base
|
|
51000
51271
|
* @param {boolean} [exactUrl]
|
|
51001
51272
|
*/
|
|
51002
|
-
(path, base, exactUrl = false) => {
|
|
51003
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
|
|
51273
|
+
(path$1, base, exactUrl = false) => {
|
|
51274
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`;
|
|
51004
51275
|
},
|
|
51005
51276
|
Error
|
|
51006
51277
|
);
|
|
@@ -51038,8 +51309,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
51038
51309
|
* @param {string} extension
|
|
51039
51310
|
* @param {string} path
|
|
51040
51311
|
*/
|
|
51041
|
-
(extension, path) => {
|
|
51042
|
-
return `Unknown file extension "${extension}" for ${path}`;
|
|
51312
|
+
(extension, path$1) => {
|
|
51313
|
+
return `Unknown file extension "${extension}" for ${path$1}`;
|
|
51043
51314
|
},
|
|
51044
51315
|
TypeError
|
|
51045
51316
|
);
|
|
@@ -51196,7 +51467,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
51196
51467
|
/** @type {string | undefined} */
|
|
51197
51468
|
let string$2;
|
|
51198
51469
|
try {
|
|
51199
|
-
string$2 = fs2.readFileSync(
|
|
51470
|
+
string$2 = fs2.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
|
|
51200
51471
|
} catch (error) {
|
|
51201
51472
|
const exception = error;
|
|
51202
51473
|
if (exception.code !== "ENOENT") throw exception;
|
|
@@ -51402,15 +51673,15 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
51402
51673
|
const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
|
|
51403
51674
|
const basePath = fileURLToPath(base);
|
|
51404
51675
|
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");
|
|
51405
|
-
else if (
|
|
51676
|
+
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");
|
|
51406
51677
|
}
|
|
51407
51678
|
/**
|
|
51408
51679
|
* @param {string} path
|
|
51409
51680
|
* @returns {Stats | undefined}
|
|
51410
51681
|
*/
|
|
51411
|
-
function tryStatSync(path) {
|
|
51682
|
+
function tryStatSync(path$1) {
|
|
51412
51683
|
try {
|
|
51413
|
-
return statSync(path);
|
|
51684
|
+
return statSync(path$1);
|
|
51414
51685
|
} catch {}
|
|
51415
51686
|
}
|
|
51416
51687
|
/**
|
|
@@ -51509,7 +51780,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
51509
51780
|
{
|
|
51510
51781
|
const real = realpathSync(filePath);
|
|
51511
51782
|
const { search, hash } = resolved;
|
|
51512
|
-
resolved = pathToFileURL(real + (filePath.endsWith(
|
|
51783
|
+
resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : ""));
|
|
51513
51784
|
resolved.search = search;
|
|
51514
51785
|
resolved.hash = hash;
|
|
51515
51786
|
}
|
|
@@ -54299,9 +54570,9 @@ function constructHeaders({ headers, headersFile, logger }) {
|
|
|
54299
54570
|
|
|
54300
54571
|
//#endregion
|
|
54301
54572
|
//#region ../workers-shared/utils/configuration/validateURL.ts
|
|
54302
|
-
const extractPathname = (path = "/", includeSearch, includeHash) => {
|
|
54303
|
-
if (!path.startsWith("/")) path = `/${path}`;
|
|
54304
|
-
const url = new URL(`//${path}`, "relative://");
|
|
54573
|
+
const extractPathname = (path$1 = "/", includeSearch, includeHash) => {
|
|
54574
|
+
if (!path$1.startsWith("/")) path$1 = `/${path$1}`;
|
|
54575
|
+
const url = new URL(`//${path$1}`, "relative://");
|
|
54305
54576
|
return `${url.pathname}${includeSearch ? url.search : ""}${includeHash ? url.hash : ""}`;
|
|
54306
54577
|
};
|
|
54307
54578
|
const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
|
|
@@ -54360,7 +54631,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
54360
54631
|
lineNumber: i$1 + 1,
|
|
54361
54632
|
message: "No headers specified"
|
|
54362
54633
|
});
|
|
54363
|
-
const [path, pathError] = validateUrl(line, false, true);
|
|
54634
|
+
const [path$1, pathError] = validateUrl(line, false, true);
|
|
54364
54635
|
if (pathError) {
|
|
54365
54636
|
invalid.push({
|
|
54366
54637
|
line,
|
|
@@ -54371,7 +54642,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
54371
54642
|
skipUntilNextPath = true;
|
|
54372
54643
|
continue;
|
|
54373
54644
|
}
|
|
54374
|
-
const wildcardError = validateNoMultipleWildcards(path);
|
|
54645
|
+
const wildcardError = validateNoMultipleWildcards(path$1);
|
|
54375
54646
|
if (wildcardError) {
|
|
54376
54647
|
invalid.push({
|
|
54377
54648
|
line,
|
|
@@ -54383,7 +54654,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
54383
54654
|
continue;
|
|
54384
54655
|
}
|
|
54385
54656
|
rule = {
|
|
54386
|
-
path,
|
|
54657
|
+
path: path$1,
|
|
54387
54658
|
line,
|
|
54388
54659
|
headers: {},
|
|
54389
54660
|
unsetHeaders: []
|
|
@@ -54466,11 +54737,11 @@ function isValidRule(rule) {
|
|
|
54466
54737
|
* `:splat` placeholder, would result in duplicate `:splat` parameters which is
|
|
54467
54738
|
* unsupported.
|
|
54468
54739
|
*/
|
|
54469
|
-
function validateNoMultipleWildcards(path) {
|
|
54470
|
-
const wildcardCount = (path.match(SPLAT_REGEX) ?? []).length;
|
|
54471
|
-
const hasSplatPlaceholder = /:splat(?!\w)/.test(path);
|
|
54472
|
-
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path}.`;
|
|
54473
|
-
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path}.`;
|
|
54740
|
+
function validateNoMultipleWildcards(path$1) {
|
|
54741
|
+
const wildcardCount = (path$1.match(SPLAT_REGEX) ?? []).length;
|
|
54742
|
+
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$1);
|
|
54743
|
+
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$1}.`;
|
|
54744
|
+
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$1}.`;
|
|
54474
54745
|
}
|
|
54475
54746
|
|
|
54476
54747
|
//#endregion
|
|
@@ -54687,13 +54958,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
54687
54958
|
const throwError = (message, Ctor) => {
|
|
54688
54959
|
throw new Ctor(message);
|
|
54689
54960
|
};
|
|
54690
|
-
const checkPath = (path, originalPath, doThrow) => {
|
|
54691
|
-
if (!isString$1(path)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
54692
|
-
if (!path) return doThrow(`path must not be empty`, TypeError);
|
|
54693
|
-
if (checkPath.isNotRelative(path)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
|
|
54961
|
+
const checkPath = (path$1, originalPath, doThrow) => {
|
|
54962
|
+
if (!isString$1(path$1)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
54963
|
+
if (!path$1) return doThrow(`path must not be empty`, TypeError);
|
|
54964
|
+
if (checkPath.isNotRelative(path$1)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
|
|
54694
54965
|
return true;
|
|
54695
54966
|
};
|
|
54696
|
-
const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
|
|
54967
|
+
const isNotRelative = (path$1) => REGEX_TEST_INVALID_PATH.test(path$1);
|
|
54697
54968
|
checkPath.isNotRelative = isNotRelative;
|
|
54698
54969
|
checkPath.convert = (p$1) => p$1;
|
|
54699
54970
|
var Ignore = class {
|
|
@@ -54729,13 +55000,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
54729
55000
|
addPattern(pattern) {
|
|
54730
55001
|
return this.add(pattern);
|
|
54731
55002
|
}
|
|
54732
|
-
_testOne(path, checkUnignored) {
|
|
55003
|
+
_testOne(path$1, checkUnignored) {
|
|
54733
55004
|
let ignored = false;
|
|
54734
55005
|
let unignored = false;
|
|
54735
55006
|
this._rules.forEach((rule) => {
|
|
54736
55007
|
const { negative } = rule;
|
|
54737
55008
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
|
|
54738
|
-
if (rule.regex.test(path)) {
|
|
55009
|
+
if (rule.regex.test(path$1)) {
|
|
54739
55010
|
ignored = !negative;
|
|
54740
55011
|
unignored = negative;
|
|
54741
55012
|
}
|
|
@@ -54746,33 +55017,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
54746
55017
|
};
|
|
54747
55018
|
}
|
|
54748
55019
|
_test(originalPath, cache$2, checkUnignored, slices) {
|
|
54749
|
-
const path = originalPath && checkPath.convert(originalPath);
|
|
54750
|
-
checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
54751
|
-
return this._t(path, cache$2, checkUnignored, slices);
|
|
55020
|
+
const path$1 = originalPath && checkPath.convert(originalPath);
|
|
55021
|
+
checkPath(path$1, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
55022
|
+
return this._t(path$1, cache$2, checkUnignored, slices);
|
|
54752
55023
|
}
|
|
54753
|
-
_t(path, cache$2, checkUnignored, slices) {
|
|
54754
|
-
if (path in cache$2) return cache$2[path];
|
|
54755
|
-
if (!slices) slices = path.split(SLASH);
|
|
55024
|
+
_t(path$1, cache$2, checkUnignored, slices) {
|
|
55025
|
+
if (path$1 in cache$2) return cache$2[path$1];
|
|
55026
|
+
if (!slices) slices = path$1.split(SLASH);
|
|
54756
55027
|
slices.pop();
|
|
54757
|
-
if (!slices.length) return cache$2[path] = this._testOne(path, checkUnignored);
|
|
55028
|
+
if (!slices.length) return cache$2[path$1] = this._testOne(path$1, checkUnignored);
|
|
54758
55029
|
const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
|
|
54759
|
-
return cache$2[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
|
|
55030
|
+
return cache$2[path$1] = parent.ignored ? parent : this._testOne(path$1, checkUnignored);
|
|
54760
55031
|
}
|
|
54761
|
-
ignores(path) {
|
|
54762
|
-
return this._test(path, this._ignoreCache, false).ignored;
|
|
55032
|
+
ignores(path$1) {
|
|
55033
|
+
return this._test(path$1, this._ignoreCache, false).ignored;
|
|
54763
55034
|
}
|
|
54764
55035
|
createFilter() {
|
|
54765
|
-
return (path) => !this.ignores(path);
|
|
55036
|
+
return (path$1) => !this.ignores(path$1);
|
|
54766
55037
|
}
|
|
54767
55038
|
filter(paths) {
|
|
54768
55039
|
return makeArray(paths).filter(this.createFilter());
|
|
54769
55040
|
}
|
|
54770
|
-
test(path) {
|
|
54771
|
-
return this._test(path, this._testCache, true);
|
|
55041
|
+
test(path$1) {
|
|
55042
|
+
return this._test(path$1, this._testCache, true);
|
|
54772
55043
|
}
|
|
54773
55044
|
};
|
|
54774
55045
|
const factory = (options) => new Ignore(options);
|
|
54775
|
-
const isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
|
|
55046
|
+
const isPathValid = (path$1) => checkPath(path$1 && checkPath.convert(path$1), path$1, RETURN_FALSE);
|
|
54776
55047
|
factory.isPathValid = isPathValid;
|
|
54777
55048
|
factory.default = factory;
|
|
54778
55049
|
module.exports = factory;
|
|
@@ -54781,7 +55052,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
54781
55052
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
54782
55053
|
checkPath.convert = makePosix;
|
|
54783
55054
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
54784
|
-
checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
|
|
55055
|
+
checkPath.isNotRelative = (path$1) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$1) || isNotRelative(path$1);
|
|
54785
55056
|
}
|
|
54786
55057
|
}) });
|
|
54787
55058
|
|
|
@@ -56136,11 +56407,11 @@ var Mime = class {
|
|
|
56136
56407
|
}
|
|
56137
56408
|
return this;
|
|
56138
56409
|
}
|
|
56139
|
-
getType(path) {
|
|
56140
|
-
if (typeof path !== "string") return null;
|
|
56141
|
-
const last = path.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
56410
|
+
getType(path$1) {
|
|
56411
|
+
if (typeof path$1 !== "string") return null;
|
|
56412
|
+
const last = path$1.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
56142
56413
|
const ext = last.replace(/^.*\./s, "").toLowerCase();
|
|
56143
|
-
const hasPath = last.length < path.length;
|
|
56414
|
+
const hasPath = last.length < path$1.length;
|
|
56144
56415
|
if (!(ext.length < last.length - 1) && hasPath) return null;
|
|
56145
56416
|
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
56146
56417
|
}
|
|
@@ -56474,8 +56745,8 @@ function getErrorMap() {
|
|
|
56474
56745
|
//#endregion
|
|
56475
56746
|
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
56476
56747
|
const makeIssue = (params) => {
|
|
56477
|
-
const { data: data$1, path, errorMaps, issueData } = params;
|
|
56478
|
-
const fullPath = [...path, ...issueData.path || []];
|
|
56748
|
+
const { data: data$1, path: path$1, errorMaps, issueData } = params;
|
|
56749
|
+
const fullPath = [...path$1, ...issueData.path || []];
|
|
56479
56750
|
const fullIssue = {
|
|
56480
56751
|
...issueData,
|
|
56481
56752
|
path: fullPath
|
|
@@ -56587,11 +56858,11 @@ var errorUtil;
|
|
|
56587
56858
|
//#endregion
|
|
56588
56859
|
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
56589
56860
|
var ParseInputLazyPath = class {
|
|
56590
|
-
constructor(parent, value, path, key) {
|
|
56861
|
+
constructor(parent, value, path$1, key) {
|
|
56591
56862
|
this._cachedPath = [];
|
|
56592
56863
|
this.parent = parent;
|
|
56593
56864
|
this.data = value;
|
|
56594
|
-
this._path = path;
|
|
56865
|
+
this._path = path$1;
|
|
56595
56866
|
this._key = key;
|
|
56596
56867
|
}
|
|
56597
56868
|
get path() {
|
|
@@ -60466,11 +60737,11 @@ const getQueryString = (params) => {
|
|
|
60466
60737
|
};
|
|
60467
60738
|
const getUrl = (config$1, options) => {
|
|
60468
60739
|
const encoder$1 = config$1.ENCODE_PATH || encodeURI;
|
|
60469
|
-
const path = options.url.replace("{api-version}", config$1.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
60740
|
+
const path$1 = options.url.replace("{api-version}", config$1.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
60470
60741
|
if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
|
|
60471
60742
|
return substring;
|
|
60472
60743
|
});
|
|
60473
|
-
const url = `${config$1.BASE}${path}`;
|
|
60744
|
+
const url = `${config$1.BASE}${path$1}`;
|
|
60474
60745
|
if (options.query) return `${url}${getQueryString(options.query)}`;
|
|
60475
60746
|
return url;
|
|
60476
60747
|
};
|
|
@@ -61012,144 +61283,6 @@ var ImageRegistriesService = class {
|
|
|
61012
61283
|
}
|
|
61013
61284
|
};
|
|
61014
61285
|
|
|
61015
|
-
//#endregion
|
|
61016
|
-
//#region ../containers-shared/src/build.ts
|
|
61017
|
-
async function constructBuildCommand(options, logger) {
|
|
61018
|
-
const platform$1 = options.platform ?? "linux/amd64";
|
|
61019
|
-
const buildCmd = [
|
|
61020
|
-
"build",
|
|
61021
|
-
"--load",
|
|
61022
|
-
"-t",
|
|
61023
|
-
options.tag,
|
|
61024
|
-
"--platform",
|
|
61025
|
-
platform$1,
|
|
61026
|
-
"--provenance=false"
|
|
61027
|
-
];
|
|
61028
|
-
if (options.args) for (const arg in options.args) buildCmd.push("--build-arg", `${arg}=${options.args[arg]}`);
|
|
61029
|
-
if (options.setNetworkToHost) buildCmd.push("--network", "host");
|
|
61030
|
-
const dockerfile = readFileSync(options.pathToDockerfile, "utf-8");
|
|
61031
|
-
buildCmd.push("-f", "-");
|
|
61032
|
-
buildCmd.push(options.buildContext);
|
|
61033
|
-
logger?.debug(`Building image with command: ${buildCmd.join(" ")}`);
|
|
61034
|
-
return {
|
|
61035
|
-
buildCmd,
|
|
61036
|
-
dockerfile
|
|
61037
|
-
};
|
|
61038
|
-
}
|
|
61039
|
-
function dockerBuild(dockerPath, options) {
|
|
61040
|
-
let errorHandled = false;
|
|
61041
|
-
let resolve$4;
|
|
61042
|
-
let reject;
|
|
61043
|
-
const ready = new Promise((res, rej) => {
|
|
61044
|
-
resolve$4 = res;
|
|
61045
|
-
reject = rej;
|
|
61046
|
-
});
|
|
61047
|
-
const child = spawn(dockerPath, options.buildCmd, {
|
|
61048
|
-
stdio: [
|
|
61049
|
-
"pipe",
|
|
61050
|
-
"inherit",
|
|
61051
|
-
"inherit"
|
|
61052
|
-
],
|
|
61053
|
-
detached: process.platform !== "win32",
|
|
61054
|
-
windowsHide: true
|
|
61055
|
-
});
|
|
61056
|
-
if (child.stdin !== null) {
|
|
61057
|
-
child.stdin.write(options.dockerfile);
|
|
61058
|
-
child.stdin.end();
|
|
61059
|
-
}
|
|
61060
|
-
child.on("exit", (code) => {
|
|
61061
|
-
if (code === 0) resolve$4();
|
|
61062
|
-
else if (!errorHandled) {
|
|
61063
|
-
errorHandled = true;
|
|
61064
|
-
reject(new UserError(`Docker build exited with code: ${code}`, { telemetryMessage: false }));
|
|
61065
|
-
}
|
|
61066
|
-
});
|
|
61067
|
-
child.on("error", (err) => {
|
|
61068
|
-
if (!errorHandled) {
|
|
61069
|
-
errorHandled = true;
|
|
61070
|
-
reject(err);
|
|
61071
|
-
}
|
|
61072
|
-
});
|
|
61073
|
-
return {
|
|
61074
|
-
abort: () => {
|
|
61075
|
-
child.unref();
|
|
61076
|
-
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
61077
|
-
else process.kill(-child.pid);
|
|
61078
|
-
},
|
|
61079
|
-
ready
|
|
61080
|
-
};
|
|
61081
|
-
}
|
|
61082
|
-
async function buildImage(dockerPath, options) {
|
|
61083
|
-
const { buildCmd, dockerfile } = await constructBuildCommand({
|
|
61084
|
-
tag: options.image_tag,
|
|
61085
|
-
pathToDockerfile: options.dockerfile,
|
|
61086
|
-
buildContext: options.image_build_context,
|
|
61087
|
-
args: options.image_vars,
|
|
61088
|
-
platform: "linux/amd64"
|
|
61089
|
-
});
|
|
61090
|
-
return dockerBuild(dockerPath, {
|
|
61091
|
-
buildCmd,
|
|
61092
|
-
dockerfile
|
|
61093
|
-
});
|
|
61094
|
-
}
|
|
61095
|
-
|
|
61096
|
-
//#endregion
|
|
61097
|
-
//#region ../containers-shared/src/login.ts
|
|
61098
|
-
function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https://api.cloudflare.com/client/v4") {
|
|
61099
|
-
OpenAPI.BASE = `${apiBase}/accounts/${accountId}/containers`;
|
|
61100
|
-
OpenAPI.CREDENTIALS = "omit";
|
|
61101
|
-
OpenAPI.HEADERS = {
|
|
61102
|
-
...typeof OpenAPI.HEADERS === "object" ? OpenAPI.HEADERS : {},
|
|
61103
|
-
Authorization: `Bearer ${apiToken}`
|
|
61104
|
-
};
|
|
61105
|
-
}
|
|
61106
|
-
/**
|
|
61107
|
-
* Gets push and pull credentials for a configured image registry
|
|
61108
|
-
* and runs `docker login`, so subsequent image pushes or pulls are
|
|
61109
|
-
* authenticated
|
|
61110
|
-
*/
|
|
61111
|
-
async function dockerLoginImageRegistry(pathToDocker, domain) {
|
|
61112
|
-
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(domain, {
|
|
61113
|
-
expiration_minutes: 15,
|
|
61114
|
-
permissions: [ImageRegistryPermissions.PUSH, ImageRegistryPermissions.PULL]
|
|
61115
|
-
});
|
|
61116
|
-
const child = spawn(pathToDocker, [
|
|
61117
|
-
"login",
|
|
61118
|
-
"--password-stdin",
|
|
61119
|
-
"--username",
|
|
61120
|
-
credentials.username,
|
|
61121
|
-
domain
|
|
61122
|
-
], { stdio: [
|
|
61123
|
-
"pipe",
|
|
61124
|
-
"inherit",
|
|
61125
|
-
"inherit"
|
|
61126
|
-
] }).on("error", (err) => {
|
|
61127
|
-
throw err;
|
|
61128
|
-
});
|
|
61129
|
-
child.stdin.write(credentials.password);
|
|
61130
|
-
child.stdin.end();
|
|
61131
|
-
await new Promise((resolve$4, reject) => {
|
|
61132
|
-
child.on("close", (code) => {
|
|
61133
|
-
if (code === 0) resolve$4();
|
|
61134
|
-
else reject(new UserError(`Login failed with code: ${code}`, { telemetryMessage: false }));
|
|
61135
|
-
});
|
|
61136
|
-
});
|
|
61137
|
-
}
|
|
61138
|
-
|
|
61139
|
-
//#endregion
|
|
61140
|
-
//#region ../containers-shared/src/registry.ts
|
|
61141
|
-
const MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
|
|
61142
|
-
|
|
61143
|
-
//#endregion
|
|
61144
|
-
//#region ../containers-shared/src/knobs.ts
|
|
61145
|
-
const getCloudflareContainerRegistry = () => {
|
|
61146
|
-
return process.env.CLOUDFLARE_CONTAINER_REGISTRY ?? (process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging.registry.cloudflare.com" : "registry.cloudflare.com");
|
|
61147
|
-
};
|
|
61148
|
-
/** Prefixes with the cloudflare-dev namespace. The name should be the container's DO classname, and the tag a build uuid. */
|
|
61149
|
-
const getDevContainerImageName = (name, tag) => {
|
|
61150
|
-
return `${MF_DEV_CONTAINER_PREFIX}/${name.toLowerCase()}:${tag}`;
|
|
61151
|
-
};
|
|
61152
|
-
|
|
61153
61286
|
//#endregion
|
|
61154
61287
|
//#region ../containers-shared/src/inspect.ts
|
|
61155
61288
|
async function dockerImageInspect(dockerPath, options) {
|
|
@@ -61244,31 +61377,41 @@ const isDockerRunning = async (dockerPath) => {
|
|
|
61244
61377
|
* @throws {UserError} If the Docker CLI cannot be reached.
|
|
61245
61378
|
*
|
|
61246
61379
|
* @param options - Docker verification options.
|
|
61380
|
+
* @param options.dockerPath - Path to the Docker CLI executable.
|
|
61381
|
+
* @param options.operation - Optional human-readable operation description for the error message
|
|
61382
|
+
* headline. When provided, produces "before ${operation}". When omitted, the clause is skipped.
|
|
61383
|
+
* @param options.imageNoun - Noun describing what needs to be built (e.g. "the configured image").
|
|
61384
|
+
* @param options.hint - Optional context-specific hint appended to the error message.
|
|
61247
61385
|
*/
|
|
61248
|
-
const verifyDockerInstalled = async ({ dockerPath,
|
|
61386
|
+
const verifyDockerInstalled = async ({ dockerPath, operation, imageNoun, hint }) => {
|
|
61249
61387
|
if (!await isDockerRunning(dockerPath)) throw new UserError(getFailedToRunDockerErrorMessage({
|
|
61250
|
-
|
|
61251
|
-
|
|
61252
|
-
|
|
61388
|
+
operation,
|
|
61389
|
+
imageNoun,
|
|
61390
|
+
hint
|
|
61253
61391
|
}), { telemetryMessage: false });
|
|
61254
61392
|
};
|
|
61255
61393
|
/**
|
|
61256
61394
|
* Builds the user-facing error message shown when Docker cannot be reached.
|
|
61257
61395
|
*
|
|
61258
|
-
* @param options -
|
|
61396
|
+
* @param options - Options controlling the error message content.
|
|
61397
|
+
* @param options.operation - Optional human-readable operation description for the headline.
|
|
61398
|
+
* @param options.imageNoun - Noun describing what needs to be built.
|
|
61399
|
+
* @param options.hint - Optional context-specific hint paragraph.
|
|
61259
61400
|
*
|
|
61260
61401
|
* @returns The formatted error message string.
|
|
61261
61402
|
*/
|
|
61262
|
-
function getFailedToRunDockerErrorMessage({
|
|
61263
|
-
const headline = `The Docker CLI is needed to build
|
|
61403
|
+
function getFailedToRunDockerErrorMessage({ operation, imageNoun, hint }) {
|
|
61404
|
+
const headline = `The Docker CLI is needed to build ${imageNoun}${operation ? ` before ${operation}` : ""} but could not be launched.`;
|
|
61264
61405
|
let daemonHint;
|
|
61265
61406
|
if (process.platform === "darwin") daemonHint = "open the Docker Desktop app or run `open -a Docker`";
|
|
61266
61407
|
else if (process.platform === "win32") daemonHint = "open the Docker Desktop app";
|
|
61267
61408
|
else daemonHint = "run `sudo systemctl start docker`";
|
|
61268
|
-
|
|
61409
|
+
let message = `${headline}\n${`To fix this, try the following:
|
|
61269
61410
|
- If Docker is not installed, download it from https://docs.docker.com/get-started/get-docker/
|
|
61270
61411
|
- If Docker is installed but the daemon is not running,\n ${daemonHint}.\n - If you use an alternative Docker-compatible CLI (e.g. Podman),
|
|
61271
|
-
set the WRANGLER_DOCKER_BIN environment variable to its path and DOCKER_HOST to its socket.`}\n\nNote: Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so
|
|
61412
|
+
set the WRANGLER_DOCKER_BIN environment variable to its path and DOCKER_HOST to its socket.`}\n\nNote: Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so.`;
|
|
61413
|
+
if (hint) message += `\n\n${hint}`;
|
|
61414
|
+
return message;
|
|
61272
61415
|
}
|
|
61273
61416
|
/**
|
|
61274
61417
|
* Kills and removes any containers which come from the given image tag
|
|
@@ -61390,6 +61533,176 @@ function getImageTag(imageTag) {
|
|
|
61390
61533
|
return tagSeparatorIndex === -1 ? void 0 : imageTag.slice(tagSeparatorIndex + 1);
|
|
61391
61534
|
}
|
|
61392
61535
|
|
|
61536
|
+
//#endregion
|
|
61537
|
+
//#region ../containers-shared/src/build.ts
|
|
61538
|
+
async function constructBuildCommand(options, logger) {
|
|
61539
|
+
const platform$1 = options.platform ?? "linux/amd64";
|
|
61540
|
+
const buildCmd = [
|
|
61541
|
+
"build",
|
|
61542
|
+
"--load",
|
|
61543
|
+
"-t",
|
|
61544
|
+
options.tag,
|
|
61545
|
+
"--platform",
|
|
61546
|
+
platform$1,
|
|
61547
|
+
"--provenance=false"
|
|
61548
|
+
];
|
|
61549
|
+
if (options.args) for (const arg in options.args) buildCmd.push("--build-arg", `${arg}=${options.args[arg]}`);
|
|
61550
|
+
if (options.setNetworkToHost) buildCmd.push("--network", "host");
|
|
61551
|
+
const dockerfile = readFileSync(options.pathToDockerfile, "utf-8");
|
|
61552
|
+
buildCmd.push("-f", "-");
|
|
61553
|
+
buildCmd.push(options.buildContext);
|
|
61554
|
+
logger?.debug(`Building image with command: ${buildCmd.join(" ")}`);
|
|
61555
|
+
return {
|
|
61556
|
+
buildCmd,
|
|
61557
|
+
dockerfile
|
|
61558
|
+
};
|
|
61559
|
+
}
|
|
61560
|
+
/**
|
|
61561
|
+
* Spawns a Docker build process and returns a handle to abort or await the build.
|
|
61562
|
+
*
|
|
61563
|
+
* By default this function first verifies that the Docker daemon is reachable.
|
|
61564
|
+
* Callers that have already performed this check (e.g. the dev and deploy flows)
|
|
61565
|
+
* should pass `verifyDockerIsRunning: false` to avoid a redundant check.
|
|
61566
|
+
*
|
|
61567
|
+
* @param dockerPath - Path to the Docker CLI executable.
|
|
61568
|
+
* @param options - Build options including the command arguments and Dockerfile content.
|
|
61569
|
+
* @param options.buildCmd - The Docker build command arguments.
|
|
61570
|
+
* @param options.dockerfile - The Dockerfile content to pipe into stdin.
|
|
61571
|
+
* @param options.verifyDockerIsRunning - When `true` (the default), verifies Docker is installed
|
|
61572
|
+
* and the daemon is running before spawning the build. Set to `false` to skip the check.
|
|
61573
|
+
*
|
|
61574
|
+
* @returns An object with an `abort` function and a `ready` promise.
|
|
61575
|
+
*/
|
|
61576
|
+
async function dockerBuild(dockerPath, options) {
|
|
61577
|
+
if (options.verifyDockerIsRunning !== false) await verifyDockerInstalled({
|
|
61578
|
+
dockerPath,
|
|
61579
|
+
imageNoun: "the image"
|
|
61580
|
+
});
|
|
61581
|
+
let errorHandled = false;
|
|
61582
|
+
let resolve$4;
|
|
61583
|
+
let reject;
|
|
61584
|
+
const ready = new Promise((res, rej) => {
|
|
61585
|
+
resolve$4 = res;
|
|
61586
|
+
reject = rej;
|
|
61587
|
+
});
|
|
61588
|
+
const child = spawn(dockerPath, options.buildCmd, {
|
|
61589
|
+
stdio: [
|
|
61590
|
+
"pipe",
|
|
61591
|
+
"inherit",
|
|
61592
|
+
"inherit"
|
|
61593
|
+
],
|
|
61594
|
+
detached: process.platform !== "win32",
|
|
61595
|
+
windowsHide: true
|
|
61596
|
+
});
|
|
61597
|
+
if (child.stdin !== null) {
|
|
61598
|
+
child.stdin.write(options.dockerfile);
|
|
61599
|
+
child.stdin.end();
|
|
61600
|
+
}
|
|
61601
|
+
child.on("exit", (code) => {
|
|
61602
|
+
if (code === 0) resolve$4();
|
|
61603
|
+
else if (!errorHandled) {
|
|
61604
|
+
errorHandled = true;
|
|
61605
|
+
reject(new UserError(`Docker build exited with code: ${code}`, { telemetryMessage: false }));
|
|
61606
|
+
}
|
|
61607
|
+
});
|
|
61608
|
+
child.on("error", (err) => {
|
|
61609
|
+
if (!errorHandled) {
|
|
61610
|
+
errorHandled = true;
|
|
61611
|
+
reject(err);
|
|
61612
|
+
}
|
|
61613
|
+
});
|
|
61614
|
+
return {
|
|
61615
|
+
abort: () => {
|
|
61616
|
+
child.unref();
|
|
61617
|
+
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
61618
|
+
else process.kill(-child.pid);
|
|
61619
|
+
},
|
|
61620
|
+
ready
|
|
61621
|
+
};
|
|
61622
|
+
}
|
|
61623
|
+
/**
|
|
61624
|
+
* Builds a container image from the given container dev options.
|
|
61625
|
+
*
|
|
61626
|
+
* @param dockerPath - Path to the Docker CLI executable.
|
|
61627
|
+
* @param options - Container configuration including the Dockerfile path, build context, and image tag.
|
|
61628
|
+
* @param verifyDockerIsRunning - When `true` (the default), verifies Docker is installed
|
|
61629
|
+
* and the daemon is running before building. Set to `false` when the caller has already
|
|
61630
|
+
* performed this check.
|
|
61631
|
+
*
|
|
61632
|
+
* @returns An object with an `abort` function and a `ready` promise.
|
|
61633
|
+
*/
|
|
61634
|
+
async function buildImage(dockerPath, options, verifyDockerIsRunning) {
|
|
61635
|
+
const { buildCmd, dockerfile } = await constructBuildCommand({
|
|
61636
|
+
tag: options.image_tag,
|
|
61637
|
+
pathToDockerfile: options.dockerfile,
|
|
61638
|
+
buildContext: options.image_build_context,
|
|
61639
|
+
args: options.image_vars,
|
|
61640
|
+
platform: "linux/amd64"
|
|
61641
|
+
});
|
|
61642
|
+
return dockerBuild(dockerPath, {
|
|
61643
|
+
buildCmd,
|
|
61644
|
+
dockerfile,
|
|
61645
|
+
verifyDockerIsRunning
|
|
61646
|
+
});
|
|
61647
|
+
}
|
|
61648
|
+
|
|
61649
|
+
//#endregion
|
|
61650
|
+
//#region ../containers-shared/src/login.ts
|
|
61651
|
+
function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https://api.cloudflare.com/client/v4") {
|
|
61652
|
+
OpenAPI.BASE = `${apiBase}/accounts/${accountId}/containers`;
|
|
61653
|
+
OpenAPI.CREDENTIALS = "omit";
|
|
61654
|
+
OpenAPI.HEADERS = {
|
|
61655
|
+
...typeof OpenAPI.HEADERS === "object" ? OpenAPI.HEADERS : {},
|
|
61656
|
+
Authorization: `Bearer ${apiToken}`
|
|
61657
|
+
};
|
|
61658
|
+
}
|
|
61659
|
+
/**
|
|
61660
|
+
* Gets push and pull credentials for a configured image registry
|
|
61661
|
+
* and runs `docker login`, so subsequent image pushes or pulls are
|
|
61662
|
+
* authenticated
|
|
61663
|
+
*/
|
|
61664
|
+
async function dockerLoginImageRegistry(pathToDocker, domain) {
|
|
61665
|
+
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(domain, {
|
|
61666
|
+
expiration_minutes: 15,
|
|
61667
|
+
permissions: [ImageRegistryPermissions.PUSH, ImageRegistryPermissions.PULL]
|
|
61668
|
+
});
|
|
61669
|
+
const child = spawn(pathToDocker, [
|
|
61670
|
+
"login",
|
|
61671
|
+
"--password-stdin",
|
|
61672
|
+
"--username",
|
|
61673
|
+
credentials.username,
|
|
61674
|
+
domain
|
|
61675
|
+
], { stdio: [
|
|
61676
|
+
"pipe",
|
|
61677
|
+
"inherit",
|
|
61678
|
+
"inherit"
|
|
61679
|
+
] }).on("error", (err) => {
|
|
61680
|
+
throw err;
|
|
61681
|
+
});
|
|
61682
|
+
child.stdin.write(credentials.password);
|
|
61683
|
+
child.stdin.end();
|
|
61684
|
+
await new Promise((resolve$4, reject) => {
|
|
61685
|
+
child.on("close", (code) => {
|
|
61686
|
+
if (code === 0) resolve$4();
|
|
61687
|
+
else reject(new UserError(`Login failed with code: ${code}`, { telemetryMessage: false }));
|
|
61688
|
+
});
|
|
61689
|
+
});
|
|
61690
|
+
}
|
|
61691
|
+
|
|
61692
|
+
//#endregion
|
|
61693
|
+
//#region ../containers-shared/src/registry.ts
|
|
61694
|
+
const MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
|
|
61695
|
+
|
|
61696
|
+
//#endregion
|
|
61697
|
+
//#region ../containers-shared/src/knobs.ts
|
|
61698
|
+
const getCloudflareContainerRegistry = () => {
|
|
61699
|
+
return process.env.CLOUDFLARE_CONTAINER_REGISTRY ?? (process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging.registry.cloudflare.com" : "registry.cloudflare.com");
|
|
61700
|
+
};
|
|
61701
|
+
/** Prefixes with the cloudflare-dev namespace. The name should be the container's DO classname, and the tag a build uuid. */
|
|
61702
|
+
const getDevContainerImageName = (name, tag) => {
|
|
61703
|
+
return `${MF_DEV_CONTAINER_PREFIX}/${name.toLowerCase()}:${tag}`;
|
|
61704
|
+
};
|
|
61705
|
+
|
|
61393
61706
|
//#endregion
|
|
61394
61707
|
//#region ../containers-shared/src/images.ts
|
|
61395
61708
|
const DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:3cb1195@sha256:0ef6716c52430096900b150d84a3302057d6cd2319dae7987128c85d0733e3c8";
|
|
@@ -61450,11 +61763,13 @@ async function prepareContainerImagesForDev(args) {
|
|
|
61450
61763
|
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 });
|
|
61451
61764
|
await verifyDockerInstalled({
|
|
61452
61765
|
dockerPath,
|
|
61453
|
-
|
|
61766
|
+
operation: "running dev",
|
|
61767
|
+
imageNoun: containerOptions.length !== 1 ? "the configured images" : "the configured image",
|
|
61768
|
+
hint: "To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or pass --enable-containers=false."
|
|
61454
61769
|
});
|
|
61455
61770
|
for (const options of containerOptions) {
|
|
61456
61771
|
if ("dockerfile" in options) {
|
|
61457
|
-
const build$8 = await buildImage(dockerPath, options);
|
|
61772
|
+
const build$8 = await buildImage(dockerPath, options, false);
|
|
61458
61773
|
onContainerImagePreparationStart({
|
|
61459
61774
|
containerOptions: options,
|
|
61460
61775
|
abort: () => {
|
|
@@ -61524,7 +61839,7 @@ function getContainerOptions(options) {
|
|
|
61524
61839
|
return containersConfig.map((container) => {
|
|
61525
61840
|
if (isDockerfile(container.image, configPath)) return {
|
|
61526
61841
|
dockerfile: container.image,
|
|
61527
|
-
image_build_context: container.image_build_context ??
|
|
61842
|
+
image_build_context: container.image_build_context ?? path.dirname(container.image),
|
|
61528
61843
|
image_vars: container.image_vars,
|
|
61529
61844
|
class_name: container.class_name,
|
|
61530
61845
|
image_tag: getDevContainerImageName(container.class_name, containerBuildId)
|
|
@@ -61540,26 +61855,26 @@ function getContainerOptions(options) {
|
|
|
61540
61855
|
//#endregion
|
|
61541
61856
|
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs
|
|
61542
61857
|
var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
61543
|
-
function cleanPath(path) {
|
|
61544
|
-
let normalized = normalize(path);
|
|
61858
|
+
function cleanPath(path$1) {
|
|
61859
|
+
let normalized = normalize(path$1);
|
|
61545
61860
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
61546
61861
|
return normalized;
|
|
61547
61862
|
}
|
|
61548
61863
|
const SLASHES_REGEX = /[\\/]/g;
|
|
61549
|
-
function convertSlashes(path, separator) {
|
|
61550
|
-
return path.replace(SLASHES_REGEX, separator);
|
|
61864
|
+
function convertSlashes(path$1, separator) {
|
|
61865
|
+
return path$1.replace(SLASHES_REGEX, separator);
|
|
61551
61866
|
}
|
|
61552
61867
|
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
61553
|
-
function isRootDirectory(path) {
|
|
61554
|
-
return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
|
|
61868
|
+
function isRootDirectory(path$1) {
|
|
61869
|
+
return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
|
|
61555
61870
|
}
|
|
61556
|
-
function normalizePath$1(path, options) {
|
|
61871
|
+
function normalizePath$1(path$1, options) {
|
|
61557
61872
|
const { resolvePaths, normalizePath: normalizePath$1$1, pathSeparator } = options;
|
|
61558
|
-
const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith(".");
|
|
61559
|
-
if (resolvePaths) path = resolve$1(path);
|
|
61560
|
-
if (normalizePath$1$1 || pathNeedsCleaning) path = cleanPath(path);
|
|
61561
|
-
if (path === ".") return "";
|
|
61562
|
-
return convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
|
|
61873
|
+
const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
|
|
61874
|
+
if (resolvePaths) path$1 = resolve$1(path$1);
|
|
61875
|
+
if (normalizePath$1$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
|
|
61876
|
+
if (path$1 === ".") return "";
|
|
61877
|
+
return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
|
|
61563
61878
|
}
|
|
61564
61879
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
61565
61880
|
return directoryPath + filename;
|
|
@@ -61595,8 +61910,8 @@ const pushDirectory = (directoryPath, paths) => {
|
|
|
61595
61910
|
paths.push(directoryPath || ".");
|
|
61596
61911
|
};
|
|
61597
61912
|
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
61598
|
-
const path = directoryPath || ".";
|
|
61599
|
-
if (filters.every((filter) => filter(path, true))) paths.push(path);
|
|
61913
|
+
const path$1 = directoryPath || ".";
|
|
61914
|
+
if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
|
|
61600
61915
|
};
|
|
61601
61916
|
const empty$2 = () => {};
|
|
61602
61917
|
function build$6(root, options) {
|
|
@@ -61645,26 +61960,26 @@ const empty = () => {};
|
|
|
61645
61960
|
function build$3(options) {
|
|
61646
61961
|
return options.group ? groupFiles : empty;
|
|
61647
61962
|
}
|
|
61648
|
-
const resolveSymlinksAsync = function(path, state, callback$1) {
|
|
61963
|
+
const resolveSymlinksAsync = function(path$1, state, callback$1) {
|
|
61649
61964
|
const { queue, fs: fs$2, options: { suppressErrors } } = state;
|
|
61650
61965
|
queue.enqueue();
|
|
61651
|
-
fs$2.realpath(path, (error, resolvedPath) => {
|
|
61966
|
+
fs$2.realpath(path$1, (error, resolvedPath) => {
|
|
61652
61967
|
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
61653
61968
|
fs$2.stat(resolvedPath, (error$1, stat$1) => {
|
|
61654
61969
|
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
61655
|
-
if (stat$1.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
|
|
61970
|
+
if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
|
|
61656
61971
|
callback$1(stat$1, resolvedPath);
|
|
61657
61972
|
queue.dequeue(null, state);
|
|
61658
61973
|
});
|
|
61659
61974
|
});
|
|
61660
61975
|
};
|
|
61661
|
-
const resolveSymlinks = function(path, state, callback$1) {
|
|
61976
|
+
const resolveSymlinks = function(path$1, state, callback$1) {
|
|
61662
61977
|
const { queue, fs: fs$2, options: { suppressErrors } } = state;
|
|
61663
61978
|
queue.enqueue();
|
|
61664
61979
|
try {
|
|
61665
|
-
const resolvedPath = fs$2.realpathSync(path);
|
|
61980
|
+
const resolvedPath = fs$2.realpathSync(path$1);
|
|
61666
61981
|
const stat$1 = fs$2.statSync(resolvedPath);
|
|
61667
|
-
if (stat$1.isDirectory() && isRecursive(path, resolvedPath, state)) return;
|
|
61982
|
+
if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
|
|
61668
61983
|
callback$1(stat$1, resolvedPath);
|
|
61669
61984
|
} catch (e) {
|
|
61670
61985
|
if (!suppressErrors) throw e;
|
|
@@ -61674,16 +61989,16 @@ function build$2(options, isSynchronous) {
|
|
|
61674
61989
|
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
61675
61990
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
61676
61991
|
}
|
|
61677
|
-
function isRecursive(path, resolved, state) {
|
|
61992
|
+
function isRecursive(path$1, resolved, state) {
|
|
61678
61993
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
61679
|
-
let parent = dirname$1(path);
|
|
61994
|
+
let parent = dirname$1(path$1);
|
|
61680
61995
|
let depth$1 = 1;
|
|
61681
61996
|
while (parent !== state.root && depth$1 < 2) {
|
|
61682
61997
|
const resolvedPath = state.symlinks.get(parent);
|
|
61683
61998
|
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
|
|
61684
61999
|
else parent = dirname$1(parent);
|
|
61685
62000
|
}
|
|
61686
|
-
state.symlinks.set(path, resolved);
|
|
62001
|
+
state.symlinks.set(path$1, resolved);
|
|
61687
62002
|
return depth$1 > 1;
|
|
61688
62003
|
}
|
|
61689
62004
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -61864,19 +62179,19 @@ var Walker = class {
|
|
|
61864
62179
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
61865
62180
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
61866
62181
|
} else if (entry.isDirectory()) {
|
|
61867
|
-
let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
61868
|
-
if (exclude && exclude(entry.name, path)) continue;
|
|
61869
|
-
this.pushDirectory(path, paths, filters);
|
|
61870
|
-
this.walkDirectory(this.state, path, path, depth$1 - 1, this.walk);
|
|
62182
|
+
let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
62183
|
+
if (exclude && exclude(entry.name, path$1)) continue;
|
|
62184
|
+
this.pushDirectory(path$1, paths, filters);
|
|
62185
|
+
this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
|
|
61871
62186
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
61872
|
-
let path = joinPathWithBasePath(entry.name, directoryPath);
|
|
61873
|
-
this.resolveSymlink(path, this.state, (stat$1, resolvedPath) => {
|
|
62187
|
+
let path$1 = joinPathWithBasePath(entry.name, directoryPath);
|
|
62188
|
+
this.resolveSymlink(path$1, this.state, (stat$1, resolvedPath) => {
|
|
61874
62189
|
if (stat$1.isDirectory()) {
|
|
61875
62190
|
resolvedPath = normalizePath$1(resolvedPath, this.state.options);
|
|
61876
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
|
|
61877
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth$1 - 1, this.walk);
|
|
62191
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
|
|
62192
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
|
|
61878
62193
|
} else {
|
|
61879
|
-
resolvedPath = useRealPaths ? resolvedPath : path;
|
|
62194
|
+
resolvedPath = useRealPaths ? resolvedPath : path$1;
|
|
61880
62195
|
const filename = basename$1(resolvedPath);
|
|
61881
62196
|
const directoryPath$1 = normalizePath$1(dirname$1(resolvedPath), this.state.options);
|
|
61882
62197
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
@@ -62041,7 +62356,7 @@ var Builder = class {
|
|
|
62041
62356
|
isMatch = globFn(patterns, ...options);
|
|
62042
62357
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
62043
62358
|
}
|
|
62044
|
-
this.options.filters.push((path) => isMatch(path));
|
|
62359
|
+
this.options.filters.push((path$1) => isMatch(path$1));
|
|
62045
62360
|
return this;
|
|
62046
62361
|
}
|
|
62047
62362
|
};
|
|
@@ -62255,8 +62570,8 @@ var require_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/pic
|
|
|
62255
62570
|
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
62256
62571
|
return output;
|
|
62257
62572
|
};
|
|
62258
|
-
exports.basename = (path, { windows } = {}) => {
|
|
62259
|
-
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
62573
|
+
exports.basename = (path$1, { windows } = {}) => {
|
|
62574
|
+
const segs = path$1.split(windows ? /[\\/]/ : "/");
|
|
62260
62575
|
const last = segs[segs.length - 1];
|
|
62261
62576
|
if (last === "") return segs[segs.length - 2];
|
|
62262
62577
|
return last;
|
|
@@ -63996,15 +64311,15 @@ function buildRelative(cwd, root) {
|
|
|
63996
64311
|
};
|
|
63997
64312
|
}
|
|
63998
64313
|
const splitPatternOptions = { parts: true };
|
|
63999
|
-
function splitPattern(path) {
|
|
64314
|
+
function splitPattern(path$1) {
|
|
64000
64315
|
var _result$parts;
|
|
64001
|
-
const result = import_picomatch.default.scan(path, splitPatternOptions);
|
|
64002
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path];
|
|
64316
|
+
const result = import_picomatch.default.scan(path$1, splitPatternOptions);
|
|
64317
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
64003
64318
|
}
|
|
64004
64319
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
64005
64320
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
64006
|
-
const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
64007
|
-
const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
64321
|
+
const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
64322
|
+
const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
64008
64323
|
/**
|
|
64009
64324
|
* Escapes a path's special characters depending on the platform.
|
|
64010
64325
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -64128,13 +64443,13 @@ function buildCrawler(options, patterns) {
|
|
|
64128
64443
|
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
64129
64444
|
const crawler = new Builder({
|
|
64130
64445
|
filters: [debug$7 ? (p$1, isDirectory$2) => {
|
|
64131
|
-
const path = format$3(p$1, isDirectory$2);
|
|
64132
|
-
const matches = matcher(path) && !ignore$1(path);
|
|
64133
|
-
if (matches) log(`matched ${path}`);
|
|
64446
|
+
const path$1 = format$3(p$1, isDirectory$2);
|
|
64447
|
+
const matches = matcher(path$1) && !ignore$1(path$1);
|
|
64448
|
+
if (matches) log(`matched ${path$1}`);
|
|
64134
64449
|
return matches;
|
|
64135
64450
|
} : (p$1, isDirectory$2) => {
|
|
64136
|
-
const path = format$3(p$1, isDirectory$2);
|
|
64137
|
-
return matcher(path) && !ignore$1(path);
|
|
64451
|
+
const path$1 = format$3(p$1, isDirectory$2);
|
|
64452
|
+
return matcher(path$1) && !ignore$1(path$1);
|
|
64138
64453
|
}],
|
|
64139
64454
|
exclude: debug$7 ? (_, p$1) => {
|
|
64140
64455
|
const skipped = excludePredicate(_, p$1);
|
|
@@ -64980,19 +65295,13 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
|
|
|
64980
65295
|
assert(entryChunk, `Expected entry chunk with name "${MAIN_ENTRY_NAME}"`);
|
|
64981
65296
|
const isPrerenderWorker = this.environment.name === ctx.resolvedPluginConfig.prerenderWorkerEnvironmentName;
|
|
64982
65297
|
const isEntryWorker = ctx.resolvedPluginConfig.type === "workers" && this.environment.name === ctx.resolvedPluginConfig.entryWorkerEnvironmentName;
|
|
64983
|
-
outputConfig = {
|
|
64984
|
-
|
|
64985
|
-
|
|
64986
|
-
|
|
64987
|
-
|
|
64988
|
-
|
|
64989
|
-
|
|
64990
|
-
}],
|
|
64991
|
-
assets: isEntryWorker || isPrerenderWorker ? {
|
|
64992
|
-
...inputWorkerConfig.assets,
|
|
64993
|
-
directory: getAssetsDirectory(this.environment.config.build.outDir, ctx.resolvedViteConfig)
|
|
64994
|
-
} : void 0
|
|
64995
|
-
};
|
|
65298
|
+
outputConfig = getOutputConfig({
|
|
65299
|
+
inputWorkerConfig,
|
|
65300
|
+
workerOutputDirectory: this.environment.config.build.outDir,
|
|
65301
|
+
resolvedViteConfig: ctx.resolvedViteConfig,
|
|
65302
|
+
entryFileName: entryChunk.fileName,
|
|
65303
|
+
includeAssets: isEntryWorker || isPrerenderWorker
|
|
65304
|
+
});
|
|
64996
65305
|
if (inputWorkerConfig.upload_source_maps === void 0 && this.environment.config.build.sourcemap) outputConfig.upload_source_maps = true;
|
|
64997
65306
|
if (inputWorkerConfig.configPath) {
|
|
64998
65307
|
const localDevVars = getLocalDevVarsForPreview(inputWorkerConfig, ctx.resolvedPluginConfig.cloudflareEnv);
|
|
@@ -65035,6 +65344,40 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
|
|
|
65035
65344
|
}
|
|
65036
65345
|
};
|
|
65037
65346
|
});
|
|
65347
|
+
function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedViteConfig, entryFileName, includeAssets }) {
|
|
65348
|
+
const sourceConfigDirectory = inputWorkerConfig.configPath ? nodePath.dirname(inputWorkerConfig.configPath) : resolvedViteConfig.root;
|
|
65349
|
+
const outputDirectory = nodePath.resolve(resolvedViteConfig.root, workerOutputDirectory);
|
|
65350
|
+
return {
|
|
65351
|
+
...inputWorkerConfig,
|
|
65352
|
+
main: entryFileName,
|
|
65353
|
+
no_bundle: true,
|
|
65354
|
+
rules: [{
|
|
65355
|
+
type: "ESModule",
|
|
65356
|
+
globs: ["**/*.js", "**/*.mjs"]
|
|
65357
|
+
}],
|
|
65358
|
+
assets: includeAssets ? {
|
|
65359
|
+
...inputWorkerConfig.assets,
|
|
65360
|
+
directory: getAssetsDirectory(workerOutputDirectory, resolvedViteConfig)
|
|
65361
|
+
} : void 0,
|
|
65362
|
+
d1_databases: inputWorkerConfig.d1_databases.map((database) => {
|
|
65363
|
+
const sourceMigrationsDir = database.migrations_dir ?? "migrations";
|
|
65364
|
+
const sourceMigrationsPath = nodePath.resolve(sourceConfigDirectory, sourceMigrationsDir);
|
|
65365
|
+
const outputMigrationsDir = vite.normalizePath(nodePath.relative(outputDirectory, sourceMigrationsPath) || ".");
|
|
65366
|
+
return {
|
|
65367
|
+
...database,
|
|
65368
|
+
migrations_dir: outputMigrationsDir,
|
|
65369
|
+
migrations_pattern: rewriteMigrationsPattern(database.migrations_pattern, sourceMigrationsDir, outputMigrationsDir)
|
|
65370
|
+
};
|
|
65371
|
+
})
|
|
65372
|
+
};
|
|
65373
|
+
}
|
|
65374
|
+
function rewriteMigrationsPattern(migrationsPattern, fromMigrationsDir, toMigrationsDir) {
|
|
65375
|
+
if (migrationsPattern === void 0) return;
|
|
65376
|
+
const normalizedDir = nodePath.posix.normalize(vite.normalizePath(fromMigrationsDir));
|
|
65377
|
+
const normalizedPattern = nodePath.posix.normalize(vite.normalizePath(migrationsPattern));
|
|
65378
|
+
const suffix = normalizedDir === "." ? normalizedPattern : nodePath.posix.relative(normalizedDir, normalizedPattern);
|
|
65379
|
+
return vite.normalizePath(nodePath.posix.normalize(toMigrationsDir === "." ? suffix : `${toMigrationsDir}/${suffix}`));
|
|
65380
|
+
}
|
|
65038
65381
|
function readAssetsIgnoreFile(assetsIgnorePath) {
|
|
65039
65382
|
const content = fs$1.existsSync(assetsIgnorePath) ? fs$1.readFileSync(assetsIgnorePath, "utf-8") : "";
|
|
65040
65383
|
if (content.length === 0) return "";
|
|
@@ -65251,13 +65594,13 @@ const wslDefaultBrowser = async () => {
|
|
|
65251
65594
|
const { stdout } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
|
|
65252
65595
|
return stdout.trim();
|
|
65253
65596
|
};
|
|
65254
|
-
const convertWslPathToWindows = async (path) => {
|
|
65255
|
-
if (/^[a-z]+:\/\//i.test(path)) return path;
|
|
65597
|
+
const convertWslPathToWindows = async (path$1) => {
|
|
65598
|
+
if (/^[a-z]+:\/\//i.test(path$1)) return path$1;
|
|
65256
65599
|
try {
|
|
65257
|
-
const { stdout } = await execFile$1("wslpath", ["-aw", path], { encoding: "utf8" });
|
|
65600
|
+
const { stdout } = await execFile$1("wslpath", ["-aw", path$1], { encoding: "utf8" });
|
|
65258
65601
|
return stdout.trim();
|
|
65259
65602
|
} catch {
|
|
65260
|
-
return path;
|
|
65603
|
+
return path$1;
|
|
65261
65604
|
}
|
|
65262
65605
|
};
|
|
65263
65606
|
|
|
@@ -65443,8 +65786,8 @@ var is_in_ssh_default = isInSsh;
|
|
|
65443
65786
|
//#endregion
|
|
65444
65787
|
//#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
65445
65788
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
65446
|
-
const __dirname = import.meta.url ?
|
|
65447
|
-
const localXdgOpenPath =
|
|
65789
|
+
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
65790
|
+
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
65448
65791
|
const { platform, arch: arch$1 } = process$1;
|
|
65449
65792
|
const tryEachApp = async (apps$1, opener) => {
|
|
65450
65793
|
if (apps$1.length === 0) return;
|