wrangler 3.93.0 → 3.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config-schema.json +156 -0
- package/package.json +4 -4
- package/wrangler-dist/cli.d.ts +46 -9
- package/wrangler-dist/cli.js +1969 -749
- package/wrangler-dist/cli.js.map +4 -4
package/wrangler-dist/cli.js
CHANGED
@@ -25115,7 +25115,7 @@ var require_number = __commonJS({
|
|
25115
25115
|
var figures = _require2.figures;
|
25116
25116
|
var clear = _require2.clear;
|
25117
25117
|
var lines = _require2.lines;
|
25118
|
-
var
|
25118
|
+
var isNumber2 = /[0-9]/;
|
25119
25119
|
var isDef = /* @__PURE__ */ __name((any) => any !== void 0, "isDef");
|
25120
25120
|
var round = /* @__PURE__ */ __name((number, precision) => {
|
25121
25121
|
let factor = Math.pow(10, precision);
|
@@ -25159,7 +25159,7 @@ var require_number = __commonJS({
|
|
25159
25159
|
return this.float ? parseFloat(x2) : parseInt(x2);
|
25160
25160
|
}
|
25161
25161
|
valid(c2) {
|
25162
|
-
return c2 === `-` || c2 === `.` && this.float ||
|
25162
|
+
return c2 === `-` || c2 === `.` && this.float || isNumber2.test(c2);
|
25163
25163
|
}
|
25164
25164
|
reset() {
|
25165
25165
|
this.typed = ``;
|
@@ -27623,7 +27623,7 @@ var require_number2 = __commonJS({
|
|
27623
27623
|
var Prompt = require_prompt2();
|
27624
27624
|
var { cursor, erase } = require_src();
|
27625
27625
|
var { style, figures, clear, lines } = require_util9();
|
27626
|
-
var
|
27626
|
+
var isNumber2 = /[0-9]/;
|
27627
27627
|
var isDef = /* @__PURE__ */ __name((any) => any !== void 0, "isDef");
|
27628
27628
|
var round = /* @__PURE__ */ __name((number, precision) => {
|
27629
27629
|
let factor = Math.pow(10, precision);
|
@@ -27667,7 +27667,7 @@ var require_number2 = __commonJS({
|
|
27667
27667
|
return this.float ? parseFloat(x2) : parseInt(x2);
|
27668
27668
|
}
|
27669
27669
|
valid(c2) {
|
27670
|
-
return c2 === `-` || c2 === `.` && this.float ||
|
27670
|
+
return c2 === `-` || c2 === `.` && this.float || isNumber2.test(c2);
|
27671
27671
|
}
|
27672
27672
|
reset() {
|
27673
27673
|
this.typed = ``;
|
@@ -30343,139 +30343,6 @@ var require_resolve = __commonJS({
|
|
30343
30343
|
}
|
30344
30344
|
});
|
30345
30345
|
|
30346
|
-
// ../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js
|
30347
|
-
var supports_color_exports = {};
|
30348
|
-
__export(supports_color_exports, {
|
30349
|
-
createSupportsColor: () => createSupportsColor2,
|
30350
|
-
default: () => supports_color_default2
|
30351
|
-
});
|
30352
|
-
function hasFlag2(flag, argv = import_node_process7.default.argv) {
|
30353
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
30354
|
-
const position = argv.indexOf(prefix + flag);
|
30355
|
-
const terminatorPosition = argv.indexOf("--");
|
30356
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
30357
|
-
}
|
30358
|
-
function envForceColor2() {
|
30359
|
-
if ("FORCE_COLOR" in env3) {
|
30360
|
-
if (env3.FORCE_COLOR === "true") {
|
30361
|
-
return 1;
|
30362
|
-
}
|
30363
|
-
if (env3.FORCE_COLOR === "false") {
|
30364
|
-
return 0;
|
30365
|
-
}
|
30366
|
-
return env3.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env3.FORCE_COLOR, 10), 3);
|
30367
|
-
}
|
30368
|
-
}
|
30369
|
-
function translateLevel2(level) {
|
30370
|
-
if (level === 0) {
|
30371
|
-
return false;
|
30372
|
-
}
|
30373
|
-
return {
|
30374
|
-
level,
|
30375
|
-
hasBasic: true,
|
30376
|
-
has256: level >= 2,
|
30377
|
-
has16m: level >= 3
|
30378
|
-
};
|
30379
|
-
}
|
30380
|
-
function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
30381
|
-
const noFlagForceColor = envForceColor2();
|
30382
|
-
if (noFlagForceColor !== void 0) {
|
30383
|
-
flagForceColor2 = noFlagForceColor;
|
30384
|
-
}
|
30385
|
-
const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
|
30386
|
-
if (forceColor === 0) {
|
30387
|
-
return 0;
|
30388
|
-
}
|
30389
|
-
if (sniffFlags) {
|
30390
|
-
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
|
30391
|
-
return 3;
|
30392
|
-
}
|
30393
|
-
if (hasFlag2("color=256")) {
|
30394
|
-
return 2;
|
30395
|
-
}
|
30396
|
-
}
|
30397
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
30398
|
-
return 0;
|
30399
|
-
}
|
30400
|
-
const min = forceColor || 0;
|
30401
|
-
if (env3.TERM === "dumb") {
|
30402
|
-
return min;
|
30403
|
-
}
|
30404
|
-
if (import_node_process7.default.platform === "win32") {
|
30405
|
-
const osRelease = import_node_os3.default.release().split(".");
|
30406
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
30407
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
30408
|
-
}
|
30409
|
-
return 1;
|
30410
|
-
}
|
30411
|
-
if ("CI" in env3) {
|
30412
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env3) || env3.CI_NAME === "codeship") {
|
30413
|
-
return 1;
|
30414
|
-
}
|
30415
|
-
return min;
|
30416
|
-
}
|
30417
|
-
if ("TEAMCITY_VERSION" in env3) {
|
30418
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env3.TEAMCITY_VERSION) ? 1 : 0;
|
30419
|
-
}
|
30420
|
-
if ("TF_BUILD" in env3 && "AGENT_NAME" in env3) {
|
30421
|
-
return 1;
|
30422
|
-
}
|
30423
|
-
if (env3.COLORTERM === "truecolor") {
|
30424
|
-
return 3;
|
30425
|
-
}
|
30426
|
-
if ("TERM_PROGRAM" in env3) {
|
30427
|
-
const version4 = Number.parseInt((env3.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
30428
|
-
switch (env3.TERM_PROGRAM) {
|
30429
|
-
case "iTerm.app":
|
30430
|
-
return version4 >= 3 ? 3 : 2;
|
30431
|
-
case "Apple_Terminal":
|
30432
|
-
return 2;
|
30433
|
-
}
|
30434
|
-
}
|
30435
|
-
if (/-256(color)?$/i.test(env3.TERM)) {
|
30436
|
-
return 2;
|
30437
|
-
}
|
30438
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env3.TERM)) {
|
30439
|
-
return 1;
|
30440
|
-
}
|
30441
|
-
if ("COLORTERM" in env3) {
|
30442
|
-
return 1;
|
30443
|
-
}
|
30444
|
-
return min;
|
30445
|
-
}
|
30446
|
-
function createSupportsColor2(stream2, options30 = {}) {
|
30447
|
-
const level = _supportsColor2(stream2, {
|
30448
|
-
streamIsTTY: stream2 && stream2.isTTY,
|
30449
|
-
...options30
|
30450
|
-
});
|
30451
|
-
return translateLevel2(level);
|
30452
|
-
}
|
30453
|
-
var import_node_process7, import_node_os3, import_node_tty3, env3, flagForceColor2, supportsColor2, supports_color_default2;
|
30454
|
-
var init_supports_color = __esm({
|
30455
|
-
"../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js"() {
|
30456
|
-
init_import_meta_url();
|
30457
|
-
import_node_process7 = __toESM(require("node:process"), 1);
|
30458
|
-
import_node_os3 = __toESM(require("node:os"), 1);
|
30459
|
-
import_node_tty3 = __toESM(require("node:tty"), 1);
|
30460
|
-
__name(hasFlag2, "hasFlag");
|
30461
|
-
({ env: env3 } = import_node_process7.default);
|
30462
|
-
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
30463
|
-
flagForceColor2 = 0;
|
30464
|
-
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
30465
|
-
flagForceColor2 = 1;
|
30466
|
-
}
|
30467
|
-
__name(envForceColor2, "envForceColor");
|
30468
|
-
__name(translateLevel2, "translateLevel");
|
30469
|
-
__name(_supportsColor2, "_supportsColor");
|
30470
|
-
__name(createSupportsColor2, "createSupportsColor");
|
30471
|
-
supportsColor2 = {
|
30472
|
-
stdout: createSupportsColor2({ isTTY: import_node_tty3.default.isatty(1) }),
|
30473
|
-
stderr: createSupportsColor2({ isTTY: import_node_tty3.default.isatty(2) })
|
30474
|
-
};
|
30475
|
-
supports_color_default2 = supportsColor2;
|
30476
|
-
}
|
30477
|
-
});
|
30478
|
-
|
30479
30346
|
// ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
|
30480
30347
|
var require_ini = __commonJS({
|
30481
30348
|
"../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports2) {
|
@@ -30930,7 +30797,7 @@ var require_minimist = __commonJS({
|
|
30930
30797
|
if (flags2.unknownFn(arg2) === false)
|
30931
30798
|
return;
|
30932
30799
|
}
|
30933
|
-
var value2 = !flags2.strings[key2] &&
|
30800
|
+
var value2 = !flags2.strings[key2] && isNumber2(val) ? Number(val) : val;
|
30934
30801
|
setKey(argv, key2.split("."), value2);
|
30935
30802
|
(aliases2[key2] || []).forEach(function(x2) {
|
30936
30803
|
setKey(argv, x2.split("."), value2);
|
@@ -31040,7 +30907,7 @@ var require_minimist = __commonJS({
|
|
31040
30907
|
} else {
|
31041
30908
|
if (!flags2.unknownFn || flags2.unknownFn(arg) !== false) {
|
31042
30909
|
argv._.push(
|
31043
|
-
flags2.strings["_"] || !
|
30910
|
+
flags2.strings["_"] || !isNumber2(arg) ? arg : Number(arg)
|
31044
30911
|
);
|
31045
30912
|
}
|
31046
30913
|
if (opts.stopEarly) {
|
@@ -31078,14 +30945,14 @@ var require_minimist = __commonJS({
|
|
31078
30945
|
return key in o;
|
31079
30946
|
}
|
31080
30947
|
__name(hasKey2, "hasKey");
|
31081
|
-
function
|
30948
|
+
function isNumber2(x2) {
|
31082
30949
|
if (typeof x2 === "number")
|
31083
30950
|
return true;
|
31084
30951
|
if (/^0x[0-9a-f]+$/i.test(x2))
|
31085
30952
|
return true;
|
31086
30953
|
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x2);
|
31087
30954
|
}
|
31088
|
-
__name(
|
30955
|
+
__name(isNumber2, "isNumber");
|
31089
30956
|
function isConstructorOrProto(obj, key) {
|
31090
30957
|
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
31091
30958
|
}
|
@@ -37063,9 +36930,9 @@ var init_path_key = __esm({
|
|
37063
36930
|
// ../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
|
37064
36931
|
function npmRunPath(options30 = {}) {
|
37065
36932
|
const {
|
37066
|
-
cwd: cwd2 =
|
37067
|
-
path: path_ =
|
37068
|
-
execPath =
|
36933
|
+
cwd: cwd2 = import_node_process7.default.cwd(),
|
36934
|
+
path: path_ = import_node_process7.default.env[pathKey()],
|
36935
|
+
execPath = import_node_process7.default.execPath
|
37069
36936
|
} = options30;
|
37070
36937
|
let previous;
|
37071
36938
|
const cwdString = cwd2 instanceof URL ? import_node_url8.default.fileURLToPath(cwd2) : cwd2;
|
@@ -37079,18 +36946,18 @@ function npmRunPath(options30 = {}) {
|
|
37079
36946
|
result.push(import_node_path25.default.resolve(cwdString, execPath, ".."));
|
37080
36947
|
return [...result, path_].join(import_node_path25.default.delimiter);
|
37081
36948
|
}
|
37082
|
-
function npmRunPathEnv({ env: env6 =
|
36949
|
+
function npmRunPathEnv({ env: env6 = import_node_process7.default.env, ...options30 } = {}) {
|
37083
36950
|
env6 = { ...env6 };
|
37084
36951
|
const path70 = pathKey({ env: env6 });
|
37085
36952
|
options30.path = env6[path70];
|
37086
36953
|
env6[path70] = npmRunPath(options30);
|
37087
36954
|
return env6;
|
37088
36955
|
}
|
37089
|
-
var
|
36956
|
+
var import_node_process7, import_node_path25, import_node_url8;
|
37090
36957
|
var init_npm_run_path = __esm({
|
37091
36958
|
"../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js"() {
|
37092
36959
|
init_import_meta_url();
|
37093
|
-
|
36960
|
+
import_node_process7 = __toESM(require("node:process"), 1);
|
37094
36961
|
import_node_path25 = __toESM(require("node:path"), 1);
|
37095
36962
|
import_node_url8 = __toESM(require("node:url"), 1);
|
37096
36963
|
init_path_key();
|
@@ -37684,11 +37551,11 @@ var init_stdio = __esm({
|
|
37684
37551
|
});
|
37685
37552
|
|
37686
37553
|
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
|
37687
|
-
var
|
37554
|
+
var import_node_os4, import_signal_exit4, DEFAULT_FORCE_KILL_TIMEOUT, spawnedKill, setKillTimeout, shouldForceKill, isSigterm, getForceKillAfterTimeout, spawnedCancel, timeoutKill, setupTimeout, validateTimeout, setExitHandler;
|
37688
37555
|
var init_kill = __esm({
|
37689
37556
|
"../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js"() {
|
37690
37557
|
init_import_meta_url();
|
37691
|
-
|
37558
|
+
import_node_os4 = __toESM(require("node:os"), 1);
|
37692
37559
|
import_signal_exit4 = __toESM(require_signal_exit(), 1);
|
37693
37560
|
DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
37694
37561
|
spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options30 = {}) => {
|
@@ -37709,7 +37576,7 @@ var init_kill = __esm({
|
|
37709
37576
|
}
|
37710
37577
|
}, "setKillTimeout");
|
37711
37578
|
shouldForceKill = /* @__PURE__ */ __name((signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult, "shouldForceKill");
|
37712
|
-
isSigterm = /* @__PURE__ */ __name((signal) => signal ===
|
37579
|
+
isSigterm = /* @__PURE__ */ __name((signal) => signal === import_node_os4.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM", "isSigterm");
|
37713
37580
|
getForceKillAfterTimeout = /* @__PURE__ */ __name(({ forceKillAfterTimeout = true }) => {
|
37714
37581
|
if (forceKillAfterTimeout === true) {
|
37715
37582
|
return DEFAULT_FORCE_KILL_TIMEOUT;
|
@@ -38204,14 +38071,14 @@ function execaCommandSync(command2, options30) {
|
|
38204
38071
|
const [file, ...args] = parseCommand(command2);
|
38205
38072
|
return execaSync(file, args, options30);
|
38206
38073
|
}
|
38207
|
-
var import_node_buffer2, import_node_path26, import_node_child_process2,
|
38074
|
+
var import_node_buffer2, import_node_path26, import_node_child_process2, import_node_process8, import_cross_spawn, DEFAULT_MAX_BUFFER, getEnv, handleArguments, handleOutput;
|
38208
38075
|
var init_execa = __esm({
|
38209
38076
|
"../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js"() {
|
38210
38077
|
init_import_meta_url();
|
38211
38078
|
import_node_buffer2 = require("node:buffer");
|
38212
38079
|
import_node_path26 = __toESM(require("node:path"), 1);
|
38213
38080
|
import_node_child_process2 = __toESM(require("node:child_process"), 1);
|
38214
|
-
|
38081
|
+
import_node_process8 = __toESM(require("node:process"), 1);
|
38215
38082
|
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
38216
38083
|
init_strip_final_newline();
|
38217
38084
|
init_npm_run_path();
|
@@ -38224,7 +38091,7 @@ var init_execa = __esm({
|
|
38224
38091
|
init_command();
|
38225
38092
|
DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
38226
38093
|
getEnv = /* @__PURE__ */ __name(({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
38227
|
-
const env6 = extendEnv ? { ...
|
38094
|
+
const env6 = extendEnv ? { ...import_node_process8.default.env, ...envOption } : envOption;
|
38228
38095
|
if (preferLocal) {
|
38229
38096
|
return npmRunPathEnv({ env: env6, cwd: localDir, execPath });
|
38230
38097
|
}
|
@@ -38241,8 +38108,8 @@ var init_execa = __esm({
|
|
38241
38108
|
stripFinalNewline: true,
|
38242
38109
|
extendEnv: true,
|
38243
38110
|
preferLocal: false,
|
38244
|
-
localDir: options30.cwd ||
|
38245
|
-
execPath:
|
38111
|
+
localDir: options30.cwd || import_node_process8.default.cwd(),
|
38112
|
+
execPath: import_node_process8.default.execPath,
|
38246
38113
|
encoding: "utf8",
|
38247
38114
|
reject: true,
|
38248
38115
|
cleanup: true,
|
@@ -38252,7 +38119,7 @@ var init_execa = __esm({
|
|
38252
38119
|
};
|
38253
38120
|
options30.env = getEnv(options30);
|
38254
38121
|
options30.stdio = normalizeStdio(options30);
|
38255
|
-
if (
|
38122
|
+
if (import_node_process8.default.platform === "win32" && import_node_path26.default.basename(file, ".exe") === "cmd") {
|
38256
38123
|
args.unshift("/q");
|
38257
38124
|
}
|
38258
38125
|
return { file, args, options: options30, parsed };
|
@@ -53641,7 +53508,7 @@ var require_object_inspect = __commonJS({
|
|
53641
53508
|
if (isWeakRef(obj)) {
|
53642
53509
|
return weakCollectionOf("WeakRef");
|
53643
53510
|
}
|
53644
|
-
if (
|
53511
|
+
if (isNumber2(obj)) {
|
53645
53512
|
return markBoxed(inspect2(Number(obj)));
|
53646
53513
|
}
|
53647
53514
|
if (isBigInt(obj)) {
|
@@ -53699,10 +53566,10 @@ var require_object_inspect = __commonJS({
|
|
53699
53566
|
return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
53700
53567
|
}
|
53701
53568
|
__name(isString4, "isString");
|
53702
|
-
function
|
53569
|
+
function isNumber2(obj) {
|
53703
53570
|
return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
53704
53571
|
}
|
53705
|
-
__name(
|
53572
|
+
__name(isNumber2, "isNumber");
|
53706
53573
|
function isBoolean3(obj) {
|
53707
53574
|
return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
53708
53575
|
}
|
@@ -62020,8 +61887,8 @@ var require_util10 = __commonJS({
|
|
62020
61887
|
return "'" + escapeQuotes(str) + "'";
|
62021
61888
|
}
|
62022
61889
|
__name(toQuotedString, "toQuotedString");
|
62023
|
-
function getPathExpr(currentPath, expr, jsonPointers,
|
62024
|
-
var path70 = jsonPointers ? "'/' + " + expr + (
|
61890
|
+
function getPathExpr(currentPath, expr, jsonPointers, isNumber2) {
|
61891
|
+
var path70 = jsonPointers ? "'/' + " + expr + (isNumber2 ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber2 ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
|
62025
61892
|
return joinPaths(currentPath, path70);
|
62026
61893
|
}
|
62027
61894
|
__name(getPathExpr, "getPathExpr");
|
@@ -71416,7 +71283,7 @@ var require_tokenize = __commonJS({
|
|
71416
71283
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
71417
71284
|
exports2.tokenize = void 0;
|
71418
71285
|
var TokenRule = /(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g;
|
71419
|
-
var
|
71286
|
+
var tokenize2 = /* @__PURE__ */ __name((subject) => {
|
71420
71287
|
let matchResult;
|
71421
71288
|
const tokens = [];
|
71422
71289
|
let argumentIndex = 0;
|
@@ -71467,7 +71334,7 @@ var require_tokenize = __commonJS({
|
|
71467
71334
|
}
|
71468
71335
|
return tokens;
|
71469
71336
|
}, "tokenize");
|
71470
|
-
exports2.tokenize =
|
71337
|
+
exports2.tokenize = tokenize2;
|
71471
71338
|
}
|
71472
71339
|
});
|
71473
71340
|
|
@@ -77267,18 +77134,18 @@ ${JSON.stringify(paths)}`);
|
|
77267
77134
|
return tempPath;
|
77268
77135
|
}
|
77269
77136
|
}
|
77270
|
-
var
|
77137
|
+
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;
|
77271
77138
|
var init_lib = __esm({
|
77272
77139
|
"../../node_modules/.pnpm/npx-import@1.1.4/node_modules/npx-import/lib/index.js"() {
|
77273
77140
|
init_import_meta_url();
|
77274
|
-
|
77141
|
+
import_node_os6 = __toESM(require("node:os"), 1);
|
77275
77142
|
import_node_path34 = __toESM(require("node:path"), 1);
|
77276
77143
|
import_semver = __toESM(require_semver2(), 1);
|
77277
77144
|
init_dist();
|
77278
77145
|
init_execa();
|
77279
77146
|
import_validate_npm_package_name = __toESM(require_lib5(), 1);
|
77280
77147
|
init_utils();
|
77281
|
-
WINDOWS =
|
77148
|
+
WINDOWS = import_node_os6.default.platform() === "win32";
|
77282
77149
|
NOT_IMPORTABLE = Symbol();
|
77283
77150
|
INSTALLED_LOCALLY = Symbol();
|
77284
77151
|
INSTALL_CACHE = {};
|
@@ -77774,7 +77641,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
77774
77641
|
}
|
77775
77642
|
}, "ThrowingEventTarget");
|
77776
77643
|
var import_path22 = __toModule(require("path"));
|
77777
|
-
var
|
77644
|
+
var import_colors19 = __toModule(require_colors2());
|
77778
77645
|
var cwd2 = process.cwd();
|
77779
77646
|
var cwdNodeModules = import_path22.default.join(cwd2, "node_modules");
|
77780
77647
|
var LogLevel3;
|
@@ -77795,16 +77662,16 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
77795
77662
|
[5]: "vrb"
|
77796
77663
|
};
|
77797
77664
|
var LEVEL_COLOUR = {
|
77798
|
-
[0]:
|
77799
|
-
[1]:
|
77800
|
-
[2]:
|
77801
|
-
[3]:
|
77802
|
-
[4]:
|
77803
|
-
[5]: (input) => (0,
|
77665
|
+
[0]: import_colors19.reset,
|
77666
|
+
[1]: import_colors19.red,
|
77667
|
+
[2]: import_colors19.yellow,
|
77668
|
+
[3]: import_colors19.green,
|
77669
|
+
[4]: import_colors19.grey,
|
77670
|
+
[5]: (input) => (0, import_colors19.dim)((0, import_colors19.grey)(input))
|
77804
77671
|
};
|
77805
77672
|
function dimInternalStackLine(line) {
|
77806
77673
|
if (line.startsWith(" at") && (!line.includes(cwd2) || line.includes(cwdNodeModules))) {
|
77807
|
-
return (0,
|
77674
|
+
return (0, import_colors19.dim)(line);
|
77808
77675
|
}
|
77809
77676
|
return line;
|
77810
77677
|
}
|
@@ -100510,15 +100377,15 @@ var require_stringify3 = __commonJS({
|
|
100510
100377
|
return value.toISOString();
|
100511
100378
|
}
|
100512
100379
|
__name(stringifyDatetime, "stringifyDatetime");
|
100513
|
-
function
|
100380
|
+
function isNumber2(type) {
|
100514
100381
|
return type === "float" || type === "integer";
|
100515
100382
|
}
|
100516
|
-
__name(
|
100383
|
+
__name(isNumber2, "isNumber");
|
100517
100384
|
function arrayType2(values) {
|
100518
100385
|
var contentType = tomlType2(values[0]);
|
100519
100386
|
if (values.every((_3) => tomlType2(_3) === contentType))
|
100520
100387
|
return contentType;
|
100521
|
-
if (values.every((_3) =>
|
100388
|
+
if (values.every((_3) => isNumber2(tomlType2(_3))))
|
100522
100389
|
return "float";
|
100523
100390
|
return "mixed";
|
100524
100391
|
}
|
@@ -101339,7 +101206,7 @@ var require_src8 = __commonJS({
|
|
101339
101206
|
var import_web3 = __toModule(require("stream/web"));
|
101340
101207
|
var import_url9 = __toModule(require("url"));
|
101341
101208
|
var import_shared5 = __toModule(require_src6());
|
101342
|
-
var
|
101209
|
+
var import_colors19 = __toModule(require_colors2());
|
101343
101210
|
var import_set_cookie_parser = __toModule(require_set_cookie());
|
101344
101211
|
var import_undici28 = __toModule(require_undici2());
|
101345
101212
|
var import_web22 = __toModule(require("stream/web"));
|
@@ -102160,12 +102027,12 @@ var require_src8 = __commonJS({
|
|
102160
102027
|
__name(millisFromCPUTime, "millisFromCPUTime");
|
102161
102028
|
function colourFromHTTPStatus(status2) {
|
102162
102029
|
if (200 <= status2 && status2 < 300)
|
102163
|
-
return
|
102030
|
+
return import_colors19.green;
|
102164
102031
|
if (400 <= status2 && status2 < 500)
|
102165
|
-
return
|
102032
|
+
return import_colors19.yellow;
|
102166
102033
|
if (500 <= status2)
|
102167
|
-
return
|
102168
|
-
return
|
102034
|
+
return import_colors19.red;
|
102035
|
+
return import_colors19.blue;
|
102169
102036
|
}
|
102170
102037
|
__name(colourFromHTTPStatus, "colourFromHTTPStatus");
|
102171
102038
|
async function logResponse(log2, {
|
@@ -102180,7 +102047,7 @@ var require_src8 = __commonJS({
|
|
102180
102047
|
const responseTime = millisFromHRTime(process.hrtime(start));
|
102181
102048
|
if (startCpu !== void 0) {
|
102182
102049
|
const responseTimeCpu = millisFromCPUTime(process.cpuUsage(startCpu).user);
|
102183
|
-
cpuParts.push((0,
|
102050
|
+
cpuParts.push((0, import_colors19.dim)((0, import_colors19.grey)(` (CPU: ~${responseTimeCpu}`)));
|
102184
102051
|
}
|
102185
102052
|
let waitUntilResponse;
|
102186
102053
|
try {
|
@@ -102193,16 +102060,16 @@ var require_src8 = __commonJS({
|
|
102193
102060
|
if (startCpu !== void 0) {
|
102194
102061
|
if (waitUntilResponse?.length) {
|
102195
102062
|
const waitUntilTimeCpu = millisFromCPUTime(process.cpuUsage(startCpu).user);
|
102196
|
-
cpuParts.push((0,
|
102063
|
+
cpuParts.push((0, import_colors19.dim)((0, import_colors19.grey)(`, waitUntil: ~${waitUntilTimeCpu}`)));
|
102197
102064
|
}
|
102198
|
-
cpuParts.push((0,
|
102065
|
+
cpuParts.push((0, import_colors19.dim)((0, import_colors19.grey)(")")));
|
102199
102066
|
}
|
102200
102067
|
log2.log([
|
102201
|
-
`${(0,
|
102202
|
-
status2 ? colourFromHTTPStatus(status2)(`${(0,
|
102203
|
-
(0,
|
102204
|
-
waitUntilResponse?.length ? (0,
|
102205
|
-
(0,
|
102068
|
+
`${(0, import_colors19.bold)(method)} ${url4} `,
|
102069
|
+
status2 ? colourFromHTTPStatus(status2)(`${(0, import_colors19.bold)(status2)} ${import_http5.default.STATUS_CODES[status2]} `) : "",
|
102070
|
+
(0, import_colors19.grey)(`(${responseTime}`),
|
102071
|
+
waitUntilResponse?.length ? (0, import_colors19.grey)(`, waitUntil: ${waitUntilTime}`) : "",
|
102072
|
+
(0, import_colors19.grey)(")"),
|
102206
102073
|
...cpuParts
|
102207
102074
|
].join(""));
|
102208
102075
|
}
|
@@ -106506,6 +106373,139 @@ var init_assets = __esm({
|
|
106506
106373
|
}
|
106507
106374
|
});
|
106508
106375
|
|
106376
|
+
// ../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js
|
106377
|
+
var supports_color_exports = {};
|
106378
|
+
__export(supports_color_exports, {
|
106379
|
+
createSupportsColor: () => createSupportsColor2,
|
106380
|
+
default: () => supports_color_default2
|
106381
|
+
});
|
106382
|
+
function hasFlag2(flag, argv = import_node_process11.default.argv) {
|
106383
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
106384
|
+
const position = argv.indexOf(prefix + flag);
|
106385
|
+
const terminatorPosition = argv.indexOf("--");
|
106386
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
106387
|
+
}
|
106388
|
+
function envForceColor2() {
|
106389
|
+
if ("FORCE_COLOR" in env5) {
|
106390
|
+
if (env5.FORCE_COLOR === "true") {
|
106391
|
+
return 1;
|
106392
|
+
}
|
106393
|
+
if (env5.FORCE_COLOR === "false") {
|
106394
|
+
return 0;
|
106395
|
+
}
|
106396
|
+
return env5.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env5.FORCE_COLOR, 10), 3);
|
106397
|
+
}
|
106398
|
+
}
|
106399
|
+
function translateLevel2(level) {
|
106400
|
+
if (level === 0) {
|
106401
|
+
return false;
|
106402
|
+
}
|
106403
|
+
return {
|
106404
|
+
level,
|
106405
|
+
hasBasic: true,
|
106406
|
+
has256: level >= 2,
|
106407
|
+
has16m: level >= 3
|
106408
|
+
};
|
106409
|
+
}
|
106410
|
+
function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
106411
|
+
const noFlagForceColor = envForceColor2();
|
106412
|
+
if (noFlagForceColor !== void 0) {
|
106413
|
+
flagForceColor2 = noFlagForceColor;
|
106414
|
+
}
|
106415
|
+
const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
|
106416
|
+
if (forceColor === 0) {
|
106417
|
+
return 0;
|
106418
|
+
}
|
106419
|
+
if (sniffFlags) {
|
106420
|
+
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
|
106421
|
+
return 3;
|
106422
|
+
}
|
106423
|
+
if (hasFlag2("color=256")) {
|
106424
|
+
return 2;
|
106425
|
+
}
|
106426
|
+
}
|
106427
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
106428
|
+
return 0;
|
106429
|
+
}
|
106430
|
+
const min = forceColor || 0;
|
106431
|
+
if (env5.TERM === "dumb") {
|
106432
|
+
return min;
|
106433
|
+
}
|
106434
|
+
if (import_node_process11.default.platform === "win32") {
|
106435
|
+
const osRelease = import_node_os7.default.release().split(".");
|
106436
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
106437
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
106438
|
+
}
|
106439
|
+
return 1;
|
106440
|
+
}
|
106441
|
+
if ("CI" in env5) {
|
106442
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env5) || env5.CI_NAME === "codeship") {
|
106443
|
+
return 1;
|
106444
|
+
}
|
106445
|
+
return min;
|
106446
|
+
}
|
106447
|
+
if ("TEAMCITY_VERSION" in env5) {
|
106448
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env5.TEAMCITY_VERSION) ? 1 : 0;
|
106449
|
+
}
|
106450
|
+
if ("TF_BUILD" in env5 && "AGENT_NAME" in env5) {
|
106451
|
+
return 1;
|
106452
|
+
}
|
106453
|
+
if (env5.COLORTERM === "truecolor") {
|
106454
|
+
return 3;
|
106455
|
+
}
|
106456
|
+
if ("TERM_PROGRAM" in env5) {
|
106457
|
+
const version4 = Number.parseInt((env5.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
106458
|
+
switch (env5.TERM_PROGRAM) {
|
106459
|
+
case "iTerm.app":
|
106460
|
+
return version4 >= 3 ? 3 : 2;
|
106461
|
+
case "Apple_Terminal":
|
106462
|
+
return 2;
|
106463
|
+
}
|
106464
|
+
}
|
106465
|
+
if (/-256(color)?$/i.test(env5.TERM)) {
|
106466
|
+
return 2;
|
106467
|
+
}
|
106468
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env5.TERM)) {
|
106469
|
+
return 1;
|
106470
|
+
}
|
106471
|
+
if ("COLORTERM" in env5) {
|
106472
|
+
return 1;
|
106473
|
+
}
|
106474
|
+
return min;
|
106475
|
+
}
|
106476
|
+
function createSupportsColor2(stream2, options30 = {}) {
|
106477
|
+
const level = _supportsColor2(stream2, {
|
106478
|
+
streamIsTTY: stream2 && stream2.isTTY,
|
106479
|
+
...options30
|
106480
|
+
});
|
106481
|
+
return translateLevel2(level);
|
106482
|
+
}
|
106483
|
+
var import_node_process11, import_node_os7, import_node_tty3, env5, flagForceColor2, supportsColor2, supports_color_default2;
|
106484
|
+
var init_supports_color = __esm({
|
106485
|
+
"../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js"() {
|
106486
|
+
init_import_meta_url();
|
106487
|
+
import_node_process11 = __toESM(require("node:process"), 1);
|
106488
|
+
import_node_os7 = __toESM(require("node:os"), 1);
|
106489
|
+
import_node_tty3 = __toESM(require("node:tty"), 1);
|
106490
|
+
__name(hasFlag2, "hasFlag");
|
106491
|
+
({ env: env5 } = import_node_process11.default);
|
106492
|
+
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
106493
|
+
flagForceColor2 = 0;
|
106494
|
+
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
106495
|
+
flagForceColor2 = 1;
|
106496
|
+
}
|
106497
|
+
__name(envForceColor2, "envForceColor");
|
106498
|
+
__name(translateLevel2, "translateLevel");
|
106499
|
+
__name(_supportsColor2, "_supportsColor");
|
106500
|
+
__name(createSupportsColor2, "createSupportsColor");
|
106501
|
+
supportsColor2 = {
|
106502
|
+
stdout: createSupportsColor2({ isTTY: import_node_tty3.default.isatty(1) }),
|
106503
|
+
stderr: createSupportsColor2({ isTTY: import_node_tty3.default.isatty(2) })
|
106504
|
+
};
|
106505
|
+
supports_color_default2 = supportsColor2;
|
106506
|
+
}
|
106507
|
+
});
|
106508
|
+
|
106509
106509
|
// ../../node_modules/.pnpm/md5-file@5.0.0/node_modules/md5-file/index.js
|
106510
106510
|
var require_md5_file = __commonJS({
|
106511
106511
|
"../../node_modules/.pnpm/md5-file@5.0.0/node_modules/md5-file/index.js"(exports2, module3) {
|
@@ -110657,7 +110657,7 @@ var import_undici3 = __toESM(require_undici());
|
|
110657
110657
|
|
110658
110658
|
// package.json
|
110659
110659
|
var name = "wrangler";
|
110660
|
-
var version = "3.
|
110660
|
+
var version = "3.95.0";
|
110661
110661
|
|
110662
110662
|
// src/environment-variables/misc-variables.ts
|
110663
110663
|
init_import_meta_url();
|
@@ -112218,6 +112218,227 @@ var import_node_fs3 = __toESM(require("node:fs"));
|
|
112218
112218
|
var import_toml3 = __toESM(require_toml());
|
112219
112219
|
var import_dotenv = __toESM(require_main2());
|
112220
112220
|
|
112221
|
+
// src/experimental-flags.ts
|
112222
|
+
init_import_meta_url();
|
112223
|
+
var import_async_hooks = require("async_hooks");
|
112224
|
+
var flags = new import_async_hooks.AsyncLocalStorage();
|
112225
|
+
var run = /* @__PURE__ */ __name((flagValues, cb) => flags.run(flagValues, cb), "run");
|
112226
|
+
var getFlag = /* @__PURE__ */ __name((flag) => {
|
112227
|
+
const store = flags.getStore();
|
112228
|
+
if (store === void 0) {
|
112229
|
+
logger.debug("No experimental flag store instantiated");
|
112230
|
+
}
|
112231
|
+
const value = flags.getStore()?.[flag];
|
112232
|
+
if (value === void 0) {
|
112233
|
+
logger.debug(
|
112234
|
+
`Attempted to use flag "${flag}" which has not been instantiated`
|
112235
|
+
);
|
112236
|
+
}
|
112237
|
+
return value;
|
112238
|
+
}, "getFlag");
|
112239
|
+
|
112240
|
+
// src/pages/errors.ts
|
112241
|
+
init_import_meta_url();
|
112242
|
+
|
112243
|
+
// src/pages/constants.ts
|
112244
|
+
init_import_meta_url();
|
112245
|
+
var isWindows = process.platform === "win32";
|
112246
|
+
var MAX_ASSET_COUNT = 2e4;
|
112247
|
+
var MAX_ASSET_SIZE = 25 * 1024 * 1024;
|
112248
|
+
var PAGES_CONFIG_CACHE_FILENAME = "pages.json";
|
112249
|
+
var MAX_BUCKET_SIZE = 40 * 1024 * 1024;
|
112250
|
+
var MAX_BUCKET_FILE_COUNT = isWindows ? 1e3 : 2e3;
|
112251
|
+
var BULK_UPLOAD_CONCURRENCY = 3;
|
112252
|
+
var MAX_UPLOAD_ATTEMPTS = 5;
|
112253
|
+
var MAX_UPLOAD_GATEWAY_ERRORS = 5;
|
112254
|
+
var MAX_DEPLOYMENT_ATTEMPTS = 3;
|
112255
|
+
var MAX_DEPLOYMENT_STATUS_ATTEMPTS = 5;
|
112256
|
+
var MAX_CHECK_MISSING_ATTEMPTS = 5;
|
112257
|
+
var SECONDS_TO_WAIT_FOR_PROXY = 5;
|
112258
|
+
var MAX_FUNCTIONS_ROUTES_RULES = 100;
|
112259
|
+
var MAX_FUNCTIONS_ROUTES_RULE_LENGTH = 100;
|
112260
|
+
var ROUTES_SPEC_VERSION = 1;
|
112261
|
+
var ROUTES_SPEC_DESCRIPTION = `Generated by wrangler@${version}`;
|
112262
|
+
|
112263
|
+
// src/pages/functions/routes-validation.ts
|
112264
|
+
init_import_meta_url();
|
112265
|
+
function isRoutesJSONSpec(data) {
|
112266
|
+
return typeof data === "object" && data && "version" in data && typeof data.version === "number" && data.version === ROUTES_SPEC_VERSION && Array.isArray(data.include) && Array.isArray(data.exclude) || false;
|
112267
|
+
}
|
112268
|
+
__name(isRoutesJSONSpec, "isRoutesJSONSpec");
|
112269
|
+
function validateRoutes(routesJSON, routesPath) {
|
112270
|
+
if (!isRoutesJSONSpec(routesJSON)) {
|
112271
|
+
throw new FatalError(
|
112272
|
+
getRoutesValidationErrorMessage(
|
112273
|
+
0 /* INVALID_JSON_SPEC */,
|
112274
|
+
routesPath
|
112275
|
+
),
|
112276
|
+
1
|
112277
|
+
);
|
112278
|
+
}
|
112279
|
+
if (!hasIncludeRules(routesJSON)) {
|
112280
|
+
throw new FatalError(
|
112281
|
+
getRoutesValidationErrorMessage(
|
112282
|
+
1 /* NO_INCLUDE_RULES */,
|
112283
|
+
routesPath
|
112284
|
+
),
|
112285
|
+
1
|
112286
|
+
);
|
112287
|
+
}
|
112288
|
+
if (!hasValidRulesCount(routesJSON)) {
|
112289
|
+
throw new FatalError(
|
112290
|
+
getRoutesValidationErrorMessage(
|
112291
|
+
3 /* TOO_MANY_RULES */,
|
112292
|
+
routesPath
|
112293
|
+
),
|
112294
|
+
1
|
112295
|
+
);
|
112296
|
+
}
|
112297
|
+
if (!hasValidRuleCharCount(routesJSON)) {
|
112298
|
+
throw new FatalError(
|
112299
|
+
getRoutesValidationErrorMessage(
|
112300
|
+
4 /* RULE_TOO_LONG */,
|
112301
|
+
routesPath
|
112302
|
+
),
|
112303
|
+
1
|
112304
|
+
);
|
112305
|
+
}
|
112306
|
+
if (!hasValidRules(routesJSON)) {
|
112307
|
+
throw new FatalError(
|
112308
|
+
getRoutesValidationErrorMessage(
|
112309
|
+
2 /* INVALID_RULES */,
|
112310
|
+
routesPath
|
112311
|
+
),
|
112312
|
+
1
|
112313
|
+
);
|
112314
|
+
}
|
112315
|
+
if (hasOverlappingRules(routesJSON.include) || hasOverlappingRules(routesJSON.exclude)) {
|
112316
|
+
throw new FatalError(
|
112317
|
+
getRoutesValidationErrorMessage(
|
112318
|
+
5 /* OVERLAPPING_RULES */,
|
112319
|
+
routesPath
|
112320
|
+
),
|
112321
|
+
1
|
112322
|
+
);
|
112323
|
+
}
|
112324
|
+
}
|
112325
|
+
__name(validateRoutes, "validateRoutes");
|
112326
|
+
function hasIncludeRules(routesJSON) {
|
112327
|
+
if (!routesJSON || !routesJSON.include) {
|
112328
|
+
throw new Error(
|
112329
|
+
"Function `hasIncludeRules` was called out of context. Attempting to validate include rules for routes that are undefined or an invalid RoutesJSONSpec"
|
112330
|
+
);
|
112331
|
+
}
|
112332
|
+
return routesJSON?.include?.length > 0;
|
112333
|
+
}
|
112334
|
+
__name(hasIncludeRules, "hasIncludeRules");
|
112335
|
+
function hasValidRulesCount(routesJSON) {
|
112336
|
+
if (!routesJSON || !routesJSON.include || !routesJSON.exclude) {
|
112337
|
+
throw new Error(
|
112338
|
+
"Function `hasValidRulesCount` was called out of context. Attempting to validate maximum rules count for routes that are undefined or an invalid RoutesJSONSpec"
|
112339
|
+
);
|
112340
|
+
}
|
112341
|
+
return routesJSON.include.length + routesJSON.exclude.length <= MAX_FUNCTIONS_ROUTES_RULES;
|
112342
|
+
}
|
112343
|
+
__name(hasValidRulesCount, "hasValidRulesCount");
|
112344
|
+
function hasValidRuleCharCount(routesJSON) {
|
112345
|
+
if (!routesJSON || !routesJSON.include || !routesJSON.exclude) {
|
112346
|
+
throw new Error(
|
112347
|
+
"Function `hasValidRuleCharCount` was called out of context. Attempting to validate rules maximum character count for routes that are undefined or an invalid RoutesJSONSpec"
|
112348
|
+
);
|
112349
|
+
}
|
112350
|
+
const rules = [...routesJSON.include, ...routesJSON.exclude];
|
112351
|
+
return rules.filter((rule) => rule.length > MAX_FUNCTIONS_ROUTES_RULE_LENGTH).length === 0;
|
112352
|
+
}
|
112353
|
+
__name(hasValidRuleCharCount, "hasValidRuleCharCount");
|
112354
|
+
function hasValidRules(routesJSON) {
|
112355
|
+
if (!routesJSON || !routesJSON.include || !routesJSON.exclude) {
|
112356
|
+
throw new Error(
|
112357
|
+
"Function `hasValidRules` was called out of context. Attempting to validate rules for routes that are undefined or an invalid RoutesJSONSpec"
|
112358
|
+
);
|
112359
|
+
}
|
112360
|
+
const rules = [...routesJSON.include, ...routesJSON.exclude];
|
112361
|
+
return rules.filter((rule) => !rule.match(/^\//)).length === 0;
|
112362
|
+
}
|
112363
|
+
__name(hasValidRules, "hasValidRules");
|
112364
|
+
function hasOverlappingRules(routes) {
|
112365
|
+
if (!routes) {
|
112366
|
+
throw new Error(
|
112367
|
+
"Function `hasverlappingRules` was called out of context. Attempting to validate rules for routes that are undefined"
|
112368
|
+
);
|
112369
|
+
}
|
112370
|
+
const endingSplatRoutes = routes.filter((route2) => route2.endsWith("/*"));
|
112371
|
+
for (let i = 0; i < endingSplatRoutes.length; i++) {
|
112372
|
+
const crrRoute = endingSplatRoutes[i];
|
112373
|
+
const crrRouteTrimmed = crrRoute.substring(0, crrRoute.length - 1);
|
112374
|
+
for (let j2 = 0; j2 < routes.length; j2++) {
|
112375
|
+
const nextRoute = routes[j2];
|
112376
|
+
if (nextRoute !== crrRoute && nextRoute.startsWith(crrRouteTrimmed)) {
|
112377
|
+
return true;
|
112378
|
+
}
|
112379
|
+
}
|
112380
|
+
}
|
112381
|
+
return false;
|
112382
|
+
}
|
112383
|
+
__name(hasOverlappingRules, "hasOverlappingRules");
|
112384
|
+
|
112385
|
+
// src/pages/errors.ts
|
112386
|
+
var EXIT_CODE_FUNCTIONS_NO_ROUTES_ERROR = 156;
|
112387
|
+
var EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR = 157;
|
112388
|
+
var EXIT_CODE_NO_CONFIG_FOUND = 158;
|
112389
|
+
var EXIT_CODE_INVALID_PAGES_CONFIG = 159;
|
112390
|
+
var FunctionsBuildError = class extends UserError {
|
112391
|
+
constructor(message) {
|
112392
|
+
super(message);
|
112393
|
+
}
|
112394
|
+
};
|
112395
|
+
__name(FunctionsBuildError, "FunctionsBuildError");
|
112396
|
+
var FunctionsNoRoutesError = class extends UserError {
|
112397
|
+
constructor(message) {
|
112398
|
+
super(message);
|
112399
|
+
}
|
112400
|
+
};
|
112401
|
+
__name(FunctionsNoRoutesError, "FunctionsNoRoutesError");
|
112402
|
+
function getFunctionsNoRoutesWarning(functionsDirectory, suffix) {
|
112403
|
+
return `No routes found when building Functions directory: ${functionsDirectory}${suffix ? " - " + suffix : ""}`;
|
112404
|
+
}
|
112405
|
+
__name(getFunctionsNoRoutesWarning, "getFunctionsNoRoutesWarning");
|
112406
|
+
function getRoutesValidationErrorMessage(errorCode, routesPath) {
|
112407
|
+
switch (errorCode) {
|
112408
|
+
case 1 /* NO_INCLUDE_RULES */:
|
112409
|
+
return `Invalid _routes.json file found at: ${routesPath}
|
112410
|
+
Routes must have at least 1 include rule, but no include rules were detected.`;
|
112411
|
+
case 3 /* TOO_MANY_RULES */:
|
112412
|
+
return `Invalid _routes.json file found at: ${routesPath}
|
112413
|
+
Detected rules that are over the ${MAX_FUNCTIONS_ROUTES_RULES} rule limit. Please make sure you have a total of ${MAX_FUNCTIONS_ROUTES_RULES} include and exclude rules combined.`;
|
112414
|
+
case 4 /* RULE_TOO_LONG */:
|
112415
|
+
return `Invalid _routes.json file found at: ${routesPath}
|
112416
|
+
Detected rules the are over the ${MAX_FUNCTIONS_ROUTES_RULE_LENGTH} character limit. Please make sure that each include and exclude routing rule is at most ${MAX_FUNCTIONS_ROUTES_RULE_LENGTH} characters long.`;
|
112417
|
+
case 2 /* INVALID_RULES */:
|
112418
|
+
return `Invalid _routes.json file found at: ${routesPath}
|
112419
|
+
All rules must start with '/'.`;
|
112420
|
+
case 5 /* OVERLAPPING_RULES */:
|
112421
|
+
return `Invalid _routes.json file found at: ${routesPath}
|
112422
|
+
Overlapping rules found. Please make sure that rules ending with a splat (eg. "/api/*") don't overlap any other rules (eg. "/api/foo"). This applies to both include and exclude rules individually.`;
|
112423
|
+
case 0 /* INVALID_JSON_SPEC */:
|
112424
|
+
default:
|
112425
|
+
return `Invalid _routes.json file found at: ${routesPath}
|
112426
|
+
Please make sure the JSON object has the following format:
|
112427
|
+
{
|
112428
|
+
version: ${ROUTES_SPEC_VERSION};
|
112429
|
+
include: string[];
|
112430
|
+
exclude: string[];
|
112431
|
+
}
|
112432
|
+
and that at least one include rule is provided.
|
112433
|
+
`;
|
112434
|
+
}
|
112435
|
+
}
|
112436
|
+
__name(getRoutesValidationErrorMessage, "getRoutesValidationErrorMessage");
|
112437
|
+
|
112438
|
+
// src/config/config-helpers.ts
|
112439
|
+
init_import_meta_url();
|
112440
|
+
var import_path6 = __toESM(require("path"));
|
112441
|
+
|
112221
112442
|
// ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
|
112222
112443
|
init_import_meta_url();
|
112223
112444
|
var import_node_path6 = __toESM(require("node:path"), 1);
|
@@ -112514,222 +112735,22 @@ function findUpSync(name2, options30 = {}) {
|
|
112514
112735
|
}
|
112515
112736
|
__name(findUpSync, "findUpSync");
|
112516
112737
|
|
112517
|
-
// src/
|
112518
|
-
|
112519
|
-
|
112520
|
-
|
112521
|
-
|
112522
|
-
|
112523
|
-
|
112524
|
-
if (store === void 0) {
|
112525
|
-
logger.debug("No experimental flag store instantiated");
|
112526
|
-
}
|
112527
|
-
const value = flags.getStore()?.[flag];
|
112528
|
-
if (value === void 0) {
|
112529
|
-
logger.debug(
|
112530
|
-
`Attempted to use flag "${flag}" which has not been instantiated`
|
112531
|
-
);
|
112532
|
-
}
|
112533
|
-
return value;
|
112534
|
-
}, "getFlag");
|
112535
|
-
|
112536
|
-
// src/pages/errors.ts
|
112537
|
-
init_import_meta_url();
|
112538
|
-
|
112539
|
-
// src/pages/constants.ts
|
112540
|
-
init_import_meta_url();
|
112541
|
-
var isWindows = process.platform === "win32";
|
112542
|
-
var MAX_ASSET_COUNT = 2e4;
|
112543
|
-
var MAX_ASSET_SIZE = 25 * 1024 * 1024;
|
112544
|
-
var PAGES_CONFIG_CACHE_FILENAME = "pages.json";
|
112545
|
-
var MAX_BUCKET_SIZE = 40 * 1024 * 1024;
|
112546
|
-
var MAX_BUCKET_FILE_COUNT = isWindows ? 1e3 : 2e3;
|
112547
|
-
var BULK_UPLOAD_CONCURRENCY = 3;
|
112548
|
-
var MAX_UPLOAD_ATTEMPTS = 5;
|
112549
|
-
var MAX_UPLOAD_GATEWAY_ERRORS = 5;
|
112550
|
-
var MAX_DEPLOYMENT_ATTEMPTS = 3;
|
112551
|
-
var MAX_DEPLOYMENT_STATUS_ATTEMPTS = 5;
|
112552
|
-
var MAX_CHECK_MISSING_ATTEMPTS = 5;
|
112553
|
-
var SECONDS_TO_WAIT_FOR_PROXY = 5;
|
112554
|
-
var MAX_FUNCTIONS_ROUTES_RULES = 100;
|
112555
|
-
var MAX_FUNCTIONS_ROUTES_RULE_LENGTH = 100;
|
112556
|
-
var ROUTES_SPEC_VERSION = 1;
|
112557
|
-
var ROUTES_SPEC_DESCRIPTION = `Generated by wrangler@${version}`;
|
112558
|
-
|
112559
|
-
// src/pages/functions/routes-validation.ts
|
112560
|
-
init_import_meta_url();
|
112561
|
-
function isRoutesJSONSpec(data) {
|
112562
|
-
return typeof data === "object" && data && "version" in data && typeof data.version === "number" && data.version === ROUTES_SPEC_VERSION && Array.isArray(data.include) && Array.isArray(data.exclude) || false;
|
112563
|
-
}
|
112564
|
-
__name(isRoutesJSONSpec, "isRoutesJSONSpec");
|
112565
|
-
function validateRoutes(routesJSON, routesPath) {
|
112566
|
-
if (!isRoutesJSONSpec(routesJSON)) {
|
112567
|
-
throw new FatalError(
|
112568
|
-
getRoutesValidationErrorMessage(
|
112569
|
-
0 /* INVALID_JSON_SPEC */,
|
112570
|
-
routesPath
|
112571
|
-
),
|
112572
|
-
1
|
112573
|
-
);
|
112574
|
-
}
|
112575
|
-
if (!hasIncludeRules(routesJSON)) {
|
112576
|
-
throw new FatalError(
|
112577
|
-
getRoutesValidationErrorMessage(
|
112578
|
-
1 /* NO_INCLUDE_RULES */,
|
112579
|
-
routesPath
|
112580
|
-
),
|
112581
|
-
1
|
112582
|
-
);
|
112583
|
-
}
|
112584
|
-
if (!hasValidRulesCount(routesJSON)) {
|
112585
|
-
throw new FatalError(
|
112586
|
-
getRoutesValidationErrorMessage(
|
112587
|
-
3 /* TOO_MANY_RULES */,
|
112588
|
-
routesPath
|
112589
|
-
),
|
112590
|
-
1
|
112591
|
-
);
|
112592
|
-
}
|
112593
|
-
if (!hasValidRuleCharCount(routesJSON)) {
|
112594
|
-
throw new FatalError(
|
112595
|
-
getRoutesValidationErrorMessage(
|
112596
|
-
4 /* RULE_TOO_LONG */,
|
112597
|
-
routesPath
|
112598
|
-
),
|
112599
|
-
1
|
112600
|
-
);
|
112601
|
-
}
|
112602
|
-
if (!hasValidRules(routesJSON)) {
|
112603
|
-
throw new FatalError(
|
112604
|
-
getRoutesValidationErrorMessage(
|
112605
|
-
2 /* INVALID_RULES */,
|
112606
|
-
routesPath
|
112607
|
-
),
|
112608
|
-
1
|
112609
|
-
);
|
112610
|
-
}
|
112611
|
-
if (hasOverlappingRules(routesJSON.include) || hasOverlappingRules(routesJSON.exclude)) {
|
112612
|
-
throw new FatalError(
|
112613
|
-
getRoutesValidationErrorMessage(
|
112614
|
-
5 /* OVERLAPPING_RULES */,
|
112615
|
-
routesPath
|
112616
|
-
),
|
112617
|
-
1
|
112618
|
-
);
|
112619
|
-
}
|
112620
|
-
}
|
112621
|
-
__name(validateRoutes, "validateRoutes");
|
112622
|
-
function hasIncludeRules(routesJSON) {
|
112623
|
-
if (!routesJSON || !routesJSON.include) {
|
112624
|
-
throw new Error(
|
112625
|
-
"Function `hasIncludeRules` was called out of context. Attempting to validate include rules for routes that are undefined or an invalid RoutesJSONSpec"
|
112626
|
-
);
|
112627
|
-
}
|
112628
|
-
return routesJSON?.include?.length > 0;
|
112629
|
-
}
|
112630
|
-
__name(hasIncludeRules, "hasIncludeRules");
|
112631
|
-
function hasValidRulesCount(routesJSON) {
|
112632
|
-
if (!routesJSON || !routesJSON.include || !routesJSON.exclude) {
|
112633
|
-
throw new Error(
|
112634
|
-
"Function `hasValidRulesCount` was called out of context. Attempting to validate maximum rules count for routes that are undefined or an invalid RoutesJSONSpec"
|
112635
|
-
);
|
112636
|
-
}
|
112637
|
-
return routesJSON.include.length + routesJSON.exclude.length <= MAX_FUNCTIONS_ROUTES_RULES;
|
112638
|
-
}
|
112639
|
-
__name(hasValidRulesCount, "hasValidRulesCount");
|
112640
|
-
function hasValidRuleCharCount(routesJSON) {
|
112641
|
-
if (!routesJSON || !routesJSON.include || !routesJSON.exclude) {
|
112642
|
-
throw new Error(
|
112643
|
-
"Function `hasValidRuleCharCount` was called out of context. Attempting to validate rules maximum character count for routes that are undefined or an invalid RoutesJSONSpec"
|
112644
|
-
);
|
112645
|
-
}
|
112646
|
-
const rules = [...routesJSON.include, ...routesJSON.exclude];
|
112647
|
-
return rules.filter((rule) => rule.length > MAX_FUNCTIONS_ROUTES_RULE_LENGTH).length === 0;
|
112648
|
-
}
|
112649
|
-
__name(hasValidRuleCharCount, "hasValidRuleCharCount");
|
112650
|
-
function hasValidRules(routesJSON) {
|
112651
|
-
if (!routesJSON || !routesJSON.include || !routesJSON.exclude) {
|
112652
|
-
throw new Error(
|
112653
|
-
"Function `hasValidRules` was called out of context. Attempting to validate rules for routes that are undefined or an invalid RoutesJSONSpec"
|
112654
|
-
);
|
112655
|
-
}
|
112656
|
-
const rules = [...routesJSON.include, ...routesJSON.exclude];
|
112657
|
-
return rules.filter((rule) => !rule.match(/^\//)).length === 0;
|
112658
|
-
}
|
112659
|
-
__name(hasValidRules, "hasValidRules");
|
112660
|
-
function hasOverlappingRules(routes) {
|
112661
|
-
if (!routes) {
|
112662
|
-
throw new Error(
|
112663
|
-
"Function `hasverlappingRules` was called out of context. Attempting to validate rules for routes that are undefined"
|
112664
|
-
);
|
112665
|
-
}
|
112666
|
-
const endingSplatRoutes = routes.filter((route2) => route2.endsWith("/*"));
|
112667
|
-
for (let i = 0; i < endingSplatRoutes.length; i++) {
|
112668
|
-
const crrRoute = endingSplatRoutes[i];
|
112669
|
-
const crrRouteTrimmed = crrRoute.substring(0, crrRoute.length - 1);
|
112670
|
-
for (let j2 = 0; j2 < routes.length; j2++) {
|
112671
|
-
const nextRoute = routes[j2];
|
112672
|
-
if (nextRoute !== crrRoute && nextRoute.startsWith(crrRouteTrimmed)) {
|
112673
|
-
return true;
|
112674
|
-
}
|
112675
|
-
}
|
112738
|
+
// src/config/config-helpers.ts
|
112739
|
+
function resolveWranglerConfigPath({
|
112740
|
+
config,
|
112741
|
+
script
|
112742
|
+
}) {
|
112743
|
+
if (config !== void 0) {
|
112744
|
+
return config;
|
112676
112745
|
}
|
112677
|
-
|
112746
|
+
const leafPath = script !== void 0 ? import_path6.default.dirname(script) : process.cwd();
|
112747
|
+
return findWranglerConfig(leafPath);
|
112678
112748
|
}
|
112679
|
-
__name(
|
112680
|
-
|
112681
|
-
|
112682
|
-
var EXIT_CODE_FUNCTIONS_NO_ROUTES_ERROR = 156;
|
112683
|
-
var EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR = 157;
|
112684
|
-
var EXIT_CODE_NO_CONFIG_FOUND = 158;
|
112685
|
-
var EXIT_CODE_INVALID_PAGES_CONFIG = 159;
|
112686
|
-
var FunctionsBuildError = class extends UserError {
|
112687
|
-
constructor(message) {
|
112688
|
-
super(message);
|
112689
|
-
}
|
112690
|
-
};
|
112691
|
-
__name(FunctionsBuildError, "FunctionsBuildError");
|
112692
|
-
var FunctionsNoRoutesError = class extends UserError {
|
112693
|
-
constructor(message) {
|
112694
|
-
super(message);
|
112695
|
-
}
|
112696
|
-
};
|
112697
|
-
__name(FunctionsNoRoutesError, "FunctionsNoRoutesError");
|
112698
|
-
function getFunctionsNoRoutesWarning(functionsDirectory, suffix) {
|
112699
|
-
return `No routes found when building Functions directory: ${functionsDirectory}${suffix ? " - " + suffix : ""}`;
|
112700
|
-
}
|
112701
|
-
__name(getFunctionsNoRoutesWarning, "getFunctionsNoRoutesWarning");
|
112702
|
-
function getRoutesValidationErrorMessage(errorCode, routesPath) {
|
112703
|
-
switch (errorCode) {
|
112704
|
-
case 1 /* NO_INCLUDE_RULES */:
|
112705
|
-
return `Invalid _routes.json file found at: ${routesPath}
|
112706
|
-
Routes must have at least 1 include rule, but no include rules were detected.`;
|
112707
|
-
case 3 /* TOO_MANY_RULES */:
|
112708
|
-
return `Invalid _routes.json file found at: ${routesPath}
|
112709
|
-
Detected rules that are over the ${MAX_FUNCTIONS_ROUTES_RULES} rule limit. Please make sure you have a total of ${MAX_FUNCTIONS_ROUTES_RULES} include and exclude rules combined.`;
|
112710
|
-
case 4 /* RULE_TOO_LONG */:
|
112711
|
-
return `Invalid _routes.json file found at: ${routesPath}
|
112712
|
-
Detected rules the are over the ${MAX_FUNCTIONS_ROUTES_RULE_LENGTH} character limit. Please make sure that each include and exclude routing rule is at most ${MAX_FUNCTIONS_ROUTES_RULE_LENGTH} characters long.`;
|
112713
|
-
case 2 /* INVALID_RULES */:
|
112714
|
-
return `Invalid _routes.json file found at: ${routesPath}
|
112715
|
-
All rules must start with '/'.`;
|
112716
|
-
case 5 /* OVERLAPPING_RULES */:
|
112717
|
-
return `Invalid _routes.json file found at: ${routesPath}
|
112718
|
-
Overlapping rules found. Please make sure that rules ending with a splat (eg. "/api/*") don't overlap any other rules (eg. "/api/foo"). This applies to both include and exclude rules individually.`;
|
112719
|
-
case 0 /* INVALID_JSON_SPEC */:
|
112720
|
-
default:
|
112721
|
-
return `Invalid _routes.json file found at: ${routesPath}
|
112722
|
-
Please make sure the JSON object has the following format:
|
112723
|
-
{
|
112724
|
-
version: ${ROUTES_SPEC_VERSION};
|
112725
|
-
include: string[];
|
112726
|
-
exclude: string[];
|
112727
|
-
}
|
112728
|
-
and that at least one include rule is provided.
|
112729
|
-
`;
|
112730
|
-
}
|
112749
|
+
__name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
112750
|
+
function findWranglerConfig(referencePath = process.cwd()) {
|
112751
|
+
return findUpSync(`wrangler.json`, { cwd: referencePath }) ?? findUpSync(`wrangler.jsonc`, { cwd: referencePath }) ?? findUpSync(`wrangler.toml`, { cwd: referencePath });
|
112731
112752
|
}
|
112732
|
-
__name(
|
112753
|
+
__name(findWranglerConfig, "findWranglerConfig");
|
112733
112754
|
|
112734
112755
|
// src/config/validation.ts
|
112735
112756
|
init_import_meta_url();
|
@@ -112953,6 +112974,24 @@ var isValidName = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
112953
112974
|
return false;
|
112954
112975
|
}
|
112955
112976
|
}, "isValidName");
|
112977
|
+
var isValidDateTimeStringFormat = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
112978
|
+
let isValid2 = true;
|
112979
|
+
if (value.includes("\u2013") || // en-dash
|
112980
|
+
value.includes("\u2014")) {
|
112981
|
+
diagnostics.errors.push(
|
112982
|
+
`"${field}" field should use ISO-8601 accepted hyphens (-) rather than en-dashes (\u2013) or em-dashes (\u2014).`
|
112983
|
+
);
|
112984
|
+
isValid2 = false;
|
112985
|
+
}
|
112986
|
+
const data = new Date(value.replaceAll(/–|—/g, "-"));
|
112987
|
+
if (isNaN(data.getTime())) {
|
112988
|
+
diagnostics.errors.push(
|
112989
|
+
`"${field}" field should be a valid ISO-8601 date (YYYY-MM-DD), but got ${JSON.stringify(value)}.`
|
112990
|
+
);
|
112991
|
+
isValid2 = false;
|
112992
|
+
}
|
112993
|
+
return isValid2;
|
112994
|
+
}, "isValidDateTimeStringFormat");
|
112956
112995
|
var isStringArray = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
112957
112996
|
if (value !== void 0 && (!Array.isArray(value) || value.some((item) => typeof item !== "string"))) {
|
112958
112997
|
diagnostics.errors.push(
|
@@ -113345,9 +113384,25 @@ Consider adding an environment configuration section to the ${configFileName(con
|
|
113345
113384
|
Object.keys(rawConfig),
|
113346
113385
|
[...Object.keys(config), "env", "$schema"]
|
113347
113386
|
);
|
113387
|
+
applyPythonConfig(config, args);
|
113348
113388
|
return { config, diagnostics };
|
113349
113389
|
}
|
113350
113390
|
__name(normalizeAndValidateConfig, "normalizeAndValidateConfig");
|
113391
|
+
function applyPythonConfig(config, args) {
|
113392
|
+
const mainModule = "script" in args ? args.script : config.main;
|
113393
|
+
if (typeof mainModule === "string" && mainModule.endsWith(".py")) {
|
113394
|
+
config.no_bundle = true;
|
113395
|
+
if (!config.rules.some((rule) => rule.type === "PythonModule")) {
|
113396
|
+
config.rules.push({ type: "PythonModule", globs: ["**/*.py"] });
|
113397
|
+
}
|
113398
|
+
if (!config.compatibility_flags.includes("python_workers")) {
|
113399
|
+
throw new UserError(
|
113400
|
+
"The `python_workers` compatibility flag is required to use Python."
|
113401
|
+
);
|
113402
|
+
}
|
113403
|
+
}
|
113404
|
+
}
|
113405
|
+
__name(applyPythonConfig, "applyPythonConfig");
|
113351
113406
|
function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
|
113352
113407
|
const { command: command2, cwd: cwd2, watch_dir = "./src", upload: upload2, ...rest } = rawBuild;
|
113353
113408
|
const deprecatedUpload = { ...upload2 };
|
@@ -113952,7 +114007,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
113952
114007
|
topLevelEnv,
|
113953
114008
|
rawEnv,
|
113954
114009
|
"compatibility_date",
|
113955
|
-
|
114010
|
+
validateCompatibilityDate,
|
113956
114011
|
void 0
|
113957
114012
|
),
|
113958
114013
|
compatibility_flags: inheritable(
|
@@ -114144,6 +114199,16 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
114144
114199
|
validateCloudchamberConfig,
|
114145
114200
|
{}
|
114146
114201
|
),
|
114202
|
+
containers: notInheritable(
|
114203
|
+
diagnostics,
|
114204
|
+
topLevelEnv,
|
114205
|
+
rawConfig,
|
114206
|
+
rawEnv,
|
114207
|
+
envName,
|
114208
|
+
"containers",
|
114209
|
+
validateContainerAppConfig,
|
114210
|
+
{ app: [] }
|
114211
|
+
),
|
114147
114212
|
send_email: notInheritable(
|
114148
114213
|
diagnostics,
|
114149
114214
|
topLevelEnv,
|
@@ -114974,6 +115039,70 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
|
|
114974
115039
|
}
|
114975
115040
|
return isValid2;
|
114976
115041
|
}, "validateBindingArray");
|
115042
|
+
var validateContainerAppConfig = /* @__PURE__ */ __name((diagnostics, _field, value) => {
|
115043
|
+
if (!value) {
|
115044
|
+
diagnostics.errors.push(
|
115045
|
+
`"containers" should be an object, but got a falsy value`
|
115046
|
+
);
|
115047
|
+
return false;
|
115048
|
+
}
|
115049
|
+
if (typeof value !== "object") {
|
115050
|
+
diagnostics.errors.push(
|
115051
|
+
`"containers" should be an object, but got ${typeof value}`
|
115052
|
+
);
|
115053
|
+
return false;
|
115054
|
+
}
|
115055
|
+
if (Array.isArray(value)) {
|
115056
|
+
diagnostics.errors.push(
|
115057
|
+
`"containers" should be an object, but got an array`
|
115058
|
+
);
|
115059
|
+
return false;
|
115060
|
+
}
|
115061
|
+
if (!("app" in value)) {
|
115062
|
+
return true;
|
115063
|
+
}
|
115064
|
+
value = value.app;
|
115065
|
+
if (!Array.isArray(value)) {
|
115066
|
+
diagnostics.errors.push(
|
115067
|
+
`"containers.app" should be an array, but got ${JSON.stringify(value)}`
|
115068
|
+
);
|
115069
|
+
return false;
|
115070
|
+
}
|
115071
|
+
for (const containerApp of value) {
|
115072
|
+
const containerAppOptional = containerApp;
|
115073
|
+
if (!isRequiredProperty(containerAppOptional, "instances", "number")) {
|
115074
|
+
diagnostics.errors.push(
|
115075
|
+
`"containers.app.instances" should be defined and an integer`
|
115076
|
+
);
|
115077
|
+
}
|
115078
|
+
if (!isRequiredProperty(containerAppOptional, "name", "string")) {
|
115079
|
+
diagnostics.errors.push(
|
115080
|
+
`"containers.app.name" should be defined and a string`
|
115081
|
+
);
|
115082
|
+
}
|
115083
|
+
if (!("configuration" in containerAppOptional)) {
|
115084
|
+
diagnostics.errors.push(
|
115085
|
+
`"containers.app.configuration" should be defined`
|
115086
|
+
);
|
115087
|
+
} else if (Array.isArray(containerAppOptional.configuration)) {
|
115088
|
+
diagnostics.errors.push(
|
115089
|
+
`"containers.app.configuration" is defined as an array, it should be an object`
|
115090
|
+
);
|
115091
|
+
} else if (!isRequiredProperty(
|
115092
|
+
containerAppOptional.configuration,
|
115093
|
+
"image",
|
115094
|
+
"string"
|
115095
|
+
)) {
|
115096
|
+
diagnostics.errors.push(
|
115097
|
+
`"containers.app.configuration.image" should be defined and a string`
|
115098
|
+
);
|
115099
|
+
}
|
115100
|
+
}
|
115101
|
+
if (diagnostics.errors.length > 0) {
|
115102
|
+
return false;
|
115103
|
+
}
|
115104
|
+
return true;
|
115105
|
+
}, "validateContainerAppConfig");
|
114977
115106
|
var validateCloudchamberConfig = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
114978
115107
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
114979
115108
|
diagnostics.errors.push(
|
@@ -115624,6 +115753,18 @@ var validateConsumer = /* @__PURE__ */ __name((diagnostics, field, value, _confi
|
|
115624
115753
|
}
|
115625
115754
|
return isValid2;
|
115626
115755
|
}, "validateConsumer");
|
115756
|
+
var validateCompatibilityDate = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
115757
|
+
if (value === void 0) {
|
115758
|
+
return true;
|
115759
|
+
}
|
115760
|
+
if (typeof value !== "string") {
|
115761
|
+
diagnostics.errors.push(
|
115762
|
+
`Expected "${field}" to be of type string but got ${JSON.stringify(value)}.`
|
115763
|
+
);
|
115764
|
+
return false;
|
115765
|
+
}
|
115766
|
+
return isValidDateTimeStringFormat(diagnostics, field, value);
|
115767
|
+
}, "validateCompatibilityDate");
|
115627
115768
|
var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
115628
115769
|
if (typeof value !== "object" || value === null) {
|
115629
115770
|
diagnostics.errors.push(
|
@@ -115944,6 +116085,7 @@ var defaultWranglerConfig = {
|
|
115944
116085
|
/** NON-INHERITABLE ENVIRONMENT FIELDS **/
|
115945
116086
|
define: {},
|
115946
116087
|
cloudchamber: {},
|
116088
|
+
containers: { app: [] },
|
115947
116089
|
send_email: [],
|
115948
116090
|
browser: void 0,
|
115949
116091
|
unsafe: {},
|
@@ -116105,29 +116247,36 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
116105
116247
|
}
|
116106
116248
|
}
|
116107
116249
|
__name(formatConfigSnippet, "formatConfigSnippet");
|
116108
|
-
function readConfig(
|
116109
|
-
|
116110
|
-
|
116111
|
-
} =
|
116112
|
-
|
116113
|
-
|
116114
|
-
|
116250
|
+
function readConfig(args, { hideWarnings = false } = {}) {
|
116251
|
+
const configPath = resolveWranglerConfigPath(args);
|
116252
|
+
const rawConfig = readRawConfig(configPath);
|
116253
|
+
const { config, diagnostics } = normalizeAndValidateConfig(
|
116254
|
+
rawConfig,
|
116255
|
+
configPath,
|
116256
|
+
args
|
116257
|
+
);
|
116258
|
+
if (diagnostics.hasWarnings() && !hideWarnings) {
|
116259
|
+
logger.warn(diagnostics.renderWarnings());
|
116260
|
+
}
|
116261
|
+
if (diagnostics.hasErrors()) {
|
116262
|
+
throw new UserError(diagnostics.renderErrors());
|
116115
116263
|
}
|
116264
|
+
return config;
|
116265
|
+
}
|
116266
|
+
__name(readConfig, "readConfig");
|
116267
|
+
function readPagesConfig(args, { hideWarnings = false } = {}) {
|
116268
|
+
const configPath = resolveWranglerConfigPath(args);
|
116269
|
+
let rawConfig;
|
116116
116270
|
try {
|
116117
116271
|
rawConfig = readRawConfig(configPath);
|
116118
116272
|
} catch (e3) {
|
116119
|
-
|
116120
|
-
|
116121
|
-
|
116122
|
-
|
116123
|
-
|
116124
|
-
);
|
116125
|
-
} else {
|
116126
|
-
throw e3;
|
116127
|
-
}
|
116273
|
+
logger.error(e3);
|
116274
|
+
throw new FatalError(
|
116275
|
+
`Your ${configFileName(configPath)} file is not a valid Pages config file`,
|
116276
|
+
EXIT_CODE_INVALID_PAGES_CONFIG
|
116277
|
+
);
|
116128
116278
|
}
|
116129
|
-
|
116130
|
-
if (!isPagesConfigFile && requirePagesConfig) {
|
116279
|
+
if (!isPagesConfig(rawConfig)) {
|
116131
116280
|
throw new FatalError(
|
116132
116281
|
`Your ${configFileName(configPath)} file is not a valid Pages config file`,
|
116133
116282
|
EXIT_CODE_INVALID_PAGES_CONFIG
|
@@ -116144,24 +116293,21 @@ function readConfig(configPath, args, {
|
|
116144
116293
|
if (diagnostics.hasErrors()) {
|
116145
116294
|
throw new UserError(diagnostics.renderErrors());
|
116146
116295
|
}
|
116147
|
-
|
116148
|
-
|
116149
|
-
|
116150
|
-
|
116151
|
-
|
116152
|
-
|
116153
|
-
|
116154
|
-
|
116155
|
-
|
116156
|
-
|
116157
|
-
|
116158
|
-
throw new UserError(pagesDiagnostics.renderErrors());
|
116159
|
-
}
|
116296
|
+
logger.debug(
|
116297
|
+
`Configuration file belonging to \u26A1\uFE0F Pages \u26A1\uFE0F project detected.`
|
116298
|
+
);
|
116299
|
+
const envNames = rawConfig.env ? Object.keys(rawConfig.env) : [];
|
116300
|
+
const projectName = rawConfig?.name;
|
116301
|
+
const pagesDiagnostics = validatePagesConfig(config, envNames, projectName);
|
116302
|
+
if (pagesDiagnostics.hasWarnings()) {
|
116303
|
+
logger.warn(pagesDiagnostics.renderWarnings());
|
116304
|
+
}
|
116305
|
+
if (pagesDiagnostics.hasErrors()) {
|
116306
|
+
throw new UserError(pagesDiagnostics.renderErrors());
|
116160
116307
|
}
|
116161
|
-
applyPythonConfig(config, args);
|
116162
116308
|
return config;
|
116163
116309
|
}
|
116164
|
-
__name(
|
116310
|
+
__name(readPagesConfig, "readPagesConfig");
|
116165
116311
|
var readRawConfig = /* @__PURE__ */ __name((configPath) => {
|
116166
116312
|
if (configPath?.endsWith("toml")) {
|
116167
116313
|
return parseTOML(readFileSync5(configPath), configPath);
|
@@ -116170,25 +116316,6 @@ var readRawConfig = /* @__PURE__ */ __name((configPath) => {
|
|
116170
116316
|
}
|
116171
116317
|
return {};
|
116172
116318
|
}, "readRawConfig");
|
116173
|
-
function applyPythonConfig(config, args) {
|
116174
|
-
const mainModule = "script" in args ? args.script : config.main;
|
116175
|
-
if (typeof mainModule === "string" && mainModule.endsWith(".py")) {
|
116176
|
-
config.no_bundle = true;
|
116177
|
-
if (!config.rules.some((rule) => rule.type === "PythonModule")) {
|
116178
|
-
config.rules.push({ type: "PythonModule", globs: ["**/*.py"] });
|
116179
|
-
}
|
116180
|
-
if (!config.compatibility_flags.includes("python_workers")) {
|
116181
|
-
throw new UserError(
|
116182
|
-
"The `python_workers` compatibility flag is required to use Python."
|
116183
|
-
);
|
116184
|
-
}
|
116185
|
-
}
|
116186
|
-
}
|
116187
|
-
__name(applyPythonConfig, "applyPythonConfig");
|
116188
|
-
function findWranglerConfig(referencePath = process.cwd()) {
|
116189
|
-
return findUpSync(`wrangler.json`, { cwd: referencePath }) ?? findUpSync(`wrangler.jsonc`, { cwd: referencePath }) ?? findUpSync(`wrangler.toml`, { cwd: referencePath });
|
116190
|
-
}
|
116191
|
-
__name(findWranglerConfig, "findWranglerConfig");
|
116192
116319
|
function addLocalSuffix(id, local = false) {
|
116193
116320
|
if (!id || typeof id === "symbol") {
|
116194
116321
|
return local ? "(local)" : "(remote)";
|
@@ -116580,8 +116707,8 @@ Service bindings & durable object bindings connect to other \`wrangler dev\` pro
|
|
116580
116707
|
}
|
116581
116708
|
__name(printBindings, "printBindings");
|
116582
116709
|
function withConfig(handler30, options30) {
|
116583
|
-
return (
|
116584
|
-
return handler30({ ...
|
116710
|
+
return (args) => {
|
116711
|
+
return handler30({ ...args, config: readConfig(args, options30) });
|
116585
116712
|
};
|
116586
116713
|
}
|
116587
116714
|
__name(withConfig, "withConfig");
|
@@ -116612,7 +116739,7 @@ __name(loadDotEnv, "loadDotEnv");
|
|
116612
116739
|
// src/config-cache.ts
|
116613
116740
|
init_import_meta_url();
|
116614
116741
|
var import_fs6 = require("fs");
|
116615
|
-
var
|
116742
|
+
var path9 = __toESM(require("path"));
|
116616
116743
|
|
116617
116744
|
// src/is-interactive.ts
|
116618
116745
|
init_import_meta_url();
|
@@ -118537,7 +118664,7 @@ function getCacheFolder() {
|
|
118537
118664
|
const closestNodeModulesDirectory = findUpSync("node_modules", {
|
118538
118665
|
type: "directory"
|
118539
118666
|
});
|
118540
|
-
__cacheFolder = closestNodeModulesDirectory ?
|
118667
|
+
__cacheFolder = closestNodeModulesDirectory ? path9.join(closestNodeModulesDirectory, ".cache/wrangler") : null;
|
118541
118668
|
if (!__cacheFolder) {
|
118542
118669
|
logger.debug("No folder available to cache configuration");
|
118543
118670
|
}
|
@@ -118554,7 +118681,7 @@ function showCacheMessage(fields, folder) {
|
|
118554
118681
|
logger.debug(
|
118555
118682
|
`Retrieving cached values for ${arrayFormatter.format(
|
118556
118683
|
fields
|
118557
|
-
)} from ${
|
118684
|
+
)} from ${path9.relative(process.cwd(), folder)}`
|
118558
118685
|
);
|
118559
118686
|
cacheMessageShown = true;
|
118560
118687
|
}
|
@@ -118565,7 +118692,7 @@ function getConfigCache(fileName) {
|
|
118565
118692
|
try {
|
118566
118693
|
const cacheFolder = getCacheFolder();
|
118567
118694
|
if (cacheFolder) {
|
118568
|
-
const configCacheLocation =
|
118695
|
+
const configCacheLocation = path9.join(cacheFolder, fileName);
|
118569
118696
|
const configCache = JSON.parse(
|
118570
118697
|
(0, import_fs6.readFileSync)(configCacheLocation, "utf-8")
|
118571
118698
|
);
|
@@ -118583,9 +118710,9 @@ function saveToConfigCache(fileName, newValues) {
|
|
118583
118710
|
const cacheFolder = getCacheFolder();
|
118584
118711
|
if (cacheFolder) {
|
118585
118712
|
logger.debug(`Saving to cache: ${JSON.stringify(newValues)}`);
|
118586
|
-
const configCacheLocation =
|
118713
|
+
const configCacheLocation = path9.join(cacheFolder, fileName);
|
118587
118714
|
const existingValues = getConfigCache(fileName);
|
118588
|
-
(0, import_fs6.mkdirSync)(
|
118715
|
+
(0, import_fs6.mkdirSync)(path9.dirname(configCacheLocation), { recursive: true });
|
118589
118716
|
(0, import_fs6.writeFileSync)(
|
118590
118717
|
configCacheLocation,
|
118591
118718
|
JSON.stringify({ ...existingValues, ...newValues }, null, 2)
|
@@ -120907,34 +121034,7 @@ __name(CallSite, "CallSite");
|
|
120907
121034
|
|
120908
121035
|
// src/update-check.ts
|
120909
121036
|
init_import_meta_url();
|
120910
|
-
init_supports_color();
|
120911
121037
|
var import_update_check = __toESM(require_update_check());
|
120912
|
-
async function printWranglerBanner(performUpdateCheck = true) {
|
120913
|
-
let text = ` \u26C5\uFE0F wrangler ${version}`;
|
120914
|
-
let maybeNewVersion;
|
120915
|
-
if (performUpdateCheck) {
|
120916
|
-
maybeNewVersion = await updateCheck();
|
120917
|
-
if (maybeNewVersion !== void 0) {
|
120918
|
-
text += ` (update available ${source_default.green(maybeNewVersion)})`;
|
120919
|
-
}
|
120920
|
-
}
|
120921
|
-
logger.log(
|
120922
|
-
"\n" + text + "\n" + (supports_color_default2.stdout ? source_default.hex("#FF8800")("-".repeat(text.length)) : "-".repeat(text.length)) + "\n"
|
120923
|
-
);
|
120924
|
-
if (maybeNewVersion !== void 0) {
|
120925
|
-
const currentMajor = parseInt(version.split(".")[0]);
|
120926
|
-
const newMajor = parseInt(maybeNewVersion.split(".")[0]);
|
120927
|
-
if (newMajor > currentMajor) {
|
120928
|
-
logger.warn(
|
120929
|
-
`The version of Wrangler you are using is now out-of-date.
|
120930
|
-
Please update to the latest version to prevent critical errors.
|
120931
|
-
Run \`npm install --save-dev wrangler@${newMajor}\` to update to the latest version.
|
120932
|
-
After installation, run Wrangler with \`npx wrangler\`.`
|
120933
|
-
);
|
120934
|
-
}
|
120935
|
-
}
|
120936
|
-
}
|
120937
|
-
__name(printWranglerBanner, "printWranglerBanner");
|
120938
121038
|
async function doUpdateCheck() {
|
120939
121039
|
let update = null;
|
120940
121040
|
const pkg = { name, version };
|
@@ -122548,9 +122648,9 @@ var wrapper_default = import_websocket.default;
|
|
122548
122648
|
// src/dev/inspect.ts
|
122549
122649
|
init_import_meta_url();
|
122550
122650
|
var import_fs7 = require("fs");
|
122551
|
-
var
|
122651
|
+
var import_node_os3 = __toESM(require("node:os"));
|
122552
122652
|
var import_node_url7 = require("node:url");
|
122553
|
-
var
|
122653
|
+
var import_path7 = __toESM(require("path"));
|
122554
122654
|
var import_open2 = __toESM(require_open());
|
122555
122655
|
|
122556
122656
|
// src/api/startDevWorker/bundle-allowed-paths.ts
|
@@ -122778,7 +122878,7 @@ function maybeHandleNetworkLoadResource(url4, bundle, tmpDir) {
|
|
122778
122878
|
if (source.includes("wrangler/templates")) {
|
122779
122879
|
return i;
|
122780
122880
|
}
|
122781
|
-
if (tmpDir !== void 0 &&
|
122881
|
+
if (tmpDir !== void 0 && import_path7.default.resolve(sourceMap?.sourceRoot ?? "", source).includes(tmpDir)) {
|
122782
122882
|
return i;
|
122783
122883
|
}
|
122784
122884
|
}).filter((i) => i !== void 0);
|
@@ -122800,7 +122900,7 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
|
|
122800
122900
|
const url4 = `https://devtools.devprod.cloudflare.dev/js_app?${query.toString()}`;
|
122801
122901
|
const errorMessage = "Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
|
122802
122902
|
let braveBrowser;
|
122803
|
-
switch (
|
122903
|
+
switch (import_node_os3.default.platform()) {
|
122804
122904
|
case "darwin":
|
122805
122905
|
case "win32":
|
122806
122906
|
braveBrowser = "Brave";
|
@@ -122832,7 +122932,7 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
|
|
122832
122932
|
// src/https-options.ts
|
122833
122933
|
init_import_meta_url();
|
122834
122934
|
var fs8 = __toESM(require("node:fs"));
|
122835
|
-
var
|
122935
|
+
var path19 = __toESM(require("node:path"));
|
122836
122936
|
var import_miniflare8 = require("miniflare");
|
122837
122937
|
var CERT_EXPIRY_DAYS = 30;
|
122838
122938
|
var ONE_DAY_IN_MS = 864e5;
|
@@ -122865,9 +122965,9 @@ function getHttpsOptions(customHttpsKeyPath = getHttpsKeyPathFromEnv(), customHt
|
|
122865
122965
|
cert: fs8.readFileSync(customHttpsCertPath, "utf8")
|
122866
122966
|
};
|
122867
122967
|
}
|
122868
|
-
const certDirectory =
|
122869
|
-
const keyPath =
|
122870
|
-
const certPath =
|
122968
|
+
const certDirectory = path19.join(getGlobalWranglerConfigPath(), "local-cert");
|
122969
|
+
const keyPath = path19.join(certDirectory, "key.pem");
|
122970
|
+
const certPath = path19.join(certDirectory, "cert.pem");
|
122871
122971
|
const regenerate = !fs8.existsSync(keyPath) || !fs8.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
|
122872
122972
|
if (regenerate) {
|
122873
122973
|
logger.log("Generating new self-signed certificate...");
|
@@ -122879,7 +122979,7 @@ function getHttpsOptions(customHttpsKeyPath = getHttpsKeyPathFromEnv(), customHt
|
|
122879
122979
|
} catch (e3) {
|
122880
122980
|
const message = e3 instanceof Error ? e3.message : `${e3}`;
|
122881
122981
|
logger.warn(
|
122882
|
-
`Unable to cache generated self-signed certificate in ${
|
122982
|
+
`Unable to cache generated self-signed certificate in ${path19.relative(
|
122883
122983
|
process.cwd(),
|
122884
122984
|
certDirectory
|
122885
122985
|
)}.
|
@@ -123395,7 +123495,7 @@ init_import_meta_url();
|
|
123395
123495
|
var import_node_assert11 = __toESM(require("node:assert"));
|
123396
123496
|
var import_node_fs11 = require("node:fs");
|
123397
123497
|
var import_promises9 = require("node:fs/promises");
|
123398
|
-
var
|
123498
|
+
var path22 = __toESM(require("node:path"));
|
123399
123499
|
|
123400
123500
|
// ../workers-shared/index.ts
|
123401
123501
|
init_import_meta_url();
|
@@ -128312,7 +128412,7 @@ var syncAssets = /* @__PURE__ */ __name(async (accountId, assetDirectory, script
|
|
128312
128412
|
const doUpload = /* @__PURE__ */ __name(async () => {
|
128313
128413
|
const payload = new import_undici4.FormData();
|
128314
128414
|
for (const manifestEntry of bucket) {
|
128315
|
-
const absFilePath =
|
128415
|
+
const absFilePath = path22.join(assetDirectory, manifestEntry[0]);
|
128316
128416
|
payload.append(
|
128317
128417
|
manifestEntry[1].hash,
|
128318
128418
|
new import_undici4.File(
|
@@ -128409,7 +128509,7 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
|
|
128409
128509
|
logger.debug("Ignoring asset:", relativeFilepath);
|
128410
128510
|
return;
|
128411
128511
|
}
|
128412
|
-
const filepath =
|
128512
|
+
const filepath = path22.join(dir, relativeFilepath);
|
128413
128513
|
const filestat = await (0, import_promises9.stat)(filepath);
|
128414
128514
|
if (filestat.isSymbolicLink() || filestat.isDirectory()) {
|
128415
128515
|
return;
|
@@ -128464,7 +128564,7 @@ function logAssetUpload(line, diffCount) {
|
|
128464
128564
|
}
|
128465
128565
|
__name(logAssetUpload, "logAssetUpload");
|
128466
128566
|
function getAssetsBasePath(config, assetsCommandLineArg) {
|
128467
|
-
return assetsCommandLineArg ? process.cwd() :
|
128567
|
+
return assetsCommandLineArg ? process.cwd() : path22.resolve(path22.dirname(config.configPath ?? "wrangler.toml"));
|
128468
128568
|
}
|
128469
128569
|
__name(getAssetsBasePath, "getAssetsBasePath");
|
128470
128570
|
function getAssetsOptions(args, config) {
|
@@ -128482,7 +128582,7 @@ function getAssetsOptions(args, config) {
|
|
128482
128582
|
throw new UserError("`The assets directory cannot be an empty string.");
|
128483
128583
|
}
|
128484
128584
|
const assetsBasePath = getAssetsBasePath(config, args.assets);
|
128485
|
-
const resolvedAssetsPath =
|
128585
|
+
const resolvedAssetsPath = path22.resolve(assetsBasePath, directory);
|
128486
128586
|
if (!(0, import_node_fs11.existsSync)(resolvedAssetsPath)) {
|
128487
128587
|
const sourceOfTruthMessage = args.assets ? '"--assets" command line argument' : '"assets.directory" field in your configuration file';
|
128488
128588
|
throw new UserError(
|
@@ -128518,7 +128618,7 @@ function validateAssetsArgsAndConfig(args, config) {
|
|
128518
128618
|
"Cannot use assets and Workers Sites in the same Worker.\nPlease remove either the `site` or `assets` field from your configuration file."
|
128519
128619
|
);
|
128520
128620
|
}
|
128521
|
-
const noOpEntrypoint =
|
128621
|
+
const noOpEntrypoint = path22.resolve(
|
128522
128622
|
getBasePath(),
|
128523
128623
|
"templates/no-op-worker.js"
|
128524
128624
|
);
|
@@ -128531,7 +128631,7 @@ function validateAssetsArgsAndConfig(args, config) {
|
|
128531
128631
|
__name(validateAssetsArgsAndConfig, "validateAssetsArgsAndConfig");
|
128532
128632
|
var CF_ASSETS_IGNORE_FILENAME = ".assetsignore";
|
128533
128633
|
async function createAssetIgnoreFunction(dir) {
|
128534
|
-
const cfAssetIgnorePath =
|
128634
|
+
const cfAssetIgnorePath = path22.resolve(dir, CF_ASSETS_IGNORE_FILENAME);
|
128535
128635
|
if (!(0, import_node_fs11.existsSync)(cfAssetIgnorePath)) {
|
128536
128636
|
return null;
|
128537
128637
|
}
|
@@ -128606,20 +128706,20 @@ __name(getBindings, "getBindings");
|
|
128606
128706
|
// src/deployment-bundle/bundle.ts
|
128607
128707
|
init_import_meta_url();
|
128608
128708
|
var fs11 = __toESM(require("node:fs"));
|
128609
|
-
var
|
128709
|
+
var path24 = __toESM(require("node:path"));
|
128610
128710
|
var esbuild = __toESM(require("esbuild"));
|
128611
128711
|
|
128612
128712
|
// src/deployment-bundle/apply-middleware.ts
|
128613
128713
|
init_import_meta_url();
|
128614
128714
|
var fs10 = __toESM(require("node:fs"));
|
128615
|
-
var
|
128715
|
+
var path23 = __toESM(require("node:path"));
|
128616
128716
|
async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
|
128617
128717
|
tmpDirPath = fs10.realpathSync(tmpDirPath);
|
128618
128718
|
const middlewareIdentifiers = middleware.map((m2, index) => [
|
128619
128719
|
`__MIDDLEWARE_${index}__`,
|
128620
|
-
|
128720
|
+
path23.resolve(getBasePath(), m2.path)
|
128621
128721
|
]);
|
128622
|
-
const dynamicFacadePath =
|
128722
|
+
const dynamicFacadePath = path23.join(
|
128623
128723
|
tmpDirPath,
|
128624
128724
|
"middleware-insertion-facade.js"
|
128625
128725
|
);
|
@@ -128648,11 +128748,11 @@ async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
|
|
128648
128748
|
export default worker;
|
128649
128749
|
`
|
128650
128750
|
);
|
128651
|
-
const targetPathLoader =
|
128751
|
+
const targetPathLoader = path23.join(
|
128652
128752
|
tmpDirPath,
|
128653
128753
|
"middleware-loader.entry.ts"
|
128654
128754
|
);
|
128655
|
-
const loaderPath =
|
128755
|
+
const loaderPath = path23.resolve(
|
128656
128756
|
getBasePath(),
|
128657
128757
|
"templates/middleware/loader-modules.ts"
|
128658
128758
|
);
|
@@ -128660,7 +128760,7 @@ async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
|
|
128660
128760
|
const transformedLoader = baseLoader.replaceAll("__ENTRY_POINT__", prepareFilePath(dynamicFacadePath)).replace(
|
128661
128761
|
"./common",
|
128662
128762
|
prepareFilePath(
|
128663
|
-
|
128763
|
+
path23.resolve(getBasePath(), "templates/middleware/common.ts")
|
128664
128764
|
)
|
128665
128765
|
);
|
128666
128766
|
await fs10.promises.writeFile(targetPathLoader, transformedLoader);
|
@@ -128671,7 +128771,7 @@ async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
|
|
128671
128771
|
}
|
128672
128772
|
};
|
128673
128773
|
} else {
|
128674
|
-
const loaderSwPath =
|
128774
|
+
const loaderSwPath = path23.resolve(
|
128675
128775
|
getBasePath(),
|
128676
128776
|
"templates/middleware/loader-sw.ts"
|
128677
128777
|
);
|
@@ -129033,7 +129133,7 @@ __name(decodeFromLowerCase, "decodeFromLowerCase");
|
|
129033
129133
|
|
129034
129134
|
// src/deployment-bundle/esbuild-plugins/nodejs-compat.ts
|
129035
129135
|
init_import_meta_url();
|
129036
|
-
var
|
129136
|
+
var import_path8 = require("path");
|
129037
129137
|
var nodejsCompatPlugin = /* @__PURE__ */ __name((mode) => ({
|
129038
129138
|
name: "nodejs_compat-imports",
|
129039
129139
|
setup(pluginBuild) {
|
@@ -129100,7 +129200,7 @@ var nodejsCompatPlugin = /* @__PURE__ */ __name((mode) => ({
|
|
129100
129200
|
}
|
129101
129201
|
}), "nodejsCompatPlugin");
|
129102
129202
|
function toList(items, absWorkingDir) {
|
129103
|
-
return items.map((i) => ` - ${source_default.blue((0,
|
129203
|
+
return items.map((i) => ` - ${source_default.blue((0, import_path8.relative)(absWorkingDir ?? "/", i))}`).join("\n");
|
129104
129204
|
}
|
129105
129205
|
__name(toList, "toList");
|
129106
129206
|
|
@@ -129283,12 +129383,12 @@ async function bundleWorker(entry, destination, {
|
|
129283
129383
|
};
|
129284
129384
|
const inject = injectOption ?? [];
|
129285
129385
|
if (checkFetch) {
|
129286
|
-
const checkedFetchFileToInject =
|
129386
|
+
const checkedFetchFileToInject = path24.join(tmpDir.path, "checked-fetch.js");
|
129287
129387
|
if (checkFetch && !fs11.existsSync(checkedFetchFileToInject)) {
|
129288
129388
|
fs11.writeFileSync(
|
129289
129389
|
checkedFetchFileToInject,
|
129290
129390
|
fs11.readFileSync(
|
129291
|
-
|
129391
|
+
path24.resolve(getBasePath(), "templates/checked-fetch.js")
|
129292
129392
|
)
|
129293
129393
|
);
|
129294
129394
|
}
|
@@ -129321,7 +129421,7 @@ async function bundleWorker(entry, destination, {
|
|
129321
129421
|
inject.push(...result2.inject ?? []);
|
129322
129422
|
}
|
129323
129423
|
if (watch7) {
|
129324
|
-
inject.push(
|
129424
|
+
inject.push(path24.resolve(getBasePath(), "templates/modules-watch-stub.js"));
|
129325
129425
|
}
|
129326
129426
|
const aliasPlugin = {
|
129327
129427
|
name: "alias",
|
@@ -129354,7 +129454,7 @@ async function bundleWorker(entry, destination, {
|
|
129354
129454
|
absWorkingDir: entry.projectRoot,
|
129355
129455
|
outdir: destination,
|
129356
129456
|
keepNames: true,
|
129357
|
-
entryNames: entryName ||
|
129457
|
+
entryNames: entryName || path24.parse(entryFile).name,
|
129358
129458
|
...isOutfile ? {
|
129359
129459
|
outdir: void 0,
|
129360
129460
|
outfile: destination,
|
@@ -129437,7 +129537,7 @@ async function bundleWorker(entry, destination, {
|
|
129437
129537
|
const entryPoint = getEntryPointFromMetafile(entryFile, result.metafile);
|
129438
129538
|
const notExportedDOs = doBindings.filter((x2) => !x2.script_name && !entryPoint.exports.includes(x2.class_name)).map((x2) => x2.class_name);
|
129439
129539
|
if (notExportedDOs.length) {
|
129440
|
-
const relativePath =
|
129540
|
+
const relativePath = path24.relative(process.cwd(), entryFile);
|
129441
129541
|
throw new UserError(
|
129442
129542
|
`Your Worker depends on the following Durable Objects, which are not exported in your entrypoint file: ${notExportedDOs.join(
|
129443
129543
|
", "
|
@@ -129447,7 +129547,7 @@ You should export these objects from your entrypoint, ${relativePath}.`
|
|
129447
129547
|
}
|
129448
129548
|
const notExportedWorkflows = workflowBindings.filter((x2) => !x2.script_name && !entryPoint.exports.includes(x2.class_name)).map((x2) => x2.class_name);
|
129449
129549
|
if (notExportedWorkflows.length) {
|
129450
|
-
const relativePath =
|
129550
|
+
const relativePath = path24.relative(process.cwd(), entryFile);
|
129451
129551
|
throw new UserError(
|
129452
129552
|
`Your Worker depends on the following Workflows, which are not exported in your entrypoint file: ${notExportedWorkflows.join(
|
129453
129553
|
", "
|
@@ -129459,7 +129559,7 @@ You should export these objects from your entrypoint, ${relativePath}.`
|
|
129459
129559
|
const sourceMapPath = Object.keys(result.metafile.outputs).filter(
|
129460
129560
|
(_path) => _path.includes(".map")
|
129461
129561
|
)[0];
|
129462
|
-
const resolvedEntryPointPath =
|
129562
|
+
const resolvedEntryPointPath = path24.resolve(
|
129463
129563
|
entry.projectRoot,
|
129464
129564
|
entryPoint.relativePath
|
129465
129565
|
);
|
@@ -129467,7 +129567,7 @@ You should export these objects from your entrypoint, ${relativePath}.`
|
|
129467
129567
|
...moduleCollector.modules,
|
129468
129568
|
...additionalModules
|
129469
129569
|
]);
|
129470
|
-
await writeAdditionalModules(modules,
|
129570
|
+
await writeAdditionalModules(modules, path24.dirname(resolvedEntryPointPath));
|
129471
129571
|
return {
|
129472
129572
|
modules,
|
129473
129573
|
dependencies: entryPoint.dependencies,
|
@@ -130218,7 +130318,7 @@ var import_undici6 = __toESM(require_undici());
|
|
130218
130318
|
init_import_meta_url();
|
130219
130319
|
var import_node_fs14 = require("node:fs");
|
130220
130320
|
var import_node_path27 = require("node:path");
|
130221
|
-
var
|
130321
|
+
var import_node_process9 = require("node:process");
|
130222
130322
|
init_execa();
|
130223
130323
|
async function getPackageManager(cwd2) {
|
130224
130324
|
const [hasYarn, hasNpm, hasPnpm] = await Promise.all([
|
@@ -130370,7 +130470,7 @@ function supportsPnpm() {
|
|
130370
130470
|
}
|
130371
130471
|
__name(supportsPnpm, "supportsPnpm");
|
130372
130472
|
function sniffUserAgent() {
|
130373
|
-
const userAgent =
|
130473
|
+
const userAgent = import_node_process9.env.npm_config_user_agent;
|
130374
130474
|
if (userAgent === void 0) {
|
130375
130475
|
return void 0;
|
130376
130476
|
}
|
@@ -130388,13 +130488,13 @@ __name(sniffUserAgent, "sniffUserAgent");
|
|
130388
130488
|
|
130389
130489
|
// src/metrics/helpers.ts
|
130390
130490
|
init_import_meta_url();
|
130391
|
-
var
|
130491
|
+
var import_node_os5 = __toESM(require("node:os"));
|
130392
130492
|
function getWranglerVersion() {
|
130393
130493
|
return version;
|
130394
130494
|
}
|
130395
130495
|
__name(getWranglerVersion, "getWranglerVersion");
|
130396
130496
|
function getPlatform() {
|
130397
|
-
const platform2 =
|
130497
|
+
const platform2 = import_node_os5.default.platform();
|
130398
130498
|
switch (platform2) {
|
130399
130499
|
case "win32":
|
130400
130500
|
return "Windows";
|
@@ -130412,7 +130512,7 @@ function getOS() {
|
|
130412
130512
|
}
|
130413
130513
|
__name(getOS, "getOS");
|
130414
130514
|
function getOSVersion() {
|
130415
|
-
return
|
130515
|
+
return import_node_os5.default.version();
|
130416
130516
|
}
|
130417
130517
|
__name(getOSVersion, "getOSVersion");
|
130418
130518
|
function getNodeVersion() {
|
@@ -130556,7 +130656,10 @@ function getMetricsDispatcher(options30) {
|
|
130556
130656
|
if (properties.command === "wrangler telemetry disable" || properties.command === "wrangler metrics disable") {
|
130557
130657
|
return;
|
130558
130658
|
}
|
130559
|
-
|
130659
|
+
if (properties.command === "wrangler deploy" || properties.command === "wrangler dev" || // for testing purposes
|
130660
|
+
properties.command === "wrangler docs") {
|
130661
|
+
printMetricsBanner();
|
130662
|
+
}
|
130560
130663
|
const argsUsed = sanitiseUserInput(properties.args ?? {});
|
130561
130664
|
const argsCombination = argsUsed.sort().join(", ");
|
130562
130665
|
const commonEventProperties = {
|
@@ -130978,7 +131081,7 @@ __name(deleteWorkerConsumer, "deleteWorkerConsumer");
|
|
130978
131081
|
init_import_meta_url();
|
130979
131082
|
var import_node_assert15 = __toESM(require("node:assert"));
|
130980
131083
|
var import_promises10 = require("node:fs/promises");
|
130981
|
-
var
|
131084
|
+
var path30 = __toESM(require("node:path"));
|
130982
131085
|
|
130983
131086
|
// ../../node_modules/.pnpm/xxhash-wasm@1.0.1/node_modules/xxhash-wasm/esm/xxhash-wasm.js
|
130984
131087
|
init_import_meta_url();
|
@@ -131342,9 +131445,9 @@ async function* getFilesInFolder(dirPath) {
|
|
131342
131445
|
continue;
|
131343
131446
|
}
|
131344
131447
|
if (file.isDirectory()) {
|
131345
|
-
yield* await getFilesInFolder(
|
131448
|
+
yield* await getFilesInFolder(path30.join(dirPath, file.name));
|
131346
131449
|
} else {
|
131347
|
-
yield
|
131450
|
+
yield path30.join(dirPath, file.name);
|
131348
131451
|
}
|
131349
131452
|
}
|
131350
131453
|
}
|
@@ -131354,11 +131457,11 @@ function hashFileContent(hasher, content) {
|
|
131354
131457
|
}
|
131355
131458
|
__name(hashFileContent, "hashFileContent");
|
131356
131459
|
function hashAsset(hasher, filePath, content) {
|
131357
|
-
const extName =
|
131358
|
-
const baseName =
|
131359
|
-
const directory =
|
131460
|
+
const extName = path30.extname(filePath) || "";
|
131461
|
+
const baseName = path30.basename(filePath, extName);
|
131462
|
+
const directory = path30.dirname(filePath);
|
131360
131463
|
const hash = hashFileContent(hasher, content);
|
131361
|
-
return urlSafe(
|
131464
|
+
return urlSafe(path30.join(directory, `${baseName}.${hash}${extName}`));
|
131362
131465
|
}
|
131363
131466
|
__name(hashAsset, "hashAsset");
|
131364
131467
|
async function createKVNamespaceIfNotAlreadyExisting(title, accountId) {
|
@@ -131401,7 +131504,7 @@ async function syncLegacyAssets(accountId, scriptName, siteAssets, preview, dryR
|
|
131401
131504
|
const namespaceKeysResponse = await listKVNamespaceKeys(accountId, namespace);
|
131402
131505
|
const namespaceKeyInfoMap = new Map(namespaceKeysResponse.map((x2) => [x2.name, x2]));
|
131403
131506
|
const namespaceKeys = new Set(namespaceKeysResponse.map((x2) => x2.name));
|
131404
|
-
const assetDirectory =
|
131507
|
+
const assetDirectory = path30.join(
|
131405
131508
|
siteAssets.baseDirectory,
|
131406
131509
|
siteAssets.assetDirectory
|
131407
131510
|
);
|
@@ -131430,7 +131533,7 @@ async function syncLegacyAssets(accountId, scriptName, siteAssets, preview, dryR
|
|
131430
131533
|
__name(logDiff, "logDiff");
|
131431
131534
|
logger.info("Building list of assets to upload...");
|
131432
131535
|
for await (const absAssetFile of getFilesInFolder(assetDirectory)) {
|
131433
|
-
const assetFile =
|
131536
|
+
const assetFile = path30.relative(assetDirectory, absAssetFile);
|
131434
131537
|
if (!include(assetFile) || exclude2(assetFile)) {
|
131435
131538
|
continue;
|
131436
131539
|
}
|
@@ -131456,7 +131559,7 @@ async function syncLegacyAssets(accountId, scriptName, siteAssets, preview, dryR
|
|
131456
131559
|
skipCount++;
|
131457
131560
|
}
|
131458
131561
|
namespaceKeys.delete(assetKey);
|
131459
|
-
const manifestKey = urlSafe(
|
131562
|
+
const manifestKey = urlSafe(path30.relative(assetDirectory, absAssetFile));
|
131460
131563
|
manifest[manifestKey] = assetKey;
|
131461
131564
|
}
|
131462
131565
|
if (uploadBucket.length > 0) {
|
@@ -131592,7 +131695,7 @@ function urlSafe(filePath) {
|
|
131592
131695
|
}
|
131593
131696
|
__name(urlSafe, "urlSafe");
|
131594
131697
|
function getLegacyAssetPaths(config, assetDirectory) {
|
131595
|
-
const baseDirectory = assetDirectory ? process.cwd() :
|
131698
|
+
const baseDirectory = assetDirectory ? process.cwd() : path30.resolve(path30.dirname(config.configPath ?? "wrangler.toml"));
|
131596
131699
|
assetDirectory ??= typeof config.legacy_assets === "string" ? config.legacy_assets : config.legacy_assets !== void 0 ? config.legacy_assets.bucket : void 0;
|
131597
131700
|
const includePatterns = typeof config.legacy_assets !== "string" && config.legacy_assets?.include || [];
|
131598
131701
|
const excludePatterns = typeof config.legacy_assets !== "string" && config.legacy_assets?.exclude || [];
|
@@ -131605,7 +131708,7 @@ function getLegacyAssetPaths(config, assetDirectory) {
|
|
131605
131708
|
}
|
131606
131709
|
__name(getLegacyAssetPaths, "getLegacyAssetPaths");
|
131607
131710
|
function getSiteAssetPaths(config, assetDirectory, includePatterns = config.site?.include ?? [], excludePatterns = config.site?.exclude ?? []) {
|
131608
|
-
const baseDirectory = assetDirectory ? process.cwd() :
|
131711
|
+
const baseDirectory = assetDirectory ? process.cwd() : path30.resolve(path30.dirname(config.configPath ?? "wrangler.toml"));
|
131609
131712
|
assetDirectory ??= config.site?.bucket;
|
131610
131713
|
if (assetDirectory) {
|
131611
131714
|
return {
|
@@ -134022,13 +134125,13 @@ __name(devRegistry3, "devRegistry");
|
|
134022
134125
|
|
134023
134126
|
// src/dev/dev-vars.ts
|
134024
134127
|
init_import_meta_url();
|
134025
|
-
var
|
134128
|
+
var path33 = __toESM(require("node:path"));
|
134026
134129
|
function getVarsForDev(config, env6, silent = false) {
|
134027
|
-
const configDir =
|
134028
|
-
const devVarsPath =
|
134130
|
+
const configDir = path33.resolve(path33.dirname(config.configPath ?? "."));
|
134131
|
+
const devVarsPath = path33.resolve(configDir, ".dev.vars");
|
134029
134132
|
const loaded = loadDotEnv(devVarsPath, env6);
|
134030
134133
|
if (loaded !== void 0) {
|
134031
|
-
const devVarsRelativePath =
|
134134
|
+
const devVarsRelativePath = path33.relative(process.cwd(), loaded.path);
|
134032
134135
|
if (!silent) {
|
134033
134136
|
logger.log(`Using vars defined in ${devVarsRelativePath}`);
|
134034
134137
|
}
|
@@ -134793,7 +134896,7 @@ Move any existing data to .wrangler/state and use --persist, or
|
|
134793
134896
|
use --persist-to=./wrangler-local-state to keep using the old path.`
|
134794
134897
|
);
|
134795
134898
|
}
|
134796
|
-
const configPath =
|
134899
|
+
const configPath = resolveWranglerConfigPath(args);
|
134797
134900
|
const authHook = /* @__PURE__ */ __name(async (config) => {
|
134798
134901
|
const hotkeysDisplayed = !!unregisterHotKeys;
|
134799
134902
|
let accountId = args.accountId;
|
@@ -135301,7 +135404,7 @@ var import_node_crypto10 = require("node:crypto");
|
|
135301
135404
|
var import_node_fs22 = require("node:fs");
|
135302
135405
|
var import_promises17 = require("node:fs/promises");
|
135303
135406
|
var import_node_path45 = __toESM(require("node:path"));
|
135304
|
-
var
|
135407
|
+
var import_node_process10 = require("node:process");
|
135305
135408
|
var import_undici12 = __toESM(require_undici());
|
135306
135409
|
|
135307
135410
|
// src/pages/buildFunctions.ts
|
@@ -136491,11 +136594,7 @@ async function deploy2({
|
|
136491
136594
|
const deploymentConfig = project.deployment_configs[env6];
|
136492
136595
|
let config;
|
136493
136596
|
try {
|
136494
|
-
config =
|
136495
|
-
void 0,
|
136496
|
-
{ ...args, env: env6 },
|
136497
|
-
{ requirePagesConfig: true }
|
136498
|
-
);
|
136597
|
+
config = readPagesConfig({ ...args, env: env6 });
|
136499
136598
|
} catch (err) {
|
136500
136599
|
if (!(err instanceof FatalError && err.code === EXIT_CODE_INVALID_PAGES_CONFIG)) {
|
136501
136600
|
throw err;
|
@@ -136519,7 +136618,7 @@ async function deploy2({
|
|
136519
136618
|
);
|
136520
136619
|
let builtFunctions = void 0;
|
136521
136620
|
let workerBundle = void 0;
|
136522
|
-
const functionsDirectory = customFunctionsDirectory || (0, import_node_path45.join)((0,
|
136621
|
+
const functionsDirectory = customFunctionsDirectory || (0, import_node_path45.join)((0, import_node_process10.cwd)(), "functions");
|
136523
136622
|
const routesOutputPath = !(0, import_node_fs22.existsSync)((0, import_node_path45.join)(directory, "_routes.json")) ? (0, import_node_path45.join)(getPagesTmpDir(), `_routes-${Math.random()}.json`) : void 0;
|
136524
136623
|
let filepathRoutingConfig;
|
136525
136624
|
if (!_workerJS && (0, import_node_fs22.existsSync)(functionsDirectory)) {
|
@@ -136825,7 +136924,7 @@ var import_node_events6 = require("node:events");
|
|
136825
136924
|
init_import_meta_url();
|
136826
136925
|
var import_assert3 = __toESM(require("assert"));
|
136827
136926
|
var import_fs8 = require("fs");
|
136828
|
-
var
|
136927
|
+
var import_path9 = __toESM(require("path"));
|
136829
136928
|
var import_chokidar4 = require("chokidar");
|
136830
136929
|
|
136831
136930
|
// src/deployment-bundle/run-custom-build.ts
|
@@ -137083,7 +137182,7 @@ var BundlerController = class extends Controller {
|
|
137083
137182
|
this.#customBuildAborter.abort();
|
137084
137183
|
this.#customBuildAborter = new AbortController();
|
137085
137184
|
const buildAborter = this.#customBuildAborter;
|
137086
|
-
const relativeFile =
|
137185
|
+
const relativeFile = import_path9.default.relative(config.projectRoot, config.entrypoint) || ".";
|
137087
137186
|
logger.log(`The file ${filePath} changed, restarting build...`);
|
137088
137187
|
this.emitBundleStartEvent(config);
|
137089
137188
|
try {
|
@@ -137103,7 +137202,7 @@ var BundlerController = class extends Controller {
|
|
137103
137202
|
if (!config.build?.bundle) {
|
137104
137203
|
const destinationDir = this.#tmpDir.path;
|
137105
137204
|
(0, import_fs8.writeFileSync)(
|
137106
|
-
|
137205
|
+
import_path9.default.join(destinationDir, import_path9.default.basename(config.entrypoint)),
|
137107
137206
|
(0, import_fs8.readFileSync)(config.entrypoint, "utf-8")
|
137108
137207
|
);
|
137109
137208
|
}
|
@@ -137114,7 +137213,7 @@ var BundlerController = class extends Controller {
|
|
137114
137213
|
moduleRoot: config.build.moduleRoot,
|
137115
137214
|
exports: config.build.exports
|
137116
137215
|
};
|
137117
|
-
const entryDirectory =
|
137216
|
+
const entryDirectory = import_path9.default.dirname(config.entrypoint);
|
137118
137217
|
const moduleCollector = createModuleCollector({
|
137119
137218
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
137120
137219
|
entryDirectory,
|
@@ -140690,7 +140789,7 @@ init_import_meta_url();
|
|
140690
140789
|
// src/ai/createFinetune.ts
|
140691
140790
|
init_import_meta_url();
|
140692
140791
|
var import_fs9 = __toESM(require("fs"));
|
140693
|
-
var
|
140792
|
+
var import_path10 = __toESM(require("path"));
|
140694
140793
|
var import_undici13 = __toESM(require_undici());
|
140695
140794
|
|
140696
140795
|
// src/ai/utils.ts
|
@@ -140797,7 +140896,7 @@ var handler = withConfig(
|
|
140797
140896
|
for (let i = 0; i < files.length; i++) {
|
140798
140897
|
const file = files[i];
|
140799
140898
|
if (requiredAssets.includes(file.name)) {
|
140800
|
-
const filePath =
|
140899
|
+
const filePath = import_path10.default.join(folder_path, file.name);
|
140801
140900
|
logger.log(
|
140802
140901
|
`\u{1F300} Uploading file "${filePath}" to "${finetune_name}"...`
|
140803
140902
|
);
|
@@ -140947,10 +141046,22 @@ __name(ai, "ai");
|
|
140947
141046
|
// src/cloudchamber/index.ts
|
140948
141047
|
init_import_meta_url();
|
140949
141048
|
|
140950
|
-
// src/cloudchamber/
|
141049
|
+
// src/cloudchamber/apply.ts
|
140951
141050
|
init_import_meta_url();
|
140952
|
-
|
140953
|
-
|
141051
|
+
|
141052
|
+
// ../cli/args.ts
|
141053
|
+
init_import_meta_url();
|
141054
|
+
var processArgument = /* @__PURE__ */ __name(async (args, name2, promptConfig) => {
|
141055
|
+
const value = args[name2];
|
141056
|
+
const result = await inputPrompt({
|
141057
|
+
...promptConfig,
|
141058
|
+
// Accept the default value if the arg is already set
|
141059
|
+
acceptDefault: promptConfig.acceptDefault ?? value !== void 0,
|
141060
|
+
defaultValue: value ?? promptConfig.defaultValue
|
141061
|
+
});
|
141062
|
+
args[name2] = result;
|
141063
|
+
return result;
|
141064
|
+
}, "processArgument");
|
140954
141065
|
|
140955
141066
|
// src/cloudchamber/client/index.ts
|
140956
141067
|
init_import_meta_url();
|
@@ -141570,6 +141681,259 @@ __name(AccountService, "AccountService");
|
|
141570
141681
|
|
141571
141682
|
// src/cloudchamber/client/services/ApplicationsService.ts
|
141572
141683
|
init_import_meta_url();
|
141684
|
+
var ApplicationsService = class {
|
141685
|
+
/**
|
141686
|
+
* Create a new application
|
141687
|
+
* Create a new application. An Application represents an intent to run one or more containers, with the same image, dynamically scheduled based on constraints
|
141688
|
+
* @param requestBody
|
141689
|
+
* @returns Application A newly created application
|
141690
|
+
* @throws ApiError
|
141691
|
+
*/
|
141692
|
+
static createApplication(requestBody) {
|
141693
|
+
return request(OpenAPI, {
|
141694
|
+
method: "POST",
|
141695
|
+
url: "/applications",
|
141696
|
+
body: requestBody,
|
141697
|
+
mediaType: "application/json",
|
141698
|
+
errors: {
|
141699
|
+
400: `Could not create the application because of input/limits reasons, more details in the error code`,
|
141700
|
+
401: `Unauthorized`,
|
141701
|
+
500: `There has been an internal error`
|
141702
|
+
}
|
141703
|
+
});
|
141704
|
+
}
|
141705
|
+
/**
|
141706
|
+
* List Applications associated with your account
|
141707
|
+
* Lists all the applications that are associated with your account
|
141708
|
+
* @param name Filter applications by name
|
141709
|
+
* @param image Filter applications by image
|
141710
|
+
* @param label Filter applications by label
|
141711
|
+
* @returns ListApplications Get all application associated with your account
|
141712
|
+
* @throws ApiError
|
141713
|
+
*/
|
141714
|
+
static listApplications(name2, image, label) {
|
141715
|
+
return request(OpenAPI, {
|
141716
|
+
method: "GET",
|
141717
|
+
url: "/applications",
|
141718
|
+
query: {
|
141719
|
+
name: name2,
|
141720
|
+
image,
|
141721
|
+
label
|
141722
|
+
},
|
141723
|
+
errors: {
|
141724
|
+
401: `Unauthorized`,
|
141725
|
+
500: `There has been an internal error`
|
141726
|
+
}
|
141727
|
+
});
|
141728
|
+
}
|
141729
|
+
/**
|
141730
|
+
* Get a single application by id
|
141731
|
+
* Returns a single application by id
|
141732
|
+
* @param applicationId
|
141733
|
+
* @returns Application A single application
|
141734
|
+
* @throws ApiError
|
141735
|
+
*/
|
141736
|
+
static getApplication(applicationId) {
|
141737
|
+
return request(OpenAPI, {
|
141738
|
+
method: "GET",
|
141739
|
+
url: "/applications/{application_id}",
|
141740
|
+
path: {
|
141741
|
+
application_id: applicationId
|
141742
|
+
},
|
141743
|
+
errors: {
|
141744
|
+
401: `Unauthorized`,
|
141745
|
+
404: `Response body when an Application is not found`,
|
141746
|
+
500: `There has been an internal error`
|
141747
|
+
}
|
141748
|
+
});
|
141749
|
+
}
|
141750
|
+
/**
|
141751
|
+
* Modify an application
|
141752
|
+
* Modifies a single application by id. Only the instances can be modified to allow scaling up/down.
|
141753
|
+
* @param applicationId
|
141754
|
+
* @param requestBody
|
141755
|
+
* @returns Application Modify application response
|
141756
|
+
* @throws ApiError
|
141757
|
+
*/
|
141758
|
+
static modifyApplication(applicationId, requestBody) {
|
141759
|
+
return request(OpenAPI, {
|
141760
|
+
method: "PATCH",
|
141761
|
+
url: "/applications/{application_id}",
|
141762
|
+
path: {
|
141763
|
+
application_id: applicationId
|
141764
|
+
},
|
141765
|
+
body: requestBody,
|
141766
|
+
mediaType: "application/json",
|
141767
|
+
errors: {
|
141768
|
+
401: `Unauthorized`,
|
141769
|
+
404: `Response body when an Application is not found`,
|
141770
|
+
500: `There has been an internal error`
|
141771
|
+
}
|
141772
|
+
});
|
141773
|
+
}
|
141774
|
+
/**
|
141775
|
+
* Delete a single application by id
|
141776
|
+
* Deletes a single application by id
|
141777
|
+
* @param applicationId
|
141778
|
+
* @returns EmptyResponse Delete application response
|
141779
|
+
* @throws ApiError
|
141780
|
+
*/
|
141781
|
+
static deleteApplication(applicationId) {
|
141782
|
+
return request(OpenAPI, {
|
141783
|
+
method: "DELETE",
|
141784
|
+
url: "/applications/{application_id}",
|
141785
|
+
path: {
|
141786
|
+
application_id: applicationId
|
141787
|
+
},
|
141788
|
+
errors: {
|
141789
|
+
401: `Unauthorized`,
|
141790
|
+
404: `Response body when an Application is not found`,
|
141791
|
+
500: `There has been an internal error`
|
141792
|
+
}
|
141793
|
+
});
|
141794
|
+
}
|
141795
|
+
/**
|
141796
|
+
* Application queue status
|
141797
|
+
* Get an application's queue status. Only works under an application with type jobs.
|
141798
|
+
* @param applicationId
|
141799
|
+
* @returns ApplicationStatus Application status with details about the job queue, instances and other metadata for introspection.
|
141800
|
+
* @throws ApiError
|
141801
|
+
*/
|
141802
|
+
static getApplicationStatus(applicationId) {
|
141803
|
+
return request(OpenAPI, {
|
141804
|
+
method: "GET",
|
141805
|
+
url: "/applications/{application_id}/status",
|
141806
|
+
path: {
|
141807
|
+
application_id: applicationId
|
141808
|
+
},
|
141809
|
+
errors: {
|
141810
|
+
401: `Unauthorized`,
|
141811
|
+
404: `Response body when an Application is not found`,
|
141812
|
+
500: `There has been an internal error`
|
141813
|
+
}
|
141814
|
+
});
|
141815
|
+
}
|
141816
|
+
/**
|
141817
|
+
* Create a new job within an application
|
141818
|
+
* Returns the created job
|
141819
|
+
* @param applicationId
|
141820
|
+
* @param requestBody
|
141821
|
+
* @returns ApplicationJob A single job within an application
|
141822
|
+
* @throws ApiError
|
141823
|
+
*/
|
141824
|
+
static createApplicationJob(applicationId, requestBody) {
|
141825
|
+
return request(OpenAPI, {
|
141826
|
+
method: "POST",
|
141827
|
+
url: "/applications/{application_id}/jobs",
|
141828
|
+
path: {
|
141829
|
+
application_id: applicationId
|
141830
|
+
},
|
141831
|
+
body: requestBody,
|
141832
|
+
mediaType: "application/json",
|
141833
|
+
errors: {
|
141834
|
+
400: `Can't create the application job because it has bad inputs`,
|
141835
|
+
401: `Unauthorized`,
|
141836
|
+
404: `Response body when an Application is not found`,
|
141837
|
+
500: `There has been an internal error`
|
141838
|
+
}
|
141839
|
+
});
|
141840
|
+
}
|
141841
|
+
/**
|
141842
|
+
* Get an application job by application and job id
|
141843
|
+
* Returns a single application job by id with its current status
|
141844
|
+
* @param applicationId
|
141845
|
+
* @param jobId
|
141846
|
+
* @returns ApplicationJob A single application
|
141847
|
+
* @throws ApiError
|
141848
|
+
*/
|
141849
|
+
static getApplicationJob(applicationId, jobId) {
|
141850
|
+
return request(OpenAPI, {
|
141851
|
+
method: "GET",
|
141852
|
+
url: "/applications/{application_id}/jobs/{job_id}",
|
141853
|
+
path: {
|
141854
|
+
application_id: applicationId,
|
141855
|
+
job_id: jobId
|
141856
|
+
},
|
141857
|
+
errors: {
|
141858
|
+
401: `Unauthorized`,
|
141859
|
+
404: `Response body when an Application/Job is not found`,
|
141860
|
+
500: `There has been an internal error`
|
141861
|
+
}
|
141862
|
+
});
|
141863
|
+
}
|
141864
|
+
/**
|
141865
|
+
* Delete an application job by application and job id
|
141866
|
+
* Cleans up the specific job from the Application and all its assoicated resources
|
141867
|
+
* @param applicationId
|
141868
|
+
* @param jobId
|
141869
|
+
* @returns GenericMessageResponse Generic OK response
|
141870
|
+
* @throws ApiError
|
141871
|
+
*/
|
141872
|
+
static deleteApplicationJob(applicationId, jobId) {
|
141873
|
+
return request(OpenAPI, {
|
141874
|
+
method: "DELETE",
|
141875
|
+
url: "/applications/{application_id}/jobs/{job_id}",
|
141876
|
+
path: {
|
141877
|
+
application_id: applicationId,
|
141878
|
+
job_id: jobId
|
141879
|
+
},
|
141880
|
+
errors: {
|
141881
|
+
401: `Unauthorized`,
|
141882
|
+
404: `Response body when an Application/Job is not found`,
|
141883
|
+
500: `There has been an internal error`
|
141884
|
+
}
|
141885
|
+
});
|
141886
|
+
}
|
141887
|
+
/**
|
141888
|
+
* Modify an existing application job
|
141889
|
+
* Modify an application job state
|
141890
|
+
* @param applicationId
|
141891
|
+
* @param jobId
|
141892
|
+
* @param requestBody
|
141893
|
+
* @returns ApplicationJob A modified job within an application
|
141894
|
+
* @throws ApiError
|
141895
|
+
*/
|
141896
|
+
static modifyApplicationJob(applicationId, jobId, requestBody) {
|
141897
|
+
return request(OpenAPI, {
|
141898
|
+
method: "PATCH",
|
141899
|
+
url: "/applications/{application_id}/jobs/{job_id}",
|
141900
|
+
path: {
|
141901
|
+
application_id: applicationId,
|
141902
|
+
job_id: jobId
|
141903
|
+
},
|
141904
|
+
body: requestBody,
|
141905
|
+
mediaType: "application/json",
|
141906
|
+
errors: {
|
141907
|
+
400: `Can't modify the application job because it has bad inputs`,
|
141908
|
+
401: `Unauthorized`,
|
141909
|
+
404: `Response body when an Application/Job is not found`,
|
141910
|
+
500: `There has been an internal error`
|
141911
|
+
}
|
141912
|
+
});
|
141913
|
+
}
|
141914
|
+
/**
|
141915
|
+
* Get a single applications deployments
|
141916
|
+
* Returns a single applications deployments
|
141917
|
+
* @param applicationId
|
141918
|
+
* @returns ListDeploymentsV2 List of deployments with their corresponding placements
|
141919
|
+
* @throws ApiError
|
141920
|
+
*/
|
141921
|
+
static listDeploymentsByApplication(applicationId) {
|
141922
|
+
return request(OpenAPI, {
|
141923
|
+
method: "GET",
|
141924
|
+
url: "/applications/{application_id}/deployments",
|
141925
|
+
path: {
|
141926
|
+
application_id: applicationId
|
141927
|
+
},
|
141928
|
+
errors: {
|
141929
|
+
401: `Unauthorized`,
|
141930
|
+
404: `Response body when an Application is not found`,
|
141931
|
+
500: `There has been an internal error`
|
141932
|
+
}
|
141933
|
+
});
|
141934
|
+
}
|
141935
|
+
};
|
141936
|
+
__name(ApplicationsService, "ApplicationsService");
|
141573
141937
|
|
141574
141938
|
// src/cloudchamber/client/services/DeploymentsService.ts
|
141575
141939
|
init_import_meta_url();
|
@@ -142030,6 +142394,11 @@ var SshPublicKeysService = class {
|
|
142030
142394
|
};
|
142031
142395
|
__name(SshPublicKeysService, "SshPublicKeysService");
|
142032
142396
|
|
142397
|
+
// src/cloudchamber/common.ts
|
142398
|
+
init_import_meta_url();
|
142399
|
+
var import_promises18 = require("fs/promises");
|
142400
|
+
var import_process2 = require("process");
|
142401
|
+
|
142033
142402
|
// src/cloudchamber/helpers/wrap.ts
|
142034
142403
|
init_import_meta_url();
|
142035
142404
|
async function wrap2(fn2) {
|
@@ -142096,13 +142465,13 @@ function parseImageName(value) {
|
|
142096
142465
|
}
|
142097
142466
|
__name(parseImageName, "parseImageName");
|
142098
142467
|
function handleFailure(cb) {
|
142099
|
-
return async (
|
142468
|
+
return async (args) => {
|
142100
142469
|
try {
|
142101
|
-
const config = readConfig(
|
142102
|
-
await fillOpenAPIConfiguration(config,
|
142103
|
-
await cb(
|
142470
|
+
const config = readConfig(args);
|
142471
|
+
await fillOpenAPIConfiguration(config, args.json);
|
142472
|
+
await cb(args, config);
|
142104
142473
|
} catch (err) {
|
142105
|
-
if (!
|
142474
|
+
if (!args.json) {
|
142106
142475
|
throw err;
|
142107
142476
|
}
|
142108
142477
|
if (err instanceof ApiError) {
|
@@ -142476,22 +142845,637 @@ async function promptForLabels(labels, initiallySelected, allowSkipping) {
|
|
142476
142845
|
}
|
142477
142846
|
__name(promptForLabels, "promptForLabels");
|
142478
142847
|
|
142479
|
-
// src/cloudchamber/
|
142848
|
+
// src/cloudchamber/helpers/diff.ts
|
142480
142849
|
init_import_meta_url();
|
142850
|
+
var Diff = class {
|
142851
|
+
diff(oldString, newString, callback) {
|
142852
|
+
function done(value) {
|
142853
|
+
callback(value);
|
142854
|
+
return true;
|
142855
|
+
}
|
142856
|
+
__name(done, "done");
|
142857
|
+
const newLen = newString.length, oldLen = oldString.length;
|
142858
|
+
let editLength = 1;
|
142859
|
+
const bestPath = [
|
142860
|
+
{ oldPos: -1, lastComponent: void 0 }
|
142861
|
+
];
|
142862
|
+
if (bestPath[0] === void 0) {
|
142863
|
+
throw new Error("unreachable");
|
142864
|
+
}
|
142865
|
+
let newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
142866
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
142867
|
+
return done(
|
142868
|
+
buildValues(
|
142869
|
+
this,
|
142870
|
+
bestPath[0].lastComponent,
|
142871
|
+
newString,
|
142872
|
+
oldString,
|
142873
|
+
false
|
142874
|
+
)
|
142875
|
+
);
|
142876
|
+
}
|
142877
|
+
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
142878
|
+
const execEditLength = /* @__PURE__ */ __name(() => {
|
142879
|
+
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
142880
|
+
let basePath;
|
142881
|
+
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
142882
|
+
if (removePath) {
|
142883
|
+
bestPath[diagonalPath - 1] = void 0;
|
142884
|
+
}
|
142885
|
+
let canAdd = false;
|
142886
|
+
if (addPath) {
|
142887
|
+
const addPathNewPos = addPath.oldPos - diagonalPath;
|
142888
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
142889
|
+
}
|
142890
|
+
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
142891
|
+
if (!canAdd && !canRemove) {
|
142892
|
+
bestPath[diagonalPath] = void 0;
|
142893
|
+
continue;
|
142894
|
+
}
|
142895
|
+
if (addPath && (!canRemove || canAdd && (removePath?.oldPos ?? 0) < (addPath?.oldPos ?? 0))) {
|
142896
|
+
basePath = this.addToPath(addPath, true, false, 0);
|
142897
|
+
} else if (removePath) {
|
142898
|
+
basePath = this.addToPath(removePath, false, true, 1);
|
142899
|
+
} else {
|
142900
|
+
throw new Error("unreachable");
|
142901
|
+
}
|
142902
|
+
newPos = this.extractCommon(
|
142903
|
+
basePath,
|
142904
|
+
newString,
|
142905
|
+
oldString,
|
142906
|
+
diagonalPath
|
142907
|
+
);
|
142908
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
142909
|
+
return done(
|
142910
|
+
buildValues(
|
142911
|
+
this,
|
142912
|
+
basePath.lastComponent,
|
142913
|
+
newString,
|
142914
|
+
oldString,
|
142915
|
+
false
|
142916
|
+
)
|
142917
|
+
);
|
142918
|
+
} else {
|
142919
|
+
bestPath[diagonalPath] = basePath;
|
142920
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
142921
|
+
maxDiagonalToConsider = Math.min(
|
142922
|
+
maxDiagonalToConsider,
|
142923
|
+
diagonalPath - 1
|
142924
|
+
);
|
142925
|
+
}
|
142926
|
+
if (newPos + 1 >= newLen) {
|
142927
|
+
minDiagonalToConsider = Math.max(
|
142928
|
+
minDiagonalToConsider,
|
142929
|
+
diagonalPath + 1
|
142930
|
+
);
|
142931
|
+
}
|
142932
|
+
}
|
142933
|
+
}
|
142934
|
+
editLength++;
|
142935
|
+
}, "execEditLength");
|
142936
|
+
while (!execEditLength()) {
|
142937
|
+
}
|
142938
|
+
}
|
142939
|
+
addToPath(path70, added, removed, oldPosInc) {
|
142940
|
+
const last = path70.lastComponent;
|
142941
|
+
if (last && last.added === added && last.removed === removed) {
|
142942
|
+
return {
|
142943
|
+
oldPos: path70.oldPos + oldPosInc,
|
142944
|
+
lastComponent: {
|
142945
|
+
count: last.count + 1,
|
142946
|
+
added,
|
142947
|
+
removed,
|
142948
|
+
previousComponent: last.previousComponent
|
142949
|
+
}
|
142950
|
+
};
|
142951
|
+
}
|
142952
|
+
return {
|
142953
|
+
oldPos: path70.oldPos + oldPosInc,
|
142954
|
+
lastComponent: {
|
142955
|
+
count: 1,
|
142956
|
+
added,
|
142957
|
+
removed,
|
142958
|
+
previousComponent: last
|
142959
|
+
}
|
142960
|
+
};
|
142961
|
+
}
|
142962
|
+
extractCommon(basePath, newString, oldString, diagonalPath) {
|
142963
|
+
const newLen = newString.length;
|
142964
|
+
const oldLen = oldString.length;
|
142965
|
+
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
142966
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && oldString[oldPos + 1] === newString[newPos + 1]) {
|
142967
|
+
newPos++;
|
142968
|
+
oldPos++;
|
142969
|
+
commonCount++;
|
142970
|
+
}
|
142971
|
+
if (commonCount) {
|
142972
|
+
basePath.lastComponent = {
|
142973
|
+
count: commonCount,
|
142974
|
+
previousComponent: basePath.lastComponent,
|
142975
|
+
added: false,
|
142976
|
+
removed: false
|
142977
|
+
};
|
142978
|
+
}
|
142979
|
+
basePath.oldPos = oldPos;
|
142980
|
+
return newPos;
|
142981
|
+
}
|
142982
|
+
equals(left2, right2) {
|
142983
|
+
return left2 === right2;
|
142984
|
+
}
|
142985
|
+
join(chars) {
|
142986
|
+
return chars.join("");
|
142987
|
+
}
|
142988
|
+
};
|
142989
|
+
__name(Diff, "Diff");
|
142990
|
+
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
|
142991
|
+
const components = [];
|
142992
|
+
let nextComponent;
|
142993
|
+
while (lastComponent) {
|
142994
|
+
components.push(lastComponent);
|
142995
|
+
nextComponent = lastComponent.previousComponent;
|
142996
|
+
delete lastComponent.previousComponent;
|
142997
|
+
lastComponent = nextComponent;
|
142998
|
+
}
|
142999
|
+
components.reverse();
|
143000
|
+
const componentLen = components.length;
|
143001
|
+
let componentPos = 0, newPos = 0, oldPos = 0;
|
143002
|
+
for (; componentPos < componentLen; componentPos++) {
|
143003
|
+
const component = components[componentPos];
|
143004
|
+
if (!component.removed) {
|
143005
|
+
if (!component.added && useLongestToken) {
|
143006
|
+
let value = newString.slice(newPos, newPos + component.count);
|
143007
|
+
value = value.map((el, i) => {
|
143008
|
+
const oldValue = oldString[oldPos + i];
|
143009
|
+
return oldValue.length > el.length ? oldValue : el;
|
143010
|
+
});
|
143011
|
+
component.value = diff.join(value);
|
143012
|
+
} else {
|
143013
|
+
component.value = diff.join(
|
143014
|
+
newString.slice(newPos, newPos + component.count)
|
143015
|
+
);
|
143016
|
+
}
|
143017
|
+
newPos += component.count;
|
143018
|
+
if (!component.added) {
|
143019
|
+
oldPos += component.count;
|
143020
|
+
}
|
143021
|
+
} else {
|
143022
|
+
component.value = diff.join(
|
143023
|
+
oldString.slice(oldPos, oldPos + component.count)
|
143024
|
+
);
|
143025
|
+
oldPos += component.count;
|
143026
|
+
}
|
143027
|
+
}
|
143028
|
+
return components;
|
143029
|
+
}
|
143030
|
+
__name(buildValues, "buildValues");
|
143031
|
+
var lineDiff = new Diff();
|
143032
|
+
function tokenize(value) {
|
143033
|
+
const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
143034
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
143035
|
+
linesAndNewlines.pop();
|
143036
|
+
}
|
143037
|
+
for (let i = 0; i < linesAndNewlines.length; i++) {
|
143038
|
+
const line = linesAndNewlines[i];
|
143039
|
+
retLines.push(line);
|
143040
|
+
}
|
143041
|
+
return retLines.filter((s) => s !== "");
|
143042
|
+
}
|
143043
|
+
__name(tokenize, "tokenize");
|
143044
|
+
function diffLines(oldStr, newStr) {
|
143045
|
+
let res = [];
|
143046
|
+
lineDiff.diff(tokenize(oldStr), tokenize(newStr), (r3) => {
|
143047
|
+
res = r3;
|
143048
|
+
});
|
143049
|
+
return res;
|
143050
|
+
}
|
143051
|
+
__name(diffLines, "diffLines");
|
142481
143052
|
|
142482
|
-
//
|
142483
|
-
|
142484
|
-
|
142485
|
-
|
142486
|
-
|
142487
|
-
|
142488
|
-
|
142489
|
-
acceptDefault: promptConfig.acceptDefault ?? value !== void 0,
|
142490
|
-
defaultValue: value ?? promptConfig.defaultValue
|
143053
|
+
// src/cloudchamber/apply.ts
|
143054
|
+
function applyCommandOptionalYargs(yargs) {
|
143055
|
+
return yargs.option("skip-defaults", {
|
143056
|
+
requiresArg: true,
|
143057
|
+
type: "boolean",
|
143058
|
+
demandOption: false,
|
143059
|
+
describe: "Skips recommended defaults added by apply"
|
142491
143060
|
});
|
142492
|
-
|
142493
|
-
|
142494
|
-
|
143061
|
+
}
|
143062
|
+
__name(applyCommandOptionalYargs, "applyCommandOptionalYargs");
|
143063
|
+
function createApplicationToModifyApplication(req) {
|
143064
|
+
return {
|
143065
|
+
configuration: req.configuration,
|
143066
|
+
instances: req.instances,
|
143067
|
+
constraints: req.constraints,
|
143068
|
+
affinities: req.affinities,
|
143069
|
+
scheduling_policy: req.scheduling_policy
|
143070
|
+
};
|
143071
|
+
}
|
143072
|
+
__name(createApplicationToModifyApplication, "createApplicationToModifyApplication");
|
143073
|
+
function applicationToCreateApplication(application) {
|
143074
|
+
return {
|
143075
|
+
configuration: application.configuration,
|
143076
|
+
constraints: application.constraints,
|
143077
|
+
name: application.name,
|
143078
|
+
scheduling_policy: application.scheduling_policy,
|
143079
|
+
affinities: application.affinities,
|
143080
|
+
instances: application.instances,
|
143081
|
+
jobs: application.jobs ? true : void 0
|
143082
|
+
};
|
143083
|
+
}
|
143084
|
+
__name(applicationToCreateApplication, "applicationToCreateApplication");
|
143085
|
+
function containerAppToCreateApplication(containerApp, skipDefaults = false) {
|
143086
|
+
const configuration = containerApp.configuration;
|
143087
|
+
return {
|
143088
|
+
...containerApp,
|
143089
|
+
configuration,
|
143090
|
+
scheduling_policy: containerApp.scheduling_policy ?? "regional" /* REGIONAL */,
|
143091
|
+
constraints: {
|
143092
|
+
...containerApp.constraints ?? (!skipDefaults ? { tier: 1 } : void 0),
|
143093
|
+
cities: containerApp.constraints?.cities?.map(
|
143094
|
+
(city) => city.toLowerCase()
|
143095
|
+
),
|
143096
|
+
regions: containerApp.constraints?.regions?.map(
|
143097
|
+
(region) => region.toUpperCase()
|
143098
|
+
)
|
143099
|
+
}
|
143100
|
+
};
|
143101
|
+
}
|
143102
|
+
__name(containerAppToCreateApplication, "containerAppToCreateApplication");
|
143103
|
+
function isNumber(c2) {
|
143104
|
+
if (typeof c2 === "number") {
|
143105
|
+
return true;
|
143106
|
+
}
|
143107
|
+
const code = c2.charCodeAt(0);
|
143108
|
+
const zero = "0".charCodeAt(0);
|
143109
|
+
const nine = "9".charCodeAt(0);
|
143110
|
+
return code >= zero && code <= nine;
|
143111
|
+
}
|
143112
|
+
__name(isNumber, "isNumber");
|
143113
|
+
function createLine(el, startWith = "") {
|
143114
|
+
let line = startWith;
|
143115
|
+
let lastAdded = 0;
|
143116
|
+
const addToLine = /* @__PURE__ */ __name((i, color = (s) => s) => {
|
143117
|
+
line += color(el.slice(lastAdded, i));
|
143118
|
+
lastAdded = i;
|
143119
|
+
}, "addToLine");
|
143120
|
+
const state = {
|
143121
|
+
render: "left"
|
143122
|
+
};
|
143123
|
+
for (let i = 0; i < el.length; i++) {
|
143124
|
+
const current = el[i];
|
143125
|
+
const peek = i + 1 < el.length ? el[i + 1] : null;
|
143126
|
+
const prev = i === 0 ? null : el[i - 1];
|
143127
|
+
switch (state.render) {
|
143128
|
+
case "left":
|
143129
|
+
if (current === "=") {
|
143130
|
+
state.render = "right";
|
143131
|
+
}
|
143132
|
+
break;
|
143133
|
+
case "right":
|
143134
|
+
if (current === '"') {
|
143135
|
+
addToLine(i);
|
143136
|
+
state.render = "quotes";
|
143137
|
+
break;
|
143138
|
+
}
|
143139
|
+
if (isNumber(current)) {
|
143140
|
+
addToLine(i);
|
143141
|
+
state.render = "number";
|
143142
|
+
break;
|
143143
|
+
}
|
143144
|
+
if (current === "[" && peek === "[") {
|
143145
|
+
state.render = "section";
|
143146
|
+
}
|
143147
|
+
break;
|
143148
|
+
case "quotes":
|
143149
|
+
if (current === '"') {
|
143150
|
+
addToLine(i + 1, brandColor);
|
143151
|
+
state.render = "right";
|
143152
|
+
}
|
143153
|
+
break;
|
143154
|
+
case "number":
|
143155
|
+
if (!isNumber(el)) {
|
143156
|
+
addToLine(i, red);
|
143157
|
+
state.render = "right";
|
143158
|
+
}
|
143159
|
+
break;
|
143160
|
+
case "section":
|
143161
|
+
if (current === "]" && prev === "]") {
|
143162
|
+
addToLine(i + 1);
|
143163
|
+
state.render = "right";
|
143164
|
+
}
|
143165
|
+
}
|
143166
|
+
}
|
143167
|
+
switch (state.render) {
|
143168
|
+
case "left":
|
143169
|
+
addToLine(el.length);
|
143170
|
+
break;
|
143171
|
+
case "right":
|
143172
|
+
addToLine(el.length);
|
143173
|
+
break;
|
143174
|
+
case "quotes":
|
143175
|
+
addToLine(el.length, brandColor);
|
143176
|
+
break;
|
143177
|
+
case "number":
|
143178
|
+
addToLine(el.length, red);
|
143179
|
+
break;
|
143180
|
+
case "section":
|
143181
|
+
addToLine(el.length, bold);
|
143182
|
+
break;
|
143183
|
+
}
|
143184
|
+
return line;
|
143185
|
+
}
|
143186
|
+
__name(createLine, "createLine");
|
143187
|
+
function printLine(el, startWith = "", printFunc = log) {
|
143188
|
+
printFunc(createLine(el, startWith));
|
143189
|
+
}
|
143190
|
+
__name(printLine, "printLine");
|
143191
|
+
function stripUndefined(r3) {
|
143192
|
+
for (const k2 in r3) {
|
143193
|
+
if (r3[k2] === void 0) {
|
143194
|
+
delete r3[k2];
|
143195
|
+
}
|
143196
|
+
}
|
143197
|
+
return r3;
|
143198
|
+
}
|
143199
|
+
__name(stripUndefined, "stripUndefined");
|
143200
|
+
function sortObjectKeys(unordered) {
|
143201
|
+
if (Array.isArray(unordered)) {
|
143202
|
+
return unordered;
|
143203
|
+
}
|
143204
|
+
return Object.keys(unordered).sort().reduce(
|
143205
|
+
(obj, key) => {
|
143206
|
+
obj[key] = unordered[key];
|
143207
|
+
return obj;
|
143208
|
+
},
|
143209
|
+
{}
|
143210
|
+
);
|
143211
|
+
}
|
143212
|
+
__name(sortObjectKeys, "sortObjectKeys");
|
143213
|
+
function sortObjectRecursive(object) {
|
143214
|
+
if (typeof object !== "object") {
|
143215
|
+
return object;
|
143216
|
+
}
|
143217
|
+
if (Array.isArray(object)) {
|
143218
|
+
return object.map((obj) => sortObjectRecursive(obj));
|
143219
|
+
}
|
143220
|
+
const objectCopy = { ...object };
|
143221
|
+
for (const [key, value] of Object.entries(object)) {
|
143222
|
+
if (typeof value === "object") {
|
143223
|
+
if (value === null) {
|
143224
|
+
continue;
|
143225
|
+
}
|
143226
|
+
objectCopy[key] = sortObjectRecursive(
|
143227
|
+
value
|
143228
|
+
);
|
143229
|
+
}
|
143230
|
+
}
|
143231
|
+
return sortObjectKeys(objectCopy);
|
143232
|
+
}
|
143233
|
+
__name(sortObjectRecursive, "sortObjectRecursive");
|
143234
|
+
async function applyCommand(args, config) {
|
143235
|
+
startSection(
|
143236
|
+
"Deploy a container application",
|
143237
|
+
"deploy changes to your application"
|
143238
|
+
);
|
143239
|
+
if (config.containers.app.length === 0) {
|
143240
|
+
endSection(
|
143241
|
+
"You don't have any container applications defined in your wrangler.toml",
|
143242
|
+
"You can set the following configuration in your wrangler.toml"
|
143243
|
+
);
|
143244
|
+
const configuration = {
|
143245
|
+
configuration: {
|
143246
|
+
image: "docker.io/cloudflare/hello-world:1.0"
|
143247
|
+
},
|
143248
|
+
instances: 2,
|
143249
|
+
name: config.name ?? "my-containers-application"
|
143250
|
+
};
|
143251
|
+
const endConfig = args.env !== void 0 ? {
|
143252
|
+
env: { [args.env]: { containers: { app: [configuration] } } }
|
143253
|
+
} : { containers: { app: [configuration] } };
|
143254
|
+
formatConfigSnippet(endConfig, config.configPath).split("\n").forEach((el) => {
|
143255
|
+
printLine(el, " ", logRaw);
|
143256
|
+
});
|
143257
|
+
return;
|
143258
|
+
}
|
143259
|
+
const applications = await promiseSpinner(
|
143260
|
+
ApplicationsService.listApplications(),
|
143261
|
+
{ json: args.json, message: "Loading applications" }
|
143262
|
+
);
|
143263
|
+
const applicationByNames = {};
|
143264
|
+
for (const application of applications) {
|
143265
|
+
applicationByNames[application.name] = application;
|
143266
|
+
}
|
143267
|
+
const actions = [];
|
143268
|
+
log(dim("Container application changes\n"));
|
143269
|
+
for (const appConfigNoDefaults of config.containers.app) {
|
143270
|
+
const appConfig = containerAppToCreateApplication(
|
143271
|
+
appConfigNoDefaults,
|
143272
|
+
args.skipDefaults
|
143273
|
+
);
|
143274
|
+
const application = applicationByNames[appConfig.name];
|
143275
|
+
if (application !== void 0 && application !== null) {
|
143276
|
+
const prevApp = sortObjectRecursive(
|
143277
|
+
stripUndefined(applicationToCreateApplication(application))
|
143278
|
+
);
|
143279
|
+
const prev = formatConfigSnippet(
|
143280
|
+
{ containers: { app: [prevApp] } },
|
143281
|
+
config.configPath
|
143282
|
+
);
|
143283
|
+
const now = formatConfigSnippet(
|
143284
|
+
{
|
143285
|
+
containers: {
|
143286
|
+
app: [
|
143287
|
+
sortObjectRecursive(
|
143288
|
+
appConfig
|
143289
|
+
)
|
143290
|
+
]
|
143291
|
+
}
|
143292
|
+
},
|
143293
|
+
config.configPath
|
143294
|
+
);
|
143295
|
+
const results = diffLines(prev, now);
|
143296
|
+
const changes = results.find((l2) => l2.added || l2.removed) !== void 0;
|
143297
|
+
if (!changes) {
|
143298
|
+
updateStatus(`no changes ${brandColor(application.name)}`);
|
143299
|
+
continue;
|
143300
|
+
}
|
143301
|
+
updateStatus(
|
143302
|
+
`${brandColor.underline("EDIT")} ${application.name}`,
|
143303
|
+
false
|
143304
|
+
);
|
143305
|
+
let printedLines = [];
|
143306
|
+
let printedDiff = false;
|
143307
|
+
const printContext = /* @__PURE__ */ __name(() => {
|
143308
|
+
let index = 0;
|
143309
|
+
for (let i = printedLines.length - 1; i >= 0; i--) {
|
143310
|
+
if (printedLines[i].trim().startsWith("[")) {
|
143311
|
+
log("");
|
143312
|
+
index = i;
|
143313
|
+
break;
|
143314
|
+
}
|
143315
|
+
}
|
143316
|
+
for (let i = index; i < printedLines.length; i++) {
|
143317
|
+
log(printedLines[i]);
|
143318
|
+
if (printedLines.length - i > 2) {
|
143319
|
+
i = printedLines.length - 2;
|
143320
|
+
printLine(dim("..."), " ");
|
143321
|
+
}
|
143322
|
+
}
|
143323
|
+
printedLines = [];
|
143324
|
+
}, "printContext");
|
143325
|
+
for (const lines of results) {
|
143326
|
+
const trimmedLines = (lines.value ?? "").split("\n").map((e3) => e3.trim()).filter((e3) => e3 !== "");
|
143327
|
+
for (const l2 of trimmedLines) {
|
143328
|
+
if (lines.added) {
|
143329
|
+
printContext();
|
143330
|
+
if (l2.startsWith("[")) {
|
143331
|
+
printLine("");
|
143332
|
+
}
|
143333
|
+
printedDiff = true;
|
143334
|
+
printLine(l2, green("+ "));
|
143335
|
+
} else if (lines.removed) {
|
143336
|
+
printContext();
|
143337
|
+
if (l2.startsWith("[")) {
|
143338
|
+
printLine("");
|
143339
|
+
}
|
143340
|
+
printedDiff = true;
|
143341
|
+
printLine(l2, red("- "));
|
143342
|
+
} else {
|
143343
|
+
if (printedDiff) {
|
143344
|
+
let printDots = false;
|
143345
|
+
if (l2.startsWith("[")) {
|
143346
|
+
printLine("");
|
143347
|
+
printDots = true;
|
143348
|
+
}
|
143349
|
+
printedDiff = false;
|
143350
|
+
printLine(l2, " ");
|
143351
|
+
if (printDots) {
|
143352
|
+
printLine(dim("..."), " ");
|
143353
|
+
}
|
143354
|
+
continue;
|
143355
|
+
}
|
143356
|
+
printedLines.push(createLine(l2, " "));
|
143357
|
+
}
|
143358
|
+
}
|
143359
|
+
}
|
143360
|
+
actions.push({
|
143361
|
+
action: "modify",
|
143362
|
+
application: createApplicationToModifyApplication(appConfig),
|
143363
|
+
id: application.id,
|
143364
|
+
name: application.name
|
143365
|
+
});
|
143366
|
+
printLine("");
|
143367
|
+
continue;
|
143368
|
+
}
|
143369
|
+
updateStatus(bold.underline(green.underline("NEW")) + ` ${appConfig.name}`);
|
143370
|
+
const s = formatConfigSnippet(
|
143371
|
+
{ containers: { app: [appConfig] } },
|
143372
|
+
config.configPath
|
143373
|
+
);
|
143374
|
+
s.split("\n").map((line) => line.trim()).forEach((el) => {
|
143375
|
+
printLine(el, " ");
|
143376
|
+
});
|
143377
|
+
actions.push({
|
143378
|
+
action: "create",
|
143379
|
+
application: appConfig
|
143380
|
+
});
|
143381
|
+
}
|
143382
|
+
if (actions.length == 0) {
|
143383
|
+
endSection("No changes to be made");
|
143384
|
+
return;
|
143385
|
+
}
|
143386
|
+
const yes = await processArgument(
|
143387
|
+
{ confirm: args.json ? true : void 0 },
|
143388
|
+
"confirm",
|
143389
|
+
{
|
143390
|
+
type: "confirm",
|
143391
|
+
question: "Do you want to apply these changes?",
|
143392
|
+
label: ""
|
143393
|
+
}
|
143394
|
+
);
|
143395
|
+
if (!yes) {
|
143396
|
+
cancel("Not applying changes");
|
143397
|
+
return;
|
143398
|
+
}
|
143399
|
+
function formatError(err) {
|
143400
|
+
if (err.body.error === "VALIDATE_INPUT" /* VALIDATE_INPUT */ && err.body.details !== void 0) {
|
143401
|
+
let message = "";
|
143402
|
+
for (const key in err.body.details) {
|
143403
|
+
message += ` ${brandColor(key)} ${err.body.details[key]}
|
143404
|
+
`;
|
143405
|
+
}
|
143406
|
+
return message;
|
143407
|
+
}
|
143408
|
+
return ` ${err.body.error}`;
|
143409
|
+
}
|
143410
|
+
__name(formatError, "formatError");
|
143411
|
+
for (const action of actions) {
|
143412
|
+
if (action.action === "create") {
|
143413
|
+
const [_result, err] = await wrap2(
|
143414
|
+
promiseSpinner(
|
143415
|
+
ApplicationsService.createApplication(action.application),
|
143416
|
+
{ json: args.json, message: `creating ${action.application.name}` }
|
143417
|
+
)
|
143418
|
+
);
|
143419
|
+
if (err !== null) {
|
143420
|
+
if (!(err instanceof ApiError)) {
|
143421
|
+
crash(`Unexpected error creating application: ${err.message}`);
|
143422
|
+
}
|
143423
|
+
if (err.status === 400) {
|
143424
|
+
crash(
|
143425
|
+
`Error creating application due to a misconfiguration
|
143426
|
+
${formatError(err)}`
|
143427
|
+
);
|
143428
|
+
}
|
143429
|
+
crash(
|
143430
|
+
`Error creating application due to an internal error (request id: ${err.body.request_id}): ${formatError(err)}`
|
143431
|
+
);
|
143432
|
+
}
|
143433
|
+
success(`Created application ${brandColor(action.application.name)}`, {
|
143434
|
+
shape: shapes.bar
|
143435
|
+
});
|
143436
|
+
printLine("");
|
143437
|
+
continue;
|
143438
|
+
}
|
143439
|
+
if (action.action === "modify") {
|
143440
|
+
const [_result, err] = await wrap2(
|
143441
|
+
promiseSpinner(
|
143442
|
+
ApplicationsService.modifyApplication(action.id, action.application),
|
143443
|
+
{
|
143444
|
+
json: args.json,
|
143445
|
+
message: `modifying application ${action.name}`
|
143446
|
+
}
|
143447
|
+
)
|
143448
|
+
);
|
143449
|
+
if (err !== null) {
|
143450
|
+
if (!(err instanceof ApiError)) {
|
143451
|
+
crash(
|
143452
|
+
`Unexpected error modifying application ${action.name}: ${err.message}`
|
143453
|
+
);
|
143454
|
+
}
|
143455
|
+
if (err.status === 400) {
|
143456
|
+
crash(
|
143457
|
+
`Error modifying application ${action.name} due to a ${brandColor.underline("misconfiguration")}
|
143458
|
+
|
143459
|
+
${formatError(err)}`
|
143460
|
+
);
|
143461
|
+
}
|
143462
|
+
crash(
|
143463
|
+
`Error modifying application ${action.name} due to an internal error (request id: ${err.body.request_id}): ${formatError(err)}`
|
143464
|
+
);
|
143465
|
+
}
|
143466
|
+
success(`Modified application ${brandColor(action.name)}`, {
|
143467
|
+
shape: shapes.bar
|
143468
|
+
});
|
143469
|
+
printLine("");
|
143470
|
+
continue;
|
143471
|
+
}
|
143472
|
+
}
|
143473
|
+
endSection("Applied changes");
|
143474
|
+
}
|
143475
|
+
__name(applyCommand, "applyCommand");
|
143476
|
+
|
143477
|
+
// src/cloudchamber/create.ts
|
143478
|
+
init_import_meta_url();
|
142495
143479
|
|
142496
143480
|
// src/cloudchamber/cli/index.ts
|
142497
143481
|
init_import_meta_url();
|
@@ -144390,6 +145374,11 @@ var cloudchamber = /* @__PURE__ */ __name((yargs, subHelp) => {
|
|
144390
145374
|
"send a request to an arbitrary cloudchamber endpoint",
|
144391
145375
|
(args) => yargsCurl(args),
|
144392
145376
|
(args) => handleFailure(curlCommand)(args)
|
145377
|
+
).command(
|
145378
|
+
"apply",
|
145379
|
+
"apply the changes in the container applications to deploy",
|
145380
|
+
(args) => applyCommandOptionalYargs(args),
|
145381
|
+
(args) => handleFailure(applyCommand)(args)
|
144393
145382
|
);
|
144394
145383
|
}, "cloudchamber");
|
144395
145384
|
|
@@ -144841,6 +145830,38 @@ __name(CommandRegistrationError, "CommandRegistrationError");
|
|
144841
145830
|
|
144842
145831
|
// src/core/register-yargs-command.ts
|
144843
145832
|
init_import_meta_url();
|
145833
|
+
|
145834
|
+
// src/wrangler-banner.ts
|
145835
|
+
init_import_meta_url();
|
145836
|
+
init_supports_color();
|
145837
|
+
async function printWranglerBanner(performUpdateCheck = true) {
|
145838
|
+
let text = ` \u26C5\uFE0F wrangler ${version}`;
|
145839
|
+
let maybeNewVersion;
|
145840
|
+
if (performUpdateCheck) {
|
145841
|
+
maybeNewVersion = await updateCheck();
|
145842
|
+
if (maybeNewVersion !== void 0) {
|
145843
|
+
text += ` (update available ${source_default.green(maybeNewVersion)})`;
|
145844
|
+
}
|
145845
|
+
}
|
145846
|
+
logger.log(
|
145847
|
+
"\n" + text + "\n" + (supports_color_default2.stdout ? source_default.hex("#FF8800")("-".repeat(text.length)) : "-".repeat(text.length)) + "\n"
|
145848
|
+
);
|
145849
|
+
if (maybeNewVersion !== void 0) {
|
145850
|
+
const currentMajor = parseInt(version.split(".")[0]);
|
145851
|
+
const newMajor = parseInt(maybeNewVersion.split(".")[0]);
|
145852
|
+
if (newMajor > currentMajor) {
|
145853
|
+
logger.warn(
|
145854
|
+
`The version of Wrangler you are using is now out-of-date.
|
145855
|
+
Please update to the latest version to prevent critical errors.
|
145856
|
+
Run \`npm install --save-dev wrangler@${newMajor}\` to update to the latest version.
|
145857
|
+
After installation, run Wrangler with \`npx wrangler\`.`
|
145858
|
+
);
|
145859
|
+
}
|
145860
|
+
}
|
145861
|
+
}
|
145862
|
+
__name(printWranglerBanner, "printWranglerBanner");
|
145863
|
+
|
145864
|
+
// src/core/register-yargs-command.ts
|
144844
145865
|
function createRegisterYargsCommand(yargs, subHelp) {
|
144845
145866
|
return /* @__PURE__ */ __name(function registerCommand(segment, def, registerSubTreeCallback) {
|
144846
145867
|
yargs.command(
|
@@ -144873,7 +145894,13 @@ __name(createRegisterYargsCommand, "createRegisterYargsCommand");
|
|
144873
145894
|
function createHandler(def) {
|
144874
145895
|
return /* @__PURE__ */ __name(async function handler30(args) {
|
144875
145896
|
try {
|
144876
|
-
|
145897
|
+
const shouldPrintBanner = def.behaviour?.printBanner;
|
145898
|
+
if (
|
145899
|
+
/* No defautl behaviour override: show the banner */
|
145900
|
+
shouldPrintBanner === void 0 || /* Explicit opt in: show the banner */
|
145901
|
+
typeof shouldPrintBanner === "boolean" && shouldPrintBanner !== false || /* Hook resolves to true */
|
145902
|
+
typeof shouldPrintBanner === "function" && shouldPrintBanner(args) === true
|
145903
|
+
) {
|
144877
145904
|
await printWranglerBanner();
|
144878
145905
|
}
|
144879
145906
|
if (def.metadata.deprecated) {
|
@@ -144884,7 +145911,7 @@ function createHandler(def) {
|
|
144884
145911
|
}
|
144885
145912
|
await def.validateArgs?.(args);
|
144886
145913
|
await def.handler(args, {
|
144887
|
-
config: def.behaviour?.provideConfig ?? true ? readConfig(args
|
145914
|
+
config: def.behaviour?.provideConfig ?? true ? readConfig(args, {
|
144888
145915
|
hideWarnings: !(def.behaviour?.printConfigWarnings ?? true)
|
144889
145916
|
}) : defaultWranglerConfig,
|
144890
145917
|
errors: { UserError, FatalError },
|
@@ -144904,7 +145931,7 @@ init_import_meta_url();
|
|
144904
145931
|
// src/d1/backups.ts
|
144905
145932
|
init_import_meta_url();
|
144906
145933
|
var import_promises20 = __toESM(require("node:fs/promises"));
|
144907
|
-
var
|
145934
|
+
var path45 = __toESM(require("path"));
|
144908
145935
|
|
144909
145936
|
// src/d1/formatTimeAgo.ts
|
144910
145937
|
init_import_meta_url();
|
@@ -147951,7 +148978,7 @@ var DownloadHandler = withConfig(
|
|
147951
148978
|
accountId,
|
147952
148979
|
name2
|
147953
148980
|
);
|
147954
|
-
const filename = output ||
|
148981
|
+
const filename = output || path45.resolve(`${name2}.${backupId.slice(0, 8)}.sqlite3`);
|
147955
148982
|
logger.log(`\u{1F300} Downloading backup ${backupId} from '${name2}'`);
|
147956
148983
|
const response = await getBackupResponse(accountId, db.uuid, backupId);
|
147957
148984
|
if (!response.ok) {
|
@@ -148272,7 +149299,7 @@ var Handler6 = /* @__PURE__ */ __name(async (args) => {
|
|
148272
149299
|
logger.loggerLevel = "error";
|
148273
149300
|
}
|
148274
149301
|
await printWranglerBanner();
|
148275
|
-
const config = readConfig(args
|
149302
|
+
const config = readConfig(args);
|
148276
149303
|
if (file && command2) {
|
148277
149304
|
throw createFatalError(
|
148278
149305
|
`Error: can't provide both --command and --file.`,
|
@@ -148709,7 +149736,7 @@ __name(Options7, "Options");
|
|
148709
149736
|
var Handler7 = /* @__PURE__ */ __name(async (args) => {
|
148710
149737
|
const { local, remote, name: name2, output, schema, data, table } = args;
|
148711
149738
|
await printWranglerBanner();
|
148712
|
-
const config = readConfig(args
|
149739
|
+
const config = readConfig(args);
|
148713
149740
|
if (!local && !remote) {
|
148714
149741
|
throw new UserError(`You must specify either --local or --remote`);
|
148715
149742
|
}
|
@@ -149144,19 +150171,19 @@ init_import_meta_url();
|
|
149144
150171
|
init_import_meta_url();
|
149145
150172
|
var import_node_assert22 = __toESM(require("node:assert"));
|
149146
150173
|
var import_node_fs26 = __toESM(require("node:fs"));
|
149147
|
-
var
|
150174
|
+
var import_path12 = __toESM(require("path"));
|
149148
150175
|
|
149149
150176
|
// src/d1/migrations/helpers.ts
|
149150
150177
|
init_import_meta_url();
|
149151
150178
|
var import_node_fs25 = __toESM(require("node:fs"));
|
149152
|
-
var
|
150179
|
+
var import_path11 = __toESM(require("path"));
|
149153
150180
|
async function getMigrationsPath({
|
149154
150181
|
projectPath,
|
149155
150182
|
migrationsFolderPath,
|
149156
150183
|
createIfMissing,
|
149157
150184
|
configPath
|
149158
150185
|
}) {
|
149159
|
-
const dir =
|
150186
|
+
const dir = import_path11.default.resolve(projectPath, migrationsFolderPath);
|
149160
150187
|
if (import_node_fs25.default.existsSync(dir)) {
|
149161
150188
|
return dir;
|
149162
150189
|
}
|
@@ -149328,7 +150355,7 @@ var ApplyHandler = withConfig(
|
|
149328
150355
|
return;
|
149329
150356
|
}
|
149330
150357
|
const migrationsPath = await getMigrationsPath({
|
149331
|
-
projectPath:
|
150358
|
+
projectPath: import_path12.default.dirname(config.configPath),
|
149332
150359
|
migrationsFolderPath: databaseInfo?.migrationsFolderPath ?? DEFAULT_MIGRATION_PATH,
|
149333
150360
|
createIfMissing: false,
|
149334
150361
|
configPath: config.configPath
|
@@ -149464,7 +150491,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
149464
150491
|
// src/d1/migrations/create.ts
|
149465
150492
|
init_import_meta_url();
|
149466
150493
|
var import_node_fs27 = __toESM(require("node:fs"));
|
149467
|
-
var
|
150494
|
+
var import_path13 = __toESM(require("path"));
|
149468
150495
|
function CreateOptions2(yargs) {
|
149469
150496
|
return Database(yargs).positional("message", {
|
149470
150497
|
describe: "The Migration message",
|
@@ -149486,7 +150513,7 @@ var CreateHandler2 = withConfig(
|
|
149486
150513
|
return;
|
149487
150514
|
}
|
149488
150515
|
const migrationsPath = await getMigrationsPath({
|
149489
|
-
projectPath:
|
150516
|
+
projectPath: import_path13.default.dirname(config.configPath),
|
149490
150517
|
migrationsFolderPath: databaseInfo.migrationsFolderPath ?? DEFAULT_MIGRATION_PATH,
|
149491
150518
|
createIfMissing: true,
|
149492
150519
|
configPath: config.configPath
|
@@ -149516,7 +150543,7 @@ __name(pad, "pad");
|
|
149516
150543
|
|
149517
150544
|
// src/d1/migrations/list.ts
|
149518
150545
|
init_import_meta_url();
|
149519
|
-
var
|
150546
|
+
var import_path14 = __toESM(require("path"));
|
149520
150547
|
function ListOptions2(yargs) {
|
149521
150548
|
return MigrationOptions(yargs);
|
149522
150549
|
}
|
@@ -149544,7 +150571,7 @@ var ListHandler2 = withConfig(
|
|
149544
150571
|
return;
|
149545
150572
|
}
|
149546
150573
|
const migrationsPath = await getMigrationsPath({
|
149547
|
-
projectPath:
|
150574
|
+
projectPath: import_path14.default.dirname(config.configPath),
|
149548
150575
|
migrationsFolderPath: databaseInfo?.migrationsFolderPath ?? DEFAULT_MIGRATION_PATH,
|
149549
150576
|
createIfMissing: false,
|
149550
150577
|
configPath: config.configPath
|
@@ -149866,7 +150893,6 @@ __name(d1, "d1");
|
|
149866
150893
|
// src/delete.ts
|
149867
150894
|
init_import_meta_url();
|
149868
150895
|
var import_assert4 = __toESM(require("assert"));
|
149869
|
-
var import_path14 = __toESM(require("path"));
|
149870
150896
|
function deleteOptions(yargs) {
|
149871
150897
|
return yargs.positional("script", {
|
149872
150898
|
describe: "The path to an entry point for your worker",
|
@@ -149891,8 +150917,7 @@ function deleteOptions(yargs) {
|
|
149891
150917
|
__name(deleteOptions, "deleteOptions");
|
149892
150918
|
async function deleteHandler(args) {
|
149893
150919
|
await printWranglerBanner();
|
149894
|
-
const
|
149895
|
-
const config = readConfig(configPath, args);
|
150920
|
+
const config = readConfig(args);
|
149896
150921
|
if (config.pages_build_output_dir) {
|
149897
150922
|
throw new UserError(
|
149898
150923
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages project delete` instead."
|
@@ -150451,9 +151476,9 @@ async function deployWorker(args) {
|
|
150451
151476
|
To learn more about Workers with assets, visit our documentation at https://developers.cloudflare.com/workers/frameworks/.`
|
150452
151477
|
);
|
150453
151478
|
}
|
150454
|
-
const configPath =
|
151479
|
+
const configPath = resolveWranglerConfigPath(args);
|
150455
151480
|
const projectRoot = configPath && import_node_path52.default.dirname(configPath);
|
150456
|
-
const config = readConfig(
|
151481
|
+
const config = readConfig(args);
|
150457
151482
|
if (config.pages_build_output_dir) {
|
150458
151483
|
throw new UserError(
|
150459
151484
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages deploy` instead."
|
@@ -150812,7 +151837,7 @@ async function initHandler(args) {
|
|
150812
151837
|
await execa(packageManager.type, c3Arguments, { stdio: "inherit" });
|
150813
151838
|
return;
|
150814
151839
|
} else {
|
150815
|
-
const config = readConfig(args
|
151840
|
+
const config = readConfig(args);
|
150816
151841
|
accountId = await requireAuth(config);
|
150817
151842
|
try {
|
150818
151843
|
await fetchResult(
|
@@ -151921,7 +152946,7 @@ ${bindings.length > 0 ? import_toml7.default.stringify(await mapBindings(account
|
|
151921
152946
|
__name(viewDeployment, "viewDeployment");
|
151922
152947
|
async function commonDeploymentCMDSetup(yargs) {
|
151923
152948
|
await printWranglerBanner();
|
151924
|
-
const config = readConfig(yargs
|
152949
|
+
const config = readConfig(yargs);
|
151925
152950
|
const accountId = await requireAuth(config);
|
151926
152951
|
const scriptName = getScriptName(
|
151927
152952
|
{ name: yargs.name, env: void 0 },
|
@@ -152145,7 +153170,7 @@ function workerNamespaceCommands(workerNamespaceYargs, subHelp) {
|
|
152145
153170
|
"List all dispatch namespaces",
|
152146
153171
|
(args) => args,
|
152147
153172
|
async (args) => {
|
152148
|
-
const config = readConfig(args
|
153173
|
+
const config = readConfig(args);
|
152149
153174
|
const accountId = await requireAuth(config);
|
152150
153175
|
await listWorkerNamespaces(accountId);
|
152151
153176
|
sendMetricsEvent("list dispatch namespaces", {
|
@@ -152163,7 +153188,7 @@ function workerNamespaceCommands(workerNamespaceYargs, subHelp) {
|
|
152163
153188
|
});
|
152164
153189
|
},
|
152165
153190
|
async (args) => {
|
152166
|
-
const config = readConfig(args
|
153191
|
+
const config = readConfig(args);
|
152167
153192
|
const accountId = await requireAuth(config);
|
152168
153193
|
await getWorkerNamespaceInfo(accountId, args.name);
|
152169
153194
|
sendMetricsEvent("view dispatch namespace", {
|
@@ -152182,7 +153207,7 @@ function workerNamespaceCommands(workerNamespaceYargs, subHelp) {
|
|
152182
153207
|
},
|
152183
153208
|
async (args) => {
|
152184
153209
|
await printWranglerBanner();
|
152185
|
-
const config = readConfig(args
|
153210
|
+
const config = readConfig(args);
|
152186
153211
|
const accountId = await requireAuth(config);
|
152187
153212
|
await createWorkerNamespace(accountId, args.name);
|
152188
153213
|
sendMetricsEvent("create dispatch namespace", {
|
@@ -152201,7 +153226,7 @@ function workerNamespaceCommands(workerNamespaceYargs, subHelp) {
|
|
152201
153226
|
},
|
152202
153227
|
async (args) => {
|
152203
153228
|
await printWranglerBanner();
|
152204
|
-
const config = readConfig(args
|
153229
|
+
const config = readConfig(args);
|
152205
153230
|
const accountId = await requireAuth(config);
|
152206
153231
|
await deleteWorkerNamespace(accountId, args.name);
|
152207
153232
|
sendMetricsEvent("delete dispatch namespace", {
|
@@ -152224,7 +153249,7 @@ function workerNamespaceCommands(workerNamespaceYargs, subHelp) {
|
|
152224
153249
|
},
|
152225
153250
|
async (args) => {
|
152226
153251
|
await printWranglerBanner();
|
152227
|
-
const config = readConfig(args
|
153252
|
+
const config = readConfig(args);
|
152228
153253
|
const accountId = await requireAuth(config);
|
152229
153254
|
await renameWorkerNamespace(accountId, args.oldName, args.newName);
|
152230
153255
|
sendMetricsEvent("rename dispatch namespace", {
|
@@ -152543,7 +153568,7 @@ function options4(commonYargs) {
|
|
152543
153568
|
}
|
152544
153569
|
__name(options4, "options");
|
152545
153570
|
async function handler4(args) {
|
152546
|
-
const config = readConfig(args
|
153571
|
+
const config = readConfig(args);
|
152547
153572
|
const origin = getOriginFromArgs(false, args);
|
152548
153573
|
logger.log(`\u{1F6A7} Creating '${args.name}'`);
|
152549
153574
|
const database = await createConfig(config, {
|
@@ -152578,7 +153603,7 @@ function options5(yargs) {
|
|
152578
153603
|
}
|
152579
153604
|
__name(options5, "options");
|
152580
153605
|
async function handler5(args) {
|
152581
|
-
const config = readConfig(args
|
153606
|
+
const config = readConfig(args);
|
152582
153607
|
logger.log(`\u{1F5D1}\uFE0F Deleting Hyperdrive database config ${args.id}`);
|
152583
153608
|
await deleteConfig(config, args.id);
|
152584
153609
|
logger.log(`\u2705 Deleted`);
|
@@ -152596,7 +153621,7 @@ function options6(yargs) {
|
|
152596
153621
|
}
|
152597
153622
|
__name(options6, "options");
|
152598
153623
|
async function handler6(args) {
|
152599
|
-
const config = readConfig(args
|
153624
|
+
const config = readConfig(args);
|
152600
153625
|
const database = await getConfig(config, args.id);
|
152601
153626
|
logger.log(JSON.stringify(database, null, 2));
|
152602
153627
|
}
|
@@ -152609,7 +153634,7 @@ function options7(yargs) {
|
|
152609
153634
|
}
|
152610
153635
|
__name(options7, "options");
|
152611
153636
|
async function handler7(args) {
|
152612
|
-
const config = readConfig(args
|
153637
|
+
const config = readConfig(args);
|
152613
153638
|
logger.log(`\u{1F4CB} Listing Hyperdrive configs`);
|
152614
153639
|
const databases = await listConfigs(config);
|
152615
153640
|
logger.table(
|
@@ -152640,7 +153665,7 @@ function options8(commonYargs) {
|
|
152640
153665
|
}
|
152641
153666
|
__name(options8, "options");
|
152642
153667
|
async function handler8(args) {
|
152643
|
-
const config = readConfig(args
|
153668
|
+
const config = readConfig(args);
|
152644
153669
|
const origin = getOriginFromArgs(true, args);
|
152645
153670
|
logger.log(`\u{1F6A7} Updating '${args.id}'`);
|
152646
153671
|
const updated = await patchConfig(config, args.id, {
|
@@ -152986,7 +154011,7 @@ var kvNamespaceCreateCommand = createCommand({
|
|
152986
154011
|
},
|
152987
154012
|
positionalArgs: ["namespace"],
|
152988
154013
|
async handler(args) {
|
152989
|
-
const config = readConfig(args
|
154014
|
+
const config = readConfig(args);
|
152990
154015
|
if (!config.name) {
|
152991
154016
|
logger.warn(
|
152992
154017
|
"No configured name present, using `worker` as a prefix for the title"
|
@@ -153032,7 +154057,7 @@ var kvNamespaceListCommand = createCommand({
|
|
153032
154057
|
args: {},
|
153033
154058
|
behaviour: { printBanner: false },
|
153034
154059
|
async handler(args) {
|
153035
|
-
const config = readConfig(args
|
154060
|
+
const config = readConfig(args);
|
153036
154061
|
const accountId = await requireAuth(config);
|
153037
154062
|
logger.log(JSON.stringify(await listKVNamespaces(accountId), null, " "));
|
153038
154063
|
sendMetricsEvent("list kv namespaces", {
|
@@ -153066,7 +154091,7 @@ var kvNamespaceDeleteCommand = createCommand({
|
|
153066
154091
|
demandOneOfOption("binding", "namespace-id")(args);
|
153067
154092
|
},
|
153068
154093
|
async handler(args) {
|
153069
|
-
const config = readConfig(args
|
154094
|
+
const config = readConfig(args);
|
153070
154095
|
let id;
|
153071
154096
|
try {
|
153072
154097
|
id = getKVNamespaceId(args, config);
|
@@ -153152,7 +154177,7 @@ var kvKeyPutCommand = createCommand({
|
|
153152
154177
|
demandOneOfOption("value", "path")(args);
|
153153
154178
|
},
|
153154
154179
|
async handler({ key, ttl, expiration, metadata, ...args }) {
|
153155
|
-
const config = readConfig(args
|
154180
|
+
const config = readConfig(args);
|
153156
154181
|
const namespaceId = getKVNamespaceId(args, config);
|
153157
154182
|
const value = args.path ? readFileSyncToBuffer(args.path) : (
|
153158
154183
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
@@ -153239,7 +154264,7 @@ var kvKeyListCommand = createCommand({
|
|
153239
154264
|
},
|
153240
154265
|
behaviour: { printBanner: false },
|
153241
154266
|
async handler({ prefix, ...args }) {
|
153242
|
-
const config = readConfig(args
|
154267
|
+
const config = readConfig(args);
|
153243
154268
|
const namespaceId = getKVNamespaceId(args, config);
|
153244
154269
|
let result;
|
153245
154270
|
let metricEvent;
|
@@ -153311,7 +154336,7 @@ var kvKeyGetCommand = createCommand({
|
|
153311
154336
|
},
|
153312
154337
|
behaviour: { printBanner: false },
|
153313
154338
|
async handler({ key, ...args }) {
|
153314
|
-
const config = readConfig(args
|
154339
|
+
const config = readConfig(args);
|
153315
154340
|
const namespaceId = getKVNamespaceId(args, config);
|
153316
154341
|
let bufferKVValue;
|
153317
154342
|
let metricEvent;
|
@@ -153386,7 +154411,7 @@ var kvKeyDeleteCommand = createCommand({
|
|
153386
154411
|
}
|
153387
154412
|
},
|
153388
154413
|
async handler({ key, ...args }) {
|
153389
|
-
const config = readConfig(args
|
154414
|
+
const config = readConfig(args);
|
153390
154415
|
const namespaceId = getKVNamespaceId(args, config);
|
153391
154416
|
logger.log(`Deleting the key "${key}" on namespace ${namespaceId}.`);
|
153392
154417
|
let metricEvent;
|
@@ -153463,7 +154488,7 @@ var kvBulkPutCommand = createCommand({
|
|
153463
154488
|
}
|
153464
154489
|
},
|
153465
154490
|
async handler({ filename, ...args }) {
|
153466
|
-
const config = readConfig(args
|
154491
|
+
const config = readConfig(args);
|
153467
154492
|
const namespaceId = getKVNamespaceId(args, config);
|
153468
154493
|
const content = parseJSON(readFileSync5(filename), filename);
|
153469
154494
|
if (!Array.isArray(content)) {
|
@@ -153582,7 +154607,7 @@ var kvBulkDeleteCommand = createCommand({
|
|
153582
154607
|
}
|
153583
154608
|
},
|
153584
154609
|
async handler({ filename, ...args }) {
|
153585
|
-
const config = readConfig(args
|
154610
|
+
const config = readConfig(args);
|
153586
154611
|
const namespaceId = getKVNamespaceId(args, config);
|
153587
154612
|
if (!args.force) {
|
153588
154613
|
const result = await confirm(
|
@@ -154089,15 +155114,12 @@ async function maybeReadPagesConfig(args) {
|
|
154089
155114
|
return void 0;
|
154090
155115
|
}
|
154091
155116
|
try {
|
154092
|
-
const config =
|
154093
|
-
|
154094
|
-
|
154095
|
-
|
154096
|
-
|
154097
|
-
|
154098
|
-
},
|
154099
|
-
{ requirePagesConfig: true }
|
154100
|
-
);
|
155117
|
+
const config = readPagesConfig({
|
155118
|
+
...args,
|
155119
|
+
config: configPath,
|
155120
|
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
155121
|
+
env: process.env.PAGES_ENVIRONMENT
|
155122
|
+
});
|
154101
155123
|
return {
|
154102
155124
|
...config,
|
154103
155125
|
hash: (0, import_node_crypto11.createHash)("sha256").update(await (0, import_promises23.readFile)(configPath)).digest("hex")
|
@@ -154259,15 +155281,12 @@ var Handler11 = /* @__PURE__ */ __name(async (args) => {
|
|
154259
155281
|
);
|
154260
155282
|
let config;
|
154261
155283
|
try {
|
154262
|
-
config =
|
154263
|
-
|
154264
|
-
|
154265
|
-
|
154266
|
-
|
154267
|
-
|
154268
|
-
},
|
154269
|
-
{ requirePagesConfig: true }
|
154270
|
-
);
|
155284
|
+
config = readPagesConfig({
|
155285
|
+
...args,
|
155286
|
+
config: configPath,
|
155287
|
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
155288
|
+
env: process.env.PAGES_ENVIRONMENT
|
155289
|
+
});
|
154271
155290
|
} catch (err) {
|
154272
155291
|
if (err instanceof FatalError && err.code === EXIT_CODE_INVALID_PAGES_CONFIG) {
|
154273
155292
|
logger.debug(
|
@@ -154672,11 +155691,7 @@ var Handler12 = /* @__PURE__ */ __name(async (args) => {
|
|
154672
155691
|
let config;
|
154673
155692
|
const configPath = findWranglerConfig(process.cwd());
|
154674
155693
|
try {
|
154675
|
-
config =
|
154676
|
-
configPath,
|
154677
|
-
{ ...args, env: void 0 },
|
154678
|
-
{ requirePagesConfig: true }
|
154679
|
-
);
|
155694
|
+
config = readPagesConfig({ ...args, config: configPath, env: void 0 });
|
154680
155695
|
} catch (err) {
|
154681
155696
|
if (!(err instanceof FatalError && err.code === EXIT_CODE_INVALID_PAGES_CONFIG)) {
|
154682
155697
|
throw err;
|
@@ -155327,7 +156342,7 @@ async function Handler13({
|
|
155327
156342
|
if (format10 === "pretty") {
|
155328
156343
|
await printWranglerBanner();
|
155329
156344
|
}
|
155330
|
-
const config = readConfig(args
|
156345
|
+
const config = readConfig(args);
|
155331
156346
|
const pagesConfig = getConfigCache(
|
155332
156347
|
PAGES_CONFIG_CACHE_FILENAME
|
155333
156348
|
);
|
@@ -155763,7 +156778,7 @@ var Handler14 = /* @__PURE__ */ __name(async (args) => {
|
|
155763
156778
|
The Worker script should be named \`_worker.js\` and located in the build output directory of your project (specified with \`wrangler pages dev <directory>\`).`
|
155764
156779
|
);
|
155765
156780
|
}
|
155766
|
-
const config = readConfig(
|
156781
|
+
const config = readConfig({ ...args, env: void 0 });
|
155767
156782
|
const resolvedDirectory = args.directory ?? config.pages_build_output_dir;
|
155768
156783
|
const [_pages, _dev, ...remaining] = args._;
|
155769
156784
|
const command2 = remaining;
|
@@ -156727,11 +157742,7 @@ async function pagesProject(env6, cliProjectName) {
|
|
156727
157742
|
let config;
|
156728
157743
|
const configPath = findWranglerConfig(process.cwd());
|
156729
157744
|
try {
|
156730
|
-
config =
|
156731
|
-
configPath,
|
156732
|
-
{ env: void 0 },
|
156733
|
-
{ requirePagesConfig: true }
|
156734
|
-
);
|
157745
|
+
config = readPagesConfig({ config: configPath, env: void 0 });
|
156735
157746
|
} catch (err) {
|
156736
157747
|
if (!(err instanceof FatalError && err.code === EXIT_CODE_INVALID_PAGES_CONFIG)) {
|
156737
157748
|
throw err;
|
@@ -157309,7 +158320,7 @@ function pipelines(pipelineYargs) {
|
|
157309
158320
|
},
|
157310
158321
|
async (args) => {
|
157311
158322
|
await printWranglerBanner();
|
157312
|
-
const config = readConfig(args
|
158323
|
+
const config = readConfig(args);
|
157313
158324
|
const bucket = args.r2;
|
157314
158325
|
const name2 = args.pipeline;
|
157315
158326
|
const compression = args.compression === void 0 ? "gzip" : args.compression;
|
@@ -157408,7 +158419,7 @@ function pipelines(pipelineYargs) {
|
|
157408
158419
|
"List current pipelines",
|
157409
158420
|
(yargs) => yargs,
|
157410
158421
|
async (args) => {
|
157411
|
-
const config = readConfig(args
|
158422
|
+
const config = readConfig(args);
|
157412
158423
|
const accountId = await requireAuth(config);
|
157413
158424
|
const list = await listPipelines(accountId);
|
157414
158425
|
sendMetricsEvent("list pipelines", {
|
@@ -157434,7 +158445,7 @@ function pipelines(pipelineYargs) {
|
|
157434
158445
|
},
|
157435
158446
|
async (args) => {
|
157436
158447
|
await printWranglerBanner();
|
157437
|
-
const config = readConfig(args
|
158448
|
+
const config = readConfig(args);
|
157438
158449
|
const accountId = await requireAuth(config);
|
157439
158450
|
const name2 = args.pipeline;
|
157440
158451
|
validateName("pipeline name", name2);
|
@@ -157462,7 +158473,7 @@ function pipelines(pipelineYargs) {
|
|
157462
158473
|
async (args) => {
|
157463
158474
|
await printWranglerBanner();
|
157464
158475
|
const name2 = args.pipeline;
|
157465
|
-
const config = readConfig(args
|
158476
|
+
const config = readConfig(args);
|
157466
158477
|
const accountId = await requireAuth(config);
|
157467
158478
|
const pipelineConfig = await getPipeline(accountId, name2);
|
157468
158479
|
if (args.compression) {
|
@@ -157574,7 +158585,7 @@ function pipelines(pipelineYargs) {
|
|
157574
158585
|
},
|
157575
158586
|
async (args) => {
|
157576
158587
|
await printWranglerBanner();
|
157577
|
-
const config = readConfig(args
|
158588
|
+
const config = readConfig(args);
|
157578
158589
|
const accountId = await requireAuth(config);
|
157579
158590
|
const name2 = args.pipeline;
|
157580
158591
|
validateName("pipeline name", name2);
|
@@ -157726,7 +158737,7 @@ function pubSubCommands(pubsubYargs, subHelp) {
|
|
157726
158737
|
}).epilogue(pubSubBetaWarning);
|
157727
158738
|
},
|
157728
158739
|
async (args) => {
|
157729
|
-
const config = readConfig(args
|
158740
|
+
const config = readConfig(args);
|
157730
158741
|
const accountId = await requireAuth(config);
|
157731
158742
|
const namespace = {
|
157732
158743
|
name: args.name
|
@@ -157748,7 +158759,7 @@ function pubSubCommands(pubsubYargs, subHelp) {
|
|
157748
158759
|
return yargs.epilogue(pubSubBetaWarning);
|
157749
158760
|
},
|
157750
158761
|
async (args) => {
|
157751
|
-
const config = readConfig(args
|
158762
|
+
const config = readConfig(args);
|
157752
158763
|
const accountId = await requireAuth(config);
|
157753
158764
|
logger.log(await listPubSubNamespaces(accountId));
|
157754
158765
|
sendMetricsEvent("list pubsub namespaces", {
|
@@ -157766,7 +158777,7 @@ function pubSubCommands(pubsubYargs, subHelp) {
|
|
157766
158777
|
}).epilogue(pubSubBetaWarning);
|
157767
158778
|
},
|
157768
158779
|
async (args) => {
|
157769
|
-
const config = readConfig(args
|
158780
|
+
const config = readConfig(args);
|
157770
158781
|
const accountId = await requireAuth(config);
|
157771
158782
|
if (await confirm(
|
157772
158783
|
`\uFE0F\u2757\uFE0F Are you sure you want to delete the Pub/Sub Namespace ${args.name}? This cannot be undone.
|
@@ -157791,7 +158802,7 @@ This name will be available for others to register.`
|
|
157791
158802
|
}).epilogue(pubSubBetaWarning);
|
157792
158803
|
},
|
157793
158804
|
async (args) => {
|
157794
|
-
const config = readConfig(args
|
158805
|
+
const config = readConfig(args);
|
157795
158806
|
const accountId = await requireAuth(config);
|
157796
158807
|
logger.log(
|
157797
158808
|
await describePubSubNamespace(accountId, args.name)
|
@@ -157826,7 +158837,7 @@ This name will be available for others to register.`
|
|
157826
158837
|
type: "string"
|
157827
158838
|
}).epilogue(pubSubBetaWarning),
|
157828
158839
|
async (args) => {
|
157829
|
-
const config = readConfig(args
|
158840
|
+
const config = readConfig(args);
|
157830
158841
|
const accountId = await requireAuth(config);
|
157831
158842
|
const broker = {
|
157832
158843
|
name: args.name
|
@@ -157879,7 +158890,7 @@ This name will be available for others to register.`
|
|
157879
158890
|
type: "string"
|
157880
158891
|
}).epilogue(pubSubBetaWarning),
|
157881
158892
|
async (args) => {
|
157882
|
-
const config = readConfig(args
|
158893
|
+
const config = readConfig(args);
|
157883
158894
|
const accountId = await requireAuth(config);
|
157884
158895
|
const broker = {};
|
157885
158896
|
if (args.description) {
|
@@ -157925,7 +158936,7 @@ This name will be available for others to register.`
|
|
157925
158936
|
}).epilogue(pubSubBetaWarning);
|
157926
158937
|
},
|
157927
158938
|
async (args) => {
|
157928
|
-
const config = readConfig(args
|
158939
|
+
const config = readConfig(args);
|
157929
158940
|
const accountId = await requireAuth(config);
|
157930
158941
|
logger.log(await listPubSubBrokers(accountId, args.namespace));
|
157931
158942
|
sendMetricsEvent("list pubsub brokers", {
|
@@ -157949,7 +158960,7 @@ This name will be available for others to register.`
|
|
157949
158960
|
}).epilogue(pubSubBetaWarning);
|
157950
158961
|
},
|
157951
158962
|
async (args) => {
|
157952
|
-
const config = readConfig(args
|
158963
|
+
const config = readConfig(args);
|
157953
158964
|
const accountId = await requireAuth(config);
|
157954
158965
|
if (await confirm(
|
157955
158966
|
`\uFE0F\u2757\uFE0F Are you sure you want to delete the Pub/Sub Broker ${args.name}? This cannot be undone.
|
@@ -157983,7 +158994,7 @@ All existing clients will be disconnected.`
|
|
157983
158994
|
}).epilogue(pubSubBetaWarning);
|
157984
158995
|
},
|
157985
158996
|
async (args) => {
|
157986
|
-
const config = readConfig(args
|
158997
|
+
const config = readConfig(args);
|
157987
158998
|
const accountId = await requireAuth(config);
|
157988
158999
|
logger.log(
|
157989
159000
|
await describePubSubBroker(
|
@@ -158031,7 +159042,7 @@ All existing clients will be disconnected.`
|
|
158031
159042
|
}).epilogue(pubSubBetaWarning);
|
158032
159043
|
},
|
158033
159044
|
async (args) => {
|
158034
|
-
const config = readConfig(args
|
159045
|
+
const config = readConfig(args);
|
158035
159046
|
const accountId = await requireAuth(config);
|
158036
159047
|
let parsedExpiration;
|
158037
159048
|
if (args.expiration) {
|
@@ -158083,7 +159094,7 @@ All existing clients will be disconnected.`
|
|
158083
159094
|
}).epilogue(pubSubBetaWarning);
|
158084
159095
|
},
|
158085
159096
|
async (args) => {
|
158086
|
-
const config = readConfig(args
|
159097
|
+
const config = readConfig(args);
|
158087
159098
|
const accountId = await requireAuth(config);
|
158088
159099
|
const numTokens = args.jti.length;
|
158089
159100
|
logger.log(
|
@@ -158122,7 +159133,7 @@ All existing clients will be disconnected.`
|
|
158122
159133
|
}).epilogue(pubSubBetaWarning);
|
158123
159134
|
},
|
158124
159135
|
async (args) => {
|
158125
|
-
const config = readConfig(args
|
159136
|
+
const config = readConfig(args);
|
158126
159137
|
const accountId = await requireAuth(config);
|
158127
159138
|
const numTokens = args.jti.length;
|
158128
159139
|
logger.log(
|
@@ -158156,7 +159167,7 @@ All existing clients will be disconnected.`
|
|
158156
159167
|
}).epilogue(pubSubBetaWarning);
|
158157
159168
|
},
|
158158
159169
|
async (args) => {
|
158159
|
-
const config = readConfig(args
|
159170
|
+
const config = readConfig(args);
|
158160
159171
|
const accountId = await requireAuth(config);
|
158161
159172
|
logger.log(`Listing previously revoked tokens for ${args.name}...`);
|
158162
159173
|
logger.log(
|
@@ -158187,7 +159198,7 @@ All existing clients will be disconnected.`
|
|
158187
159198
|
}).epilogue(pubSubBetaWarning);
|
158188
159199
|
},
|
158189
159200
|
async (args) => {
|
158190
|
-
const config = readConfig(args
|
159201
|
+
const config = readConfig(args);
|
158191
159202
|
const accountId = await requireAuth(config);
|
158192
159203
|
logger.log(
|
158193
159204
|
await getPubSubBrokerPublicKeys(
|
@@ -158293,7 +159304,7 @@ function createBody(args) {
|
|
158293
159304
|
}
|
158294
159305
|
__name(createBody, "createBody");
|
158295
159306
|
async function handler9(args) {
|
158296
|
-
const config = readConfig(args
|
159307
|
+
const config = readConfig(args);
|
158297
159308
|
if (Array.isArray(args.retryDelaySecs)) {
|
158298
159309
|
throw new CommandLineArgsError(
|
158299
159310
|
`Cannot specify --retry-delay-secs multiple times`
|
@@ -158317,7 +159328,7 @@ function options10(yargs) {
|
|
158317
159328
|
}
|
158318
159329
|
__name(options10, "options");
|
158319
159330
|
async function handler10(args) {
|
158320
|
-
const config = readConfig(args
|
159331
|
+
const config = readConfig(args);
|
158321
159332
|
logger.log(`Removing consumer from queue ${args.queueName}.`);
|
158322
159333
|
await deletePullConsumer(config, args.queueName);
|
158323
159334
|
logger.log(`Removed consumer from queue ${args.queueName}.`);
|
@@ -158402,7 +159413,7 @@ function createBody2(args) {
|
|
158402
159413
|
}
|
158403
159414
|
__name(createBody2, "createBody");
|
158404
159415
|
async function handler11(args) {
|
158405
|
-
const config = readConfig(args
|
159416
|
+
const config = readConfig(args);
|
158406
159417
|
if (Array.isArray(args.retryDelaySecs)) {
|
158407
159418
|
throw new CommandLineArgsError(
|
158408
159419
|
`Cannot specify --retry-delay-secs multiple times`
|
@@ -158430,7 +159441,7 @@ function options12(yargs) {
|
|
158430
159441
|
}
|
158431
159442
|
__name(options12, "options");
|
158432
159443
|
async function handler12(args) {
|
158433
|
-
const config = readConfig(args
|
159444
|
+
const config = readConfig(args);
|
158434
159445
|
logger.log(`Removing consumer from queue ${args.queueName}.`);
|
158435
159446
|
await deleteWorkerConsumer(config, args.queueName, args.scriptName, args.env);
|
158436
159447
|
logger.log(`Removed consumer from queue ${args.queueName}.`);
|
@@ -158518,7 +159529,7 @@ function createBody3(args) {
|
|
158518
159529
|
}
|
158519
159530
|
__name(createBody3, "createBody");
|
158520
159531
|
async function handler13(args) {
|
158521
|
-
const config = readConfig(args
|
159532
|
+
const config = readConfig(args);
|
158522
159533
|
const body = createBody3(args);
|
158523
159534
|
try {
|
158524
159535
|
logger.log(`\u{1F300} Creating queue '${args.name}'`);
|
@@ -158572,7 +159583,7 @@ function options14(yargs) {
|
|
158572
159583
|
}
|
158573
159584
|
__name(options14, "options");
|
158574
159585
|
async function handler14(args) {
|
158575
|
-
const config = readConfig(args
|
159586
|
+
const config = readConfig(args);
|
158576
159587
|
logger.log(`Deleting queue ${args.name}.`);
|
158577
159588
|
await deleteQueue(config, args.name);
|
158578
159589
|
logger.log(`Deleted queue ${args.name}.`);
|
@@ -158590,7 +159601,7 @@ function options15(yargs) {
|
|
158590
159601
|
}
|
158591
159602
|
__name(options15, "options");
|
158592
159603
|
async function handler15(args) {
|
158593
|
-
const config = readConfig(args
|
159604
|
+
const config = readConfig(args);
|
158594
159605
|
const queue = await getQueue(config, args.name);
|
158595
159606
|
const accountId = await requireAuth(config);
|
158596
159607
|
await printWranglerBanner();
|
@@ -158634,7 +159645,7 @@ function options16(yargs) {
|
|
158634
159645
|
}
|
158635
159646
|
__name(options16, "options");
|
158636
159647
|
async function handler16(args) {
|
158637
|
-
const config = readConfig(args
|
159648
|
+
const config = readConfig(args);
|
158638
159649
|
const queues2 = await listQueues(config, args.page);
|
158639
159650
|
logger.table(
|
158640
159651
|
queues2.map((queue) => ({
|
@@ -159345,6 +160356,60 @@ function isNonNegativeNumber(str) {
|
|
159345
160356
|
return num >= 0;
|
159346
160357
|
}
|
159347
160358
|
__name(isNonNegativeNumber, "isNonNegativeNumber");
|
160359
|
+
async function getCORSPolicy(accountId, bucketName, jurisdiction) {
|
160360
|
+
const headers = {};
|
160361
|
+
if (jurisdiction) {
|
160362
|
+
headers["cf-r2-jurisdiction"] = jurisdiction;
|
160363
|
+
}
|
160364
|
+
const result = await fetchResult(
|
160365
|
+
`/accounts/${accountId}/r2/buckets/${bucketName}/cors`,
|
160366
|
+
{
|
160367
|
+
method: "GET",
|
160368
|
+
headers
|
160369
|
+
}
|
160370
|
+
);
|
160371
|
+
return result.rules;
|
160372
|
+
}
|
160373
|
+
__name(getCORSPolicy, "getCORSPolicy");
|
160374
|
+
function tableFromCORSPolicyResponse(rules) {
|
160375
|
+
const rows = [];
|
160376
|
+
for (const rule of rules) {
|
160377
|
+
rows.push({
|
160378
|
+
allowed_origins: rule.allowed?.origins?.join(", ") || "(no origins)",
|
160379
|
+
allowed_methods: rule.allowed?.methods?.join(", ") || "(no methods)",
|
160380
|
+
allowed_headers: rule.allowed?.headers?.join(", ") || "(no headers)",
|
160381
|
+
exposed_headers: rule.exposeHeaders?.join(", ") || "(no exposed headers)",
|
160382
|
+
max_age_seconds: rule.maxAgeSeconds?.toString() || "(0 seconds)"
|
160383
|
+
});
|
160384
|
+
}
|
160385
|
+
return rows;
|
160386
|
+
}
|
160387
|
+
__name(tableFromCORSPolicyResponse, "tableFromCORSPolicyResponse");
|
160388
|
+
async function putCORSPolicy(accountId, bucketName, rules, jurisdiction) {
|
160389
|
+
const headers = {
|
160390
|
+
"Content-Type": "application/json"
|
160391
|
+
};
|
160392
|
+
if (jurisdiction) {
|
160393
|
+
headers["cf-r2-jurisdiction"] = jurisdiction;
|
160394
|
+
}
|
160395
|
+
await fetchResult(`/accounts/${accountId}/r2/buckets/${bucketName}/cors`, {
|
160396
|
+
method: "PUT",
|
160397
|
+
headers,
|
160398
|
+
body: JSON.stringify({ rules })
|
160399
|
+
});
|
160400
|
+
}
|
160401
|
+
__name(putCORSPolicy, "putCORSPolicy");
|
160402
|
+
async function deleteCORSPolicy(accountId, bucketName, jurisdiction) {
|
160403
|
+
const headers = {};
|
160404
|
+
if (jurisdiction) {
|
160405
|
+
headers["cf-r2-jurisdiction"] = jurisdiction;
|
160406
|
+
}
|
160407
|
+
await fetchResult(`/accounts/${accountId}/r2/buckets/${bucketName}/cors`, {
|
160408
|
+
method: "DELETE",
|
160409
|
+
headers
|
160410
|
+
});
|
160411
|
+
}
|
160412
|
+
__name(deleteCORSPolicy, "deleteCORSPolicy");
|
159348
160413
|
function isValidR2BucketName(name2) {
|
159349
160414
|
return typeof name2 === "string" && /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name2);
|
159350
160415
|
}
|
@@ -159597,6 +160662,153 @@ var r2BucketDeleteCommand = createCommand({
|
|
159597
160662
|
}
|
159598
160663
|
});
|
159599
160664
|
|
160665
|
+
// src/r2/cors.ts
|
160666
|
+
init_import_meta_url();
|
160667
|
+
var import_node_path61 = __toESM(require("node:path"));
|
160668
|
+
var r2BucketCORSNamespace = createNamespace({
|
160669
|
+
metadata: {
|
160670
|
+
description: "Manage CORS configuration for an R2 bucket",
|
160671
|
+
status: "stable",
|
160672
|
+
owner: "Product: R2"
|
160673
|
+
}
|
160674
|
+
});
|
160675
|
+
var r2BucketCORSListCommand = createCommand({
|
160676
|
+
metadata: {
|
160677
|
+
description: "List the CORS rules for an R2 bucket",
|
160678
|
+
status: "stable",
|
160679
|
+
owner: "Product: R2"
|
160680
|
+
},
|
160681
|
+
positionalArgs: ["bucket"],
|
160682
|
+
args: {
|
160683
|
+
bucket: {
|
160684
|
+
describe: "The name of the R2 bucket to list the CORS rules for",
|
160685
|
+
type: "string",
|
160686
|
+
demandOption: true
|
160687
|
+
},
|
160688
|
+
jurisdiction: {
|
160689
|
+
describe: "The jurisdiction where the bucket exists",
|
160690
|
+
alias: "J",
|
160691
|
+
requiresArg: true,
|
160692
|
+
type: "string"
|
160693
|
+
}
|
160694
|
+
},
|
160695
|
+
async handler({ bucket, jurisdiction }, { config }) {
|
160696
|
+
const accountId = await requireAuth(config);
|
160697
|
+
logger.log(`Listing CORS rules for bucket '${bucket}'...`);
|
160698
|
+
const corsPolicy = await getCORSPolicy(accountId, bucket, jurisdiction);
|
160699
|
+
if (corsPolicy.length === 0) {
|
160700
|
+
logger.log(
|
160701
|
+
`There is no CORS configuration defined for bucket '${bucket}'.`
|
160702
|
+
);
|
160703
|
+
} else {
|
160704
|
+
const tableOutput = tableFromCORSPolicyResponse(corsPolicy);
|
160705
|
+
logger.log(tableOutput.map((x2) => formatLabelledValues(x2)).join("\n\n"));
|
160706
|
+
}
|
160707
|
+
}
|
160708
|
+
});
|
160709
|
+
var r2BucketCORSSetCommand = createCommand({
|
160710
|
+
metadata: {
|
160711
|
+
description: "Set the CORS configuration for an R2 bucket from a JSON file",
|
160712
|
+
status: "stable",
|
160713
|
+
owner: "Product: R2"
|
160714
|
+
},
|
160715
|
+
positionalArgs: ["bucket"],
|
160716
|
+
args: {
|
160717
|
+
bucket: {
|
160718
|
+
describe: "The name of the R2 bucket to set the CORS configuration for",
|
160719
|
+
type: "string",
|
160720
|
+
demandOption: true
|
160721
|
+
},
|
160722
|
+
file: {
|
160723
|
+
describe: "Path to the JSON file containing the CORS configuration",
|
160724
|
+
type: "string",
|
160725
|
+
demandOption: true,
|
160726
|
+
requiresArg: true
|
160727
|
+
},
|
160728
|
+
jurisdiction: {
|
160729
|
+
describe: "The jurisdiction where the bucket exists",
|
160730
|
+
alias: "J",
|
160731
|
+
requiresArg: true,
|
160732
|
+
type: "string"
|
160733
|
+
},
|
160734
|
+
force: {
|
160735
|
+
describe: "Skip confirmation",
|
160736
|
+
type: "boolean",
|
160737
|
+
alias: "y",
|
160738
|
+
default: false
|
160739
|
+
}
|
160740
|
+
},
|
160741
|
+
async handler({ bucket, file, jurisdiction, force }, { config }) {
|
160742
|
+
const accountId = await requireAuth(config);
|
160743
|
+
const jsonFilePath = import_node_path61.default.resolve(file);
|
160744
|
+
const corsConfig = parseJSON(
|
160745
|
+
readFileSync5(jsonFilePath),
|
160746
|
+
jsonFilePath
|
160747
|
+
);
|
160748
|
+
if (!corsConfig.rules || !Array.isArray(corsConfig.rules)) {
|
160749
|
+
throw new UserError(
|
160750
|
+
`The CORS configuration file must contain a 'rules' array as expected by the request body of the CORS API: https://developers.cloudflare.com/api/operations/r2-put-bucket-cors-policy`
|
160751
|
+
);
|
160752
|
+
}
|
160753
|
+
if (!force) {
|
160754
|
+
const confirmedRemoval = await confirm(
|
160755
|
+
`Are you sure you want to overwrite the existing CORS configuration for bucket '${bucket}'?`
|
160756
|
+
);
|
160757
|
+
if (!confirmedRemoval) {
|
160758
|
+
logger.log("Set cancelled.");
|
160759
|
+
return;
|
160760
|
+
}
|
160761
|
+
}
|
160762
|
+
logger.log(
|
160763
|
+
`Setting CORS configuration (${corsConfig.rules.length} rules) for bucket '${bucket}'...`
|
160764
|
+
);
|
160765
|
+
await putCORSPolicy(accountId, bucket, corsConfig.rules, jurisdiction);
|
160766
|
+
logger.log(`\u2728 Set CORS configuration for bucket '${bucket}'.`);
|
160767
|
+
}
|
160768
|
+
});
|
160769
|
+
var r2BucketCORSDeleteCommand = createCommand({
|
160770
|
+
metadata: {
|
160771
|
+
description: "Clear the CORS configuration for an R2 bucket",
|
160772
|
+
status: "stable",
|
160773
|
+
owner: "Product: R2"
|
160774
|
+
},
|
160775
|
+
positionalArgs: ["bucket"],
|
160776
|
+
args: {
|
160777
|
+
bucket: {
|
160778
|
+
describe: "The name of the R2 bucket to delete the CORS configuration for",
|
160779
|
+
type: "string",
|
160780
|
+
demandOption: true
|
160781
|
+
},
|
160782
|
+
jurisdiction: {
|
160783
|
+
describe: "The jurisdiction where the bucket exists",
|
160784
|
+
alias: "J",
|
160785
|
+
requiresArg: true,
|
160786
|
+
type: "string"
|
160787
|
+
},
|
160788
|
+
force: {
|
160789
|
+
describe: "Skip confirmation",
|
160790
|
+
type: "boolean",
|
160791
|
+
alias: "y",
|
160792
|
+
default: false
|
160793
|
+
}
|
160794
|
+
},
|
160795
|
+
async handler({ bucket, jurisdiction, force }, { config }) {
|
160796
|
+
const accountId = await requireAuth(config);
|
160797
|
+
if (!force) {
|
160798
|
+
const confirmedRemoval = await confirm(
|
160799
|
+
`Are you sure you want to clear the existing CORS configuration for bucket '${bucket}'?`
|
160800
|
+
);
|
160801
|
+
if (!confirmedRemoval) {
|
160802
|
+
logger.log("Set cancelled.");
|
160803
|
+
return;
|
160804
|
+
}
|
160805
|
+
}
|
160806
|
+
logger.log(`Deleting the CORS configuration for bucket '${bucket}'...`);
|
160807
|
+
await deleteCORSPolicy(accountId, bucket, jurisdiction);
|
160808
|
+
logger.log(`CORS configuration deleted for bucket '${bucket}'.`);
|
160809
|
+
}
|
160810
|
+
});
|
160811
|
+
|
159600
160812
|
// src/r2/domain.ts
|
159601
160813
|
init_import_meta_url();
|
159602
160814
|
var r2BucketDomainNamespace = createNamespace({
|
@@ -160373,7 +161585,7 @@ var r2BucketNotificationDeleteCommand = createCommand({
|
|
160373
161585
|
init_import_meta_url();
|
160374
161586
|
var import_node_buffer5 = require("node:buffer");
|
160375
161587
|
var fs25 = __toESM(require("node:fs"));
|
160376
|
-
var
|
161588
|
+
var path64 = __toESM(require("node:path"));
|
160377
161589
|
var stream = __toESM(require("node:stream"));
|
160378
161590
|
var r2ObjectNamespace = createNamespace({
|
160379
161591
|
metadata: {
|
@@ -160439,7 +161651,7 @@ var r2ObjectGetCommand = createCommand({
|
|
160439
161651
|
}
|
160440
161652
|
let output;
|
160441
161653
|
if (file) {
|
160442
|
-
fs25.mkdirSync(
|
161654
|
+
fs25.mkdirSync(path64.dirname(file), { recursive: true });
|
160443
161655
|
output = fs25.createWriteStream(file);
|
160444
161656
|
} else {
|
160445
161657
|
output = process.stdout;
|
@@ -160701,7 +161913,7 @@ var r2ObjectDeleteCommand = createCommand({
|
|
160701
161913
|
},
|
160702
161914
|
async handler(args) {
|
160703
161915
|
const { objectPath, jurisdiction } = args;
|
160704
|
-
const config = readConfig(args
|
161916
|
+
const config = readConfig(args);
|
160705
161917
|
const { bucket, key } = bucketAndKeyFromObjectPath(objectPath);
|
160706
161918
|
let fullBucketName = bucket;
|
160707
161919
|
if (jurisdiction !== void 0) {
|
@@ -161148,7 +162360,7 @@ var r2BucketSippyGetCommand = createCommand({
|
|
161148
162360
|
|
161149
162361
|
// src/secret/index.ts
|
161150
162362
|
init_import_meta_url();
|
161151
|
-
var
|
162363
|
+
var import_node_path62 = __toESM(require("node:path"));
|
161152
162364
|
var import_node_readline3 = __toESM(require("node:readline"));
|
161153
162365
|
var import_undici19 = __toESM(require_undici());
|
161154
162366
|
var VERSION_NOT_DEPLOYED_ERR_CODE = 10215;
|
@@ -161255,7 +162467,7 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
|
|
161255
162467
|
},
|
161256
162468
|
async (args) => {
|
161257
162469
|
await printWranglerBanner();
|
161258
|
-
const config = readConfig(args
|
162470
|
+
const config = readConfig(args);
|
161259
162471
|
if (config.pages_build_output_dir) {
|
161260
162472
|
throw new UserError(
|
161261
162473
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages secret put` instead."
|
@@ -161336,7 +162548,7 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
|
|
161336
162548
|
},
|
161337
162549
|
async (args) => {
|
161338
162550
|
await printWranglerBanner();
|
161339
|
-
const config = readConfig(args
|
162551
|
+
const config = readConfig(args);
|
161340
162552
|
if (config.pages_build_output_dir) {
|
161341
162553
|
throw new UserError(
|
161342
162554
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages secret delete` instead."
|
@@ -161378,7 +162590,7 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
|
|
161378
162590
|
});
|
161379
162591
|
},
|
161380
162592
|
async (args) => {
|
161381
|
-
const config = readConfig(args
|
162593
|
+
const config = readConfig(args);
|
161382
162594
|
if (config.pages_build_output_dir) {
|
161383
162595
|
throw new UserError(
|
161384
162596
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages secret list` instead."
|
@@ -161424,7 +162636,7 @@ var secretBulkOptions = /* @__PURE__ */ __name((yargs) => {
|
|
161424
162636
|
}, "secretBulkOptions");
|
161425
162637
|
var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
161426
162638
|
await printWranglerBanner();
|
161427
|
-
const config = readConfig(secretBulkArgs
|
162639
|
+
const config = readConfig(secretBulkArgs);
|
161428
162640
|
if (config.pages_build_output_dir) {
|
161429
162641
|
throw new UserError(
|
161430
162642
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages secret bulk` instead."
|
@@ -161449,7 +162661,7 @@ var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
|
161449
162661
|
);
|
161450
162662
|
let content;
|
161451
162663
|
if (secretBulkArgs.json) {
|
161452
|
-
const jsonFilePath =
|
162664
|
+
const jsonFilePath = import_node_path62.default.resolve(secretBulkArgs.json);
|
161453
162665
|
try {
|
161454
162666
|
content = parseJSON(
|
161455
162667
|
readFileSync5(jsonFilePath),
|
@@ -170743,7 +171955,7 @@ async function tailHandler(args) {
|
|
170743
171955
|
if (args.format === "pretty") {
|
170744
171956
|
await printWranglerBanner();
|
170745
171957
|
}
|
170746
|
-
const config = readConfig(args
|
171958
|
+
const config = readConfig(args);
|
170747
171959
|
if (config.pages_build_output_dir) {
|
170748
171960
|
throw new UserError(
|
170749
171961
|
"It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages deployment tail` instead."
|
@@ -170897,7 +172109,7 @@ function triggersDeployOptions(yargs) {
|
|
170897
172109
|
__name(triggersDeployOptions, "triggersDeployOptions");
|
170898
172110
|
async function triggersDeployHandler(args) {
|
170899
172111
|
await printWranglerBanner();
|
170900
|
-
const config = readConfig(
|
172112
|
+
const config = readConfig(args);
|
170901
172113
|
const assetsOptions = getAssetsOptions({ assets: void 0 }, config);
|
170902
172114
|
sendMetricsEvent(
|
170903
172115
|
"deploy worker triggers",
|
@@ -170925,7 +172137,7 @@ __name(triggersDeployHandler, "triggersDeployHandler");
|
|
170925
172137
|
// src/type-generation/index.ts
|
170926
172138
|
init_import_meta_url();
|
170927
172139
|
var fs26 = __toESM(require("node:fs"));
|
170928
|
-
var
|
172140
|
+
var import_node_path63 = require("node:path");
|
170929
172141
|
var import_miniflare22 = require("miniflare");
|
170930
172142
|
|
170931
172143
|
// src/type-generation/runtime/index.ts
|
@@ -171087,21 +172299,21 @@ async function typesHandler(args) {
|
|
171087
172299
|
);
|
171088
172300
|
}
|
171089
172301
|
await printWranglerBanner();
|
171090
|
-
const configPath = args
|
172302
|
+
const configPath = resolveWranglerConfigPath(args);
|
171091
172303
|
if (!configPath || !fs26.existsSync(configPath) || fs26.statSync(configPath).isDirectory()) {
|
171092
172304
|
logger.warn(
|
171093
172305
|
`No config file detected${args.config ? ` (at ${args.config})` : ""}, aborting`
|
171094
172306
|
);
|
171095
172307
|
return;
|
171096
172308
|
}
|
171097
|
-
const config = readConfig(
|
172309
|
+
const config = readConfig(args);
|
171098
172310
|
if (typeof args.experimentalIncludeRuntime === "string") {
|
171099
172311
|
logger.log(`Generating runtime types...`);
|
171100
172312
|
const { outFile } = await generateRuntimeTypes({
|
171101
172313
|
config,
|
171102
172314
|
outFile: args.experimentalIncludeRuntime || void 0
|
171103
172315
|
});
|
171104
|
-
const tsconfigPath = config.tsconfig ?? (0,
|
172316
|
+
const tsconfigPath = config.tsconfig ?? (0, import_node_path63.join)((0, import_node_path63.dirname)(configPath), "tsconfig.json");
|
171105
172317
|
const tsconfigTypes = readTsconfigTypes(tsconfigPath);
|
171106
172318
|
const { mode } = (0, import_miniflare22.getNodeCompat)(
|
171107
172319
|
config.compatibility_date,
|
@@ -171181,8 +172393,8 @@ function constructTSModuleGlob(glob) {
|
|
171181
172393
|
}
|
171182
172394
|
__name(constructTSModuleGlob, "constructTSModuleGlob");
|
171183
172395
|
function generateImportSpecifier(from, to) {
|
171184
|
-
const relativePath = (0,
|
171185
|
-
const filename = (0,
|
172396
|
+
const relativePath = (0, import_node_path63.relative)((0, import_node_path63.dirname)(from), (0, import_node_path63.dirname)(to)).replace(/\\/g, "/");
|
172397
|
+
const filename = (0, import_node_path63.basename)(to, (0, import_node_path63.extname)(to));
|
171186
172398
|
if (!relativePath) {
|
171187
172399
|
return `./${filename}`;
|
171188
172400
|
} else if (relativePath.startsWith("..")) {
|
@@ -171217,7 +172429,7 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
171217
172429
|
}
|
171218
172430
|
}
|
171219
172431
|
const entrypointFormat = entrypoint?.format ?? "modules";
|
171220
|
-
const fullOutputPath = (0,
|
172432
|
+
const fullOutputPath = (0, import_node_path63.resolve)(outputPath);
|
171221
172433
|
const userProvidedEnvInterface = envInterface !== "Env";
|
171222
172434
|
if (userProvidedEnvInterface && entrypointFormat === "service-worker") {
|
171223
172435
|
throw new Error(
|
@@ -171403,7 +172615,7 @@ function writeDTSFile({
|
|
171403
172615
|
try {
|
171404
172616
|
if (wranglerOverrideDTSPath !== void 0 && !fs26.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
|
171405
172617
|
throw new UserError(
|
171406
|
-
`A non-wrangler ${(0,
|
172618
|
+
`A non-wrangler ${(0, import_node_path63.basename)(path70)} already exists, please rename and try again.`
|
171407
172619
|
);
|
171408
172620
|
}
|
171409
172621
|
} catch (error2) {
|
@@ -171992,7 +173204,7 @@ function options17(yargs) {
|
|
171992
173204
|
}
|
171993
173205
|
__name(options17, "options");
|
171994
173206
|
async function handler17(args) {
|
171995
|
-
const config = readConfig(args
|
173207
|
+
const config = readConfig(args);
|
171996
173208
|
let indexConfig;
|
171997
173209
|
if (args.preset) {
|
171998
173210
|
indexConfig = { preset: args.preset };
|
@@ -172075,7 +173287,7 @@ function options18(yargs) {
|
|
172075
173287
|
}
|
172076
173288
|
__name(options18, "options");
|
172077
173289
|
async function handler18(args) {
|
172078
|
-
const config = readConfig(args
|
173290
|
+
const config = readConfig(args);
|
172079
173291
|
const reqOptions = {
|
172080
173292
|
propertyName: args.propertyName,
|
172081
173293
|
indexType: args.type
|
@@ -172108,7 +173320,7 @@ function options19(yargs) {
|
|
172108
173320
|
}
|
172109
173321
|
__name(options19, "options");
|
172110
173322
|
async function handler19(args) {
|
172111
|
-
const config = readConfig(args
|
173323
|
+
const config = readConfig(args);
|
172112
173324
|
logger.log(`Deleting Vectorize index ${args.name}`);
|
172113
173325
|
if (!args.force) {
|
172114
173326
|
const confirmedDeletion = await confirm(
|
@@ -172142,7 +173354,7 @@ function options20(yargs) {
|
|
172142
173354
|
}
|
172143
173355
|
__name(options20, "options");
|
172144
173356
|
async function handler20(args) {
|
172145
|
-
const config = readConfig(args
|
173357
|
+
const config = readConfig(args);
|
172146
173358
|
if (args.ids.length === 0) {
|
172147
173359
|
logger.error("\u{1F6A8} Please provide valid vector identifiers for deletion.");
|
172148
173360
|
return;
|
@@ -172173,7 +173385,7 @@ function options21(yargs) {
|
|
172173
173385
|
}
|
172174
173386
|
__name(options21, "options");
|
172175
173387
|
async function handler21(args) {
|
172176
|
-
const config = readConfig(args
|
173388
|
+
const config = readConfig(args);
|
172177
173389
|
const reqOptions = {
|
172178
173390
|
propertyName: args.propertyName
|
172179
173391
|
};
|
@@ -172204,7 +173416,7 @@ function options22(yargs) {
|
|
172204
173416
|
}
|
172205
173417
|
__name(options22, "options");
|
172206
173418
|
async function handler22(args) {
|
172207
|
-
const config = readConfig(args
|
173419
|
+
const config = readConfig(args);
|
172208
173420
|
const index = await getIndex(config, args.name, args.deprecatedV1);
|
172209
173421
|
if (args.json) {
|
172210
173422
|
logger.log(JSON.stringify(index, null, 2));
|
@@ -172241,7 +173453,7 @@ function options23(yargs) {
|
|
172241
173453
|
}
|
172242
173454
|
__name(options23, "options");
|
172243
173455
|
async function handler23(args) {
|
172244
|
-
const config = readConfig(args
|
173456
|
+
const config = readConfig(args);
|
172245
173457
|
if (args.ids.length === 0) {
|
172246
173458
|
logger.error("\u{1F6A8} Please provide valid vector identifiers.");
|
172247
173459
|
return;
|
@@ -172276,7 +173488,7 @@ function options24(yargs) {
|
|
172276
173488
|
}
|
172277
173489
|
__name(options24, "options");
|
172278
173490
|
async function handler24(args) {
|
172279
|
-
const config = readConfig(args
|
173491
|
+
const config = readConfig(args);
|
172280
173492
|
logger.log(`\u{1F4CB} Fetching index info...`);
|
172281
173493
|
const info = await indexInfo(config, args.name);
|
172282
173494
|
if (args.json) {
|
@@ -172329,7 +173541,7 @@ function options25(yargs) {
|
|
172329
173541
|
}
|
172330
173542
|
__name(options25, "options");
|
172331
173543
|
async function handler25(args) {
|
172332
|
-
const config = readConfig(args
|
173544
|
+
const config = readConfig(args);
|
172333
173545
|
const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs34.createReadStream)(args.file) });
|
172334
173546
|
if (args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_V1_MAX_BATCH_SIZE) {
|
172335
173547
|
logger.error(
|
@@ -172403,7 +173615,7 @@ function options26(yargs) {
|
|
172403
173615
|
}
|
172404
173616
|
__name(options26, "options");
|
172405
173617
|
async function handler26(args) {
|
172406
|
-
const config = readConfig(args
|
173618
|
+
const config = readConfig(args);
|
172407
173619
|
logger.log(`\u{1F4CB} Listing Vectorize indexes...`);
|
172408
173620
|
const indexes = await listIndexes(config, args.deprecatedV1);
|
172409
173621
|
if (indexes.length === 0) {
|
@@ -172447,7 +173659,7 @@ function options27(yargs) {
|
|
172447
173659
|
}
|
172448
173660
|
__name(options27, "options");
|
172449
173661
|
async function handler27(args) {
|
172450
|
-
const config = readConfig(args
|
173662
|
+
const config = readConfig(args);
|
172451
173663
|
logger.log(`\u{1F4CB} Fetching metadata indexes...`);
|
172452
173664
|
const res = await listMetadataIndex(config, args.name);
|
172453
173665
|
if (res.metadataIndexes.length === 0) {
|
@@ -172540,7 +173752,7 @@ function options28(yargs) {
|
|
172540
173752
|
}
|
172541
173753
|
__name(options28, "options");
|
172542
173754
|
async function handler28(args) {
|
172543
|
-
const config = readConfig(args
|
173755
|
+
const config = readConfig(args);
|
172544
173756
|
const queryOptions = {
|
172545
173757
|
topK: args.topK,
|
172546
173758
|
returnValues: args.returnValues,
|
@@ -172673,7 +173885,7 @@ function options29(yargs) {
|
|
172673
173885
|
}
|
172674
173886
|
__name(options29, "options");
|
172675
173887
|
async function handler29(args) {
|
172676
|
-
const config = readConfig(args
|
173888
|
+
const config = readConfig(args);
|
172677
173889
|
const rl = (0, import_node_readline5.createInterface)({ input: (0, import_node_fs35.createReadStream)(args.file) });
|
172678
173890
|
if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
|
172679
173891
|
logger.error(
|
@@ -172811,6 +174023,9 @@ var versionsListCommand = createCommand({
|
|
172811
174023
|
owner: "Workers: Authoring and Testing",
|
172812
174024
|
status: "stable"
|
172813
174025
|
},
|
174026
|
+
behaviour: {
|
174027
|
+
printBanner: (args) => !args.json
|
174028
|
+
},
|
172814
174029
|
args: {
|
172815
174030
|
name: {
|
172816
174031
|
describe: "Name of the Worker",
|
@@ -172823,7 +174038,7 @@ var versionsListCommand = createCommand({
|
|
172823
174038
|
default: false
|
172824
174039
|
}
|
172825
174040
|
},
|
172826
|
-
handler: /* @__PURE__ */ __name(async function
|
174041
|
+
handler: /* @__PURE__ */ __name(async function versionsListHandler(args, { config }) {
|
172827
174042
|
sendMetricsEvent(
|
172828
174043
|
"list worker versions",
|
172829
174044
|
{ json: args.json },
|
@@ -172858,7 +174073,7 @@ var versionsListCommand = createCommand({
|
|
172858
174073
|
logRaw(formattedVersion);
|
172859
174074
|
logRaw(``);
|
172860
174075
|
}
|
172861
|
-
}, "
|
174076
|
+
}, "versionsListHandler")
|
172862
174077
|
});
|
172863
174078
|
function getVersionSource(version4) {
|
172864
174079
|
return version4.annotations?.["workers/triggered_by"] === void 0 ? formatSource2(version4.metadata.source) : formatTrigger2(version4.annotations["workers/triggered_by"]);
|
@@ -172895,15 +174110,6 @@ function formatTrigger2(trigger) {
|
|
172895
174110
|
}
|
172896
174111
|
__name(formatTrigger2, "formatTrigger");
|
172897
174112
|
|
172898
|
-
// src/versions/utils/config.ts
|
172899
|
-
init_import_meta_url();
|
172900
|
-
var import_node_path63 = __toESM(require("node:path"));
|
172901
|
-
function getConfig2(args, options30, entryPath) {
|
172902
|
-
const configPath = args.config || entryPath && findWranglerConfig(import_node_path63.default.dirname(entryPath));
|
172903
|
-
return readConfig(configPath, args, options30);
|
172904
|
-
}
|
172905
|
-
__name(getConfig2, "getConfig");
|
172906
|
-
|
172907
174113
|
// src/versions/deployments/list.ts
|
172908
174114
|
var BLANK_INPUT3 = "-";
|
172909
174115
|
function versionsDeploymentsListOptions(yargs) {
|
@@ -172922,7 +174128,7 @@ async function versionsDeploymentsListHandler(args) {
|
|
172922
174128
|
if (!args.json) {
|
172923
174129
|
await printWranglerBanner();
|
172924
174130
|
}
|
172925
|
-
const config =
|
174131
|
+
const config = readConfig(args);
|
172926
174132
|
sendMetricsEvent(
|
172927
174133
|
"list versioned deployments",
|
172928
174134
|
{ json: args.json },
|
@@ -173008,7 +174214,7 @@ async function versionsDeploymentsStatusHandler(args) {
|
|
173008
174214
|
if (!args.json) {
|
173009
174215
|
await printWranglerBanner();
|
173010
174216
|
}
|
173011
|
-
const config =
|
174217
|
+
const config = readConfig(args);
|
173012
174218
|
sendMetricsEvent(
|
173013
174219
|
"view latest versioned deployment",
|
173014
174220
|
{},
|
@@ -173149,7 +174355,7 @@ function versionsRollbackOptions(rollbackYargs) {
|
|
173149
174355
|
}
|
173150
174356
|
__name(versionsRollbackOptions, "versionsRollbackOptions");
|
173151
174357
|
async function versionsRollbackHandler(args) {
|
173152
|
-
const config =
|
174358
|
+
const config = readConfig(args);
|
173153
174359
|
const accountId = await requireAuth(config);
|
173154
174360
|
const workerName = args.name ?? config.name;
|
173155
174361
|
if (workerName === void 0) {
|
@@ -173419,7 +174625,7 @@ var versionsSecretBulkCommand = createCommand({
|
|
173419
174625
|
status: "stable"
|
173420
174626
|
},
|
173421
174627
|
behaviour: {
|
173422
|
-
|
174628
|
+
printConfigWarnings: false
|
173423
174629
|
},
|
173424
174630
|
args: {
|
173425
174631
|
json: {
|
@@ -173443,8 +174649,7 @@ var versionsSecretBulkCommand = createCommand({
|
|
173443
174649
|
}
|
173444
174650
|
},
|
173445
174651
|
positionalArgs: ["json"],
|
173446
|
-
handler: /* @__PURE__ */ __name(async function versionsSecretPutBulkHandler(args) {
|
173447
|
-
const config = getConfig2(args, { hideWarnings: true });
|
174652
|
+
handler: /* @__PURE__ */ __name(async function versionsSecretPutBulkHandler(args, { config }) {
|
173448
174653
|
const scriptName = getLegacyScriptName(args, config);
|
173449
174654
|
if (!scriptName) {
|
173450
174655
|
throw new UserError(
|
@@ -173527,7 +174732,7 @@ var versionsSecretDeleteCommand = createCommand({
|
|
173527
174732
|
status: "stable"
|
173528
174733
|
},
|
173529
174734
|
behaviour: {
|
173530
|
-
|
174735
|
+
printConfigWarnings: false
|
173531
174736
|
},
|
173532
174737
|
args: {
|
173533
174738
|
key: {
|
@@ -173552,8 +174757,7 @@ var versionsSecretDeleteCommand = createCommand({
|
|
173552
174757
|
}
|
173553
174758
|
},
|
173554
174759
|
positionalArgs: ["key"],
|
173555
|
-
handler: /* @__PURE__ */ __name(async function versionsSecretDeleteHandler(args) {
|
173556
|
-
const config = getConfig2(args, { hideWarnings: true });
|
174760
|
+
handler: /* @__PURE__ */ __name(async function versionsSecretDeleteHandler(args, { config }) {
|
173557
174761
|
const scriptName = getLegacyScriptName(args, config);
|
173558
174762
|
if (!scriptName) {
|
173559
174763
|
throw new UserError(
|
@@ -173618,7 +174822,7 @@ var versionsSecretsListCommand = createCommand({
|
|
173618
174822
|
status: "stable"
|
173619
174823
|
},
|
173620
174824
|
behaviour: {
|
173621
|
-
|
174825
|
+
printConfigWarnings: false
|
173622
174826
|
},
|
173623
174827
|
args: {
|
173624
174828
|
name: {
|
@@ -173632,8 +174836,7 @@ var versionsSecretsListCommand = createCommand({
|
|
173632
174836
|
default: false
|
173633
174837
|
}
|
173634
174838
|
},
|
173635
|
-
handler: /* @__PURE__ */ __name(async function
|
173636
|
-
const config = getConfig2(args, { hideWarnings: true });
|
174839
|
+
handler: /* @__PURE__ */ __name(async function versionsSecretListHandler(args, { config }) {
|
173637
174840
|
const scriptName = getLegacyScriptName(args, config);
|
173638
174841
|
if (!scriptName) {
|
173639
174842
|
throw new UserError(
|
@@ -173699,7 +174902,7 @@ var versionsSecretPutCommand = createCommand({
|
|
173699
174902
|
status: "stable"
|
173700
174903
|
},
|
173701
174904
|
behaviour: {
|
173702
|
-
|
174905
|
+
printConfigWarnings: false
|
173703
174906
|
},
|
173704
174907
|
args: {
|
173705
174908
|
key: {
|
@@ -173724,8 +174927,7 @@ var versionsSecretPutCommand = createCommand({
|
|
173724
174927
|
}
|
173725
174928
|
},
|
173726
174929
|
positionalArgs: ["key"],
|
173727
|
-
handler: /* @__PURE__ */ __name(async function versionsSecretPutHandler(args) {
|
173728
|
-
const config = getConfig2(args, { hideWarnings: true });
|
174930
|
+
handler: /* @__PURE__ */ __name(async function versionsSecretPutHandler(args, { config }) {
|
173729
174931
|
const scriptName = getLegacyScriptName(args, config);
|
173730
174932
|
if (!scriptName) {
|
173731
174933
|
throw new UserError(
|
@@ -173947,10 +175149,9 @@ var versionsUploadCommand = createCommand({
|
|
173947
175149
|
}
|
173948
175150
|
},
|
173949
175151
|
behaviour: {
|
173950
|
-
provideConfig:
|
175152
|
+
provideConfig: true
|
173951
175153
|
},
|
173952
|
-
handler: /* @__PURE__ */ __name(async function versionsUploadHandler(args) {
|
173953
|
-
const config = getConfig2(args, {}, args.script);
|
175154
|
+
handler: /* @__PURE__ */ __name(async function versionsUploadHandler(args, { config }) {
|
173954
175155
|
const entry = await getEntry(args, config, "versions upload");
|
173955
175156
|
sendMetricsEvent(
|
173956
175157
|
"upload worker version",
|
@@ -174431,6 +175632,9 @@ var versionsViewCommand = createCommand({
|
|
174431
175632
|
owner: "Workers: Authoring and Testing",
|
174432
175633
|
status: "stable"
|
174433
175634
|
},
|
175635
|
+
behaviour: {
|
175636
|
+
printBanner: (args) => !args.json
|
175637
|
+
},
|
174434
175638
|
args: {
|
174435
175639
|
"version-id": {
|
174436
175640
|
describe: "The Worker Version ID to view",
|
@@ -174451,9 +175655,6 @@ var versionsViewCommand = createCommand({
|
|
174451
175655
|
},
|
174452
175656
|
positionalArgs: ["version-id"],
|
174453
175657
|
handler: /* @__PURE__ */ __name(async function versionsViewHandler(args, { config }) {
|
174454
|
-
if (!args.json) {
|
174455
|
-
await printWranglerBanner();
|
174456
|
-
}
|
174457
175658
|
sendMetricsEvent(
|
174458
175659
|
"view worker version",
|
174459
175660
|
{},
|
@@ -176545,6 +177746,22 @@ function createCLIParser(argv) {
|
|
176545
177746
|
{
|
176546
177747
|
command: "wrangler r2 bucket lifecycle set",
|
176547
177748
|
definition: r2BucketLifecycleSetCommand
|
177749
|
+
},
|
177750
|
+
{
|
177751
|
+
command: "wrangler r2 bucket cors",
|
177752
|
+
definition: r2BucketCORSNamespace
|
177753
|
+
},
|
177754
|
+
{
|
177755
|
+
command: "wrangler r2 bucket cors delete",
|
177756
|
+
definition: r2BucketCORSDeleteCommand
|
177757
|
+
},
|
177758
|
+
{
|
177759
|
+
command: "wrangler r2 bucket cors list",
|
177760
|
+
definition: r2BucketCORSListCommand
|
177761
|
+
},
|
177762
|
+
{
|
177763
|
+
command: "wrangler r2 bucket cors set",
|
177764
|
+
definition: r2BucketCORSSetCommand
|
176548
177765
|
}
|
176549
177766
|
]);
|
176550
177767
|
registry.registerNamespace("r2");
|
@@ -176767,8 +177984,8 @@ async function main(argv) {
|
|
176767
177984
|
}
|
176768
177985
|
recordedCommand = true;
|
176769
177986
|
try {
|
176770
|
-
const configPath = args
|
176771
|
-
const rawConfig = readRawConfig(
|
177987
|
+
const configPath = resolveWranglerConfigPath(args);
|
177988
|
+
const rawConfig = readRawConfig(configPath);
|
176772
177989
|
dispatcher = getMetricsDispatcher({
|
176773
177990
|
sendMetrics: rawConfig.send_metrics,
|
176774
177991
|
configPath
|
@@ -177348,7 +178565,8 @@ var ConfigController = class extends Controller {
|
|
177348
178565
|
const signal = this.#abortController.signal;
|
177349
178566
|
this.latestInput = input;
|
177350
178567
|
try {
|
177351
|
-
const fileConfig = readConfig(
|
178568
|
+
const fileConfig = readConfig({
|
178569
|
+
config: input.config,
|
177352
178570
|
env: input.env,
|
177353
178571
|
"dispatch-namespace": void 0,
|
177354
178572
|
"legacy-env": !input.legacy?.enableServiceEnvironments,
|
@@ -178259,7 +179477,8 @@ __name(maybeGetRegisteredWorkers, "maybeGetRegisteredWorkers");
|
|
178259
179477
|
// src/api/integrations/platform/index.ts
|
178260
179478
|
async function getPlatformProxy(options30 = {}) {
|
178261
179479
|
const env6 = options30.environment;
|
178262
|
-
const rawConfig = readConfig(
|
179480
|
+
const rawConfig = readConfig({
|
179481
|
+
config: options30.configPath,
|
178263
179482
|
env: env6
|
178264
179483
|
});
|
178265
179484
|
const miniflareOptions = await run(
|
@@ -178358,7 +179577,7 @@ function deepFreeze(obj) {
|
|
178358
179577
|
}
|
178359
179578
|
__name(deepFreeze, "deepFreeze");
|
178360
179579
|
function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6) {
|
178361
|
-
const config = typeof configOrConfigPath === "string" ? readConfig(configOrConfigPath,
|
179580
|
+
const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env: env6 }) : configOrConfigPath;
|
178362
179581
|
const modulesRules = config.rules.concat(DEFAULT_MODULE_RULES).map((rule) => ({
|
178363
179582
|
type: rule.type,
|
178364
179583
|
include: rule.globs,
|
@@ -178988,3 +180207,4 @@ yargs-parser/build/lib/index.js:
|
|
178988
180207
|
* SPDX-License-Identifier: ISC
|
178989
180208
|
*)
|
178990
180209
|
*/
|
180210
|
+
//# sourceMappingURL=cli.js.map
|