wrangler 3.78.6 → 3.78.8
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/package.json +5 -5
- package/wrangler-dist/cli.js +596 -443
- package/wrangler-dist/cli.js.map +4 -4
package/wrangler-dist/cli.js
CHANGED
@@ -66927,17 +66927,17 @@ var require_eventemitter3 = __commonJS({
|
|
66927
66927
|
});
|
66928
66928
|
|
66929
66929
|
// src/pages/hash.ts
|
66930
|
-
var import_node_fs10,
|
66930
|
+
var import_node_fs10, import_node_path16, import_blake3_wasm, hashFile;
|
66931
66931
|
var init_hash = __esm({
|
66932
66932
|
"src/pages/hash.ts"() {
|
66933
66933
|
init_import_meta_url();
|
66934
66934
|
import_node_fs10 = require("node:fs");
|
66935
|
-
|
66935
|
+
import_node_path16 = require("node:path");
|
66936
66936
|
import_blake3_wasm = require("blake3-wasm");
|
66937
66937
|
hashFile = /* @__PURE__ */ __name((filepath) => {
|
66938
66938
|
const contents = (0, import_node_fs10.readFileSync)(filepath);
|
66939
66939
|
const base64Contents = contents.toString("base64");
|
66940
|
-
const extension = (0,
|
66940
|
+
const extension = (0, import_node_path16.extname)(filepath).substring(1);
|
66941
66941
|
return (0, import_blake3_wasm.hash)(base64Contents + extension).toString("hex").slice(0, 32);
|
66942
66942
|
}, "hashFile");
|
66943
66943
|
}
|
@@ -71121,15 +71121,15 @@ function npmRunPath(options29 = {}) {
|
|
71121
71121
|
} = options29;
|
71122
71122
|
let previous;
|
71123
71123
|
const cwdString = cwd2 instanceof URL ? import_node_url9.default.fileURLToPath(cwd2) : cwd2;
|
71124
|
-
let cwdPath =
|
71124
|
+
let cwdPath = import_node_path25.default.resolve(cwdString);
|
71125
71125
|
const result = [];
|
71126
71126
|
while (previous !== cwdPath) {
|
71127
|
-
result.push(
|
71127
|
+
result.push(import_node_path25.default.join(cwdPath, "node_modules/.bin"));
|
71128
71128
|
previous = cwdPath;
|
71129
|
-
cwdPath =
|
71129
|
+
cwdPath = import_node_path25.default.resolve(cwdPath, "..");
|
71130
71130
|
}
|
71131
|
-
result.push(
|
71132
|
-
return [...result, path_].join(
|
71131
|
+
result.push(import_node_path25.default.resolve(cwdString, execPath, ".."));
|
71132
|
+
return [...result, path_].join(import_node_path25.default.delimiter);
|
71133
71133
|
}
|
71134
71134
|
function npmRunPathEnv({ env: env7 = import_node_process8.default.env, ...options29 } = {}) {
|
71135
71135
|
env7 = { ...env7 };
|
@@ -71138,12 +71138,12 @@ function npmRunPathEnv({ env: env7 = import_node_process8.default.env, ...option
|
|
71138
71138
|
env7[path74] = npmRunPath(options29);
|
71139
71139
|
return env7;
|
71140
71140
|
}
|
71141
|
-
var import_node_process8,
|
71141
|
+
var import_node_process8, import_node_path25, import_node_url9;
|
71142
71142
|
var init_npm_run_path = __esm({
|
71143
71143
|
"../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js"() {
|
71144
71144
|
init_import_meta_url();
|
71145
71145
|
import_node_process8 = __toESM(require("node:process"), 1);
|
71146
|
-
|
71146
|
+
import_node_path25 = __toESM(require("node:path"), 1);
|
71147
71147
|
import_node_url9 = __toESM(require("node:url"), 1);
|
71148
71148
|
init_path_key();
|
71149
71149
|
__name(npmRunPath, "npmRunPath");
|
@@ -72256,12 +72256,12 @@ function execaCommandSync(command2, options29) {
|
|
72256
72256
|
const [file, ...args] = parseCommand(command2);
|
72257
72257
|
return execaSync(file, args, options29);
|
72258
72258
|
}
|
72259
|
-
var import_node_buffer3,
|
72259
|
+
var import_node_buffer3, import_node_path26, import_node_child_process2, import_node_process9, import_cross_spawn, DEFAULT_MAX_BUFFER, getEnv, handleArguments, handleOutput;
|
72260
72260
|
var init_execa = __esm({
|
72261
72261
|
"../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js"() {
|
72262
72262
|
init_import_meta_url();
|
72263
72263
|
import_node_buffer3 = require("node:buffer");
|
72264
|
-
|
72264
|
+
import_node_path26 = __toESM(require("node:path"), 1);
|
72265
72265
|
import_node_child_process2 = __toESM(require("node:child_process"), 1);
|
72266
72266
|
import_node_process9 = __toESM(require("node:process"), 1);
|
72267
72267
|
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
@@ -72304,7 +72304,7 @@ var init_execa = __esm({
|
|
72304
72304
|
};
|
72305
72305
|
options29.env = getEnv(options29);
|
72306
72306
|
options29.stdio = normalizeStdio(options29);
|
72307
|
-
if (import_node_process9.default.platform === "win32" &&
|
72307
|
+
if (import_node_process9.default.platform === "win32" && import_node_path26.default.basename(file, ".exe") === "cmd") {
|
72308
72308
|
args.unshift("/q");
|
72309
72309
|
}
|
72310
72310
|
return { file, args, options: options29, parsed };
|
@@ -72329,7 +72329,7 @@ var init_execa = __esm({
|
|
72329
72329
|
var require_depd = __commonJS({
|
72330
72330
|
"../../node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js"(exports2, module3) {
|
72331
72331
|
init_import_meta_url();
|
72332
|
-
var
|
72332
|
+
var relative15 = require("path").relative;
|
72333
72333
|
module3.exports = depd;
|
72334
72334
|
var basePath = process.cwd();
|
72335
72335
|
function containsNamespace(str, namespace) {
|
@@ -72535,7 +72535,7 @@ var require_depd = __commonJS({
|
|
72535
72535
|
}
|
72536
72536
|
__name(formatColor, "formatColor");
|
72537
72537
|
function formatLocation(callSite) {
|
72538
|
-
return
|
72538
|
+
return relative15(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
72539
72539
|
}
|
72540
72540
|
__name(formatLocation, "formatLocation");
|
72541
72541
|
function getStack() {
|
@@ -93847,7 +93847,7 @@ var require_response2 = __commonJS({
|
|
93847
93847
|
var encodeUrl = require_encodeurl();
|
93848
93848
|
var escapeHtml = require_escape_html();
|
93849
93849
|
var http4 = require("http");
|
93850
|
-
var
|
93850
|
+
var isAbsolute2 = require_utils5().isAbsolute;
|
93851
93851
|
var onFinished = require_on_finished();
|
93852
93852
|
var path74 = require("path");
|
93853
93853
|
var statuses = require_statuses();
|
@@ -94054,7 +94054,7 @@ var require_response2 = __commonJS({
|
|
94054
94054
|
done = options29;
|
94055
94055
|
opts = {};
|
94056
94056
|
}
|
94057
|
-
if (!opts.root && !
|
94057
|
+
if (!opts.root && !isAbsolute2(path75)) {
|
94058
94058
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
94059
94059
|
}
|
94060
94060
|
var pathname = encodeURI(path75);
|
@@ -95511,51 +95511,51 @@ var require_uri_all = __commonJS({
|
|
95511
95511
|
return uriTokens.join("");
|
95512
95512
|
}
|
95513
95513
|
__name(serialize, "serialize");
|
95514
|
-
function resolveComponents(base2,
|
95514
|
+
function resolveComponents(base2, relative15) {
|
95515
95515
|
var options29 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
95516
95516
|
var skipNormalization = arguments[3];
|
95517
95517
|
var target = {};
|
95518
95518
|
if (!skipNormalization) {
|
95519
95519
|
base2 = parse7(serialize(base2, options29), options29);
|
95520
|
-
|
95520
|
+
relative15 = parse7(serialize(relative15, options29), options29);
|
95521
95521
|
}
|
95522
95522
|
options29 = options29 || {};
|
95523
|
-
if (!options29.tolerant &&
|
95524
|
-
target.scheme =
|
95525
|
-
target.userinfo =
|
95526
|
-
target.host =
|
95527
|
-
target.port =
|
95528
|
-
target.path = removeDotSegments(
|
95529
|
-
target.query =
|
95523
|
+
if (!options29.tolerant && relative15.scheme) {
|
95524
|
+
target.scheme = relative15.scheme;
|
95525
|
+
target.userinfo = relative15.userinfo;
|
95526
|
+
target.host = relative15.host;
|
95527
|
+
target.port = relative15.port;
|
95528
|
+
target.path = removeDotSegments(relative15.path || "");
|
95529
|
+
target.query = relative15.query;
|
95530
95530
|
} else {
|
95531
|
-
if (
|
95532
|
-
target.userinfo =
|
95533
|
-
target.host =
|
95534
|
-
target.port =
|
95535
|
-
target.path = removeDotSegments(
|
95536
|
-
target.query =
|
95531
|
+
if (relative15.userinfo !== void 0 || relative15.host !== void 0 || relative15.port !== void 0) {
|
95532
|
+
target.userinfo = relative15.userinfo;
|
95533
|
+
target.host = relative15.host;
|
95534
|
+
target.port = relative15.port;
|
95535
|
+
target.path = removeDotSegments(relative15.path || "");
|
95536
|
+
target.query = relative15.query;
|
95537
95537
|
} else {
|
95538
|
-
if (!
|
95538
|
+
if (!relative15.path) {
|
95539
95539
|
target.path = base2.path;
|
95540
|
-
if (
|
95541
|
-
target.query =
|
95540
|
+
if (relative15.query !== void 0) {
|
95541
|
+
target.query = relative15.query;
|
95542
95542
|
} else {
|
95543
95543
|
target.query = base2.query;
|
95544
95544
|
}
|
95545
95545
|
} else {
|
95546
|
-
if (
|
95547
|
-
target.path = removeDotSegments(
|
95546
|
+
if (relative15.path.charAt(0) === "/") {
|
95547
|
+
target.path = removeDotSegments(relative15.path);
|
95548
95548
|
} else {
|
95549
95549
|
if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
|
95550
|
-
target.path = "/" +
|
95550
|
+
target.path = "/" + relative15.path;
|
95551
95551
|
} else if (!base2.path) {
|
95552
|
-
target.path =
|
95552
|
+
target.path = relative15.path;
|
95553
95553
|
} else {
|
95554
|
-
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) +
|
95554
|
+
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative15.path;
|
95555
95555
|
}
|
95556
95556
|
target.path = removeDotSegments(target.path);
|
95557
95557
|
}
|
95558
|
-
target.query =
|
95558
|
+
target.query = relative15.query;
|
95559
95559
|
}
|
95560
95560
|
target.userinfo = base2.userinfo;
|
95561
95561
|
target.host = base2.host;
|
@@ -95563,7 +95563,7 @@ var require_uri_all = __commonJS({
|
|
95563
95563
|
}
|
95564
95564
|
target.scheme = base2.scheme;
|
95565
95565
|
}
|
95566
|
-
target.fragment =
|
95566
|
+
target.fragment = relative15.fragment;
|
95567
95567
|
return target;
|
95568
95568
|
}
|
95569
95569
|
__name(resolveComponents, "resolveComponents");
|
@@ -107494,7 +107494,7 @@ function constructRedirects({
|
|
107494
107494
|
}
|
107495
107495
|
const num_valid = redirects.rules.length;
|
107496
107496
|
const num_invalid = redirects.invalid.length;
|
107497
|
-
const redirectsRelativePath = redirectsFile ? (0,
|
107497
|
+
const redirectsRelativePath = redirectsFile ? (0, import_node_path33.relative)(process.cwd(), redirectsFile) : "";
|
107498
107498
|
logger3.log(
|
107499
107499
|
`\u2728 Parsed ${num_valid} valid redirect rule${num_valid === 1 ? "" : "s"}.`
|
107500
107500
|
);
|
@@ -107556,7 +107556,7 @@ function constructHeaders({
|
|
107556
107556
|
}
|
107557
107557
|
const num_valid = headers.rules.length;
|
107558
107558
|
const num_invalid = headers.invalid.length;
|
107559
|
-
const headersRelativePath = headersFile ? (0,
|
107559
|
+
const headersRelativePath = headersFile ? (0, import_node_path33.relative)(process.cwd(), headersFile) : "";
|
107560
107560
|
logger3.log(
|
107561
107561
|
`\u2728 Parsed ${num_valid} valid header rule${num_valid === 1 ? "" : "s"}.`
|
107562
107562
|
);
|
@@ -107609,11 +107609,11 @@ function constructWebAnalytics({
|
|
107609
107609
|
}
|
107610
107610
|
};
|
107611
107611
|
}
|
107612
|
-
var
|
107612
|
+
var import_node_path33, noopLogger;
|
107613
107613
|
var init_createMetadataObject = __esm({
|
107614
107614
|
"../pages-shared/metadata-generator/createMetadataObject.ts"() {
|
107615
107615
|
init_import_meta_url();
|
107616
|
-
|
107616
|
+
import_node_path33 = require("node:path");
|
107617
107617
|
init_constants();
|
107618
107618
|
noopLogger = {
|
107619
107619
|
debug: (_message) => {
|
@@ -112386,7 +112386,7 @@ async function installAndReturnDir(packages, logger3) {
|
|
112386
112386
|
throw new Error(`Failed installing ${packages.map((p2) => p2.name).join(",")} using: ${installPackage}.`);
|
112387
112387
|
}
|
112388
112388
|
const tempPath = getTempPath(stdout2);
|
112389
|
-
const nodeModulesPath =
|
112389
|
+
const nodeModulesPath = import_node_path34.default.resolve(tempPath, "..");
|
112390
112390
|
if (!nodeModulesPath.endsWith("node_modules")) {
|
112391
112391
|
throw new Error(`Found NPX temporary path of '${tempPath}' but expected to be able to find a node_modules directory by looking in '..'.`);
|
112392
112392
|
}
|
@@ -112440,12 +112440,12 @@ ${JSON.stringify(paths)}`);
|
|
112440
112440
|
return tempPath;
|
112441
112441
|
}
|
112442
112442
|
}
|
112443
|
-
var import_node_os6,
|
112443
|
+
var import_node_os6, import_node_path34, import_semver, import_validate_npm_package_name, WINDOWS, NOT_IMPORTABLE, INSTALLED_LOCALLY, INSTALL_CACHE, DEFAULT_LOGGER, INSTRUCTIONS, formatForCLI;
|
112444
112444
|
var init_lib = __esm({
|
112445
112445
|
"../../node_modules/.pnpm/npx-import@1.1.4/node_modules/npx-import/lib/index.js"() {
|
112446
112446
|
init_import_meta_url();
|
112447
112447
|
import_node_os6 = __toESM(require("node:os"), 1);
|
112448
|
-
|
112448
|
+
import_node_path34 = __toESM(require("node:path"), 1);
|
112449
112449
|
import_semver = __toESM(require_semver2(), 1);
|
112450
112450
|
init_dist();
|
112451
112451
|
init_execa();
|
@@ -113290,7 +113290,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
113290
113290
|
}
|
113291
113291
|
}
|
113292
113292
|
}, "Mutex");
|
113293
|
-
var
|
113293
|
+
var import_node_path69 = __toModule(require("node:path"));
|
113294
113294
|
async function createSQLiteDB(dbPath) {
|
113295
113295
|
const { npxImport: npxImport2, npxResolve: npxResolve2 } = await Promise.resolve().then(() => (init_lib(), lib_exports));
|
113296
113296
|
const { default: DatabaseConstructor } = await npxImport2("better-sqlite3@8.0.1");
|
@@ -113300,7 +113300,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
113300
113300
|
}
|
113301
113301
|
__name(createSQLiteDB, "createSQLiteDB");
|
113302
113302
|
function getSQLiteNativeBindingLocation(sqliteResolvePath) {
|
113303
|
-
return
|
113303
|
+
return import_node_path69.default.resolve(import_node_path69.default.dirname(sqliteResolvePath), "../build/Release/better_sqlite3.node");
|
113304
113304
|
}
|
113305
113305
|
__name(getSQLiteNativeBindingLocation, "getSQLiteNativeBindingLocation");
|
113306
113306
|
}
|
@@ -141511,13 +141511,13 @@ async function generateASSETSBinding(options29) {
|
|
141511
141511
|
};
|
141512
141512
|
}
|
141513
141513
|
async function generateAssetsFetch(directory, log2) {
|
141514
|
-
directory = (0,
|
141514
|
+
directory = (0, import_node_path35.resolve)(directory);
|
141515
141515
|
const polyfill2 = (await Promise.resolve().then(() => (init_miniflare(), miniflare_exports))).default;
|
141516
141516
|
await polyfill2();
|
141517
141517
|
const { generateHandler: generateHandler3, parseQualityWeightedList: parseQualityWeightedList2 } = await Promise.resolve().then(() => (init_handler(), handler_exports));
|
141518
|
-
const headersFile = (0,
|
141519
|
-
const redirectsFile = (0,
|
141520
|
-
const workerFile = (0,
|
141518
|
+
const headersFile = (0, import_node_path35.join)(directory, "_headers");
|
141519
|
+
const redirectsFile = (0, import_node_path35.join)(directory, "_redirects");
|
141520
|
+
const workerFile = (0, import_node_path35.join)(directory, "_worker.js");
|
141521
141521
|
const ignoredFiles = [headersFile, redirectsFile, workerFile];
|
141522
141522
|
let redirects;
|
141523
141523
|
if ((0, import_node_fs19.existsSync)(redirectsFile)) {
|
@@ -141570,7 +141570,7 @@ async function generateAssetsFetch(directory, log2) {
|
|
141570
141570
|
xServerEnvHeader: "dev",
|
141571
141571
|
logError: console.error,
|
141572
141572
|
findAssetEntryForPath: async (path74) => {
|
141573
|
-
const filepath = (0,
|
141573
|
+
const filepath = (0, import_node_path35.resolve)((0, import_node_path35.join)(directory, path74));
|
141574
141574
|
if (!filepath.startsWith(directory)) {
|
141575
141575
|
return null;
|
141576
141576
|
}
|
@@ -141618,13 +141618,13 @@ async function generateAssetsFetch(directory, log2) {
|
|
141618
141618
|
return await generateResponse(request3);
|
141619
141619
|
};
|
141620
141620
|
}
|
141621
|
-
var import_node_assert15, import_node_fs19,
|
141621
|
+
var import_node_assert15, import_node_fs19, import_node_path35, import_chokidar2, import_mime3, import_miniflare7, import_undici9, ProxyDispatcher, invalidAssetsFetch;
|
141622
141622
|
var init_assets = __esm({
|
141623
141623
|
"src/miniflare-cli/assets.ts"() {
|
141624
141624
|
init_import_meta_url();
|
141625
141625
|
import_node_assert15 = __toESM(require("node:assert"));
|
141626
141626
|
import_node_fs19 = require("node:fs");
|
141627
|
-
|
141627
|
+
import_node_path35 = require("node:path");
|
141628
141628
|
init_createMetadataObject();
|
141629
141629
|
init_parseHeaders();
|
141630
141630
|
init_parseRedirects();
|
@@ -151333,7 +151333,7 @@ var import_undici27 = __toESM(require_undici());
|
|
151333
151333
|
init_import_meta_url();
|
151334
151334
|
var import_node_assert24 = __toESM(require("node:assert"));
|
151335
151335
|
var import_node_events3 = __toESM(require("node:events"));
|
151336
|
-
var
|
151336
|
+
var import_node_path64 = __toESM(require("node:path"));
|
151337
151337
|
var import_node_util3 = __toESM(require("node:util"));
|
151338
151338
|
var import_env2 = __toESM(require_dist());
|
151339
151339
|
var import_chokidar6 = require("chokidar");
|
@@ -152882,7 +152882,7 @@ init_import_meta_url();
|
|
152882
152882
|
init_import_meta_url();
|
152883
152883
|
|
152884
152884
|
// package.json
|
152885
|
-
var version = "3.78.
|
152885
|
+
var version = "3.78.8";
|
152886
152886
|
var package_default = {
|
152887
152887
|
name: "wrangler",
|
152888
152888
|
version,
|
@@ -152969,7 +152969,7 @@ var package_default = {
|
|
152969
152969
|
"resolve.exports": "^2.0.2",
|
152970
152970
|
selfsigned: "^2.0.1",
|
152971
152971
|
"source-map": "^0.6.1",
|
152972
|
-
unenv: "npm:unenv-nightly@2.0.0-
|
152972
|
+
unenv: "npm:unenv-nightly@2.0.0-20240919-125358-9a64854",
|
152973
152973
|
workerd: "1.20240909.0",
|
152974
152974
|
"xxhash-wasm": "^1.0.1"
|
152975
152975
|
},
|
@@ -158110,7 +158110,7 @@ __name(loadDotEnv, "loadDotEnv");
|
|
158110
158110
|
init_import_meta_url();
|
158111
158111
|
var import_node_assert13 = __toESM(require("node:assert"));
|
158112
158112
|
var import_node_fs15 = require("node:fs");
|
158113
|
-
var
|
158113
|
+
var import_node_path23 = __toESM(require("node:path"));
|
158114
158114
|
var import_node_url8 = require("node:url");
|
158115
158115
|
|
158116
158116
|
// ../cli/index.ts
|
@@ -165777,14 +165777,14 @@ var AssetConfigSchema = z.object({
|
|
165777
165777
|
|
165778
165778
|
// ../workers-shared/utils/helpers.ts
|
165779
165779
|
init_import_meta_url();
|
165780
|
+
var import_node_path15 = require("node:path");
|
165780
165781
|
var import_mime = __toESM(require_mime());
|
165781
|
-
var
|
165782
|
-
|
165783
|
-
|
165784
|
-
}
|
165785
|
-
|
165786
|
-
|
165787
|
-
}, "decodeFilePath");
|
165782
|
+
var normalizeFilePath = /* @__PURE__ */ __name((relativeFilepath) => {
|
165783
|
+
if ((0, import_node_path15.isAbsolute)(relativeFilepath)) {
|
165784
|
+
throw new Error(`Expected relative path`);
|
165785
|
+
}
|
165786
|
+
return "/" + relativeFilepath.split(import_node_path15.sep).join("/");
|
165787
|
+
}, "normalizeFilePath");
|
165788
165788
|
var getContentType = /* @__PURE__ */ __name((absFilePath) => {
|
165789
165789
|
let contentType = (0, import_mime.getType)(absFilePath) || "application/octet-stream";
|
165790
165790
|
if (contentType.startsWith("text/") && !contentType.includes("charset")) {
|
@@ -166370,14 +166370,14 @@ init_hash();
|
|
166370
166370
|
// src/pages/upload.tsx
|
166371
166371
|
init_import_meta_url();
|
166372
166372
|
var import_promises7 = require("node:fs/promises");
|
166373
|
-
var
|
166373
|
+
var import_node_path18 = require("node:path");
|
166374
166374
|
var import_ink = __toESM(require_build2());
|
166375
166375
|
var import_ink_spinner = __toESM(require_build3());
|
166376
166376
|
|
166377
166377
|
// src/pages/validate.tsx
|
166378
166378
|
init_import_meta_url();
|
166379
166379
|
var import_promises6 = require("node:fs/promises");
|
166380
|
-
var
|
166380
|
+
var import_node_path17 = require("node:path");
|
166381
166381
|
var import_mime2 = __toESM(require_mime());
|
166382
166382
|
var import_minimatch = __toESM(require_minimatch());
|
166383
166383
|
init_hash();
|
@@ -166408,13 +166408,13 @@ var validate = /* @__PURE__ */ __name(async (args) => {
|
|
166408
166408
|
"**/node_modules",
|
166409
166409
|
"**/.git"
|
166410
166410
|
].map((pattern) => new import_minimatch.Minimatch(pattern));
|
166411
|
-
const directory = (0,
|
166411
|
+
const directory = (0, import_node_path17.resolve)(args.directory);
|
166412
166412
|
const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
|
166413
166413
|
const files = await (0, import_promises6.readdir)(dir);
|
166414
166414
|
await Promise.all(
|
166415
166415
|
files.map(async (file) => {
|
166416
|
-
const filepath = (0,
|
166417
|
-
const relativeFilepath = (0,
|
166416
|
+
const filepath = (0, import_node_path17.join)(dir, file);
|
166417
|
+
const relativeFilepath = (0, import_node_path17.relative)(startingDir, filepath);
|
166418
166418
|
const filestat = await (0, import_promises6.stat)(filepath);
|
166419
166419
|
for (const minimatch of IGNORE_LIST) {
|
166420
166420
|
if (minimatch.match(relativeFilepath)) {
|
@@ -166427,7 +166427,7 @@ var validate = /* @__PURE__ */ __name(async (args) => {
|
|
166427
166427
|
if (filestat.isDirectory()) {
|
166428
166428
|
fileMap2 = await walk(filepath, fileMap2, startingDir);
|
166429
166429
|
} else {
|
166430
|
-
const name = relativeFilepath.split(
|
166430
|
+
const name = relativeFilepath.split(import_node_path17.sep).join("/");
|
166431
166431
|
if (filestat.size > MAX_ASSET_SIZE) {
|
166432
166432
|
throw new FatalError(
|
166433
166433
|
`Error: Pages only supports files up to ${prettyBytes(
|
@@ -166498,7 +166498,7 @@ var Handler2 = /* @__PURE__ */ __name(async ({
|
|
166498
166498
|
skipCaching: skipCaching ?? false
|
166499
166499
|
});
|
166500
166500
|
if (outputManifestPath) {
|
166501
|
-
await (0, import_promises7.mkdir)((0,
|
166501
|
+
await (0, import_promises7.mkdir)((0, import_node_path18.dirname)(outputManifestPath), { recursive: true });
|
166502
166502
|
await (0, import_promises7.writeFile)(outputManifestPath, JSON.stringify(manifest));
|
166503
166503
|
}
|
166504
166504
|
logger.log(`\u2728 Upload complete!`);
|
@@ -166798,10 +166798,7 @@ var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName
|
|
166798
166798
|
1
|
166799
166799
|
);
|
166800
166800
|
}
|
166801
|
-
assetLogCount = logAssetUpload(
|
166802
|
-
`+ ${decodeFilePath(manifestEntry[0], path16.sep)}`,
|
166803
|
-
assetLogCount
|
166804
|
-
);
|
166801
|
+
assetLogCount = logAssetUpload(`+ ${manifestEntry[0]}`, assetLogCount);
|
166805
166802
|
return manifestEntry;
|
166806
166803
|
});
|
166807
166804
|
});
|
@@ -166816,8 +166813,7 @@ var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName
|
|
166816
166813
|
const doUpload = /* @__PURE__ */ __name(async () => {
|
166817
166814
|
const payload = new import_undici5.FormData();
|
166818
166815
|
for (const manifestEntry of bucket) {
|
166819
|
-
const
|
166820
|
-
const absFilePath = path16.join(assetDirectory, decodedFilePath);
|
166816
|
+
const absFilePath = path16.join(assetDirectory, manifestEntry[0]);
|
166821
166817
|
payload.append(
|
166822
166818
|
manifestEntry[1].hash,
|
166823
166819
|
new import_undici5.File(
|
@@ -166909,17 +166905,17 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
|
|
166909
166905
|
let counter = 0;
|
166910
166906
|
const ignoreFn = await createAssetIgnoreFunction(dir);
|
166911
166907
|
await Promise.all(
|
166912
|
-
files.map(async (
|
166913
|
-
const filepath = path16.join(dir, file);
|
166914
|
-
const relativeFilepath = path16.relative(dir, filepath);
|
166908
|
+
files.map(async (relativeFilepath) => {
|
166915
166909
|
if (ignoreFn?.(relativeFilepath)) {
|
166916
166910
|
logger.debug("Ignoring asset:", relativeFilepath);
|
166917
166911
|
return;
|
166918
166912
|
}
|
166913
|
+
const filepath = path16.join(dir, relativeFilepath);
|
166919
166914
|
const filestat = await (0, import_promises8.stat)(filepath);
|
166920
166915
|
if (filestat.isSymbolicLink() || filestat.isDirectory()) {
|
166921
166916
|
return;
|
166922
166917
|
} else {
|
166918
|
+
errorOnLegacyPagesWorkerJSAsset(relativeFilepath, !!ignoreFn);
|
166923
166919
|
if (counter >= MAX_ASSET_COUNT2) {
|
166924
166920
|
throw new UserError(
|
166925
166921
|
`Maximum number of assets exceeded.
|
@@ -166944,7 +166940,7 @@ Cloudflare Workers supports assets with sizes of up to ${prettyBytes(
|
|
166944
166940
|
Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.`
|
166945
166941
|
);
|
166946
166942
|
}
|
166947
|
-
manifest[
|
166943
|
+
manifest[normalizeFilePath(relativeFilepath)] = {
|
166948
166944
|
hash: hashFile(filepath),
|
166949
166945
|
size: filestat.size
|
166950
166946
|
};
|
@@ -166974,49 +166970,48 @@ function getExperimentalAssetsBasePath(config, experimentalAssetsCommandLineArg)
|
|
166974
166970
|
__name(getExperimentalAssetsBasePath, "getExperimentalAssetsBasePath");
|
166975
166971
|
function processExperimentalAssetsArg(args, config) {
|
166976
166972
|
const experimentalAssets = args.experimentalAssets ? { directory: args.experimentalAssets } : config.experimental_assets;
|
166977
|
-
|
166978
|
-
|
166979
|
-
|
166980
|
-
|
166981
|
-
|
166982
|
-
|
166983
|
-
|
166984
|
-
|
166985
|
-
|
166986
|
-
|
166987
|
-
|
166988
|
-
|
166989
|
-
|
166990
|
-
|
166973
|
+
if (!experimentalAssets) {
|
166974
|
+
return;
|
166975
|
+
}
|
166976
|
+
const experimentalAssetsBasePath = getExperimentalAssetsBasePath(
|
166977
|
+
config,
|
166978
|
+
args.experimentalAssets
|
166979
|
+
);
|
166980
|
+
const resolvedExperimentalAssetsPath = path16.resolve(
|
166981
|
+
experimentalAssetsBasePath,
|
166982
|
+
experimentalAssets.directory
|
166983
|
+
);
|
166984
|
+
if (!(0, import_node_fs11.existsSync)(resolvedExperimentalAssetsPath)) {
|
166985
|
+
const sourceOfTruthMessage = args.experimentalAssets ? '"--experimental-assets" command line argument' : '"experimental_assets.directory" field in your configuration file';
|
166986
|
+
throw new UserError(
|
166987
|
+
`The directory specified by the ${sourceOfTruthMessage} does not exist:
|
166991
166988
|
${resolvedExperimentalAssetsPath}`
|
166992
|
-
|
166993
|
-
}
|
166994
|
-
experimentalAssets.directory = resolvedExperimentalAssetsPath;
|
166995
|
-
const routingConfig = {
|
166996
|
-
has_user_worker: Boolean(args.script || config.main)
|
166997
|
-
};
|
166998
|
-
const assetConfig = {
|
166999
|
-
html_handling: config.experimental_assets?.html_handling,
|
167000
|
-
not_found_handling: config.experimental_assets?.not_found_handling
|
167001
|
-
};
|
167002
|
-
experimentalAssetsOptions = {
|
167003
|
-
...experimentalAssets,
|
167004
|
-
routingConfig,
|
167005
|
-
assetConfig
|
167006
|
-
};
|
166989
|
+
);
|
167007
166990
|
}
|
167008
|
-
|
166991
|
+
experimentalAssets.directory = resolvedExperimentalAssetsPath;
|
166992
|
+
const routingConfig = {
|
166993
|
+
has_user_worker: Boolean(args.script || config.main)
|
166994
|
+
};
|
166995
|
+
const assetConfig = {
|
166996
|
+
html_handling: config.experimental_assets?.html_handling,
|
166997
|
+
not_found_handling: config.experimental_assets?.not_found_handling
|
166998
|
+
};
|
166999
|
+
return {
|
167000
|
+
...experimentalAssets,
|
167001
|
+
routingConfig,
|
167002
|
+
assetConfig
|
167003
|
+
};
|
167009
167004
|
}
|
167010
167005
|
__name(processExperimentalAssetsArg, "processExperimentalAssetsArg");
|
167011
|
-
function
|
167006
|
+
function validateAssetsArgsAndConfig(args, config) {
|
167012
167007
|
if ((args.experimentalAssets || config.experimental_assets) && (args.legacyAssets || config.legacy_assets)) {
|
167013
167008
|
throw new UserError(
|
167014
|
-
"Cannot use Experimental Assets and Legacy Assets in the same Worker."
|
167009
|
+
"Cannot use Experimental Assets and Legacy Assets in the same Worker.\nPlease remove either the `legacy_assets` or `experimental_assets` field from your configuration file."
|
167015
167010
|
);
|
167016
167011
|
}
|
167017
167012
|
if ((args.experimentalAssets || config.experimental_assets) && (args.site || config.site)) {
|
167018
167013
|
throw new UserError(
|
167019
|
-
"Cannot use Experimental Assets and Workers Sites in the same Worker."
|
167014
|
+
"Cannot use Experimental Assets and Workers Sites in the same Worker.\nPlease remove either the `site` or `experimental_assets` field from your configuration file."
|
167020
167015
|
);
|
167021
167016
|
}
|
167022
167017
|
if ((args.experimentalAssets || config.experimental_assets) && config.tail_consumers?.length) {
|
@@ -167024,10 +167019,15 @@ function verifyMutuallyExclusiveAssetsArgsOrConfig(args, config) {
|
|
167024
167019
|
"Cannot use Experimental Assets and tail consumers in the same Worker. Tail Workers are not yet supported for Workers with assets."
|
167025
167020
|
);
|
167026
167021
|
}
|
167022
|
+
if (!(args.script || config.main) && config.experimental_assets?.binding) {
|
167023
|
+
throw new UserError(
|
167024
|
+
"Cannot use Experimental Assets with a binding in an assets-only Worker.\nPlease remove the asset binding from your configuration file, or provide a Worker script in your configuration file (`main`)."
|
167025
|
+
);
|
167026
|
+
}
|
167027
167027
|
}
|
167028
|
-
__name(
|
167028
|
+
__name(validateAssetsArgsAndConfig, "validateAssetsArgsAndConfig");
|
167029
|
+
var CF_ASSETS_IGNORE_FILENAME = ".assetsignore";
|
167029
167030
|
async function createAssetIgnoreFunction(dir) {
|
167030
|
-
const CF_ASSETS_IGNORE_FILENAME = ".assetsignore";
|
167031
167031
|
const cfAssetIgnorePath = path16.resolve(dir, CF_ASSETS_IGNORE_FILENAME);
|
167032
167032
|
if (!(0, import_node_fs11.existsSync)(cfAssetIgnorePath)) {
|
167033
167033
|
return null;
|
@@ -167037,6 +167037,20 @@ async function createAssetIgnoreFunction(dir) {
|
|
167037
167037
|
return createPatternMatcher(ignorePatterns, true);
|
167038
167038
|
}
|
167039
167039
|
__name(createAssetIgnoreFunction, "createAssetIgnoreFunction");
|
167040
|
+
function errorOnLegacyPagesWorkerJSAsset(file, hasAssetsIgnoreFile) {
|
167041
|
+
if (!hasAssetsIgnoreFile) {
|
167042
|
+
const workerJsType = file === "_worker.js" ? "file" : file.startsWith("_worker.js") ? "directory" : null;
|
167043
|
+
if (workerJsType !== null) {
|
167044
|
+
throw new UserError(dedent2`
|
167045
|
+
Uploading a Pages _worker.js ${workerJsType} as an asset.
|
167046
|
+
This could expose your private server-side code to the public Internet. Is this intended?
|
167047
|
+
If you do not want to upload this ${workerJsType}, either remove it or add an "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, containing "_worker.js" to avoid uploading.
|
167048
|
+
If you do want to upload this ${workerJsType}, you can add an empty "${CF_ASSETS_IGNORE_FILENAME}" file, to the root of your asset directory, to hide this error.
|
167049
|
+
`);
|
167050
|
+
}
|
167051
|
+
}
|
167052
|
+
}
|
167053
|
+
__name(errorOnLegacyPagesWorkerJSAsset, "errorOnLegacyPagesWorkerJSAsset");
|
167040
167054
|
|
167041
167055
|
// src/metrics/index.ts
|
167042
167056
|
init_import_meta_url();
|
@@ -167049,7 +167063,7 @@ var import_undici6 = __toESM(require_undici());
|
|
167049
167063
|
init_import_meta_url();
|
167050
167064
|
var import_node_crypto4 = require("node:crypto");
|
167051
167065
|
var import_node_fs12 = require("node:fs");
|
167052
|
-
var
|
167066
|
+
var import_node_path19 = __toESM(require("node:path"));
|
167053
167067
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
167054
167068
|
var USER_ID_CACHE_PATH = "user-id.json";
|
167055
167069
|
async function getMetricsConfig({
|
@@ -167087,7 +167101,7 @@ async function getMetricsConfig({
|
|
167087
167101
|
"Would you like to help improve Wrangler by sending usage metrics to Cloudflare?"
|
167088
167102
|
);
|
167089
167103
|
logger.log(
|
167090
|
-
`Your choice has been saved in the following file: ${
|
167104
|
+
`Your choice has been saved in the following file: ${import_node_path19.default.relative(
|
167091
167105
|
process.cwd(),
|
167092
167106
|
getMetricsConfigPath()
|
167093
167107
|
)}.
|
@@ -167108,7 +167122,7 @@ async function getMetricsConfig({
|
|
167108
167122
|
}
|
167109
167123
|
__name(getMetricsConfig, "getMetricsConfig");
|
167110
167124
|
function writeMetricsConfig(config) {
|
167111
|
-
(0, import_node_fs12.mkdirSync)(
|
167125
|
+
(0, import_node_fs12.mkdirSync)(import_node_path19.default.dirname(getMetricsConfigPath()), { recursive: true });
|
167112
167126
|
(0, import_node_fs12.writeFileSync)(
|
167113
167127
|
getMetricsConfigPath(),
|
167114
167128
|
JSON.stringify(
|
@@ -167132,7 +167146,7 @@ function readMetricsConfig() {
|
|
167132
167146
|
}
|
167133
167147
|
__name(readMetricsConfig, "readMetricsConfig");
|
167134
167148
|
function getMetricsConfigPath() {
|
167135
|
-
return
|
167149
|
+
return import_node_path19.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
167136
167150
|
}
|
167137
167151
|
__name(getMetricsConfigPath, "getMetricsConfigPath");
|
167138
167152
|
function getDeviceId(config) {
|
@@ -167580,16 +167594,16 @@ var import_undici7 = __toESM(require_undici());
|
|
167580
167594
|
|
167581
167595
|
// src/dev/get-local-persistence-path.ts
|
167582
167596
|
init_import_meta_url();
|
167583
|
-
var
|
167597
|
+
var import_node_path20 = __toESM(require("node:path"));
|
167584
167598
|
function getLocalPersistencePath(persistTo, configPath) {
|
167585
167599
|
return persistTo ? (
|
167586
167600
|
// If path specified, always treat it as relative to cwd()
|
167587
|
-
|
167601
|
+
import_node_path20.default.resolve(process.cwd(), persistTo)
|
167588
167602
|
) : (
|
167589
167603
|
// Otherwise, treat it as relative to wrangler.toml,
|
167590
167604
|
// if one can be found, otherwise cwd()
|
167591
|
-
|
167592
|
-
configPath ?
|
167605
|
+
import_node_path20.default.resolve(
|
167606
|
+
configPath ? import_node_path20.default.dirname(configPath) : process.cwd(),
|
167593
167607
|
".wrangler/state"
|
167594
167608
|
)
|
167595
167609
|
);
|
@@ -167600,7 +167614,7 @@ __name(getLocalPersistencePath, "getLocalPersistencePath");
|
|
167600
167614
|
init_import_meta_url();
|
167601
167615
|
var import_node_assert11 = __toESM(require("node:assert"));
|
167602
167616
|
var import_node_crypto5 = require("node:crypto");
|
167603
|
-
var
|
167617
|
+
var import_node_path21 = __toESM(require("node:path"));
|
167604
167618
|
|
167605
167619
|
// ../../node_modules/.pnpm/es-module-lexer@1.3.1/node_modules/es-module-lexer/dist/lexer.js
|
167606
167620
|
init_import_meta_url();
|
@@ -168242,7 +168256,7 @@ async function buildSourceOptions(config) {
|
|
168242
168256
|
config.bundle.modules
|
168243
168257
|
);
|
168244
168258
|
const entrypointNames = isPython ? [] : await getEntrypointNames(entrypointSource);
|
168245
|
-
const modulesRoot =
|
168259
|
+
const modulesRoot = import_node_path21.default.dirname(scriptPath3);
|
168246
168260
|
const sourceOptions = {
|
168247
168261
|
modulesRoot,
|
168248
168262
|
modules: [
|
@@ -168255,7 +168269,7 @@ async function buildSourceOptions(config) {
|
|
168255
168269
|
// Misc (WebAssembly, etc, ...)
|
168256
168270
|
...modules.map((module3) => ({
|
168257
168271
|
type: ModuleTypeToRuleType[module3.type ?? "esm"],
|
168258
|
-
path:
|
168272
|
+
path: import_node_path21.default.resolve(modulesRoot, module3.name),
|
168259
168273
|
contents: module3.content
|
168260
168274
|
}))
|
168261
168275
|
]
|
@@ -168314,14 +168328,14 @@ function buildMiniflareBindingOptions(config) {
|
|
168314
168328
|
const wasmBindings = { ...bindings.wasm_modules };
|
168315
168329
|
if (config.format === "service-worker" && config.bundle) {
|
168316
168330
|
const scriptPath3 = config.bundle.path;
|
168317
|
-
const modulesRoot =
|
168331
|
+
const modulesRoot = import_node_path21.default.dirname(scriptPath3);
|
168318
168332
|
for (const { type, name } of config.bundle.modules) {
|
168319
168333
|
if (type === "text") {
|
168320
|
-
textBlobBindings[getIdentifier(name)] =
|
168334
|
+
textBlobBindings[getIdentifier(name)] = import_node_path21.default.resolve(modulesRoot, name);
|
168321
168335
|
} else if (type === "buffer") {
|
168322
|
-
dataBlobBindings[getIdentifier(name)] =
|
168336
|
+
dataBlobBindings[getIdentifier(name)] = import_node_path21.default.resolve(modulesRoot, name);
|
168323
168337
|
} else if (type === "compiled-wasm") {
|
168324
|
-
wasmBindings[getIdentifier(name)] =
|
168338
|
+
wasmBindings[getIdentifier(name)] = import_node_path21.default.resolve(modulesRoot, name);
|
168325
168339
|
}
|
168326
168340
|
}
|
168327
168341
|
}
|
@@ -168532,13 +168546,13 @@ function buildMiniflareBindingOptions(config) {
|
|
168532
168546
|
__name(buildMiniflareBindingOptions, "buildMiniflareBindingOptions");
|
168533
168547
|
function buildPersistOptions(localPersistencePath) {
|
168534
168548
|
if (localPersistencePath !== null) {
|
168535
|
-
const v3Path =
|
168549
|
+
const v3Path = import_node_path21.default.join(localPersistencePath, "v3");
|
168536
168550
|
return {
|
168537
|
-
cachePersist:
|
168538
|
-
durableObjectsPersist:
|
168539
|
-
kvPersist:
|
168540
|
-
r2Persist:
|
168541
|
-
d1Persist:
|
168551
|
+
cachePersist: import_node_path21.default.join(v3Path, "cache"),
|
168552
|
+
durableObjectsPersist: import_node_path21.default.join(v3Path, "do"),
|
168553
|
+
kvPersist: import_node_path21.default.join(v3Path, "kv"),
|
168554
|
+
r2Persist: import_node_path21.default.join(v3Path, "r2"),
|
168555
|
+
d1Persist: import_node_path21.default.join(v3Path, "d1")
|
168542
168556
|
};
|
168543
168557
|
}
|
168544
168558
|
}
|
@@ -168563,7 +168577,7 @@ function buildSitesOptions({
|
|
168563
168577
|
if (legacyAssetPaths !== void 0) {
|
168564
168578
|
const { baseDirectory, assetDirectory, includePatterns, excludePatterns } = legacyAssetPaths;
|
168565
168579
|
return {
|
168566
|
-
sitePath:
|
168580
|
+
sitePath: import_node_path21.default.join(baseDirectory, assetDirectory),
|
168567
168581
|
siteInclude: includePatterns.length > 0 ? includePatterns : void 0,
|
168568
168582
|
siteExclude: excludePatterns.length > 0 ? excludePatterns : void 0
|
168569
168583
|
};
|
@@ -171038,6 +171052,16 @@ __name(createLogUpdate, "createLogUpdate");
|
|
171038
171052
|
var logUpdate = createLogUpdate(import_node_process7.default.stdout);
|
171039
171053
|
var logUpdateStderr = createLogUpdate(import_node_process7.default.stderr);
|
171040
171054
|
|
171055
|
+
// ../cli/error.ts
|
171056
|
+
init_import_meta_url();
|
171057
|
+
var CancelError = class extends Error {
|
171058
|
+
constructor(message, signal) {
|
171059
|
+
super(message);
|
171060
|
+
this.signal = signal;
|
171061
|
+
}
|
171062
|
+
};
|
171063
|
+
__name(CancelError, "CancelError");
|
171064
|
+
|
171041
171065
|
// ../cli/select-list.ts
|
171042
171066
|
init_import_meta_url();
|
171043
171067
|
var SelectRefreshablePrompt = class extends h {
|
@@ -171099,7 +171123,11 @@ var leftT = gray(shapes.leftT);
|
|
171099
171123
|
function acceptDefault(promptConfig, renderers, initialValue) {
|
171100
171124
|
const error2 = promptConfig.validate?.(initialValue);
|
171101
171125
|
if (error2) {
|
171102
|
-
|
171126
|
+
if (promptConfig.throwOnError) {
|
171127
|
+
throw new Error(error2);
|
171128
|
+
} else {
|
171129
|
+
crash(error2);
|
171130
|
+
}
|
171103
171131
|
}
|
171104
171132
|
const lines = renderers.submit({ value: initialValue });
|
171105
171133
|
logRaw(lines.join("\n"));
|
@@ -171190,8 +171218,12 @@ var inputPrompt = /* @__PURE__ */ __name(async (promptConfig) => {
|
|
171190
171218
|
}
|
171191
171219
|
const input = await prompt2.prompt();
|
171192
171220
|
if (eD(input)) {
|
171193
|
-
|
171194
|
-
|
171221
|
+
if (promptConfig.throwOnError) {
|
171222
|
+
throw new CancelError("Operation cancelled");
|
171223
|
+
} else {
|
171224
|
+
cancel("Operation cancelled");
|
171225
|
+
process.exit(0);
|
171226
|
+
}
|
171195
171227
|
}
|
171196
171228
|
return input;
|
171197
171229
|
}, "inputPrompt");
|
@@ -171203,10 +171235,6 @@ var renderSubmit = /* @__PURE__ */ __name((config, value) => {
|
|
171203
171235
|
const content = config.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
171204
171236
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
171205
171237
|
}, "renderSubmit");
|
171206
|
-
var handleCancel = /* @__PURE__ */ __name(() => {
|
171207
|
-
cancel("Operation cancelled.");
|
171208
|
-
process.exit(0);
|
171209
|
-
}, "handleCancel");
|
171210
171238
|
var getRenderers = /* @__PURE__ */ __name((config) => {
|
171211
171239
|
switch (config.type) {
|
171212
171240
|
case "select":
|
@@ -171226,6 +171254,12 @@ var getTextRenderers = /* @__PURE__ */ __name((config) => {
|
|
171226
171254
|
const helpText = config.helpText ?? "";
|
171227
171255
|
const format10 = config.format ?? ((val) => String(val));
|
171228
171256
|
const defaultValue = config.defaultValue?.toString() ?? "";
|
171257
|
+
const activeRenderer = /* @__PURE__ */ __name(({ value }) => [
|
171258
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
171259
|
+
`${space(2)}${format10(value || dim(defaultValue))}`,
|
171260
|
+
``
|
171261
|
+
// extra line for readability
|
171262
|
+
], "activeRenderer");
|
171229
171263
|
return {
|
171230
171264
|
initial: () => [
|
171231
171265
|
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
@@ -171233,12 +171267,7 @@ var getTextRenderers = /* @__PURE__ */ __name((config) => {
|
|
171233
171267
|
``
|
171234
171268
|
// extra line for readability
|
171235
171269
|
],
|
171236
|
-
active:
|
171237
|
-
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
171238
|
-
`${space(2)}${format10(value || dim(defaultValue))}`,
|
171239
|
-
``
|
171240
|
-
// extra line for readability
|
171241
|
-
],
|
171270
|
+
active: activeRenderer,
|
171242
171271
|
error: ({ value, error: error2 }) => [
|
171243
171272
|
`${leftT} ${status.error} ${dim(error2)}`,
|
171244
171273
|
`${grayBar}`,
|
@@ -171248,7 +171277,7 @@ var getTextRenderers = /* @__PURE__ */ __name((config) => {
|
|
171248
171277
|
// extra line for readability
|
171249
171278
|
],
|
171250
171279
|
submit: ({ value }) => renderSubmit(config, format10(value ?? "")),
|
171251
|
-
cancel:
|
171280
|
+
cancel: activeRenderer
|
171252
171281
|
};
|
171253
171282
|
}, "getTextRenderers");
|
171254
171283
|
var getSelectRenderers = /* @__PURE__ */ __name((config) => {
|
@@ -171338,7 +171367,7 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
171338
171367
|
options29.find((o2) => o2.value === value)?.label
|
171339
171368
|
);
|
171340
171369
|
},
|
171341
|
-
cancel:
|
171370
|
+
cancel: defaultRenderer
|
171342
171371
|
};
|
171343
171372
|
}, "getSelectRenderers");
|
171344
171373
|
var getSelectListRenderers = /* @__PURE__ */ __name((config) => {
|
@@ -171433,7 +171462,7 @@ var getSelectListRenderers = /* @__PURE__ */ __name((config) => {
|
|
171433
171462
|
options29.find((o2) => o2.value === value)?.value
|
171434
171463
|
);
|
171435
171464
|
},
|
171436
|
-
cancel:
|
171465
|
+
cancel: defaultRenderer
|
171437
171466
|
};
|
171438
171467
|
}, "getSelectListRenderers");
|
171439
171468
|
var getConfirmRenderers = /* @__PURE__ */ __name((config) => {
|
@@ -171455,7 +171484,7 @@ var getConfirmRenderers = /* @__PURE__ */ __name((config) => {
|
|
171455
171484
|
confirm: defaultRenderer,
|
171456
171485
|
error: defaultRenderer,
|
171457
171486
|
submit: ({ value }) => renderSubmit(config, value ? "yes" : "no"),
|
171458
|
-
cancel:
|
171487
|
+
cancel: defaultRenderer
|
171459
171488
|
};
|
171460
171489
|
}, "getConfirmRenderers");
|
171461
171490
|
var spinnerFrames = {
|
@@ -171540,7 +171569,7 @@ var isInteractive2 = /* @__PURE__ */ __name(() => {
|
|
171540
171569
|
init_import_meta_url();
|
171541
171570
|
var import_node_crypto6 = require("node:crypto");
|
171542
171571
|
var import_node_fs14 = require("node:fs");
|
171543
|
-
var
|
171572
|
+
var import_node_path22 = require("node:path");
|
171544
171573
|
function writeOutput(entry) {
|
171545
171574
|
if (outputFilePath === void 0) {
|
171546
171575
|
outputFilePath = getOutputFilePath();
|
@@ -171564,7 +171593,7 @@ function getOutputFilePath() {
|
|
171564
171593
|
const outputFileDirectoryFromEnv = getOutputFileDirectoryFromEnv();
|
171565
171594
|
if (outputFileDirectoryFromEnv) {
|
171566
171595
|
const date = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").replace(".", "_").replace("T", "_").replace("Z", "");
|
171567
|
-
return (0,
|
171596
|
+
return (0, import_node_path22.resolve)(
|
171568
171597
|
outputFileDirectoryFromEnv,
|
171569
171598
|
`wrangler-output-${date}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}.json`
|
171570
171599
|
);
|
@@ -172355,7 +172384,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172355
172384
|
);
|
172356
172385
|
if (props.outDir) {
|
172357
172386
|
(0, import_node_fs15.mkdirSync)(props.outDir, { recursive: true });
|
172358
|
-
const readmePath =
|
172387
|
+
const readmePath = import_node_path23.default.join(props.outDir, "README.md");
|
172359
172388
|
(0, import_node_fs15.writeFileSync)(
|
172360
172389
|
readmePath,
|
172361
172390
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
@@ -172402,11 +172431,11 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172402
172431
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
172403
172432
|
(0, import_node_fs15.mkdirSync)(destinationDir, { recursive: true });
|
172404
172433
|
(0, import_node_fs15.writeFileSync)(
|
172405
|
-
|
172434
|
+
import_node_path23.default.join(destinationDir, import_node_path23.default.basename(props.entry.file)),
|
172406
172435
|
(0, import_node_fs15.readFileSync)(props.entry.file, "utf-8")
|
172407
172436
|
);
|
172408
172437
|
}
|
172409
|
-
const entryDirectory =
|
172438
|
+
const entryDirectory = import_node_path23.default.dirname(props.entry.file);
|
172410
172439
|
const moduleCollector = createModuleCollector({
|
172411
172440
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
172412
172441
|
entryDirectory,
|
@@ -172462,7 +172491,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172462
172491
|
}
|
172463
172492
|
);
|
172464
172493
|
for (const module3 of modules) {
|
172465
|
-
const modulePath = module3.filePath === void 0 ? module3.name :
|
172494
|
+
const modulePath = module3.filePath === void 0 ? module3.name : import_node_path23.default.relative("", module3.filePath);
|
172466
172495
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
172467
172496
|
dependencies[modulePath] = { bytesInOutput };
|
172468
172497
|
}
|
@@ -172539,7 +172568,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172539
172568
|
});
|
172540
172569
|
}
|
172541
172570
|
const placement = config.placement?.mode === "smart" ? { mode: "smart", hint: config.placement.hint } : void 0;
|
172542
|
-
const entryPointName =
|
172571
|
+
const entryPointName = import_node_path23.default.basename(resolvedEntryPointPath);
|
172543
172572
|
const main2 = {
|
172544
172573
|
name: entryPointName,
|
172545
172574
|
filePath: resolvedEntryPointPath,
|
@@ -172574,7 +172603,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172574
172603
|
0
|
172575
172604
|
);
|
172576
172605
|
await printBundleSize(
|
172577
|
-
{ name:
|
172606
|
+
{ name: import_node_path23.default.basename(resolvedEntryPointPath), content },
|
172578
172607
|
modules
|
172579
172608
|
);
|
172580
172609
|
const withoutStaticAssets = {
|
@@ -172978,17 +173007,17 @@ __name(noBundleWorker, "noBundleWorker");
|
|
172978
173007
|
|
172979
173008
|
// src/deployment-bundle/entry.ts
|
172980
173009
|
init_import_meta_url();
|
172981
|
-
var
|
173010
|
+
var import_node_path28 = __toESM(require("node:path"));
|
172982
173011
|
|
172983
173012
|
// src/deployment-bundle/guess-worker-format.ts
|
172984
173013
|
init_import_meta_url();
|
172985
|
-
var
|
173014
|
+
var import_node_path24 = __toESM(require("node:path"));
|
172986
173015
|
var esbuild2 = __toESM(require("esbuild"));
|
172987
173016
|
async function guessWorkerFormat(entryFile, entryWorkingDirectory, hint, tsconfig) {
|
172988
|
-
const parsedEntryPath =
|
173017
|
+
const parsedEntryPath = import_node_path24.default.parse(entryFile);
|
172989
173018
|
if (parsedEntryPath.ext == ".py") {
|
172990
173019
|
logger.warn(
|
172991
|
-
`The entrypoint ${
|
173020
|
+
`The entrypoint ${import_node_path24.default.relative(
|
172992
173021
|
process.cwd(),
|
172993
173022
|
entryFile
|
172994
173023
|
)} defines a Python worker, support for Python workers is currently experimental. Python workers with a requirements.txt file can only be run locally and cannot be deployed.`
|
@@ -173012,7 +173041,7 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, hint, tsconfi
|
|
173012
173041
|
guessedWorkerFormat = "modules";
|
173013
173042
|
} else {
|
173014
173043
|
logger.warn(
|
173015
|
-
`The entrypoint ${
|
173044
|
+
`The entrypoint ${import_node_path24.default.relative(
|
173016
173045
|
process.cwd(),
|
173017
173046
|
entryFile
|
173018
173047
|
)} has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...`
|
@@ -173042,7 +173071,7 @@ __name(guessWorkerFormat, "guessWorkerFormat");
|
|
173042
173071
|
// src/deployment-bundle/run-custom-build.ts
|
173043
173072
|
init_import_meta_url();
|
173044
173073
|
var import_node_fs16 = require("node:fs");
|
173045
|
-
var
|
173074
|
+
var import_node_path27 = __toESM(require("node:path"));
|
173046
173075
|
init_execa();
|
173047
173076
|
async function runCustomBuild(expectedEntryAbsolute, expectedEntryRelative, build5) {
|
173048
173077
|
if (build5.command) {
|
@@ -173105,8 +173134,8 @@ The provided entry-point path, "${relativeEntryPointPath}", points to a director
|
|
173105
173134
|
]) {
|
173106
173135
|
for (const extension of [".ts", ".tsx", ".js", ".jsx"]) {
|
173107
173136
|
const filePath = basenamePath + extension;
|
173108
|
-
if (fileExists(
|
173109
|
-
possiblePaths.push(
|
173137
|
+
if (fileExists(import_node_path27.default.resolve(absoluteEntryPointPath, filePath))) {
|
173138
|
+
possiblePaths.push(import_node_path27.default.join(relativeEntryPointPath, filePath));
|
173110
173139
|
}
|
173111
173140
|
}
|
173112
173141
|
}
|
@@ -173123,10 +173152,10 @@ Did you mean to set the main field to${possiblePaths.length > 1 ? " one of" : ""
|
|
173123
173152
|
__name(getMissingEntryPointMessage, "getMissingEntryPointMessage");
|
173124
173153
|
function fileExists(filePath) {
|
173125
173154
|
const SOURCE_FILE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"];
|
173126
|
-
if (
|
173155
|
+
if (import_node_path27.default.extname(filePath) !== "") {
|
173127
173156
|
return (0, import_node_fs16.existsSync)(filePath);
|
173128
173157
|
}
|
173129
|
-
const base =
|
173158
|
+
const base = import_node_path27.default.join(import_node_path27.default.dirname(filePath), import_node_path27.default.basename(filePath));
|
173130
173159
|
for (const ext of SOURCE_FILE_EXTENSIONS) {
|
173131
173160
|
if ((0, import_node_fs16.existsSync)(base + ext)) {
|
173132
173161
|
return true;
|
@@ -173141,26 +173170,26 @@ async function getEntry(args, config, command2) {
|
|
173141
173170
|
let file;
|
173142
173171
|
let directory = process.cwd();
|
173143
173172
|
if (args.script) {
|
173144
|
-
file =
|
173173
|
+
file = import_node_path28.default.resolve(args.script);
|
173145
173174
|
} else if (config.main === void 0) {
|
173146
173175
|
if (config.site?.["entry-point"]) {
|
173147
|
-
directory =
|
173148
|
-
file =
|
173176
|
+
directory = import_node_path28.default.resolve(import_node_path28.default.dirname(config.configPath ?? "."));
|
173177
|
+
file = import_node_path28.default.extname(config.site?.["entry-point"]) ? import_node_path28.default.resolve(config.site?.["entry-point"]) : (
|
173149
173178
|
// site.entry-point could be a directory
|
173150
|
-
|
173179
|
+
import_node_path28.default.resolve(config.site?.["entry-point"], "index.js")
|
173151
173180
|
);
|
173152
173181
|
} else if (args.legacyAssets || config.legacy_assets || args.experimentalAssets || config.experimental_assets) {
|
173153
|
-
file =
|
173182
|
+
file = import_node_path28.default.resolve(getBasePath(), "templates/no-op-worker.js");
|
173154
173183
|
} else {
|
173155
173184
|
throw new UserError(
|
173156
173185
|
`Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler ${command2} path/to/script\`) or the \`main\` config field.`
|
173157
173186
|
);
|
173158
173187
|
}
|
173159
173188
|
} else {
|
173160
|
-
directory =
|
173161
|
-
file =
|
173189
|
+
directory = import_node_path28.default.resolve(import_node_path28.default.dirname(config.configPath ?? "."));
|
173190
|
+
file = import_node_path28.default.resolve(directory, config.main);
|
173162
173191
|
}
|
173163
|
-
const relativeFile =
|
173192
|
+
const relativeFile = import_node_path28.default.relative(directory, file) || ".";
|
173164
173193
|
await runCustomBuild(file, relativeFile, config.build);
|
173165
173194
|
const format10 = await guessWorkerFormat(
|
173166
173195
|
file,
|
@@ -173192,7 +173221,7 @@ ${migrateUrl}`
|
|
173192
173221
|
file,
|
173193
173222
|
directory,
|
173194
173223
|
format: format10,
|
173195
|
-
moduleRoot: args.moduleRoot ?? config.base_dir ??
|
173224
|
+
moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path28.default.dirname(file),
|
173196
173225
|
name: config.name ?? "worker"
|
173197
173226
|
};
|
173198
173227
|
}
|
@@ -173231,7 +173260,7 @@ var import_node_fs17 = require("node:fs");
|
|
173231
173260
|
var import_promises10 = require("node:fs/promises");
|
173232
173261
|
var import_node_http2 = require("node:http");
|
173233
173262
|
var import_node_net = __toESM(require("node:net"));
|
173234
|
-
var
|
173263
|
+
var import_node_path29 = __toESM(require("node:path"));
|
173235
173264
|
var import_body_parser = __toESM(require_body_parser());
|
173236
173265
|
var import_chokidar = require("chokidar");
|
173237
173266
|
|
@@ -173304,7 +173333,7 @@ if (Number.isNaN(DEV_REGISTRY_PORT)) {
|
|
173304
173333
|
DEV_REGISTRY_PORT = 6284;
|
173305
173334
|
}
|
173306
173335
|
var DEV_REGISTRY_HOST = `http://127.0.0.1:${DEV_REGISTRY_PORT}`;
|
173307
|
-
var DEV_REGISTRY_PATH =
|
173336
|
+
var DEV_REGISTRY_PATH = import_node_path29.default.join(getGlobalWranglerConfigPath(), "registry");
|
173308
173337
|
var globalServer;
|
173309
173338
|
var globalTerminator;
|
173310
173339
|
var globalWatcher;
|
@@ -173318,10 +173347,10 @@ async function loadWorkerDefinitions() {
|
|
173318
173347
|
for (const workerName of workerDefinitions) {
|
173319
173348
|
try {
|
173320
173349
|
const file = await (0, import_promises10.readFile)(
|
173321
|
-
|
173350
|
+
import_node_path29.default.join(DEV_REGISTRY_PATH, workerName),
|
173322
173351
|
"utf8"
|
173323
173352
|
);
|
173324
|
-
const stats = await (0, import_promises10.stat)(
|
173353
|
+
const stats = await (0, import_promises10.stat)(import_node_path29.default.join(DEV_REGISTRY_PATH, workerName));
|
173325
173354
|
if (stats.mtime < subMinutes(/* @__PURE__ */ new Date(), 10)) {
|
173326
173355
|
await unregisterWorker(workerName);
|
173327
173356
|
} else {
|
@@ -173429,7 +173458,7 @@ async function registerWorker(name, definition) {
|
|
173429
173458
|
}
|
173430
173459
|
await (0, import_promises10.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
|
173431
173460
|
await (0, import_promises10.writeFile)(
|
173432
|
-
|
173461
|
+
import_node_path29.default.join(DEV_REGISTRY_PATH, name),
|
173433
173462
|
// We don't currently do anything with the stored Wrangler version,
|
173434
173463
|
// but if we need to make breaking changes to this format in the future
|
173435
173464
|
// we can use this field to present useful messaging
|
@@ -173438,7 +173467,7 @@ async function registerWorker(name, definition) {
|
|
173438
173467
|
heartbeats.set(
|
173439
173468
|
name,
|
173440
173469
|
setInterval(() => {
|
173441
|
-
(0, import_node_fs17.utimesSync)(
|
173470
|
+
(0, import_node_fs17.utimesSync)(import_node_path29.default.join(DEV_REGISTRY_PATH, name), /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
173442
173471
|
}, 3e4)
|
173443
173472
|
);
|
173444
173473
|
return;
|
@@ -173466,7 +173495,7 @@ __name(registerWorker, "registerWorker");
|
|
173466
173495
|
async function unregisterWorker(name) {
|
173467
173496
|
if (getFlag("FILE_BASED_REGISTRY")) {
|
173468
173497
|
try {
|
173469
|
-
await (0, import_promises10.unlink)(
|
173498
|
+
await (0, import_promises10.unlink)(import_node_path29.default.join(DEV_REGISTRY_PATH, name));
|
173470
173499
|
const existingHeartbeat = heartbeats.get(name);
|
173471
173500
|
if (existingHeartbeat) {
|
173472
173501
|
clearInterval(existingHeartbeat);
|
@@ -173585,12 +173614,12 @@ var termux_default = clipboard;
|
|
173585
173614
|
|
173586
173615
|
// ../../node_modules/.pnpm/clipboardy@3.0.0/node_modules/clipboardy/lib/linux.js
|
173587
173616
|
init_import_meta_url();
|
173588
|
-
var
|
173617
|
+
var import_node_path30 = __toESM(require("node:path"), 1);
|
173589
173618
|
var import_node_url10 = require("node:url");
|
173590
173619
|
var import_execa3 = __toESM(require_execa(), 1);
|
173591
|
-
var __dirname3 =
|
173620
|
+
var __dirname3 = import_node_path30.default.dirname((0, import_node_url10.fileURLToPath)(import_meta_url));
|
173592
173621
|
var xsel = "xsel";
|
173593
|
-
var xselFallback =
|
173622
|
+
var xselFallback = import_node_path30.default.join(__dirname3, "../fallbacks/linux/xsel");
|
173594
173623
|
var copyArguments = ["--clipboard", "--input"];
|
173595
173624
|
var pasteArguments = ["--clipboard", "--output"];
|
173596
173625
|
var makeError2 = /* @__PURE__ */ __name((xselError, fallbackError) => {
|
@@ -173659,13 +173688,13 @@ var macos_default = clipboard3;
|
|
173659
173688
|
|
173660
173689
|
// ../../node_modules/.pnpm/clipboardy@3.0.0/node_modules/clipboardy/lib/windows.js
|
173661
173690
|
init_import_meta_url();
|
173662
|
-
var
|
173691
|
+
var import_node_path31 = __toESM(require("node:path"), 1);
|
173663
173692
|
var import_node_url11 = require("node:url");
|
173664
173693
|
var import_execa5 = __toESM(require_execa(), 1);
|
173665
173694
|
var import_arch = __toESM(require_arch(), 1);
|
173666
|
-
var __dirname4 =
|
173695
|
+
var __dirname4 = import_node_path31.default.dirname((0, import_node_url11.fileURLToPath)(import_meta_url));
|
173667
173696
|
var binarySuffix = (0, import_arch.default)() === "x64" ? "x86_64" : "i686";
|
173668
|
-
var windowBinaryPath =
|
173697
|
+
var windowBinaryPath = import_node_path31.default.join(__dirname4, `../fallbacks/windows/clipboard_${binarySuffix}.exe`);
|
173669
173698
|
var clipboard4 = {
|
173670
173699
|
copy: async (options29) => (0, import_execa5.default)(windowBinaryPath, ["--copy"], options29),
|
173671
173700
|
paste: async (options29) => {
|
@@ -173858,7 +173887,7 @@ var import_open2 = __toESM(require_open());
|
|
173858
173887
|
init_import_meta_url();
|
173859
173888
|
var import_node_assert14 = __toESM(require("node:assert"));
|
173860
173889
|
var import_node_fs18 = __toESM(require("node:fs"));
|
173861
|
-
var
|
173890
|
+
var import_node_path32 = __toESM(require("node:path"));
|
173862
173891
|
var import_node_url12 = require("node:url");
|
173863
173892
|
function isAllowedSourcePath(bundle, filePath) {
|
173864
173893
|
const allowed = getBundleReferencedPaths(bundle);
|
@@ -173890,7 +173919,7 @@ function getBundleReferencedPaths(bundle) {
|
|
173890
173919
|
const sourceRoot = sourceMap.sourceRoot ?? "";
|
173891
173920
|
for (const source of sourceMap.sources) {
|
173892
173921
|
const sourceURL = new URL(
|
173893
|
-
|
173922
|
+
import_node_path32.default.posix.join(sourceRoot, source),
|
173894
173923
|
sourceMappingURL
|
173895
173924
|
);
|
173896
173925
|
allowed.sourcePaths.add((0, import_node_url12.fileURLToPath)(sourceURL));
|
@@ -174309,7 +174338,7 @@ __name(useLocalWorker, "useLocalWorker");
|
|
174309
174338
|
// src/dev/remote.tsx
|
174310
174339
|
init_import_meta_url();
|
174311
174340
|
var import_node_assert17 = __toESM(require("node:assert"));
|
174312
|
-
var
|
174341
|
+
var import_node_path36 = __toESM(require("node:path"));
|
174313
174342
|
var import_ink2 = __toESM(require_build2());
|
174314
174343
|
var import_ink_select_input = __toESM(require_build4());
|
174315
174344
|
var import_react3 = __toESM(require_react());
|
@@ -175393,7 +175422,7 @@ async function createRemoteWorkerInit(props) {
|
|
175393
175422
|
);
|
175394
175423
|
void printBundleSize(
|
175395
175424
|
{
|
175396
|
-
name:
|
175425
|
+
name: import_node_path36.default.basename(props.bundle.path),
|
175397
175426
|
content
|
175398
175427
|
},
|
175399
175428
|
props.modules
|
@@ -175421,9 +175450,9 @@ async function createRemoteWorkerInit(props) {
|
|
175421
175450
|
const init3 = {
|
175422
175451
|
name: props.name,
|
175423
175452
|
main: {
|
175424
|
-
name:
|
175453
|
+
name: import_node_path36.default.basename(props.bundle.path),
|
175425
175454
|
filePath: props.bundle.path,
|
175426
|
-
type: getBundleType(props.format,
|
175455
|
+
type: getBundleType(props.format, import_node_path36.default.basename(props.bundle.path)),
|
175427
175456
|
content
|
175428
175457
|
},
|
175429
175458
|
modules,
|
@@ -175538,7 +175567,7 @@ __name(handleUserFriendlyError, "handleUserFriendlyError");
|
|
175538
175567
|
init_import_meta_url();
|
175539
175568
|
var import_node_assert18 = __toESM(require("node:assert"));
|
175540
175569
|
var import_node_fs20 = require("node:fs");
|
175541
|
-
var
|
175570
|
+
var import_node_path37 = __toESM(require("node:path"));
|
175542
175571
|
var import_chokidar3 = require("chokidar");
|
175543
175572
|
var import_ink3 = __toESM(require_build2());
|
175544
175573
|
var import_react4 = __toESM(require_react());
|
@@ -175569,7 +175598,7 @@ function runBuild({
|
|
175569
175598
|
defineNavigatorUserAgent
|
175570
175599
|
}, setBundle, onErr) {
|
175571
175600
|
let stopWatching = void 0;
|
175572
|
-
const entryDirectory =
|
175601
|
+
const entryDirectory = import_node_path37.default.dirname(entry.file);
|
175573
175602
|
const moduleCollector = noBundle ? noopModuleCollector : createModuleCollector({
|
175574
175603
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
175575
175604
|
entryDirectory,
|
@@ -175638,8 +175667,8 @@ function runBuild({
|
|
175638
175667
|
}) : void 0;
|
175639
175668
|
stopWatching = bundleResult?.stop;
|
175640
175669
|
if (noBundle) {
|
175641
|
-
const watching = [
|
175642
|
-
const watchPythonRequirements = getBundleType(entry.format, entry.file) === "python" ?
|
175670
|
+
const watching = [import_node_path37.default.resolve(entry.moduleRoot)];
|
175671
|
+
const watchPythonRequirements = getBundleType(entry.format, entry.file) === "python" ? import_node_path37.default.resolve(entry.directory, "requirements.txt") : void 0;
|
175643
175672
|
if (watchPythonRequirements) {
|
175644
175673
|
watching.push(watchPythonRequirements);
|
175645
175674
|
}
|
@@ -180919,7 +180948,7 @@ __name(ApiError, "ApiError");
|
|
180919
180948
|
|
180920
180949
|
// src/cloudchamber/client/core/CancelablePromise.ts
|
180921
180950
|
init_import_meta_url();
|
180922
|
-
var
|
180951
|
+
var CancelError2 = class extends Error {
|
180923
180952
|
constructor(message) {
|
180924
180953
|
super(message);
|
180925
180954
|
this.name = "CancelError";
|
@@ -180928,7 +180957,7 @@ var CancelError = class extends Error {
|
|
180928
180957
|
return true;
|
180929
180958
|
}
|
180930
180959
|
};
|
180931
|
-
__name(
|
180960
|
+
__name(CancelError2, "CancelError");
|
180932
180961
|
var CancelablePromise = class {
|
180933
180962
|
#isResolved;
|
180934
180963
|
#isRejected;
|
@@ -181005,7 +181034,7 @@ var CancelablePromise = class {
|
|
181005
181034
|
}
|
181006
181035
|
}
|
181007
181036
|
this.#cancelHandlers.length = 0;
|
181008
|
-
this.#reject?.(new
|
181037
|
+
this.#reject?.(new CancelError2("Request aborted"));
|
181009
181038
|
}
|
181010
181039
|
get isCancelled() {
|
181011
181040
|
return this.#isCancelled;
|
@@ -187340,7 +187369,7 @@ var Handler5 = withConfig(
|
|
187340
187369
|
init_import_meta_url();
|
187341
187370
|
var import_fs9 = require("fs");
|
187342
187371
|
var import_node_assert19 = __toESM(require("node:assert"));
|
187343
|
-
var
|
187372
|
+
var import_node_path38 = __toESM(require("node:path"));
|
187344
187373
|
var import_ink7 = __toESM(require_build2());
|
187345
187374
|
var import_ink_table3 = __toESM(require_dist4());
|
187346
187375
|
var import_md5_file = __toESM(require_md5_file());
|
@@ -187668,7 +187697,7 @@ async function executeLocally({
|
|
187668
187697
|
}
|
187669
187698
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
187670
187699
|
const persistencePath = getLocalPersistencePath(persistTo, config.configPath);
|
187671
|
-
const d1Persist =
|
187700
|
+
const d1Persist = import_node_path38.default.join(persistencePath, "v3", "d1");
|
187672
187701
|
logger.log(
|
187673
187702
|
`\u{1F300} Executing on local database ${name} (${id}) from ${readableRelative(
|
187674
187703
|
d1Persist
|
@@ -187933,7 +187962,7 @@ __name(checkForSQLiteBinary, "checkForSQLiteBinary");
|
|
187933
187962
|
// src/d1/export.ts
|
187934
187963
|
init_import_meta_url();
|
187935
187964
|
var import_promises15 = __toESM(require("node:fs/promises"));
|
187936
|
-
var
|
187965
|
+
var import_node_path39 = __toESM(require("node:path"));
|
187937
187966
|
var import_miniflare14 = require("miniflare");
|
187938
187967
|
var import_undici15 = __toESM(require_undici());
|
187939
187968
|
function Options7(yargs) {
|
@@ -187997,7 +188026,7 @@ async function exportLocal(config, name, output, tables, noSchema, noData) {
|
|
187997
188026
|
}
|
187998
188027
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
187999
188028
|
const persistencePath = getLocalPersistencePath(void 0, config.configPath);
|
188000
|
-
const d1Persist =
|
188029
|
+
const d1Persist = import_node_path39.default.join(persistencePath, "v3", "d1");
|
188001
188030
|
logger.log(
|
188002
188031
|
`\u{1F300} Exporting local database ${name} (${id}) from ${readableRelative(
|
188003
188032
|
d1Persist
|
@@ -189328,30 +189357,43 @@ __name(checkAndConfirmForceDeleteIfNecessary, "checkAndConfirmForceDeleteIfNeces
|
|
189328
189357
|
// src/deploy/index.ts
|
189329
189358
|
init_import_meta_url();
|
189330
189359
|
var import_node_assert21 = __toESM(require("node:assert"));
|
189331
|
-
var
|
189360
|
+
var import_node_path40 = __toESM(require("node:path"));
|
189332
189361
|
|
189333
189362
|
// src/match-tag.ts
|
189334
189363
|
init_import_meta_url();
|
189335
|
-
async function verifyWorkerMatchesCITag(accountId, workerName) {
|
189364
|
+
async function verifyWorkerMatchesCITag(accountId, workerName, configPath) {
|
189336
189365
|
const matchTag = getCIMatchTag();
|
189366
|
+
logger.debug(
|
189367
|
+
`Starting verifyWorkerMatchesCITag() with tag: ${matchTag}, name: ${workerName}`
|
189368
|
+
);
|
189337
189369
|
if (!matchTag) {
|
189370
|
+
logger.debug(
|
189371
|
+
"No WRANGLER_CI_MATCH_TAG variable provided, aborting verifyWorkerMatchesCITag()"
|
189372
|
+
);
|
189338
189373
|
return;
|
189339
189374
|
}
|
189375
|
+
const envAccountID = getCloudflareAccountIdFromEnv();
|
189376
|
+
if (accountId !== envAccountID) {
|
189377
|
+
throw new FatalError(
|
189378
|
+
`The \`account_id\` in \`${configPath ?? "wrangler.toml"}\` must match the \`account_id\` for this account. Please update your wrangler.toml with \`account_id = "${envAccountID}"\``
|
189379
|
+
);
|
189380
|
+
}
|
189340
189381
|
let tag;
|
189341
189382
|
try {
|
189342
189383
|
const worker = await fetchResult(
|
189343
189384
|
`/accounts/${accountId}/workers/services/${workerName}`
|
189344
189385
|
);
|
189345
189386
|
tag = worker.default_environment.script.tag;
|
189387
|
+
logger.debug(`API returned with tag: ${tag} for worker: ${workerName}`);
|
189346
189388
|
} catch (e3) {
|
189347
189389
|
logger.debug(e3);
|
189348
189390
|
if (e3.code === 10090) {
|
189349
189391
|
throw new FatalError(
|
189350
|
-
`
|
189392
|
+
`The name in \`${configPath ?? "wrangler.toml"}\` (${workerName}) must match the name of your Worker. Please update the name field in your wrangler.toml.`
|
189351
189393
|
);
|
189352
189394
|
} else {
|
189353
189395
|
throw new FatalError(
|
189354
|
-
"Wrangler cannot validate that your Worker name matches what is expected by the
|
189396
|
+
"Wrangler cannot validate that your Worker name matches what is expected by the build system. Please retry the build."
|
189355
189397
|
);
|
189356
189398
|
}
|
189357
189399
|
}
|
@@ -189360,7 +189402,7 @@ async function verifyWorkerMatchesCITag(accountId, workerName) {
|
|
189360
189402
|
`Failed to match Worker tag. The API returned "${tag}", but the CI system expected "${matchTag}"`
|
189361
189403
|
);
|
189362
189404
|
throw new FatalError(
|
189363
|
-
`
|
189405
|
+
`The name in \`${configPath ?? "wrangler.toml"}\` (${workerName}) must match the name of your Worker. Please update the name field in your wrangler.toml.`
|
189364
189406
|
);
|
189365
189407
|
}
|
189366
189408
|
}
|
@@ -189550,8 +189592,8 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
189550
189592
|
throw new UserError("Cannot use both --assets and --legacy-assets.");
|
189551
189593
|
}
|
189552
189594
|
args.legacyAssets = args.legacyAssets ?? args.assets;
|
189553
|
-
const configPath = args.config || args.script && findWranglerToml(
|
189554
|
-
const projectRoot = configPath &&
|
189595
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path40.default.dirname(args.script));
|
189596
|
+
const projectRoot = configPath && import_node_path40.default.dirname(configPath);
|
189555
189597
|
const config = readConfig(configPath, args);
|
189556
189598
|
const entry = await getEntry(args, config, "deploy");
|
189557
189599
|
if (args.public) {
|
@@ -189569,7 +189611,7 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
189569
189611
|
"Cannot use Legacy Assets and Workers Sites in the same Worker."
|
189570
189612
|
);
|
189571
189613
|
}
|
189572
|
-
|
189614
|
+
validateAssetsArgsAndConfig(args, config);
|
189573
189615
|
const experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
189574
189616
|
if (args.latest) {
|
189575
189617
|
logger.warn(
|
@@ -189597,7 +189639,11 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
189597
189639
|
);
|
189598
189640
|
if (!args.dryRun) {
|
189599
189641
|
(0, import_node_assert21.default)(accountId, "Missing account ID");
|
189600
|
-
await verifyWorkerMatchesCITag(
|
189642
|
+
await verifyWorkerMatchesCITag(
|
189643
|
+
accountId,
|
189644
|
+
name,
|
189645
|
+
import_node_path40.default.relative(entry.directory, config.configPath ?? "wrangler.toml")
|
189646
|
+
);
|
189601
189647
|
}
|
189602
189648
|
const { sourceMapSize, versionId, workerTag, targets } = await deploy({
|
189603
189649
|
config,
|
@@ -189665,7 +189711,7 @@ var import_undici16 = __toESM(require_undici());
|
|
189665
189711
|
init_import_meta_url();
|
189666
189712
|
var fs20 = __toESM(require("node:fs"));
|
189667
189713
|
var import_promises16 = require("node:fs/promises");
|
189668
|
-
var
|
189714
|
+
var import_node_path43 = __toESM(require("node:path"));
|
189669
189715
|
var import_toml4 = __toESM(require_toml());
|
189670
189716
|
init_execa();
|
189671
189717
|
|
@@ -189673,7 +189719,7 @@ init_execa();
|
|
189673
189719
|
init_import_meta_url();
|
189674
189720
|
var import_node_fs24 = __toESM(require("node:fs"));
|
189675
189721
|
var import_node_os8 = __toESM(require("node:os"));
|
189676
|
-
var
|
189722
|
+
var import_node_path41 = __toESM(require("node:path"));
|
189677
189723
|
init_execa();
|
189678
189724
|
|
189679
189725
|
// ../../node_modules/.pnpm/semiver@1.1.0/node_modules/semiver/dist/semiver.mjs
|
@@ -189744,7 +189790,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
189744
189790
|
args.push(remote.substring(0, tagIndex));
|
189745
189791
|
}
|
189746
189792
|
const tempDir = import_node_fs24.default.mkdtempSync(
|
189747
|
-
|
189793
|
+
import_node_path41.default.join(import_node_os8.default.tmpdir(), `wrangler-generate-repo-`)
|
189748
189794
|
);
|
189749
189795
|
args.push(tempDir);
|
189750
189796
|
await execa("git", args);
|
@@ -189753,7 +189799,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
189753
189799
|
cwd: tempDir
|
189754
189800
|
});
|
189755
189801
|
}
|
189756
|
-
const templatePath = subdirectory !== void 0 ?
|
189802
|
+
const templatePath = subdirectory !== void 0 ? import_node_path41.default.join(tempDir, subdirectory) : tempDir;
|
189757
189803
|
try {
|
189758
189804
|
import_node_fs24.default.renameSync(templatePath, targetDirectory);
|
189759
189805
|
} catch (err) {
|
@@ -189772,7 +189818,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
189772
189818
|
throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
|
189773
189819
|
}
|
189774
189820
|
}
|
189775
|
-
import_node_fs24.default.rmSync(
|
189821
|
+
import_node_fs24.default.rmSync(import_node_path41.default.join(targetDirectory, ".git"), {
|
189776
189822
|
recursive: true,
|
189777
189823
|
force: true
|
189778
189824
|
});
|
@@ -189782,7 +189828,7 @@ __name(cloneIntoDirectory, "cloneIntoDirectory");
|
|
189782
189828
|
// src/package-manager.ts
|
189783
189829
|
init_import_meta_url();
|
189784
189830
|
var import_node_fs25 = require("node:fs");
|
189785
|
-
var
|
189831
|
+
var import_node_path42 = require("node:path");
|
189786
189832
|
var import_node_process11 = require("node:process");
|
189787
189833
|
init_execa();
|
189788
189834
|
async function getPackageManager2(cwd2) {
|
@@ -189791,9 +189837,9 @@ async function getPackageManager2(cwd2) {
|
|
189791
189837
|
supportsNpm(),
|
189792
189838
|
supportsPnpm()
|
189793
189839
|
]);
|
189794
|
-
const hasYarnLock = (0, import_node_fs25.existsSync)((0,
|
189795
|
-
const hasNpmLock = (0, import_node_fs25.existsSync)((0,
|
189796
|
-
const hasPnpmLock = (0, import_node_fs25.existsSync)((0,
|
189840
|
+
const hasYarnLock = (0, import_node_fs25.existsSync)((0, import_node_path42.join)(cwd2, "yarn.lock"));
|
189841
|
+
const hasNpmLock = (0, import_node_fs25.existsSync)((0, import_node_path42.join)(cwd2, "package-lock.json"));
|
189842
|
+
const hasPnpmLock = (0, import_node_fs25.existsSync)((0, import_node_path42.join)(cwd2, "pnpm-lock.yaml"));
|
189797
189843
|
const userAgent = sniffUserAgent();
|
189798
189844
|
if (hasNpmLock) {
|
189799
189845
|
if (hasNpm) {
|
@@ -190035,15 +190081,15 @@ async function initHandler(args) {
|
|
190035
190081
|
const instructions = [];
|
190036
190082
|
let shouldRunPackageManagerInstall = false;
|
190037
190083
|
const fromDashWorkerName = args.fromDash;
|
190038
|
-
const creationDirectory =
|
190084
|
+
const creationDirectory = import_node_path43.default.resolve(
|
190039
190085
|
process.cwd(),
|
190040
190086
|
(args.name ? args.name : fromDashWorkerName) ?? ""
|
190041
190087
|
);
|
190042
190088
|
assertNoTypeArg(args);
|
190043
190089
|
assertNoSiteArg(args, creationDirectory);
|
190044
|
-
const workerName =
|
190090
|
+
const workerName = import_node_path43.default.basename(creationDirectory).toLowerCase().replaceAll(/[^a-z0-9\-_]/gm, "-");
|
190045
190091
|
const packageManager = await getPackageManager2(creationDirectory);
|
190046
|
-
const wranglerTomlDestination =
|
190092
|
+
const wranglerTomlDestination = import_node_path43.default.join(
|
190047
190093
|
creationDirectory,
|
190048
190094
|
"./wrangler.toml"
|
190049
190095
|
);
|
@@ -190093,7 +190139,7 @@ The \`init\` command will be removed in a future version.`
|
|
190093
190139
|
if (fs20.existsSync(wranglerTomlDestination)) {
|
190094
190140
|
let shouldContinue = false;
|
190095
190141
|
logger.warn(
|
190096
|
-
`${
|
190142
|
+
`${import_node_path43.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
|
190097
190143
|
);
|
190098
190144
|
if (!fromDashWorkerName) {
|
190099
190145
|
shouldContinue = await confirm(
|
@@ -190145,12 +190191,12 @@ The \`init\` command will be removed in a future version.`
|
|
190145
190191
|
}) + "\n"
|
190146
190192
|
);
|
190147
190193
|
logger.log(
|
190148
|
-
`\u2728 Created ${
|
190194
|
+
`\u2728 Created ${import_node_path43.default.relative(process.cwd(), wranglerTomlDestination)}`
|
190149
190195
|
);
|
190150
190196
|
justCreatedWranglerToml = true;
|
190151
190197
|
} catch (err) {
|
190152
190198
|
throw new Error(
|
190153
|
-
`Failed to create ${
|
190199
|
+
`Failed to create ${import_node_path43.default.relative(
|
190154
190200
|
process.cwd(),
|
190155
190201
|
wranglerTomlDestination
|
190156
190202
|
)}.
|
@@ -190163,11 +190209,11 @@ ${err.message ?? err}`
|
|
190163
190209
|
if (shouldInitGit) {
|
190164
190210
|
await initializeGit(creationDirectory);
|
190165
190211
|
await (0, import_promises16.writeFile)(
|
190166
|
-
|
190167
|
-
readFileSync5(
|
190212
|
+
import_node_path43.default.join(creationDirectory, ".gitignore"),
|
190213
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), "templates/gitignore"))
|
190168
190214
|
);
|
190169
190215
|
logger.log(
|
190170
|
-
args.name && args.name !== "." ? `\u2728 Initialized git repository at ${
|
190216
|
+
args.name && args.name !== "." ? `\u2728 Initialized git repository at ${import_node_path43.default.relative(
|
190171
190217
|
process.cwd(),
|
190172
190218
|
creationDirectory
|
190173
190219
|
)}` : `\u2728 Initialized git repository`
|
@@ -190187,7 +190233,7 @@ ${err.message ?? err}`
|
|
190187
190233
|
shouldCreatePackageJson = yesFlag || await confirm("No package.json found. Would you like to create one?");
|
190188
190234
|
if (shouldCreatePackageJson) {
|
190189
190235
|
await (0, import_promises16.writeFile)(
|
190190
|
-
|
190236
|
+
import_node_path43.default.join(creationDirectory, "./package.json"),
|
190191
190237
|
JSON.stringify(
|
190192
190238
|
{
|
190193
190239
|
name: workerName,
|
@@ -190202,9 +190248,9 @@ ${err.message ?? err}`
|
|
190202
190248
|
) + "\n"
|
190203
190249
|
);
|
190204
190250
|
shouldRunPackageManagerInstall = true;
|
190205
|
-
pathToPackageJson =
|
190251
|
+
pathToPackageJson = import_node_path43.default.join(creationDirectory, "package.json");
|
190206
190252
|
logger.log(
|
190207
|
-
`\u2728 Created ${
|
190253
|
+
`\u2728 Created ${import_node_path43.default.relative(process.cwd(), pathToPackageJson)}`
|
190208
190254
|
);
|
190209
190255
|
} else {
|
190210
190256
|
return;
|
@@ -190216,7 +190262,7 @@ ${err.message ?? err}`
|
|
190216
190262
|
);
|
190217
190263
|
if (!(packageJson.devDependencies?.wrangler || packageJson.dependencies?.wrangler)) {
|
190218
190264
|
const shouldInstall = yesFlag || await confirm(
|
190219
|
-
`Would you like to install wrangler into ${
|
190265
|
+
`Would you like to install wrangler into ${import_node_path43.default.relative(
|
190220
190266
|
process.cwd(),
|
190221
190267
|
pathToPackageJson
|
190222
190268
|
)}?`
|
@@ -190237,14 +190283,14 @@ ${err.message ?? err}`
|
|
190237
190283
|
if (yesFlag || await confirm("Would you like to use TypeScript?")) {
|
190238
190284
|
isTypescriptProject = true;
|
190239
190285
|
await (0, import_promises16.writeFile)(
|
190240
|
-
|
190241
|
-
readFileSync5(
|
190286
|
+
import_node_path43.default.join(creationDirectory, "./tsconfig.json"),
|
190287
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), "templates/tsconfig.init.json"))
|
190242
190288
|
);
|
190243
190289
|
devDepsToInstall.push("@cloudflare/workers-types");
|
190244
190290
|
devDepsToInstall.push("typescript");
|
190245
|
-
pathToTSConfig =
|
190291
|
+
pathToTSConfig = import_node_path43.default.join(creationDirectory, "tsconfig.json");
|
190246
190292
|
logger.log(
|
190247
|
-
`\u2728 Created ${
|
190293
|
+
`\u2728 Created ${import_node_path43.default.relative(process.cwd(), pathToTSConfig)}`
|
190248
190294
|
);
|
190249
190295
|
}
|
190250
190296
|
} else {
|
@@ -190260,7 +190306,7 @@ ${err.message ?? err}`
|
|
190260
190306
|
if (shouldInstall) {
|
190261
190307
|
devDepsToInstall.push("@cloudflare/workers-types");
|
190262
190308
|
instructions.push(
|
190263
|
-
`\u{1F6A8} Please add "@cloudflare/workers-types" to compilerOptions.types in ${
|
190309
|
+
`\u{1F6A8} Please add "@cloudflare/workers-types" to compilerOptions.types in ${import_node_path43.default.relative(
|
190264
190310
|
process.cwd(),
|
190265
190311
|
pathToTSConfig
|
190266
190312
|
)}`
|
@@ -190298,7 +190344,7 @@ ${err.message ?? err}`
|
|
190298
190344
|
};
|
190299
190345
|
fs20.writeFileSync(wranglerTomlDestination, import_toml4.default.stringify(newToml));
|
190300
190346
|
}
|
190301
|
-
const isNamedWorker = isCreatingWranglerToml &&
|
190347
|
+
const isNamedWorker = isCreatingWranglerToml && import_node_path43.default.dirname(packagePath) !== process.cwd();
|
190302
190348
|
const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
|
190303
190349
|
if (isWritingScripts) {
|
190304
190350
|
await (0, import_promises16.writeFile)(
|
@@ -190339,25 +190385,25 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190339
190385
|
}
|
190340
190386
|
__name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
|
190341
190387
|
if (isTypescriptProject) {
|
190342
|
-
if (!fs20.existsSync(
|
190343
|
-
const newWorkerFilename =
|
190388
|
+
if (!fs20.existsSync(import_node_path43.default.join(creationDirectory, "./src/index.ts"))) {
|
190389
|
+
const newWorkerFilename = import_node_path43.default.relative(
|
190344
190390
|
process.cwd(),
|
190345
|
-
|
190391
|
+
import_node_path43.default.join(creationDirectory, "./src/index.ts")
|
190346
190392
|
);
|
190347
190393
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
190348
190394
|
if (newWorkerType !== "none") {
|
190349
190395
|
const template = getNewWorkerTemplate("ts", newWorkerType);
|
190350
|
-
await (0, import_promises16.mkdir)(
|
190396
|
+
await (0, import_promises16.mkdir)(import_node_path43.default.join(creationDirectory, "./src"), {
|
190351
190397
|
recursive: true
|
190352
190398
|
});
|
190353
190399
|
await (0, import_promises16.writeFile)(
|
190354
|
-
|
190355
|
-
readFileSync5(
|
190400
|
+
import_node_path43.default.join(creationDirectory, "./src/index.ts"),
|
190401
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), `templates/${template}`))
|
190356
190402
|
);
|
190357
190403
|
logger.log(
|
190358
|
-
`\u2728 Created ${
|
190404
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190359
190405
|
process.cwd(),
|
190360
|
-
|
190406
|
+
import_node_path43.default.join(creationDirectory, "./src/index.ts")
|
190361
190407
|
)}`
|
190362
190408
|
);
|
190363
190409
|
shouldCreateTests = yesFlag || await confirm(
|
@@ -190370,18 +190416,18 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190370
190416
|
newWorkerTestType = "vitest";
|
190371
190417
|
devDepsToInstall.push(newWorkerTestType);
|
190372
190418
|
await (0, import_promises16.writeFile)(
|
190373
|
-
|
190419
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.ts"),
|
190374
190420
|
readFileSync5(
|
190375
|
-
|
190421
|
+
import_node_path43.default.join(
|
190376
190422
|
getBasePath(),
|
190377
190423
|
`templates/init-tests/test-${newWorkerTestType}-new-worker.ts`
|
190378
190424
|
)
|
190379
190425
|
)
|
190380
190426
|
);
|
190381
190427
|
logger.log(
|
190382
|
-
`\u2728 Created ${
|
190428
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190383
190429
|
process.cwd(),
|
190384
|
-
|
190430
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.ts")
|
190385
190431
|
)}`
|
190386
190432
|
);
|
190387
190433
|
}
|
@@ -190397,10 +190443,10 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190397
190443
|
}
|
190398
190444
|
}
|
190399
190445
|
} else {
|
190400
|
-
if (!fs20.existsSync(
|
190401
|
-
const newWorkerFilename =
|
190446
|
+
if (!fs20.existsSync(import_node_path43.default.join(creationDirectory, "./src/index.js"))) {
|
190447
|
+
const newWorkerFilename = import_node_path43.default.relative(
|
190402
190448
|
process.cwd(),
|
190403
|
-
|
190449
|
+
import_node_path43.default.join(creationDirectory, "./src/index.js")
|
190404
190450
|
);
|
190405
190451
|
if (fromDashWorkerName) {
|
190406
190452
|
logger.warn(
|
@@ -190410,7 +190456,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190410
190456
|
accountId,
|
190411
190457
|
fromDashWorkerName
|
190412
190458
|
);
|
190413
|
-
await (0, import_promises16.mkdir)(
|
190459
|
+
await (0, import_promises16.mkdir)(import_node_path43.default.join(creationDirectory, "./src"), {
|
190414
190460
|
recursive: true
|
190415
190461
|
});
|
190416
190462
|
config.main = `src/${config.main}`;
|
@@ -190418,11 +190464,11 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190418
190464
|
for (const files of createBatches(modules, 10)) {
|
190419
190465
|
await Promise.all(
|
190420
190466
|
files.map(async (file) => {
|
190421
|
-
const filepath =
|
190467
|
+
const filepath = import_node_path43.default.join(
|
190422
190468
|
creationDirectory,
|
190423
190469
|
`./src/${file.name}`
|
190424
190470
|
);
|
190425
|
-
const directory = (0,
|
190471
|
+
const directory = (0, import_node_path43.dirname)(filepath);
|
190426
190472
|
await (0, import_promises16.mkdir)(directory, { recursive: true });
|
190427
190473
|
await (0, import_promises16.writeFile)(filepath, file.stream());
|
190428
190474
|
})
|
@@ -190440,17 +190486,17 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190440
190486
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
190441
190487
|
if (newWorkerType !== "none") {
|
190442
190488
|
const template = getNewWorkerTemplate("js", newWorkerType);
|
190443
|
-
await (0, import_promises16.mkdir)(
|
190489
|
+
await (0, import_promises16.mkdir)(import_node_path43.default.join(creationDirectory, "./src"), {
|
190444
190490
|
recursive: true
|
190445
190491
|
});
|
190446
190492
|
await (0, import_promises16.writeFile)(
|
190447
|
-
|
190448
|
-
readFileSync5(
|
190493
|
+
import_node_path43.default.join(creationDirectory, "./src/index.js"),
|
190494
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), `templates/${template}`))
|
190449
190495
|
);
|
190450
190496
|
logger.log(
|
190451
|
-
`\u2728 Created ${
|
190497
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190452
190498
|
process.cwd(),
|
190453
|
-
|
190499
|
+
import_node_path43.default.join(creationDirectory, "./src/index.js")
|
190454
190500
|
)}`
|
190455
190501
|
);
|
190456
190502
|
shouldCreateTests = yesFlag || await confirm("Would you like us to write your first test?");
|
@@ -190458,18 +190504,18 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190458
190504
|
newWorkerTestType = await getNewWorkerTestType(yesFlag);
|
190459
190505
|
devDepsToInstall.push(newWorkerTestType);
|
190460
190506
|
await (0, import_promises16.writeFile)(
|
190461
|
-
|
190507
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.js"),
|
190462
190508
|
readFileSync5(
|
190463
|
-
|
190509
|
+
import_node_path43.default.join(
|
190464
190510
|
getBasePath(),
|
190465
190511
|
`templates/init-tests/test-${newWorkerTestType}-new-worker.js`
|
190466
190512
|
)
|
190467
190513
|
)
|
190468
190514
|
);
|
190469
190515
|
logger.log(
|
190470
|
-
`\u2728 Created ${
|
190516
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190471
190517
|
process.cwd(),
|
190472
|
-
|
190518
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.js")
|
190473
190519
|
)}`
|
190474
190520
|
);
|
190475
190521
|
}
|
@@ -190582,7 +190628,7 @@ function getNewWorkerToml(workerType) {
|
|
190582
190628
|
__name(getNewWorkerToml, "getNewWorkerToml");
|
190583
190629
|
async function findPath(isolatedInit, cwd2, basename5) {
|
190584
190630
|
if (isolatedInit) {
|
190585
|
-
return fs20.existsSync(
|
190631
|
+
return fs20.existsSync(import_node_path43.default.resolve(cwd2, basename5)) ? import_node_path43.default.resolve(cwd2, basename5) : void 0;
|
190586
190632
|
} else {
|
190587
190633
|
return await findUp(basename5, {
|
190588
190634
|
cwd: cwd2
|
@@ -190827,14 +190873,90 @@ async function mapBindings(accountId, bindings) {
|
|
190827
190873
|
};
|
190828
190874
|
}
|
190829
190875
|
break;
|
190830
|
-
|
190831
|
-
|
190832
|
-
|
190876
|
+
case "secret_text":
|
190877
|
+
break;
|
190878
|
+
case "version_metadata": {
|
190879
|
+
{
|
190880
|
+
configObj.version_metadata = {
|
190881
|
+
binding: binding.name
|
190882
|
+
};
|
190833
190883
|
}
|
190884
|
+
break;
|
190885
|
+
}
|
190886
|
+
case "send_email": {
|
190887
|
+
configObj.send_email = [
|
190888
|
+
...configObj.send_email ?? [],
|
190889
|
+
{
|
190890
|
+
name: binding.name,
|
190891
|
+
destination_address: binding.destination_address,
|
190892
|
+
allowed_destination_addresses: binding.allowed_destination_addresses
|
190893
|
+
}
|
190894
|
+
];
|
190895
|
+
break;
|
190896
|
+
}
|
190897
|
+
case "queue":
|
190898
|
+
configObj.queues ??= { producers: [] };
|
190899
|
+
configObj.queues.producers = [
|
190900
|
+
...configObj.queues.producers ?? [],
|
190901
|
+
{
|
190902
|
+
binding: binding.name,
|
190903
|
+
queue: binding.queue_name,
|
190904
|
+
delivery_delay: binding.delivery_delay
|
190905
|
+
}
|
190906
|
+
];
|
190907
|
+
break;
|
190908
|
+
case "vectorize":
|
190909
|
+
configObj.vectorize = [
|
190910
|
+
...configObj.vectorize ?? [],
|
190911
|
+
{
|
190912
|
+
binding: binding.name,
|
190913
|
+
index_name: binding.index_name
|
190914
|
+
}
|
190915
|
+
];
|
190916
|
+
break;
|
190917
|
+
case "hyperdrive":
|
190918
|
+
configObj.hyperdrive = [
|
190919
|
+
...configObj.hyperdrive ?? [],
|
190920
|
+
{
|
190921
|
+
binding: binding.name,
|
190922
|
+
id: binding.id
|
190923
|
+
}
|
190924
|
+
];
|
190925
|
+
break;
|
190926
|
+
case "mtls_certificate":
|
190927
|
+
configObj.mtls_certificates = [
|
190928
|
+
...configObj.mtls_certificates ?? [],
|
190929
|
+
{
|
190930
|
+
binding: binding.name,
|
190931
|
+
certificate_id: binding.certificate_id
|
190932
|
+
}
|
190933
|
+
];
|
190934
|
+
break;
|
190935
|
+
case "pipelines":
|
190936
|
+
configObj.pipelines = [
|
190937
|
+
...configObj.pipelines ?? [],
|
190938
|
+
{
|
190939
|
+
binding: binding.name,
|
190940
|
+
pipeline: binding.id
|
190941
|
+
}
|
190942
|
+
];
|
190943
|
+
break;
|
190944
|
+
case "assets":
|
190945
|
+
throw new FatalError(
|
190946
|
+
"`wrangler init --from-dash` is not yet supported for Workers with Assets"
|
190947
|
+
);
|
190948
|
+
case "inherit":
|
190949
|
+
configObj.unsafe = {
|
190950
|
+
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
190951
|
+
metadata: configObj.unsafe?.metadata ?? void 0
|
190952
|
+
};
|
190953
|
+
break;
|
190954
|
+
default: {
|
190834
190955
|
configObj.unsafe = {
|
190835
190956
|
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
190836
190957
|
metadata: configObj.unsafe?.metadata ?? void 0
|
190837
190958
|
};
|
190959
|
+
assertNever(binding);
|
190838
190960
|
}
|
190839
190961
|
}
|
190840
190962
|
return configObj;
|
@@ -190853,7 +190975,7 @@ function assertNoTypeArg(args) {
|
|
190853
190975
|
__name(assertNoTypeArg, "assertNoTypeArg");
|
190854
190976
|
function assertNoSiteArg(args, creationDirectory) {
|
190855
190977
|
if (args.site) {
|
190856
|
-
const gitDirectory = creationDirectory !== process.cwd() ?
|
190978
|
+
const gitDirectory = creationDirectory !== process.cwd() ? import_node_path43.default.basename(creationDirectory) : "my-site";
|
190857
190979
|
const message = `The --site option is no longer supported.
|
190858
190980
|
If you wish to create a brand new Worker Sites project then clone the \`worker-sites-template\` starter repository:
|
190859
190981
|
|
@@ -191488,7 +191610,7 @@ __name(docsHandler, "docsHandler");
|
|
191488
191610
|
// src/generate/index.ts
|
191489
191611
|
init_import_meta_url();
|
191490
191612
|
var import_node_fs26 = __toESM(require("node:fs"));
|
191491
|
-
var
|
191613
|
+
var import_node_path44 = __toESM(require("node:path"));
|
191492
191614
|
init_execa();
|
191493
191615
|
function generateOptions(yargs) {
|
191494
191616
|
return yargs.positional("name", {
|
@@ -191548,7 +191670,7 @@ Please refer to https://developers.cloudflare.com/workers/wrangler/deprecations/
|
|
191548
191670
|
}
|
191549
191671
|
const creationDirectory = generateWorkerDirectoryName(args.name);
|
191550
191672
|
if (args.site) {
|
191551
|
-
const gitDirectory = creationDirectory !== process.cwd() ?
|
191673
|
+
const gitDirectory = creationDirectory !== process.cwd() ? import_node_path44.default.basename(creationDirectory) : "my-site";
|
191552
191674
|
const message = `The --site option is no longer supported.
|
191553
191675
|
If you wish to create a brand new Worker Sites project then clone the \`worker-sites-template\` starter repository:
|
191554
191676
|
|
@@ -191580,7 +191702,7 @@ Running \`npm create cloudflare@latest\` for you instead.
|
|
191580
191702
|
return;
|
191581
191703
|
}
|
191582
191704
|
logger.log(
|
191583
|
-
`Creating a worker in ${
|
191705
|
+
`Creating a worker in ${import_node_path44.default.basename(creationDirectory)} from ${args.template}`
|
191584
191706
|
);
|
191585
191707
|
const { remote, subdirectory } = parseTemplatePath(args.template);
|
191586
191708
|
await cloneIntoDirectory(remote, creationDirectory, subdirectory);
|
@@ -191589,10 +191711,10 @@ Running \`npm create cloudflare@latest\` for you instead.
|
|
191589
191711
|
}
|
191590
191712
|
__name(generateHandler2, "generateHandler");
|
191591
191713
|
function generateWorkerDirectoryName(workerName) {
|
191592
|
-
let workerDirectoryPath =
|
191714
|
+
let workerDirectoryPath = import_node_path44.default.resolve(process.cwd(), workerName);
|
191593
191715
|
let i = 1;
|
191594
191716
|
while (import_node_fs26.default.existsSync(workerDirectoryPath)) {
|
191595
|
-
workerDirectoryPath =
|
191717
|
+
workerDirectoryPath = import_node_path44.default.resolve(process.cwd(), `${workerName}-${i}`);
|
191596
191718
|
i++;
|
191597
191719
|
}
|
191598
191720
|
return workerDirectoryPath;
|
@@ -192887,12 +193009,12 @@ init_import_meta_url();
|
|
192887
193009
|
var import_node_crypto7 = require("node:crypto");
|
192888
193010
|
var import_node_fs29 = require("node:fs");
|
192889
193011
|
var import_promises21 = require("node:fs/promises");
|
192890
|
-
var
|
193012
|
+
var import_node_path53 = __toESM(require("node:path"));
|
192891
193013
|
|
192892
193014
|
// src/api/pages/create-worker-bundle-contents.ts
|
192893
193015
|
init_import_meta_url();
|
192894
193016
|
var import_node_fs27 = require("node:fs");
|
192895
|
-
var
|
193017
|
+
var import_node_path45 = __toESM(require("node:path"));
|
192896
193018
|
var import_undici18 = __toESM(require_undici());
|
192897
193019
|
async function createUploadWorkerBundleContents(workerBundle, config) {
|
192898
193020
|
const workerBundleFormData = createWorkerBundleFormData(workerBundle, config);
|
@@ -192906,7 +193028,7 @@ async function createUploadWorkerBundleContents(workerBundle, config) {
|
|
192906
193028
|
__name(createUploadWorkerBundleContents, "createUploadWorkerBundleContents");
|
192907
193029
|
function createWorkerBundleFormData(workerBundle, config) {
|
192908
193030
|
const mainModule = {
|
192909
|
-
name:
|
193031
|
+
name: import_node_path45.default.basename(workerBundle.resolvedEntryPointPath),
|
192910
193032
|
filePath: workerBundle.resolvedEntryPointPath,
|
192911
193033
|
content: (0, import_node_fs27.readFileSync)(workerBundle.resolvedEntryPointPath, {
|
192912
193034
|
encoding: "utf-8"
|
@@ -192967,16 +193089,16 @@ __name(createWorkerBundleFormData, "createWorkerBundleFormData");
|
|
192967
193089
|
// src/pages/buildFunctions.ts
|
192968
193090
|
init_import_meta_url();
|
192969
193091
|
var import_node_fs28 = require("node:fs");
|
192970
|
-
var
|
193092
|
+
var import_node_path52 = require("node:path");
|
192971
193093
|
|
192972
193094
|
// src/pages/functions/buildPlugin.ts
|
192973
193095
|
init_import_meta_url();
|
192974
193096
|
var import_promises18 = require("node:fs/promises");
|
192975
|
-
var
|
193097
|
+
var import_node_path48 = require("node:path");
|
192976
193098
|
|
192977
193099
|
// src/pages/utils.ts
|
192978
193100
|
init_import_meta_url();
|
192979
|
-
var
|
193101
|
+
var import_node_path46 = __toESM(require("node:path"));
|
192980
193102
|
var RUNNING_BUILDERS = [];
|
192981
193103
|
var CLEANUP_CALLBACKS = [];
|
192982
193104
|
var CLEANUP = /* @__PURE__ */ __name(() => {
|
@@ -193005,7 +193127,7 @@ function getPagesProjectRoot() {
|
|
193005
193127
|
return projectRootCache;
|
193006
193128
|
}
|
193007
193129
|
const packagePath = findUpSync("package.json");
|
193008
|
-
projectRootCache = packagePath ?
|
193130
|
+
projectRootCache = packagePath ? import_node_path46.default.dirname(packagePath) : process.cwd();
|
193009
193131
|
projectRootCacheCwd = cwd2;
|
193010
193132
|
return projectRootCache;
|
193011
193133
|
}
|
@@ -193037,7 +193159,7 @@ __name(debounce, "debounce");
|
|
193037
193159
|
// src/pages/functions/buildWorker.ts
|
193038
193160
|
init_import_meta_url();
|
193039
193161
|
var import_promises17 = require("node:fs/promises");
|
193040
|
-
var
|
193162
|
+
var import_node_path47 = require("node:path");
|
193041
193163
|
var import_esbuild3 = require("esbuild");
|
193042
193164
|
|
193043
193165
|
// ../../node_modules/.pnpm/nanoid@3.3.6/node_modules/nanoid/index.js
|
@@ -193075,7 +193197,7 @@ var nanoid = /* @__PURE__ */ __name((size = 21) => {
|
|
193075
193197
|
// src/pages/functions/buildWorker.ts
|
193076
193198
|
function buildWorkerFromFunctions({
|
193077
193199
|
routesModule,
|
193078
|
-
outfile = (0,
|
193200
|
+
outfile = (0, import_node_path47.join)(getPagesTmpDir(), `./functionsWorker-${Math.random()}.js`),
|
193079
193201
|
outdir,
|
193080
193202
|
minify = false,
|
193081
193203
|
sourcemap = false,
|
@@ -193091,7 +193213,7 @@ function buildWorkerFromFunctions({
|
|
193091
193213
|
external
|
193092
193214
|
}) {
|
193093
193215
|
const entry = {
|
193094
|
-
file: (0,
|
193216
|
+
file: (0, import_node_path47.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
|
193095
193217
|
directory: functionsDirectory,
|
193096
193218
|
format: "modules",
|
193097
193219
|
moduleRoot: functionsDirectory
|
@@ -193100,7 +193222,7 @@ function buildWorkerFromFunctions({
|
|
193100
193222
|
entry,
|
193101
193223
|
findAdditionalModules: false
|
193102
193224
|
});
|
193103
|
-
return bundleWorker(entry, outdir ? (0,
|
193225
|
+
return bundleWorker(entry, outdir ? (0, import_node_path47.resolve)(outdir) : (0, import_node_path47.resolve)(outfile), {
|
193104
193226
|
bundle: true,
|
193105
193227
|
additionalModules: [],
|
193106
193228
|
moduleCollector,
|
@@ -193133,7 +193255,7 @@ function buildWorkerFromFunctions({
|
|
193133
193255
|
__name(buildWorkerFromFunctions, "buildWorkerFromFunctions");
|
193134
193256
|
function buildRawWorker({
|
193135
193257
|
workerScriptPath,
|
193136
|
-
outfile = (0,
|
193258
|
+
outfile = (0, import_node_path47.join)(getPagesTmpDir(), `./functionsWorker-${Math.random()}.js`),
|
193137
193259
|
outdir,
|
193138
193260
|
directory,
|
193139
193261
|
bundle = true,
|
@@ -193152,12 +193274,12 @@ function buildRawWorker({
|
|
193152
193274
|
}) {
|
193153
193275
|
const entry = {
|
193154
193276
|
file: workerScriptPath,
|
193155
|
-
directory: (0,
|
193277
|
+
directory: (0, import_node_path47.resolve)(directory),
|
193156
193278
|
format: "modules",
|
193157
|
-
moduleRoot: (0,
|
193279
|
+
moduleRoot: (0, import_node_path47.resolve)(directory)
|
193158
193280
|
};
|
193159
193281
|
const moduleCollector = externalModules ? noopModuleCollector : createModuleCollector({ entry, findAdditionalModules: false });
|
193160
|
-
return bundleWorker(entry, outdir ? (0,
|
193282
|
+
return bundleWorker(entry, outdir ? (0, import_node_path47.resolve)(outdir) : (0, import_node_path47.resolve)(outfile), {
|
193161
193283
|
bundle,
|
193162
193284
|
moduleCollector,
|
193163
193285
|
additionalModules,
|
@@ -193183,7 +193305,7 @@ function buildRawWorker({
|
|
193183
193305
|
setup(pluginBuild) {
|
193184
193306
|
pluginBuild.onResolve({ filter: /.*/ }, async (args) => {
|
193185
193307
|
if (externalModules.includes(
|
193186
|
-
(0,
|
193308
|
+
(0, import_node_path47.resolve)(args.resolveDir, args.path)
|
193187
193309
|
)) {
|
193188
193310
|
return { path: args.path, external: true };
|
193189
193311
|
}
|
@@ -193211,13 +193333,13 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
193211
193333
|
defineNavigatorUserAgent,
|
193212
193334
|
sourceMaps
|
193213
193335
|
}) {
|
193214
|
-
const entrypoint = (0,
|
193336
|
+
const entrypoint = (0, import_node_path47.resolve)((0, import_node_path47.join)(workerJSDirectory, "index.js"));
|
193215
193337
|
const additionalModules = await findAdditionalModules(
|
193216
193338
|
{
|
193217
193339
|
file: entrypoint,
|
193218
|
-
directory: (0,
|
193340
|
+
directory: (0, import_node_path47.resolve)(workerJSDirectory),
|
193219
193341
|
format: "modules",
|
193220
|
-
moduleRoot: (0,
|
193342
|
+
moduleRoot: (0, import_node_path47.resolve)(workerJSDirectory)
|
193221
193343
|
},
|
193222
193344
|
[
|
193223
193345
|
{
|
@@ -193238,7 +193360,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
193238
193360
|
sourceMapPath: void 0
|
193239
193361
|
};
|
193240
193362
|
}
|
193241
|
-
const outfile = (0,
|
193363
|
+
const outfile = (0, import_node_path47.join)(
|
193242
193364
|
getPagesTmpDir(),
|
193243
193365
|
`./bundledWorker-${Math.random()}.mjs`
|
193244
193366
|
);
|
@@ -193246,7 +193368,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
193246
193368
|
workerScriptPath: entrypoint,
|
193247
193369
|
bundle: true,
|
193248
193370
|
externalModules: additionalModules.map(
|
193249
|
-
(m2) => (0,
|
193371
|
+
(m2) => (0, import_node_path47.join)(workerJSDirectory, m2.name)
|
193250
193372
|
),
|
193251
193373
|
outfile,
|
193252
193374
|
directory: buildOutputDirectory,
|
@@ -193330,7 +193452,7 @@ function assetsPlugin(buildOutputDirectory) {
|
|
193330
193452
|
setup(pluginBuild) {
|
193331
193453
|
const identifiers = /* @__PURE__ */ new Map();
|
193332
193454
|
pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
|
193333
|
-
const directory = (0,
|
193455
|
+
const directory = (0, import_node_path47.resolve)(
|
193334
193456
|
args.resolveDir,
|
193335
193457
|
args.path.slice("assets:".length)
|
193336
193458
|
);
|
@@ -193358,7 +193480,7 @@ function assetsPlugin(buildOutputDirectory) {
|
|
193358
193480
|
async (args) => {
|
193359
193481
|
const identifier = identifiers.get(args.path);
|
193360
193482
|
if (buildOutputDirectory) {
|
193361
|
-
const staticAssetsOutputDirectory = (0,
|
193483
|
+
const staticAssetsOutputDirectory = (0, import_node_path47.join)(
|
193362
193484
|
buildOutputDirectory,
|
193363
193485
|
"cdn-cgi",
|
193364
193486
|
"pages-plugins",
|
@@ -193406,7 +193528,7 @@ function buildPluginFromFunctions({
|
|
193406
193528
|
external
|
193407
193529
|
}) {
|
193408
193530
|
const entry = {
|
193409
|
-
file: (0,
|
193531
|
+
file: (0, import_node_path48.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
|
193410
193532
|
directory: functionsDirectory,
|
193411
193533
|
format: "modules",
|
193412
193534
|
moduleRoot: functionsDirectory
|
@@ -193415,7 +193537,7 @@ function buildPluginFromFunctions({
|
|
193415
193537
|
entry,
|
193416
193538
|
findAdditionalModules: false
|
193417
193539
|
});
|
193418
|
-
return bundleWorker(entry, (0,
|
193540
|
+
return bundleWorker(entry, (0, import_node_path48.resolve)(outdir), {
|
193419
193541
|
bundle: true,
|
193420
193542
|
additionalModules: [],
|
193421
193543
|
moduleCollector,
|
@@ -193439,7 +193561,7 @@ function buildPluginFromFunctions({
|
|
193439
193561
|
name: "Assets",
|
193440
193562
|
setup(pluginBuild) {
|
193441
193563
|
pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
|
193442
|
-
const directory = (0,
|
193564
|
+
const directory = (0, import_node_path48.resolve)(
|
193443
193565
|
args.resolveDir,
|
193444
193566
|
args.path.slice("assets:".length)
|
193445
193567
|
);
|
@@ -193454,7 +193576,7 @@ function buildPluginFromFunctions({
|
|
193454
193576
|
]
|
193455
193577
|
};
|
193456
193578
|
}
|
193457
|
-
const path74 = `assets:./${(0,
|
193579
|
+
const path74 = `assets:./${(0, import_node_path48.relative)(outdir, directory)}`;
|
193458
193580
|
return { path: path74, external: true, namespace: "assets" };
|
193459
193581
|
});
|
193460
193582
|
}
|
@@ -193467,9 +193589,9 @@ function buildPluginFromFunctions({
|
|
193467
193589
|
pluginBuild.onResolve({ filter: /.*\.(wasm|bin)$/ }, async (args) => {
|
193468
193590
|
return {
|
193469
193591
|
external: true,
|
193470
|
-
path: `./${(0,
|
193592
|
+
path: `./${(0, import_node_path48.relative)(
|
193471
193593
|
outdir,
|
193472
|
-
(0,
|
193594
|
+
(0, import_node_path48.resolve)(args.resolveDir, args.path)
|
193473
193595
|
)}`
|
193474
193596
|
};
|
193475
193597
|
});
|
@@ -193492,7 +193614,7 @@ __name(buildPluginFromFunctions, "buildPluginFromFunctions");
|
|
193492
193614
|
// src/pages/functions/filepath-routing.ts
|
193493
193615
|
init_import_meta_url();
|
193494
193616
|
var import_promises19 = __toESM(require("node:fs/promises"));
|
193495
|
-
var
|
193617
|
+
var import_node_path49 = __toESM(require("node:path"));
|
193496
193618
|
var import_esbuild4 = require("esbuild");
|
193497
193619
|
async function generateConfigFromFileTree({
|
193498
193620
|
baseDir,
|
@@ -193506,13 +193628,13 @@ async function generateConfigFromFileTree({
|
|
193506
193628
|
baseURL = baseURL.slice(0, -1);
|
193507
193629
|
}
|
193508
193630
|
await forEachFile(baseDir, async (filepath) => {
|
193509
|
-
const ext =
|
193631
|
+
const ext = import_node_path49.default.extname(filepath);
|
193510
193632
|
if (/^\.(mjs|js|ts|tsx|jsx)$/.test(ext)) {
|
193511
193633
|
const { metafile } = await (0, import_esbuild4.build)({
|
193512
193634
|
metafile: true,
|
193513
193635
|
write: false,
|
193514
193636
|
bundle: false,
|
193515
|
-
entryPoints: [
|
193637
|
+
entryPoints: [import_node_path49.default.resolve(filepath)]
|
193516
193638
|
}).catch((e3) => {
|
193517
193639
|
throw new FunctionsBuildError(e3.message);
|
193518
193640
|
});
|
@@ -193527,13 +193649,13 @@ async function generateConfigFromFileTree({
|
|
193527
193649
|
/^onRequest(Get|Post|Put|Patch|Delete|Options|Head)?$/
|
193528
193650
|
) ?? [];
|
193529
193651
|
if (match) {
|
193530
|
-
const basename5 =
|
193652
|
+
const basename5 = import_node_path49.default.basename(filepath).slice(0, -ext.length);
|
193531
193653
|
const isIndexFile = basename5 === "index";
|
193532
193654
|
const isMiddlewareFile = basename5 === "_middleware" || basename5 === "_middleware_";
|
193533
|
-
let routePath =
|
193534
|
-
let mountPath =
|
193655
|
+
let routePath = import_node_path49.default.relative(baseDir, filepath).slice(0, -ext.length);
|
193656
|
+
let mountPath = import_node_path49.default.dirname(routePath);
|
193535
193657
|
if (isIndexFile || isMiddlewareFile) {
|
193536
|
-
routePath =
|
193658
|
+
routePath = import_node_path49.default.dirname(routePath);
|
193537
193659
|
}
|
193538
193660
|
if (routePath === ".") {
|
193539
193661
|
routePath = "";
|
@@ -193547,7 +193669,7 @@ async function generateConfigFromFileTree({
|
|
193547
193669
|
routePath = convertSimpleParams(routePath);
|
193548
193670
|
mountPath = convertCatchallParams(mountPath);
|
193549
193671
|
mountPath = convertSimpleParams(mountPath);
|
193550
|
-
const modulePath = toUrlPath(
|
193672
|
+
const modulePath = toUrlPath(import_node_path49.default.relative(baseDir, filepath));
|
193551
193673
|
const routeEntry = {
|
193552
193674
|
routePath: toUrlPath(routePath),
|
193553
193675
|
mountPath: toUrlPath(mountPath),
|
@@ -193625,7 +193747,7 @@ async function forEachFile(baseDir, fn2) {
|
|
193625
193747
|
const cwd2 = searchPaths.shift();
|
193626
193748
|
const dir = await import_promises19.default.readdir(cwd2, { withFileTypes: true });
|
193627
193749
|
for (const entry of dir) {
|
193628
|
-
const pathname =
|
193750
|
+
const pathname = import_node_path49.default.join(cwd2, entry.name);
|
193629
193751
|
if (entry.isDirectory()) {
|
193630
193752
|
searchPaths.push(pathname);
|
193631
193753
|
} else if (entry.isFile()) {
|
@@ -193669,7 +193791,7 @@ __name(convertSimpleParams, "convertSimpleParams");
|
|
193669
193791
|
// src/pages/functions/routes.ts
|
193670
193792
|
init_import_meta_url();
|
193671
193793
|
var import_promises20 = __toESM(require("node:fs/promises"));
|
193672
|
-
var
|
193794
|
+
var import_node_path50 = __toESM(require("node:path"));
|
193673
193795
|
|
193674
193796
|
// src/pages/functions/identifiers.ts
|
193675
193797
|
init_import_meta_url();
|
@@ -193766,8 +193888,8 @@ function parseConfig(config, baseDir) {
|
|
193766
193888
|
return paths.map((modulePath) => {
|
193767
193889
|
const [filepath, name = "default"] = modulePath.split(":");
|
193768
193890
|
let { identifier } = importMap.get(modulePath) ?? {};
|
193769
|
-
const resolvedPath =
|
193770
|
-
if (
|
193891
|
+
const resolvedPath = import_node_path50.default.resolve(baseDir, filepath);
|
193892
|
+
if (import_node_path50.default.relative(baseDir, resolvedPath).startsWith("..")) {
|
193771
193893
|
throw new UserError(`Invalid module path "${filepath}"`);
|
193772
193894
|
}
|
193773
193895
|
if (name !== "default" && !isValidIdentifier(name)) {
|
@@ -193819,7 +193941,7 @@ __name(generateRoutesModule, "generateRoutesModule");
|
|
193819
193941
|
|
193820
193942
|
// src/pages/functions/routes-transformation.ts
|
193821
193943
|
init_import_meta_url();
|
193822
|
-
var
|
193944
|
+
var import_node_path51 = require("node:path");
|
193823
193945
|
|
193824
193946
|
// src/pages/functions/routes-consolidation.ts
|
193825
193947
|
init_import_meta_url();
|
@@ -193873,7 +193995,7 @@ function convertRoutesToGlobPatterns(routes) {
|
|
193873
193995
|
const globbedRoutePath = routePath.replace(/:\w+\*?.*/, "*");
|
193874
193996
|
if (typeof middleware === "string" || Array.isArray(middleware) && middleware.length > 0) {
|
193875
193997
|
if (!globbedRoutePath.endsWith("*")) {
|
193876
|
-
return toUrlPath((0,
|
193998
|
+
return toUrlPath((0, import_node_path51.join)(globbedRoutePath, "*"));
|
193877
193999
|
}
|
193878
194000
|
}
|
193879
194001
|
return toUrlPath(globbedRoutePath);
|
@@ -193943,7 +194065,7 @@ async function buildFunctions({
|
|
193943
194065
|
routesOutputPath,
|
193944
194066
|
nodejsCompatMode,
|
193945
194067
|
local,
|
193946
|
-
routesModule = (0,
|
194068
|
+
routesModule = (0, import_node_path52.join)(
|
193947
194069
|
getPagesTmpDir(),
|
193948
194070
|
`./functionsRoutes-${Math.random()}.mjs`
|
193949
194071
|
),
|
@@ -193978,7 +194100,7 @@ async function buildFunctions({
|
|
193978
194100
|
srcDir: functionsDirectory,
|
193979
194101
|
outfile: routesModule
|
193980
194102
|
});
|
193981
|
-
const absoluteFunctionsDirectory = (0,
|
194103
|
+
const absoluteFunctionsDirectory = (0, import_node_path52.resolve)(functionsDirectory);
|
193982
194104
|
let bundle;
|
193983
194105
|
if (plugin) {
|
193984
194106
|
if (outdir === void 0) {
|
@@ -194165,8 +194287,8 @@ var Handler10 = /* @__PURE__ */ __name(async (args) => {
|
|
194165
194287
|
if (outfile && outfile !== bundle.resolvedEntryPointPath) {
|
194166
194288
|
(0, import_node_fs29.writeFileSync)(
|
194167
194289
|
outfile,
|
194168
|
-
`export { default } from './${(0,
|
194169
|
-
(0,
|
194290
|
+
`export { default } from './${(0, import_node_path53.relative)(
|
194291
|
+
(0, import_node_path53.dirname)(outfile),
|
194170
194292
|
bundle.resolvedEntryPointPath
|
194171
194293
|
)}'`
|
194172
194294
|
);
|
@@ -194252,7 +194374,7 @@ var Handler10 = /* @__PURE__ */ __name(async (args) => {
|
|
194252
194374
|
bundle,
|
194253
194375
|
config
|
194254
194376
|
);
|
194255
|
-
(0, import_node_fs29.mkdirSync)((0,
|
194377
|
+
(0, import_node_fs29.mkdirSync)((0, import_node_path53.dirname)(outfile), { recursive: true });
|
194256
194378
|
(0, import_node_fs29.writeFileSync)(
|
194257
194379
|
outfile,
|
194258
194380
|
Buffer.from(await workerBundleContents.arrayBuffer())
|
@@ -194268,7 +194390,7 @@ async function maybeReadPagesConfig(args) {
|
|
194268
194390
|
if (!args.projectDirectory || !args.buildMetadataPath) {
|
194269
194391
|
return;
|
194270
194392
|
}
|
194271
|
-
const configPath =
|
194393
|
+
const configPath = import_node_path53.default.resolve(args.projectDirectory, "wrangler.toml");
|
194272
194394
|
if (!(0, import_node_fs29.existsSync)(configPath)) {
|
194273
194395
|
return void 0;
|
194274
194396
|
}
|
@@ -194307,7 +194429,7 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194307
194429
|
logger.warn(
|
194308
194430
|
"Creating a Pages Plugin with `--outfile` is now deprecated. Please use `--outdir` instead."
|
194309
194431
|
);
|
194310
|
-
args.outdir = (0,
|
194432
|
+
args.outdir = (0, import_node_path53.dirname)((0, import_node_path53.resolve)(args.outfile));
|
194311
194433
|
} else if (!args.outfile && !args.outdir) {
|
194312
194434
|
args.outfile ??= "_worker.js";
|
194313
194435
|
args.outdir = ".";
|
@@ -194331,14 +194453,14 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194331
194453
|
if (!args.outdir) {
|
194332
194454
|
args.outfile ??= "_worker.bundle";
|
194333
194455
|
}
|
194334
|
-
args.buildOutputDirectory ??= args.outfile ? (0,
|
194456
|
+
args.buildOutputDirectory ??= args.outfile ? (0, import_node_path53.dirname)(args.outfile) : ".";
|
194335
194457
|
}
|
194336
|
-
args.buildOutputDirectory = config?.pages_build_output_dir ?? (args.buildOutputDirectory ? (0,
|
194458
|
+
args.buildOutputDirectory = config?.pages_build_output_dir ?? (args.buildOutputDirectory ? (0, import_node_path53.resolve)(args.buildOutputDirectory) : void 0);
|
194337
194459
|
if (args.outdir) {
|
194338
|
-
args.outdir = (0,
|
194460
|
+
args.outdir = (0, import_node_path53.resolve)(args.outdir);
|
194339
194461
|
}
|
194340
194462
|
if (args.outfile) {
|
194341
|
-
args.outfile = (0,
|
194463
|
+
args.outfile = (0, import_node_path53.resolve)(args.outfile);
|
194342
194464
|
}
|
194343
194465
|
const { nodeCompat: node_compat, ...argsExceptNodeCompat } = args;
|
194344
194466
|
const nodejsCompatMode = getNodeCompatMode(args.compatibilityFlags ?? [], {
|
@@ -194351,7 +194473,7 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194351
194473
|
);
|
194352
194474
|
let workerScriptPath;
|
194353
194475
|
if (args.buildOutputDirectory) {
|
194354
|
-
const prospectiveWorkerScriptPath = (0,
|
194476
|
+
const prospectiveWorkerScriptPath = (0, import_node_path53.resolve)(
|
194355
194477
|
args.buildOutputDirectory,
|
194356
194478
|
"_worker.js"
|
194357
194479
|
);
|
@@ -194361,9 +194483,9 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194361
194483
|
} else if (!foundWorkerScript && !(0, import_node_fs29.existsSync)(args.directory)) {
|
194362
194484
|
throw new FatalError(
|
194363
194485
|
`Could not find anything to build.
|
194364
|
-
We first looked inside the build output directory (${(0,
|
194365
|
-
(0,
|
194366
|
-
)}), then looked for the Functions directory (${(0,
|
194486
|
+
We first looked inside the build output directory (${(0, import_node_path53.basename)(
|
194487
|
+
(0, import_node_path53.resolve)(args.buildOutputDirectory)
|
194488
|
+
)}), then looked for the Functions directory (${(0, import_node_path53.basename)(
|
194367
194489
|
args.directory
|
194368
194490
|
)}) but couldn't find anything to build.
|
194369
194491
|
\u27A4 If you are trying to build _worker.js, please make sure you provide the [--build-output-directory] containing your static files.
|
@@ -194374,7 +194496,7 @@ We first looked inside the build output directory (${(0, import_node_path52.base
|
|
194374
194496
|
} else if (!(0, import_node_fs29.existsSync)(args.directory)) {
|
194375
194497
|
throw new FatalError(
|
194376
194498
|
`Could not find anything to build.
|
194377
|
-
We looked for the Functions directory (${(0,
|
194499
|
+
We looked for the Functions directory (${(0, import_node_path53.basename)(
|
194378
194500
|
args.directory
|
194379
194501
|
)}) but couldn't find anything to build.
|
194380
194502
|
\u27A4 Please make sure [directory] points to the location of your Functions files.`,
|
@@ -194389,7 +194511,7 @@ We looked for the Functions directory (${(0, import_node_path52.basename)(
|
|
194389
194511
|
config,
|
194390
194512
|
buildMetadata: config && args.projectDirectory && config.pages_build_output_dir ? {
|
194391
194513
|
wrangler_config_hash: config.hash,
|
194392
|
-
build_output_directory:
|
194514
|
+
build_output_directory: import_node_path53.default.relative(
|
194393
194515
|
args.projectDirectory,
|
194394
194516
|
config.pages_build_output_dir
|
194395
194517
|
)
|
@@ -194400,7 +194522,7 @@ We looked for the Functions directory (${(0, import_node_path52.basename)(
|
|
194400
194522
|
// src/pages/build-env.ts
|
194401
194523
|
init_import_meta_url();
|
194402
194524
|
var import_node_fs30 = require("node:fs");
|
194403
|
-
var
|
194525
|
+
var import_node_path54 = __toESM(require("node:path"));
|
194404
194526
|
function Options11(yargs) {
|
194405
194527
|
return yargs.positional("projectDir", {
|
194406
194528
|
type: "string",
|
@@ -194423,7 +194545,7 @@ var Handler11 = /* @__PURE__ */ __name(async (args) => {
|
|
194423
194545
|
logger.log(
|
194424
194546
|
"Checking for configuration in a wrangler.toml configuration file (BETA)\n"
|
194425
194547
|
);
|
194426
|
-
const configPath =
|
194548
|
+
const configPath = import_node_path54.default.resolve(args.projectDir, "wrangler.toml");
|
194427
194549
|
if (!(0, import_node_fs30.existsSync)(configPath)) {
|
194428
194550
|
logger.debug("No wrangler.toml configuration file found. Exiting.");
|
194429
194551
|
process.exitCode = EXIT_CODE_NO_CONFIG_FOUND;
|
@@ -194454,7 +194576,7 @@ var Handler11 = /* @__PURE__ */ __name(async (args) => {
|
|
194454
194576
|
);
|
194455
194577
|
const buildConfiguration = {
|
194456
194578
|
vars: textVars,
|
194457
|
-
pages_build_output_dir:
|
194579
|
+
pages_build_output_dir: import_node_path54.default.relative(
|
194458
194580
|
args.projectDir,
|
194459
194581
|
config.pages_build_output_dir
|
194460
194582
|
)
|
@@ -194484,7 +194606,7 @@ init_import_meta_url();
|
|
194484
194606
|
var import_node_crypto8 = require("node:crypto");
|
194485
194607
|
var import_node_fs31 = require("node:fs");
|
194486
194608
|
var import_promises22 = require("node:fs/promises");
|
194487
|
-
var
|
194609
|
+
var import_node_path55 = __toESM(require("node:path"));
|
194488
194610
|
var import_node_process12 = require("node:process");
|
194489
194611
|
var import_undici19 = __toESM(require_undici());
|
194490
194612
|
async function deploy2({
|
@@ -194503,17 +194625,17 @@ async function deploy2({
|
|
194503
194625
|
}) {
|
194504
194626
|
let _headers, _redirects, _routesGenerated, _routesCustom, _workerJSIsDirectory = false, _workerJS;
|
194505
194627
|
bundle = bundle ?? true;
|
194506
|
-
const _workerPath = (0,
|
194628
|
+
const _workerPath = (0, import_node_path55.resolve)(directory, "_worker.js");
|
194507
194629
|
try {
|
194508
|
-
_headers = (0, import_node_fs31.readFileSync)((0,
|
194630
|
+
_headers = (0, import_node_fs31.readFileSync)((0, import_node_path55.join)(directory, "_headers"), "utf-8");
|
194509
194631
|
} catch {
|
194510
194632
|
}
|
194511
194633
|
try {
|
194512
|
-
_redirects = (0, import_node_fs31.readFileSync)((0,
|
194634
|
+
_redirects = (0, import_node_fs31.readFileSync)((0, import_node_path55.join)(directory, "_redirects"), "utf-8");
|
194513
194635
|
} catch {
|
194514
194636
|
}
|
194515
194637
|
try {
|
194516
|
-
_routesCustom = (0, import_node_fs31.readFileSync)((0,
|
194638
|
+
_routesCustom = (0, import_node_fs31.readFileSync)((0, import_node_path55.join)(directory, "_routes.json"), "utf-8");
|
194517
194639
|
} catch {
|
194518
194640
|
}
|
194519
194641
|
try {
|
@@ -194557,11 +194679,11 @@ async function deploy2({
|
|
194557
194679
|
);
|
194558
194680
|
let builtFunctions = void 0;
|
194559
194681
|
let workerBundle = void 0;
|
194560
|
-
const functionsDirectory = customFunctionsDirectory || (0,
|
194561
|
-
const routesOutputPath = !(0, import_node_fs31.existsSync)((0,
|
194682
|
+
const functionsDirectory = customFunctionsDirectory || (0, import_node_path55.join)((0, import_node_process12.cwd)(), "functions");
|
194683
|
+
const routesOutputPath = !(0, import_node_fs31.existsSync)((0, import_node_path55.join)(directory, "_routes.json")) ? (0, import_node_path55.join)(getPagesTmpDir(), `_routes-${Math.random()}.json`) : void 0;
|
194562
194684
|
let filepathRoutingConfig;
|
194563
194685
|
if (!_workerJS && (0, import_node_fs31.existsSync)(functionsDirectory)) {
|
194564
|
-
const outputConfigPath = (0,
|
194686
|
+
const outputConfigPath = (0, import_node_path55.join)(
|
194565
194687
|
getPagesTmpDir(),
|
194566
194688
|
`functions-filepath-routing-config-${Math.random()}.json`
|
194567
194689
|
);
|
@@ -194633,7 +194755,7 @@ async function deploy2({
|
|
194633
194755
|
}
|
194634
194756
|
if (config !== void 0 && config.configPath !== void 0 && config.pages_build_output_dir) {
|
194635
194757
|
const configHash = (0, import_node_crypto8.createHash)("sha256").update(await (0, import_promises22.readFile)(config.configPath)).digest("hex");
|
194636
|
-
const outputDir =
|
194758
|
+
const outputDir = import_node_path55.default.relative(
|
194637
194759
|
process.cwd(),
|
194638
194760
|
config.pages_build_output_dir
|
194639
194761
|
);
|
@@ -194651,7 +194773,7 @@ async function deploy2({
|
|
194651
194773
|
});
|
194652
194774
|
} else if (_workerJS) {
|
194653
194775
|
if (bundle) {
|
194654
|
-
const outfile = (0,
|
194776
|
+
const outfile = (0, import_node_path55.join)(
|
194655
194777
|
getPagesTmpDir(),
|
194656
194778
|
`./bundledWorker-${Math.random()}.mjs`
|
194657
194779
|
);
|
@@ -194692,7 +194814,7 @@ async function deploy2({
|
|
194692
194814
|
if (_routesCustom) {
|
194693
194815
|
try {
|
194694
194816
|
const routesCustomJSON = JSON.parse(_routesCustom);
|
194695
|
-
validateRoutes(routesCustomJSON, (0,
|
194817
|
+
validateRoutes(routesCustomJSON, (0, import_node_path55.join)(directory, "_routes.json"));
|
194696
194818
|
formData.append(
|
194697
194819
|
"_routes.json",
|
194698
194820
|
new import_undici19.File([_routesCustom], "_routes.json")
|
@@ -194718,7 +194840,7 @@ async function deploy2({
|
|
194718
194840
|
if (_routesCustom) {
|
194719
194841
|
try {
|
194720
194842
|
const routesCustomJSON = JSON.parse(_routesCustom);
|
194721
|
-
validateRoutes(routesCustomJSON, (0,
|
194843
|
+
validateRoutes(routesCustomJSON, (0, import_node_path55.join)(directory, "_routes.json"));
|
194722
194844
|
formData.append(
|
194723
194845
|
"_routes.json",
|
194724
194846
|
new import_undici19.File([_routesCustom], "_routes.json")
|
@@ -196004,7 +196126,7 @@ __name(ListHandler4, "ListHandler");
|
|
196004
196126
|
init_import_meta_url();
|
196005
196127
|
var import_node_child_process6 = require("node:child_process");
|
196006
196128
|
var import_node_fs32 = require("node:fs");
|
196007
|
-
var
|
196129
|
+
var import_node_path56 = require("node:path");
|
196008
196130
|
var import_chokidar5 = require("chokidar");
|
196009
196131
|
var esbuild3 = __toESM(require("esbuild"));
|
196010
196132
|
|
@@ -196263,7 +196385,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196263
196385
|
return void 0;
|
196264
196386
|
}
|
196265
196387
|
} else {
|
196266
|
-
directory = (0,
|
196388
|
+
directory = (0, import_node_path56.resolve)(directory);
|
196267
196389
|
}
|
196268
196390
|
const {
|
196269
196391
|
compatibilityDate,
|
@@ -196287,7 +196409,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196287
196409
|
(promiseResolve) => scriptReadyResolve = promiseResolve
|
196288
196410
|
);
|
196289
196411
|
const singleWorkerScriptPath = args.scriptPath ?? DEFAULT_SCRIPT_PATH;
|
196290
|
-
const workerScriptPath = directory !== void 0 ? (0,
|
196412
|
+
const workerScriptPath = directory !== void 0 ? (0, import_node_path56.join)(directory, singleWorkerScriptPath) : (0, import_node_path56.resolve)(singleWorkerScriptPath);
|
196291
196413
|
const usingWorkerDirectory = (0, import_node_fs32.existsSync)(workerScriptPath) && (0, import_node_fs32.lstatSync)(workerScriptPath).isDirectory();
|
196292
196414
|
const usingWorkerScript = (0, import_node_fs32.existsSync)(workerScriptPath);
|
196293
196415
|
const enableBundling = args.bundle ?? !args.noBundle;
|
@@ -196349,15 +196471,15 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196349
196471
|
);
|
196350
196472
|
}, "runBuild");
|
196351
196473
|
if (enableBundling) {
|
196352
|
-
scriptPath3 = (0,
|
196474
|
+
scriptPath3 = (0, import_node_path56.join)(
|
196353
196475
|
getPagesTmpDir(),
|
196354
196476
|
`./bundledWorker-${Math.random()}.mjs`
|
196355
196477
|
);
|
196356
196478
|
runBuild2 = /* @__PURE__ */ __name(async () => {
|
196357
|
-
const workerScriptDirectory = (0,
|
196479
|
+
const workerScriptDirectory = (0, import_node_path56.dirname)(workerScriptPath);
|
196358
196480
|
let currentBundleDependencies = [];
|
196359
196481
|
const bundle = await buildRawWorker({
|
196360
|
-
workerScriptPath: usingWorkerDirectory ? (0,
|
196482
|
+
workerScriptPath: usingWorkerDirectory ? (0, import_node_path56.join)(workerScriptPath, "index.js") : workerScriptPath,
|
196361
196483
|
outfile: scriptPath3,
|
196362
196484
|
directory: directory ?? ".",
|
196363
196485
|
nodejsCompatMode,
|
@@ -196367,11 +196489,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196367
196489
|
onEnd: () => scriptReadyResolve(),
|
196368
196490
|
defineNavigatorUserAgent
|
196369
196491
|
});
|
196370
|
-
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0,
|
196371
|
-
(resolvedDep) => !resolvedDep.includes((0,
|
196492
|
+
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0, import_node_path56.resolve)(workerScriptDirectory, dep)).filter(
|
196493
|
+
(resolvedDep) => !resolvedDep.includes((0, import_node_path56.normalize)(singleWorkerScriptPath)) && !resolvedDep.includes((0, import_node_path56.normalize)("/.wrangler/")) && resolvedDep.includes((0, import_node_path56.resolve)(process.cwd()))
|
196372
196494
|
);
|
196373
196495
|
const bundleModules = bundle.modules.filter((module3) => !!module3.filePath).map(
|
196374
|
-
(module3) => (0,
|
196496
|
+
(module3) => (0, import_node_path56.resolve)(workerScriptDirectory, module3.filePath)
|
196375
196497
|
);
|
196376
196498
|
currentBundleDependencies = [...bundleDependencies, ...bundleModules];
|
196377
196499
|
if (watchedBundleDependencies.length) {
|
@@ -196403,11 +196525,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196403
196525
|
throw new FatalError(`Failed to build ${singleWorkerScriptPath}.`);
|
196404
196526
|
}
|
196405
196527
|
} else if (usingFunctions) {
|
196406
|
-
scriptPath3 = (0,
|
196528
|
+
scriptPath3 = (0, import_node_path56.join)(
|
196407
196529
|
getPagesTmpDir(),
|
196408
196530
|
`./functionsWorker-${Math.random()}.mjs`
|
196409
196531
|
);
|
196410
|
-
const routesModule = (0,
|
196532
|
+
const routesModule = (0, import_node_path56.join)(
|
196411
196533
|
getPagesTmpDir(),
|
196412
196534
|
`./functionsRoutes-${Math.random()}.mjs`
|
196413
196535
|
);
|
@@ -196432,11 +196554,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196432
196554
|
routesModule,
|
196433
196555
|
defineNavigatorUserAgent
|
196434
196556
|
});
|
196435
|
-
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0,
|
196436
|
-
(resolvedDep) => !resolvedDep.includes((0,
|
196557
|
+
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0, import_node_path56.resolve)(functionsDirectory, dep)).filter(
|
196558
|
+
(resolvedDep) => !resolvedDep.includes((0, import_node_path56.normalize)("/functions/")) && !resolvedDep.includes((0, import_node_path56.normalize)("/.wrangler/")) && resolvedDep.includes((0, import_node_path56.resolve)(process.cwd()))
|
196437
196559
|
);
|
196438
196560
|
const bundleModules = bundle.modules.filter((module3) => !!module3.filePath).map(
|
196439
|
-
(module3) => (0,
|
196561
|
+
(module3) => (0, import_node_path56.resolve)(functionsDirectory, module3.filePath)
|
196440
196562
|
);
|
196441
196563
|
currentBundleDependencies = [...bundleDependencies, ...bundleModules];
|
196442
196564
|
if (watchedBundleDependencies.length) {
|
@@ -196484,7 +196606,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196484
196606
|
if (!usingFunctions && !usingWorkerScript) {
|
196485
196607
|
scriptReadyResolve();
|
196486
196608
|
logger.log("No Functions. Shimming...");
|
196487
|
-
scriptPath3 = (0,
|
196609
|
+
scriptPath3 = (0, import_node_path56.resolve)(getBasePath(), "templates/pages-shim.ts");
|
196488
196610
|
}
|
196489
196611
|
await scriptReadyPromise;
|
196490
196612
|
if (scriptPath3 === "") {
|
@@ -196494,13 +196616,13 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196494
196616
|
}
|
196495
196617
|
let scriptEntrypoint = scriptPath3;
|
196496
196618
|
if (directory && (usingFunctions || usingWorkerScript || usingWorkerDirectory)) {
|
196497
|
-
const routesJSONPath = (0,
|
196619
|
+
const routesJSONPath = (0, import_node_path56.join)(directory, "_routes.json");
|
196498
196620
|
if ((0, import_node_fs32.existsSync)(routesJSONPath)) {
|
196499
196621
|
let routesJSONContents;
|
196500
196622
|
const runBuild2 = /* @__PURE__ */ __name(async (entrypointFile, outfile, routes) => {
|
196501
196623
|
await esbuild3.build({
|
196502
196624
|
entryPoints: [
|
196503
|
-
(0,
|
196625
|
+
(0, import_node_path56.resolve)(getBasePath(), "templates/pages-dev-pipeline.ts")
|
196504
196626
|
],
|
196505
196627
|
bundle: true,
|
196506
196628
|
sourcemap: true,
|
@@ -196508,7 +196630,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196508
196630
|
plugins: [
|
196509
196631
|
esbuildAliasExternalPlugin({
|
196510
196632
|
__ENTRY_POINT__: entrypointFile,
|
196511
|
-
"./pages-dev-util": (0,
|
196633
|
+
"./pages-dev-util": (0, import_node_path56.resolve)(
|
196512
196634
|
getBasePath(),
|
196513
196635
|
"templates/pages-dev-util.ts"
|
196514
196636
|
)
|
@@ -196523,7 +196645,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196523
196645
|
try {
|
196524
196646
|
routesJSONContents = (0, import_node_fs32.readFileSync)(routesJSONPath, "utf-8");
|
196525
196647
|
validateRoutes(JSON.parse(routesJSONContents), directory);
|
196526
|
-
scriptEntrypoint = (0,
|
196648
|
+
scriptEntrypoint = (0, import_node_path56.join)(
|
196527
196649
|
getPagesTmpDir(),
|
196528
196650
|
`${Math.random().toString(36).slice(2)}.js`
|
196529
196651
|
);
|
@@ -197093,7 +197215,7 @@ var Handler15 = /* @__PURE__ */ __name(async ({ projectName, force }) => {
|
|
197093
197215
|
// src/pages/functions.ts
|
197094
197216
|
init_import_meta_url();
|
197095
197217
|
var import_node_fs33 = require("node:fs");
|
197096
|
-
var
|
197218
|
+
var import_node_path57 = __toESM(require("node:path"));
|
197097
197219
|
function OptimizeRoutesOptions(yargs) {
|
197098
197220
|
return yargs.options({
|
197099
197221
|
"routes-path": {
|
@@ -197115,7 +197237,7 @@ async function OptimizeRoutesHandler({
|
|
197115
197237
|
outputRoutesPath
|
197116
197238
|
}) {
|
197117
197239
|
let routesFileContents;
|
197118
|
-
const routesOutputDirectory =
|
197240
|
+
const routesOutputDirectory = import_node_path57.default.dirname(outputRoutesPath);
|
197119
197241
|
if (!(0, import_node_fs33.existsSync)(routesPath)) {
|
197120
197242
|
throw new FatalError(
|
197121
197243
|
`Oops! File ${routesPath} does not exist. Please make sure --routes-path is a valid file path (for example "/public/_routes.json").`,
|
@@ -197150,7 +197272,7 @@ __name(OptimizeRoutesHandler, "OptimizeRoutesHandler");
|
|
197150
197272
|
|
197151
197273
|
// src/pages/secret/index.ts
|
197152
197274
|
init_import_meta_url();
|
197153
|
-
var
|
197275
|
+
var import_node_path58 = __toESM(require("node:path"));
|
197154
197276
|
var import_node_readline2 = __toESM(require("node:readline"));
|
197155
197277
|
|
197156
197278
|
// src/utils/std.ts
|
@@ -197310,7 +197432,7 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
197310
197432
|
);
|
197311
197433
|
let content;
|
197312
197434
|
if (args.json) {
|
197313
|
-
const jsonFilePath =
|
197435
|
+
const jsonFilePath = import_node_path58.default.resolve(args.json);
|
197314
197436
|
content = parseJSON(
|
197315
197437
|
readFileSync5(jsonFilePath),
|
197316
197438
|
jsonFilePath
|
@@ -200292,7 +200414,7 @@ __name(r22, "r2");
|
|
200292
200414
|
|
200293
200415
|
// src/secret/index.ts
|
200294
200416
|
init_import_meta_url();
|
200295
|
-
var
|
200417
|
+
var import_node_path59 = __toESM(require("node:path"));
|
200296
200418
|
var import_node_readline3 = __toESM(require("node:readline"));
|
200297
200419
|
var import_undici20 = __toESM(require_undici());
|
200298
200420
|
var VERSION_NOT_DEPLOYED_ERR_CODE = 10215;
|
@@ -200558,7 +200680,7 @@ var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
|
200558
200680
|
);
|
200559
200681
|
let content;
|
200560
200682
|
if (secretBulkArgs.json) {
|
200561
|
-
const jsonFilePath =
|
200683
|
+
const jsonFilePath = import_node_path59.default.resolve(secretBulkArgs.json);
|
200562
200684
|
try {
|
200563
200685
|
content = parseJSON(
|
200564
200686
|
readFileSync5(jsonFilePath),
|
@@ -210026,7 +210148,7 @@ __name(triggersDeployHandler, "triggersDeployHandler");
|
|
210026
210148
|
// src/type-generation/index.ts
|
210027
210149
|
init_import_meta_url();
|
210028
210150
|
var fs25 = __toESM(require("node:fs"));
|
210029
|
-
var
|
210151
|
+
var import_node_path60 = require("node:path");
|
210030
210152
|
|
210031
210153
|
// src/type-generation/runtime/index.ts
|
210032
210154
|
init_import_meta_url();
|
@@ -210200,7 +210322,7 @@ async function typesHandler(args) {
|
|
210200
210322
|
config,
|
210201
210323
|
outFile: args.experimentalIncludeRuntime || void 0
|
210202
210324
|
});
|
210203
|
-
const tsconfigPath = config.tsconfig ?? (0,
|
210325
|
+
const tsconfigPath = config.tsconfig ?? (0, import_node_path60.join)((0, import_node_path60.dirname)(configPath), "tsconfig.json");
|
210204
210326
|
const tsconfigTypes = readTsconfigTypes(tsconfigPath);
|
210205
210327
|
const mode = getNodeCompatMode(config.compatibility_flags, {
|
210206
210328
|
validateConfig: false,
|
@@ -210238,7 +210360,8 @@ async function typesHandler(args) {
|
|
210238
210360
|
browser: config.browser,
|
210239
210361
|
ai: config.ai,
|
210240
210362
|
version_metadata: config.version_metadata,
|
210241
|
-
secrets
|
210363
|
+
secrets,
|
210364
|
+
experimental_assets: config.experimental_assets
|
210242
210365
|
};
|
210243
210366
|
await generateTypes(
|
210244
210367
|
configBindingsWithSecrets,
|
@@ -210260,8 +210383,8 @@ function constructTypeKey(key) {
|
|
210260
210383
|
}
|
210261
210384
|
__name(constructTypeKey, "constructTypeKey");
|
210262
210385
|
function generateImportSpecifier(from, to) {
|
210263
|
-
const relativePath = (0,
|
210264
|
-
const filename = (0,
|
210386
|
+
const relativePath = (0, import_node_path60.relative)((0, import_node_path60.dirname)(from), (0, import_node_path60.dirname)(to)).replace(/\\/g, "/");
|
210387
|
+
const filename = (0, import_node_path60.basename)(to, (0, import_node_path60.extname)(to));
|
210265
210388
|
if (!relativePath) {
|
210266
210389
|
return `./${filename}`;
|
210267
210390
|
} else if (relativePath.startsWith("..")) {
|
@@ -210289,7 +210412,7 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
210289
210412
|
const configContainsEntrypoint = config.main !== void 0 || !!config.site?.["entry-point"];
|
210290
210413
|
const entrypoint = configContainsEntrypoint ? await getEntry({}, config, "types") : void 0;
|
210291
210414
|
const entrypointFormat = entrypoint?.format ?? "modules";
|
210292
|
-
const fullOutputPath = (0,
|
210415
|
+
const fullOutputPath = (0, import_node_path60.resolve)(outputPath);
|
210293
210416
|
const userProvidedEnvInterface = envInterface !== "Env";
|
210294
210417
|
if (userProvidedEnvInterface && entrypointFormat === "service-worker") {
|
210295
210418
|
throw new Error(
|
@@ -210430,6 +210553,11 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
210430
210553
|
`${configToDTS.version_metadata.binding}: { id: string; tag: string };`
|
210431
210554
|
);
|
210432
210555
|
}
|
210556
|
+
if (configToDTS.experimental_assets?.binding) {
|
210557
|
+
envTypeStructure.push(
|
210558
|
+
constructType(configToDTS.experimental_assets.binding, "Fetcher")
|
210559
|
+
);
|
210560
|
+
}
|
210433
210561
|
const modulesTypeStructure = [];
|
210434
210562
|
if (configToDTS.rules) {
|
210435
210563
|
const moduleTypeMap = {
|
@@ -210469,7 +210597,7 @@ function writeDTSFile({
|
|
210469
210597
|
try {
|
210470
210598
|
if (wranglerOverrideDTSPath !== void 0 && !fs25.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
|
210471
210599
|
throw new UserError(
|
210472
|
-
`A non-wrangler ${(0,
|
210600
|
+
`A non-wrangler ${(0, import_node_path60.basename)(path74)} already exists, please rename and try again.`
|
210473
210601
|
);
|
210474
210602
|
}
|
210475
210603
|
} catch (error2) {
|
@@ -211553,7 +211681,7 @@ __name(vectorize, "vectorize");
|
|
211553
211681
|
// src/versions/index.ts
|
211554
211682
|
init_import_meta_url();
|
211555
211683
|
var import_node_assert23 = __toESM(require("node:assert"));
|
211556
|
-
var
|
211684
|
+
var import_node_path63 = __toESM(require("node:path"));
|
211557
211685
|
|
211558
211686
|
// src/versions/list.ts
|
211559
211687
|
init_import_meta_url();
|
@@ -211656,7 +211784,7 @@ init_import_meta_url();
|
|
211656
211784
|
|
211657
211785
|
// src/versions/secrets/bulk.ts
|
211658
211786
|
init_import_meta_url();
|
211659
|
-
var
|
211787
|
+
var import_node_path61 = __toESM(require("node:path"));
|
211660
211788
|
var import_node_readline6 = __toESM(require("node:readline"));
|
211661
211789
|
function versionsSecretsPutBulkOptions(yargs) {
|
211662
211790
|
return yargs.positional("json", {
|
@@ -211692,7 +211820,7 @@ async function versionsSecretPutBulkHandler(args) {
|
|
211692
211820
|
);
|
211693
211821
|
let content;
|
211694
211822
|
if (args.json) {
|
211695
|
-
const jsonFilePath =
|
211823
|
+
const jsonFilePath = import_node_path61.default.resolve(args.json);
|
211696
211824
|
try {
|
211697
211825
|
content = parseJSON(
|
211698
211826
|
readFileSync5(jsonFilePath),
|
@@ -212153,7 +212281,7 @@ __name(parseModules, "parseModules");
|
|
212153
212281
|
// src/versions/upload.ts
|
212154
212282
|
init_import_meta_url();
|
212155
212283
|
var import_node_fs36 = require("node:fs");
|
212156
|
-
var
|
212284
|
+
var import_node_path62 = __toESM(require("node:path"));
|
212157
212285
|
var scriptStartupErrorRegex2 = /startup/i;
|
212158
212286
|
function errIsScriptSize2(err) {
|
212159
212287
|
if (!err) {
|
@@ -212250,7 +212378,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212250
212378
|
}
|
212251
212379
|
if (props.outDir) {
|
212252
212380
|
(0, import_node_fs36.mkdirSync)(props.outDir, { recursive: true });
|
212253
|
-
const readmePath =
|
212381
|
+
const readmePath = import_node_path62.default.join(props.outDir, "README.md");
|
212254
212382
|
(0, import_node_fs36.writeFileSync)(
|
212255
212383
|
readmePath,
|
212256
212384
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
@@ -212282,11 +212410,11 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212282
212410
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
212283
212411
|
(0, import_node_fs36.mkdirSync)(destinationDir, { recursive: true });
|
212284
212412
|
(0, import_node_fs36.writeFileSync)(
|
212285
|
-
|
212413
|
+
import_node_path62.default.join(destinationDir, import_node_path62.default.basename(props.entry.file)),
|
212286
212414
|
(0, import_node_fs36.readFileSync)(props.entry.file, "utf-8")
|
212287
212415
|
);
|
212288
212416
|
}
|
212289
|
-
const entryDirectory =
|
212417
|
+
const entryDirectory = import_node_path62.default.dirname(props.entry.file);
|
212290
212418
|
const moduleCollector = createModuleCollector({
|
212291
212419
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
212292
212420
|
entryDirectory,
|
@@ -212339,7 +212467,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212339
212467
|
}
|
212340
212468
|
);
|
212341
212469
|
for (const module3 of modules) {
|
212342
|
-
const modulePath = module3.filePath === void 0 ? module3.name :
|
212470
|
+
const modulePath = module3.filePath === void 0 ? module3.name : import_node_path62.default.relative("", module3.filePath);
|
212343
212471
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
212344
212472
|
dependencies[modulePath] = { bytesInOutput };
|
212345
212473
|
}
|
@@ -212389,7 +212517,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212389
212517
|
}
|
212390
212518
|
};
|
212391
212519
|
const placement = config.placement?.mode === "smart" ? { mode: "smart", hint: config.placement.hint } : void 0;
|
212392
|
-
const entryPointName =
|
212520
|
+
const entryPointName = import_node_path62.default.basename(resolvedEntryPointPath);
|
212393
212521
|
const main2 = {
|
212394
212522
|
name: entryPointName,
|
212395
212523
|
filePath: resolvedEntryPointPath,
|
@@ -212426,7 +212554,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212426
212554
|
observability: void 0
|
212427
212555
|
};
|
212428
212556
|
await printBundleSize(
|
212429
|
-
{ name:
|
212557
|
+
{ name: import_node_path62.default.basename(resolvedEntryPointPath), content },
|
212430
212558
|
modules
|
212431
212559
|
);
|
212432
212560
|
const withoutStaticAssets = {
|
@@ -212865,8 +212993,8 @@ function versionsUploadOptions(yargs) {
|
|
212865
212993
|
__name(versionsUploadOptions, "versionsUploadOptions");
|
212866
212994
|
async function versionsUploadHandler(args) {
|
212867
212995
|
await printWranglerBanner();
|
212868
|
-
const configPath = args.config || args.script && findWranglerToml(
|
212869
|
-
const projectRoot = configPath &&
|
212996
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path63.default.dirname(args.script));
|
212997
|
+
const projectRoot = configPath && import_node_path63.default.dirname(configPath);
|
212870
212998
|
const config = readConfig(configPath, args);
|
212871
212999
|
const entry = await getEntry(args, config, "versions upload");
|
212872
213000
|
await sendMetricsEvent(
|
@@ -212889,14 +213017,15 @@ async function versionsUploadHandler(args) {
|
|
212889
213017
|
"Legacy Assets does not support uploading versions through `wrangler versions upload`. You must use `wrangler deploy` instead."
|
212890
213018
|
);
|
212891
213019
|
}
|
212892
|
-
|
213020
|
+
validateAssetsArgsAndConfig(
|
212893
213021
|
{
|
212894
213022
|
// given that legacyAssets and sites are not supported by
|
212895
213023
|
// `wrangler versions upload` pass them as undefined to
|
212896
213024
|
// skip the corresponding mutual exclusivity validation
|
212897
213025
|
legacyAssets: void 0,
|
212898
213026
|
site: void 0,
|
212899
|
-
experimentalAssets: args.experimentalAssets
|
213027
|
+
experimentalAssets: args.experimentalAssets,
|
213028
|
+
script: args.script
|
212900
213029
|
},
|
212901
213030
|
config
|
212902
213031
|
);
|
@@ -212917,7 +213046,11 @@ async function versionsUploadHandler(args) {
|
|
212917
213046
|
);
|
212918
213047
|
if (!args.dryRun) {
|
212919
213048
|
(0, import_node_assert23.default)(accountId, "Missing account ID");
|
212920
|
-
await verifyWorkerMatchesCITag(
|
213049
|
+
await verifyWorkerMatchesCITag(
|
213050
|
+
accountId,
|
213051
|
+
name,
|
213052
|
+
import_node_path63.default.relative(entry.directory, config.configPath ?? "wrangler.toml")
|
213053
|
+
);
|
212921
213054
|
}
|
212922
213055
|
if (!args.dryRun) {
|
212923
213056
|
await standardPricingWarning2(config);
|
@@ -214472,7 +214605,7 @@ async function startDev(args) {
|
|
214472
214605
|
let assetsWatcher;
|
214473
214606
|
let rerender;
|
214474
214607
|
try {
|
214475
|
-
const configPath = args.config || args.script && findWranglerToml(
|
214608
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path64.default.dirname(args.script));
|
214476
214609
|
let config = readConfig(configPath, args);
|
214477
214610
|
if (args.logLevel) {
|
214478
214611
|
logger.loggerLevel = args.logLevel;
|
@@ -214509,12 +214642,17 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214509
214642
|
"Cannot use Legacy Assets and Workers Sites in the same Worker."
|
214510
214643
|
);
|
214511
214644
|
}
|
214512
|
-
|
214645
|
+
if ((args.experimentalAssets || config.experimental_assets) && args.remote) {
|
214646
|
+
throw new UserError(
|
214647
|
+
"Cannot use Experimental Assets in remote mode. Workers with assets are only supported in local mode. Please use `wrangler dev`."
|
214648
|
+
);
|
214649
|
+
}
|
214650
|
+
validateAssetsArgsAndConfig(args, config);
|
214513
214651
|
let experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
214514
214652
|
if (experimentalAssetsOptions) {
|
214515
214653
|
args.forceLocal = true;
|
214516
214654
|
}
|
214517
|
-
const projectRoot = configPath &&
|
214655
|
+
const projectRoot = configPath && import_node_path64.default.dirname(configPath);
|
214518
214656
|
const devEnv = new DevEnv();
|
214519
214657
|
if (args.experimentalDevEnv) {
|
214520
214658
|
void devEnv.proxy.ready.promise.then(({ url: url4 }) => {
|
@@ -214660,7 +214798,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214660
214798
|
configParam
|
214661
214799
|
);
|
214662
214800
|
return Boolean(args.site || configParam.site) && legacyAssetPaths ? {
|
214663
|
-
bucket:
|
214801
|
+
bucket: import_node_path64.default.join(
|
214664
214802
|
legacyAssetPaths.baseDirectory,
|
214665
214803
|
legacyAssetPaths?.assetDirectory
|
214666
214804
|
),
|
@@ -214702,13 +214840,23 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214702
214840
|
if (!config.configPath) {
|
214703
214841
|
return;
|
214704
214842
|
}
|
214705
|
-
logger.log(`${
|
214843
|
+
logger.log(`${import_node_path64.default.basename(config.configPath)} changed...`);
|
214844
|
+
entry = await getEntry(
|
214845
|
+
{
|
214846
|
+
legacyAssets: args.legacyAssets,
|
214847
|
+
script: args.script,
|
214848
|
+
moduleRoot: args.moduleRoot,
|
214849
|
+
experimentalAssets: args.experimentalAssets
|
214850
|
+
},
|
214851
|
+
config,
|
214852
|
+
"dev"
|
214853
|
+
);
|
214854
|
+
experimentalAssetsOptions = processExperimentalAssetsArg(
|
214855
|
+
args,
|
214856
|
+
config
|
214857
|
+
);
|
214706
214858
|
if (experimentalAssetsOptions && !args.experimentalAssets) {
|
214707
214859
|
await assetsWatcher?.close();
|
214708
|
-
experimentalAssetsOptions = processExperimentalAssetsArg(
|
214709
|
-
args,
|
214710
|
-
config
|
214711
|
-
);
|
214712
214860
|
if (experimentalAssetsOptions) {
|
214713
214861
|
assetsWatcher = (0, import_chokidar6.watch)(experimentalAssetsOptions.directory, {
|
214714
214862
|
persistent: true,
|
@@ -214726,8 +214874,9 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214726
214874
|
}
|
214727
214875
|
});
|
214728
214876
|
}
|
214877
|
+
const devServerSettings = await validateDevServerSettings(args, config);
|
214878
|
+
let { entry } = devServerSettings;
|
214729
214879
|
const {
|
214730
|
-
entry,
|
214731
214880
|
upstreamProtocol,
|
214732
214881
|
host,
|
214733
214882
|
routes,
|
@@ -214739,7 +214888,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214739
214888
|
localPersistencePath,
|
214740
214889
|
processEntrypoint,
|
214741
214890
|
additionalModules
|
214742
|
-
} =
|
214891
|
+
} = devServerSettings;
|
214743
214892
|
const nodejsCompatMode = getNodeCompatMode(
|
214744
214893
|
args.compatibilityFlags ?? config.compatibility_flags ?? [],
|
214745
214894
|
{
|
@@ -214862,8 +215011,8 @@ async function startApiDev(args) {
|
|
214862
215011
|
if (args.logLevel) {
|
214863
215012
|
logger.loggerLevel = args.logLevel;
|
214864
215013
|
}
|
214865
|
-
const configPath = args.config || args.script && findWranglerToml(
|
214866
|
-
const projectRoot = configPath &&
|
215014
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path64.default.dirname(args.script));
|
215015
|
+
const projectRoot = configPath && import_node_path64.default.dirname(configPath);
|
214867
215016
|
const config = readConfig(configPath, args);
|
214868
215017
|
const {
|
214869
215018
|
entry,
|
@@ -215784,7 +215933,7 @@ __name(BundlerController, "BundlerController");
|
|
215784
215933
|
// src/api/startDevWorker/ConfigController.ts
|
215785
215934
|
init_import_meta_url();
|
215786
215935
|
var import_node_assert25 = __toESM(require("node:assert"));
|
215787
|
-
var
|
215936
|
+
var import_node_path65 = __toESM(require("node:path"));
|
215788
215937
|
var import_chokidar8 = require("chokidar");
|
215789
215938
|
var getInspectorPort = memoizeGetPort(DEFAULT_INSPECTOR_PORT, "127.0.0.1");
|
215790
215939
|
var getLocalPort = memoizeGetPort(DEFAULT_LOCAL_PORT, "localhost");
|
@@ -216017,7 +216166,7 @@ var ConfigController = class extends Controller {
|
|
216017
216166
|
persistent: true,
|
216018
216167
|
ignoreInitial: true
|
216019
216168
|
}).on("change", async (_event) => {
|
216020
|
-
logger.log(`${
|
216169
|
+
logger.log(`${import_node_path65.default.basename(configPath)} changed...`);
|
216021
216170
|
(0, import_node_assert25.default)(
|
216022
216171
|
this.latestInput,
|
216023
216172
|
"Cannot be watching config without having first set an input"
|
@@ -216341,19 +216490,19 @@ init_import_meta_url();
|
|
216341
216490
|
var import_node_assert26 = __toESM(require("node:assert"));
|
216342
216491
|
var import_node_crypto11 = require("node:crypto");
|
216343
216492
|
var import_node_events5 = __toESM(require("node:events"));
|
216344
|
-
var
|
216493
|
+
var import_node_path68 = __toESM(require("node:path"));
|
216345
216494
|
var import_miniflare20 = require("miniflare");
|
216346
216495
|
|
216347
216496
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
|
216348
216497
|
init_import_meta_url();
|
216349
|
-
var
|
216350
|
-
var scriptPath =
|
216498
|
+
var import_node_path66 = __toESM(require("node:path"));
|
216499
|
+
var scriptPath = import_node_path66.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
|
216351
216500
|
var InspectorProxyWorker_default = scriptPath;
|
216352
216501
|
|
216353
216502
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts
|
216354
216503
|
init_import_meta_url();
|
216355
|
-
var
|
216356
|
-
var scriptPath2 =
|
216504
|
+
var import_node_path67 = __toESM(require("node:path"));
|
216505
|
+
var scriptPath2 = import_node_path67.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
|
216357
216506
|
var ProxyWorker_default = scriptPath2;
|
216358
216507
|
|
216359
216508
|
// src/api/startDevWorker/ProxyController.ts
|
@@ -216385,7 +216534,7 @@ var ProxyController = class extends Controller {
|
|
216385
216534
|
name: "ProxyWorker",
|
216386
216535
|
compatibilityDate: "2023-12-18",
|
216387
216536
|
compatibilityFlags: ["nodejs_compat"],
|
216388
|
-
modulesRoot:
|
216537
|
+
modulesRoot: import_node_path68.default.dirname(ProxyWorker_default),
|
216389
216538
|
modules: [{ type: "ESModule", path: ProxyWorker_default }],
|
216390
216539
|
durableObjects: {
|
216391
216540
|
DURABLE_OBJECT: {
|
@@ -216414,7 +216563,7 @@ var ProxyController = class extends Controller {
|
|
216414
216563
|
"nodejs_compat",
|
216415
216564
|
"increase_websocket_message_size"
|
216416
216565
|
],
|
216417
|
-
modulesRoot:
|
216566
|
+
modulesRoot: import_node_path68.default.dirname(InspectorProxyWorker_default),
|
216418
216567
|
modules: [{ type: "ESModule", path: InspectorProxyWorker_default }],
|
216419
216568
|
durableObjects: {
|
216420
216569
|
DURABLE_OBJECT: {
|
@@ -217436,15 +217585,19 @@ function unstable_getMiniflareWorkerOptions(configPath, env7) {
|
|
217436
217585
|
);
|
217437
217586
|
}
|
217438
217587
|
if (bindings.durable_objects !== void 0) {
|
217588
|
+
const classNameToUseSQLite = getClassNamesWhichUseSQLite(config.migrations);
|
217439
217589
|
bindingOptions.durableObjects = Object.fromEntries(
|
217440
|
-
bindings.durable_objects.bindings.map((binding) =>
|
217441
|
-
binding.
|
217442
|
-
|
217443
|
-
|
217444
|
-
|
217445
|
-
|
217446
|
-
|
217447
|
-
|
217590
|
+
bindings.durable_objects.bindings.map((binding) => {
|
217591
|
+
const useSQLite = classNameToUseSQLite.get(binding.class_name);
|
217592
|
+
return [
|
217593
|
+
binding.name,
|
217594
|
+
{
|
217595
|
+
className: binding.class_name,
|
217596
|
+
scriptName: binding.script_name,
|
217597
|
+
useSQLite
|
217598
|
+
}
|
217599
|
+
];
|
217600
|
+
})
|
217448
217601
|
);
|
217449
217602
|
}
|
217450
217603
|
const legacyAssetPaths = config.legacy_assets ? getLegacyAssetPaths(config, void 0) : getSiteAssetPaths(config);
|