@cloudflare/vite-plugin 1.50.0 → 1.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1038 -295
- package/dist/index.mjs.map +1 -1
- package/dist/{open-PBXRGS4R-MlJKk7qC.mjs → open-PBXRGS4R-7GUxLVbA.mjs} +4 -4
- package/dist/open-PBXRGS4R-7GUxLVbA.mjs.map +1 -0
- package/dist/{package-21IUaIs8.mjs → package-B0nclL_x.mjs} +3 -2
- package/dist/{package-21IUaIs8.mjs.map → package-B0nclL_x.mjs.map} +1 -1
- package/package.json +14 -13
- package/dist/open-PBXRGS4R-MlJKk7qC.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import assert from "node:assert";
|
|
|
5
5
|
import { CoreHeaders, CorePaths, DeferredPromise, Log, LogLevel, Miniflare, MiniflareCoreError, Mutex, Request as Request$1, Response as Response$1, buildPublicUrl, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
|
|
6
6
|
import * as wrangler from "wrangler";
|
|
7
7
|
import * as path2 from "node:path";
|
|
8
|
-
import
|
|
8
|
+
import path2__default, { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
9
|
import * as util$1 from "node:util";
|
|
10
10
|
import util, { TextEncoder as TextEncoder$1, format, inspect, promisify, styleText } from "node:util";
|
|
11
11
|
import * as vite from "vite";
|
|
@@ -31,6 +31,8 @@ import { getCloudflarePreset, nonPrefixedNodeModules } from "@cloudflare/unenv-p
|
|
|
31
31
|
import process$1, { exit, stdin, stdout } from "node:process";
|
|
32
32
|
import v8 from "node:v8";
|
|
33
33
|
import { defineEnv } from "unenv";
|
|
34
|
+
import os$1 from "os";
|
|
35
|
+
import { execSync } from "child_process";
|
|
34
36
|
import tty from "node:tty";
|
|
35
37
|
import P from "node:readline";
|
|
36
38
|
import { WebSocket, WebSocketServer } from "ws";
|
|
@@ -1487,7 +1489,7 @@ async function assertWranglerVersion() {
|
|
|
1487
1489
|
* The default compatibility date to use when the user omits one.
|
|
1488
1490
|
* This value is injected at build time and remains fixed for each release.
|
|
1489
1491
|
*/
|
|
1490
|
-
const DEFAULT_COMPAT_DATE = "2026-
|
|
1492
|
+
const DEFAULT_COMPAT_DATE = "2026-08-05";
|
|
1491
1493
|
|
|
1492
1494
|
//#endregion
|
|
1493
1495
|
//#region src/build-output-env.ts
|
|
@@ -1882,8 +1884,8 @@ __name$4(constructWranglerConfig, "constructWranglerConfig");
|
|
|
1882
1884
|
|
|
1883
1885
|
//#endregion
|
|
1884
1886
|
//#region ../workers-utils/dist/chunk-53IMCORZ.mjs
|
|
1885
|
-
function isDirectory$1(path$
|
|
1886
|
-
return fs2.statSync(path$
|
|
1887
|
+
function isDirectory$1(path$1) {
|
|
1888
|
+
return fs2.statSync(path$1, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
1887
1889
|
}
|
|
1888
1890
|
__name$4(isDirectory$1, "isDirectory");
|
|
1889
1891
|
function removeDir$1(dirPath, { fireAndForget = false } = {}) {
|
|
@@ -1926,7 +1928,7 @@ function getEnv(name) {
|
|
|
1926
1928
|
}
|
|
1927
1929
|
__name$4(getEnv, "getEnv");
|
|
1928
1930
|
function normalizePath$2(p$2) {
|
|
1929
|
-
return p$2 ?
|
|
1931
|
+
return p$2 ? path2__default.normalize(path2__default.join(p$2, ".")) : void 0;
|
|
1930
1932
|
}
|
|
1931
1933
|
__name$4(normalizePath$2, "normalizePath");
|
|
1932
1934
|
function homeDir() {
|
|
@@ -1934,13 +1936,13 @@ function homeDir() {
|
|
|
1934
1936
|
os.homedir(),
|
|
1935
1937
|
getEnv("USERPROFILE"),
|
|
1936
1938
|
getEnv("HOME"),
|
|
1937
|
-
getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ?
|
|
1939
|
+
getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ? path2__default.join(getEnv("HOMEDRIVE") ?? "", getEnv("HOMEPATH") ?? "") : void 0
|
|
1938
1940
|
].find(isNonEmpty));
|
|
1939
1941
|
return normalizePath$2(os.homedir() || getEnv("HOME"));
|
|
1940
1942
|
}
|
|
1941
1943
|
__name$4(homeDir, "homeDir");
|
|
1942
1944
|
function joinToBase(base, segments) {
|
|
1943
|
-
return base ?
|
|
1945
|
+
return base ? path2__default.join(base, ...segments) : void 0;
|
|
1944
1946
|
}
|
|
1945
1947
|
__name$4(joinToBase, "joinToBase");
|
|
1946
1948
|
function tempDir() {
|
|
@@ -1976,7 +1978,7 @@ function baseDir() {
|
|
|
1976
1978
|
}
|
|
1977
1979
|
__name$4(baseDir, "baseDir");
|
|
1978
1980
|
function valOrPath(value, segments) {
|
|
1979
|
-
return value ||
|
|
1981
|
+
return value || path2__default.join(...segments);
|
|
1980
1982
|
}
|
|
1981
1983
|
__name$4(valOrPath, "valOrPath");
|
|
1982
1984
|
function windowsAppData() {
|
|
@@ -2016,10 +2018,10 @@ function xdgCache() {
|
|
|
2016
2018
|
}
|
|
2017
2019
|
__name$4(xdgCache, "xdgCache");
|
|
2018
2020
|
function xdgAppPaths(name) {
|
|
2019
|
-
const segment =
|
|
2021
|
+
const segment = path2__default.parse(name).name;
|
|
2020
2022
|
return {
|
|
2021
|
-
config: /* @__PURE__ */ __name$4(() =>
|
|
2022
|
-
cache: /* @__PURE__ */ __name$4(() =>
|
|
2023
|
+
config: /* @__PURE__ */ __name$4(() => path2__default.join(xdgConfig(), segment), "config"),
|
|
2024
|
+
cache: /* @__PURE__ */ __name$4(() => path2__default.join(xdgCache(), segment), "cache")
|
|
2023
2025
|
};
|
|
2024
2026
|
}
|
|
2025
2027
|
__name$4(xdgAppPaths, "xdgAppPaths");
|
|
@@ -2027,7 +2029,7 @@ function getGlobalConfigPath({ appName = "wrangler", leadingDot = true, useLegac
|
|
|
2027
2029
|
const dirName = `${leadingDot ? "." : ""}${appName}`;
|
|
2028
2030
|
const configDir = xdgAppPaths(dirName).config();
|
|
2029
2031
|
if (useLegacyHomeDir) {
|
|
2030
|
-
const legacyConfigDir =
|
|
2032
|
+
const legacyConfigDir = path2__default.join(os.homedir(), dirName);
|
|
2031
2033
|
if (isDirectory$1(legacyConfigDir)) return legacyConfigDir;
|
|
2032
2034
|
}
|
|
2033
2035
|
return configDir;
|
|
@@ -4404,7 +4406,7 @@ function resolveWranglerConfigPath$1({ config: config$2, script }, options) {
|
|
|
4404
4406
|
deployConfigPath: void 0,
|
|
4405
4407
|
redirected: false
|
|
4406
4408
|
};
|
|
4407
|
-
return findWranglerConfig$2(script !== void 0 ?
|
|
4409
|
+
return findWranglerConfig$2(script !== void 0 ? path2__default.dirname(script) : process.cwd(), options);
|
|
4408
4410
|
}
|
|
4409
4411
|
__name$4(resolveWranglerConfigPath$1, "resolveWranglerConfigPath");
|
|
4410
4412
|
function findWranglerConfig$2(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -4435,15 +4437,15 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
|
|
|
4435
4437
|
const deployConfigFile = readFileSync$1(deployConfigPath);
|
|
4436
4438
|
try {
|
|
4437
4439
|
const deployConfig = parseJSONC$1(deployConfigFile, deployConfigPath);
|
|
4438
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
4440
|
+
redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
|
|
4439
4441
|
} catch (e) {
|
|
4440
|
-
throw new UserError(`Failed to parse the deploy configuration file at ${
|
|
4442
|
+
throw new UserError(`Failed to parse the deploy configuration file at ${path2__default.relative(".", deployConfigPath)}`, {
|
|
4441
4443
|
cause: e,
|
|
4442
4444
|
telemetryMessage: false
|
|
4443
4445
|
});
|
|
4444
4446
|
}
|
|
4445
4447
|
if (!redirectedConfigPath) throw new UserError(esm_default$2`
|
|
4446
|
-
A deploy configuration file was found at "${
|
|
4448
|
+
A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
|
|
4447
4449
|
But this is not valid - the required "configPath" property was not found.
|
|
4448
4450
|
Instead this file contains:
|
|
4449
4451
|
\`\`\`
|
|
@@ -4451,13 +4453,13 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
|
|
|
4451
4453
|
\`\`\`
|
|
4452
4454
|
`, { telemetryMessage: false });
|
|
4453
4455
|
if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default$2`
|
|
4454
|
-
There is a deploy configuration at "${
|
|
4455
|
-
But the redirected configuration path it points to, "${
|
|
4456
|
+
There is a deploy configuration at "${path2__default.relative(".", deployConfigPath)}".
|
|
4457
|
+
But the redirected configuration path it points to, "${path2__default.relative(".", redirectedConfigPath)}", does not exist.
|
|
4456
4458
|
`, { telemetryMessage: false });
|
|
4457
4459
|
if (userConfigPath) {
|
|
4458
|
-
if (
|
|
4459
|
-
Found both a user configuration file at "${
|
|
4460
|
-
and a deploy configuration file at "${
|
|
4460
|
+
if (path2__default.join(path2__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG$1) !== deployConfigPath) throw new UserError(esm_default$2`
|
|
4461
|
+
Found both a user configuration file at "${path2__default.relative(".", userConfigPath)}"
|
|
4462
|
+
and a deploy configuration file at "${path2__default.relative(".", deployConfigPath)}".
|
|
4461
4463
|
But these do not share the same base path so it is not clear which should be used.
|
|
4462
4464
|
`, { telemetryMessage: false });
|
|
4463
4465
|
}
|
|
@@ -5649,10 +5651,10 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
5649
5651
|
if (!isHttpOrHttpsPrefixed(url$2.origin || url$2.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
5650
5652
|
const port = url$2.port != null ? url$2.port : url$2.protocol === "https:" ? 443 : 80;
|
|
5651
5653
|
let origin = url$2.origin != null ? url$2.origin : `${url$2.protocol || ""}//${url$2.hostname || ""}:${port}`;
|
|
5652
|
-
let path$
|
|
5654
|
+
let path$1 = url$2.path != null ? url$2.path : `${url$2.pathname || ""}${url$2.search || ""}`;
|
|
5653
5655
|
if (origin[origin.length - 1] === "/") origin = origin.slice(0, origin.length - 1);
|
|
5654
|
-
if (path$
|
|
5655
|
-
return new URL(`${origin}${path$
|
|
5656
|
+
if (path$1 && path$1[0] !== "/") path$1 = `/${path$1}`;
|
|
5657
|
+
return new URL(`${origin}${path$1}`);
|
|
5656
5658
|
}
|
|
5657
5659
|
if (!isHttpOrHttpsPrefixed(url$2.origin || url$2.protocol)) throw new InvalidArgumentError$36("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
5658
5660
|
return url$2;
|
|
@@ -6527,8 +6529,8 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
|
|
|
6527
6529
|
debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$6, error$2.message);
|
|
6528
6530
|
});
|
|
6529
6531
|
diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
|
|
6530
|
-
const { request: { method, path: path$
|
|
6531
|
-
debugLog("sending request to %s %s%s", method, origin, path$
|
|
6532
|
+
const { request: { method, path: path$1, origin } } = evt;
|
|
6533
|
+
debugLog("sending request to %s %s%s", method, origin, path$1);
|
|
6532
6534
|
});
|
|
6533
6535
|
}
|
|
6534
6536
|
let isTrackingRequestEvents = false;
|
|
@@ -6540,16 +6542,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
|
|
|
6540
6542
|
}
|
|
6541
6543
|
isTrackingRequestEvents = true;
|
|
6542
6544
|
diagnosticsChannel$1.subscribe("undici:request:headers", (evt) => {
|
|
6543
|
-
const { request: { method, path: path$
|
|
6544
|
-
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$
|
|
6545
|
+
const { request: { method, path: path$1, origin }, response: { statusCode } } = evt;
|
|
6546
|
+
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$1, statusCode);
|
|
6545
6547
|
});
|
|
6546
6548
|
diagnosticsChannel$1.subscribe("undici:request:trailers", (evt) => {
|
|
6547
|
-
const { request: { method, path: path$
|
|
6548
|
-
debugLog("trailers received from %s %s%s", method, origin, path$
|
|
6549
|
+
const { request: { method, path: path$1, origin } } = evt;
|
|
6550
|
+
debugLog("trailers received from %s %s%s", method, origin, path$1);
|
|
6549
6551
|
});
|
|
6550
6552
|
diagnosticsChannel$1.subscribe("undici:request:error", (evt) => {
|
|
6551
|
-
const { request: { method, path: path$
|
|
6552
|
-
debugLog("request to %s %s%s errored - %s", method, origin, path$
|
|
6553
|
+
const { request: { method, path: path$1, origin }, error: error$2 } = evt;
|
|
6554
|
+
debugLog("request to %s %s%s errored - %s", method, origin, path$1, error$2.message);
|
|
6553
6555
|
});
|
|
6554
6556
|
}
|
|
6555
6557
|
let isTrackingWebSocketEvents = false;
|
|
@@ -6610,10 +6612,10 @@ var require_request$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
6610
6612
|
}
|
|
6611
6613
|
const kHandler = Symbol("handler");
|
|
6612
6614
|
var Request$6 = class {
|
|
6613
|
-
constructor(origin, { path: path$
|
|
6614
|
-
if (typeof path$
|
|
6615
|
-
else if (path$
|
|
6616
|
-
else if (invalidPathRegex.test(path$
|
|
6615
|
+
constructor(origin, { path: path$1, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
|
|
6616
|
+
if (typeof path$1 !== "string") throw new InvalidArgumentError$35("path must be a string");
|
|
6617
|
+
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");
|
|
6618
|
+
else if (invalidPathRegex.test(path$1)) throw new InvalidArgumentError$35("invalid request path");
|
|
6617
6619
|
if (typeof method !== "string") throw new InvalidArgumentError$35("method must be a string");
|
|
6618
6620
|
else if (normalizedMethodRecords$1[method] === void 0 && !isValidHTTPToken$2(method)) throw new InvalidArgumentError$35("invalid request method");
|
|
6619
6621
|
if (upgrade$1 && typeof upgrade$1 !== "string") throw new InvalidArgumentError$35("upgrade must be a string");
|
|
@@ -6654,7 +6656,7 @@ var require_request$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
6654
6656
|
this.completed = false;
|
|
6655
6657
|
this.aborted = false;
|
|
6656
6658
|
this.upgrade = upgrade$1 || null;
|
|
6657
|
-
this.path = query ? serializePathWithQuery$3(path$
|
|
6659
|
+
this.path = query ? serializePathWithQuery$3(path$1, query) : path$1;
|
|
6658
6660
|
this.origin = origin;
|
|
6659
6661
|
this.protocol = getProtocolFromUrlString(origin);
|
|
6660
6662
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -11253,7 +11255,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11253
11255
|
* @returns
|
|
11254
11256
|
*/
|
|
11255
11257
|
function writeH1(client, request$2) {
|
|
11256
|
-
const { method, path: path$
|
|
11258
|
+
const { method, path: path$1, host, upgrade: upgrade$1, blocking, reset } = request$2;
|
|
11257
11259
|
let { body, headers, contentLength } = request$2;
|
|
11258
11260
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
11259
11261
|
if (util$22.isFormDataLike(body)) {
|
|
@@ -11299,7 +11301,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11299
11301
|
if (client[kMaxRequests$1] && socket[kCounter$1]++ >= client[kMaxRequests$1]) socket[kReset$1] = true;
|
|
11300
11302
|
if (blocking) socket[kBlocking] = true;
|
|
11301
11303
|
if (socket.setTypeOfService) socket.setTypeOfService(request$2.typeOfService);
|
|
11302
|
-
let header = `${method} ${path$
|
|
11304
|
+
let header = `${method} ${path$1} HTTP/1.1\r\n`;
|
|
11303
11305
|
if (typeof host === "string") header += `host: ${host}\r\n`;
|
|
11304
11306
|
else header += client[kHostHeader$1];
|
|
11305
11307
|
if (upgrade$1) header += `connection: upgrade\r\nupgrade: ${upgrade$1}\r\n`;
|
|
@@ -11835,7 +11837,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11835
11837
|
function writeH2(client, request$2) {
|
|
11836
11838
|
const requestTimeout = request$2.bodyTimeout ?? client[kBodyTimeout$1];
|
|
11837
11839
|
const session = client[kHTTP2Session];
|
|
11838
|
-
const { method, path: path$
|
|
11840
|
+
const { method, path: path$1, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
|
|
11839
11841
|
let { body } = request$2;
|
|
11840
11842
|
if (upgrade$1 != null && upgrade$1 !== "websocket") {
|
|
11841
11843
|
util$21.errorRequest(client, request$2, new InvalidArgumentError$30(`Custom upgrade "${upgrade$1}" not supported over HTTP/2`));
|
|
@@ -11888,7 +11890,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11888
11890
|
}
|
|
11889
11891
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
11890
11892
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
11891
|
-
headers[HTTP2_HEADER_PATH] = path$
|
|
11893
|
+
headers[HTTP2_HEADER_PATH] = path$1;
|
|
11892
11894
|
if (protocol === "ws:" || protocol === "wss:") headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
11893
11895
|
else headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
11894
11896
|
stream$2 = session.request(headers, {
|
|
@@ -11930,7 +11932,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
11930
11932
|
stream$2.setTimeout(requestTimeout);
|
|
11931
11933
|
return true;
|
|
11932
11934
|
}
|
|
11933
|
-
headers[HTTP2_HEADER_PATH] = path$
|
|
11935
|
+
headers[HTTP2_HEADER_PATH] = path$1;
|
|
11934
11936
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
11935
11937
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
11936
11938
|
if (body && typeof body.read === "function") body.read(0);
|
|
@@ -13795,8 +13797,8 @@ var require_proxy_agent = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
|
|
|
13795
13797
|
}
|
|
13796
13798
|
if (onHeaders) onHeaders.call(this, statusCode, data$1, resume$1);
|
|
13797
13799
|
};
|
|
13798
|
-
const { origin, path: path$
|
|
13799
|
-
opts.path = origin + path$
|
|
13800
|
+
const { origin, path: path$1 = "/", headers = {} } = opts;
|
|
13801
|
+
opts.path = origin + path$1;
|
|
13800
13802
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
13801
13803
|
const { host } = new URL(origin);
|
|
13802
13804
|
headers.host = host;
|
|
@@ -15581,16 +15583,16 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15581
15583
|
}
|
|
15582
15584
|
return normalizedQp;
|
|
15583
15585
|
}
|
|
15584
|
-
function safeUrl(path$
|
|
15585
|
-
if (typeof path$
|
|
15586
|
-
const pathSegments = path$
|
|
15587
|
-
if (pathSegments.length !== 2) return path$
|
|
15586
|
+
function safeUrl(path$1) {
|
|
15587
|
+
if (typeof path$1 !== "string") return path$1;
|
|
15588
|
+
const pathSegments = path$1.split("?", 3);
|
|
15589
|
+
if (pathSegments.length !== 2) return path$1;
|
|
15588
15590
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
15589
15591
|
qp.sort();
|
|
15590
15592
|
return [...pathSegments, qp.toString()].join("?");
|
|
15591
15593
|
}
|
|
15592
|
-
function matchKey(mockDispatch$1, { path: path$
|
|
15593
|
-
const pathMatch = matchValue$1(mockDispatch$1.path, path$
|
|
15594
|
+
function matchKey(mockDispatch$1, { path: path$1, method, body, headers }) {
|
|
15595
|
+
const pathMatch = matchValue$1(mockDispatch$1.path, path$1);
|
|
15594
15596
|
const methodMatch = matchValue$1(mockDispatch$1.method, method);
|
|
15595
15597
|
const bodyMatch = typeof mockDispatch$1.body !== "undefined" ? matchValue$1(mockDispatch$1.body, body) : true;
|
|
15596
15598
|
const headersMatch = matchHeaders(mockDispatch$1, headers);
|
|
@@ -15608,8 +15610,8 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15608
15610
|
const basePath = key.query ? serializePathWithQuery$2(key.path, key.query) : key.path;
|
|
15609
15611
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
15610
15612
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
15611
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$
|
|
15612
|
-
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$
|
|
15613
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$1, ignoreTrailingSlash }) => {
|
|
15614
|
+
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$1)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path$1), resolvedPath);
|
|
15613
15615
|
});
|
|
15614
15616
|
if (matchedMockDispatches.length === 0) throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
15615
15617
|
matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue$1(method, key.method));
|
|
@@ -15652,15 +15654,15 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
15652
15654
|
/**
|
|
15653
15655
|
* @param {string} path Path to remove trailing slash from
|
|
15654
15656
|
*/
|
|
15655
|
-
function removeTrailingSlash(path$
|
|
15656
|
-
while (path$
|
|
15657
|
-
if (path$
|
|
15658
|
-
return path$
|
|
15657
|
+
function removeTrailingSlash(path$1) {
|
|
15658
|
+
while (path$1.endsWith("/")) path$1 = path$1.slice(0, -1);
|
|
15659
|
+
if (path$1.length === 0) path$1 = "/";
|
|
15660
|
+
return path$1;
|
|
15659
15661
|
}
|
|
15660
15662
|
function buildKey$1(opts) {
|
|
15661
|
-
const { path: path$
|
|
15663
|
+
const { path: path$1, method, body, headers, query } = opts;
|
|
15662
15664
|
return {
|
|
15663
|
-
path: path$
|
|
15665
|
+
path: path$1,
|
|
15664
15666
|
method,
|
|
15665
15667
|
body,
|
|
15666
15668
|
headers,
|
|
@@ -16227,10 +16229,10 @@ var require_pending_interceptors_formatter = /* @__PURE__ */ __commonJS$2({ "../
|
|
|
16227
16229
|
});
|
|
16228
16230
|
}
|
|
16229
16231
|
format(pendingInterceptors) {
|
|
16230
|
-
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$
|
|
16232
|
+
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$1, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
16231
16233
|
Method: method,
|
|
16232
16234
|
Origin: origin,
|
|
16233
|
-
Path: path$
|
|
16235
|
+
Path: path$1,
|
|
16234
16236
|
"Status code": statusCode,
|
|
16235
16237
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
16236
16238
|
Invocations: timesInvoked,
|
|
@@ -16288,8 +16290,8 @@ var require_mock_agent = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
|
|
|
16288
16290
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
16289
16291
|
const dispatchOpts = { ...opts };
|
|
16290
16292
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
16291
|
-
const [path$
|
|
16292
|
-
dispatchOpts.path = `${path$
|
|
16293
|
+
const [path$1, searchParams] = dispatchOpts.path.split("?");
|
|
16294
|
+
dispatchOpts.path = `${path$1}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
|
|
16293
16295
|
}
|
|
16294
16296
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
16295
16297
|
}
|
|
@@ -16766,10 +16768,10 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../node_modul
|
|
|
16766
16768
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
16767
16769
|
*/
|
|
16768
16770
|
async loadSnapshots(filePath) {
|
|
16769
|
-
const path$
|
|
16770
|
-
if (!path$
|
|
16771
|
+
const path$1 = filePath || this.#snapshotPath;
|
|
16772
|
+
if (!path$1) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16771
16773
|
try {
|
|
16772
|
-
const data$1 = await readFile(resolve$3(path$
|
|
16774
|
+
const data$1 = await readFile(resolve$3(path$1), "utf8");
|
|
16773
16775
|
const parsed = JSON.parse(data$1);
|
|
16774
16776
|
if (Array.isArray(parsed)) {
|
|
16775
16777
|
this.#snapshots.clear();
|
|
@@ -16777,7 +16779,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../node_modul
|
|
|
16777
16779
|
} else this.#snapshots = new Map(Object.entries(parsed));
|
|
16778
16780
|
} catch (error$2) {
|
|
16779
16781
|
if (error$2.code === "ENOENT") this.#snapshots.clear();
|
|
16780
|
-
else throw new UndiciError$1(`Failed to load snapshots from ${path$
|
|
16782
|
+
else throw new UndiciError$1(`Failed to load snapshots from ${path$1}`, { cause: error$2 });
|
|
16781
16783
|
}
|
|
16782
16784
|
}
|
|
16783
16785
|
/**
|
|
@@ -16787,9 +16789,9 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../node_modul
|
|
|
16787
16789
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
16788
16790
|
*/
|
|
16789
16791
|
async saveSnapshots(filePath) {
|
|
16790
|
-
const path$
|
|
16791
|
-
if (!path$
|
|
16792
|
-
const resolvedPath = resolve$3(path$
|
|
16792
|
+
const path$1 = filePath || this.#snapshotPath;
|
|
16793
|
+
if (!path$1) throw new InvalidArgumentError$6("Snapshot path is required");
|
|
16794
|
+
const resolvedPath = resolve$3(path$1);
|
|
16793
16795
|
await mkdir(dirname$2(resolvedPath), { recursive: true });
|
|
16794
16796
|
const data$1 = Array.from(this.#snapshots.entries()).map(([hash$1, snapshot]) => ({
|
|
16795
16797
|
hash: hash$1,
|
|
@@ -17363,11 +17365,11 @@ var require_redirect_handler = /* @__PURE__ */ __commonJS$2({ "../../node_module
|
|
|
17363
17365
|
return;
|
|
17364
17366
|
}
|
|
17365
17367
|
const { origin, pathname, search } = util$9.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
17366
|
-
const path$
|
|
17367
|
-
const redirectUrlString = `${origin}${path$
|
|
17368
|
+
const path$1 = search ? `${pathname}${search}` : pathname;
|
|
17369
|
+
const redirectUrlString = `${origin}${path$1}`;
|
|
17368
17370
|
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.`);
|
|
17369
17371
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
17370
|
-
this.opts.path = path$
|
|
17372
|
+
this.opts.path = path$1;
|
|
17371
17373
|
this.opts.origin = origin;
|
|
17372
17374
|
this.opts.query = null;
|
|
17373
17375
|
}
|
|
@@ -22333,10 +22335,10 @@ var require_fetch = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/und
|
|
|
22333
22335
|
const url$2 = requestCurrentURL(request$2);
|
|
22334
22336
|
/** @type {import('../../..').Agent} */
|
|
22335
22337
|
const agent = fetchParams.controller.dispatcher;
|
|
22336
|
-
const path$
|
|
22338
|
+
const path$1 = url$2.pathname + url$2.search;
|
|
22337
22339
|
const hasTrailingQuestionMark = url$2.search.length === 0 && url$2.href[url$2.href.length - url$2.hash.length - 1] === "?";
|
|
22338
22340
|
return new Promise((resolve$4, reject) => agent.dispatch({
|
|
22339
|
-
path: hasTrailingQuestionMark ? `${path$
|
|
22341
|
+
path: hasTrailingQuestionMark ? `${path$1}?` : path$1,
|
|
22340
22342
|
origin: url$2.origin,
|
|
22341
22343
|
method: request$2.method,
|
|
22342
22344
|
body: agent.isMockActive ? request$2.body && (request$2.body.source || request$2.body.stream) : body,
|
|
@@ -23118,9 +23120,9 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
23118
23120
|
* path-value = <any CHAR except CTLs or ";">
|
|
23119
23121
|
* @param {string} path
|
|
23120
23122
|
*/
|
|
23121
|
-
function validateCookiePath(path$
|
|
23122
|
-
for (let i$1 = 0; i$1 < path$
|
|
23123
|
-
const code = path$
|
|
23123
|
+
function validateCookiePath(path$1) {
|
|
23124
|
+
for (let i$1 = 0; i$1 < path$1.length; ++i$1) {
|
|
23125
|
+
const code = path$1.charCodeAt(i$1);
|
|
23124
23126
|
if (code < 32 || code === 127 || code === 59) throw new Error("Invalid cookie path");
|
|
23125
23127
|
}
|
|
23126
23128
|
}
|
|
@@ -26248,9 +26250,9 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
26248
26250
|
if (opts != null && typeof opts !== "object") throw new InvalidArgumentError("invalid opts");
|
|
26249
26251
|
if (opts && opts.path != null) {
|
|
26250
26252
|
if (typeof opts.path !== "string") throw new InvalidArgumentError("invalid opts.path");
|
|
26251
|
-
let path$
|
|
26252
|
-
if (!opts.path.startsWith("/")) path$
|
|
26253
|
-
url$2 = new URL(util$2.parseOrigin(url$2).origin + path$
|
|
26253
|
+
let path$1 = opts.path;
|
|
26254
|
+
if (!opts.path.startsWith("/")) path$1 = `/${path$1}`;
|
|
26255
|
+
url$2 = new URL(util$2.parseOrigin(url$2).origin + path$1);
|
|
26254
26256
|
} else {
|
|
26255
26257
|
if (!opts) opts = typeof url$2 === "object" ? url$2 : {};
|
|
26256
26258
|
url$2 = util$2.parseURL(url$2);
|
|
@@ -26722,7 +26724,7 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26722
26724
|
} });
|
|
26723
26725
|
var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$2, module$1) {
|
|
26724
26726
|
var exec$3 = __require$1("child_process").exec;
|
|
26725
|
-
var execSync$
|
|
26727
|
+
var execSync$2 = __require$1("child_process").execSync;
|
|
26726
26728
|
var fs3 = __require$1("fs");
|
|
26727
26729
|
var path6 = __require$1("path");
|
|
26728
26730
|
var access$1 = fs3.access;
|
|
@@ -26778,7 +26780,7 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
|
|
|
26778
26780
|
}, "commandExistsWindows");
|
|
26779
26781
|
var commandExistsUnixSync$1 = /* @__PURE__ */ __name$4(function(commandName, cleanedCommandName) {
|
|
26780
26782
|
if (fileNotExistsSync$1(commandName)) try {
|
|
26781
|
-
return !!execSync$
|
|
26783
|
+
return !!execSync$2("command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }");
|
|
26782
26784
|
} catch (error51) {
|
|
26783
26785
|
return false;
|
|
26784
26786
|
}
|
|
@@ -26787,7 +26789,7 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
|
|
|
26787
26789
|
var commandExistsWindowsSync$1 = /* @__PURE__ */ __name$4(function(commandName, cleanedCommandName, callback$1) {
|
|
26788
26790
|
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) return false;
|
|
26789
26791
|
try {
|
|
26790
|
-
return !!execSync$
|
|
26792
|
+
return !!execSync$2("where " + cleanedCommandName, { stdio: [] });
|
|
26791
26793
|
} catch (error51) {
|
|
26792
26794
|
return false;
|
|
26793
26795
|
}
|
|
@@ -41589,7 +41591,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
|
|
|
41589
41591
|
var getRegistryPath = getEnvironmentVariableFactory({
|
|
41590
41592
|
variableName: "WRANGLER_REGISTRY_PATH",
|
|
41591
41593
|
defaultValue() {
|
|
41592
|
-
return
|
|
41594
|
+
return path2__default.join(getGlobalConfigPath(), "registry");
|
|
41593
41595
|
}
|
|
41594
41596
|
});
|
|
41595
41597
|
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
|
|
@@ -41999,7 +42001,7 @@ function isPagesConfig(rawConfig) {
|
|
|
41999
42001
|
}
|
|
42000
42002
|
__name$4(isPagesConfig, "isPagesConfig");
|
|
42001
42003
|
function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
|
|
42002
|
-
const diagnostics = new Diagnostics(`Processing ${configPath ?
|
|
42004
|
+
const diagnostics = new Diagnostics(`Processing ${configPath ? path2__default.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
|
|
42003
42005
|
const isRedirectedConfig2 = isRedirectedRawConfig$1(rawConfig, configPath, userConfigPath);
|
|
42004
42006
|
if ("legacy_env" in rawConfig) {
|
|
42005
42007
|
if (!isRedirectedConfig2) diagnostics.errors.push(dedent$2`
|
|
@@ -42117,34 +42119,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
42117
42119
|
else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
|
|
42118
42120
|
return {
|
|
42119
42121
|
command,
|
|
42120
|
-
watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir2) =>
|
|
42122
|
+
watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir2) => path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), `${dir2}`))) : path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), `${watch_dir}`)) : watch_dir,
|
|
42121
42123
|
cwd
|
|
42122
42124
|
};
|
|
42123
42125
|
}
|
|
42124
42126
|
__name$4(normalizeAndValidateBuild, "normalizeAndValidateBuild");
|
|
42125
42127
|
function normalizeAndValidateMainField(configPath, rawMain) {
|
|
42126
|
-
const configDir =
|
|
42128
|
+
const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
|
|
42127
42129
|
if (rawMain !== void 0) if (typeof rawMain === "string") {
|
|
42128
|
-
const directory =
|
|
42129
|
-
return
|
|
42130
|
+
const directory = path2__default.resolve(configDir);
|
|
42131
|
+
return path2__default.resolve(directory, rawMain);
|
|
42130
42132
|
} else return rawMain;
|
|
42131
42133
|
else return;
|
|
42132
42134
|
}
|
|
42133
42135
|
__name$4(normalizeAndValidateMainField, "normalizeAndValidateMainField");
|
|
42134
42136
|
function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
42135
|
-
const configDir =
|
|
42137
|
+
const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
|
|
42136
42138
|
if (rawDir !== void 0) if (typeof rawDir === "string") {
|
|
42137
|
-
const directory =
|
|
42138
|
-
return
|
|
42139
|
+
const directory = path2__default.resolve(configDir);
|
|
42140
|
+
return path2__default.resolve(directory, rawDir);
|
|
42139
42141
|
} else return rawDir;
|
|
42140
42142
|
else return;
|
|
42141
42143
|
}
|
|
42142
42144
|
__name$4(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
|
|
42143
42145
|
function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
42144
|
-
const configDir =
|
|
42146
|
+
const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
|
|
42145
42147
|
if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
|
|
42146
|
-
const directory =
|
|
42147
|
-
return
|
|
42148
|
+
const directory = path2__default.resolve(configDir);
|
|
42149
|
+
return path2__default.resolve(directory, rawPagesDir);
|
|
42148
42150
|
} else return rawPagesDir;
|
|
42149
42151
|
else return;
|
|
42150
42152
|
}
|
|
@@ -42198,7 +42200,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
|
|
|
42198
42200
|
validateOptionalProperty(diagnostics, "site", "entry-point", legacySiteEntryPoint, "string");
|
|
42199
42201
|
deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
|
|
42200
42202
|
\`\`\`
|
|
42201
|
-
main = "${
|
|
42203
|
+
main = "${path2__default.join(String(legacySiteEntryPoint) || "workers-site", path2__default.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js")}"
|
|
42202
42204
|
\`\`\``, false, void 0, "warning");
|
|
42203
42205
|
let siteEntryPoint = legacySiteEntryPoint;
|
|
42204
42206
|
if (!mainEntryPoint && !siteEntryPoint) {
|
|
@@ -42211,7 +42213,7 @@ main = "workers-site/index.js"
|
|
|
42211
42213
|
} else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
|
|
42212
42214
|
They serve the same purpose: to point to the entry-point of your worker.
|
|
42213
42215
|
Delete the deprecated \`site.entry-point\` field from your config.`);
|
|
42214
|
-
if (configPath && siteEntryPoint) siteEntryPoint =
|
|
42216
|
+
if (configPath && siteEntryPoint) siteEntryPoint = path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), siteEntryPoint));
|
|
42215
42217
|
return {
|
|
42216
42218
|
bucket,
|
|
42217
42219
|
"entry-point": siteEntryPoint,
|
|
@@ -42243,7 +42245,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
42243
42245
|
if (rawMapping === void 0) return;
|
|
42244
42246
|
const mapping = {};
|
|
42245
42247
|
for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
|
|
42246
|
-
if (configPath) mapping[name] = configPath ?
|
|
42248
|
+
if (configPath) mapping[name] = configPath ? path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), filePath)) : filePath;
|
|
42247
42249
|
}
|
|
42248
42250
|
return mapping;
|
|
42249
42251
|
}
|
|
@@ -42446,7 +42448,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
42446
42448
|
exports: inheritable(diagnostics, topLevelEnv, rawEnv, "exports", validateExports, {}),
|
|
42447
42449
|
kv_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "kv_namespaces", validateBindingArray(envName, validateKVBinding), []),
|
|
42448
42450
|
cloudchamber: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "cloudchamber", validateCloudchamberConfig, {}),
|
|
42449
|
-
containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name, configPath), void 0),
|
|
42451
|
+
containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name ?? rawConfig?.name, configPath), void 0),
|
|
42450
42452
|
send_email: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "send_email", validateBindingArray(envName, validateSendEmailBinding), []),
|
|
42451
42453
|
queues: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "queues", validateQueues(envName), {
|
|
42452
42454
|
producers: [],
|
|
@@ -42503,7 +42505,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
42503
42505
|
__name$4(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
|
|
42504
42506
|
function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
|
|
42505
42507
|
const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
|
|
42506
|
-
return configPath && tsconfig ?
|
|
42508
|
+
return configPath && tsconfig ? path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), tsconfig)) : tsconfig;
|
|
42507
42509
|
}
|
|
42508
42510
|
__name$4(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
|
|
42509
42511
|
var validateAndNormalizeRules = /* @__PURE__ */ __name$4((diagnostics, topLevelEnv, rawEnv, envName) => {
|
|
@@ -43046,9 +43048,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
|
43046
43048
|
let resolvedBuildContextPath = void 0;
|
|
43047
43049
|
try {
|
|
43048
43050
|
if (isDockerfile(resolvedImage, configPath)) {
|
|
43049
|
-
const baseDir$1 = configPath ?
|
|
43050
|
-
resolvedImage =
|
|
43051
|
-
resolvedBuildContextPath = containerAppOptional.image_build_context ?
|
|
43051
|
+
const baseDir$1 = configPath ? path2__default.dirname(configPath) : process.cwd();
|
|
43052
|
+
resolvedImage = path2__default.resolve(baseDir$1, resolvedImage);
|
|
43053
|
+
resolvedBuildContextPath = containerAppOptional.image_build_context ? path2__default.resolve(baseDir$1, containerAppOptional.image_build_context) : path2__default.dirname(resolvedImage);
|
|
43052
43054
|
}
|
|
43053
43055
|
} catch (err) {
|
|
43054
43056
|
if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
|
|
@@ -44420,8 +44422,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
|
|
|
44420
44422
|
}
|
|
44421
44423
|
__name$4(isRemoteValid, "isRemoteValid");
|
|
44422
44424
|
function isDockerfile(imagePath, configPath) {
|
|
44423
|
-
const baseDir$1 = configPath ?
|
|
44424
|
-
const maybeDockerfile =
|
|
44425
|
+
const baseDir$1 = configPath ? path2__default.dirname(configPath) : process.cwd();
|
|
44426
|
+
const maybeDockerfile = path2__default.resolve(baseDir$1, imagePath);
|
|
44425
44427
|
if (fs2.existsSync(maybeDockerfile)) {
|
|
44426
44428
|
if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
|
|
44427
44429
|
return true;
|
|
@@ -44572,10 +44574,10 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
44572
44574
|
__name$4(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
44573
44575
|
function getPackagePath(packageName, projectPath) {
|
|
44574
44576
|
try {
|
|
44575
|
-
return
|
|
44577
|
+
return path2__default.dirname(__require$1.resolve(`${packageName}/package.json`, { paths: [projectPath] }));
|
|
44576
44578
|
} catch {}
|
|
44577
44579
|
try {
|
|
44578
|
-
return
|
|
44580
|
+
return path2__default.dirname(__require$1.resolve(packageName, { paths: [projectPath] }));
|
|
44579
44581
|
} catch {}
|
|
44580
44582
|
}
|
|
44581
44583
|
__name$4(getPackagePath, "getPackagePath");
|
|
@@ -44600,14 +44602,14 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
44600
44602
|
__name$4(getInstalledPackageVersion, "getInstalledPackageVersion");
|
|
44601
44603
|
function findFileUp(name, startDir, lastDir) {
|
|
44602
44604
|
let dir2 = startDir;
|
|
44603
|
-
const root =
|
|
44605
|
+
const root = path2__default.parse(dir2).root;
|
|
44604
44606
|
while (true) {
|
|
44605
|
-
const candidate =
|
|
44607
|
+
const candidate = path2__default.join(dir2, name);
|
|
44606
44608
|
try {
|
|
44607
44609
|
if (statSync(candidate).isFile()) return candidate;
|
|
44608
44610
|
} catch {}
|
|
44609
44611
|
if (lastDir !== void 0 && dir2 === lastDir) break;
|
|
44610
|
-
const parent =
|
|
44612
|
+
const parent = path2__default.dirname(dir2);
|
|
44611
44613
|
if (parent === dir2 || dir2 === root) break;
|
|
44612
44614
|
dir2 = parent;
|
|
44613
44615
|
}
|
|
@@ -44873,7 +44875,7 @@ var process3 = globalThis.process;
|
|
|
44873
44875
|
var { onExit, load: load$1, unload: unload$1 } = signalExitWrap(processOk$1(process3) ? new SignalExit(process3) : new SignalExitFallback());
|
|
44874
44876
|
function getWranglerHiddenDirPath(projectRoot) {
|
|
44875
44877
|
projectRoot ??= process.cwd();
|
|
44876
|
-
return
|
|
44878
|
+
return path2__default.join(projectRoot, ".wrangler");
|
|
44877
44879
|
}
|
|
44878
44880
|
__name$4(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
|
44879
44881
|
var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
|
|
@@ -44890,7 +44892,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
44890
44892
|
const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
|
|
44891
44893
|
for (const entry of entries) {
|
|
44892
44894
|
if (!entry.isDirectory()) continue;
|
|
44893
|
-
const entryPath =
|
|
44895
|
+
const entryPath = path2__default.join(tmpRoot, entry.name);
|
|
44894
44896
|
try {
|
|
44895
44897
|
if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync$1(entryPath);
|
|
44896
44898
|
} catch {}
|
|
@@ -44898,10 +44900,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
44898
44900
|
}
|
|
44899
44901
|
__name$4(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
|
|
44900
44902
|
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
44901
|
-
const tmpRoot =
|
|
44903
|
+
const tmpRoot = path2__default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
|
44902
44904
|
fs2.mkdirSync(tmpRoot, { recursive: true });
|
|
44903
44905
|
sweepStaleWranglerTmpDirs(tmpRoot);
|
|
44904
|
-
const tmpPrefix =
|
|
44906
|
+
const tmpPrefix = path2__default.join(tmpRoot, `${prefix}-`);
|
|
44905
44907
|
const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
|
|
44906
44908
|
const cleanupDir = /* @__PURE__ */ __name$4(() => {
|
|
44907
44909
|
if (cleanup) try {
|
|
@@ -45777,7 +45779,7 @@ async function fetchLatestNpmVersion(name, version2) {
|
|
|
45777
45779
|
__name$4(fetchLatestNpmVersion, "fetchLatestNpmVersion");
|
|
45778
45780
|
async function openInBrowser(url2, logger$1) {
|
|
45779
45781
|
try {
|
|
45780
|
-
const { default: open$1 } = await import("./open-PBXRGS4R-
|
|
45782
|
+
const { default: open$1 } = await import("./open-PBXRGS4R-7GUxLVbA.mjs");
|
|
45781
45783
|
(await open$1(url2)).on("error", (err) => {
|
|
45782
45784
|
handleBrowserOpenError(url2, err, logger$1);
|
|
45783
45785
|
});
|
|
@@ -48333,8 +48335,8 @@ const postfixRE = /[?#].*$/;
|
|
|
48333
48335
|
function cleanUrl(url$2) {
|
|
48334
48336
|
return url$2.replace(postfixRE, "");
|
|
48335
48337
|
}
|
|
48336
|
-
function withTrailingSlash(path$
|
|
48337
|
-
return path$
|
|
48338
|
+
function withTrailingSlash(path$1) {
|
|
48339
|
+
return path$1.endsWith("/") ? path$1 : `${path$1}/`;
|
|
48338
48340
|
}
|
|
48339
48341
|
function createRequestHandler(handler) {
|
|
48340
48342
|
return async (req, res, next) => {
|
|
@@ -48973,11 +48975,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
48973
48975
|
for (let i$1 = startIndex; i$1 < x.issues.length; i$1++) if (x.issues[i$1]?.continue === false) return true;
|
|
48974
48976
|
return false;
|
|
48975
48977
|
}
|
|
48976
|
-
function prefixIssues(path$
|
|
48978
|
+
function prefixIssues(path$1, issues) {
|
|
48977
48979
|
return issues.map((iss) => {
|
|
48978
48980
|
var _a$3;
|
|
48979
48981
|
(_a$3 = iss).path ?? (_a$3.path = []);
|
|
48980
|
-
iss.path.unshift(path$
|
|
48982
|
+
iss.path.unshift(path$1);
|
|
48981
48983
|
return iss;
|
|
48982
48984
|
});
|
|
48983
48985
|
}
|
|
@@ -49042,12 +49044,12 @@ function flattenError(error$2, mapper = (issue$2) => issue$2.message) {
|
|
|
49042
49044
|
}
|
|
49043
49045
|
function formatError(error$2, mapper = (issue$2) => issue$2.message) {
|
|
49044
49046
|
const fieldErrors = { _errors: [] };
|
|
49045
|
-
const processError = (error$3, path$
|
|
49046
|
-
for (const issue$2 of error$3.issues) if (issue$2.code === "invalid_union" && issue$2.errors.length) issue$2.errors.map((issues) => processError({ issues }, [...path$
|
|
49047
|
-
else if (issue$2.code === "invalid_key") processError({ issues: issue$2.issues }, [...path$
|
|
49048
|
-
else if (issue$2.code === "invalid_element") processError({ issues: issue$2.issues }, [...path$
|
|
49047
|
+
const processError = (error$3, path$1 = []) => {
|
|
49048
|
+
for (const issue$2 of error$3.issues) if (issue$2.code === "invalid_union" && issue$2.errors.length) issue$2.errors.map((issues) => processError({ issues }, [...path$1, ...issue$2.path]));
|
|
49049
|
+
else if (issue$2.code === "invalid_key") processError({ issues: issue$2.issues }, [...path$1, ...issue$2.path]);
|
|
49050
|
+
else if (issue$2.code === "invalid_element") processError({ issues: issue$2.issues }, [...path$1, ...issue$2.path]);
|
|
49049
49051
|
else {
|
|
49050
|
-
const fullpath = [...path$
|
|
49052
|
+
const fullpath = [...path$1, ...issue$2.path];
|
|
49051
49053
|
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue$2));
|
|
49052
49054
|
else {
|
|
49053
49055
|
let curr = fieldErrors;
|
|
@@ -56005,7 +56007,7 @@ function resolveWranglerConfigPath({ config: config$2, script }, options) {
|
|
|
56005
56007
|
deployConfigPath: void 0,
|
|
56006
56008
|
redirected: false
|
|
56007
56009
|
};
|
|
56008
|
-
return findWranglerConfig$1(script !== void 0 ?
|
|
56010
|
+
return findWranglerConfig$1(script !== void 0 ? path2__default.dirname(script) : process.cwd(), options);
|
|
56009
56011
|
}
|
|
56010
56012
|
__name$3(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
56011
56013
|
function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -56036,15 +56038,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
56036
56038
|
const deployConfigFile = readFileSync$1$1(deployConfigPath);
|
|
56037
56039
|
try {
|
|
56038
56040
|
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
56039
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
56041
|
+
redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
|
|
56040
56042
|
} catch (e) {
|
|
56041
|
-
throw new UserError$1(`Failed to parse the deploy configuration file at ${
|
|
56043
|
+
throw new UserError$1(`Failed to parse the deploy configuration file at ${path2__default.relative(".", deployConfigPath)}`, {
|
|
56042
56044
|
cause: e,
|
|
56043
56045
|
telemetryMessage: false
|
|
56044
56046
|
});
|
|
56045
56047
|
}
|
|
56046
56048
|
if (!redirectedConfigPath) throw new UserError$1(esm_default$1`
|
|
56047
|
-
A deploy configuration file was found at "${
|
|
56049
|
+
A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
|
|
56048
56050
|
But this is not valid - the required "configPath" property was not found.
|
|
56049
56051
|
Instead this file contains:
|
|
56050
56052
|
\`\`\`
|
|
@@ -56052,13 +56054,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
56052
56054
|
\`\`\`
|
|
56053
56055
|
`, { telemetryMessage: false });
|
|
56054
56056
|
if (!existsSync(redirectedConfigPath)) throw new UserError$1(esm_default$1`
|
|
56055
|
-
There is a deploy configuration at "${
|
|
56056
|
-
But the redirected configuration path it points to, "${
|
|
56057
|
+
There is a deploy configuration at "${path2__default.relative(".", deployConfigPath)}".
|
|
56058
|
+
But the redirected configuration path it points to, "${path2__default.relative(".", redirectedConfigPath)}", does not exist.
|
|
56057
56059
|
`, { telemetryMessage: false });
|
|
56058
56060
|
if (userConfigPath) {
|
|
56059
|
-
if (
|
|
56060
|
-
Found both a user configuration file at "${
|
|
56061
|
-
and a deploy configuration file at "${
|
|
56061
|
+
if (path2__default.join(path2__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError$1(esm_default$1`
|
|
56062
|
+
Found both a user configuration file at "${path2__default.relative(".", userConfigPath)}"
|
|
56063
|
+
and a deploy configuration file at "${path2__default.relative(".", deployConfigPath)}".
|
|
56062
56064
|
But these do not share the same base path so it is not clear which should be used.
|
|
56063
56065
|
`, { telemetryMessage: false });
|
|
56064
56066
|
}
|
|
@@ -56855,9 +56857,9 @@ async function generate({ compatibilityDate, compatibilityFlags = [] }) {
|
|
|
56855
56857
|
modules: true,
|
|
56856
56858
|
script: (await fsp.readFile(require$1.resolve("workerd/worker.mjs"))).toString()
|
|
56857
56859
|
});
|
|
56858
|
-
const path$
|
|
56860
|
+
const path$1 = `http://dummy.com/${compatibilityDate}${compatibilityFlags.length ? `+${compatibilityFlags.join("+")}` : ""}`;
|
|
56859
56861
|
try {
|
|
56860
|
-
const res = await mf.dispatchFetch(path$
|
|
56862
|
+
const res = await mf.dispatchFetch(path$1);
|
|
56861
56863
|
const text = await res.text();
|
|
56862
56864
|
if (!res.ok) throw new Error(text);
|
|
56863
56865
|
return text;
|
|
@@ -57052,8 +57054,8 @@ var __name$2 = (target$1, value) => __defProp$2(target$1, "name", {
|
|
|
57052
57054
|
value,
|
|
57053
57055
|
configurable: true
|
|
57054
57056
|
});
|
|
57055
|
-
function isDirectory(path$1
|
|
57056
|
-
return fs2.statSync(path$1
|
|
57057
|
+
function isDirectory(path$1) {
|
|
57058
|
+
return fs2.statSync(path$1, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
57057
57059
|
}
|
|
57058
57060
|
__name$2(isDirectory, "isDirectory");
|
|
57059
57061
|
function removeDir(dirPath, { fireAndForget = false } = {}) {
|
|
@@ -62363,15 +62365,15 @@ function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
62363
62365
|
function withTrailingSlash$1(input = "", respectQueryAndFragment) {
|
|
62364
62366
|
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
|
|
62365
62367
|
if (hasTrailingSlash(input, true)) return input || "/";
|
|
62366
|
-
let path$
|
|
62368
|
+
let path$1 = input;
|
|
62367
62369
|
let fragment = "";
|
|
62368
62370
|
const fragmentIndex = input.indexOf("#");
|
|
62369
62371
|
if (fragmentIndex >= 0) {
|
|
62370
|
-
path$
|
|
62372
|
+
path$1 = input.slice(0, fragmentIndex);
|
|
62371
62373
|
fragment = input.slice(fragmentIndex);
|
|
62372
|
-
if (!path$
|
|
62374
|
+
if (!path$1) return fragment;
|
|
62373
62375
|
}
|
|
62374
|
-
const [s0, ...s] = path$
|
|
62376
|
+
const [s0, ...s] = path$1.split("?");
|
|
62375
62377
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
62376
62378
|
}
|
|
62377
62379
|
function isNonEmptyURL(url$2) {
|
|
@@ -62397,8 +62399,8 @@ const isAbsolute$2 = function(p$2) {
|
|
|
62397
62399
|
//#endregion
|
|
62398
62400
|
//#region ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
|
|
62399
62401
|
const BUILTIN_MODULES = new Set(builtinModules);
|
|
62400
|
-
function normalizeSlash(path$
|
|
62401
|
-
return path$
|
|
62402
|
+
function normalizeSlash(path$1) {
|
|
62403
|
+
return path$1.replace(/\\/g, "/");
|
|
62402
62404
|
}
|
|
62403
62405
|
/**
|
|
62404
62406
|
* @typedef ErrnoExceptionFields
|
|
@@ -62518,8 +62520,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
62518
62520
|
* @param {string} [base]
|
|
62519
62521
|
* @param {string} [message]
|
|
62520
62522
|
*/
|
|
62521
|
-
(path$
|
|
62522
|
-
return `Invalid package config ${path$
|
|
62523
|
+
(path$1, base, message) => {
|
|
62524
|
+
return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
62523
62525
|
},
|
|
62524
62526
|
Error
|
|
62525
62527
|
);
|
|
@@ -62549,8 +62551,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
62549
62551
|
* @param {string} base
|
|
62550
62552
|
* @param {boolean} [exactUrl]
|
|
62551
62553
|
*/
|
|
62552
|
-
(path$
|
|
62553
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${path$
|
|
62554
|
+
(path$1, base, exactUrl = false) => {
|
|
62555
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`;
|
|
62554
62556
|
},
|
|
62555
62557
|
Error
|
|
62556
62558
|
);
|
|
@@ -62588,8 +62590,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
62588
62590
|
* @param {string} extension
|
|
62589
62591
|
* @param {string} path
|
|
62590
62592
|
*/
|
|
62591
|
-
(extension, path$
|
|
62592
|
-
return `Unknown file extension "${extension}" for ${path$
|
|
62593
|
+
(extension, path$1) => {
|
|
62594
|
+
return `Unknown file extension "${extension}" for ${path$1}`;
|
|
62593
62595
|
},
|
|
62594
62596
|
TypeError
|
|
62595
62597
|
);
|
|
@@ -62746,7 +62748,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
62746
62748
|
/** @type {string | undefined} */
|
|
62747
62749
|
let string$3;
|
|
62748
62750
|
try {
|
|
62749
|
-
string$3 = fs2.readFileSync(
|
|
62751
|
+
string$3 = fs2.readFileSync(path2__default.toNamespacedPath(jsonPath), "utf8");
|
|
62750
62752
|
} catch (error$2) {
|
|
62751
62753
|
const exception = error$2;
|
|
62752
62754
|
if (exception.code !== "ENOENT") throw exception;
|
|
@@ -62952,15 +62954,15 @@ function emitLegacyIndexDeprecation(url$2, packageJsonUrl, base, main) {
|
|
|
62952
62954
|
const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
|
|
62953
62955
|
const basePath = fileURLToPath(base);
|
|
62954
62956
|
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");
|
|
62955
|
-
else if (
|
|
62957
|
+
else if (path2__default.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");
|
|
62956
62958
|
}
|
|
62957
62959
|
/**
|
|
62958
62960
|
* @param {string} path
|
|
62959
62961
|
* @returns {Stats | undefined}
|
|
62960
62962
|
*/
|
|
62961
|
-
function tryStatSync(path$
|
|
62963
|
+
function tryStatSync(path$1) {
|
|
62962
62964
|
try {
|
|
62963
|
-
return statSync(path$
|
|
62965
|
+
return statSync(path$1);
|
|
62964
62966
|
} catch {}
|
|
62965
62967
|
}
|
|
62966
62968
|
/**
|
|
@@ -63059,7 +63061,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
63059
63061
|
{
|
|
63060
63062
|
const real = realpathSync(filePath);
|
|
63061
63063
|
const { search, hash: hash$1 } = resolved;
|
|
63062
|
-
resolved = pathToFileURL(real + (filePath.endsWith(
|
|
63064
|
+
resolved = pathToFileURL(real + (filePath.endsWith(path2__default.sep) ? "/" : ""));
|
|
63063
63065
|
resolved.search = search;
|
|
63064
63066
|
resolved.hash = hash$1;
|
|
63065
63067
|
}
|
|
@@ -65530,6 +65532,480 @@ function createModuleReference(type, id) {
|
|
|
65530
65532
|
return `__CLOUDFLARE_MODULE__${type}__${id}__CLOUDFLARE_MODULE__`;
|
|
65531
65533
|
}
|
|
65532
65534
|
|
|
65535
|
+
//#endregion
|
|
65536
|
+
//#region ../../node_modules/.pnpm/process-ancestry@0.1.0/node_modules/process-ancestry/dist/index.js
|
|
65537
|
+
function getProcessInfo(pid) {
|
|
65538
|
+
try {
|
|
65539
|
+
const output = execSync(`ps -p ${pid} -o pid=,ppid=,command=`, {
|
|
65540
|
+
encoding: "utf8",
|
|
65541
|
+
timeout: 5e3
|
|
65542
|
+
}).trim();
|
|
65543
|
+
if (!output) return null;
|
|
65544
|
+
const [pidStr, ppidStr, ...commandParts] = output.split(/\s+/);
|
|
65545
|
+
const parsedPid = pidStr ? parseInt(pidStr, 10) : NaN;
|
|
65546
|
+
const parsedPpid = ppidStr ? parseInt(ppidStr, 10) : NaN;
|
|
65547
|
+
if (isNaN(parsedPid) || isNaN(parsedPpid)) return null;
|
|
65548
|
+
return {
|
|
65549
|
+
pid: parsedPid,
|
|
65550
|
+
ppid: parsedPpid,
|
|
65551
|
+
command: commandParts.join(" ") || void 0
|
|
65552
|
+
};
|
|
65553
|
+
} catch (error$2) {
|
|
65554
|
+
if (error$2 instanceof Error && error$2.message.includes("timeout")) console.warn(`Process lookup timed out for PID ${pid}`);
|
|
65555
|
+
return null;
|
|
65556
|
+
}
|
|
65557
|
+
}
|
|
65558
|
+
function getAncestryUnix(startPid) {
|
|
65559
|
+
const result = [];
|
|
65560
|
+
const visited = /* @__PURE__ */ new Set();
|
|
65561
|
+
let currentPid = startPid;
|
|
65562
|
+
let maxDepth = 1e3;
|
|
65563
|
+
while (currentPid && maxDepth > 0) {
|
|
65564
|
+
if (visited.has(currentPid)) {
|
|
65565
|
+
console.warn(`Detected cycle in process tree at PID ${currentPid}`);
|
|
65566
|
+
break;
|
|
65567
|
+
}
|
|
65568
|
+
visited.add(currentPid);
|
|
65569
|
+
const info$1 = getProcessInfo(currentPid);
|
|
65570
|
+
if (!info$1 || info$1.ppid === 0 || info$1.ppid === 1) break;
|
|
65571
|
+
result.push(info$1);
|
|
65572
|
+
currentPid = info$1.ppid;
|
|
65573
|
+
maxDepth--;
|
|
65574
|
+
}
|
|
65575
|
+
if (maxDepth === 0) console.warn(`Reached maximum depth limit while traversing process tree from PID ${startPid}`);
|
|
65576
|
+
return result;
|
|
65577
|
+
}
|
|
65578
|
+
function getProcessInfo2(pid) {
|
|
65579
|
+
try {
|
|
65580
|
+
const output = execSync(`wmic process where (ProcessId=${pid}) get ProcessId,ParentProcessId,CommandLine /format:csv`, {
|
|
65581
|
+
encoding: "utf8",
|
|
65582
|
+
timeout: 1e4
|
|
65583
|
+
});
|
|
65584
|
+
if (!output) return null;
|
|
65585
|
+
const fields = output.split("\n").filter((line) => line.trim() && !line.startsWith("Node")).pop()?.split(",");
|
|
65586
|
+
if (!fields || fields.length < 4) return null;
|
|
65587
|
+
const [_node, commandLine, parentPid, thisPid] = fields;
|
|
65588
|
+
const parsedPid = thisPid ? parseInt(thisPid.trim(), 10) : NaN;
|
|
65589
|
+
const parsedPpid = parentPid ? parseInt(parentPid.trim(), 10) : NaN;
|
|
65590
|
+
if (isNaN(parsedPid) || isNaN(parsedPpid)) return null;
|
|
65591
|
+
return {
|
|
65592
|
+
pid: parsedPid,
|
|
65593
|
+
ppid: parsedPpid,
|
|
65594
|
+
command: commandLine?.trim() || void 0
|
|
65595
|
+
};
|
|
65596
|
+
} catch (error$2) {
|
|
65597
|
+
if (error$2 instanceof Error && error$2.message.includes("timeout")) console.warn(`Process lookup timed out for PID ${pid}`);
|
|
65598
|
+
return null;
|
|
65599
|
+
}
|
|
65600
|
+
}
|
|
65601
|
+
function getAncestryWindows(startPid) {
|
|
65602
|
+
const result = [];
|
|
65603
|
+
const visited = /* @__PURE__ */ new Set();
|
|
65604
|
+
let currentPid = startPid;
|
|
65605
|
+
let maxDepth = 1e3;
|
|
65606
|
+
while (currentPid && maxDepth > 0) {
|
|
65607
|
+
if (visited.has(currentPid)) {
|
|
65608
|
+
console.warn(`Detected cycle in process tree at PID ${currentPid}`);
|
|
65609
|
+
break;
|
|
65610
|
+
}
|
|
65611
|
+
visited.add(currentPid);
|
|
65612
|
+
const info$1 = getProcessInfo2(currentPid);
|
|
65613
|
+
if (!info$1 || info$1.ppid === 0 || info$1.ppid === 4) break;
|
|
65614
|
+
result.push(info$1);
|
|
65615
|
+
currentPid = info$1.ppid;
|
|
65616
|
+
maxDepth--;
|
|
65617
|
+
}
|
|
65618
|
+
if (maxDepth === 0) console.warn(`Reached maximum depth limit while traversing process tree from PID ${startPid}`);
|
|
65619
|
+
return result;
|
|
65620
|
+
}
|
|
65621
|
+
function getProcessAncestry(pid = process.pid) {
|
|
65622
|
+
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) throw new Error("PID must be a positive integer");
|
|
65623
|
+
if (os$1.platform() === "win32") return getAncestryWindows(pid);
|
|
65624
|
+
else return getAncestryUnix(pid);
|
|
65625
|
+
}
|
|
65626
|
+
|
|
65627
|
+
//#endregion
|
|
65628
|
+
//#region ../../node_modules/.pnpm/am-i-vibing@0.5.0/node_modules/am-i-vibing/dist/detector-1yx2Hoe0.mjs
|
|
65629
|
+
/**
|
|
65630
|
+
* Provider configurations for major AI coding tools
|
|
65631
|
+
*/
|
|
65632
|
+
const providers = [
|
|
65633
|
+
{
|
|
65634
|
+
id: "opencode",
|
|
65635
|
+
name: "OpenCode",
|
|
65636
|
+
type: "agent",
|
|
65637
|
+
envVars: [{ any: [
|
|
65638
|
+
"OPENCODE",
|
|
65639
|
+
"OPENCODE_BIN_PATH",
|
|
65640
|
+
"OPENCODE_SERVER",
|
|
65641
|
+
"OPENCODE_APP_INFO",
|
|
65642
|
+
"OPENCODE_MODES"
|
|
65643
|
+
] }]
|
|
65644
|
+
},
|
|
65645
|
+
{
|
|
65646
|
+
id: "jules",
|
|
65647
|
+
name: "Jules",
|
|
65648
|
+
type: "agent",
|
|
65649
|
+
envVars: [{ all: [["HOME", "/home/jules"], ["USER", "swebot"]] }]
|
|
65650
|
+
},
|
|
65651
|
+
{
|
|
65652
|
+
id: "claude-code",
|
|
65653
|
+
name: "Claude Code",
|
|
65654
|
+
type: "agent",
|
|
65655
|
+
envVars: ["CLAUDECODE"]
|
|
65656
|
+
},
|
|
65657
|
+
{
|
|
65658
|
+
id: "cursor-agent",
|
|
65659
|
+
name: "Cursor Agent",
|
|
65660
|
+
type: "agent",
|
|
65661
|
+
envVars: [{ all: ["CURSOR_TRACE_ID", ["PAGER", "head -n 10000 | cat"]] }]
|
|
65662
|
+
},
|
|
65663
|
+
{
|
|
65664
|
+
id: "cursor",
|
|
65665
|
+
name: "Cursor",
|
|
65666
|
+
type: "interactive",
|
|
65667
|
+
envVars: ["CURSOR_TRACE_ID"]
|
|
65668
|
+
},
|
|
65669
|
+
{
|
|
65670
|
+
id: "antigravity",
|
|
65671
|
+
name: "Antigravity",
|
|
65672
|
+
type: "agent",
|
|
65673
|
+
envVars: [{ any: ["ANTIGRAVITY_AGENT", "ANTIGRAVITY_PROJECT_ID"] }]
|
|
65674
|
+
},
|
|
65675
|
+
{
|
|
65676
|
+
id: "gemini-agent",
|
|
65677
|
+
name: "Gemini CLI",
|
|
65678
|
+
type: "agent",
|
|
65679
|
+
envVars: [["GEMINI_CLI", "1"]],
|
|
65680
|
+
processChecks: ["gemini"]
|
|
65681
|
+
},
|
|
65682
|
+
{
|
|
65683
|
+
id: "codex",
|
|
65684
|
+
name: "OpenAI Codex",
|
|
65685
|
+
type: "agent",
|
|
65686
|
+
envVars: ["CODEX_THREAD_ID"],
|
|
65687
|
+
processChecks: ["codex"]
|
|
65688
|
+
},
|
|
65689
|
+
{
|
|
65690
|
+
id: "replit",
|
|
65691
|
+
name: "Replit",
|
|
65692
|
+
type: "agent",
|
|
65693
|
+
envVars: ["REPL_ID"]
|
|
65694
|
+
},
|
|
65695
|
+
{
|
|
65696
|
+
id: "aider",
|
|
65697
|
+
name: "Aider",
|
|
65698
|
+
type: "agent",
|
|
65699
|
+
envVars: ["AIDER_API_KEY"],
|
|
65700
|
+
processChecks: ["aider"]
|
|
65701
|
+
},
|
|
65702
|
+
{
|
|
65703
|
+
id: "bolt-agent",
|
|
65704
|
+
name: "Bolt.new Agent",
|
|
65705
|
+
type: "agent",
|
|
65706
|
+
envVars: [{ all: [["SHELL", "/bin/jsh"], "npm_config_yes"] }]
|
|
65707
|
+
},
|
|
65708
|
+
{
|
|
65709
|
+
id: "bolt",
|
|
65710
|
+
name: "Bolt.new",
|
|
65711
|
+
type: "interactive",
|
|
65712
|
+
envVars: [{
|
|
65713
|
+
all: [["SHELL", "/bin/jsh"]],
|
|
65714
|
+
none: ["npm_config_yes"]
|
|
65715
|
+
}]
|
|
65716
|
+
},
|
|
65717
|
+
{
|
|
65718
|
+
id: "zed-agent",
|
|
65719
|
+
name: "Zed Agent",
|
|
65720
|
+
type: "agent",
|
|
65721
|
+
envVars: [{ all: [["TERM_PROGRAM", "zed"], ["PAGER", "cat"]] }]
|
|
65722
|
+
},
|
|
65723
|
+
{
|
|
65724
|
+
id: "zed",
|
|
65725
|
+
name: "Zed",
|
|
65726
|
+
type: "interactive",
|
|
65727
|
+
envVars: [{
|
|
65728
|
+
all: [["TERM_PROGRAM", "zed"]],
|
|
65729
|
+
none: [["PAGER", "cat"]]
|
|
65730
|
+
}]
|
|
65731
|
+
},
|
|
65732
|
+
{
|
|
65733
|
+
id: "replit-assistant",
|
|
65734
|
+
name: "Replit Assistant",
|
|
65735
|
+
type: "agent",
|
|
65736
|
+
envVars: [{ all: ["REPL_ID", ["REPLIT_MODE", "assistant"]] }]
|
|
65737
|
+
},
|
|
65738
|
+
{
|
|
65739
|
+
id: "replit",
|
|
65740
|
+
name: "Replit",
|
|
65741
|
+
type: "interactive",
|
|
65742
|
+
envVars: [{
|
|
65743
|
+
all: ["REPL_ID"],
|
|
65744
|
+
none: [["REPLIT_MODE", "assistant"]]
|
|
65745
|
+
}]
|
|
65746
|
+
},
|
|
65747
|
+
{
|
|
65748
|
+
id: "windsurf",
|
|
65749
|
+
name: "Windsurf",
|
|
65750
|
+
type: "agent",
|
|
65751
|
+
envVars: ["CODEIUM_EDITOR_APP_ROOT"]
|
|
65752
|
+
},
|
|
65753
|
+
{
|
|
65754
|
+
id: "crush",
|
|
65755
|
+
name: "Crush",
|
|
65756
|
+
type: "agent",
|
|
65757
|
+
envVars: [{ any: [
|
|
65758
|
+
["CRUSH", "1"],
|
|
65759
|
+
["AGENT", "crush"],
|
|
65760
|
+
["AI_AGENT", "crush"]
|
|
65761
|
+
] }],
|
|
65762
|
+
processChecks: ["crush"]
|
|
65763
|
+
},
|
|
65764
|
+
{
|
|
65765
|
+
id: "amp",
|
|
65766
|
+
name: "Amp",
|
|
65767
|
+
type: "agent",
|
|
65768
|
+
envVars: [{ any: ["AMP_CURRENT_THREAD_ID", ["AGENT", "amp"]] }]
|
|
65769
|
+
},
|
|
65770
|
+
{
|
|
65771
|
+
id: "auggie",
|
|
65772
|
+
name: "Auggie",
|
|
65773
|
+
type: "agent",
|
|
65774
|
+
envVars: [["AUGMENT_AGENT", "1"]]
|
|
65775
|
+
},
|
|
65776
|
+
{
|
|
65777
|
+
id: "qwen-code",
|
|
65778
|
+
name: "Qwen Code",
|
|
65779
|
+
type: "agent",
|
|
65780
|
+
envVars: [["QWEN_CODE", "1"]]
|
|
65781
|
+
},
|
|
65782
|
+
{
|
|
65783
|
+
id: "vscode-copilot-agent",
|
|
65784
|
+
name: "GitHub Copilot in VS Code",
|
|
65785
|
+
type: "agent",
|
|
65786
|
+
envVars: [{ all: [["TERM_PROGRAM", "vscode"], ["GIT_PAGER", "cat"]] }]
|
|
65787
|
+
},
|
|
65788
|
+
{
|
|
65789
|
+
id: "warp",
|
|
65790
|
+
name: "Warp Terminal",
|
|
65791
|
+
type: "hybrid",
|
|
65792
|
+
envVars: [{ all: [["TERM_PROGRAM", "WarpTerminal"]] }]
|
|
65793
|
+
},
|
|
65794
|
+
{
|
|
65795
|
+
id: "octofriend",
|
|
65796
|
+
name: "Octofriend",
|
|
65797
|
+
type: "agent",
|
|
65798
|
+
processChecks: ["octofriend"]
|
|
65799
|
+
},
|
|
65800
|
+
{
|
|
65801
|
+
id: "devin",
|
|
65802
|
+
name: "Devin",
|
|
65803
|
+
type: "agent",
|
|
65804
|
+
processChecks: ["devin"]
|
|
65805
|
+
},
|
|
65806
|
+
{
|
|
65807
|
+
id: "droid",
|
|
65808
|
+
name: "Factory Droid",
|
|
65809
|
+
type: "agent",
|
|
65810
|
+
processChecks: ["droid"]
|
|
65811
|
+
},
|
|
65812
|
+
{
|
|
65813
|
+
id: "pi",
|
|
65814
|
+
name: "Pi",
|
|
65815
|
+
type: "agent",
|
|
65816
|
+
envVars: [["PI_CODING_AGENT", "true"]]
|
|
65817
|
+
}
|
|
65818
|
+
];
|
|
65819
|
+
/**
|
|
65820
|
+
* Check if a specific environment variable exists (handles both strings and tuples)
|
|
65821
|
+
*/
|
|
65822
|
+
function checkEnvVar(envVarDef, env$3 = process.env) {
|
|
65823
|
+
const [envVar, expectedValue] = typeof envVarDef === "string" ? [envVarDef, void 0] : envVarDef;
|
|
65824
|
+
const actualValue = env$3[envVar];
|
|
65825
|
+
return Boolean(actualValue && (!expectedValue || actualValue === expectedValue));
|
|
65826
|
+
}
|
|
65827
|
+
/**
|
|
65828
|
+
* Check if a process is running in the process tree
|
|
65829
|
+
*/
|
|
65830
|
+
function checkProcess(processName, processAncestry) {
|
|
65831
|
+
for (const ancestorProcess of processAncestry) if (ancestorProcess.command?.includes(processName)) return true;
|
|
65832
|
+
return false;
|
|
65833
|
+
}
|
|
65834
|
+
/**
|
|
65835
|
+
* Check if an environment variable group matches based on its properties
|
|
65836
|
+
*/
|
|
65837
|
+
function checkEnvVars(definition, env$3 = process.env) {
|
|
65838
|
+
if (typeof definition === "string" || Array.isArray(definition)) return checkEnvVar(definition, env$3);
|
|
65839
|
+
const { any: any$1, all: all$1, none } = definition;
|
|
65840
|
+
const anyResult = !any$1?.length || any$1.some((envVar) => checkEnvVar(envVar, env$3));
|
|
65841
|
+
const allResult = !all$1?.length || all$1.every((envVar) => checkEnvVar(envVar, env$3));
|
|
65842
|
+
const noneResult = !none?.length || !none.some((envVar) => checkEnvVar(envVar, env$3));
|
|
65843
|
+
return anyResult && allResult && noneResult;
|
|
65844
|
+
}
|
|
65845
|
+
/**
|
|
65846
|
+
* Run custom detectors for a provider
|
|
65847
|
+
*/
|
|
65848
|
+
function runCustomDetectors(provider) {
|
|
65849
|
+
return provider.customDetectors?.some((detector) => {
|
|
65850
|
+
try {
|
|
65851
|
+
return detector();
|
|
65852
|
+
} catch {
|
|
65853
|
+
return false;
|
|
65854
|
+
}
|
|
65855
|
+
}) ?? false;
|
|
65856
|
+
}
|
|
65857
|
+
/**
|
|
65858
|
+
* Create a positive detection result
|
|
65859
|
+
*/
|
|
65860
|
+
function createDetectedResult(provider) {
|
|
65861
|
+
return {
|
|
65862
|
+
isAgentic: true,
|
|
65863
|
+
id: provider.id,
|
|
65864
|
+
name: provider.name,
|
|
65865
|
+
type: provider.type
|
|
65866
|
+
};
|
|
65867
|
+
}
|
|
65868
|
+
/**
|
|
65869
|
+
* Normalize the various supported argument shapes into a DetectOptions object.
|
|
65870
|
+
*
|
|
65871
|
+
* Supported shapes:
|
|
65872
|
+
* - detectAgenticEnvironment()
|
|
65873
|
+
* - detectAgenticEnvironment(options)
|
|
65874
|
+
* - detectAgenticEnvironment(env) // legacy
|
|
65875
|
+
* - detectAgenticEnvironment(env, processAncestry) // legacy
|
|
65876
|
+
*/
|
|
65877
|
+
function normalizeOptions(envOrOptions, legacyAncestry) {
|
|
65878
|
+
if (envOrOptions != null && typeof envOrOptions === "object" && ("env" in envOrOptions || "processAncestry" in envOrOptions || "checkProcesses" in envOrOptions)) {
|
|
65879
|
+
const opts = envOrOptions;
|
|
65880
|
+
return {
|
|
65881
|
+
env: opts.env ?? process.env,
|
|
65882
|
+
processAncestry: opts.processAncestry,
|
|
65883
|
+
checkProcesses: opts.checkProcesses ?? opts.processAncestry !== void 0
|
|
65884
|
+
};
|
|
65885
|
+
}
|
|
65886
|
+
return {
|
|
65887
|
+
env: envOrOptions ?? process.env,
|
|
65888
|
+
processAncestry: legacyAncestry,
|
|
65889
|
+
checkProcesses: legacyAncestry !== void 0
|
|
65890
|
+
};
|
|
65891
|
+
}
|
|
65892
|
+
function detectAgenticEnvironment(envOrOptions, legacyAncestry) {
|
|
65893
|
+
const { env: env$3, processAncestry, checkProcesses } = normalizeOptions(envOrOptions, legacyAncestry);
|
|
65894
|
+
for (const provider of providers) if (provider.envVars?.some((group) => checkEnvVars(group, env$3))) return createDetectedResult(provider);
|
|
65895
|
+
for (const provider of providers) if (runCustomDetectors(provider)) return createDetectedResult(provider);
|
|
65896
|
+
if (checkProcesses) {
|
|
65897
|
+
let cachedAncestry = processAncestry;
|
|
65898
|
+
const getAncestry = () => {
|
|
65899
|
+
if (cachedAncestry === void 0) try {
|
|
65900
|
+
cachedAncestry = getProcessAncestry();
|
|
65901
|
+
} catch {
|
|
65902
|
+
cachedAncestry = [];
|
|
65903
|
+
}
|
|
65904
|
+
return cachedAncestry;
|
|
65905
|
+
};
|
|
65906
|
+
for (const provider of providers) if (provider.processChecks?.some((processName) => checkProcess(processName, getAncestry()))) return createDetectedResult(provider);
|
|
65907
|
+
}
|
|
65908
|
+
return {
|
|
65909
|
+
isAgentic: false,
|
|
65910
|
+
id: null,
|
|
65911
|
+
name: null,
|
|
65912
|
+
type: null
|
|
65913
|
+
};
|
|
65914
|
+
}
|
|
65915
|
+
|
|
65916
|
+
//#endregion
|
|
65917
|
+
//#region src/detect-agent.ts
|
|
65918
|
+
const NO_PROCESS_ANCESTRY = [];
|
|
65919
|
+
/**
|
|
65920
|
+
* Detects whether the current process is being driven by an AI coding agent.
|
|
65921
|
+
*
|
|
65922
|
+
* True only when the detected type is exactly `"agent"`. Hybrid terminals (Warp,
|
|
65923
|
+
* VS Code) embed agentic features but still have a human at the keyboard, so
|
|
65924
|
+
* they're treated as interactive — note `isAgent()` from the library would
|
|
65925
|
+
* report them as agents.
|
|
65926
|
+
*
|
|
65927
|
+
* Any error resolves to `false` rather than propagating.
|
|
65928
|
+
*/
|
|
65929
|
+
function isAgentSession() {
|
|
65930
|
+
try {
|
|
65931
|
+
return detectAgenticEnvironment({
|
|
65932
|
+
env: process.env,
|
|
65933
|
+
processAncestry: NO_PROCESS_ANCESTRY
|
|
65934
|
+
}).type === "agent";
|
|
65935
|
+
} catch {
|
|
65936
|
+
return false;
|
|
65937
|
+
}
|
|
65938
|
+
}
|
|
65939
|
+
|
|
65940
|
+
//#endregion
|
|
65941
|
+
//#region src/plugins/agent-hint.ts
|
|
65942
|
+
/**
|
|
65943
|
+
* Plugin that prints the Local Explorer API URL and useful routes when
|
|
65944
|
+
* the dev server is started by a headless AI agent. This allows agents
|
|
65945
|
+
* to discover and call the Local Explorer API programmatically.
|
|
65946
|
+
*
|
|
65947
|
+
* The hint is printed by patching `server.bindCLIShortcuts` so it
|
|
65948
|
+
* appears after both the server URLs and the keyboard shortcut hints.
|
|
65949
|
+
*/
|
|
65950
|
+
const agentHintPlugin = createPlugin("agent-hint", () => {
|
|
65951
|
+
return {
|
|
65952
|
+
configureServer(viteDevServer) {
|
|
65953
|
+
maybeAddAgentHint(viteDevServer, "dev");
|
|
65954
|
+
},
|
|
65955
|
+
configurePreviewServer(vitePreviewServer) {
|
|
65956
|
+
maybeAddAgentHint(vitePreviewServer, "preview");
|
|
65957
|
+
}
|
|
65958
|
+
};
|
|
65959
|
+
});
|
|
65960
|
+
/**
|
|
65961
|
+
* If the session is a headless AI agent with Local Explorer enabled,
|
|
65962
|
+
* patches `server.bindCLIShortcuts` to print the explorer API hint
|
|
65963
|
+
* after the shortcut hints have been printed.
|
|
65964
|
+
*
|
|
65965
|
+
* @param server - The Vite dev or preview server
|
|
65966
|
+
* @param mode - Whether this is a "dev" or "preview" session
|
|
65967
|
+
*/
|
|
65968
|
+
function maybeAddAgentHint(server, mode) {
|
|
65969
|
+
if (process.stdin.isTTY || !getLocalExplorerEnabledFromEnv() || !isAgentSession()) return;
|
|
65970
|
+
const originalBindCLIShortcuts = server.bindCLIShortcuts.bind(server);
|
|
65971
|
+
server.bindCLIShortcuts = (options) => {
|
|
65972
|
+
originalBindCLIShortcuts(options);
|
|
65973
|
+
if (options?.print) printLocalExplorerAgentHint(server, mode);
|
|
65974
|
+
};
|
|
65975
|
+
}
|
|
65976
|
+
/**
|
|
65977
|
+
* Prints the Local Explorer API URL and useful routes to stdout so that
|
|
65978
|
+
* headless AI agents can discover and call them programmatically.
|
|
65979
|
+
*
|
|
65980
|
+
* Keep the message in sync with the wrangler copy in
|
|
65981
|
+
* packages/wrangler/src/dev/start-dev.ts.
|
|
65982
|
+
*
|
|
65983
|
+
* @param server - The Vite dev or preview server (must have `resolvedUrls` populated)
|
|
65984
|
+
* @param mode - Whether this is a "dev" or "preview" session
|
|
65985
|
+
*/
|
|
65986
|
+
function printLocalExplorerAgentHint(server, mode) {
|
|
65987
|
+
const url$2 = server.resolvedUrls?.local[0];
|
|
65988
|
+
if (!url$2) return;
|
|
65989
|
+
const explorerApiUrl = new URL(`${CorePaths.EXPLORER}/api`, url$2).href;
|
|
65990
|
+
server.config.logger.info([
|
|
65991
|
+
"",
|
|
65992
|
+
`The Cloudflare Vite plugin detected this ${mode} session is running in an AI agent.`,
|
|
65993
|
+
`The Local Explorer API is available at ${explorerApiUrl}`,
|
|
65994
|
+
`Useful routes:`,
|
|
65995
|
+
` GET ${explorerApiUrl}/local/workers - local Workers and bindings`,
|
|
65996
|
+
` GET ${explorerApiUrl}/storage/kv/namespaces - KV namespaces`,
|
|
65997
|
+
` GET ${explorerApiUrl}/d1/database - D1 databases`,
|
|
65998
|
+
` GET ${explorerApiUrl}/r2/buckets - R2 buckets`,
|
|
65999
|
+
` GET ${explorerApiUrl}/workers/durable_objects/namespaces - Durable Object namespaces`,
|
|
66000
|
+
` GET ${explorerApiUrl}/workflows - Workflows`,
|
|
66001
|
+
` POST ${explorerApiUrl}/local/observability/query - run a read-only SQL query (SELECT/WITH only) over captured request traces and console logs. Tables: spans, logs (read attributes via json(attributes)). Example:`,
|
|
66002
|
+
` curl -X POST ${explorerApiUrl}/local/observability/query -H 'Content-Type: application/json' -d '{"sql":"SELECT service, name, outcome, duration_ms FROM spans WHERE parent_id IS NULL LIMIT 20"}'`,
|
|
66003
|
+
`If the routes above don't cover what you need, fetch the full OpenAPI schema (large - use only as a last resort):`,
|
|
66004
|
+
` GET ${explorerApiUrl} - OpenAPI schema`,
|
|
66005
|
+
""
|
|
66006
|
+
].join("\n"));
|
|
66007
|
+
}
|
|
66008
|
+
|
|
65533
66009
|
//#endregion
|
|
65534
66010
|
//#region src/cloudflare-environment.ts
|
|
65535
66011
|
const MAIN_ENTRY_NAME = "index";
|
|
@@ -65891,9 +66367,9 @@ function constructHeaders({ headers, headersFile, logger: logger$1 }) {
|
|
|
65891
66367
|
|
|
65892
66368
|
//#endregion
|
|
65893
66369
|
//#region ../workers-shared/utils/configuration/validateURL.ts
|
|
65894
|
-
const extractPathname = (path$
|
|
65895
|
-
if (!path$
|
|
65896
|
-
const url$2 = new URL(`//${path$
|
|
66370
|
+
const extractPathname = (path$1 = "/", includeSearch, includeHash) => {
|
|
66371
|
+
if (!path$1.startsWith("/")) path$1 = `/${path$1}`;
|
|
66372
|
+
const url$2 = new URL(`//${path$1}`, "relative://");
|
|
65897
66373
|
return `${url$2.pathname}${includeSearch ? url$2.search : ""}${includeHash ? url$2.hash : ""}`;
|
|
65898
66374
|
};
|
|
65899
66375
|
const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
|
|
@@ -65952,7 +66428,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
65952
66428
|
lineNumber: i$1 + 1,
|
|
65953
66429
|
message: "No headers specified"
|
|
65954
66430
|
});
|
|
65955
|
-
const [path$
|
|
66431
|
+
const [path$1, pathError] = validateUrl(line, false, true);
|
|
65956
66432
|
if (pathError) {
|
|
65957
66433
|
invalid.push({
|
|
65958
66434
|
line,
|
|
@@ -65963,7 +66439,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
65963
66439
|
skipUntilNextPath = true;
|
|
65964
66440
|
continue;
|
|
65965
66441
|
}
|
|
65966
|
-
const wildcardError = validateNoMultipleWildcards(path$
|
|
66442
|
+
const wildcardError = validateNoMultipleWildcards(path$1);
|
|
65967
66443
|
if (wildcardError) {
|
|
65968
66444
|
invalid.push({
|
|
65969
66445
|
line,
|
|
@@ -65975,7 +66451,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
65975
66451
|
continue;
|
|
65976
66452
|
}
|
|
65977
66453
|
rule = {
|
|
65978
|
-
path: path$
|
|
66454
|
+
path: path$1,
|
|
65979
66455
|
line,
|
|
65980
66456
|
headers: {},
|
|
65981
66457
|
unsetHeaders: []
|
|
@@ -66058,11 +66534,11 @@ function isValidRule(rule) {
|
|
|
66058
66534
|
* `:splat` placeholder, would result in duplicate `:splat` parameters which is
|
|
66059
66535
|
* unsupported.
|
|
66060
66536
|
*/
|
|
66061
|
-
function validateNoMultipleWildcards(path$
|
|
66062
|
-
const wildcardCount = (path$
|
|
66063
|
-
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$
|
|
66064
|
-
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$
|
|
66065
|
-
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$
|
|
66537
|
+
function validateNoMultipleWildcards(path$1) {
|
|
66538
|
+
const wildcardCount = (path$1.match(SPLAT_REGEX) ?? []).length;
|
|
66539
|
+
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$1);
|
|
66540
|
+
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$1}.`;
|
|
66541
|
+
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$1}.`;
|
|
66066
66542
|
}
|
|
66067
66543
|
|
|
66068
66544
|
//#endregion
|
|
@@ -66279,13 +66755,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
66279
66755
|
const throwError = (message, Ctor) => {
|
|
66280
66756
|
throw new Ctor(message);
|
|
66281
66757
|
};
|
|
66282
|
-
const checkPath = (path$
|
|
66283
|
-
if (!isString$1(path$
|
|
66284
|
-
if (!path$
|
|
66285
|
-
if (checkPath.isNotRelative(path$
|
|
66758
|
+
const checkPath = (path$1, originalPath, doThrow) => {
|
|
66759
|
+
if (!isString$1(path$1)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
66760
|
+
if (!path$1) return doThrow(`path must not be empty`, TypeError);
|
|
66761
|
+
if (checkPath.isNotRelative(path$1)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
|
|
66286
66762
|
return true;
|
|
66287
66763
|
};
|
|
66288
|
-
const isNotRelative = (path$
|
|
66764
|
+
const isNotRelative = (path$1) => REGEX_TEST_INVALID_PATH.test(path$1);
|
|
66289
66765
|
checkPath.isNotRelative = isNotRelative;
|
|
66290
66766
|
checkPath.convert = (p$2) => p$2;
|
|
66291
66767
|
var Ignore = class {
|
|
@@ -66321,13 +66797,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
66321
66797
|
addPattern(pattern) {
|
|
66322
66798
|
return this.add(pattern);
|
|
66323
66799
|
}
|
|
66324
|
-
_testOne(path$
|
|
66800
|
+
_testOne(path$1, checkUnignored) {
|
|
66325
66801
|
let ignored = false;
|
|
66326
66802
|
let unignored = false;
|
|
66327
66803
|
this._rules.forEach((rule) => {
|
|
66328
66804
|
const { negative } = rule;
|
|
66329
66805
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
|
|
66330
|
-
if (rule.regex.test(path$
|
|
66806
|
+
if (rule.regex.test(path$1)) {
|
|
66331
66807
|
ignored = !negative;
|
|
66332
66808
|
unignored = negative;
|
|
66333
66809
|
}
|
|
@@ -66338,33 +66814,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
66338
66814
|
};
|
|
66339
66815
|
}
|
|
66340
66816
|
_test(originalPath, cache$2, checkUnignored, slices) {
|
|
66341
|
-
const path$
|
|
66342
|
-
checkPath(path$
|
|
66343
|
-
return this._t(path$
|
|
66817
|
+
const path$1 = originalPath && checkPath.convert(originalPath);
|
|
66818
|
+
checkPath(path$1, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
66819
|
+
return this._t(path$1, cache$2, checkUnignored, slices);
|
|
66344
66820
|
}
|
|
66345
|
-
_t(path$
|
|
66346
|
-
if (path$
|
|
66347
|
-
if (!slices) slices = path$
|
|
66821
|
+
_t(path$1, cache$2, checkUnignored, slices) {
|
|
66822
|
+
if (path$1 in cache$2) return cache$2[path$1];
|
|
66823
|
+
if (!slices) slices = path$1.split(SLASH);
|
|
66348
66824
|
slices.pop();
|
|
66349
|
-
if (!slices.length) return cache$2[path$
|
|
66825
|
+
if (!slices.length) return cache$2[path$1] = this._testOne(path$1, checkUnignored);
|
|
66350
66826
|
const parent = this._t(slices.join(SLASH) + SLASH, cache$2, checkUnignored, slices);
|
|
66351
|
-
return cache$2[path$
|
|
66827
|
+
return cache$2[path$1] = parent.ignored ? parent : this._testOne(path$1, checkUnignored);
|
|
66352
66828
|
}
|
|
66353
|
-
ignores(path$
|
|
66354
|
-
return this._test(path$
|
|
66829
|
+
ignores(path$1) {
|
|
66830
|
+
return this._test(path$1, this._ignoreCache, false).ignored;
|
|
66355
66831
|
}
|
|
66356
66832
|
createFilter() {
|
|
66357
|
-
return (path$
|
|
66833
|
+
return (path$1) => !this.ignores(path$1);
|
|
66358
66834
|
}
|
|
66359
66835
|
filter(paths) {
|
|
66360
66836
|
return makeArray(paths).filter(this.createFilter());
|
|
66361
66837
|
}
|
|
66362
|
-
test(path$
|
|
66363
|
-
return this._test(path$
|
|
66838
|
+
test(path$1) {
|
|
66839
|
+
return this._test(path$1, this._testCache, true);
|
|
66364
66840
|
}
|
|
66365
66841
|
};
|
|
66366
66842
|
const factory = (options) => new Ignore(options);
|
|
66367
|
-
const isPathValid = (path$
|
|
66843
|
+
const isPathValid = (path$1) => checkPath(path$1 && checkPath.convert(path$1), path$1, RETURN_FALSE);
|
|
66368
66844
|
factory.isPathValid = isPathValid;
|
|
66369
66845
|
factory.default = factory;
|
|
66370
66846
|
module.exports = factory;
|
|
@@ -66373,7 +66849,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/ig
|
|
|
66373
66849
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
66374
66850
|
checkPath.convert = makePosix;
|
|
66375
66851
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
66376
|
-
checkPath.isNotRelative = (path$
|
|
66852
|
+
checkPath.isNotRelative = (path$1) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$1) || isNotRelative(path$1);
|
|
66377
66853
|
}
|
|
66378
66854
|
}) });
|
|
66379
66855
|
|
|
@@ -67728,11 +68204,11 @@ var Mime = class {
|
|
|
67728
68204
|
}
|
|
67729
68205
|
return this;
|
|
67730
68206
|
}
|
|
67731
|
-
getType(path$
|
|
67732
|
-
if (typeof path$
|
|
67733
|
-
const last = path$
|
|
68207
|
+
getType(path$1) {
|
|
68208
|
+
if (typeof path$1 !== "string") return null;
|
|
68209
|
+
const last = path$1.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
67734
68210
|
const ext = last.replace(/^.*\./s, "").toLowerCase();
|
|
67735
|
-
const hasPath = last.length < path$
|
|
68211
|
+
const hasPath = last.length < path$1.length;
|
|
67736
68212
|
if (!(ext.length < last.length - 1) && hasPath) return null;
|
|
67737
68213
|
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
67738
68214
|
}
|
|
@@ -68505,11 +68981,11 @@ const getQueryString = (params) => {
|
|
|
68505
68981
|
};
|
|
68506
68982
|
const getUrl = (config$2, options) => {
|
|
68507
68983
|
const encoder$1 = config$2.ENCODE_PATH || encodeURI;
|
|
68508
|
-
const path$
|
|
68984
|
+
const path$1 = options.url.replace("{api-version}", config$2.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
68509
68985
|
if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
|
|
68510
68986
|
return substring;
|
|
68511
68987
|
});
|
|
68512
|
-
const url$2 = `${config$2.BASE}${path$
|
|
68988
|
+
const url$2 = `${config$2.BASE}${path$1}`;
|
|
68513
68989
|
if (options.query) return `${url$2}${getQueryString(options.query)}`;
|
|
68514
68990
|
return url$2;
|
|
68515
68991
|
};
|
|
@@ -69607,7 +70083,7 @@ function getContainerOptions(options) {
|
|
|
69607
70083
|
return containersConfig.map((container) => {
|
|
69608
70084
|
if (isDockerfile(container.image, configPath)) return {
|
|
69609
70085
|
dockerfile: container.image,
|
|
69610
|
-
image_build_context: container.image_build_context ??
|
|
70086
|
+
image_build_context: container.image_build_context ?? path2__default.dirname(container.image),
|
|
69611
70087
|
image_vars: container.image_vars,
|
|
69612
70088
|
class_name: container.class_name,
|
|
69613
70089
|
image_tag: getDevContainerImageName(container.class_name, containerBuildId)
|
|
@@ -72443,7 +72919,7 @@ var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
|
|
|
72443
72919
|
});
|
|
72444
72920
|
|
|
72445
72921
|
//#endregion
|
|
72446
|
-
//#region ../workers-auth/dist/chunk-
|
|
72922
|
+
//#region ../workers-auth/dist/chunk-7AYQ2BAF.mjs
|
|
72447
72923
|
var import_undici$2 = require_undici();
|
|
72448
72924
|
var hasWarnedAboutDeprecatedV1ApiToken = false;
|
|
72449
72925
|
function readStoredAuthState(options) {
|
|
@@ -72544,6 +73020,11 @@ function getCloudflareAccountIdFromEnv() {
|
|
|
72544
73020
|
return validateAccountId(accountId, "set in the `CLOUDFLARE_ACCOUNT_ID` environment variable");
|
|
72545
73021
|
}
|
|
72546
73022
|
__name$1(getCloudflareAccountIdFromEnv, "getCloudflareAccountIdFromEnv");
|
|
73023
|
+
var DEVICE_AUTH_PATH = "/oauth2/device/auth";
|
|
73024
|
+
function getDeviceAuthUrl() {
|
|
73025
|
+
return `https://${getAuthDomainFromEnv()}${DEVICE_AUTH_PATH}`;
|
|
73026
|
+
}
|
|
73027
|
+
__name$1(getDeviceAuthUrl, "getDeviceAuthUrl");
|
|
72547
73028
|
var getAccessClientIdFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_ID" });
|
|
72548
73029
|
var getAccessClientSecretFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_SECRET" });
|
|
72549
73030
|
var getCfAuthorizationTokenFromEnv = getEnvironmentVariableFactory({ variableName: "WRANGLER_CF_AUTHORIZATION_TOKEN" });
|
|
@@ -72689,6 +73170,26 @@ async function generatePKCECodes() {
|
|
|
72689
73170
|
};
|
|
72690
73171
|
}
|
|
72691
73172
|
__name$1(generatePKCECodes, "generatePKCECodes");
|
|
73173
|
+
var generateVerificationUrl = /* @__PURE__ */ __name$1(({ verificationUri, userCode }) => {
|
|
73174
|
+
const url2 = new URL(verificationUri);
|
|
73175
|
+
url2.searchParams.set("user_code", userCode);
|
|
73176
|
+
return url2.toString();
|
|
73177
|
+
}, "generateVerificationUrl");
|
|
73178
|
+
function parseUrl(value) {
|
|
73179
|
+
try {
|
|
73180
|
+
return new URL(value);
|
|
73181
|
+
} catch {
|
|
73182
|
+
return;
|
|
73183
|
+
}
|
|
73184
|
+
}
|
|
73185
|
+
__name$1(parseUrl, "parseUrl");
|
|
73186
|
+
function assertTrustedVerificationUrl(verificationUrl, options) {
|
|
73187
|
+
const url2 = parseUrl(verificationUrl);
|
|
73188
|
+
const expected = parseUrl(`https://${options.authDomain}`);
|
|
73189
|
+
if (!(url2 !== void 0 && expected !== void 0 && url2.protocol === "https:" && url2.username === "" && url2.password === "" && url2.host === expected.host)) throw new UserError(`The authorization server returned an untrusted \`${options.field}\`: ${verificationUrl}
|
|
73190
|
+
Expected an \`https\` URL on \`${options.authDomain}\`. Refusing to display or open it.`, { telemetryMessage: "user device-flow untrusted verification url" });
|
|
73191
|
+
}
|
|
73192
|
+
__name$1(assertTrustedVerificationUrl, "assertTrustedVerificationUrl");
|
|
72692
73193
|
var generateAuthUrl = /* @__PURE__ */ __name$1(({ authUrl, clientId, scopes, stateQueryParam, codeChallenge, redirectUri }) => {
|
|
72693
73194
|
return authUrl + `?response_type=code&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent([...scopes, "offline_access"].join(" "))}&state=${stateQueryParam}&code_challenge=${encodeURIComponent(codeChallenge)}&code_challenge_method=S256`;
|
|
72694
73195
|
}, "generateAuthUrl");
|
|
@@ -73342,6 +73843,228 @@ If you have changed the callback host or port because you are running in a conta
|
|
|
73342
73843
|
return Promise.race([timerPromise, loginPromise]);
|
|
73343
73844
|
}
|
|
73344
73845
|
__name$1(getOauthToken, "getOauthToken");
|
|
73846
|
+
var DEVICE_FLOW_MAX_DURATION_SECONDS = 300;
|
|
73847
|
+
var DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS = 1;
|
|
73848
|
+
function getStringMember(body, key) {
|
|
73849
|
+
if (typeof body !== "object" || body === null) return;
|
|
73850
|
+
const value = body[key];
|
|
73851
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
73852
|
+
}
|
|
73853
|
+
__name$1(getStringMember, "getStringMember");
|
|
73854
|
+
function getPositiveNumberMember(body, key) {
|
|
73855
|
+
if (typeof body !== "object" || body === null) return;
|
|
73856
|
+
const value = body[key];
|
|
73857
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
73858
|
+
}
|
|
73859
|
+
__name$1(getPositiveNumberMember, "getPositiveNumberMember");
|
|
73860
|
+
function describeUnusableResponse(response, body) {
|
|
73861
|
+
const status$1 = `HTTP ${response.status} ${response.statusText}`.trim();
|
|
73862
|
+
const description = getStringMember(body, "error_description");
|
|
73863
|
+
return description ? `${status$1}: ${description}` : status$1;
|
|
73864
|
+
}
|
|
73865
|
+
__name$1(describeUnusableResponse, "describeUnusableResponse");
|
|
73866
|
+
function isRetryableStatus(status$1) {
|
|
73867
|
+
return status$1 >= 500 || status$1 === 429;
|
|
73868
|
+
}
|
|
73869
|
+
__name$1(isRetryableStatus, "isRetryableStatus");
|
|
73870
|
+
function asDeviceAuthorizationResponse(body) {
|
|
73871
|
+
const deviceCode = getStringMember(body, "device_code");
|
|
73872
|
+
const userCode = getStringMember(body, "user_code");
|
|
73873
|
+
const verificationUri = getStringMember(body, "verification_uri");
|
|
73874
|
+
const expiresIn = getPositiveNumberMember(body, "expires_in");
|
|
73875
|
+
if (!deviceCode || !userCode || !verificationUri || expiresIn === void 0) return;
|
|
73876
|
+
return {
|
|
73877
|
+
device_code: deviceCode,
|
|
73878
|
+
user_code: userCode,
|
|
73879
|
+
verification_uri: verificationUri,
|
|
73880
|
+
verification_uri_complete: getStringMember(body, "verification_uri_complete"),
|
|
73881
|
+
expires_in: expiresIn,
|
|
73882
|
+
interval: getPositiveNumberMember(body, "interval")
|
|
73883
|
+
};
|
|
73884
|
+
}
|
|
73885
|
+
__name$1(asDeviceAuthorizationResponse, "asDeviceAuthorizationResponse");
|
|
73886
|
+
async function readJson(response, logger$1) {
|
|
73887
|
+
const text = await response.text();
|
|
73888
|
+
try {
|
|
73889
|
+
return JSON.parse(text);
|
|
73890
|
+
} catch (e) {
|
|
73891
|
+
if (text.match(/<!DOCTYPE html>/)) {
|
|
73892
|
+
logger$1.debug("The body of the response was HTML rather than JSON. Check the debug logs to see the full body of the response.");
|
|
73893
|
+
if (text.match(/challenge-platform/)) logger$1.debug(`It looks like you might have hit a bot challenge page. This may be transient but if not, please contact Cloudflare to find out what can be done. When you contact Cloudflare, please provide your Ray ID: ${response.headers.get("cf-ray")}`);
|
|
73894
|
+
}
|
|
73895
|
+
logger$1.debug("Full body of response\n\n", text);
|
|
73896
|
+
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
73897
|
+
}
|
|
73898
|
+
}
|
|
73899
|
+
__name$1(readJson, "readJson");
|
|
73900
|
+
async function buildDeviceAuthHeaders(logger$1, isNonInteractiveOrCI2) {
|
|
73901
|
+
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
73902
|
+
if (await domainUsesAccess(getAuthDomainFromEnv(), logger$1)) {
|
|
73903
|
+
logger$1.debug("Using Cloudflare Access to get an access token for the device authorization request");
|
|
73904
|
+
Object.assign(headers, await getCloudflareAccessHeaders({
|
|
73905
|
+
logger: logger$1,
|
|
73906
|
+
isNonInteractiveOrCI: isNonInteractiveOrCI2
|
|
73907
|
+
}));
|
|
73908
|
+
}
|
|
73909
|
+
return headers;
|
|
73910
|
+
}
|
|
73911
|
+
__name$1(buildDeviceAuthHeaders, "buildDeviceAuthHeaders");
|
|
73912
|
+
async function requestDeviceAuthorization(scopes, clientId, logger$1, isNonInteractiveOrCI2) {
|
|
73913
|
+
const params = new URLSearchParams({
|
|
73914
|
+
client_id: clientId,
|
|
73915
|
+
scope: [...scopes, "offline_access"].join(" ")
|
|
73916
|
+
});
|
|
73917
|
+
const headers = await buildDeviceAuthHeaders(logger$1, isNonInteractiveOrCI2);
|
|
73918
|
+
const deviceAuthUrl = getDeviceAuthUrl();
|
|
73919
|
+
logger$1.debug("Fetching device authorization from", deviceAuthUrl);
|
|
73920
|
+
const response = await (0, import_undici$2.fetch)(deviceAuthUrl, {
|
|
73921
|
+
method: "POST",
|
|
73922
|
+
body: params.toString(),
|
|
73923
|
+
headers
|
|
73924
|
+
});
|
|
73925
|
+
if (!response.ok) {
|
|
73926
|
+
const body2 = await readJson(response, logger$1).catch(() => void 0);
|
|
73927
|
+
throw toErrorClass(body2 && typeof body2 === "object" && "error" in body2 ? String(body2.error) : `HTTP ${response.status} ${response.statusText}`);
|
|
73928
|
+
}
|
|
73929
|
+
const body = await readJson(response, logger$1);
|
|
73930
|
+
const deviceAuth = asDeviceAuthorizationResponse(body);
|
|
73931
|
+
if (deviceAuth === void 0) {
|
|
73932
|
+
logger$1.debug("Unusable device authorization response body:", body);
|
|
73933
|
+
throw new UserError(`The device authorization endpoint returned a response that could not be interpreted (${describeUnusableResponse(response, body)}).
|
|
73934
|
+
Enable debug logging to see the full response.`, { telemetryMessage: "user device-flow unusable device authorization response" });
|
|
73935
|
+
}
|
|
73936
|
+
return deviceAuth;
|
|
73937
|
+
}
|
|
73938
|
+
__name$1(requestDeviceAuthorization, "requestDeviceAuthorization");
|
|
73939
|
+
async function pollDeviceToken(deviceCode, clientId, logger$1, isNonInteractiveOrCI2) {
|
|
73940
|
+
const response = await fetchAuthToken(new URLSearchParams({
|
|
73941
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
73942
|
+
device_code: deviceCode,
|
|
73943
|
+
client_id: clientId
|
|
73944
|
+
}), logger$1, isNonInteractiveOrCI2);
|
|
73945
|
+
const body = await readJson(response, logger$1);
|
|
73946
|
+
const error$2 = getStringMember(body, "error");
|
|
73947
|
+
if (error$2 !== void 0) return {
|
|
73948
|
+
kind: "oauth-error",
|
|
73949
|
+
error: error$2
|
|
73950
|
+
};
|
|
73951
|
+
const accessToken = getStringMember(body, "access_token");
|
|
73952
|
+
const expiresIn = getPositiveNumberMember(body, "expires_in");
|
|
73953
|
+
if (!response.ok || accessToken === void 0 || expiresIn === void 0) {
|
|
73954
|
+
logger$1.debug("Unusable token response body:", body);
|
|
73955
|
+
return {
|
|
73956
|
+
kind: "unexpected",
|
|
73957
|
+
detail: describeUnusableResponse(response, body),
|
|
73958
|
+
retryable: !response.ok && isRetryableStatus(response.status)
|
|
73959
|
+
};
|
|
73960
|
+
}
|
|
73961
|
+
return {
|
|
73962
|
+
kind: "token",
|
|
73963
|
+
grant: {
|
|
73964
|
+
access_token: accessToken,
|
|
73965
|
+
expires_in: expiresIn,
|
|
73966
|
+
refresh_token: getStringMember(body, "refresh_token"),
|
|
73967
|
+
scope: getStringMember(body, "scope")
|
|
73968
|
+
}
|
|
73969
|
+
};
|
|
73970
|
+
}
|
|
73971
|
+
__name$1(pollDeviceToken, "pollDeviceToken");
|
|
73972
|
+
function sleep(seconds) {
|
|
73973
|
+
return new Promise((resolve$4) => setTimeout(resolve$4, seconds * 1e3));
|
|
73974
|
+
}
|
|
73975
|
+
__name$1(sleep, "sleep");
|
|
73976
|
+
async function getOauthTokenViaDeviceFlow(options, ctx) {
|
|
73977
|
+
const { logger: logger$1, openInBrowser: openInBrowser$1, isNonInteractiveOrCI: isNonInteractiveOrCI2 } = ctx;
|
|
73978
|
+
const deviceAuth = await requestDeviceAuthorization(options.scopes, options.clientId, logger$1, isNonInteractiveOrCI2);
|
|
73979
|
+
const authDomain = getAuthDomainFromEnv();
|
|
73980
|
+
assertTrustedVerificationUrl(deviceAuth.verification_uri, {
|
|
73981
|
+
field: "verification_uri",
|
|
73982
|
+
authDomain
|
|
73983
|
+
});
|
|
73984
|
+
if (deviceAuth.verification_uri_complete !== void 0) assertTrustedVerificationUrl(deviceAuth.verification_uri_complete, {
|
|
73985
|
+
field: "verification_uri_complete",
|
|
73986
|
+
authDomain
|
|
73987
|
+
});
|
|
73988
|
+
const verificationUrl = deviceAuth.verification_uri_complete ?? generateVerificationUrl({
|
|
73989
|
+
verificationUri: deviceAuth.verification_uri,
|
|
73990
|
+
userCode: deviceAuth.user_code
|
|
73991
|
+
});
|
|
73992
|
+
const maxDurationSeconds = Math.min(deviceAuth.expires_in, DEVICE_FLOW_MAX_DURATION_SECONDS);
|
|
73993
|
+
logger$1.log(esm_default`
|
|
73994
|
+
To authorize ${ctx.displayName}, please visit:
|
|
73995
|
+
|
|
73996
|
+
${deviceAuth.verification_uri}
|
|
73997
|
+
|
|
73998
|
+
and enter the code:
|
|
73999
|
+
|
|
74000
|
+
${deviceAuth.user_code}
|
|
74001
|
+
|
|
74002
|
+
You have ${toHumanPeriod(maxDurationSeconds)} to approve this request.
|
|
74003
|
+
`);
|
|
74004
|
+
if (options.browser) {
|
|
74005
|
+
logger$1.log(`
|
|
74006
|
+
Opening a link in your default browser: ${verificationUrl}`);
|
|
74007
|
+
await openInBrowser$1(verificationUrl);
|
|
74008
|
+
}
|
|
74009
|
+
const deadline = Date.now() + maxDurationSeconds * 1e3;
|
|
74010
|
+
let intervalSeconds = Math.max(deviceAuth.interval ?? DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS, DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS);
|
|
74011
|
+
let firstPoll = true;
|
|
74012
|
+
let lastPollFailure;
|
|
74013
|
+
while (Date.now() < deadline) {
|
|
74014
|
+
if (!firstPoll) await sleep(intervalSeconds);
|
|
74015
|
+
firstPoll = false;
|
|
74016
|
+
let result;
|
|
74017
|
+
try {
|
|
74018
|
+
result = await pollDeviceToken(deviceAuth.device_code, options.clientId, logger$1, isNonInteractiveOrCI2);
|
|
74019
|
+
} catch (e) {
|
|
74020
|
+
logger$1.debug("Ignoring transient error while polling for token:", e);
|
|
74021
|
+
lastPollFailure = e instanceof Error ? e.message : String(e);
|
|
74022
|
+
continue;
|
|
74023
|
+
}
|
|
74024
|
+
if (result.kind === "unexpected") {
|
|
74025
|
+
if (!result.retryable) throw new UserError(`The token endpoint returned a response that could not be interpreted (${result.detail}).
|
|
74026
|
+
Enable debug logging to see the full response.`, { telemetryMessage: "user device-flow unusable token response" });
|
|
74027
|
+
logger$1.debug("Ignoring transient response while polling for token:", result.detail);
|
|
74028
|
+
lastPollFailure = result.detail;
|
|
74029
|
+
continue;
|
|
74030
|
+
}
|
|
74031
|
+
lastPollFailure = void 0;
|
|
74032
|
+
if (result.kind === "oauth-error") switch (result.error) {
|
|
74033
|
+
case "authorization_pending": continue;
|
|
74034
|
+
case "slow_down":
|
|
74035
|
+
intervalSeconds += 5;
|
|
74036
|
+
continue;
|
|
74037
|
+
case "access_denied": throw new UserError(`Consent denied. You must grant consent to ${ctx.displayName} in order to login.
|
|
74038
|
+
If you don't want to do this consider passing an API token via the \`CLOUDFLARE_API_TOKEN\` environment variable.`, { telemetryMessage: "user device-flow consent denied" });
|
|
74039
|
+
case "expired_token": throw new UserError(`Device code expired before the request was approved. Please run \`${ctx.deviceLoginCommand}\` again to obtain a new code.`, { telemetryMessage: "user device-flow code expired" });
|
|
74040
|
+
default: throw toErrorClass(result.error);
|
|
74041
|
+
}
|
|
74042
|
+
const { grant } = result;
|
|
74043
|
+
return {
|
|
74044
|
+
token: {
|
|
74045
|
+
value: grant.access_token,
|
|
74046
|
+
expiry: new Date(Date.now() + grant.expires_in * 1e3).toISOString()
|
|
74047
|
+
},
|
|
74048
|
+
scopes: grant.scope ? grant.scope.split(" ") : [],
|
|
74049
|
+
refreshToken: grant.refresh_token ? { value: grant.refresh_token } : void 0
|
|
74050
|
+
};
|
|
74051
|
+
}
|
|
74052
|
+
if (lastPollFailure !== void 0) throw new UserError(`Gave up waiting for device authorization: the token endpoint kept returning responses that could not be interpreted (last: ${lastPollFailure}).
|
|
74053
|
+
Enable debug logging to see the full response, then run \`${ctx.deviceLoginCommand}\` to try again.`, { telemetryMessage: "user device-flow poll failed" });
|
|
74054
|
+
throw new UserError(`Device authorization timed out after ${toHumanPeriod(maxDurationSeconds)}. Please run \`${ctx.deviceLoginCommand}\` again to obtain a new code.`, { telemetryMessage: "user device-flow authorization timeout" });
|
|
74055
|
+
}
|
|
74056
|
+
__name$1(getOauthTokenViaDeviceFlow, "getOauthTokenViaDeviceFlow");
|
|
74057
|
+
function toHumanPeriod(seconds) {
|
|
74058
|
+
if (seconds < 60) return `${seconds} seconds`;
|
|
74059
|
+
const minutes = Math.floor(seconds / 60);
|
|
74060
|
+
const minutesPostfix = minutes === 1 ? "minute" : "minutes";
|
|
74061
|
+
const remainingSeconds = seconds % 60;
|
|
74062
|
+
const secondsPostfix = remainingSeconds === 1 ? "second" : "seconds";
|
|
74063
|
+
if (remainingSeconds === 0) return `${minutes} ${minutesPostfix}`;
|
|
74064
|
+
if (remainingSeconds == 59) return `${minutes + 1} ${minutesPostfix}`;
|
|
74065
|
+
return `${minutes} ${minutesPostfix} and ${remainingSeconds} ${secondsPostfix}`;
|
|
74066
|
+
}
|
|
74067
|
+
__name$1(toHumanPeriod, "toHumanPeriod");
|
|
73345
74068
|
function createOAuthFlow(ctx) {
|
|
73346
74069
|
const oauthFlowState = {};
|
|
73347
74070
|
const generators = {
|
|
@@ -73370,17 +74093,27 @@ function createOAuthFlow(ctx) {
|
|
|
73370
74093
|
OAuth login is not supported in the \`${complianceRegion}\` compliance region.
|
|
73371
74094
|
Please use a Cloudflare API token (\`CLOUDFLARE_API_TOKEN\` environment variable) or remove the ${props.complianceConfig?.compliance_region ? "`compliance_region` configuration property" : "`CLOUDFLARE_API_ENVIRONMENT` environment variable"}.
|
|
73372
74095
|
`, { telemetryMessage: "user login unsupported compliance region" });
|
|
73373
|
-
|
|
73374
|
-
|
|
73375
|
-
|
|
73376
|
-
|
|
73377
|
-
|
|
73378
|
-
|
|
73379
|
-
|
|
73380
|
-
|
|
73381
|
-
|
|
73382
|
-
|
|
73383
|
-
|
|
74096
|
+
let oauth;
|
|
74097
|
+
if (props.device) {
|
|
74098
|
+
ctx.logger.log("Attempting to login via OAuth Device Authorization Grant...");
|
|
74099
|
+
oauth = await getOauthTokenViaDeviceFlow({
|
|
74100
|
+
browser: props.browser ?? true,
|
|
74101
|
+
scopes: props.scopes,
|
|
74102
|
+
clientId: getClientId()
|
|
74103
|
+
}, ctx);
|
|
74104
|
+
} else {
|
|
74105
|
+
ctx.logger.log("Attempting to login via OAuth...");
|
|
74106
|
+
oauth = await getOauthToken({
|
|
74107
|
+
browser: props.browser ?? true,
|
|
74108
|
+
scopes: props.scopes,
|
|
74109
|
+
clientId: getClientId(),
|
|
74110
|
+
redirectUri: ctx.redirectUri,
|
|
74111
|
+
denied: consent.denied,
|
|
74112
|
+
granted: consent.granted,
|
|
74113
|
+
callbackHost: props.callbackHost ?? defaultCallbackHost,
|
|
74114
|
+
callbackPort: props.callbackPort ?? defaultCallbackPort
|
|
74115
|
+
}, oauthFlowState, ctx, generators);
|
|
74116
|
+
}
|
|
73384
74117
|
getStorage(props.profile).write({
|
|
73385
74118
|
oauth_token: oauth.token?.value ?? "",
|
|
73386
74119
|
expiration_time: oauth.token?.expiry,
|
|
@@ -73581,13 +74314,13 @@ function createProfileStore(args) {
|
|
|
73581
74314
|
args.bindings.write(currentBindings);
|
|
73582
74315
|
},
|
|
73583
74316
|
activate(profile, dir$2) {
|
|
73584
|
-
const normalizedDir =
|
|
74317
|
+
const normalizedDir = path2__default.resolve(dir$2);
|
|
73585
74318
|
const currentBindings = args.bindings.read();
|
|
73586
74319
|
currentBindings[normalizedDir] = profile;
|
|
73587
74320
|
args.bindings.write(currentBindings);
|
|
73588
74321
|
},
|
|
73589
74322
|
deactivate(dir$2) {
|
|
73590
|
-
const normalizedDir =
|
|
74323
|
+
const normalizedDir = path2__default.resolve(dir$2);
|
|
73591
74324
|
const currentBindings = args.bindings.read();
|
|
73592
74325
|
const boundProfile = currentBindings[normalizedDir];
|
|
73593
74326
|
if (boundProfile === void 0) {
|
|
@@ -73659,18 +74392,18 @@ function validateProfileName(name) {
|
|
|
73659
74392
|
}
|
|
73660
74393
|
__name$1(validateProfileName, "validateProfileName");
|
|
73661
74394
|
function formatDirectoryForUserError(dir$2) {
|
|
73662
|
-
return
|
|
74395
|
+
return path2__default.relative(process.cwd(), dir$2) || ".";
|
|
73663
74396
|
}
|
|
73664
74397
|
__name$1(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
73665
74398
|
function getProfileForDirectoryFromBindings(startDir, bindings$1) {
|
|
73666
|
-
const normalizedDir =
|
|
74399
|
+
const normalizedDir = path2__default.resolve(startDir);
|
|
73667
74400
|
const sortedEntries = Object.entries(bindings$1).sort(([a], [b]) => b.length - a.length);
|
|
73668
74401
|
for (const [boundDir, profile] of sortedEntries) {
|
|
73669
74402
|
if (normalizedDir === boundDir) return {
|
|
73670
74403
|
profile,
|
|
73671
74404
|
dir: boundDir
|
|
73672
74405
|
};
|
|
73673
|
-
if (normalizedDir.startsWith(boundDir) && normalizedDir[boundDir.length] ===
|
|
74406
|
+
if (normalizedDir.startsWith(boundDir) && normalizedDir[boundDir.length] === path2__default.sep) return {
|
|
73674
74407
|
profile,
|
|
73675
74408
|
dir: boundDir
|
|
73676
74409
|
};
|
|
@@ -74425,7 +75158,7 @@ function resolveAuthProfileBaseName(profile) {
|
|
|
74425
75158
|
}
|
|
74426
75159
|
__name$1(resolveAuthProfileBaseName, "resolveAuthProfileBaseName");
|
|
74427
75160
|
function getAuthConfigFilePath$2(configPath, profile, extension = "toml") {
|
|
74428
|
-
return
|
|
75161
|
+
return path2__default.join(configPath, USER_AUTH_CONFIG_PATH, `${resolveAuthProfileBaseName(profile)}.${extension}`);
|
|
74429
75162
|
}
|
|
74430
75163
|
__name$1(getAuthConfigFilePath$2, "getAuthConfigFilePath");
|
|
74431
75164
|
var FileCredentialStore = class {
|
|
@@ -74456,7 +75189,7 @@ var FileCredentialStore = class {
|
|
|
74456
75189
|
}
|
|
74457
75190
|
write(config$2) {
|
|
74458
75191
|
const filePath = this.filePath();
|
|
74459
|
-
mkdirSync(
|
|
75192
|
+
mkdirSync(path2__default.dirname(filePath), { recursive: true });
|
|
74460
75193
|
writeFileSync(filePath, stringifyFile(this.format, config$2), {
|
|
74461
75194
|
encoding: "utf-8",
|
|
74462
75195
|
mode: 384
|
|
@@ -74521,7 +75254,7 @@ function parseEncryptedEnvelope(raw) {
|
|
|
74521
75254
|
}
|
|
74522
75255
|
__name$1(parseEncryptedEnvelope, "parseEncryptedEnvelope");
|
|
74523
75256
|
function getEncryptedAuthConfigFilePath$2(configPath, profile) {
|
|
74524
|
-
return
|
|
75257
|
+
return path2__default.join(configPath, "config", `${resolveAuthProfileBaseName(profile)}.enc`);
|
|
74525
75258
|
}
|
|
74526
75259
|
__name$1(getEncryptedAuthConfigFilePath$2, "getEncryptedAuthConfigFilePath");
|
|
74527
75260
|
var EncryptedFileCredentialStore = class {
|
|
@@ -74560,7 +75293,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
74560
75293
|
const key = this.ensureKey();
|
|
74561
75294
|
const envelope = encryptString(stringifyFile(this.format, config$2), key);
|
|
74562
75295
|
const encryptedPath = getEncryptedAuthConfigFilePath$2(this.configPath, this.profile);
|
|
74563
|
-
mkdirSync(
|
|
75296
|
+
mkdirSync(path2__default.dirname(encryptedPath), { recursive: true });
|
|
74564
75297
|
writeFileSync(encryptedPath, JSON.stringify(envelope, null, " "), {
|
|
74565
75298
|
encoding: "utf-8",
|
|
74566
75299
|
mode: 384
|
|
@@ -74665,26 +75398,26 @@ function setNpmRunner(fn) {
|
|
|
74665
75398
|
}
|
|
74666
75399
|
__name$1(setNpmRunner, "setNpmRunner");
|
|
74667
75400
|
function getKeyringInstallDir(configPath) {
|
|
74668
|
-
return
|
|
75401
|
+
return path2__default.join(configPath, "native", "keyring");
|
|
74669
75402
|
}
|
|
74670
75403
|
__name$1(getKeyringInstallDir, "getKeyringInstallDir");
|
|
74671
75404
|
function getInstalledBindingPath(installDir) {
|
|
74672
|
-
return
|
|
75405
|
+
return path2__default.join(installDir, "node_modules", "@napi-rs", "keyring");
|
|
74673
75406
|
}
|
|
74674
75407
|
__name$1(getInstalledBindingPath, "getInstalledBindingPath");
|
|
74675
75408
|
function findKeyringBinding(installDir) {
|
|
74676
75409
|
const cached$2 = cachedBindingPathByDir.get(installDir);
|
|
74677
75410
|
if (cached$2 !== void 0) return cached$2;
|
|
74678
75411
|
const lazy$2 = getInstalledBindingPath(installDir);
|
|
74679
|
-
if (existsSync(
|
|
75412
|
+
if (existsSync(path2__default.join(lazy$2, "index.js"))) {
|
|
74680
75413
|
cachedBindingPathByDir.set(installDir, lazy$2);
|
|
74681
75414
|
return lazy$2;
|
|
74682
75415
|
}
|
|
74683
75416
|
try {
|
|
74684
75417
|
const r$1 = npmRunner(["root", "-g"]);
|
|
74685
75418
|
if (r$1.status === 0) {
|
|
74686
|
-
const global$2 =
|
|
74687
|
-
if (existsSync(
|
|
75419
|
+
const global$2 = path2__default.join(r$1.stdout.trim(), "@napi-rs", "keyring");
|
|
75420
|
+
if (existsSync(path2__default.join(global$2, "index.js"))) {
|
|
74688
75421
|
cachedBindingPathByDir.set(installDir, global$2);
|
|
74689
75422
|
return global$2;
|
|
74690
75423
|
}
|
|
@@ -74697,7 +75430,7 @@ __name$1(findKeyringBinding, "findKeyringBinding");
|
|
|
74697
75430
|
function installKeyringBindingSync(installDir) {
|
|
74698
75431
|
const dir$2 = installDir;
|
|
74699
75432
|
mkdirSync(dir$2, { recursive: true });
|
|
74700
|
-
const hostPkgJson =
|
|
75433
|
+
const hostPkgJson = path2__default.join(dir$2, "package.json");
|
|
74701
75434
|
if (!existsSync(hostPkgJson)) writeFileSync(hostPkgJson, JSON.stringify({
|
|
74702
75435
|
private: true,
|
|
74703
75436
|
name: "cloudflare-auth-keyring-host"
|
|
@@ -75126,10 +75859,10 @@ function scrubEncryptedCredentials(options) {
|
|
|
75126
75859
|
__name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
75127
75860
|
|
|
75128
75861
|
//#endregion
|
|
75129
|
-
//#region ../workers-auth/dist/chunk-
|
|
75862
|
+
//#region ../workers-auth/dist/chunk-AEOSGWMT.mjs
|
|
75130
75863
|
function createPreferences(getConfigPath) {
|
|
75131
75864
|
function getUserPreferencesPath() {
|
|
75132
|
-
return
|
|
75865
|
+
return path2__default.resolve(getConfigPath(), "preferences.json");
|
|
75133
75866
|
}
|
|
75134
75867
|
__name$1(getUserPreferencesPath, "getUserPreferencesPath");
|
|
75135
75868
|
function readUserPreferences$2() {
|
|
@@ -75149,7 +75882,7 @@ function createPreferences(getConfigPath) {
|
|
|
75149
75882
|
...update
|
|
75150
75883
|
};
|
|
75151
75884
|
const filePath = getUserPreferencesPath();
|
|
75152
|
-
mkdirSync(
|
|
75885
|
+
mkdirSync(path2__default.dirname(filePath), { recursive: true });
|
|
75153
75886
|
writeFileSync(filePath, JSON.stringify(next, null, " "), { encoding: "utf-8" });
|
|
75154
75887
|
}
|
|
75155
75888
|
__name$1(updateUserPreferences$2, "updateUserPreferences");
|
|
@@ -75784,7 +76517,7 @@ function createFileStorage(format$4, getPath) {
|
|
|
75784
76517
|
}, "read"),
|
|
75785
76518
|
write(config$2) {
|
|
75786
76519
|
const configPath = getPath();
|
|
75787
|
-
mkdirSync(
|
|
76520
|
+
mkdirSync(path2__default.dirname(configPath), { recursive: true });
|
|
75788
76521
|
writeFileSync(configPath, stringifyFile(format$4, config$2), {
|
|
75789
76522
|
encoding: "utf-8",
|
|
75790
76523
|
mode: 384
|
|
@@ -75868,6 +76601,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
75868
76601
|
purgeOnLoginOrLogout: configCache.purgeConfigCaches,
|
|
75869
76602
|
clientId: descriptor.clientId,
|
|
75870
76603
|
consent: descriptor.consent,
|
|
76604
|
+
displayName: descriptor.displayName,
|
|
76605
|
+
deviceLoginCommand: descriptor.commands.deviceLogin,
|
|
75871
76606
|
redirectUri: descriptor.redirectUri,
|
|
75872
76607
|
storageFactory: credentialStorage.storageFactory,
|
|
75873
76608
|
allowGlobalAuthKey,
|
|
@@ -75910,7 +76645,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
75910
76645
|
browser: props?.browser ?? true,
|
|
75911
76646
|
callbackHost: props?.callbackHost,
|
|
75912
76647
|
callbackPort: props?.callbackPort,
|
|
75913
|
-
profile: props?.profile
|
|
76648
|
+
profile: props?.profile,
|
|
76649
|
+
device: props?.device
|
|
75914
76650
|
};
|
|
75915
76651
|
}
|
|
75916
76652
|
__name$1(withDefaultScopes, "withDefaultScopes");
|
|
@@ -76095,7 +76831,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
76095
76831
|
}
|
|
76096
76832
|
__name$1(encryptedPath, "encryptedPath");
|
|
76097
76833
|
function getProfileConfigDirectory() {
|
|
76098
|
-
return
|
|
76834
|
+
return path2__default.dirname(plaintextPath("default"));
|
|
76099
76835
|
}
|
|
76100
76836
|
__name$1(getProfileConfigDirectory, "getProfileConfigDirectory");
|
|
76101
76837
|
const configs = {
|
|
@@ -76122,7 +76858,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
76122
76858
|
}
|
|
76123
76859
|
};
|
|
76124
76860
|
function getDirectoryBindingsPath() {
|
|
76125
|
-
return
|
|
76861
|
+
return path2__default.join(getConfigPath(), DIRECTORY_BINDINGS_FILE);
|
|
76126
76862
|
}
|
|
76127
76863
|
__name$1(getDirectoryBindingsPath, "getDirectoryBindingsPath");
|
|
76128
76864
|
return createProfileStore({
|
|
@@ -76138,7 +76874,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
76138
76874
|
},
|
|
76139
76875
|
write(dirBindings) {
|
|
76140
76876
|
const bindingsPath = getDirectoryBindingsPath();
|
|
76141
|
-
mkdirSync(
|
|
76877
|
+
mkdirSync(path2__default.dirname(bindingsPath), { recursive: true });
|
|
76142
76878
|
writeFileSync(bindingsPath, JSON.stringify(dirBindings, null, " "), "utf-8");
|
|
76143
76879
|
}
|
|
76144
76880
|
}
|
|
@@ -76254,6 +76990,7 @@ __name$1(createAuthConfigFileHelpers, "createAuthConfigFileHelpers");
|
|
|
76254
76990
|
//#region ../workers-auth/dist/cf/index.mjs
|
|
76255
76991
|
var CF_KEYRING_SERVICE_NAME = "cloudflare";
|
|
76256
76992
|
var CF_CLI_NAME = "cf";
|
|
76993
|
+
var CF_DISPLAY_NAME = "cf";
|
|
76257
76994
|
var CF_OAUTH_CALLBACK_URL = "http://localhost:8877/oauth/callback";
|
|
76258
76995
|
var CF_CONSENT_PAGES = {
|
|
76259
76996
|
granted: { url: "https://welcome.developers.workers.dev/cf-oauth-consent-granted" },
|
|
@@ -76378,7 +77115,7 @@ function getTemporaryAccountConfigFile$1() {
|
|
|
76378
77115
|
}
|
|
76379
77116
|
__name$1(getTemporaryAccountConfigFile$1, "getTemporaryAccountConfigFile");
|
|
76380
77117
|
function getCfTemporaryAccountConfigPath() {
|
|
76381
|
-
return
|
|
77118
|
+
return path2__default.join(getCfConfigPath(), getTemporaryAccountConfigFile$1());
|
|
76382
77119
|
}
|
|
76383
77120
|
__name$1(getCfTemporaryAccountConfigPath, "getCfTemporaryAccountConfigPath");
|
|
76384
77121
|
function createJsonFileStorage(getPath) {
|
|
@@ -76391,10 +77128,12 @@ var { getAuthConfigFilePath: getAuthConfigFilePath$1, getEncryptedAuthConfigFile
|
|
|
76391
77128
|
});
|
|
76392
77129
|
var CF_CLI = {
|
|
76393
77130
|
cliName: CF_CLI_NAME,
|
|
77131
|
+
displayName: CF_DISPLAY_NAME,
|
|
76394
77132
|
commands: {
|
|
76395
77133
|
login: "cf auth login",
|
|
76396
77134
|
whoami: "cf auth whoami",
|
|
76397
|
-
createProfile: "cf auth create"
|
|
77135
|
+
createProfile: "cf auth create",
|
|
77136
|
+
deviceLogin: "cf auth login --device"
|
|
76398
77137
|
},
|
|
76399
77138
|
keyringServiceName: CF_KEYRING_SERVICE_NAME,
|
|
76400
77139
|
clientId: getClientIdFromEnv$1,
|
|
@@ -76480,6 +77219,7 @@ function validateScopeKeys(scopes) {
|
|
|
76480
77219
|
__name$1(validateScopeKeys, "validateScopeKeys");
|
|
76481
77220
|
var WRANGLER_KEYRING_SERVICE_NAME = "wrangler";
|
|
76482
77221
|
var WRANGLER_CLI_NAME = "wrangler";
|
|
77222
|
+
var WRANGLER_DISPLAY_NAME = "Wrangler";
|
|
76483
77223
|
var OAUTH_CALLBACK_URL = "http://localhost:8976/oauth/callback";
|
|
76484
77224
|
var WRANGLER_CONSENT_PAGES = {
|
|
76485
77225
|
granted: { url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-granted" },
|
|
@@ -76498,7 +77238,7 @@ function getTemporaryAccountConfigFile() {
|
|
|
76498
77238
|
}
|
|
76499
77239
|
__name$1(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
76500
77240
|
function getTemporaryPreviewAccountConfigPath() {
|
|
76501
|
-
return
|
|
77241
|
+
return path2__default.join(getGlobalConfigPath(), getTemporaryAccountConfigFile());
|
|
76502
77242
|
}
|
|
76503
77243
|
__name$1(getTemporaryPreviewAccountConfigPath, "getTemporaryPreviewAccountConfigPath");
|
|
76504
77244
|
function createTomlFileStorage(getPath) {
|
|
@@ -76511,10 +77251,12 @@ var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigSt
|
|
|
76511
77251
|
});
|
|
76512
77252
|
var WRANGLER_CLI = {
|
|
76513
77253
|
cliName: WRANGLER_CLI_NAME,
|
|
77254
|
+
displayName: WRANGLER_DISPLAY_NAME,
|
|
76514
77255
|
commands: {
|
|
76515
77256
|
login: "wrangler login",
|
|
76516
77257
|
whoami: "wrangler whoami",
|
|
76517
|
-
createProfile: "wrangler auth create"
|
|
77258
|
+
createProfile: "wrangler auth create",
|
|
77259
|
+
deviceLogin: "wrangler login --device"
|
|
76518
77260
|
},
|
|
76519
77261
|
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
76520
77262
|
clientId: getClientIdFromEnv,
|
|
@@ -76568,9 +77310,9 @@ var __name = (target$1, value) => __defProp(target$1, "name", {
|
|
|
76568
77310
|
//#region ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
|
|
76569
77311
|
var require_command_exists$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js": ((exports, module) => {
|
|
76570
77312
|
var exec = __require$2("child_process").exec;
|
|
76571
|
-
var execSync = __require$2("child_process").execSync;
|
|
77313
|
+
var execSync$1 = __require$2("child_process").execSync;
|
|
76572
77314
|
var fs$2 = __require$2("fs");
|
|
76573
|
-
var path
|
|
77315
|
+
var path = __require$2("path");
|
|
76574
77316
|
var access = fs$2.access;
|
|
76575
77317
|
var accessSync$1 = fs$2.accessSync;
|
|
76576
77318
|
var constants$4 = fs$2.constants || fs$2;
|
|
@@ -76624,7 +77366,7 @@ var require_command_exists$1 = /* @__PURE__ */ __commonJS$2({ "../../node_module
|
|
|
76624
77366
|
};
|
|
76625
77367
|
var commandExistsUnixSync = function(commandName, cleanedCommandName) {
|
|
76626
77368
|
if (fileNotExistsSync(commandName)) try {
|
|
76627
|
-
return !!execSync("command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }");
|
|
77369
|
+
return !!execSync$1("command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }");
|
|
76628
77370
|
} catch (error$2) {
|
|
76629
77371
|
return false;
|
|
76630
77372
|
}
|
|
@@ -76633,7 +77375,7 @@ var require_command_exists$1 = /* @__PURE__ */ __commonJS$2({ "../../node_module
|
|
|
76633
77375
|
var commandExistsWindowsSync = function(commandName, cleanedCommandName, callback$1) {
|
|
76634
77376
|
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) return false;
|
|
76635
77377
|
try {
|
|
76636
|
-
return !!execSync("where " + cleanedCommandName, { stdio: [] });
|
|
77378
|
+
return !!execSync$1("where " + cleanedCommandName, { stdio: [] });
|
|
76637
77379
|
} catch (error$2) {
|
|
76638
77380
|
return false;
|
|
76639
77381
|
}
|
|
@@ -76647,8 +77389,8 @@ var require_command_exists$1 = /* @__PURE__ */ __commonJS$2({ "../../node_module
|
|
|
76647
77389
|
};
|
|
76648
77390
|
if (isUsingWindows) cleanInput = function(s) {
|
|
76649
77391
|
if (/[\\]/.test(s)) {
|
|
76650
|
-
var dirname$3 = "\"" + path
|
|
76651
|
-
var basename$2 = "\"" + path
|
|
77392
|
+
var dirname$3 = "\"" + path.dirname(s) + "\"";
|
|
77393
|
+
var basename$2 = "\"" + path.basename(s) + "\"";
|
|
76652
77394
|
return dirname$3 + ":" + basename$2;
|
|
76653
77395
|
}
|
|
76654
77396
|
return "\"" + s + "\"";
|
|
@@ -77462,11 +78204,11 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
77462
78204
|
const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
|
|
77463
78205
|
if (modules?.some(({ name }) => name === manifestModuleName) && main.type === "esm") {
|
|
77464
78206
|
assert(modules !== void 0);
|
|
77465
|
-
const subDirs = new Set(modules.map((module$1) =>
|
|
78207
|
+
const subDirs = new Set(modules.map((module$1) => path2__default.posix.dirname(module$1.name)));
|
|
77466
78208
|
for (const subDir of subDirs) {
|
|
77467
78209
|
if (subDir === ".") continue;
|
|
77468
|
-
const relativePath =
|
|
77469
|
-
const filePath =
|
|
78210
|
+
const relativePath = path2__default.posix.relative(subDir, manifestModuleName);
|
|
78211
|
+
const filePath = path2__default.posix.join(subDir, manifestModuleName);
|
|
77470
78212
|
modules.push({
|
|
77471
78213
|
name: filePath,
|
|
77472
78214
|
filePath,
|
|
@@ -77546,7 +78288,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
77546
78288
|
//#endregion
|
|
77547
78289
|
//#region ../remote-bindings/dist/index.mjs
|
|
77548
78290
|
var import_undici = require_undici();
|
|
77549
|
-
var version$2 = "0.0.
|
|
78291
|
+
var version$2 = "0.0.7";
|
|
77550
78292
|
var NoDefaultValueProvided = class extends UserError {
|
|
77551
78293
|
constructor() {
|
|
77552
78294
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -77991,7 +78733,7 @@ function createRemoteWorkerInit(props) {
|
|
|
77991
78733
|
return {
|
|
77992
78734
|
name: props.name,
|
|
77993
78735
|
main: {
|
|
77994
|
-
name:
|
|
78736
|
+
name: path2__default.basename(props.bundle.path),
|
|
77995
78737
|
filePath: props.bundle.path,
|
|
77996
78738
|
type: props.bundle.type,
|
|
77997
78739
|
content: props.bundle.entrypointSource
|
|
@@ -78460,26 +79202,26 @@ function deepStrictEqual(source, target$1) {
|
|
|
78460
79202
|
//#endregion
|
|
78461
79203
|
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs
|
|
78462
79204
|
var __require = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
78463
|
-
function cleanPath(path$
|
|
78464
|
-
let normalized = normalize(path$
|
|
79205
|
+
function cleanPath(path$1) {
|
|
79206
|
+
let normalized = normalize(path$1);
|
|
78465
79207
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
78466
79208
|
return normalized;
|
|
78467
79209
|
}
|
|
78468
79210
|
const SLASHES_REGEX = /[\\/]/g;
|
|
78469
|
-
function convertSlashes(path$
|
|
78470
|
-
return path$
|
|
79211
|
+
function convertSlashes(path$1, separator) {
|
|
79212
|
+
return path$1.replace(SLASHES_REGEX, separator);
|
|
78471
79213
|
}
|
|
78472
79214
|
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
78473
|
-
function isRootDirectory(path$
|
|
78474
|
-
return path$
|
|
79215
|
+
function isRootDirectory(path$1) {
|
|
79216
|
+
return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
|
|
78475
79217
|
}
|
|
78476
|
-
function normalizePath$1(path$
|
|
79218
|
+
function normalizePath$1(path$1, options) {
|
|
78477
79219
|
const { resolvePaths, normalizePath: normalizePath$1$1, pathSeparator } = options;
|
|
78478
|
-
const pathNeedsCleaning = process.platform === "win32" && path$
|
|
78479
|
-
if (resolvePaths) path$
|
|
78480
|
-
if (normalizePath$1$1 || pathNeedsCleaning) path$
|
|
78481
|
-
if (path$
|
|
78482
|
-
return convertSlashes(path$
|
|
79220
|
+
const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
|
|
79221
|
+
if (resolvePaths) path$1 = resolve$1(path$1);
|
|
79222
|
+
if (normalizePath$1$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
|
|
79223
|
+
if (path$1 === ".") return "";
|
|
79224
|
+
return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
|
|
78483
79225
|
}
|
|
78484
79226
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
78485
79227
|
return directoryPath + filename;
|
|
@@ -78515,8 +79257,8 @@ const pushDirectory = (directoryPath, paths) => {
|
|
|
78515
79257
|
paths.push(directoryPath || ".");
|
|
78516
79258
|
};
|
|
78517
79259
|
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
78518
|
-
const path$
|
|
78519
|
-
if (filters.every((filter) => filter(path$
|
|
79260
|
+
const path$1 = directoryPath || ".";
|
|
79261
|
+
if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
|
|
78520
79262
|
};
|
|
78521
79263
|
const empty$2 = () => {};
|
|
78522
79264
|
function build$6(root, options) {
|
|
@@ -78565,26 +79307,26 @@ const empty = () => {};
|
|
|
78565
79307
|
function build$3(options) {
|
|
78566
79308
|
return options.group ? groupFiles : empty;
|
|
78567
79309
|
}
|
|
78568
|
-
const resolveSymlinksAsync = function(path$
|
|
79310
|
+
const resolveSymlinksAsync = function(path$1, state, callback$1) {
|
|
78569
79311
|
const { queue, fs: fs$3, options: { suppressErrors } } = state;
|
|
78570
79312
|
queue.enqueue();
|
|
78571
|
-
fs$3.realpath(path$
|
|
79313
|
+
fs$3.realpath(path$1, (error$2, resolvedPath) => {
|
|
78572
79314
|
if (error$2) return queue.dequeue(suppressErrors ? null : error$2, state);
|
|
78573
79315
|
fs$3.stat(resolvedPath, (error$1$1, stat$1) => {
|
|
78574
79316
|
if (error$1$1) return queue.dequeue(suppressErrors ? null : error$1$1, state);
|
|
78575
|
-
if (stat$1.isDirectory() && isRecursive(path$
|
|
79317
|
+
if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
|
|
78576
79318
|
callback$1(stat$1, resolvedPath);
|
|
78577
79319
|
queue.dequeue(null, state);
|
|
78578
79320
|
});
|
|
78579
79321
|
});
|
|
78580
79322
|
};
|
|
78581
|
-
const resolveSymlinks = function(path$
|
|
79323
|
+
const resolveSymlinks = function(path$1, state, callback$1) {
|
|
78582
79324
|
const { queue, fs: fs$3, options: { suppressErrors } } = state;
|
|
78583
79325
|
queue.enqueue();
|
|
78584
79326
|
try {
|
|
78585
|
-
const resolvedPath = fs$3.realpathSync(path$
|
|
79327
|
+
const resolvedPath = fs$3.realpathSync(path$1);
|
|
78586
79328
|
const stat$1 = fs$3.statSync(resolvedPath);
|
|
78587
|
-
if (stat$1.isDirectory() && isRecursive(path$
|
|
79329
|
+
if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
|
|
78588
79330
|
callback$1(stat$1, resolvedPath);
|
|
78589
79331
|
} catch (e) {
|
|
78590
79332
|
if (!suppressErrors) throw e;
|
|
@@ -78594,16 +79336,16 @@ function build$2(options, isSynchronous) {
|
|
|
78594
79336
|
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
78595
79337
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
78596
79338
|
}
|
|
78597
|
-
function isRecursive(path$
|
|
79339
|
+
function isRecursive(path$1, resolved, state) {
|
|
78598
79340
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
78599
|
-
let parent = dirname$1(path$
|
|
79341
|
+
let parent = dirname$1(path$1);
|
|
78600
79342
|
let depth$1 = 1;
|
|
78601
79343
|
while (parent !== state.root && depth$1 < 2) {
|
|
78602
79344
|
const resolvedPath = state.symlinks.get(parent);
|
|
78603
79345
|
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
|
|
78604
79346
|
else parent = dirname$1(parent);
|
|
78605
79347
|
}
|
|
78606
|
-
state.symlinks.set(path$
|
|
79348
|
+
state.symlinks.set(path$1, resolved);
|
|
78607
79349
|
return depth$1 > 1;
|
|
78608
79350
|
}
|
|
78609
79351
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -78784,19 +79526,19 @@ var Walker = class {
|
|
|
78784
79526
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
78785
79527
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
78786
79528
|
} else if (entry.isDirectory()) {
|
|
78787
|
-
let path$
|
|
78788
|
-
if (exclude && exclude(entry.name, path$
|
|
78789
|
-
this.pushDirectory(path$
|
|
78790
|
-
this.walkDirectory(this.state, path$
|
|
79529
|
+
let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
79530
|
+
if (exclude && exclude(entry.name, path$1)) continue;
|
|
79531
|
+
this.pushDirectory(path$1, paths, filters);
|
|
79532
|
+
this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
|
|
78791
79533
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
78792
|
-
let path$
|
|
78793
|
-
this.resolveSymlink(path$
|
|
79534
|
+
let path$1 = joinPathWithBasePath(entry.name, directoryPath);
|
|
79535
|
+
this.resolveSymlink(path$1, this.state, (stat$1, resolvedPath) => {
|
|
78794
79536
|
if (stat$1.isDirectory()) {
|
|
78795
79537
|
resolvedPath = normalizePath$1(resolvedPath, this.state.options);
|
|
78796
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$
|
|
78797
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$
|
|
79538
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
|
|
79539
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
|
|
78798
79540
|
} else {
|
|
78799
|
-
resolvedPath = useRealPaths ? resolvedPath : path$
|
|
79541
|
+
resolvedPath = useRealPaths ? resolvedPath : path$1;
|
|
78800
79542
|
const filename = basename$1(resolvedPath);
|
|
78801
79543
|
const directoryPath$1 = normalizePath$1(dirname$1(resolvedPath), this.state.options);
|
|
78802
79544
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
@@ -78961,7 +79703,7 @@ var Builder = class {
|
|
|
78961
79703
|
isMatch = globFn(patterns, ...options);
|
|
78962
79704
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
78963
79705
|
}
|
|
78964
|
-
this.options.filters.push((path$
|
|
79706
|
+
this.options.filters.push((path$1) => isMatch(path$1));
|
|
78965
79707
|
return this;
|
|
78966
79708
|
}
|
|
78967
79709
|
};
|
|
@@ -79175,8 +79917,8 @@ var require_utils = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/pic
|
|
|
79175
79917
|
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
79176
79918
|
return output;
|
|
79177
79919
|
};
|
|
79178
|
-
exports.basename = (path$
|
|
79179
|
-
const segs = path$
|
|
79920
|
+
exports.basename = (path$1, { windows } = {}) => {
|
|
79921
|
+
const segs = path$1.split(windows ? /[\\/]/ : "/");
|
|
79180
79922
|
const last = segs[segs.length - 1];
|
|
79181
79923
|
if (last === "") return segs[segs.length - 2];
|
|
79182
79924
|
return last;
|
|
@@ -80916,15 +81658,15 @@ function buildRelative(cwd, root) {
|
|
|
80916
81658
|
};
|
|
80917
81659
|
}
|
|
80918
81660
|
const splitPatternOptions = { parts: true };
|
|
80919
|
-
function splitPattern(path$
|
|
81661
|
+
function splitPattern(path$1) {
|
|
80920
81662
|
var _result$parts;
|
|
80921
|
-
const result = import_picomatch.default.scan(path$
|
|
80922
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$
|
|
81663
|
+
const result = import_picomatch.default.scan(path$1, splitPatternOptions);
|
|
81664
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
80923
81665
|
}
|
|
80924
81666
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
80925
81667
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
80926
|
-
const escapePosixPath = (path$
|
|
80927
|
-
const escapeWin32Path = (path$
|
|
81668
|
+
const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
81669
|
+
const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
80928
81670
|
/**
|
|
80929
81671
|
* Escapes a path's special characters depending on the platform.
|
|
80930
81672
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -81048,13 +81790,13 @@ function buildCrawler(options, patterns) {
|
|
|
81048
81790
|
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
81049
81791
|
const crawler = new Builder({
|
|
81050
81792
|
filters: [debug$7 ? (p$2, isDirectory$2) => {
|
|
81051
|
-
const path$
|
|
81052
|
-
const matches = matcher(path$
|
|
81053
|
-
if (matches) log(`matched ${path$
|
|
81793
|
+
const path$1 = format$4(p$2, isDirectory$2);
|
|
81794
|
+
const matches = matcher(path$1) && !ignore$1(path$1);
|
|
81795
|
+
if (matches) log(`matched ${path$1}`);
|
|
81054
81796
|
return matches;
|
|
81055
81797
|
} : (p$2, isDirectory$2) => {
|
|
81056
|
-
const path$
|
|
81057
|
-
return matcher(path$
|
|
81798
|
+
const path$1 = format$4(p$2, isDirectory$2);
|
|
81799
|
+
return matcher(path$1) && !ignore$1(path$1);
|
|
81058
81800
|
}],
|
|
81059
81801
|
exclude: debug$7 ? (_, p$2) => {
|
|
81060
81802
|
const skipped = excludePredicate(_, p$2);
|
|
@@ -82304,13 +83046,13 @@ const wslDefaultBrowser = async () => {
|
|
|
82304
83046
|
const { stdout: stdout$2 } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
|
|
82305
83047
|
return stdout$2.trim();
|
|
82306
83048
|
};
|
|
82307
|
-
const convertWslPathToWindows = async (path$
|
|
82308
|
-
if (/^[a-z]+:\/\//i.test(path$
|
|
83049
|
+
const convertWslPathToWindows = async (path$1) => {
|
|
83050
|
+
if (/^[a-z]+:\/\//i.test(path$1)) return path$1;
|
|
82309
83051
|
try {
|
|
82310
|
-
const { stdout: stdout$2 } = await execFile$1("wslpath", ["-aw", path$
|
|
83052
|
+
const { stdout: stdout$2 } = await execFile$1("wslpath", ["-aw", path$1], { encoding: "utf8" });
|
|
82311
83053
|
return stdout$2.trim();
|
|
82312
83054
|
} catch {
|
|
82313
|
-
return path$
|
|
83055
|
+
return path$1;
|
|
82314
83056
|
}
|
|
82315
83057
|
};
|
|
82316
83058
|
|
|
@@ -82496,8 +83238,8 @@ var is_in_ssh_default = isInSsh;
|
|
|
82496
83238
|
//#endregion
|
|
82497
83239
|
//#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
82498
83240
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
82499
|
-
const __dirname = import.meta.url ?
|
|
82500
|
-
const localXdgOpenPath =
|
|
83241
|
+
const __dirname = import.meta.url ? path2__default.dirname(fileURLToPath(import.meta.url)) : "";
|
|
83242
|
+
const localXdgOpenPath = path2__default.join(__dirname, "xdg-open");
|
|
82501
83243
|
const { platform, arch: arch$1 } = process$1;
|
|
82502
83244
|
const tryEachApp = async (apps$1, opener) => {
|
|
82503
83245
|
if (apps$1.length === 0) return;
|
|
@@ -82890,6 +83632,7 @@ function cloudflare(pluginConfig = {}) {
|
|
|
82890
83632
|
tunnelPlugin(ctx),
|
|
82891
83633
|
previewPlugin(ctx),
|
|
82892
83634
|
shortcutsPlugin(ctx),
|
|
83635
|
+
agentHintPlugin(ctx),
|
|
82893
83636
|
debugPlugin(ctx),
|
|
82894
83637
|
triggerHandlersPlugin(ctx),
|
|
82895
83638
|
virtualModulesPlugin(ctx),
|