rsbuild-plugin-cloudflare 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { a as __toESM$1, i as __require$1, n as __export, r as __name$3, t as __commonJS$1 } from "./chunk-53YJWLG7-_ps118Xl.mjs";
|
|
2
2
|
import { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
3
3
|
import assert from "node:assert";
|
|
4
|
-
import * as fs
|
|
5
|
-
import
|
|
6
|
-
import * as fs$
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
import fs2, { accessSync, appendFileSync, chmodSync, constants, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
|
+
import * as fs$1 from "node:fs/promises";
|
|
7
7
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
8
|
-
import * as path
|
|
9
|
-
import
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
import path__default, { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
10
10
|
import { BUILD_OUTPUT_ROOT, DEFAULT_WORKER_DIRECTORY_NAME, cleanBuildOutputDir, getWorkerAssetsDir, getWorkerBundleDir, normalizeDirectoryName, readBuildOutput, writeContainerConfig, writeRootConfig, writeWorkerConfig } from "@cloudflare/build-output-utils";
|
|
11
11
|
import { CoreHeaders, DeferredPromise, Log, LogLevel, Miniflare, MiniflareCoreError, Mutex, Request as Request$1, Response as Response$1, buildPublicUrl, convertV4MiniflareOptions, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, kUnsafeEphemeralUniqueKey, parseForwardedProto, parseModuleFallbackRequest } from "miniflare";
|
|
12
12
|
import * as util from "node:util";
|
|
@@ -133,8 +133,8 @@ var require_package = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_mod
|
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region ../../workers-sdk/node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js
|
|
135
135
|
var require_main = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js": ((exports, module) => {
|
|
136
|
-
const fs$
|
|
137
|
-
const path$
|
|
136
|
+
const fs$3 = __require$2("fs");
|
|
137
|
+
const path$2 = __require$2("path");
|
|
138
138
|
const os$1 = __require$2("os");
|
|
139
139
|
const crypto$3 = __require$2("crypto");
|
|
140
140
|
const version$5 = require_package().version;
|
|
@@ -209,12 +209,12 @@ var require_main = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_module
|
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
function _vaultPath(options) {
|
|
212
|
-
let dotenvPath = path$
|
|
212
|
+
let dotenvPath = path$2.resolve(process.cwd(), ".env");
|
|
213
213
|
if (options && options.path && options.path.length > 0) dotenvPath = options.path;
|
|
214
214
|
return dotenvPath.endsWith(".vault") ? dotenvPath : `${dotenvPath}.vault`;
|
|
215
215
|
}
|
|
216
216
|
function _resolveHome(envPath) {
|
|
217
|
-
return envPath[0] === "~" ? path$
|
|
217
|
+
return envPath[0] === "~" ? path$2.join(os$1.homedir(), envPath.slice(1)) : envPath;
|
|
218
218
|
}
|
|
219
219
|
function _configVault(options) {
|
|
220
220
|
_log("Loading env from encrypted .env.vault");
|
|
@@ -225,7 +225,7 @@ var require_main = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_module
|
|
|
225
225
|
return { parsed };
|
|
226
226
|
}
|
|
227
227
|
function configDotenv(options) {
|
|
228
|
-
let dotenvPath = path$
|
|
228
|
+
let dotenvPath = path$2.resolve(process.cwd(), ".env");
|
|
229
229
|
let encoding = "utf8";
|
|
230
230
|
const debug$5 = Boolean(options && options.debug);
|
|
231
231
|
if (options) {
|
|
@@ -233,7 +233,7 @@ var require_main = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_module
|
|
|
233
233
|
if (options.encoding != null) encoding = options.encoding;
|
|
234
234
|
}
|
|
235
235
|
try {
|
|
236
|
-
const parsed = DotenvModule.parse(fs$
|
|
236
|
+
const parsed = DotenvModule.parse(fs$3.readFileSync(dotenvPath, { encoding }));
|
|
237
237
|
let processEnv = process.env;
|
|
238
238
|
if (options && options.processEnv != null) processEnv = options.processEnv;
|
|
239
239
|
DotenvModule.populate(processEnv, parsed, options);
|
|
@@ -246,7 +246,7 @@ var require_main = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_module
|
|
|
246
246
|
function config$2(options) {
|
|
247
247
|
const vaultPath = _vaultPath(options);
|
|
248
248
|
if (_dotenvKey(options).length === 0) return DotenvModule.configDotenv(options);
|
|
249
|
-
if (!fs$
|
|
249
|
+
if (!fs$3.existsSync(vaultPath)) {
|
|
250
250
|
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
251
251
|
return DotenvModule.configDotenv(options);
|
|
252
252
|
}
|
|
@@ -371,12 +371,12 @@ function getEnvPaths(envDir, mode) {
|
|
|
371
371
|
".env",
|
|
372
372
|
".env.local",
|
|
373
373
|
...mode === void 0 ? [] : [`.env.${mode}`, `.env.${mode}.local`]
|
|
374
|
-
].map((filename) => path
|
|
374
|
+
].map((filename) => path.resolve(envDir, filename));
|
|
375
375
|
}
|
|
376
376
|
__name$3(getEnvPaths, "getEnvPaths");
|
|
377
377
|
function getDevVarsCandidatePaths(envDir, mode) {
|
|
378
378
|
if (envDir === false) return [];
|
|
379
|
-
return [...mode === void 0 ? [] : [`.dev.vars.${mode}`], ".dev.vars"].map((filename) => path
|
|
379
|
+
return [...mode === void 0 ? [] : [`.dev.vars.${mode}`], ".dev.vars"].map((filename) => path.resolve(envDir, filename));
|
|
380
380
|
}
|
|
381
381
|
__name$3(getDevVarsCandidatePaths, "getDevVarsCandidatePaths");
|
|
382
382
|
async function loadEnv(envDir, mode) {
|
|
@@ -423,11 +423,11 @@ async function loadDevVars(envDir, mode) {
|
|
|
423
423
|
__name$3(loadDevVars, "loadDevVars");
|
|
424
424
|
async function tryParseFile(filePath, parse$6) {
|
|
425
425
|
try {
|
|
426
|
-
const stat2 = await fs$
|
|
426
|
+
const stat2 = await fs$1.stat(filePath);
|
|
427
427
|
if (!stat2.isFile() && !stat2.isFIFO()) return;
|
|
428
428
|
return {
|
|
429
429
|
path: filePath,
|
|
430
|
-
values: parse$6(await fs$
|
|
430
|
+
values: parse$6(await fs$1.readFile(filePath, "utf8"))
|
|
431
431
|
};
|
|
432
432
|
} catch (error$3) {
|
|
433
433
|
if (isMissingFileError(error$3)) return;
|
|
@@ -866,7 +866,7 @@ const version$3 = "8.0.0";
|
|
|
866
866
|
* @returns The normalized path.
|
|
867
867
|
*/
|
|
868
868
|
function normalizePath$1(id) {
|
|
869
|
-
return path
|
|
869
|
+
return path.posix.normalize(process.platform === "win32" ? id.replaceAll("\\", "/") : id);
|
|
870
870
|
}
|
|
871
871
|
|
|
872
872
|
//#endregion
|
|
@@ -1700,9 +1700,9 @@ function cloneDef(schema) {
|
|
|
1700
1700
|
return mergeDefs$1(schema._zod.def);
|
|
1701
1701
|
}
|
|
1702
1702
|
__name$3(cloneDef, "cloneDef");
|
|
1703
|
-
function getElementAtPath(obj, path$
|
|
1704
|
-
if (!path$
|
|
1705
|
-
return path$
|
|
1703
|
+
function getElementAtPath(obj, path$3) {
|
|
1704
|
+
if (!path$3) return obj;
|
|
1705
|
+
return path$3.reduce((acc, key) => acc?.[key], obj);
|
|
1706
1706
|
}
|
|
1707
1707
|
__name$3(getElementAtPath, "getElementAtPath");
|
|
1708
1708
|
function promiseAllObject(promisesObj) {
|
|
@@ -1997,11 +1997,11 @@ function explicitlyAborted$1(x, startIndex = 0) {
|
|
|
1997
1997
|
return false;
|
|
1998
1998
|
}
|
|
1999
1999
|
__name$3(explicitlyAborted$1, "explicitlyAborted");
|
|
2000
|
-
function prefixIssues$1(path$
|
|
2000
|
+
function prefixIssues$1(path$3, issues) {
|
|
2001
2001
|
return issues.map((iss) => {
|
|
2002
2002
|
var _a3;
|
|
2003
2003
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
2004
|
-
iss.path.unshift(path$
|
|
2004
|
+
iss.path.unshift(path$3);
|
|
2005
2005
|
return iss;
|
|
2006
2006
|
});
|
|
2007
2007
|
}
|
|
@@ -2472,12 +2472,12 @@ function flattenError$1(error62, mapper = (issue2) => issue2.message) {
|
|
|
2472
2472
|
__name$3(flattenError$1, "flattenError");
|
|
2473
2473
|
function formatError$2(error62, mapper = (issue2) => issue2.message) {
|
|
2474
2474
|
const fieldErrors = { _errors: [] };
|
|
2475
|
-
const processError = /* @__PURE__ */ __name$3((error63, path$
|
|
2476
|
-
for (const issue2 of error63.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path$
|
|
2477
|
-
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path$
|
|
2478
|
-
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path$
|
|
2475
|
+
const processError = /* @__PURE__ */ __name$3((error63, path$3 = []) => {
|
|
2476
|
+
for (const issue2 of error63.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path$3, ...issue2.path]));
|
|
2477
|
+
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path$3, ...issue2.path]);
|
|
2478
|
+
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path$3, ...issue2.path]);
|
|
2479
2479
|
else {
|
|
2480
|
-
const fullpath = [...path$
|
|
2480
|
+
const fullpath = [...path$3, ...issue2.path];
|
|
2481
2481
|
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue2));
|
|
2482
2482
|
else {
|
|
2483
2483
|
let curr = fieldErrors;
|
|
@@ -2510,13 +2510,13 @@ function formatError$2(error62, mapper = (issue2) => issue2.message) {
|
|
|
2510
2510
|
__name$3(formatError$2, "formatError");
|
|
2511
2511
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
2512
2512
|
const result = { errors: [] };
|
|
2513
|
-
const processError = /* @__PURE__ */ __name$3((error63, path$
|
|
2513
|
+
const processError = /* @__PURE__ */ __name$3((error63, path$3 = []) => {
|
|
2514
2514
|
var _a3;
|
|
2515
|
-
for (const issue2 of error63.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path$
|
|
2516
|
-
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path$
|
|
2517
|
-
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path$
|
|
2515
|
+
for (const issue2 of error63.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path$3, ...issue2.path]));
|
|
2516
|
+
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path$3, ...issue2.path]);
|
|
2517
|
+
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path$3, ...issue2.path]);
|
|
2518
2518
|
else {
|
|
2519
|
-
const fullpath = [...path$
|
|
2519
|
+
const fullpath = [...path$3, ...issue2.path];
|
|
2520
2520
|
if (fullpath.length === 0) {
|
|
2521
2521
|
result.errors.push(mapper(issue2));
|
|
2522
2522
|
continue;
|
|
@@ -2551,8 +2551,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2551
2551
|
__name$3(treeifyError, "treeifyError");
|
|
2552
2552
|
function toDotPath(_path) {
|
|
2553
2553
|
const segs = [];
|
|
2554
|
-
const path$
|
|
2555
|
-
for (const seg of path$
|
|
2554
|
+
const path$3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2555
|
+
for (const seg of path$3) if (typeof seg === "number") segs.push(`[${seg}]`);
|
|
2556
2556
|
else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`);
|
|
2557
2557
|
else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`);
|
|
2558
2558
|
else {
|
|
@@ -19159,11 +19159,11 @@ function decodeJSONPointerSegment(segment) {
|
|
|
19159
19159
|
__name$3(decodeJSONPointerSegment, "decodeJSONPointerSegment");
|
|
19160
19160
|
function resolveRef(ref$1, ctx) {
|
|
19161
19161
|
if (!ref$1.startsWith("#")) throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19162
|
-
const path$
|
|
19163
|
-
if (path$
|
|
19162
|
+
const path$3 = ref$1.slice(1).split("/").filter(Boolean);
|
|
19163
|
+
if (path$3.length === 0) return ctx.rootSchema;
|
|
19164
19164
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19165
|
-
if (path$
|
|
19166
|
-
const key = path$
|
|
19165
|
+
if (path$3[0] === defsKey) {
|
|
19166
|
+
const key = path$3[1] === void 0 ? void 0 : decodeJSONPointerSegment(path$3[1]);
|
|
19167
19167
|
if (!key || !ctx.defs[key]) throw new Error(`Reference not found: ${ref$1}`);
|
|
19168
19168
|
return ctx.defs[key];
|
|
19169
19169
|
}
|
|
@@ -22387,7 +22387,7 @@ function resolveWranglerConfigPath({ config: config$3, script }, options) {
|
|
|
22387
22387
|
deployConfigPath: void 0,
|
|
22388
22388
|
redirected: false
|
|
22389
22389
|
};
|
|
22390
|
-
return findWranglerConfig(script !== void 0 ?
|
|
22390
|
+
return findWranglerConfig(script !== void 0 ? path__default.dirname(script) : process.cwd(), options);
|
|
22391
22391
|
}
|
|
22392
22392
|
__name$3(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
22393
22393
|
function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -22418,15 +22418,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
22418
22418
|
const deployConfigFile = readFileSync$1(deployConfigPath);
|
|
22419
22419
|
try {
|
|
22420
22420
|
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
22421
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
22421
|
+
redirectedConfigPath = deployConfig.configPath && path__default.resolve(path__default.dirname(deployConfigPath), deployConfig.configPath);
|
|
22422
22422
|
} catch (e) {
|
|
22423
|
-
throw new UserError(`Failed to parse the deploy configuration file at ${
|
|
22423
|
+
throw new UserError(`Failed to parse the deploy configuration file at ${path__default.relative(".", deployConfigPath)}`, {
|
|
22424
22424
|
cause: e,
|
|
22425
22425
|
telemetryMessage: false
|
|
22426
22426
|
});
|
|
22427
22427
|
}
|
|
22428
22428
|
if (!redirectedConfigPath) throw new UserError(esm_default$1`
|
|
22429
|
-
A deploy configuration file was found at "${
|
|
22429
|
+
A deploy configuration file was found at "${path__default.relative(".", deployConfigPath)}".
|
|
22430
22430
|
But this is not valid - the required "configPath" property was not found.
|
|
22431
22431
|
Instead this file contains:
|
|
22432
22432
|
\`\`\`
|
|
@@ -22434,20 +22434,20 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
22434
22434
|
\`\`\`
|
|
22435
22435
|
`, { telemetryMessage: false });
|
|
22436
22436
|
if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default$1`
|
|
22437
|
-
There is a deploy configuration at "${
|
|
22438
|
-
But the redirected configuration path it points to, "${
|
|
22437
|
+
There is a deploy configuration at "${path__default.relative(".", deployConfigPath)}".
|
|
22438
|
+
But the redirected configuration path it points to, "${path__default.relative(".", redirectedConfigPath)}", does not exist.
|
|
22439
22439
|
`, { telemetryMessage: false });
|
|
22440
22440
|
if (userConfigPath) {
|
|
22441
|
-
const expectedDeployConfigPath =
|
|
22441
|
+
const expectedDeployConfigPath = path__default.join(path__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG);
|
|
22442
22442
|
if (expectedDeployConfigPath !== deployConfigPath) throw new UserError(esm_default$1`
|
|
22443
|
-
Found both a user configuration file at "${
|
|
22444
|
-
and a deploy configuration file at "${
|
|
22443
|
+
Found both a user configuration file at "${path__default.relative(".", userConfigPath)}"
|
|
22444
|
+
and a deploy configuration file at "${path__default.relative(".", deployConfigPath)}".
|
|
22445
22445
|
But these do not share the same base path so it is not clear which should be used.
|
|
22446
22446
|
|
|
22447
22447
|
A deploy configuration file is generated by a build tool to redirect Wrangler to the configuration it generated.
|
|
22448
|
-
It is only applied when it sits alongside the user configuration file, which here would be "${
|
|
22448
|
+
It is only applied when it sits alongside the user configuration file, which here would be "${path__default.relative(".", expectedDeployConfigPath)}".
|
|
22449
22449
|
|
|
22450
|
-
Please either delete "${
|
|
22450
|
+
Please either delete "${path__default.relative(".", deployConfigPath)}" if it is left over from a previous build,
|
|
22451
22451
|
or try running this command from the directory containing the configuration you want to use.
|
|
22452
22452
|
See https://developers.cloudflare.com/workers/wrangler/configuration/#generated-wrangler-configuration
|
|
22453
22453
|
`, { telemetryMessage: false });
|
|
@@ -22478,7 +22478,7 @@ function configFormat(configPath) {
|
|
|
22478
22478
|
}
|
|
22479
22479
|
__name$3(configFormat, "configFormat");
|
|
22480
22480
|
function configFileName(configPath, userConfigPath) {
|
|
22481
|
-
if (userConfigPath !== void 0) return
|
|
22481
|
+
if (userConfigPath !== void 0) return path__default.basename(userConfigPath);
|
|
22482
22482
|
switch (configFormat(configPath)) {
|
|
22483
22483
|
case "toml": return "wrangler.toml";
|
|
22484
22484
|
case "json": return "wrangler.json";
|
|
@@ -22541,12 +22541,12 @@ var getDockerPath = getEnvironmentVariableFactory({
|
|
|
22541
22541
|
//#endregion
|
|
22542
22542
|
//#region ../../workers-sdk/packages/workers-utils/dist/chunk-WFKY67B6.mjs
|
|
22543
22543
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
22544
|
-
function isDirectory(path$
|
|
22545
|
-
return
|
|
22544
|
+
function isDirectory(path$3) {
|
|
22545
|
+
return fs2.statSync(path$3, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
22546
22546
|
}
|
|
22547
22547
|
__name$3(isDirectory, "isDirectory");
|
|
22548
22548
|
function removeDir(dirPath, { fireAndForget = false } = {}) {
|
|
22549
|
-
const result =
|
|
22549
|
+
const result = fs2.promises.rm(dirPath, {
|
|
22550
22550
|
recursive: true,
|
|
22551
22551
|
force: true,
|
|
22552
22552
|
maxRetries: 5,
|
|
@@ -22557,7 +22557,7 @@ function removeDir(dirPath, { fireAndForget = false } = {}) {
|
|
|
22557
22557
|
}
|
|
22558
22558
|
__name$3(removeDir, "removeDir");
|
|
22559
22559
|
function removeDirSync(dirPath) {
|
|
22560
|
-
|
|
22560
|
+
fs2.rmSync(dirPath, {
|
|
22561
22561
|
recursive: true,
|
|
22562
22562
|
force: true,
|
|
22563
22563
|
maxRetries: 5,
|
|
@@ -22586,7 +22586,7 @@ function getEnv(name) {
|
|
|
22586
22586
|
}
|
|
22587
22587
|
__name$3(getEnv, "getEnv");
|
|
22588
22588
|
function normalizePath(p$3) {
|
|
22589
|
-
return p$3 ?
|
|
22589
|
+
return p$3 ? path__default.normalize(path__default.join(p$3, ".")) : void 0;
|
|
22590
22590
|
}
|
|
22591
22591
|
__name$3(normalizePath, "normalizePath");
|
|
22592
22592
|
function homeDir() {
|
|
@@ -22594,13 +22594,13 @@ function homeDir() {
|
|
|
22594
22594
|
os.homedir(),
|
|
22595
22595
|
getEnv("USERPROFILE"),
|
|
22596
22596
|
getEnv("HOME"),
|
|
22597
|
-
getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ?
|
|
22597
|
+
getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ? path__default.join(getEnv("HOMEDRIVE") ?? "", getEnv("HOMEPATH") ?? "") : void 0
|
|
22598
22598
|
].find(isNonEmpty));
|
|
22599
22599
|
return normalizePath(os.homedir() || getEnv("HOME"));
|
|
22600
22600
|
}
|
|
22601
22601
|
__name$3(homeDir, "homeDir");
|
|
22602
22602
|
function joinToBase(base, segments) {
|
|
22603
|
-
return base ?
|
|
22603
|
+
return base ? path__default.join(base, ...segments) : void 0;
|
|
22604
22604
|
}
|
|
22605
22605
|
__name$3(joinToBase, "joinToBase");
|
|
22606
22606
|
function tempDir() {
|
|
@@ -22636,7 +22636,7 @@ function baseDir() {
|
|
|
22636
22636
|
}
|
|
22637
22637
|
__name$3(baseDir, "baseDir");
|
|
22638
22638
|
function valOrPath(value, segments) {
|
|
22639
|
-
return value ||
|
|
22639
|
+
return value || path__default.join(...segments);
|
|
22640
22640
|
}
|
|
22641
22641
|
__name$3(valOrPath, "valOrPath");
|
|
22642
22642
|
function windowsAppData() {
|
|
@@ -22676,10 +22676,10 @@ function xdgCache() {
|
|
|
22676
22676
|
}
|
|
22677
22677
|
__name$3(xdgCache, "xdgCache");
|
|
22678
22678
|
function xdgAppPaths(name) {
|
|
22679
|
-
const segment =
|
|
22679
|
+
const segment = path__default.parse(name).name;
|
|
22680
22680
|
return {
|
|
22681
|
-
config: /* @__PURE__ */ __name$3(() =>
|
|
22682
|
-
cache: /* @__PURE__ */ __name$3(() =>
|
|
22681
|
+
config: /* @__PURE__ */ __name$3(() => path__default.join(xdgConfig(), segment), "config"),
|
|
22682
|
+
cache: /* @__PURE__ */ __name$3(() => path__default.join(xdgCache(), segment), "cache")
|
|
22683
22683
|
};
|
|
22684
22684
|
}
|
|
22685
22685
|
__name$3(xdgAppPaths, "xdgAppPaths");
|
|
@@ -22687,7 +22687,7 @@ function getGlobalConfigPath({ appName = "wrangler", leadingDot = true, useLegac
|
|
|
22687
22687
|
const dirName = `${leadingDot ? "." : ""}${appName}`;
|
|
22688
22688
|
const configDir = xdgAppPaths(dirName).config();
|
|
22689
22689
|
if (useLegacyHomeDir) {
|
|
22690
|
-
const legacyConfigDir =
|
|
22690
|
+
const legacyConfigDir = path__default.join(os.homedir(), dirName);
|
|
22691
22691
|
if (isDirectory(legacyConfigDir)) return legacyConfigDir;
|
|
22692
22692
|
}
|
|
22693
22693
|
return configDir;
|
|
@@ -22780,7 +22780,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
|
|
|
22780
22780
|
var getRegistryPath = getEnvironmentVariableFactory({
|
|
22781
22781
|
variableName: "WRANGLER_REGISTRY_PATH",
|
|
22782
22782
|
defaultValue() {
|
|
22783
|
-
return
|
|
22783
|
+
return path__default.join(getGlobalConfigPath(), "registry");
|
|
22784
22784
|
}
|
|
22785
22785
|
});
|
|
22786
22786
|
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
|
|
@@ -24379,10 +24379,10 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
24379
24379
|
if (!isHttpOrHttpsPrefixed(url$2.origin || url$2.protocol)) throw new InvalidArgumentError$38("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
24380
24380
|
const port = url$2.port != null ? url$2.port : url$2.protocol === "https:" ? 443 : 80;
|
|
24381
24381
|
let origin = url$2.origin != null ? url$2.origin : `${url$2.protocol || ""}//${url$2.hostname || ""}:${port}`;
|
|
24382
|
-
let path$
|
|
24382
|
+
let path$3 = url$2.path != null ? url$2.path : `${url$2.pathname || ""}${url$2.search || ""}`;
|
|
24383
24383
|
if (origin[origin.length - 1] === "/") origin = origin.slice(0, origin.length - 1);
|
|
24384
|
-
if (path$
|
|
24385
|
-
return new URL(`${origin}${path$
|
|
24384
|
+
if (path$3 && path$3[0] !== "/") path$3 = `/${path$3}`;
|
|
24385
|
+
return new URL(`${origin}${path$3}`);
|
|
24386
24386
|
}
|
|
24387
24387
|
if (!isHttpOrHttpsPrefixed(url$2.origin || url$2.protocol)) throw new InvalidArgumentError$38("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
24388
24388
|
return url$2;
|
|
@@ -25257,8 +25257,8 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node
|
|
|
25257
25257
|
debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$6, error$3.message);
|
|
25258
25258
|
});
|
|
25259
25259
|
diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
|
|
25260
|
-
const { request: { method, path: path$
|
|
25261
|
-
debugLog("sending request to %s %s%s", method, origin, path$
|
|
25260
|
+
const { request: { method, path: path$3, origin } } = evt;
|
|
25261
|
+
debugLog("sending request to %s %s%s", method, origin, path$3);
|
|
25262
25262
|
});
|
|
25263
25263
|
}
|
|
25264
25264
|
let isTrackingRequestEvents = false;
|
|
@@ -25270,16 +25270,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node
|
|
|
25270
25270
|
}
|
|
25271
25271
|
isTrackingRequestEvents = true;
|
|
25272
25272
|
diagnosticsChannel$1.subscribe("undici:request:headers", (evt) => {
|
|
25273
|
-
const { request: { method, path: path$
|
|
25274
|
-
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$
|
|
25273
|
+
const { request: { method, path: path$3, origin }, response: { statusCode } } = evt;
|
|
25274
|
+
debugLog("received response to %s %s%s - HTTP %d", method, origin, path$3, statusCode);
|
|
25275
25275
|
});
|
|
25276
25276
|
diagnosticsChannel$1.subscribe("undici:request:trailers", (evt) => {
|
|
25277
|
-
const { request: { method, path: path$
|
|
25278
|
-
debugLog("trailers received from %s %s%s", method, origin, path$
|
|
25277
|
+
const { request: { method, path: path$3, origin } } = evt;
|
|
25278
|
+
debugLog("trailers received from %s %s%s", method, origin, path$3);
|
|
25279
25279
|
});
|
|
25280
25280
|
diagnosticsChannel$1.subscribe("undici:request:error", (evt) => {
|
|
25281
|
-
const { request: { method, path: path$
|
|
25282
|
-
debugLog("request to %s %s%s errored - %s", method, origin, path$
|
|
25281
|
+
const { request: { method, path: path$3, origin }, error: error$3 } = evt;
|
|
25282
|
+
debugLog("request to %s %s%s errored - %s", method, origin, path$3, error$3.message);
|
|
25283
25283
|
});
|
|
25284
25284
|
}
|
|
25285
25285
|
let isTrackingWebSocketEvents = false;
|
|
@@ -25340,10 +25340,10 @@ var require_request$1 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
25340
25340
|
}
|
|
25341
25341
|
const kHandler = Symbol("handler");
|
|
25342
25342
|
var Request$6 = class {
|
|
25343
|
-
constructor(origin, { path: path$
|
|
25344
|
-
if (typeof path$
|
|
25345
|
-
else if (path$
|
|
25346
|
-
else if (invalidPathRegex.test(path$
|
|
25343
|
+
constructor(origin, { path: path$3, method, body, headers, query, idempotent, blocking, upgrade: upgrade$1, headersTimeout, bodyTimeout, reset, expectContinue, servername, throwOnError, maxRedirections, typeOfService }, handler) {
|
|
25344
|
+
if (typeof path$3 !== "string") throw new InvalidArgumentError$37("path must be a string");
|
|
25345
|
+
else if (path$3[0] !== "/" && !(path$3.startsWith("http://") || path$3.startsWith("https://")) && method !== "CONNECT") throw new InvalidArgumentError$37("path must be an absolute URL or start with a slash");
|
|
25346
|
+
else if (invalidPathRegex.test(path$3)) throw new InvalidArgumentError$37("invalid request path");
|
|
25347
25347
|
if (typeof method !== "string") throw new InvalidArgumentError$37("method must be a string");
|
|
25348
25348
|
else if (normalizedMethodRecords$1[method] === void 0 && !isValidHTTPToken$3(method)) throw new InvalidArgumentError$37("invalid request method");
|
|
25349
25349
|
if (upgrade$1 && typeof upgrade$1 !== "string") throw new InvalidArgumentError$37("upgrade must be a string");
|
|
@@ -25384,7 +25384,7 @@ var require_request$1 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
25384
25384
|
this.completed = false;
|
|
25385
25385
|
this.aborted = false;
|
|
25386
25386
|
this.upgrade = upgrade$1 || null;
|
|
25387
|
-
this.path = query ? serializePathWithQuery$3(path$
|
|
25387
|
+
this.path = query ? serializePathWithQuery$3(path$3, query) : path$3;
|
|
25388
25388
|
this.origin = origin;
|
|
25389
25389
|
this.protocol = getProtocolFromUrlString(origin);
|
|
25390
25390
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -29989,7 +29989,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
29989
29989
|
* @returns
|
|
29990
29990
|
*/
|
|
29991
29991
|
function writeH1(client, request$2) {
|
|
29992
|
-
const { method, path: path$
|
|
29992
|
+
const { method, path: path$3, host, upgrade: upgrade$1, blocking, reset } = request$2;
|
|
29993
29993
|
let { body, headers, contentLength } = request$2;
|
|
29994
29994
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
29995
29995
|
if (util$21.isFormDataLike(body)) {
|
|
@@ -30045,7 +30045,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
30045
30045
|
if (client[kMaxRequests$1] && socket[kCounter$1]++ >= client[kMaxRequests$1]) socket[kReset$1] = true;
|
|
30046
30046
|
if (blocking) socket[kBlocking] = true;
|
|
30047
30047
|
if (socket.setTypeOfService) socket.setTypeOfService(request$2.typeOfService);
|
|
30048
|
-
let header = `${method} ${path$
|
|
30048
|
+
let header = `${method} ${path$3} HTTP/1.1\r\n`;
|
|
30049
30049
|
if (typeof host === "string") header += `host: ${host}\r\n`;
|
|
30050
30050
|
else header += client[kHostHeader$1];
|
|
30051
30051
|
if (upgrade$1) header += `connection: upgrade\r\nupgrade: ${upgrade$1}\r\n`;
|
|
@@ -30596,7 +30596,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
30596
30596
|
const headersTimeout = request$2.headersTimeout ?? client[kHeadersTimeout$1];
|
|
30597
30597
|
const bodyTimeout = request$2.bodyTimeout ?? client[kBodyTimeout$1];
|
|
30598
30598
|
const session = client[kHTTP2Session];
|
|
30599
|
-
const { method, path: path$
|
|
30599
|
+
const { method, path: path$3, host, upgrade: upgrade$1, expectContinue, signal, protocol, headers: reqHeaders } = request$2;
|
|
30600
30600
|
let { body } = request$2;
|
|
30601
30601
|
if (upgrade$1 != null && upgrade$1 !== "websocket") {
|
|
30602
30602
|
util$20.errorRequest(client, request$2, new InvalidArgumentError$31(`Custom upgrade "${upgrade$1}" not supported over HTTP/2`));
|
|
@@ -30650,7 +30650,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
30650
30650
|
}
|
|
30651
30651
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
30652
30652
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
30653
|
-
headers[HTTP2_HEADER_PATH] = path$
|
|
30653
|
+
headers[HTTP2_HEADER_PATH] = path$3;
|
|
30654
30654
|
if (protocol === "ws:" || protocol === "wss:") headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
30655
30655
|
else headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
30656
30656
|
stream$2 = session.request(headers, {
|
|
@@ -30693,7 +30693,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_m
|
|
|
30693
30693
|
stream$2.setTimeout(headersTimeout);
|
|
30694
30694
|
return true;
|
|
30695
30695
|
}
|
|
30696
|
-
headers[HTTP2_HEADER_PATH] = path$
|
|
30696
|
+
headers[HTTP2_HEADER_PATH] = path$3;
|
|
30697
30697
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
30698
30698
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
30699
30699
|
if (body && typeof body.read === "function") body.read(0);
|
|
@@ -32565,8 +32565,8 @@ var require_proxy_agent = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node
|
|
|
32565
32565
|
}
|
|
32566
32566
|
if (onHeaders) onHeaders.call(this, statusCode, data$1, resume$1);
|
|
32567
32567
|
};
|
|
32568
|
-
const { origin, path: path$
|
|
32569
|
-
opts.path = origin + path$
|
|
32568
|
+
const { origin, path: path$3 = "/", headers = {} } = opts;
|
|
32569
|
+
opts.path = origin + path$3;
|
|
32570
32570
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
32571
32571
|
const { host } = new URL(origin);
|
|
32572
32572
|
headers.host = host;
|
|
@@ -34382,16 +34382,16 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_
|
|
|
34382
34382
|
}
|
|
34383
34383
|
return normalizedQp;
|
|
34384
34384
|
}
|
|
34385
|
-
function safeUrl(path$
|
|
34386
|
-
if (typeof path$
|
|
34387
|
-
const pathSegments = path$
|
|
34388
|
-
if (pathSegments.length !== 2) return path$
|
|
34385
|
+
function safeUrl(path$3) {
|
|
34386
|
+
if (typeof path$3 !== "string") return path$3;
|
|
34387
|
+
const pathSegments = path$3.split("?", 3);
|
|
34388
|
+
if (pathSegments.length !== 2) return path$3;
|
|
34389
34389
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
34390
34390
|
qp.sort();
|
|
34391
34391
|
return [...pathSegments, qp.toString()].join("?");
|
|
34392
34392
|
}
|
|
34393
|
-
function matchKey(mockDispatch$1, { path: path$
|
|
34394
|
-
const pathMatch = matchValue$1(mockDispatch$1.path, path$
|
|
34393
|
+
function matchKey(mockDispatch$1, { path: path$3, method, body, headers }) {
|
|
34394
|
+
const pathMatch = matchValue$1(mockDispatch$1.path, path$3);
|
|
34395
34395
|
const methodMatch = matchValue$1(mockDispatch$1.method, method);
|
|
34396
34396
|
const bodyMatch = typeof mockDispatch$1.body !== "undefined" ? matchValue$1(mockDispatch$1.body, body) : true;
|
|
34397
34397
|
const headersMatch = matchHeaders(mockDispatch$1, headers);
|
|
@@ -34409,8 +34409,8 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_
|
|
|
34409
34409
|
const basePath = key.query ? serializePathWithQuery$2(key.path, key.query) : key.path;
|
|
34410
34410
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
34411
34411
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
34412
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$
|
|
34413
|
-
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$
|
|
34412
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path$3, ignoreTrailingSlash }) => {
|
|
34413
|
+
return ignoreTrailingSlash ? matchValue$1(removeTrailingSlash(safeUrl(path$3)), resolvedPathWithoutTrailingSlash) : matchValue$1(safeUrl(path$3), resolvedPath);
|
|
34414
34414
|
});
|
|
34415
34415
|
if (matchedMockDispatches.length === 0) throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
34416
34416
|
matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue$1(method, key.method));
|
|
@@ -34453,15 +34453,15 @@ var require_mock_utils = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_
|
|
|
34453
34453
|
/**
|
|
34454
34454
|
* @param {string} path Path to remove trailing slash from
|
|
34455
34455
|
*/
|
|
34456
|
-
function removeTrailingSlash(path$
|
|
34457
|
-
while (path$
|
|
34458
|
-
if (path$
|
|
34459
|
-
return path$
|
|
34456
|
+
function removeTrailingSlash(path$3) {
|
|
34457
|
+
while (path$3.endsWith("/")) path$3 = path$3.slice(0, -1);
|
|
34458
|
+
if (path$3.length === 0) path$3 = "/";
|
|
34459
|
+
return path$3;
|
|
34460
34460
|
}
|
|
34461
34461
|
function buildKey$1(opts) {
|
|
34462
|
-
const { path: path$
|
|
34462
|
+
const { path: path$3, method, body, headers, query } = opts;
|
|
34463
34463
|
return {
|
|
34464
|
-
path: path$
|
|
34464
|
+
path: path$3,
|
|
34465
34465
|
method,
|
|
34466
34466
|
body,
|
|
34467
34467
|
headers,
|
|
@@ -35028,10 +35028,10 @@ var require_pending_interceptors_formatter = /* @__PURE__ */ __commonJS$2({ "../
|
|
|
35028
35028
|
});
|
|
35029
35029
|
}
|
|
35030
35030
|
format(pendingInterceptors) {
|
|
35031
|
-
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$
|
|
35031
|
+
const withPrettyHeaders = pendingInterceptors.map(({ method, path: path$3, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
35032
35032
|
Method: method,
|
|
35033
35033
|
Origin: origin,
|
|
35034
|
-
Path: path$
|
|
35034
|
+
Path: path$3,
|
|
35035
35035
|
"Status code": statusCode,
|
|
35036
35036
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
35037
35037
|
Invocations: timesInvoked,
|
|
@@ -35089,8 +35089,8 @@ var require_mock_agent = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_
|
|
|
35089
35089
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
35090
35090
|
const dispatchOpts = { ...opts };
|
|
35091
35091
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
35092
|
-
const [path$
|
|
35093
|
-
dispatchOpts.path = `${path$
|
|
35092
|
+
const [path$3, searchParams] = dispatchOpts.path.split("?");
|
|
35093
|
+
dispatchOpts.path = `${path$3}?${normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)}`;
|
|
35094
35094
|
}
|
|
35095
35095
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
35096
35096
|
}
|
|
@@ -35567,10 +35567,10 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../workers-sd
|
|
|
35567
35567
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
35568
35568
|
*/
|
|
35569
35569
|
async loadSnapshots(filePath) {
|
|
35570
|
-
const path$
|
|
35571
|
-
if (!path$
|
|
35570
|
+
const path$3 = filePath || this.#snapshotPath;
|
|
35571
|
+
if (!path$3) throw new InvalidArgumentError$7("Snapshot path is required");
|
|
35572
35572
|
try {
|
|
35573
|
-
const data$1 = await readFile$1(resolve$2(path$
|
|
35573
|
+
const data$1 = await readFile$1(resolve$2(path$3), "utf8");
|
|
35574
35574
|
const parsed = JSON.parse(data$1);
|
|
35575
35575
|
if (Array.isArray(parsed)) {
|
|
35576
35576
|
this.#snapshots.clear();
|
|
@@ -35578,7 +35578,7 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../workers-sd
|
|
|
35578
35578
|
} else this.#snapshots = new Map(Object.entries(parsed));
|
|
35579
35579
|
} catch (error$3) {
|
|
35580
35580
|
if (error$3.code === "ENOENT") this.#snapshots.clear();
|
|
35581
|
-
else throw new UndiciError$1(`Failed to load snapshots from ${path$
|
|
35581
|
+
else throw new UndiciError$1(`Failed to load snapshots from ${path$3}`, { cause: error$3 });
|
|
35582
35582
|
}
|
|
35583
35583
|
}
|
|
35584
35584
|
/**
|
|
@@ -35588,9 +35588,9 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJS$2({ "../../workers-sd
|
|
|
35588
35588
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
35589
35589
|
*/
|
|
35590
35590
|
async saveSnapshots(filePath) {
|
|
35591
|
-
const path$
|
|
35592
|
-
if (!path$
|
|
35593
|
-
const resolvedPath = resolve$2(path$
|
|
35591
|
+
const path$3 = filePath || this.#snapshotPath;
|
|
35592
|
+
if (!path$3) throw new InvalidArgumentError$7("Snapshot path is required");
|
|
35593
|
+
const resolvedPath = resolve$2(path$3);
|
|
35594
35594
|
await mkdir$1(dirname$1(resolvedPath), { recursive: true });
|
|
35595
35595
|
const data$1 = Array.from(this.#snapshots.entries()).map(([hash$1, snapshot]) => ({
|
|
35596
35596
|
hash: hash$1,
|
|
@@ -36164,11 +36164,11 @@ var require_redirect_handler = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk
|
|
|
36164
36164
|
return;
|
|
36165
36165
|
}
|
|
36166
36166
|
const { origin, pathname, search } = util$8.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
36167
|
-
const path$
|
|
36168
|
-
const redirectUrlString = `${origin}${path$
|
|
36167
|
+
const path$3 = search ? `${pathname}${search}` : pathname;
|
|
36168
|
+
const redirectUrlString = `${origin}${path$3}`;
|
|
36169
36169
|
for (const historyUrl of this.history) if (historyUrl.toString() === redirectUrlString) throw new InvalidArgumentError$4(`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.`);
|
|
36170
36170
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
36171
|
-
this.opts.path = path$
|
|
36171
|
+
this.opts.path = path$3;
|
|
36172
36172
|
this.opts.origin = origin;
|
|
36173
36173
|
this.opts.query = null;
|
|
36174
36174
|
}
|
|
@@ -37500,17 +37500,17 @@ var require_cache_handler = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/no
|
|
|
37500
37500
|
if (locationUrl.origin !== originUrl.origin) return;
|
|
37501
37501
|
return locationUrl.pathname + locationUrl.search;
|
|
37502
37502
|
}
|
|
37503
|
-
function deleteCachedUri(store, cacheKey, path$
|
|
37503
|
+
function deleteCachedUri(store, cacheKey, path$3) {
|
|
37504
37504
|
deleteCachedValue$1(store, {
|
|
37505
37505
|
...cacheKey,
|
|
37506
|
-
path: path$
|
|
37506
|
+
path: path$3
|
|
37507
37507
|
});
|
|
37508
37508
|
for (let i$1 = 0; i$1 < util$7.safeHTTPMethods.length; i$1++) {
|
|
37509
37509
|
const method = util$7.safeHTTPMethods[i$1];
|
|
37510
37510
|
if (method !== cacheKey.method) deleteCachedValue$1(store, {
|
|
37511
37511
|
...cacheKey,
|
|
37512
37512
|
method,
|
|
37513
|
-
path: path$
|
|
37513
|
+
path: path$3
|
|
37514
37514
|
});
|
|
37515
37515
|
}
|
|
37516
37516
|
}
|
|
@@ -37518,8 +37518,8 @@ var require_cache_handler = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/no
|
|
|
37518
37518
|
if (headerValue === void 0) return;
|
|
37519
37519
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
37520
37520
|
for (let i$1 = 0; i$1 < values.length; i$1++) {
|
|
37521
|
-
const path$
|
|
37522
|
-
if (path$
|
|
37521
|
+
const path$3 = getSameOriginPath(cacheKey, values[i$1]);
|
|
37522
|
+
if (path$3 !== void 0) deleteCachedUri(store, cacheKey, path$3);
|
|
37523
37523
|
}
|
|
37524
37524
|
}
|
|
37525
37525
|
function invalidateUnsafeRequest(store, cacheKey, resHeaders) {
|
|
@@ -41618,10 +41618,10 @@ var require_fetch = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modul
|
|
|
41618
41618
|
const url$2 = requestCurrentURL(request$2);
|
|
41619
41619
|
/** @type {import('../../..').Agent} */
|
|
41620
41620
|
const agent = fetchParams.controller.dispatcher;
|
|
41621
|
-
const path$
|
|
41621
|
+
const path$3 = url$2.pathname + url$2.search;
|
|
41622
41622
|
const hasTrailingQuestionMark = url$2.search.length === 0 && url$2.href[url$2.href.length - url$2.hash.length - 1] === "?";
|
|
41623
41623
|
return new Promise((resolve$3, reject) => agent.dispatch({
|
|
41624
|
-
path: hasTrailingQuestionMark ? `${path$
|
|
41624
|
+
path: hasTrailingQuestionMark ? `${path$3}?` : path$3,
|
|
41625
41625
|
origin: url$2.origin,
|
|
41626
41626
|
method: request$2.method,
|
|
41627
41627
|
body: agent.isMockActive ? request$2.body && (request$2.body.source || request$2.body.stream) : body,
|
|
@@ -42403,9 +42403,9 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
42403
42403
|
* path-value = <any CHAR except CTLs or ";">
|
|
42404
42404
|
* @param {string} path
|
|
42405
42405
|
*/
|
|
42406
|
-
function validateCookiePath(path$
|
|
42407
|
-
for (let i$1 = 0; i$1 < path$
|
|
42408
|
-
const code = path$
|
|
42406
|
+
function validateCookiePath(path$3) {
|
|
42407
|
+
for (let i$1 = 0; i$1 < path$3.length; ++i$1) {
|
|
42408
|
+
const code = path$3.charCodeAt(i$1);
|
|
42409
42409
|
if (code < 32 || code > 126 || code === 59) throw new Error("Invalid cookie path");
|
|
42410
42410
|
}
|
|
42411
42411
|
}
|
|
@@ -45669,9 +45669,9 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
45669
45669
|
if (opts != null && typeof opts !== "object") throw new InvalidArgumentError("invalid opts");
|
|
45670
45670
|
if (opts && opts.path != null) {
|
|
45671
45671
|
if (typeof opts.path !== "string") throw new InvalidArgumentError("invalid opts.path");
|
|
45672
|
-
let path$
|
|
45673
|
-
if (!opts.path.startsWith("/")) path$
|
|
45674
|
-
url$2 = new URL(util$1.parseOrigin(url$2).origin + path$
|
|
45672
|
+
let path$3 = opts.path;
|
|
45673
|
+
if (!opts.path.startsWith("/")) path$3 = `/${path$3}`;
|
|
45674
|
+
url$2 = new URL(util$1.parseOrigin(url$2).origin + path$3);
|
|
45675
45675
|
} else {
|
|
45676
45676
|
if (!opts) opts = typeof url$2 === "object" ? url$2 : {};
|
|
45677
45677
|
url$2 = util$1.parseURL(url$2);
|
|
@@ -47459,7 +47459,7 @@ function isPagesConfig(rawConfig) {
|
|
|
47459
47459
|
}
|
|
47460
47460
|
__name$3(isPagesConfig, "isPagesConfig");
|
|
47461
47461
|
function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
|
|
47462
|
-
const diagnostics = new Diagnostics(`Processing ${configPath ?
|
|
47462
|
+
const diagnostics = new Diagnostics(`Processing ${configPath ? path__default.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
|
|
47463
47463
|
const isRedirectedConfig2 = isRedirectedRawConfig(rawConfig, configPath, userConfigPath);
|
|
47464
47464
|
if ("legacy_env" in rawConfig) {
|
|
47465
47465
|
if (!isRedirectedConfig2) diagnostics.errors.push(dedent$1`
|
|
@@ -47577,34 +47577,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
|
|
47577
47577
|
else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
|
|
47578
47578
|
return {
|
|
47579
47579
|
command,
|
|
47580
|
-
watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir2) =>
|
|
47580
|
+
watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir2) => path__default.relative(process.cwd(), path__default.join(path__default.dirname(configPath), `${dir2}`))) : path__default.relative(process.cwd(), path__default.join(path__default.dirname(configPath), `${watch_dir}`)) : watch_dir,
|
|
47581
47581
|
cwd
|
|
47582
47582
|
};
|
|
47583
47583
|
}
|
|
47584
47584
|
__name$3(normalizeAndValidateBuild, "normalizeAndValidateBuild");
|
|
47585
47585
|
function normalizeAndValidateMainField(configPath, rawMain) {
|
|
47586
|
-
const configDir =
|
|
47586
|
+
const configDir = path__default.dirname(configPath ?? "wrangler.toml");
|
|
47587
47587
|
if (rawMain !== void 0) if (typeof rawMain === "string") {
|
|
47588
|
-
const directory =
|
|
47589
|
-
return
|
|
47588
|
+
const directory = path__default.resolve(configDir);
|
|
47589
|
+
return path__default.resolve(directory, rawMain);
|
|
47590
47590
|
} else return rawMain;
|
|
47591
47591
|
else return;
|
|
47592
47592
|
}
|
|
47593
47593
|
__name$3(normalizeAndValidateMainField, "normalizeAndValidateMainField");
|
|
47594
47594
|
function normalizeAndValidateBaseDirField(configPath, rawDir) {
|
|
47595
|
-
const configDir =
|
|
47595
|
+
const configDir = path__default.dirname(configPath ?? "wrangler.toml");
|
|
47596
47596
|
if (rawDir !== void 0) if (typeof rawDir === "string") {
|
|
47597
|
-
const directory =
|
|
47598
|
-
return
|
|
47597
|
+
const directory = path__default.resolve(configDir);
|
|
47598
|
+
return path__default.resolve(directory, rawDir);
|
|
47599
47599
|
} else return rawDir;
|
|
47600
47600
|
else return;
|
|
47601
47601
|
}
|
|
47602
47602
|
__name$3(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
|
|
47603
47603
|
function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
|
|
47604
|
-
const configDir =
|
|
47604
|
+
const configDir = path__default.dirname(configPath ?? "wrangler.toml");
|
|
47605
47605
|
if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
|
|
47606
|
-
const directory =
|
|
47607
|
-
return
|
|
47606
|
+
const directory = path__default.resolve(configDir);
|
|
47607
|
+
return path__default.resolve(directory, rawPagesDir);
|
|
47608
47608
|
} else return rawPagesDir;
|
|
47609
47609
|
else return;
|
|
47610
47610
|
}
|
|
@@ -47658,7 +47658,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
|
|
|
47658
47658
|
validateOptionalProperty(diagnostics, "site", "entry-point", legacySiteEntryPoint, "string");
|
|
47659
47659
|
deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
|
|
47660
47660
|
\`\`\`
|
|
47661
|
-
main = "${
|
|
47661
|
+
main = "${path__default.join(String(legacySiteEntryPoint) || "workers-site", path__default.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js")}"
|
|
47662
47662
|
\`\`\``, false, void 0, "warning");
|
|
47663
47663
|
let siteEntryPoint = legacySiteEntryPoint;
|
|
47664
47664
|
if (!mainEntryPoint && !siteEntryPoint) {
|
|
@@ -47671,7 +47671,7 @@ main = "workers-site/index.js"
|
|
|
47671
47671
|
} else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
|
|
47672
47672
|
They serve the same purpose: to point to the entry-point of your worker.
|
|
47673
47673
|
Delete the deprecated \`site.entry-point\` field from your config.`);
|
|
47674
|
-
if (configPath && siteEntryPoint) siteEntryPoint =
|
|
47674
|
+
if (configPath && siteEntryPoint) siteEntryPoint = path__default.relative(process.cwd(), path__default.join(path__default.dirname(configPath), siteEntryPoint));
|
|
47675
47675
|
return {
|
|
47676
47676
|
bucket,
|
|
47677
47677
|
"entry-point": siteEntryPoint,
|
|
@@ -47703,7 +47703,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
47703
47703
|
if (rawMapping === void 0) return;
|
|
47704
47704
|
const mapping = {};
|
|
47705
47705
|
for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
|
|
47706
|
-
if (configPath) mapping[name] = configPath ?
|
|
47706
|
+
if (configPath) mapping[name] = configPath ? path__default.relative(process.cwd(), path__default.join(path__default.dirname(configPath), filePath)) : filePath;
|
|
47707
47707
|
}
|
|
47708
47708
|
return mapping;
|
|
47709
47709
|
}
|
|
@@ -47991,7 +47991,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
47991
47991
|
__name$3(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
|
|
47992
47992
|
function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
|
|
47993
47993
|
const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
|
|
47994
|
-
return configPath && tsconfig ?
|
|
47994
|
+
return configPath && tsconfig ? path__default.relative(process.cwd(), path__default.join(path__default.dirname(configPath), tsconfig)) : tsconfig;
|
|
47995
47995
|
}
|
|
47996
47996
|
__name$3(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
|
|
47997
47997
|
var validateAndNormalizeRules = /* @__PURE__ */ __name$3((diagnostics, topLevelEnv, rawEnv, envName) => {
|
|
@@ -48812,9 +48812,9 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
48812
48812
|
let resolvedBuildContextPath = void 0;
|
|
48813
48813
|
try {
|
|
48814
48814
|
if (isDockerfile(resolvedImage, configPath)) {
|
|
48815
|
-
const baseDir$1 = configPath ?
|
|
48816
|
-
resolvedImage =
|
|
48817
|
-
resolvedBuildContextPath = containerAppOptional.image_build_context ?
|
|
48815
|
+
const baseDir$1 = configPath ? path__default.dirname(configPath) : process.cwd();
|
|
48816
|
+
resolvedImage = path__default.resolve(baseDir$1, resolvedImage);
|
|
48817
|
+
resolvedBuildContextPath = containerAppOptional.image_build_context ? path__default.resolve(baseDir$1, containerAppOptional.image_build_context) : path__default.dirname(resolvedImage);
|
|
48818
48818
|
}
|
|
48819
48819
|
} catch (err) {
|
|
48820
48820
|
if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
|
|
@@ -50503,9 +50503,9 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
|
|
|
50503
50503
|
}
|
|
50504
50504
|
__name$3(isRemoteValid, "isRemoteValid");
|
|
50505
50505
|
function isDockerfile(imagePath, configPath) {
|
|
50506
|
-
const baseDir$1 = configPath ?
|
|
50507
|
-
const maybeDockerfile =
|
|
50508
|
-
if (
|
|
50506
|
+
const baseDir$1 = configPath ? path__default.dirname(configPath) : process.cwd();
|
|
50507
|
+
const maybeDockerfile = path__default.resolve(baseDir$1, imagePath);
|
|
50508
|
+
if (fs2.existsSync(maybeDockerfile)) {
|
|
50509
50509
|
if (isDirectory(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
|
|
50510
50510
|
return true;
|
|
50511
50511
|
}
|
|
@@ -50675,14 +50675,14 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
|
|
|
50675
50675
|
__name$3(validateDurableObjectBinding2, "validateDurableObjectBinding");
|
|
50676
50676
|
function getPackagePath(packageName, projectPath) {
|
|
50677
50677
|
try {
|
|
50678
|
-
return
|
|
50678
|
+
return path__default.dirname(__require$1.resolve(`${packageName}/package.json`, { paths: [projectPath] }));
|
|
50679
50679
|
} catch {}
|
|
50680
50680
|
try {
|
|
50681
|
-
return
|
|
50681
|
+
return path__default.dirname(__require$1.resolve(packageName, { paths: [projectPath] }));
|
|
50682
50682
|
} catch {}
|
|
50683
50683
|
try {
|
|
50684
|
-
const candidate =
|
|
50685
|
-
if (statSync(candidate).isFile()) return
|
|
50684
|
+
const candidate = path__default.join(projectPath, "node_modules", packageName, "package.json");
|
|
50685
|
+
if (statSync(candidate).isFile()) return path__default.dirname(candidate);
|
|
50686
50686
|
} catch {}
|
|
50687
50687
|
}
|
|
50688
50688
|
__name$3(getPackagePath, "getPackagePath");
|
|
@@ -50707,14 +50707,14 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
50707
50707
|
__name$3(getInstalledPackageVersion, "getInstalledPackageVersion");
|
|
50708
50708
|
function findFileUp(name, startDir, lastDir) {
|
|
50709
50709
|
let dir2 = startDir;
|
|
50710
|
-
const root =
|
|
50710
|
+
const root = path__default.parse(dir2).root;
|
|
50711
50711
|
while (true) {
|
|
50712
|
-
const candidate =
|
|
50712
|
+
const candidate = path__default.join(dir2, name);
|
|
50713
50713
|
try {
|
|
50714
50714
|
if (statSync(candidate).isFile()) return candidate;
|
|
50715
50715
|
} catch {}
|
|
50716
50716
|
if (lastDir !== void 0 && dir2 === lastDir) break;
|
|
50717
|
-
const parent =
|
|
50717
|
+
const parent = path__default.dirname(dir2);
|
|
50718
50718
|
if (parent === dir2 || dir2 === root) break;
|
|
50719
50719
|
dir2 = parent;
|
|
50720
50720
|
}
|
|
@@ -50978,7 +50978,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
50978
50978
|
}, {});
|
|
50979
50979
|
}
|
|
50980
50980
|
__name$3(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
50981
|
-
var DEFAULT_COMPAT_DATE = "2026-10-
|
|
50981
|
+
var DEFAULT_COMPAT_DATE = "2026-10-23";
|
|
50982
50982
|
function constructWranglerConfig(config$3) {
|
|
50983
50983
|
const mappedBindings = mapWorkerMetadataBindings(config$3.bindings);
|
|
50984
50984
|
const durableObjectClassNames = config$3.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$3.name).map((durableObject) => durableObject.class_name);
|
|
@@ -51879,8 +51879,8 @@ function createConfigCache(logger$2, options) {
|
|
|
51879
51879
|
if (envCacheDir) return envCacheDir;
|
|
51880
51880
|
}
|
|
51881
51881
|
const closestNodeModulesDirectory = dir("node_modules");
|
|
51882
|
-
const nodeModulesCache = closestNodeModulesDirectory ? path
|
|
51883
|
-
const localCache = path
|
|
51882
|
+
const nodeModulesCache = closestNodeModulesDirectory ? path.join(closestNodeModulesDirectory, ".cache", namespace) : null;
|
|
51883
|
+
const localCache = path.join(process.cwd(), `.${namespace}`, "cache");
|
|
51884
51884
|
if (nodeModulesCache && existsSync(nodeModulesCache)) return nodeModulesCache;
|
|
51885
51885
|
if (existsSync(localCache)) return localCache;
|
|
51886
51886
|
if (nodeModulesCache) return nodeModulesCache;
|
|
@@ -51890,7 +51890,7 @@ function createConfigCache(logger$2, options) {
|
|
|
51890
51890
|
function showCacheMessage(fields, folder) {
|
|
51891
51891
|
if (!cacheMessageShown && !isNonInteractiveOrCI()) {
|
|
51892
51892
|
if (fields.length > 0) {
|
|
51893
|
-
logger$2.debug(`Retrieving cached values for ${arrayFormatter.format(fields)} from ${path
|
|
51893
|
+
logger$2.debug(`Retrieving cached values for ${arrayFormatter.format(fields)} from ${path.relative(process.cwd(), folder)}`);
|
|
51894
51894
|
cacheMessageShown = true;
|
|
51895
51895
|
}
|
|
51896
51896
|
}
|
|
@@ -51899,7 +51899,7 @@ function createConfigCache(logger$2, options) {
|
|
|
51899
51899
|
function getConfigCache(fileName) {
|
|
51900
51900
|
try {
|
|
51901
51901
|
const cacheFolder = getCacheFolder();
|
|
51902
|
-
const configCacheLocation = path
|
|
51902
|
+
const configCacheLocation = path.join(cacheFolder, fileName);
|
|
51903
51903
|
const configCache = JSON.parse(readFileSync(configCacheLocation, "utf-8"));
|
|
51904
51904
|
showCacheMessage(Object.keys(configCache), cacheFolder);
|
|
51905
51905
|
return configCache;
|
|
@@ -51912,9 +51912,9 @@ function createConfigCache(logger$2, options) {
|
|
|
51912
51912
|
const cacheFolder = getCacheFolder();
|
|
51913
51913
|
if (cacheFolder) {
|
|
51914
51914
|
logger$2.debug(`Saving to cache: ${JSON.stringify(newValues)}`);
|
|
51915
|
-
const configCacheLocation = path
|
|
51915
|
+
const configCacheLocation = path.join(cacheFolder, fileName);
|
|
51916
51916
|
const existingValues = getConfigCache(fileName);
|
|
51917
|
-
mkdirSync(path
|
|
51917
|
+
mkdirSync(path.dirname(configCacheLocation), { recursive: true });
|
|
51918
51918
|
writeFileSync(configCacheLocation, JSON.stringify({
|
|
51919
51919
|
...existingValues,
|
|
51920
51920
|
...newValues
|
|
@@ -52104,7 +52104,7 @@ var process2 = globalThis.process;
|
|
|
52104
52104
|
var { onExit, load: load$1, unload: unload$1 } = signalExitWrap(processOk$1(process2) ? new SignalExit(process2) : new SignalExitFallback());
|
|
52105
52105
|
function getWranglerHiddenDirPath(projectRoot) {
|
|
52106
52106
|
projectRoot ??= process.cwd();
|
|
52107
|
-
return
|
|
52107
|
+
return path__default.join(projectRoot, ".wrangler");
|
|
52108
52108
|
}
|
|
52109
52109
|
__name$3(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
|
52110
52110
|
var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
|
|
@@ -52114,26 +52114,26 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
|
52114
52114
|
sweptTmpRoots.add(tmpRoot);
|
|
52115
52115
|
let entries;
|
|
52116
52116
|
try {
|
|
52117
|
-
entries =
|
|
52117
|
+
entries = fs2.readdirSync(tmpRoot, { withFileTypes: true });
|
|
52118
52118
|
} catch {
|
|
52119
52119
|
return;
|
|
52120
52120
|
}
|
|
52121
52121
|
const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
|
|
52122
52122
|
for (const entry of entries) {
|
|
52123
52123
|
if (!entry.isDirectory()) continue;
|
|
52124
|
-
const entryPath =
|
|
52124
|
+
const entryPath = path__default.join(tmpRoot, entry.name);
|
|
52125
52125
|
try {
|
|
52126
|
-
if (
|
|
52126
|
+
if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync(entryPath);
|
|
52127
52127
|
} catch {}
|
|
52128
52128
|
}
|
|
52129
52129
|
}
|
|
52130
52130
|
__name$3(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
|
|
52131
52131
|
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
52132
|
-
const tmpRoot =
|
|
52133
|
-
|
|
52132
|
+
const tmpRoot = path__default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
|
52133
|
+
fs2.mkdirSync(tmpRoot, { recursive: true });
|
|
52134
52134
|
sweepStaleWranglerTmpDirs(tmpRoot);
|
|
52135
|
-
const tmpPrefix =
|
|
52136
|
-
const tmpDir =
|
|
52135
|
+
const tmpPrefix = path__default.join(tmpRoot, `${prefix}-`);
|
|
52136
|
+
const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
|
|
52137
52137
|
const cleanupDir = /* @__PURE__ */ __name$3(() => {
|
|
52138
52138
|
if (cleanup) try {
|
|
52139
52139
|
removeDirSync(tmpDir);
|
|
@@ -53134,7 +53134,7 @@ async function fetchPackument(name) {
|
|
|
53134
53134
|
}
|
|
53135
53135
|
__name$3(fetchPackument, "fetchPackument");
|
|
53136
53136
|
function getCacheFile(name, distTag) {
|
|
53137
|
-
return
|
|
53137
|
+
return path__default.join(tmpdir(), "update-check", `${name.replace("/", "-")}-${distTag}.json`);
|
|
53138
53138
|
}
|
|
53139
53139
|
__name$3(getCacheFile, "getCacheFile");
|
|
53140
53140
|
async function readCache(file$2) {
|
|
@@ -53150,7 +53150,7 @@ async function readCache(file$2) {
|
|
|
53150
53150
|
__name$3(readCache, "readCache");
|
|
53151
53151
|
async function writeCache(file$2, cache$1) {
|
|
53152
53152
|
try {
|
|
53153
|
-
await mkdir(
|
|
53153
|
+
await mkdir(path__default.dirname(file$2), { recursive: true });
|
|
53154
53154
|
await writeFile(file$2, JSON.stringify(cache$1), "utf8");
|
|
53155
53155
|
} catch {}
|
|
53156
53156
|
}
|
|
@@ -53161,7 +53161,7 @@ function compareVersions(a, b) {
|
|
|
53161
53161
|
__name$3(compareVersions, "compareVersions");
|
|
53162
53162
|
async function openInBrowser(url$2, logger$2) {
|
|
53163
53163
|
try {
|
|
53164
|
-
const { default: open$2 } = await import("./open-NPEHYJ5T-
|
|
53164
|
+
const { default: open$2 } = await import("./open-NPEHYJ5T-DzmTra1S.mjs");
|
|
53165
53165
|
(await open$2(url$2)).on("error", (err) => {
|
|
53166
53166
|
handleBrowserOpenError(url$2, err, logger$2);
|
|
53167
53167
|
});
|
|
@@ -53315,16 +53315,16 @@ var DEFAULT_MIGRATIONS_DIR = "./migrations";
|
|
|
53315
53315
|
function getD1MigrationFiles(options) {
|
|
53316
53316
|
const migrationsDir = normalizeRelativePath(options.migrationsDir ?? DEFAULT_MIGRATIONS_DIR);
|
|
53317
53317
|
const dirRelativePattern = stripDirPrefix(normalizeRelativePath(options.migrationsPattern ?? `${migrationsDir}/*.sql`), migrationsDir);
|
|
53318
|
-
const walkRoot =
|
|
53318
|
+
const walkRoot = path__default.resolve(options.projectPath, migrationsDir);
|
|
53319
53319
|
return listFilesRelative(walkRoot, new import_minimatch.Minimatch(dirRelativePattern, { dot: false })).map((name) => ({
|
|
53320
53320
|
name,
|
|
53321
|
-
filePath:
|
|
53321
|
+
filePath: path__default.join(walkRoot, ...name.split("/"))
|
|
53322
53322
|
}));
|
|
53323
53323
|
}
|
|
53324
53324
|
__name$3(getD1MigrationFiles, "getD1MigrationFiles");
|
|
53325
53325
|
function normalizeRelativePath(p$3) {
|
|
53326
53326
|
const forwardSlashed = p$3.replace(/\\/g, "/");
|
|
53327
|
-
const normalized =
|
|
53327
|
+
const normalized = path__default.posix.normalize(forwardSlashed);
|
|
53328
53328
|
if (normalized.endsWith("/")) return normalized.slice(0, -1);
|
|
53329
53329
|
return normalized;
|
|
53330
53330
|
}
|
|
@@ -53346,7 +53346,7 @@ function listFilesRelative(dir2, matcher) {
|
|
|
53346
53346
|
const { abs, rel } = stack.pop();
|
|
53347
53347
|
let entries;
|
|
53348
53348
|
try {
|
|
53349
|
-
entries =
|
|
53349
|
+
entries = fs2.readdirSync(abs, { withFileTypes: true });
|
|
53350
53350
|
} catch {
|
|
53351
53351
|
continue;
|
|
53352
53352
|
}
|
|
@@ -53354,7 +53354,7 @@ function listFilesRelative(dir2, matcher) {
|
|
|
53354
53354
|
const childRel = rel === "" ? entry.name : `${rel}/${entry.name}`;
|
|
53355
53355
|
if (entry.isDirectory()) {
|
|
53356
53356
|
if (matcher.match(childRel, true)) stack.push({
|
|
53357
|
-
abs:
|
|
53357
|
+
abs: path__default.join(abs, entry.name),
|
|
53358
53358
|
rel: childRel
|
|
53359
53359
|
});
|
|
53360
53360
|
} else if (entry.isFile() && matcher.match(childRel)) out.push(childRel);
|
|
@@ -57629,13 +57629,13 @@ function createProfileStore(args) {
|
|
|
57629
57629
|
args.bindings.write(currentBindings);
|
|
57630
57630
|
},
|
|
57631
57631
|
activate(profile, dir$1) {
|
|
57632
|
-
const normalizedDir =
|
|
57632
|
+
const normalizedDir = path__default.resolve(dir$1);
|
|
57633
57633
|
const currentBindings = args.bindings.read();
|
|
57634
57634
|
currentBindings[normalizedDir] = profile;
|
|
57635
57635
|
args.bindings.write(currentBindings);
|
|
57636
57636
|
},
|
|
57637
57637
|
deactivate(dir$1) {
|
|
57638
|
-
const normalizedDir =
|
|
57638
|
+
const normalizedDir = path__default.resolve(dir$1);
|
|
57639
57639
|
const currentBindings = args.bindings.read();
|
|
57640
57640
|
const boundProfile = currentBindings[normalizedDir];
|
|
57641
57641
|
if (boundProfile === void 0) {
|
|
@@ -57707,18 +57707,18 @@ function validateProfileName(name) {
|
|
|
57707
57707
|
}
|
|
57708
57708
|
__name$1(validateProfileName, "validateProfileName");
|
|
57709
57709
|
function formatDirectoryForUserError(dir$1) {
|
|
57710
|
-
return
|
|
57710
|
+
return path__default.relative(process.cwd(), dir$1) || ".";
|
|
57711
57711
|
}
|
|
57712
57712
|
__name$1(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
57713
57713
|
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
57714
|
-
const normalizedDir =
|
|
57714
|
+
const normalizedDir = path__default.resolve(startDir);
|
|
57715
57715
|
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
57716
57716
|
for (const [boundDir, profile] of sortedEntries) {
|
|
57717
57717
|
if (normalizedDir === boundDir) return {
|
|
57718
57718
|
profile,
|
|
57719
57719
|
dir: boundDir
|
|
57720
57720
|
};
|
|
57721
|
-
if (normalizedDir.startsWith(boundDir) && normalizedDir[boundDir.length] ===
|
|
57721
|
+
if (normalizedDir.startsWith(boundDir) && normalizedDir[boundDir.length] === path__default.sep) return {
|
|
57722
57722
|
profile,
|
|
57723
57723
|
dir: boundDir
|
|
57724
57724
|
};
|
|
@@ -57894,7 +57894,7 @@ function resolveAuthProfileBaseName(profile) {
|
|
|
57894
57894
|
}
|
|
57895
57895
|
__name$1(resolveAuthProfileBaseName, "resolveAuthProfileBaseName");
|
|
57896
57896
|
function getAuthConfigFilePath$2(configPath, profile, extension = "toml") {
|
|
57897
|
-
return
|
|
57897
|
+
return path__default.join(configPath, USER_AUTH_CONFIG_PATH, `${resolveAuthProfileBaseName(profile)}.${extension}`);
|
|
57898
57898
|
}
|
|
57899
57899
|
__name$1(getAuthConfigFilePath$2, "getAuthConfigFilePath");
|
|
57900
57900
|
var FileCredentialStore = class {
|
|
@@ -57925,7 +57925,7 @@ var FileCredentialStore = class {
|
|
|
57925
57925
|
}
|
|
57926
57926
|
write(config$3) {
|
|
57927
57927
|
const filePath = this.filePath();
|
|
57928
|
-
mkdirSync(
|
|
57928
|
+
mkdirSync(path__default.dirname(filePath), { recursive: true });
|
|
57929
57929
|
writeFileSync(filePath, stringifyFile(this.format, config$3), {
|
|
57930
57930
|
encoding: "utf-8",
|
|
57931
57931
|
mode: 384
|
|
@@ -57990,7 +57990,7 @@ function parseEncryptedEnvelope(raw) {
|
|
|
57990
57990
|
}
|
|
57991
57991
|
__name$1(parseEncryptedEnvelope, "parseEncryptedEnvelope");
|
|
57992
57992
|
function getEncryptedAuthConfigFilePath$2(configPath, profile) {
|
|
57993
|
-
return
|
|
57993
|
+
return path__default.join(configPath, "config", `${resolveAuthProfileBaseName(profile)}.enc`);
|
|
57994
57994
|
}
|
|
57995
57995
|
__name$1(getEncryptedAuthConfigFilePath$2, "getEncryptedAuthConfigFilePath");
|
|
57996
57996
|
var EncryptedFileCredentialStore = class {
|
|
@@ -58029,7 +58029,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
58029
58029
|
const key = this.ensureKey();
|
|
58030
58030
|
const envelope = encryptString(stringifyFile(this.format, config$3), key);
|
|
58031
58031
|
const encryptedPath = getEncryptedAuthConfigFilePath$2(this.configPath, this.profile);
|
|
58032
|
-
mkdirSync(
|
|
58032
|
+
mkdirSync(path__default.dirname(encryptedPath), { recursive: true });
|
|
58033
58033
|
writeFileSync(encryptedPath, JSON.stringify(envelope, null, " "), {
|
|
58034
58034
|
encoding: "utf-8",
|
|
58035
58035
|
mode: 384
|
|
@@ -58134,11 +58134,11 @@ function setNpmRunner(fn) {
|
|
|
58134
58134
|
}
|
|
58135
58135
|
__name$1(setNpmRunner, "setNpmRunner");
|
|
58136
58136
|
function getKeyringInstallDir(configPath) {
|
|
58137
|
-
return
|
|
58137
|
+
return path__default.join(configPath, "native", "keyring");
|
|
58138
58138
|
}
|
|
58139
58139
|
__name$1(getKeyringInstallDir, "getKeyringInstallDir");
|
|
58140
58140
|
function getInstalledBindingPath(installDir) {
|
|
58141
|
-
return
|
|
58141
|
+
return path__default.join(installDir, "node_modules", "@napi-rs", "keyring");
|
|
58142
58142
|
}
|
|
58143
58143
|
__name$1(getInstalledBindingPath, "getInstalledBindingPath");
|
|
58144
58144
|
function canLoadKeyringBinding(candidate) {
|
|
@@ -58154,15 +58154,15 @@ function findKeyringBinding(installDir) {
|
|
|
58154
58154
|
const cached$2 = cachedBindingPathByDir.get(installDir);
|
|
58155
58155
|
if (cached$2 !== void 0) return cached$2;
|
|
58156
58156
|
const lazy$1 = getInstalledBindingPath(installDir);
|
|
58157
|
-
if (existsSync(
|
|
58157
|
+
if (existsSync(path__default.join(lazy$1, "index.js")) && canLoadKeyringBinding(lazy$1)) {
|
|
58158
58158
|
cachedBindingPathByDir.set(installDir, lazy$1);
|
|
58159
58159
|
return lazy$1;
|
|
58160
58160
|
}
|
|
58161
58161
|
try {
|
|
58162
58162
|
const r$1 = npmRunner(["root", "-g"]);
|
|
58163
58163
|
if (r$1.status === 0) {
|
|
58164
|
-
const global$2 =
|
|
58165
|
-
if (existsSync(
|
|
58164
|
+
const global$2 = path__default.join(r$1.stdout.trim(), "@napi-rs", "keyring");
|
|
58165
|
+
if (existsSync(path__default.join(global$2, "index.js")) && canLoadKeyringBinding(global$2)) {
|
|
58166
58166
|
cachedBindingPathByDir.set(installDir, global$2);
|
|
58167
58167
|
return global$2;
|
|
58168
58168
|
}
|
|
@@ -58175,7 +58175,7 @@ __name$1(findKeyringBinding, "findKeyringBinding");
|
|
|
58175
58175
|
function installKeyringBindingSync(installDir) {
|
|
58176
58176
|
const dir$1 = installDir;
|
|
58177
58177
|
mkdirSync(dir$1, { recursive: true });
|
|
58178
|
-
const hostPkgJson =
|
|
58178
|
+
const hostPkgJson = path__default.join(dir$1, "package.json");
|
|
58179
58179
|
if (!existsSync(hostPkgJson)) writeFileSync(hostPkgJson, JSON.stringify({
|
|
58180
58180
|
private: true,
|
|
58181
58181
|
name: "cloudflare-auth-keyring-host"
|
|
@@ -58626,7 +58626,7 @@ var AuthenticationError = class extends UserError {
|
|
|
58626
58626
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
58627
58627
|
function createPreferences(getConfigPath) {
|
|
58628
58628
|
function getUserPreferencesPath() {
|
|
58629
|
-
return
|
|
58629
|
+
return path__default.resolve(getConfigPath(), "preferences.json");
|
|
58630
58630
|
}
|
|
58631
58631
|
__name$1(getUserPreferencesPath, "getUserPreferencesPath");
|
|
58632
58632
|
function readUserPreferences$2() {
|
|
@@ -58646,7 +58646,7 @@ function createPreferences(getConfigPath) {
|
|
|
58646
58646
|
...update
|
|
58647
58647
|
};
|
|
58648
58648
|
const filePath = getUserPreferencesPath();
|
|
58649
|
-
mkdirSync(
|
|
58649
|
+
mkdirSync(path__default.dirname(filePath), { recursive: true });
|
|
58650
58650
|
writeFileSync(filePath, JSON.stringify(next, null, " "), { encoding: "utf-8" });
|
|
58651
58651
|
}
|
|
58652
58652
|
__name$1(updateUserPreferences$2, "updateUserPreferences");
|
|
@@ -59281,7 +59281,7 @@ function createFileStorage(format$3, getPath) {
|
|
|
59281
59281
|
}, "read"),
|
|
59282
59282
|
write(config$3) {
|
|
59283
59283
|
const configPath = getPath();
|
|
59284
|
-
mkdirSync(
|
|
59284
|
+
mkdirSync(path__default.dirname(configPath), { recursive: true });
|
|
59285
59285
|
writeFileSync(configPath, stringifyFile(format$3, config$3), {
|
|
59286
59286
|
encoding: "utf-8",
|
|
59287
59287
|
mode: 384
|
|
@@ -59605,7 +59605,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
59605
59605
|
}
|
|
59606
59606
|
__name$1(encryptedPath, "encryptedPath");
|
|
59607
59607
|
function getProfileConfigDirectory() {
|
|
59608
|
-
return
|
|
59608
|
+
return path__default.dirname(plaintextPath("default"));
|
|
59609
59609
|
}
|
|
59610
59610
|
__name$1(getProfileConfigDirectory, "getProfileConfigDirectory");
|
|
59611
59611
|
const configs = {
|
|
@@ -59632,7 +59632,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
59632
59632
|
}
|
|
59633
59633
|
};
|
|
59634
59634
|
function getDirectoryBindingsPath() {
|
|
59635
|
-
return
|
|
59635
|
+
return path__default.join(getConfigPath(), DIRECTORY_BINDINGS_FILE);
|
|
59636
59636
|
}
|
|
59637
59637
|
__name$1(getDirectoryBindingsPath, "getDirectoryBindingsPath");
|
|
59638
59638
|
return createProfileStore({
|
|
@@ -59648,7 +59648,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
59648
59648
|
},
|
|
59649
59649
|
write(dirBindings) {
|
|
59650
59650
|
const bindingsPath = getDirectoryBindingsPath();
|
|
59651
|
-
mkdirSync(
|
|
59651
|
+
mkdirSync(path__default.dirname(bindingsPath), { recursive: true });
|
|
59652
59652
|
writeFileSync(bindingsPath, JSON.stringify(dirBindings, null, " "), "utf-8");
|
|
59653
59653
|
}
|
|
59654
59654
|
}
|
|
@@ -60298,7 +60298,7 @@ function getTemporaryAccountConfigFile$1() {
|
|
|
60298
60298
|
}
|
|
60299
60299
|
__name$1(getTemporaryAccountConfigFile$1, "getTemporaryAccountConfigFile");
|
|
60300
60300
|
function getCfTemporaryAccountConfigPath() {
|
|
60301
|
-
return
|
|
60301
|
+
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile$1());
|
|
60302
60302
|
}
|
|
60303
60303
|
__name$1(getCfTemporaryAccountConfigPath, "getCfTemporaryAccountConfigPath");
|
|
60304
60304
|
function createJsonFileStorage(getPath) {
|
|
@@ -60378,8 +60378,8 @@ const debuglog = util.debuglog("@cloudflare:vite-plugin");
|
|
|
60378
60378
|
function toApiComplianceRegion(region) {
|
|
60379
60379
|
return region === "fedramp-high" ? "fedramp_high" : region;
|
|
60380
60380
|
}
|
|
60381
|
-
function withTrailingSlash$1(path$
|
|
60382
|
-
return path$
|
|
60381
|
+
function withTrailingSlash$1(path$3) {
|
|
60382
|
+
return path$3.endsWith("/") ? path$3 : `${path$3}/`;
|
|
60383
60383
|
}
|
|
60384
60384
|
function createRequestHandler(handler) {
|
|
60385
60385
|
return async (req, res, next) => {
|
|
@@ -66819,10 +66819,10 @@ async function dockerBuild(dockerPath, options) {
|
|
|
66819
66819
|
__name$2(dockerBuild, "dockerBuild");
|
|
66820
66820
|
function resolveInputContainerImage(options) {
|
|
66821
66821
|
if ("reference" in options.image) return { reference: options.image.reference };
|
|
66822
|
-
const dockerfile =
|
|
66822
|
+
const dockerfile = path__default.resolve(options.root, options.image.dockerfile);
|
|
66823
66823
|
return {
|
|
66824
66824
|
dockerfile,
|
|
66825
|
-
buildContext: options.image.buildContext === void 0 ?
|
|
66825
|
+
buildContext: options.image.buildContext === void 0 ? path__default.dirname(dockerfile) : path__default.resolve(options.root, options.image.buildContext),
|
|
66826
66826
|
buildVars: options.image.buildVars
|
|
66827
66827
|
};
|
|
66828
66828
|
}
|
|
@@ -66968,7 +66968,7 @@ async function cleanupPreviousBuildOutputImageTags(options) {
|
|
|
66968
66968
|
}
|
|
66969
66969
|
__name$2(cleanupPreviousBuildOutputImageTags, "cleanupPreviousBuildOutputImageTags");
|
|
66970
66970
|
function getBuildOutputImageRepositoryPrefix(root) {
|
|
66971
|
-
return `${BUILD_OUTPUT_IMAGE_NAMESPACE}/${shortHash(
|
|
66971
|
+
return `${BUILD_OUTPUT_IMAGE_NAMESPACE}/${shortHash(path__default.resolve(root))}/`;
|
|
66972
66972
|
}
|
|
66973
66973
|
__name$2(getBuildOutputImageRepositoryPrefix, "getBuildOutputImageRepositoryPrefix");
|
|
66974
66974
|
function shortHash(value) {
|
|
@@ -67725,14 +67725,14 @@ function createContainerDevPlan(options) {
|
|
|
67725
67725
|
if (resolvedContainer === void 0) throw new Error(`Expected Durable Object-managed Container "${container.name}" to be resolved`);
|
|
67726
67726
|
const className2 = resolvedContainer.class_name;
|
|
67727
67727
|
const namedOptions = [];
|
|
67728
|
-
const baseDir$1 = configPath ?
|
|
67728
|
+
const baseDir$1 = configPath ? path__default.dirname(configPath) : process.cwd();
|
|
67729
67729
|
for (const [imageName, image] of Object.entries(container.images ?? {})) {
|
|
67730
67730
|
const imageTag2 = getNamedContainerImageTag(className2, imageName, requireContainerBuildId(containerBuildId));
|
|
67731
67731
|
if (image.dockerfile !== void 0) {
|
|
67732
|
-
const dockerfile =
|
|
67732
|
+
const dockerfile = path__default.resolve(baseDir$1, image.dockerfile);
|
|
67733
67733
|
namedOptions.push({
|
|
67734
67734
|
dockerfile,
|
|
67735
|
-
image_build_context: image.build_context === void 0 ?
|
|
67735
|
+
image_build_context: image.build_context === void 0 ? path__default.dirname(dockerfile) : path__default.resolve(baseDir$1, image.build_context),
|
|
67736
67736
|
image_vars: image.build_vars,
|
|
67737
67737
|
class_name: className2,
|
|
67738
67738
|
image_name: imageName,
|
|
@@ -67760,7 +67760,7 @@ function createContainerDevPlan(options) {
|
|
|
67760
67760
|
containerRuntimeOptions.set(className, { imageName: imageTag });
|
|
67761
67761
|
if (isDockerfile(container.image, configPath)) containerOptions.push({
|
|
67762
67762
|
dockerfile: container.image,
|
|
67763
|
-
image_build_context: container.image_build_context ??
|
|
67763
|
+
image_build_context: container.image_build_context ?? path__default.dirname(container.image),
|
|
67764
67764
|
image_vars: container.image_vars,
|
|
67765
67765
|
class_name: className,
|
|
67766
67766
|
image_tag: imageTag
|
|
@@ -68291,7 +68291,7 @@ function getTemporaryAccountConfigFile() {
|
|
|
68291
68291
|
}
|
|
68292
68292
|
__name$1(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
68293
68293
|
function getTemporaryPreviewAccountConfigPath() {
|
|
68294
|
-
return
|
|
68294
|
+
return path__default.join(getGlobalConfigPath(), getTemporaryAccountConfigFile());
|
|
68295
68295
|
}
|
|
68296
68296
|
__name$1(getTemporaryPreviewAccountConfigPath, "getTemporaryPreviewAccountConfigPath");
|
|
68297
68297
|
function createTomlFileStorage(getPath) {
|
|
@@ -68367,11 +68367,11 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
68367
68367
|
var require_command_exists$1 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js": ((exports, module) => {
|
|
68368
68368
|
var exec = __require$2("child_process").exec;
|
|
68369
68369
|
var execSync = __require$2("child_process").execSync;
|
|
68370
|
-
var fs$
|
|
68371
|
-
var path$
|
|
68372
|
-
var access = fs$
|
|
68373
|
-
var accessSync$1 = fs$
|
|
68374
|
-
var constants$2 = fs$
|
|
68370
|
+
var fs$2 = __require$2("fs");
|
|
68371
|
+
var path$1 = __require$2("path");
|
|
68372
|
+
var access = fs$2.access;
|
|
68373
|
+
var accessSync$1 = fs$2.accessSync;
|
|
68374
|
+
var constants$2 = fs$2.constants || fs$2;
|
|
68375
68375
|
var isUsingWindows = process.platform == "win32";
|
|
68376
68376
|
var fileNotExists = function(commandName, callback) {
|
|
68377
68377
|
access(commandName, constants$2.F_OK, function(err) {
|
|
@@ -68445,8 +68445,8 @@ var require_command_exists$1 = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk
|
|
|
68445
68445
|
};
|
|
68446
68446
|
if (isUsingWindows) cleanInput = function(s) {
|
|
68447
68447
|
if (/[\\]/.test(s)) {
|
|
68448
|
-
var dirname$2 = "\"" + path$
|
|
68449
|
-
var basename$1 = "\"" + path$
|
|
68448
|
+
var dirname$2 = "\"" + path$1.dirname(s) + "\"";
|
|
68449
|
+
var basename$1 = "\"" + path$1.basename(s) + "\"";
|
|
68450
68450
|
return dirname$2 + ":" + basename$1;
|
|
68451
68451
|
}
|
|
68452
68452
|
return "\"" + s + "\"";
|
|
@@ -68958,11 +68958,11 @@ function createWorkerUploadForm(worker, bindings, options) {
|
|
|
68958
68958
|
const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
|
|
68959
68959
|
if (modules?.some(({ name }) => name === manifestModuleName) && main.type === "esm") {
|
|
68960
68960
|
assert(modules !== void 0);
|
|
68961
|
-
const subDirs = new Set(modules.map((module$1) =>
|
|
68961
|
+
const subDirs = new Set(modules.map((module$1) => path__default.posix.dirname(module$1.name)));
|
|
68962
68962
|
for (const subDir of subDirs) {
|
|
68963
68963
|
if (subDir === ".") continue;
|
|
68964
|
-
const relativePath =
|
|
68965
|
-
const filePath =
|
|
68964
|
+
const relativePath = path__default.posix.relative(subDir, manifestModuleName);
|
|
68965
|
+
const filePath = path__default.posix.join(subDir, manifestModuleName);
|
|
68966
68966
|
modules.push({
|
|
68967
68967
|
name: filePath,
|
|
68968
68968
|
filePath,
|
|
@@ -69047,7 +69047,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
69047
69047
|
//#endregion
|
|
69048
69048
|
//#region ../../workers-sdk/packages/remote-bindings/dist/index.mjs
|
|
69049
69049
|
var import_undici = require_undici();
|
|
69050
|
-
var version$2 = "0.0.
|
|
69050
|
+
var version$2 = "0.0.52";
|
|
69051
69051
|
var NoDefaultValueProvided = class extends UserError {
|
|
69052
69052
|
constructor() {
|
|
69053
69053
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -69504,7 +69504,7 @@ function createRemoteWorkerInit(props) {
|
|
|
69504
69504
|
return {
|
|
69505
69505
|
name: props.name,
|
|
69506
69506
|
main: {
|
|
69507
|
-
name:
|
|
69507
|
+
name: path__default.basename(props.bundle.path),
|
|
69508
69508
|
filePath: props.bundle.path,
|
|
69509
69509
|
type: props.bundle.type,
|
|
69510
69510
|
content: props.bundle.entrypointSource
|
|
@@ -70095,9 +70095,9 @@ function constructHeaders({ headers, headersFile, logger: logger$2 }) {
|
|
|
70095
70095
|
|
|
70096
70096
|
//#endregion
|
|
70097
70097
|
//#region ../../workers-sdk/packages/workers-shared/utils/configuration/validateURL.ts
|
|
70098
|
-
const extractPathname = (path$
|
|
70099
|
-
if (!path$
|
|
70100
|
-
const url$2 = new URL(`//${path$
|
|
70098
|
+
const extractPathname = (path$3 = "/", includeSearch, includeHash) => {
|
|
70099
|
+
if (!path$3.startsWith("/")) path$3 = `/${path$3}`;
|
|
70100
|
+
const url$2 = new URL(`//${path$3}`, "relative://");
|
|
70101
70101
|
return `${url$2.pathname}${includeSearch ? url$2.search : ""}${includeHash ? url$2.hash : ""}`;
|
|
70102
70102
|
};
|
|
70103
70103
|
const URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
|
|
@@ -70156,7 +70156,7 @@ function parseHeaders(input$1, { maxRules = MAX_HEADER_RULES, maxLineLength = MA
|
|
|
70156
70156
|
lineNumber: i$1 + 1,
|
|
70157
70157
|
message: "No headers specified"
|
|
70158
70158
|
});
|
|
70159
|
-
const [path$
|
|
70159
|
+
const [path$3, pathError] = validateUrl(line, false, true);
|
|
70160
70160
|
if (pathError) {
|
|
70161
70161
|
invalid.push({
|
|
70162
70162
|
line,
|
|
@@ -70167,7 +70167,7 @@ function parseHeaders(input$1, { maxRules = MAX_HEADER_RULES, maxLineLength = MA
|
|
|
70167
70167
|
skipUntilNextPath = true;
|
|
70168
70168
|
continue;
|
|
70169
70169
|
}
|
|
70170
|
-
const wildcardError = validateNoMultipleWildcards(path$
|
|
70170
|
+
const wildcardError = validateNoMultipleWildcards(path$3);
|
|
70171
70171
|
if (wildcardError) {
|
|
70172
70172
|
invalid.push({
|
|
70173
70173
|
line,
|
|
@@ -70179,7 +70179,7 @@ function parseHeaders(input$1, { maxRules = MAX_HEADER_RULES, maxLineLength = MA
|
|
|
70179
70179
|
continue;
|
|
70180
70180
|
}
|
|
70181
70181
|
rule = {
|
|
70182
|
-
path: path$
|
|
70182
|
+
path: path$3,
|
|
70183
70183
|
line,
|
|
70184
70184
|
headers: {},
|
|
70185
70185
|
unsetHeaders: []
|
|
@@ -70262,11 +70262,11 @@ function isValidRule(rule) {
|
|
|
70262
70262
|
* `:splat` placeholder, would result in duplicate `:splat` parameters which is
|
|
70263
70263
|
* unsupported.
|
|
70264
70264
|
*/
|
|
70265
|
-
function validateNoMultipleWildcards(path$
|
|
70266
|
-
const wildcardCount = (path$
|
|
70267
|
-
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$
|
|
70268
|
-
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$
|
|
70269
|
-
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$
|
|
70265
|
+
function validateNoMultipleWildcards(path$3) {
|
|
70266
|
+
const wildcardCount = (path$3.match(SPLAT_REGEX) ?? []).length;
|
|
70267
|
+
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$3);
|
|
70268
|
+
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$3}.`;
|
|
70269
|
+
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$3}.`;
|
|
70270
70270
|
}
|
|
70271
70271
|
|
|
70272
70272
|
//#endregion
|
|
@@ -70483,13 +70483,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
70483
70483
|
const throwError = (message, Ctor) => {
|
|
70484
70484
|
throw new Ctor(message);
|
|
70485
70485
|
};
|
|
70486
|
-
const checkPath = (path$
|
|
70487
|
-
if (!isString(path$
|
|
70488
|
-
if (!path$
|
|
70489
|
-
if (checkPath.isNotRelative(path$
|
|
70486
|
+
const checkPath = (path$3, originalPath, doThrow) => {
|
|
70487
|
+
if (!isString(path$3)) return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
|
70488
|
+
if (!path$3) return doThrow(`path must not be empty`, TypeError);
|
|
70489
|
+
if (checkPath.isNotRelative(path$3)) return doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`, RangeError);
|
|
70490
70490
|
return true;
|
|
70491
70491
|
};
|
|
70492
|
-
const isNotRelative = (path$
|
|
70492
|
+
const isNotRelative = (path$3) => REGEX_TEST_INVALID_PATH.test(path$3);
|
|
70493
70493
|
checkPath.isNotRelative = isNotRelative;
|
|
70494
70494
|
checkPath.convert = (p$3) => p$3;
|
|
70495
70495
|
var Ignore = class {
|
|
@@ -70525,13 +70525,13 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
70525
70525
|
addPattern(pattern) {
|
|
70526
70526
|
return this.add(pattern);
|
|
70527
70527
|
}
|
|
70528
|
-
_testOne(path$
|
|
70528
|
+
_testOne(path$3, checkUnignored) {
|
|
70529
70529
|
let ignored = false;
|
|
70530
70530
|
let unignored = false;
|
|
70531
70531
|
this._rules.forEach((rule) => {
|
|
70532
70532
|
const { negative } = rule;
|
|
70533
70533
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) return;
|
|
70534
|
-
if (rule.regex.test(path$
|
|
70534
|
+
if (rule.regex.test(path$3)) {
|
|
70535
70535
|
ignored = !negative;
|
|
70536
70536
|
unignored = negative;
|
|
70537
70537
|
}
|
|
@@ -70542,33 +70542,33 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
70542
70542
|
};
|
|
70543
70543
|
}
|
|
70544
70544
|
_test(originalPath, cache$1, checkUnignored, slices) {
|
|
70545
|
-
const path$
|
|
70546
|
-
checkPath(path$
|
|
70547
|
-
return this._t(path$
|
|
70545
|
+
const path$3 = originalPath && checkPath.convert(originalPath);
|
|
70546
|
+
checkPath(path$3, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
|
70547
|
+
return this._t(path$3, cache$1, checkUnignored, slices);
|
|
70548
70548
|
}
|
|
70549
|
-
_t(path$
|
|
70550
|
-
if (path$
|
|
70551
|
-
if (!slices) slices = path$
|
|
70549
|
+
_t(path$3, cache$1, checkUnignored, slices) {
|
|
70550
|
+
if (path$3 in cache$1) return cache$1[path$3];
|
|
70551
|
+
if (!slices) slices = path$3.split(SLASH);
|
|
70552
70552
|
slices.pop();
|
|
70553
|
-
if (!slices.length) return cache$1[path$
|
|
70553
|
+
if (!slices.length) return cache$1[path$3] = this._testOne(path$3, checkUnignored);
|
|
70554
70554
|
const parent = this._t(slices.join(SLASH) + SLASH, cache$1, checkUnignored, slices);
|
|
70555
|
-
return cache$1[path$
|
|
70555
|
+
return cache$1[path$3] = parent.ignored ? parent : this._testOne(path$3, checkUnignored);
|
|
70556
70556
|
}
|
|
70557
|
-
ignores(path$
|
|
70558
|
-
return this._test(path$
|
|
70557
|
+
ignores(path$3) {
|
|
70558
|
+
return this._test(path$3, this._ignoreCache, false).ignored;
|
|
70559
70559
|
}
|
|
70560
70560
|
createFilter() {
|
|
70561
|
-
return (path$
|
|
70561
|
+
return (path$3) => !this.ignores(path$3);
|
|
70562
70562
|
}
|
|
70563
70563
|
filter(paths) {
|
|
70564
70564
|
return makeArray(paths).filter(this.createFilter());
|
|
70565
70565
|
}
|
|
70566
|
-
test(path$
|
|
70567
|
-
return this._test(path$
|
|
70566
|
+
test(path$3) {
|
|
70567
|
+
return this._test(path$3, this._testCache, true);
|
|
70568
70568
|
}
|
|
70569
70569
|
};
|
|
70570
70570
|
const factory = (options) => new Ignore(options);
|
|
70571
|
-
const isPathValid = (path$
|
|
70571
|
+
const isPathValid = (path$3) => checkPath(path$3 && checkPath.convert(path$3), path$3, RETURN_FALSE);
|
|
70572
70572
|
factory.isPathValid = isPathValid;
|
|
70573
70573
|
factory.default = factory;
|
|
70574
70574
|
module.exports = factory;
|
|
@@ -70577,7 +70577,7 @@ var require_ignore = /* @__PURE__ */ __commonJS$2({ "../../workers-sdk/node_modu
|
|
|
70577
70577
|
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
70578
70578
|
checkPath.convert = makePosix;
|
|
70579
70579
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
70580
|
-
checkPath.isNotRelative = (path$
|
|
70580
|
+
checkPath.isNotRelative = (path$3) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path$3) || isNotRelative(path$3);
|
|
70581
70581
|
}
|
|
70582
70582
|
}) });
|
|
70583
70583
|
|
|
@@ -71932,11 +71932,11 @@ var Mime = class {
|
|
|
71932
71932
|
}
|
|
71933
71933
|
return this;
|
|
71934
71934
|
}
|
|
71935
|
-
getType(path$
|
|
71936
|
-
if (typeof path$
|
|
71937
|
-
const last = path$
|
|
71935
|
+
getType(path$3) {
|
|
71936
|
+
if (typeof path$3 !== "string") return null;
|
|
71937
|
+
const last = path$3.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
71938
71938
|
const ext = last.replace(/^.*\./s, "").toLowerCase();
|
|
71939
|
-
const hasPath = last.length < path$
|
|
71939
|
+
const hasPath = last.length < path$3.length;
|
|
71940
71940
|
if (!(ext.length < last.length - 1) && hasPath) return null;
|
|
71941
71941
|
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
71942
71942
|
}
|
|
@@ -72281,11 +72281,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
72281
72281
|
for (let i$1 = startIndex; i$1 < x.issues.length; i$1++) if (x.issues[i$1]?.continue === false) return true;
|
|
72282
72282
|
return false;
|
|
72283
72283
|
}
|
|
72284
|
-
function prefixIssues(path$
|
|
72284
|
+
function prefixIssues(path$3, issues) {
|
|
72285
72285
|
return issues.map((iss) => {
|
|
72286
72286
|
var _a$3;
|
|
72287
72287
|
(_a$3 = iss).path ?? (_a$3.path = []);
|
|
72288
|
-
iss.path.unshift(path$
|
|
72288
|
+
iss.path.unshift(path$3);
|
|
72289
72289
|
return iss;
|
|
72290
72290
|
});
|
|
72291
72291
|
}
|
|
@@ -72692,12 +72692,12 @@ function flattenError(error$3, mapper = (issue$2) => issue$2.message) {
|
|
|
72692
72692
|
}
|
|
72693
72693
|
function formatError(error$3, mapper = (issue$2) => issue$2.message) {
|
|
72694
72694
|
const fieldErrors = { _errors: [] };
|
|
72695
|
-
const processError = (error$4, path$
|
|
72696
|
-
for (const issue$2 of error$4.issues) if (issue$2.code === "invalid_union" && issue$2.errors.length) issue$2.errors.map((issues) => processError({ issues }, [...path$
|
|
72697
|
-
else if (issue$2.code === "invalid_key") processError({ issues: issue$2.issues }, [...path$
|
|
72698
|
-
else if (issue$2.code === "invalid_element") processError({ issues: issue$2.issues }, [...path$
|
|
72695
|
+
const processError = (error$4, path$3 = []) => {
|
|
72696
|
+
for (const issue$2 of error$4.issues) if (issue$2.code === "invalid_union" && issue$2.errors.length) issue$2.errors.map((issues) => processError({ issues }, [...path$3, ...issue$2.path]));
|
|
72697
|
+
else if (issue$2.code === "invalid_key") processError({ issues: issue$2.issues }, [...path$3, ...issue$2.path]);
|
|
72698
|
+
else if (issue$2.code === "invalid_element") processError({ issues: issue$2.issues }, [...path$3, ...issue$2.path]);
|
|
72699
72699
|
else {
|
|
72700
|
-
const fullpath = [...path$
|
|
72700
|
+
const fullpath = [...path$3, ...issue$2.path];
|
|
72701
72701
|
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue$2));
|
|
72702
72702
|
else {
|
|
72703
72703
|
let curr = fieldErrors;
|
|
@@ -77661,10 +77661,10 @@ function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig
|
|
|
77661
77661
|
};
|
|
77662
77662
|
}
|
|
77663
77663
|
function getRedirectsConfigPath(config$3) {
|
|
77664
|
-
return path
|
|
77664
|
+
return path.join(config$3.publicDir, REDIRECTS_FILENAME);
|
|
77665
77665
|
}
|
|
77666
77666
|
function getHeadersConfigPath(config$3) {
|
|
77667
|
-
return path
|
|
77667
|
+
return path.join(config$3.publicDir, HEADERS_FILENAME);
|
|
77668
77668
|
}
|
|
77669
77669
|
|
|
77670
77670
|
//#endregion
|
|
@@ -78000,7 +78000,7 @@ const INTERNAL_WORKERS_COMPATIBILITY_DATE = "2024-10-04";
|
|
|
78000
78000
|
const PUBLIC_DIR_PREFIX = "/__vite_public_dir__";
|
|
78001
78001
|
function getPersistenceRoot(root, persistState) {
|
|
78002
78002
|
if (persistState === false) return;
|
|
78003
|
-
return path
|
|
78003
|
+
return path.resolve(root, typeof persistState === "object" ? persistState.path : ".cloudflare/state", "v3");
|
|
78004
78004
|
}
|
|
78005
78005
|
const miniflareModulesRoot = process.platform === "win32" ? "Z:\\" : "/";
|
|
78006
78006
|
const ROUTER_WORKER_PATH = "./workers/router-worker/index.js";
|
|
@@ -78017,14 +78017,14 @@ async function getInternalWorkerManifest(workerPath) {
|
|
|
78017
78017
|
modulesRoot: miniflareModulesRoot,
|
|
78018
78018
|
modules: { [workerPath]: {
|
|
78019
78019
|
type: "esm",
|
|
78020
|
-
contents: await fs$
|
|
78020
|
+
contents: await fs$1.readFile(fileURLToPath(new URL(workerPath, import.meta.url)), "utf8")
|
|
78021
78021
|
} }
|
|
78022
78022
|
};
|
|
78023
78023
|
}
|
|
78024
78024
|
async function getUserWorkerManifest(wrapperContents) {
|
|
78025
78025
|
const moduleRunner = "workers/runner-worker/vite/module-runner";
|
|
78026
78026
|
const moduleRunnerSource = satisfiesMinimumViteVersion("7.2.0") ? MODULE_RUNNER_PATH : MODULE_RUNNER_LEGACY_PATH;
|
|
78027
|
-
const [runnerContents, moduleRunnerContents] = await Promise.all([fs$
|
|
78027
|
+
const [runnerContents, moduleRunnerContents] = await Promise.all([fs$1.readFile(fileURLToPath(new URL(RUNNER_PATH, import.meta.url)), "utf8"), fs$1.readFile(fileURLToPath(new URL(moduleRunnerSource, import.meta.url)), "utf8")]);
|
|
78028
78028
|
return {
|
|
78029
78029
|
mainModule: WRAPPER_PATH,
|
|
78030
78030
|
modulesRoot: miniflareModulesRoot,
|
|
@@ -78141,10 +78141,10 @@ async function getDevMiniflareOptions$1(ctx, viteDevServer) {
|
|
|
78141
78141
|
const publicDirInRoot = publicDir.startsWith(withTrailingSlash$1(root));
|
|
78142
78142
|
const publicPath = withTrailingSlash$1(publicDir.slice(root.length));
|
|
78143
78143
|
if (publicDirInRoot && pathname.startsWith(publicPath)) return Response$1.json(null);
|
|
78144
|
-
const publicDirFilePath = path
|
|
78145
|
-
const rootDirFilePath = path
|
|
78144
|
+
const publicDirFilePath = path.join(publicDir, pathname);
|
|
78145
|
+
const rootDirFilePath = path.join(root, pathname);
|
|
78146
78146
|
for (const resolvedPath of [publicDirFilePath, rootDirFilePath]) try {
|
|
78147
|
-
if ((await fs$
|
|
78147
|
+
if ((await fs$1.stat(resolvedPath)).isFile()) return Response$1.json(resolvedPath === publicDirFilePath ? `${PUBLIC_DIR_PREFIX}${pathname}` : pathname);
|
|
78148
78148
|
} catch {}
|
|
78149
78149
|
}
|
|
78150
78150
|
return Response$1.json(null);
|
|
@@ -78157,8 +78157,8 @@ async function getDevMiniflareOptions$1(ctx, viteDevServer) {
|
|
|
78157
78157
|
try {
|
|
78158
78158
|
const { root, publicDir } = resolvedViteConfig;
|
|
78159
78159
|
if (pathname.startsWith(PUBLIC_DIR_PREFIX)) {
|
|
78160
|
-
const resolvedPath$1 = path
|
|
78161
|
-
return new Response$1(await fs$
|
|
78160
|
+
const resolvedPath$1 = path.join(publicDir, pathname.slice(20));
|
|
78161
|
+
return new Response$1(await fs$1.readFile(resolvedPath$1, "utf-8"), { headers: { "Content-Type": "text/html" } });
|
|
78162
78162
|
}
|
|
78163
78163
|
const bundledDev = viteDevServer.environments.client.bundledDev;
|
|
78164
78164
|
if (bundledDev) {
|
|
@@ -78173,8 +78173,8 @@ async function getDevMiniflareOptions$1(ctx, viteDevServer) {
|
|
|
78173
78173
|
if (!file$2) throw new Error(`No bundled file for "${pathname}" after waiting for bundle regeneration.`);
|
|
78174
78174
|
return new Response$1(typeof file$2.source === "string" ? file$2.source : Buffer.from(file$2.source), { headers: { "Content-Type": "text/html" } });
|
|
78175
78175
|
}
|
|
78176
|
-
const resolvedPath = path
|
|
78177
|
-
let html = await fs$
|
|
78176
|
+
const resolvedPath = path.join(root, pathname);
|
|
78177
|
+
let html = await fs$1.readFile(resolvedPath, "utf-8");
|
|
78178
78178
|
html = await viteDevServer.transformIndexHtml(resolvedPath, html);
|
|
78179
78179
|
return new Response$1(html, { headers: { "Content-Type": "text/html" } });
|
|
78180
78180
|
} catch (error$3) {
|
|
@@ -78324,7 +78324,7 @@ async function getDevMiniflareOptions$1(ctx, viteDevServer) {
|
|
|
78324
78324
|
await viteDevServer.restart();
|
|
78325
78325
|
},
|
|
78326
78326
|
resourcePersistencePath: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
|
|
78327
|
-
resourceTmpPath: path
|
|
78327
|
+
resourceTmpPath: path.resolve(resolvedViteConfig.root, ".cloudflare/tmp"),
|
|
78328
78328
|
containerEngine,
|
|
78329
78329
|
workers: [...assetWorkers, ...userWorkers],
|
|
78330
78330
|
async unsafeModuleFallbackService(request$2) {
|
|
@@ -78339,7 +78339,7 @@ async function getDevMiniflareOptions$1(ctx, viteDevServer) {
|
|
|
78339
78339
|
assert(modulePath, `Unexpected error: module path not found in reference: ${full}.`);
|
|
78340
78340
|
let contents;
|
|
78341
78341
|
try {
|
|
78342
|
-
contents = await fs$
|
|
78342
|
+
contents = await fs$1.readFile(modulePath);
|
|
78343
78343
|
} catch {
|
|
78344
78344
|
throw new Error(`Import "${modulePath}" not found. Does the file exist?`);
|
|
78345
78345
|
}
|
|
@@ -78364,7 +78364,7 @@ async function getMiniflareManifest(bundle) {
|
|
|
78364
78364
|
assert(mainEntry !== void 0, `Build Output Specification: \`mainModule\` "${mainModule}" is missing from \`modules\`.`);
|
|
78365
78365
|
const modules = {};
|
|
78366
78366
|
await Promise.all(Object.entries(bundle.modules).map(async ([modulePath, { type }]) => {
|
|
78367
|
-
const contents = await fs$
|
|
78367
|
+
const contents = await fs$1.readFile(path.join(bundle.rootPath, modulePath));
|
|
78368
78368
|
modules[modulePath] = {
|
|
78369
78369
|
type,
|
|
78370
78370
|
contents: type === "wasm" || type === "data" ? new Uint8Array(contents) : contents.toString()
|
|
@@ -78455,7 +78455,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
78455
78455
|
telemetry: { enabled: false },
|
|
78456
78456
|
handleStructuredLogs: getStructuredLogsLogger(logger$2),
|
|
78457
78457
|
resourcePersistencePath: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
|
|
78458
|
-
resourceTmpPath: path
|
|
78458
|
+
resourceTmpPath: path.resolve(resolvedViteConfig.root, ".cloudflare/tmp"),
|
|
78459
78459
|
containerEngine,
|
|
78460
78460
|
workers
|
|
78461
78461
|
},
|
|
@@ -83642,15 +83642,15 @@ function hasTrailingSlash(input$1 = "", respectQueryAndFragment) {
|
|
|
83642
83642
|
function withTrailingSlash(input$1 = "", respectQueryAndFragment) {
|
|
83643
83643
|
if (!respectQueryAndFragment) return input$1.endsWith("/") ? input$1 : input$1 + "/";
|
|
83644
83644
|
if (hasTrailingSlash(input$1, true)) return input$1 || "/";
|
|
83645
|
-
let path$
|
|
83645
|
+
let path$3 = input$1;
|
|
83646
83646
|
let fragment = "";
|
|
83647
83647
|
const fragmentIndex = input$1.indexOf("#");
|
|
83648
83648
|
if (fragmentIndex >= 0) {
|
|
83649
|
-
path$
|
|
83649
|
+
path$3 = input$1.slice(0, fragmentIndex);
|
|
83650
83650
|
fragment = input$1.slice(fragmentIndex);
|
|
83651
|
-
if (!path$
|
|
83651
|
+
if (!path$3) return fragment;
|
|
83652
83652
|
}
|
|
83653
|
-
const [s0, ...s] = path$
|
|
83653
|
+
const [s0, ...s] = path$3.split("?");
|
|
83654
83654
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
83655
83655
|
}
|
|
83656
83656
|
function isNonEmptyURL(url$2) {
|
|
@@ -83676,8 +83676,8 @@ const isAbsolute$1 = function(p$3) {
|
|
|
83676
83676
|
//#endregion
|
|
83677
83677
|
//#region ../../workers-sdk/node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
|
|
83678
83678
|
const BUILTIN_MODULES = new Set(builtinModules);
|
|
83679
|
-
function normalizeSlash(path$
|
|
83680
|
-
return path$
|
|
83679
|
+
function normalizeSlash(path$3) {
|
|
83680
|
+
return path$3.replace(/\\/g, "/");
|
|
83681
83681
|
}
|
|
83682
83682
|
/**
|
|
83683
83683
|
* @typedef ErrnoExceptionFields
|
|
@@ -83797,8 +83797,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
83797
83797
|
* @param {string} [base]
|
|
83798
83798
|
* @param {string} [message]
|
|
83799
83799
|
*/
|
|
83800
|
-
(path$
|
|
83801
|
-
return `Invalid package config ${path$
|
|
83800
|
+
(path$3, base, message) => {
|
|
83801
|
+
return `Invalid package config ${path$3}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
83802
83802
|
},
|
|
83803
83803
|
Error
|
|
83804
83804
|
);
|
|
@@ -83828,8 +83828,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
83828
83828
|
* @param {string} base
|
|
83829
83829
|
* @param {boolean} [exactUrl]
|
|
83830
83830
|
*/
|
|
83831
|
-
(path$
|
|
83832
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${path$
|
|
83831
|
+
(path$3, base, exactUrl = false) => {
|
|
83832
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path$3}' imported from ${base}`;
|
|
83833
83833
|
},
|
|
83834
83834
|
Error
|
|
83835
83835
|
);
|
|
@@ -83867,8 +83867,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
83867
83867
|
* @param {string} extension
|
|
83868
83868
|
* @param {string} path
|
|
83869
83869
|
*/
|
|
83870
|
-
(extension, path$
|
|
83871
|
-
return `Unknown file extension "${extension}" for ${path$
|
|
83870
|
+
(extension, path$3) => {
|
|
83871
|
+
return `Unknown file extension "${extension}" for ${path$3}`;
|
|
83872
83872
|
},
|
|
83873
83873
|
TypeError
|
|
83874
83874
|
);
|
|
@@ -84025,7 +84025,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
84025
84025
|
/** @type {string | undefined} */
|
|
84026
84026
|
let string$2;
|
|
84027
84027
|
try {
|
|
84028
|
-
string$2 =
|
|
84028
|
+
string$2 = fs2.readFileSync(path__default.toNamespacedPath(jsonPath), "utf8");
|
|
84029
84029
|
} catch (error$3) {
|
|
84030
84030
|
const exception = error$3;
|
|
84031
84031
|
if (exception.code !== "ENOENT") throw exception;
|
|
@@ -84231,15 +84231,15 @@ function emitLegacyIndexDeprecation(url$2, packageJsonUrl, base, main) {
|
|
|
84231
84231
|
const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
|
|
84232
84232
|
const basePath = fileURLToPath(base);
|
|
84233
84233
|
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");
|
|
84234
|
-
else if (
|
|
84234
|
+
else if (path__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");
|
|
84235
84235
|
}
|
|
84236
84236
|
/**
|
|
84237
84237
|
* @param {string} path
|
|
84238
84238
|
* @returns {Stats | undefined}
|
|
84239
84239
|
*/
|
|
84240
|
-
function tryStatSync(path$
|
|
84240
|
+
function tryStatSync(path$3) {
|
|
84241
84241
|
try {
|
|
84242
|
-
return statSync(path$
|
|
84242
|
+
return statSync(path$3);
|
|
84243
84243
|
} catch {}
|
|
84244
84244
|
}
|
|
84245
84245
|
/**
|
|
@@ -84338,7 +84338,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
84338
84338
|
{
|
|
84339
84339
|
const real = realpathSync(filePath);
|
|
84340
84340
|
const { search, hash: hash$1 } = resolved;
|
|
84341
|
-
resolved = pathToFileURL(real + (filePath.endsWith(
|
|
84341
|
+
resolved = pathToFileURL(real + (filePath.endsWith(path__default.sep) ? "/" : ""));
|
|
84342
84342
|
resolved.search = search;
|
|
84343
84343
|
resolved.hash = hash$1;
|
|
84344
84344
|
}
|
|
@@ -85000,7 +85000,7 @@ var NodeJsCompatWarnings = class {
|
|
|
85000
85000
|
`;
|
|
85001
85001
|
this.sources.forEach((importers, source) => {
|
|
85002
85002
|
importers.forEach((importer) => {
|
|
85003
|
-
message += ` - "${source}" imported from "${path
|
|
85003
|
+
message += ` - "${source}" imported from "${path.relative(this.resolvedViteConfig.root, importer)}"\n`;
|
|
85004
85004
|
});
|
|
85005
85005
|
});
|
|
85006
85006
|
this.resolvedViteConfig.logger.warn(message, { timestamp: true });
|
|
@@ -85204,7 +85204,7 @@ function resolveWorkerType(options) {
|
|
|
85204
85204
|
async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
|
|
85205
85205
|
if (typeof pluginConfig.tunnel === "object" && pluginConfig.tunnel.name !== void 0 && (pluginConfig.tunnel.allowedMail?.length ?? 0) > 0) throw new Error("`tunnel.allowedMail` is only supported for Quick Tunnels and cannot be used together with `tunnel.name`.");
|
|
85206
85206
|
const mode = "mode" in userConfig && typeof userConfig.mode === "string" ? userConfig.mode : viteEnv.mode;
|
|
85207
|
-
const root = userConfig.root ? path
|
|
85207
|
+
const root = userConfig.root ? path.resolve(userConfig.root) : process.cwd();
|
|
85208
85208
|
const envDir = resolveEnvDir(root, userConfig.envDir);
|
|
85209
85209
|
const preview = viteEnv.isPreview ? await readBuildOutputPreview(root, !!process.env.CLOUDFLARE_VITE_BUILD) : void 0;
|
|
85210
85210
|
const localEnvMode = preview?.rootConfig.buildContext.mode ?? mode;
|
|
@@ -85368,7 +85368,7 @@ function addAuxiliaryWorkers(options) {
|
|
|
85368
85368
|
* @returns An absolute environment directory, or `false` when disabled.
|
|
85369
85369
|
*/
|
|
85370
85370
|
function resolveEnvDir(root, envDir) {
|
|
85371
|
-
return envDir === false ? false : path
|
|
85371
|
+
return envDir === false ? false : path.resolve(root, envDir ?? ".");
|
|
85372
85372
|
}
|
|
85373
85373
|
const RESERVED_WORKER_DIRECTORY_NAMES = new Set([DEFAULT_WORKER_DIRECTORY_NAME, PRERENDER_WORKER_DIRECTORY_NAME]);
|
|
85374
85374
|
function getAuxiliaryWorkerDirectoryName(workerName) {
|
|
@@ -85431,9 +85431,9 @@ const CONFIG_PACKAGE = "cf/config";
|
|
|
85431
85431
|
* when the generated content differs from what's already on disk.
|
|
85432
85432
|
*/
|
|
85433
85433
|
async function loadCloudflareConfig(options) {
|
|
85434
|
-
const configPath = path
|
|
85435
|
-
if (!fs
|
|
85436
|
-
const wranglerConfigFilename = WRANGLER_CONFIG_FILENAMES.find((filename) => fs
|
|
85434
|
+
const configPath = path.resolve(options.root, CONFIG_FILENAME);
|
|
85435
|
+
if (!fs.existsSync(configPath)) {
|
|
85436
|
+
const wranglerConfigFilename = WRANGLER_CONFIG_FILENAMES.find((filename) => fs.existsSync(path.resolve(options.root, filename)));
|
|
85437
85437
|
if (wranglerConfigFilename !== void 0) throw new Error(`Found \`${wranglerConfigFilename}\` but no \`${CONFIG_FILENAME}\`. The Cloudflare Vite plugin no longer reads Wrangler configuration files, so this configuration would be ignored. Run \`npx cf migrate --bundler vite\` to generate \`${CONFIG_FILENAME}\`.`);
|
|
85438
85438
|
return;
|
|
85439
85439
|
}
|
|
@@ -85475,13 +85475,13 @@ async function loadCloudflareConfig(options) {
|
|
|
85475
85475
|
* touching mtimes unnecessarily).
|
|
85476
85476
|
*/
|
|
85477
85477
|
async function writeCloudflareTypes(options) {
|
|
85478
|
-
const outputPath = path
|
|
85479
|
-
const outputDir = path
|
|
85480
|
-
const relativeConfigPath = normalizePath$1(path
|
|
85478
|
+
const outputPath = path.resolve(options.root, TYPES_OUTPUT_PATH);
|
|
85479
|
+
const outputDir = path.dirname(outputPath);
|
|
85480
|
+
const relativeConfigPath = normalizePath$1(path.relative(outputDir, options.configPath));
|
|
85481
85481
|
const configImportPath = relativeConfigPath.startsWith(".") ? relativeConfigPath : `./${relativeConfigPath}`;
|
|
85482
85482
|
let existingContent;
|
|
85483
85483
|
try {
|
|
85484
|
-
existingContent = await fs$
|
|
85484
|
+
existingContent = await fs$1.readFile(outputPath, "utf8");
|
|
85485
85485
|
} catch {}
|
|
85486
85486
|
let content = generateTypes({
|
|
85487
85487
|
configPath: configImportPath,
|
|
@@ -85496,8 +85496,8 @@ async function writeCloudflareTypes(options) {
|
|
|
85496
85496
|
content += `\n${runtimeHeader}\n${RUNTIME_TYPES_MARKER}\n${runtimeTypes}`;
|
|
85497
85497
|
}
|
|
85498
85498
|
if (existingContent !== content) {
|
|
85499
|
-
await fs$
|
|
85500
|
-
await fs$
|
|
85499
|
+
await fs$1.mkdir(outputDir, { recursive: true });
|
|
85500
|
+
await fs$1.writeFile(outputPath, content);
|
|
85501
85501
|
}
|
|
85502
85502
|
}
|
|
85503
85503
|
|
|
@@ -85913,18 +85913,18 @@ function createDebugMiddleware(workerNames, getResolvedInspectorPort) {
|
|
|
85913
85913
|
function moveImportedAssets({ importedAssetPaths, entryWorkerBuildDirectory, clientBuildDirectory, entryWorkerEnvironmentName, root, logger: logger$2 }) {
|
|
85914
85914
|
const movedAssetPaths = [];
|
|
85915
85915
|
for (const assetPath of importedAssetPaths) {
|
|
85916
|
-
const src$1 = path
|
|
85917
|
-
const dest = path
|
|
85918
|
-
if (!fs
|
|
85919
|
-
if (fs
|
|
85916
|
+
const src$1 = path.join(entryWorkerBuildDirectory, assetPath);
|
|
85917
|
+
const dest = path.join(clientBuildDirectory, assetPath);
|
|
85918
|
+
if (!fs.existsSync(src$1)) continue;
|
|
85919
|
+
if (fs.existsSync(dest)) fs.unlinkSync(src$1);
|
|
85920
85920
|
else {
|
|
85921
|
-
const destDir = path
|
|
85922
|
-
fs
|
|
85923
|
-
fs
|
|
85921
|
+
const destDir = path.dirname(dest);
|
|
85922
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
85923
|
+
fs.renameSync(src$1, dest);
|
|
85924
85924
|
movedAssetPaths.push(dest);
|
|
85925
85925
|
}
|
|
85926
85926
|
}
|
|
85927
|
-
if (movedAssetPaths.length) logger$2.info([`${import_picocolors.default.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => import_picocolors.default.dim(path
|
|
85927
|
+
if (movedAssetPaths.length) logger$2.info([`${import_picocolors.default.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => import_picocolors.default.dim(path.relative(root, assetPath)))].join("\n"));
|
|
85928
85928
|
}
|
|
85929
85929
|
|
|
85930
85930
|
//#endregion
|
|
@@ -86108,8 +86108,8 @@ function getWorkerEnvironmentConfig(worker, root, mode, userConfig, environmentN
|
|
|
86108
86108
|
const type = resolved && matchAdditionalModule(resolved);
|
|
86109
86109
|
if (resolved && type) {
|
|
86110
86110
|
const filePath = resolved.replace(/\?.*$/, "");
|
|
86111
|
-
const { name, ext } = path
|
|
86112
|
-
const fileName = `${name}-${createHash("sha256").update(await fs$
|
|
86111
|
+
const { name, ext } = path.parse(filePath);
|
|
86112
|
+
const fileName = `${name}-${createHash("sha256").update(await fs$1.readFile(filePath)).digest("hex").slice(0, 8)}${ext}`;
|
|
86113
86113
|
additionalModules.set(fileName, {
|
|
86114
86114
|
filePath,
|
|
86115
86115
|
type: toModuleType(type)
|
|
@@ -86156,25 +86156,41 @@ function getWorkerEnvironmentConfig(worker, root, mode, userConfig, environmentN
|
|
|
86156
86156
|
*
|
|
86157
86157
|
* @param worker The resolved Worker.
|
|
86158
86158
|
* @param root The project root.
|
|
86159
|
+
* @param layer The Rspack layer to build the entry in.
|
|
86159
86160
|
* @returns The Rsbuild entry config.
|
|
86160
86161
|
*/
|
|
86161
|
-
function getWorkerEntry({ config: config$3, nodeJsCompat }, root) {
|
|
86162
|
+
function getWorkerEntry({ config: config$3, nodeJsCompat }, root, layer) {
|
|
86162
86163
|
const specifier = JSON.stringify(getEntrypointSpecifier(config$3.entrypoint, root));
|
|
86163
|
-
const entry = toDataUri(`import * as mod from ${specifier};\nexport * from ${specifier};\nexport default Object(mod).default ?? {};\n`);
|
|
86164
86164
|
return { [WORKER_ENTRY_NAME]: {
|
|
86165
|
-
import: nodeJsCompat ?
|
|
86166
|
-
html: false
|
|
86165
|
+
import: toDataUri(`${nodeJsCompat ? `${nodeJsCompat.injectGlobalCode()}\n` : ""}import * as mod from ${specifier};\nexport * from ${specifier};\nexport default Object(mod).default ?? {};\n`),
|
|
86166
|
+
html: false,
|
|
86167
|
+
...layer !== void 0 && { layer }
|
|
86167
86168
|
} };
|
|
86168
86169
|
}
|
|
86169
86170
|
/**
|
|
86171
|
+
* Gets the Rspack layer that an environment's entries are built in, which the
|
|
86172
|
+
* Worker's entry keeps when it replaces them. TanStack Start's React Server
|
|
86173
|
+
* Components support, for example, builds its server entry in Rspack's
|
|
86174
|
+
* server-side rendering layer, which client components must be built in for
|
|
86175
|
+
* the server to render them.
|
|
86176
|
+
*
|
|
86177
|
+
* @param entry The environment's entries.
|
|
86178
|
+
* @returns The entries' layer, if they're all in the same one.
|
|
86179
|
+
*/
|
|
86180
|
+
function getEntryLayer(entry) {
|
|
86181
|
+
const layers = new Set(Object.values(entry ?? {}).map((description) => typeof description === "object" && !Array.isArray(description) ? description.layer ?? void 0 : void 0));
|
|
86182
|
+
const [layer] = layers;
|
|
86183
|
+
return layers.size === 1 ? layer : void 0;
|
|
86184
|
+
}
|
|
86185
|
+
/**
|
|
86170
86186
|
* Gets the specifier that the Worker's entry imports its entrypoint with. As in
|
|
86171
86187
|
* Vite, the entrypoint is a path relative to the root, or else a module
|
|
86172
86188
|
* specifier (e.g. a package export). Data URI modules resolve imports from the
|
|
86173
86189
|
* root, and a relative path keeps absolute paths out of the bundle.
|
|
86174
86190
|
*/
|
|
86175
86191
|
function getEntrypointSpecifier(entrypoint, root) {
|
|
86176
|
-
const entrypointPath = path
|
|
86177
|
-
return fs
|
|
86192
|
+
const entrypointPath = path.resolve(root, entrypoint);
|
|
86193
|
+
return fs.existsSync(entrypointPath) ? `./${path.relative(root, entrypointPath).replaceAll("\\", "/")}` : entrypoint;
|
|
86178
86194
|
}
|
|
86179
86195
|
/**
|
|
86180
86196
|
* As in the Vite plugin, fails at startup rather than with a build error, which
|
|
@@ -86208,7 +86224,7 @@ function nodeJsCompatPlugin(nodeJsCompat) {
|
|
|
86208
86224
|
function wasmInitPlugin() {
|
|
86209
86225
|
return new rspack.NormalModuleReplacementPlugin(wasmInitRE, (resource) => {
|
|
86210
86226
|
const wasmPath = resource.request.replace(/\?init$/, "");
|
|
86211
|
-
resource.request = toDataUri(getWasmInitModule(wasmPath.startsWith(".") ? path
|
|
86227
|
+
resource.request = toDataUri(getWasmInitModule(wasmPath.startsWith(".") ? path.resolve(resource.context, wasmPath).replaceAll("\\", "/") : wasmPath));
|
|
86212
86228
|
});
|
|
86213
86229
|
}
|
|
86214
86230
|
/**
|
|
@@ -86225,7 +86241,7 @@ function additionalModulesPlugin(additionalModules) {
|
|
|
86225
86241
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
86226
86242
|
}, async () => {
|
|
86227
86243
|
for (const [fileName, { filePath, type }] of additionalModules) {
|
|
86228
|
-
compilation.emitAsset(fileName, new compiler.webpack.sources.RawSource(await fs$
|
|
86244
|
+
compilation.emitAsset(fileName, new compiler.webpack.sources.RawSource(await fs$1.readFile(filePath)), { [MODULE_TYPE_KEY]: type });
|
|
86229
86245
|
compilation.fileDependencies.add(filePath);
|
|
86230
86246
|
}
|
|
86231
86247
|
for (const { name: chunkName, source } of compilation.getAssets()) {
|
|
@@ -86234,7 +86250,7 @@ function additionalModulesPlugin(additionalModules) {
|
|
|
86234
86250
|
const replaced = new compiler.webpack.sources.ReplaceSource(source);
|
|
86235
86251
|
for (const match of code.matchAll(moduleReferenceGlobalRE)) {
|
|
86236
86252
|
const [reference, fileName = ""] = match;
|
|
86237
|
-
const relativePath = path
|
|
86253
|
+
const relativePath = path.posix.relative(path.posix.dirname(chunkName), fileName);
|
|
86238
86254
|
replaced.replace(match.index, match.index + reference.length - 1, relativePath.startsWith(".") ? relativePath : `./${relativePath}`);
|
|
86239
86255
|
}
|
|
86240
86256
|
compilation.updateAsset(chunkName, replaced);
|
|
@@ -86320,12 +86336,12 @@ function getModuleType({ name, info }) {
|
|
|
86320
86336
|
* @param compilation The Worker environment's compilation.
|
|
86321
86337
|
*/
|
|
86322
86338
|
async function removeUnemittedFiles(distPath, compilation) {
|
|
86323
|
-
const emitted = new Set(compilation.getAssets().map(({ name }) => path
|
|
86324
|
-
const entries = await fs$
|
|
86339
|
+
const emitted = new Set(compilation.getAssets().map(({ name }) => path.join(distPath, name)));
|
|
86340
|
+
const entries = await fs$1.readdir(distPath, {
|
|
86325
86341
|
recursive: true,
|
|
86326
86342
|
withFileTypes: true
|
|
86327
86343
|
});
|
|
86328
|
-
await Promise.all(entries.map((entry) => path
|
|
86344
|
+
await Promise.all(entries.map((entry) => path.join(entry.parentPath, entry.name)).filter((file$2, index) => entries[index]?.isFile() && !emitted.has(file$2)).map((file$2) => fs$1.rm(file$2)));
|
|
86329
86345
|
}
|
|
86330
86346
|
|
|
86331
86347
|
//#endregion
|
|
@@ -86446,7 +86462,7 @@ function cloudflare(options = {}) {
|
|
|
86446
86462
|
...resolvedPluginConfig.configPaths,
|
|
86447
86463
|
...getEnvPaths(resolvedEnvDir, mode),
|
|
86448
86464
|
...getDevVarsCandidatePaths(resolvedEnvDir, mode),
|
|
86449
|
-
...resolvedPluginConfig.experimental.headersAndRedirectsDevModeSupport ? getPublicDirs(userConfig.server?.publicDir, root).flatMap((dir$1) => [path
|
|
86465
|
+
...resolvedPluginConfig.experimental.headersAndRedirectsDevModeSupport ? getPublicDirs(userConfig.server?.publicDir, root).flatMap((dir$1) => [path.join(dir$1, "_headers"), path.join(dir$1, "_redirects")]) : []
|
|
86450
86466
|
],
|
|
86451
86467
|
type: "reload-server"
|
|
86452
86468
|
} },
|
|
@@ -86460,7 +86476,7 @@ function cloudflare(options = {}) {
|
|
|
86460
86476
|
const worker = workerEnvironments.get(name);
|
|
86461
86477
|
if (worker) {
|
|
86462
86478
|
config$3.output.distPath.root = getWorkerBundleDir(root, worker.directoryName);
|
|
86463
|
-
config$3.source.entry = getWorkerEntry(worker, root);
|
|
86479
|
+
config$3.source.entry = getWorkerEntry(worker, root, getEntryLayer(config$3.source.entry));
|
|
86464
86480
|
config$3.output.target = "web-worker";
|
|
86465
86481
|
config$3.output.module = true;
|
|
86466
86482
|
} else if (action === "build" && ctx.resolvedPluginConfig.type !== "preview" && config$3.output.target === "web") config$3.output.distPath.root = getWorkerAssetsDir(root);
|
|
@@ -86573,11 +86589,11 @@ function cloudflare(options = {}) {
|
|
|
86573
86589
|
const assetsDir = getWorkerAssetsDir(root);
|
|
86574
86590
|
const publicDirs = api$1.getNormalizedConfig().server.publicDir.filter(({ copyOnBuild }) => copyOnBuild).map(({ name }) => name);
|
|
86575
86591
|
if (hasFallbackClient) {
|
|
86576
|
-
await fs$
|
|
86577
|
-
if (fs
|
|
86578
|
-
} else if (!fs
|
|
86579
|
-
for (const name of publicDirs) if (fs
|
|
86580
|
-
if (resolvedPluginConfig.prerenderWorkerEnvironmentName) await fs$
|
|
86592
|
+
await fs$1.rm(path.join(assetsDir, `${CLIENT_FALLBACK_ENTRY_NAME}.js`), { force: true });
|
|
86593
|
+
if (fs.existsSync(assetsDir) && fs.readdirSync(assetsDir).length === 0) await fs$1.rmdir(assetsDir);
|
|
86594
|
+
} else if (!fs.existsSync(assetsDir)) {
|
|
86595
|
+
for (const name of publicDirs) if (fs.existsSync(name)) await fs$1.cp(name, assetsDir, { recursive: true });
|
|
86596
|
+
if (resolvedPluginConfig.prerenderWorkerEnvironmentName) await fs$1.mkdir(assetsDir, { recursive: true });
|
|
86581
86597
|
}
|
|
86582
86598
|
if (importedAssets) moveImportedAssets({
|
|
86583
86599
|
importedAssetPaths: importedAssets.paths,
|
|
@@ -86650,18 +86666,18 @@ function cloudflare(options = {}) {
|
|
|
86650
86666
|
if (entry && environment) return environment.getTransformedHtml(entry.entryName);
|
|
86651
86667
|
const publicFile = findPublicFile(pathname);
|
|
86652
86668
|
if (!publicFile) throw new Error(`No HTML found for "${pathname}".`);
|
|
86653
|
-
return fs$
|
|
86669
|
+
return fs$1.readFile(publicFile, "utf8");
|
|
86654
86670
|
}
|
|
86655
86671
|
};
|
|
86656
86672
|
function findHtmlEntry(pathname) {
|
|
86657
86673
|
const { base } = api$1.getNormalizedConfig().server;
|
|
86658
|
-
for (const [environmentName, { htmlPaths }] of Object.entries(environmentContexts)) for (const [entryName, htmlPath] of Object.entries(htmlPaths)) if (path
|
|
86674
|
+
for (const [environmentName, { htmlPaths }] of Object.entries(environmentContexts)) for (const [entryName, htmlPath] of Object.entries(htmlPaths)) if (path.posix.join(base, htmlPath) === pathname) return {
|
|
86659
86675
|
environmentName,
|
|
86660
86676
|
entryName
|
|
86661
86677
|
};
|
|
86662
86678
|
}
|
|
86663
86679
|
function findPublicFile(pathname) {
|
|
86664
|
-
return getPublicDirs(api$1.getNormalizedConfig().server.publicDir, root).map((dir$1) => path
|
|
86680
|
+
return getPublicDirs(api$1.getNormalizedConfig().server.publicDir, root).map((dir$1) => path.join(dir$1, pathname)).find((file$2) => fs.statSync(file$2, { throwIfNoEntry: false })?.isFile());
|
|
86665
86681
|
}
|
|
86666
86682
|
}
|
|
86667
86683
|
};
|
|
@@ -86689,7 +86705,7 @@ function toViteWorkerOptions({ rsbuildEnvironment,...options }) {
|
|
|
86689
86705
|
* @returns Whether Rsbuild should build a client from its default entry.
|
|
86690
86706
|
*/
|
|
86691
86707
|
function hasDefaultClientEntry(root, workers) {
|
|
86692
|
-
if (!fs
|
|
86708
|
+
if (!fs.existsSync(path.join(root, "index.html"))) return false;
|
|
86693
86709
|
const entry = [
|
|
86694
86710
|
"ts",
|
|
86695
86711
|
"js",
|
|
@@ -86699,9 +86715,9 @@ function hasDefaultClientEntry(root, workers) {
|
|
|
86699
86715
|
"cts",
|
|
86700
86716
|
"mjs",
|
|
86701
86717
|
"cjs"
|
|
86702
|
-
].map((extension) => path
|
|
86718
|
+
].map((extension) => path.join(root, `src/index.${extension}`)).find((file$2) => fs.statSync(file$2, { throwIfNoEntry: false })?.isFile());
|
|
86703
86719
|
return entry !== void 0 && [...workers].every(({ config: config$3 }) => {
|
|
86704
|
-
const entrypoint = path
|
|
86720
|
+
const entrypoint = path.resolve(root, config$3.entrypoint);
|
|
86705
86721
|
return ![entrypoint, ...resolveExtensions.map((ext) => entrypoint + ext)].includes(entry);
|
|
86706
86722
|
});
|
|
86707
86723
|
}
|
|
@@ -86736,7 +86752,7 @@ function getFallbackClientConfig() {
|
|
|
86736
86752
|
*/
|
|
86737
86753
|
function getHasPublicAssets(publicDir) {
|
|
86738
86754
|
try {
|
|
86739
|
-
return fs
|
|
86755
|
+
return fs.readdirSync(publicDir).length > 0;
|
|
86740
86756
|
} catch {
|
|
86741
86757
|
return false;
|
|
86742
86758
|
}
|
|
@@ -86774,7 +86790,7 @@ function withCloudflareStateIgnored(ignored) {
|
|
|
86774
86790
|
/** Resolves Rsbuild's `server.publicDir` option to absolute directories. */
|
|
86775
86791
|
function getPublicDirs(publicDir, root) {
|
|
86776
86792
|
if (publicDir === false) return [];
|
|
86777
|
-
return [publicDir ?? {}].flat().map(({ name = "public" }) => path
|
|
86793
|
+
return [publicDir ?? {}].flat().map(({ name = "public" }) => path.resolve(root, name));
|
|
86778
86794
|
}
|
|
86779
86795
|
/**
|
|
86780
86796
|
* Whether a request is for a page, which Rsbuild would otherwise serve itself:
|
|
@@ -86783,7 +86799,7 @@ function getPublicDirs(publicDir, root) {
|
|
|
86783
86799
|
*/
|
|
86784
86800
|
function isPageRequest(req, hmrPath) {
|
|
86785
86801
|
const { pathname } = new URL(req.url ?? "/", "http://localhost");
|
|
86786
|
-
return (req.method === "GET" || req.method === "HEAD") && pathname !== hmrPath && !/^\/(__|rsbuild-)/.test(pathname) && (pathname.endsWith(".html") || path
|
|
86802
|
+
return (req.method === "GET" || req.method === "HEAD") && pathname !== hmrPath && !/^\/(__|rsbuild-)/.test(pathname) && (pathname.endsWith(".html") || path.posix.extname(pathname) === "");
|
|
86787
86803
|
}
|
|
86788
86804
|
|
|
86789
86805
|
//#endregion
|