wrangler 3.96.0 → 3.97.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/package.json +3 -3
- package/wrangler-dist/cli.js +563 -541
- package/wrangler-dist/cli.js.map +3 -3
package/wrangler-dist/cli.js
CHANGED
@@ -17534,7 +17534,7 @@ var require_XDG = __commonJS({
|
|
17534
17534
|
exports2.__esModule = true;
|
17535
17535
|
exports2.Adapt = void 0;
|
17536
17536
|
function Adapt(adapter_) {
|
17537
|
-
var
|
17537
|
+
var env5 = adapter_.env, osPaths = adapter_.osPaths, path70 = adapter_.path;
|
17538
17538
|
var isMacOS = /^darwin$/i.test(adapter_.process.platform);
|
17539
17539
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
17540
17540
|
function baseDir() {
|
@@ -17547,63 +17547,63 @@ var require_XDG = __commonJS({
|
|
17547
17547
|
__name(valOrPath, "valOrPath");
|
17548
17548
|
var linux = /* @__PURE__ */ __name(function() {
|
17549
17549
|
var cache2 = /* @__PURE__ */ __name(function() {
|
17550
|
-
return valOrPath(
|
17550
|
+
return valOrPath(env5.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
|
17551
17551
|
}, "cache");
|
17552
17552
|
var config = /* @__PURE__ */ __name(function() {
|
17553
|
-
return valOrPath(
|
17553
|
+
return valOrPath(env5.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
|
17554
17554
|
}, "config");
|
17555
17555
|
var data = /* @__PURE__ */ __name(function() {
|
17556
|
-
return valOrPath(
|
17556
|
+
return valOrPath(env5.get("XDG_DATA_HOME"), [baseDir(), ".local", "share"]);
|
17557
17557
|
}, "data");
|
17558
17558
|
var runtime = /* @__PURE__ */ __name(function() {
|
17559
|
-
return
|
17559
|
+
return env5.get("XDG_RUNTIME_DIR") || void 0;
|
17560
17560
|
}, "runtime");
|
17561
17561
|
var state = /* @__PURE__ */ __name(function() {
|
17562
|
-
return valOrPath(
|
17562
|
+
return valOrPath(env5.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
|
17563
17563
|
}, "state");
|
17564
17564
|
return { cache: cache2, config, data, runtime, state };
|
17565
17565
|
}, "linux");
|
17566
17566
|
var macos = /* @__PURE__ */ __name(function() {
|
17567
17567
|
var cache2 = /* @__PURE__ */ __name(function() {
|
17568
|
-
return valOrPath(
|
17568
|
+
return valOrPath(env5.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
|
17569
17569
|
}, "cache");
|
17570
17570
|
var config = /* @__PURE__ */ __name(function() {
|
17571
|
-
return valOrPath(
|
17571
|
+
return valOrPath(env5.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
|
17572
17572
|
}, "config");
|
17573
17573
|
var data = /* @__PURE__ */ __name(function() {
|
17574
|
-
return valOrPath(
|
17574
|
+
return valOrPath(env5.get("XDG_DATA_HOME"), [baseDir(), "Library", "Application Support"]);
|
17575
17575
|
}, "data");
|
17576
17576
|
var runtime = /* @__PURE__ */ __name(function() {
|
17577
|
-
return
|
17577
|
+
return env5.get("XDG_RUNTIME_DIR") || void 0;
|
17578
17578
|
}, "runtime");
|
17579
17579
|
var state = /* @__PURE__ */ __name(function() {
|
17580
|
-
return valOrPath(
|
17580
|
+
return valOrPath(env5.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
|
17581
17581
|
}, "state");
|
17582
17582
|
return { cache: cache2, config, data, runtime, state };
|
17583
17583
|
}, "macos");
|
17584
17584
|
var windows = /* @__PURE__ */ __name(function() {
|
17585
17585
|
function appData() {
|
17586
|
-
return valOrPath(
|
17586
|
+
return valOrPath(env5.get("APPDATA"), [baseDir(), "AppData", "Roaming"]);
|
17587
17587
|
}
|
17588
17588
|
__name(appData, "appData");
|
17589
17589
|
function localAppData() {
|
17590
|
-
return valOrPath(
|
17590
|
+
return valOrPath(env5.get("LOCALAPPDATA"), [baseDir(), "AppData", "Local"]);
|
17591
17591
|
}
|
17592
17592
|
__name(localAppData, "localAppData");
|
17593
17593
|
var cache2 = /* @__PURE__ */ __name(function() {
|
17594
|
-
return valOrPath(
|
17594
|
+
return valOrPath(env5.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
|
17595
17595
|
}, "cache");
|
17596
17596
|
var config = /* @__PURE__ */ __name(function() {
|
17597
|
-
return valOrPath(
|
17597
|
+
return valOrPath(env5.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
|
17598
17598
|
}, "config");
|
17599
17599
|
var data = /* @__PURE__ */ __name(function() {
|
17600
|
-
return valOrPath(
|
17600
|
+
return valOrPath(env5.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
|
17601
17601
|
}, "data");
|
17602
17602
|
var runtime = /* @__PURE__ */ __name(function() {
|
17603
|
-
return
|
17603
|
+
return env5.get("XDG_RUNTIME_DIR") || void 0;
|
17604
17604
|
}, "runtime");
|
17605
17605
|
var state = /* @__PURE__ */ __name(function() {
|
17606
|
-
return valOrPath(
|
17606
|
+
return valOrPath(env5.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
|
17607
17607
|
}, "state");
|
17608
17608
|
return { cache: cache2, config, data, runtime, state };
|
17609
17609
|
}, "windows");
|
@@ -17620,11 +17620,11 @@ var require_XDG = __commonJS({
|
|
17620
17620
|
XDG.runtime = extension.runtime;
|
17621
17621
|
XDG.state = extension.state;
|
17622
17622
|
XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
|
17623
|
-
var pathList =
|
17623
|
+
var pathList = env5.get("XDG_CONFIG_DIRS");
|
17624
17624
|
return __spreadArray([extension.config()], pathList ? pathList.split(path70.delimiter) : []);
|
17625
17625
|
}, "configDirs");
|
17626
17626
|
XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
|
17627
|
-
var pathList =
|
17627
|
+
var pathList = env5.get("XDG_DATA_DIRS");
|
17628
17628
|
return __spreadArray([extension.data()], pathList ? pathList.split(path70.delimiter) : []);
|
17629
17629
|
}, "dataDirs");
|
17630
17630
|
return XDG;
|
@@ -17656,7 +17656,7 @@ var require_OSPaths = __commonJS({
|
|
17656
17656
|
}
|
17657
17657
|
__name(isEmpty, "isEmpty");
|
17658
17658
|
function Adapt(adapter_) {
|
17659
|
-
var
|
17659
|
+
var env5 = adapter_.env, os13 = adapter_.os, path70 = adapter_.path;
|
17660
17660
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
17661
17661
|
function normalizePath(path_) {
|
17662
17662
|
return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
|
@@ -17664,14 +17664,14 @@ var require_OSPaths = __commonJS({
|
|
17664
17664
|
__name(normalizePath, "normalizePath");
|
17665
17665
|
function home() {
|
17666
17666
|
var posix2 = /* @__PURE__ */ __name(function() {
|
17667
|
-
return normalizePath((typeof os13.homedir === "function" ? os13.homedir() : void 0) ||
|
17667
|
+
return normalizePath((typeof os13.homedir === "function" ? os13.homedir() : void 0) || env5.get("HOME"));
|
17668
17668
|
}, "posix");
|
17669
17669
|
var windows = /* @__PURE__ */ __name(function() {
|
17670
17670
|
var priorityList = [
|
17671
17671
|
typeof os13.homedir === "function" ? os13.homedir() : void 0,
|
17672
|
-
|
17673
|
-
|
17674
|
-
|
17672
|
+
env5.get("USERPROFILE"),
|
17673
|
+
env5.get("HOME"),
|
17674
|
+
env5.get("HOMEDRIVE") || env5.get("HOMEPATH") ? path70.join(env5.get("HOMEDRIVE") || "", env5.get("HOMEPATH") || "") : void 0
|
17675
17675
|
];
|
17676
17676
|
return normalizePath(priorityList.find(function(v2) {
|
17677
17677
|
return !isEmpty(v2);
|
@@ -17689,9 +17689,9 @@ var require_OSPaths = __commonJS({
|
|
17689
17689
|
var fallback = "/tmp";
|
17690
17690
|
var priorityList = [
|
17691
17691
|
typeof os13.tmpdir === "function" ? os13.tmpdir() : void 0,
|
17692
|
-
|
17693
|
-
|
17694
|
-
|
17692
|
+
env5.get("TMPDIR"),
|
17693
|
+
env5.get("TEMP"),
|
17694
|
+
env5.get("TMP")
|
17695
17695
|
];
|
17696
17696
|
return normalizePath(priorityList.find(function(v2) {
|
17697
17697
|
return !isEmpty(v2);
|
@@ -17705,28 +17705,28 @@ var require_OSPaths = __commonJS({
|
|
17705
17705
|
return void 0;
|
17706
17706
|
},
|
17707
17707
|
function() {
|
17708
|
-
return
|
17708
|
+
return env5.get("TEMP");
|
17709
17709
|
},
|
17710
17710
|
function() {
|
17711
|
-
return
|
17711
|
+
return env5.get("TMP");
|
17712
17712
|
},
|
17713
17713
|
function() {
|
17714
|
-
return joinPathToBase(
|
17714
|
+
return joinPathToBase(env5.get("LOCALAPPDATA"), ["Temp"]);
|
17715
17715
|
},
|
17716
17716
|
function() {
|
17717
17717
|
return joinPathToBase(home(), ["AppData", "Local", "Temp"]);
|
17718
17718
|
},
|
17719
17719
|
function() {
|
17720
|
-
return joinPathToBase(
|
17720
|
+
return joinPathToBase(env5.get("ALLUSERSPROFILE"), ["Temp"]);
|
17721
17721
|
},
|
17722
17722
|
function() {
|
17723
|
-
return joinPathToBase(
|
17723
|
+
return joinPathToBase(env5.get("SystemRoot"), ["Temp"]);
|
17724
17724
|
},
|
17725
17725
|
function() {
|
17726
|
-
return joinPathToBase(
|
17726
|
+
return joinPathToBase(env5.get("windir"), ["Temp"]);
|
17727
17727
|
},
|
17728
17728
|
function() {
|
17729
|
-
return joinPathToBase(
|
17729
|
+
return joinPathToBase(env5.get("SystemDrive"), ["\\", "Temp"]);
|
17730
17730
|
}
|
17731
17731
|
];
|
17732
17732
|
var v2 = priorityListLazy.find(function(v3) {
|
@@ -18502,15 +18502,15 @@ var require_supports_colors = __commonJS({
|
|
18502
18502
|
init_import_meta_url();
|
18503
18503
|
var os13 = require("os");
|
18504
18504
|
var hasFlag3 = require_has_flag();
|
18505
|
-
var
|
18505
|
+
var env5 = process.env;
|
18506
18506
|
var forceColor = void 0;
|
18507
18507
|
if (hasFlag3("no-color") || hasFlag3("no-colors") || hasFlag3("color=false")) {
|
18508
18508
|
forceColor = false;
|
18509
18509
|
} else if (hasFlag3("color") || hasFlag3("colors") || hasFlag3("color=true") || hasFlag3("color=always")) {
|
18510
18510
|
forceColor = true;
|
18511
18511
|
}
|
18512
|
-
if ("FORCE_COLOR" in
|
18513
|
-
forceColor =
|
18512
|
+
if ("FORCE_COLOR" in env5) {
|
18513
|
+
forceColor = env5.FORCE_COLOR.length === 0 || parseInt(env5.FORCE_COLOR, 10) !== 0;
|
18514
18514
|
}
|
18515
18515
|
function translateLevel3(level) {
|
18516
18516
|
if (level === 0) {
|
@@ -18545,20 +18545,20 @@ var require_supports_colors = __commonJS({
|
|
18545
18545
|
}
|
18546
18546
|
return 1;
|
18547
18547
|
}
|
18548
|
-
if ("CI" in
|
18548
|
+
if ("CI" in env5) {
|
18549
18549
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some(function(sign) {
|
18550
|
-
return sign in
|
18551
|
-
}) ||
|
18550
|
+
return sign in env5;
|
18551
|
+
}) || env5.CI_NAME === "codeship") {
|
18552
18552
|
return 1;
|
18553
18553
|
}
|
18554
18554
|
return min;
|
18555
18555
|
}
|
18556
|
-
if ("TEAMCITY_VERSION" in
|
18557
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(
|
18556
|
+
if ("TEAMCITY_VERSION" in env5) {
|
18557
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env5.TEAMCITY_VERSION) ? 1 : 0;
|
18558
18558
|
}
|
18559
|
-
if ("TERM_PROGRAM" in
|
18560
|
-
var version4 = parseInt((
|
18561
|
-
switch (
|
18559
|
+
if ("TERM_PROGRAM" in env5) {
|
18560
|
+
var version4 = parseInt((env5.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
18561
|
+
switch (env5.TERM_PROGRAM) {
|
18562
18562
|
case "iTerm.app":
|
18563
18563
|
return version4 >= 3 ? 3 : 2;
|
18564
18564
|
case "Hyper":
|
@@ -18567,16 +18567,16 @@ var require_supports_colors = __commonJS({
|
|
18567
18567
|
return 2;
|
18568
18568
|
}
|
18569
18569
|
}
|
18570
|
-
if (/-256(color)?$/i.test(
|
18570
|
+
if (/-256(color)?$/i.test(env5.TERM)) {
|
18571
18571
|
return 2;
|
18572
18572
|
}
|
18573
|
-
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(
|
18573
|
+
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env5.TERM)) {
|
18574
18574
|
return 1;
|
18575
18575
|
}
|
18576
|
-
if ("COLORTERM" in
|
18576
|
+
if ("COLORTERM" in env5) {
|
18577
18577
|
return 1;
|
18578
18578
|
}
|
18579
|
-
if (
|
18579
|
+
if (env5.TERM === "dumb") {
|
18580
18580
|
return min;
|
18581
18581
|
}
|
18582
18582
|
return min;
|
@@ -22930,8 +22930,8 @@ var require_picocolors = __commonJS({
|
|
22930
22930
|
"../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports2, module3) {
|
22931
22931
|
init_import_meta_url();
|
22932
22932
|
var argv = process.argv || [];
|
22933
|
-
var
|
22934
|
-
var isColorSupported = !("NO_COLOR" in
|
22933
|
+
var env5 = process.env;
|
22934
|
+
var isColorSupported = !("NO_COLOR" in env5 || argv.includes("--no-color")) && ("FORCE_COLOR" in env5 || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env5.TERM !== "dumb" || "CI" in env5);
|
22935
22935
|
var formatter = /* @__PURE__ */ __name((open3, close2, replace = open3) => (input) => {
|
22936
22936
|
let string = "" + input;
|
22937
22937
|
let index = string.indexOf(close2, open3.length);
|
@@ -23469,7 +23469,7 @@ var require_ci_info = __commonJS({
|
|
23469
23469
|
"use strict";
|
23470
23470
|
init_import_meta_url();
|
23471
23471
|
var vendors = require_vendors();
|
23472
|
-
var
|
23472
|
+
var env5 = process.env;
|
23473
23473
|
Object.defineProperty(exports2, "_vendors", {
|
23474
23474
|
value: vendors.map(function(v2) {
|
23475
23475
|
return v2.constant;
|
@@ -23489,14 +23489,14 @@ var require_ci_info = __commonJS({
|
|
23489
23489
|
exports2.name = vendor.name;
|
23490
23490
|
switch (typeof vendor.pr) {
|
23491
23491
|
case "string":
|
23492
|
-
exports2.isPR = !!
|
23492
|
+
exports2.isPR = !!env5[vendor.pr];
|
23493
23493
|
break;
|
23494
23494
|
case "object":
|
23495
23495
|
if ("env" in vendor.pr) {
|
23496
|
-
exports2.isPR = vendor.pr.env in
|
23496
|
+
exports2.isPR = vendor.pr.env in env5 && env5[vendor.pr.env] !== vendor.pr.ne;
|
23497
23497
|
} else if ("any" in vendor.pr) {
|
23498
23498
|
exports2.isPR = vendor.pr.any.some(function(key) {
|
23499
|
-
return !!
|
23499
|
+
return !!env5[key];
|
23500
23500
|
});
|
23501
23501
|
} else {
|
23502
23502
|
exports2.isPR = checkEnv(vendor.pr);
|
@@ -23506,30 +23506,30 @@ var require_ci_info = __commonJS({
|
|
23506
23506
|
exports2.isPR = null;
|
23507
23507
|
}
|
23508
23508
|
});
|
23509
|
-
exports2.isCI = !!(
|
23510
|
-
(
|
23511
|
-
|
23512
|
-
|
23513
|
-
|
23514
|
-
|
23515
|
-
|
23516
|
-
|
23517
|
-
|
23518
|
-
|
23509
|
+
exports2.isCI = !!(env5.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
|
23510
|
+
(env5.BUILD_ID || // Jenkins, Cloudbees
|
23511
|
+
env5.BUILD_NUMBER || // Jenkins, TeamCity
|
23512
|
+
env5.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
|
23513
|
+
env5.CI_APP_ID || // Appflow
|
23514
|
+
env5.CI_BUILD_ID || // Appflow
|
23515
|
+
env5.CI_BUILD_NUMBER || // Appflow
|
23516
|
+
env5.CI_NAME || // Codeship and others
|
23517
|
+
env5.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
|
23518
|
+
env5.RUN_ID || // TaskCluster, dsari
|
23519
23519
|
exports2.name || false));
|
23520
23520
|
function checkEnv(obj) {
|
23521
23521
|
if (typeof obj === "string")
|
23522
|
-
return !!
|
23522
|
+
return !!env5[obj];
|
23523
23523
|
if ("env" in obj) {
|
23524
|
-
return
|
23524
|
+
return env5[obj.env] && env5[obj.env].includes(obj.includes);
|
23525
23525
|
}
|
23526
23526
|
if ("any" in obj) {
|
23527
23527
|
return obj.any.some(function(k2) {
|
23528
|
-
return !!
|
23528
|
+
return !!env5[k2];
|
23529
23529
|
});
|
23530
23530
|
}
|
23531
23531
|
return Object.keys(obj).every(function(k2) {
|
23532
|
-
return
|
23532
|
+
return env5[k2] === obj[k2];
|
23533
23533
|
});
|
23534
23534
|
}
|
23535
23535
|
__name(checkEnv, "checkEnv");
|
@@ -30615,11 +30615,11 @@ var require_utils3 = __commonJS({
|
|
30615
30615
|
var content = file.apply(null, arguments);
|
30616
30616
|
return content ? parse6(content) : null;
|
30617
30617
|
};
|
30618
|
-
var
|
30619
|
-
|
30618
|
+
var env5 = exports2.env = function(prefix, env6) {
|
30619
|
+
env6 = env6 || process.env;
|
30620
30620
|
var obj = {};
|
30621
30621
|
var l2 = prefix.length;
|
30622
|
-
for (var k2 in
|
30622
|
+
for (var k2 in env6) {
|
30623
30623
|
if (k2.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
|
30624
30624
|
var keypath = k2.substring(l2).split("__");
|
30625
30625
|
var _emptyStringIndex;
|
@@ -30631,7 +30631,7 @@ var require_utils3 = __commonJS({
|
|
30631
30631
|
if (!_subkey || typeof cursor !== "object")
|
30632
30632
|
return;
|
30633
30633
|
if (i === keypath.length - 1)
|
30634
|
-
cursor[_subkey] =
|
30634
|
+
cursor[_subkey] = env6[k2];
|
30635
30635
|
if (cursor[_subkey] === void 0)
|
30636
30636
|
cursor[_subkey] = {};
|
30637
30637
|
cursor = cursor[_subkey];
|
@@ -30977,7 +30977,7 @@ var require_rc = __commonJS({
|
|
30977
30977
|
argv = require_minimist()(process.argv.slice(2));
|
30978
30978
|
defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
|
30979
30979
|
parse6 = parse6 || cc.parse;
|
30980
|
-
var
|
30980
|
+
var env5 = cc.env(name2 + "_");
|
30981
30981
|
var configs = [defaults];
|
30982
30982
|
var configFiles = [];
|
30983
30983
|
function addConfigFile(file) {
|
@@ -31003,12 +31003,12 @@ var require_rc = __commonJS({
|
|
31003
31003
|
join17(home, "." + name2 + "rc")
|
31004
31004
|
].forEach(addConfigFile);
|
31005
31005
|
addConfigFile(cc.find("." + name2 + "rc"));
|
31006
|
-
if (
|
31007
|
-
addConfigFile(
|
31006
|
+
if (env5.config)
|
31007
|
+
addConfigFile(env5.config);
|
31008
31008
|
if (argv.config)
|
31009
31009
|
addConfigFile(argv.config);
|
31010
31010
|
return deepExtend.apply(null, configs.concat([
|
31011
|
-
|
31011
|
+
env5,
|
31012
31012
|
argv,
|
31013
31013
|
configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
|
31014
31014
|
]));
|
@@ -36639,7 +36639,7 @@ var require_resolveCommand = __commonJS({
|
|
36639
36639
|
var which = require_which();
|
36640
36640
|
var getPathKey = require_path_key();
|
36641
36641
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
36642
|
-
const
|
36642
|
+
const env5 = parsed.options.env || process.env;
|
36643
36643
|
const cwd2 = process.cwd();
|
36644
36644
|
const hasCustomCwd = parsed.options.cwd != null;
|
36645
36645
|
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
@@ -36652,7 +36652,7 @@ var require_resolveCommand = __commonJS({
|
|
36652
36652
|
let resolved;
|
36653
36653
|
try {
|
36654
36654
|
resolved = which.sync(parsed.command, {
|
36655
|
-
path:
|
36655
|
+
path: env5[getPathKey({ env: env5 })],
|
36656
36656
|
pathExt: withoutPathExt ? path70.delimiter : void 0
|
36657
36657
|
});
|
36658
36658
|
} catch (e3) {
|
@@ -36930,13 +36930,13 @@ var init_strip_final_newline = __esm({
|
|
36930
36930
|
// ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
36931
36931
|
function pathKey(options30 = {}) {
|
36932
36932
|
const {
|
36933
|
-
env:
|
36933
|
+
env: env5 = process.env,
|
36934
36934
|
platform: platform2 = process.platform
|
36935
36935
|
} = options30;
|
36936
36936
|
if (platform2 !== "win32") {
|
36937
36937
|
return "PATH";
|
36938
36938
|
}
|
36939
|
-
return Object.keys(
|
36939
|
+
return Object.keys(env5).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
36940
36940
|
}
|
36941
36941
|
var init_path_key = __esm({
|
36942
36942
|
"../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js"() {
|
@@ -36964,12 +36964,12 @@ function npmRunPath(options30 = {}) {
|
|
36964
36964
|
result.push(import_node_path25.default.resolve(cwdString, execPath, ".."));
|
36965
36965
|
return [...result, path_].join(import_node_path25.default.delimiter);
|
36966
36966
|
}
|
36967
|
-
function npmRunPathEnv({ env:
|
36968
|
-
|
36969
|
-
const path70 = pathKey({ env:
|
36970
|
-
options30.path =
|
36971
|
-
|
36972
|
-
return
|
36967
|
+
function npmRunPathEnv({ env: env5 = import_node_process8.default.env, ...options30 } = {}) {
|
36968
|
+
env5 = { ...env5 };
|
36969
|
+
const path70 = pathKey({ env: env5 });
|
36970
|
+
options30.path = env5[path70];
|
36971
|
+
env5[path70] = npmRunPath(options30);
|
36972
|
+
return env5;
|
36973
36973
|
}
|
36974
36974
|
var import_node_process8, import_node_path25, import_node_url9;
|
36975
36975
|
var init_npm_run_path = __esm({
|
@@ -38109,11 +38109,11 @@ var init_execa = __esm({
|
|
38109
38109
|
init_command();
|
38110
38110
|
DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
|
38111
38111
|
getEnv = /* @__PURE__ */ __name(({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
|
38112
|
-
const
|
38112
|
+
const env5 = extendEnv ? { ...import_node_process9.default.env, ...envOption } : envOption;
|
38113
38113
|
if (preferLocal) {
|
38114
|
-
return npmRunPathEnv({ env:
|
38114
|
+
return npmRunPathEnv({ env: env5, cwd: localDir, execPath });
|
38115
38115
|
}
|
38116
|
-
return
|
38116
|
+
return env5;
|
38117
38117
|
}, "getEnv");
|
38118
38118
|
handleArguments = /* @__PURE__ */ __name((file, args, options30 = {}) => {
|
38119
38119
|
const parsed = import_cross_spawn.default._parse(file, args, options30);
|
@@ -38226,8 +38226,8 @@ var require_parse4 = __commonJS({
|
|
38226
38226
|
return matches;
|
38227
38227
|
}
|
38228
38228
|
__name(matchAll, "matchAll");
|
38229
|
-
function getVar(
|
38230
|
-
var r3 = typeof
|
38229
|
+
function getVar(env5, pre, key) {
|
38230
|
+
var r3 = typeof env5 === "function" ? env5(key) : env5[key];
|
38231
38231
|
if (typeof r3 === "undefined" && key != "") {
|
38232
38232
|
r3 = "";
|
38233
38233
|
} else if (typeof r3 === "undefined") {
|
@@ -38239,7 +38239,7 @@ var require_parse4 = __commonJS({
|
|
38239
38239
|
return pre + r3;
|
38240
38240
|
}
|
38241
38241
|
__name(getVar, "getVar");
|
38242
|
-
function parseInternal(string,
|
38242
|
+
function parseInternal(string, env5, opts) {
|
38243
38243
|
if (!opts) {
|
38244
38244
|
opts = {};
|
38245
38245
|
}
|
@@ -38254,8 +38254,8 @@ var require_parse4 = __commonJS({
|
|
38254
38254
|
if (matches.length === 0) {
|
38255
38255
|
return [];
|
38256
38256
|
}
|
38257
|
-
if (!
|
38258
|
-
|
38257
|
+
if (!env5) {
|
38258
|
+
env5 = {};
|
38259
38259
|
}
|
38260
38260
|
var commented = false;
|
38261
38261
|
return matches.map(function(match2) {
|
@@ -38301,7 +38301,7 @@ var require_parse4 = __commonJS({
|
|
38301
38301
|
i2 += varend.index - 1;
|
38302
38302
|
}
|
38303
38303
|
}
|
38304
|
-
return getVar(
|
38304
|
+
return getVar(env5, "", varname);
|
38305
38305
|
}
|
38306
38306
|
__name(parseEnvVar, "parseEnvVar");
|
38307
38307
|
for (i2 = 0; i2 < s.length; i2++) {
|
@@ -38358,9 +38358,9 @@ var require_parse4 = __commonJS({
|
|
38358
38358
|
}, []);
|
38359
38359
|
}
|
38360
38360
|
__name(parseInternal, "parseInternal");
|
38361
|
-
module3.exports = /* @__PURE__ */ __name(function parse6(s,
|
38362
|
-
var mapped = parseInternal(s,
|
38363
|
-
if (typeof
|
38361
|
+
module3.exports = /* @__PURE__ */ __name(function parse6(s, env5, opts) {
|
38362
|
+
var mapped = parseInternal(s, env5, opts);
|
38363
|
+
if (typeof env5 !== "function") {
|
38364
38364
|
return mapped;
|
38365
38365
|
}
|
38366
38366
|
return mapped.reduce(function(acc, s2) {
|
@@ -38674,7 +38674,7 @@ var require_ms = __commonJS({
|
|
38674
38674
|
var require_common = __commonJS({
|
38675
38675
|
"../../node_modules/.pnpm/debug@4.3.6_supports-color@9.2.2/node_modules/debug/src/common.js"(exports2, module3) {
|
38676
38676
|
init_import_meta_url();
|
38677
|
-
function setup(
|
38677
|
+
function setup(env5) {
|
38678
38678
|
createDebug.debug = createDebug;
|
38679
38679
|
createDebug.default = createDebug;
|
38680
38680
|
createDebug.coerce = coerce2;
|
@@ -38683,8 +38683,8 @@ var require_common = __commonJS({
|
|
38683
38683
|
createDebug.enabled = enabled;
|
38684
38684
|
createDebug.humanize = require_ms();
|
38685
38685
|
createDebug.destroy = destroy;
|
38686
|
-
Object.keys(
|
38687
|
-
createDebug[key] =
|
38686
|
+
Object.keys(env5).forEach((key) => {
|
38687
|
+
createDebug[key] = env5[key];
|
38688
38688
|
});
|
38689
38689
|
createDebug.names = [];
|
38690
38690
|
createDebug.skips = [];
|
@@ -39789,7 +39789,7 @@ var require_ms2 = __commonJS({
|
|
39789
39789
|
var require_common2 = __commonJS({
|
39790
39790
|
"../../node_modules/.pnpm/debug@4.3.7_supports-color@9.2.2/node_modules/debug/src/common.js"(exports2, module3) {
|
39791
39791
|
init_import_meta_url();
|
39792
|
-
function setup(
|
39792
|
+
function setup(env5) {
|
39793
39793
|
createDebug.debug = createDebug;
|
39794
39794
|
createDebug.default = createDebug;
|
39795
39795
|
createDebug.coerce = coerce2;
|
@@ -39798,8 +39798,8 @@ var require_common2 = __commonJS({
|
|
39798
39798
|
createDebug.enabled = enabled;
|
39799
39799
|
createDebug.humanize = require_ms2();
|
39800
39800
|
createDebug.destroy = destroy;
|
39801
|
-
Object.keys(
|
39802
|
-
createDebug[key] =
|
39801
|
+
Object.keys(env5).forEach((key) => {
|
39802
|
+
createDebug[key] = env5[key];
|
39803
39803
|
});
|
39804
39804
|
createDebug.names = [];
|
39805
39805
|
createDebug.skips = [];
|
@@ -57778,7 +57778,7 @@ var require_finalhandler = __commonJS({
|
|
57778
57778
|
module3.exports = finalhandler;
|
57779
57779
|
function finalhandler(req, res, options30) {
|
57780
57780
|
var opts = options30 || {};
|
57781
|
-
var
|
57781
|
+
var env5 = opts.env || "production";
|
57782
57782
|
var onerror = opts.onerror;
|
57783
57783
|
return function(err) {
|
57784
57784
|
var headers;
|
@@ -57795,7 +57795,7 @@ var require_finalhandler = __commonJS({
|
|
57795
57795
|
} else {
|
57796
57796
|
headers = getErrorHeaders(err);
|
57797
57797
|
}
|
57798
|
-
msg = getErrorMessage2(err, status2,
|
57798
|
+
msg = getErrorMessage2(err, status2, env5);
|
57799
57799
|
} else {
|
57800
57800
|
status2 = 404;
|
57801
57801
|
msg = "Cannot " + req.method + " " + encodeUrl(getResourceName(req));
|
@@ -57826,9 +57826,9 @@ var require_finalhandler = __commonJS({
|
|
57826
57826
|
return headers;
|
57827
57827
|
}
|
57828
57828
|
__name(getErrorHeaders, "getErrorHeaders");
|
57829
|
-
function getErrorMessage2(err, status2,
|
57829
|
+
function getErrorMessage2(err, status2, env5) {
|
57830
57830
|
var msg;
|
57831
|
-
if (
|
57831
|
+
if (env5 !== "production") {
|
57832
57832
|
msg = err.stack;
|
57833
57833
|
if (!msg && typeof err.toString === "function") {
|
57834
57834
|
msg = err.toString();
|
@@ -60891,10 +60891,10 @@ var require_application = __commonJS({
|
|
60891
60891
|
this.defaultConfiguration();
|
60892
60892
|
}, "init");
|
60893
60893
|
app.defaultConfiguration = /* @__PURE__ */ __name(function defaultConfiguration() {
|
60894
|
-
var
|
60894
|
+
var env5 = "production";
|
60895
60895
|
this.enable("x-powered-by");
|
60896
60896
|
this.set("etag", "weak");
|
60897
|
-
this.set("env",
|
60897
|
+
this.set("env", env5);
|
60898
60898
|
this.set("query parser", "extended");
|
60899
60899
|
this.set("subdomain offset", 2);
|
60900
60900
|
this.set("trust proxy", false);
|
@@ -60902,7 +60902,7 @@ var require_application = __commonJS({
|
|
60902
60902
|
configurable: true,
|
60903
60903
|
value: true
|
60904
60904
|
});
|
60905
|
-
debug("booting in %s mode",
|
60905
|
+
debug("booting in %s mode", env5);
|
60906
60906
|
this.on("mount", /* @__PURE__ */ __name(function onmount(parent) {
|
60907
60907
|
if (this.settings[trustProxyDefaultSymbol] === true && typeof parent.settings["trust proxy fn"] === "function") {
|
60908
60908
|
delete this.settings["trust proxy"];
|
@@ -60919,7 +60919,7 @@ var require_application = __commonJS({
|
|
60919
60919
|
this.set("view", View);
|
60920
60920
|
this.set("views", resolve22("views"));
|
60921
60921
|
this.set("jsonp callback name", "callback");
|
60922
|
-
if (
|
60922
|
+
if (env5 === "production") {
|
60923
60923
|
this.enable("view cache");
|
60924
60924
|
}
|
60925
60925
|
Object.defineProperty(this, "router", {
|
@@ -105433,19 +105433,19 @@ Make sure "${service}" is mounted so Miniflare knows where to find it.`);
|
|
105433
105433
|
}
|
105434
105434
|
config.build = { cwd: configDir, upload: { dir: "" } };
|
105435
105435
|
(0, import_assert32.default)(config.build.upload);
|
105436
|
-
const
|
105436
|
+
const env5 = configEnv ? ` --env ${configEnv}` : "";
|
105437
105437
|
if (config.type === "webpack") {
|
105438
105438
|
let packageDir = "";
|
105439
105439
|
if (config.site) {
|
105440
105440
|
packageDir = config.site["entry-point"] ?? "workers-site";
|
105441
105441
|
}
|
105442
|
-
config.build.command = `wrangler build${
|
105442
|
+
config.build.command = `wrangler build${env5}`;
|
105443
105443
|
config.build.upload.main = import_path32.default.join(packageDir, "worker", "script.js");
|
105444
105444
|
config.miniflare ??= {};
|
105445
105445
|
config.miniflare.build_watch_dirs = ["src", "index.js"];
|
105446
105446
|
} else if (config.type === "rust") {
|
105447
105447
|
const rustScript = import_path32.default.join(__dirname, "plugins", "rust.js");
|
105448
|
-
config.build.command = `wrangler build${
|
105448
|
+
config.build.command = `wrangler build${env5} && ${process.execPath} ${rustScript}`;
|
105449
105449
|
config.build.upload.main = import_path32.default.join("worker", "generated", "script.js");
|
105450
105450
|
config.wasm_modules ??= {};
|
105451
105451
|
config.wasm_modules.wasm = import_path32.default.join(configDir, "worker", "generated", "script.wasm");
|
@@ -108164,8 +108164,7 @@ var init_rulesEngine = __esm({
|
|
108164
108164
|
var handler_exports = {};
|
108165
108165
|
__export(handler_exports, {
|
108166
108166
|
ANALYTICS_VERSION: () => ANALYTICS_VERSION2,
|
108167
|
-
|
108168
|
-
ASSET_PRESERVATION_CACHE_V2: () => ASSET_PRESERVATION_CACHE_V2,
|
108167
|
+
ASSET_PRESERVATION_CACHE: () => ASSET_PRESERVATION_CACHE,
|
108169
108168
|
CACHE_CONTROL_BROWSER: () => CACHE_CONTROL_BROWSER,
|
108170
108169
|
CACHE_PRESERVATION_WRITE_FREQUENCY: () => CACHE_PRESERVATION_WRITE_FREQUENCY,
|
108171
108170
|
HEADERS_VERSION: () => HEADERS_VERSION2,
|
@@ -108523,10 +108522,10 @@ async function generateHandler2({
|
|
108523
108522
|
waitUntil(
|
108524
108523
|
(async () => {
|
108525
108524
|
try {
|
108526
|
-
const
|
108527
|
-
|
108525
|
+
const assetPreservationCache = await caches.open(
|
108526
|
+
ASSET_PRESERVATION_CACHE
|
108528
108527
|
);
|
108529
|
-
const match2 = await
|
108528
|
+
const match2 = await assetPreservationCache.match(request3);
|
108530
108529
|
if (!match2 || assetKey !== await match2.text() || isPreservationCacheResponseExpiring(match2)) {
|
108531
108530
|
const preservedResponse = new Response(assetKey, response);
|
108532
108531
|
preservedResponse.headers.set(
|
@@ -108534,7 +108533,7 @@ async function generateHandler2({
|
|
108534
108533
|
CACHE_CONTROL_PRESERVATION
|
108535
108534
|
);
|
108536
108535
|
preservedResponse.headers.set("x-robots-tag", "noindex");
|
108537
|
-
await
|
108536
|
+
await assetPreservationCache.put(
|
108538
108537
|
request3.url,
|
108539
108538
|
preservedResponse
|
108540
108539
|
);
|
@@ -108565,25 +108564,12 @@ async function generateHandler2({
|
|
108565
108564
|
async function notFound() {
|
108566
108565
|
if (caches) {
|
108567
108566
|
try {
|
108568
|
-
const
|
108569
|
-
|
108567
|
+
const assetPreservationCache = await caches.open(
|
108568
|
+
ASSET_PRESERVATION_CACHE
|
108570
108569
|
);
|
108571
|
-
|
108570
|
+
const preservedResponse = await assetPreservationCache.match(
|
108572
108571
|
request3.url
|
108573
108572
|
);
|
108574
|
-
const cutoffDate = /* @__PURE__ */ new Date("2024-05-17");
|
108575
|
-
if (!preservedResponse && Date.now() < cutoffDate.getTime()) {
|
108576
|
-
const assetPreservationCacheV1 = await caches.open(
|
108577
|
-
ASSET_PRESERVATION_CACHE_V1
|
108578
|
-
);
|
108579
|
-
preservedResponse = await assetPreservationCacheV1.match(request3.url);
|
108580
|
-
if (preservedResponse) {
|
108581
|
-
if (setMetrics) {
|
108582
|
-
setMetrics({ preservationCacheResult: "checked-hit" });
|
108583
|
-
}
|
108584
|
-
return preservedResponse;
|
108585
|
-
}
|
108586
|
-
}
|
108587
108573
|
if (preservedResponse) {
|
108588
108574
|
if (setMetrics) {
|
108589
108575
|
setMetrics({ preservationCacheResult: "checked-hit" });
|
@@ -108685,14 +108671,13 @@ function isPreservationCacheResponseExpiring(response) {
|
|
108685
108671
|
function isHTMLContentType(contentType) {
|
108686
108672
|
return contentType?.toLowerCase().startsWith("text/html") || false;
|
108687
108673
|
}
|
108688
|
-
var
|
108674
|
+
var ASSET_PRESERVATION_CACHE, CACHE_CONTROL_PRESERVATION, CACHE_PRESERVATION_WRITE_FREQUENCY, CACHE_CONTROL_BROWSER, REDIRECTS_VERSION2, HEADERS_VERSION2, HEADERS_VERSION_V1, ANALYTICS_VERSION2, ALLOWED_EARLY_HINT_LINK_ATTRIBUTES;
|
108689
108675
|
var init_handler = __esm({
|
108690
108676
|
"../pages-shared/asset-server/handler.ts"() {
|
108691
108677
|
init_import_meta_url();
|
108692
108678
|
init_responses();
|
108693
108679
|
init_rulesEngine();
|
108694
|
-
|
108695
|
-
ASSET_PRESERVATION_CACHE_V2 = "assetPreservationCacheV2";
|
108680
|
+
ASSET_PRESERVATION_CACHE = "assetPreservationCacheV2";
|
108696
108681
|
CACHE_CONTROL_PRESERVATION = "public, s-maxage=604800";
|
108697
108682
|
CACHE_PRESERVATION_WRITE_FREQUENCY = 86400;
|
108698
108683
|
CACHE_CONTROL_BROWSER = "public, max-age=0, must-revalidate";
|
@@ -109693,8 +109678,8 @@ var YargsParser = class {
|
|
109693
109678
|
if (typeof envPrefix === "undefined")
|
109694
109679
|
return;
|
109695
109680
|
const prefix = typeof envPrefix === "string" ? envPrefix : "";
|
109696
|
-
const
|
109697
|
-
Object.keys(
|
109681
|
+
const env5 = mixin.env();
|
109682
|
+
Object.keys(env5).forEach(function(envVar) {
|
109698
109683
|
if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
|
109699
109684
|
const keys = envVar.split("__").map(function(key, i) {
|
109700
109685
|
if (i === 0) {
|
@@ -109703,7 +109688,7 @@ var YargsParser = class {
|
|
109703
109688
|
return camelCase(key);
|
109704
109689
|
});
|
109705
109690
|
if ((configOnly && flags2.configs[keys.join(".")] || !configOnly) && !hasKey2(argv2, keys)) {
|
109706
|
-
setArg(keys.join("."),
|
109691
|
+
setArg(keys.join("."), env5[envVar]);
|
109707
109692
|
}
|
109708
109693
|
}
|
109709
109694
|
});
|
@@ -111202,7 +111187,7 @@ var import_undici3 = __toESM(require_undici());
|
|
111202
111187
|
|
111203
111188
|
// package.json
|
111204
111189
|
var name = "wrangler";
|
111205
|
-
var version = "3.
|
111190
|
+
var version = "3.97.0";
|
111206
111191
|
|
111207
111192
|
// src/environment-variables/misc-variables.ts
|
111208
111193
|
init_import_meta_url();
|
@@ -111310,6 +111295,9 @@ var getBuildConditionsFromEnv = getEnvironmentVariableFactory({
|
|
111310
111295
|
var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
|
111311
111296
|
variableName: "WRANGLER_BUILD_PLATFORM"
|
111312
111297
|
});
|
111298
|
+
var getUnenvResolvePathsFromEnv = getEnvironmentVariableFactory({
|
111299
|
+
variableName: "WRANGLER_UNENV_RESOLVE_PATHS"
|
111300
|
+
});
|
111313
111301
|
var getRegistryPath = getEnvironmentVariableFactory({
|
111314
111302
|
variableName: "WRANGLER_REGISTRY_PATH",
|
111315
111303
|
defaultValue() {
|
@@ -117289,11 +117277,11 @@ function tryLoadDotEnv(path70) {
|
|
117289
117277
|
}
|
117290
117278
|
}
|
117291
117279
|
__name(tryLoadDotEnv, "tryLoadDotEnv");
|
117292
|
-
function loadDotEnv(path70,
|
117293
|
-
if (
|
117280
|
+
function loadDotEnv(path70, env5) {
|
117281
|
+
if (env5 === void 0) {
|
117294
117282
|
return tryLoadDotEnv(path70);
|
117295
117283
|
} else {
|
117296
|
-
return tryLoadDotEnv(`${path70}.${
|
117284
|
+
return tryLoadDotEnv(`${path70}.${env5}`) ?? tryLoadDotEnv(path70);
|
117297
117285
|
}
|
117298
117286
|
}
|
117299
117287
|
__name(loadDotEnv, "loadDotEnv");
|
@@ -119532,11 +119520,11 @@ var getRevokeUrlFromEnv = getEnvironmentVariableFactory({
|
|
119532
119520
|
defaultValue: () => `https://${getAuthDomainFromEnv()}/oauth2/revoke`
|
119533
119521
|
});
|
119534
119522
|
var getCloudflareAccessToken = /* @__PURE__ */ __name(async () => {
|
119535
|
-
const
|
119523
|
+
const env5 = getEnvironmentVariableFactory({
|
119536
119524
|
variableName: "WRANGLER_CF_AUTHORIZATION_TOKEN"
|
119537
119525
|
})();
|
119538
|
-
if (
|
119539
|
-
return
|
119526
|
+
if (env5 !== void 0) {
|
119527
|
+
return env5;
|
119540
119528
|
}
|
119541
119529
|
return getAccessToken(getAuthDomainFromEnv());
|
119542
119530
|
}, "getCloudflareAccessToken");
|
@@ -134356,7 +134344,7 @@ function renderDeploymentConfiguration(action, {
|
|
134356
134344
|
memory,
|
134357
134345
|
environmentVariables,
|
134358
134346
|
labels,
|
134359
|
-
env:
|
134347
|
+
env: env5,
|
134360
134348
|
network
|
134361
134349
|
}) {
|
134362
134350
|
let environmentVariablesText = "[]";
|
@@ -134366,7 +134354,7 @@ function renderDeploymentConfiguration(action, {
|
|
134366
134354
|
}
|
134367
134355
|
} else if (action === "create") {
|
134368
134356
|
environmentVariablesText = `
|
134369
|
-
No environment variables added! You can set some under [${
|
134357
|
+
No environment variables added! You can set some under [${env5 ? "env." + env5 + "." : ""}vars] and via command line`;
|
134370
134358
|
}
|
134371
134359
|
let labelsText = "[]";
|
134372
134360
|
if (labels !== void 0 && labels.length !== 0) {
|
@@ -134450,11 +134438,11 @@ function collectEnvironmentVariables(deploymentEnv, config, envArgs) {
|
|
134450
134438
|
if (envMap.size === 0) {
|
134451
134439
|
return void 0;
|
134452
134440
|
}
|
134453
|
-
const
|
134441
|
+
const env5 = Array.from(envMap).map(
|
134454
134442
|
([name2, value]) => ({ name: name2, value })
|
134455
134443
|
);
|
134456
|
-
sortEnvironmentVariables(
|
134457
|
-
return
|
134444
|
+
sortEnvironmentVariables(env5);
|
134445
|
+
return env5;
|
134458
134446
|
}
|
134459
134447
|
__name(collectEnvironmentVariables, "collectEnvironmentVariables");
|
134460
134448
|
async function promptForEnvironmentVariables(environmentVariables, initiallySelected, allowSkipping) {
|
@@ -143947,18 +143935,31 @@ var import_node_path29 = __toESM(require("node:path"));
|
|
143947
143935
|
var import_unenv = require("unenv");
|
143948
143936
|
var REQUIRED_NODE_BUILT_IN_NAMESPACE = "node-built-in-modules";
|
143949
143937
|
var REQUIRED_UNENV_ALIAS_NAMESPACE = "required-unenv-alias";
|
143950
|
-
|
143951
|
-
const {
|
143938
|
+
function nodejsHybridPlugin(unenvResolvePaths) {
|
143939
|
+
const { env: env5 } = (0, import_unenv.defineEnv)({
|
143940
|
+
nodeCompat: true,
|
143941
|
+
presets: [import_unenv.cloudflare],
|
143942
|
+
resolve: {
|
143943
|
+
paths: unenvResolvePaths
|
143944
|
+
}
|
143945
|
+
});
|
143946
|
+
const { alias, inject, external } = env5;
|
143947
|
+
const unresolvedAlias = (0, import_unenv.defineEnv)({
|
143948
|
+
nodeCompat: true,
|
143949
|
+
presets: [import_unenv.cloudflare],
|
143950
|
+
resolve: false
|
143951
|
+
}).env.alias;
|
143952
143952
|
return {
|
143953
143953
|
name: "hybrid-nodejs_compat",
|
143954
143954
|
setup(build5) {
|
143955
143955
|
errorOnServiceWorkerFormat(build5);
|
143956
143956
|
handleRequireCallsToNodeJSBuiltins(build5);
|
143957
|
-
handleUnenvAliasedPackages(build5, alias, external);
|
143957
|
+
handleUnenvAliasedPackages(build5, unresolvedAlias, alias, external);
|
143958
143958
|
handleNodeJSGlobals(build5, inject);
|
143959
143959
|
}
|
143960
143960
|
};
|
143961
|
-
}
|
143961
|
+
}
|
143962
|
+
__name(nodejsHybridPlugin, "nodejsHybridPlugin");
|
143962
143963
|
var NODEJS_MODULES_RE = new RegExp(`^(node:)?(${import_node_module2.builtinModules.join("|")})$`);
|
143963
143964
|
function errorOnServiceWorkerFormat(build5) {
|
143964
143965
|
const paths = /* @__PURE__ */ new Set();
|
@@ -144011,28 +144012,19 @@ function handleRequireCallsToNodeJSBuiltins(build5) {
|
|
144011
144012
|
);
|
144012
144013
|
}
|
144013
144014
|
__name(handleRequireCallsToNodeJSBuiltins, "handleRequireCallsToNodeJSBuiltins");
|
144014
|
-
function handleUnenvAliasedPackages(build5, alias, external) {
|
144015
|
-
const
|
144016
|
-
for (const [module3, unresolvedAlias] of Object.entries(alias)) {
|
144017
|
-
try {
|
144018
|
-
aliasAbsolute[module3] = require.resolve(unresolvedAlias).replace(/\.cjs$/, ".mjs");
|
144019
|
-
} catch (e3) {
|
144020
|
-
}
|
144021
|
-
}
|
144022
|
-
const UNENV_ALIAS_RE = new RegExp(
|
144023
|
-
`^(${Object.keys(aliasAbsolute).join("|")})$`
|
144024
|
-
);
|
144015
|
+
function handleUnenvAliasedPackages(build5, unresolvedAlias, alias, external) {
|
144016
|
+
const UNENV_ALIAS_RE = new RegExp(`^(${Object.keys(alias).join("|")})$`);
|
144025
144017
|
build5.onResolve({ filter: UNENV_ALIAS_RE }, (args) => {
|
144026
|
-
const
|
144027
|
-
if (args.kind === "require-call" && (
|
144018
|
+
const unresolved = unresolvedAlias[args.path];
|
144019
|
+
if (args.kind === "require-call" && (unresolved.startsWith("unenv/runtime/npm/") || unresolved.startsWith("unenv/runtime/mock/"))) {
|
144028
144020
|
return {
|
144029
144021
|
path: args.path,
|
144030
144022
|
namespace: REQUIRED_UNENV_ALIAS_NAMESPACE
|
144031
144023
|
};
|
144032
144024
|
}
|
144033
144025
|
return {
|
144034
|
-
path:
|
144035
|
-
external: external.includes(
|
144026
|
+
path: alias[args.path],
|
144027
|
+
external: external.includes(unresolved)
|
144036
144028
|
};
|
144037
144029
|
});
|
144038
144030
|
build5.initialOptions.banner = { js: "", ...build5.initialOptions.banner };
|
@@ -144224,7 +144216,10 @@ var standardURLPlugin = /* @__PURE__ */ __name(() => ({
|
|
144224
144216
|
}), "standardURLPlugin");
|
144225
144217
|
|
144226
144218
|
// src/deployment-bundle/esbuild-plugins/nodejs-plugins.ts
|
144227
|
-
function getNodeJSCompatPlugins(
|
144219
|
+
function getNodeJSCompatPlugins({
|
144220
|
+
mode,
|
144221
|
+
unenvResolvePaths
|
144222
|
+
}) {
|
144228
144223
|
switch (mode) {
|
144229
144224
|
case "als":
|
144230
144225
|
return [asyncLocalStoragePlugin, nodejsCompatPlugin(mode)];
|
@@ -144238,7 +144233,7 @@ function getNodeJSCompatPlugins(mode) {
|
|
144238
144233
|
case "v1":
|
144239
144234
|
return [nodejsCompatPlugin(mode)];
|
144240
144235
|
case "v2":
|
144241
|
-
return [nodejsHybridPlugin()];
|
144236
|
+
return [nodejsHybridPlugin(unenvResolvePaths)];
|
144242
144237
|
case null:
|
144243
144238
|
return [nodejsCompatPlugin(mode)];
|
144244
144239
|
}
|
@@ -144429,6 +144424,7 @@ async function bundleWorker(entry, destination, {
|
|
144429
144424
|
});
|
144430
144425
|
}
|
144431
144426
|
};
|
144427
|
+
const unenvResolvePaths = getUnenvResolvePathsFromEnv()?.split(",");
|
144432
144428
|
const buildOptions2 = {
|
144433
144429
|
// Don't use entryFile here as the file may have been changed when applying the middleware
|
144434
144430
|
entryPoints: [entry.file],
|
@@ -144468,7 +144464,10 @@ async function bundleWorker(entry, destination, {
|
|
144468
144464
|
plugins: [
|
144469
144465
|
aliasPlugin,
|
144470
144466
|
moduleCollector.plugin,
|
144471
|
-
...getNodeJSCompatPlugins(
|
144467
|
+
...getNodeJSCompatPlugins({
|
144468
|
+
mode: nodejsCompatMode ?? null,
|
144469
|
+
unenvResolvePaths
|
144470
|
+
}),
|
144472
144471
|
cloudflareInternalPlugin,
|
144473
144472
|
buildResultPlugin,
|
144474
144473
|
...plugins || [],
|
@@ -145777,11 +145776,11 @@ var quote = /* @__PURE__ */ __name(function(args) {
|
|
145777
145776
|
const stringArgs = args.map((arg) => String(arg));
|
145778
145777
|
return import_shell_quote.default.quote(stringArgs);
|
145779
145778
|
}, "quote");
|
145780
|
-
function parse4(cmd,
|
145779
|
+
function parse4(cmd, env5) {
|
145781
145780
|
if (process.platform === "win32") {
|
145782
145781
|
cmd = cmd.replaceAll("\\", "\\\\");
|
145783
145782
|
}
|
145784
|
-
const entries = import_shell_quote.default.parse(cmd,
|
145783
|
+
const entries = import_shell_quote.default.parse(cmd, env5);
|
145785
145784
|
const argv = [];
|
145786
145785
|
for (const entry of entries) {
|
145787
145786
|
if (typeof entry === "string") {
|
@@ -148671,20 +148670,22 @@ ${content}`
|
|
148671
148670
|
);
|
148672
148671
|
}
|
148673
148672
|
const errors = [];
|
148674
|
-
|
148675
|
-
|
148673
|
+
const keysToDelete = [];
|
148674
|
+
for (const [index, item] of content.entries()) {
|
148675
|
+
const key = typeof item !== "string" ? item?.name : item;
|
148676
148676
|
if (typeof key !== "string") {
|
148677
148677
|
errors.push(
|
148678
|
-
`The item at index ${
|
148679
|
-
|
148678
|
+
`The item at index ${index} is type: "${typeof item}" - ${JSON.stringify(
|
148679
|
+
item
|
148680
148680
|
)}`
|
148681
148681
|
);
|
148682
148682
|
}
|
148683
|
+
keysToDelete.push(key);
|
148683
148684
|
}
|
148684
148685
|
if (errors.length > 0) {
|
148685
148686
|
throw new UserError(
|
148686
148687
|
`Unexpected JSON input from "${filename}".
|
148687
|
-
Expected an array of strings.
|
148688
|
+
Expected an array of strings or objects with a "name" key.
|
148688
148689
|
` + errors.join("\n")
|
148689
148690
|
);
|
148690
148691
|
}
|
@@ -148695,7 +148696,7 @@ Expected an array of strings.
|
|
148695
148696
|
config.configPath,
|
148696
148697
|
namespaceId,
|
148697
148698
|
async (namespace) => {
|
148698
|
-
for (const key of
|
148699
|
+
for (const key of keysToDelete) {
|
148699
148700
|
await namespace.delete(key);
|
148700
148701
|
}
|
148701
148702
|
}
|
@@ -148703,7 +148704,7 @@ Expected an array of strings.
|
|
148703
148704
|
metricEvent = "delete kv key-values (bulk) (local)";
|
148704
148705
|
} else {
|
148705
148706
|
const accountId = await requireAuth(config);
|
148706
|
-
await deleteKVBulkKeyValue(accountId, namespaceId,
|
148707
|
+
await deleteKVBulkKeyValue(accountId, namespaceId, keysToDelete);
|
148707
148708
|
metricEvent = "delete kv key-values (bulk)";
|
148708
148709
|
}
|
148709
148710
|
sendMetricsEvent(metricEvent, {
|
@@ -151196,11 +151197,11 @@ async function deploy2({
|
|
151196
151197
|
if (branch) {
|
151197
151198
|
isProduction = project.production_branch === branch;
|
151198
151199
|
}
|
151199
|
-
const
|
151200
|
-
const deploymentConfig = project.deployment_configs[
|
151200
|
+
const env5 = isProduction ? "production" : "preview";
|
151201
|
+
const deploymentConfig = project.deployment_configs[env5];
|
151201
151202
|
let config;
|
151202
151203
|
try {
|
151203
|
-
config = readPagesConfig({ ...args, env:
|
151204
|
+
config = readPagesConfig({ ...args, env: env5 });
|
151204
151205
|
} catch (err) {
|
151205
151206
|
if (!(err instanceof FatalError && err.code === EXIT_CODE_INVALID_PAGES_CONFIG)) {
|
151206
151207
|
throw err;
|
@@ -152293,12 +152294,12 @@ __name(prettifyOutcome, "prettifyOutcome");
|
|
152293
152294
|
|
152294
152295
|
// src/tail/createTail.ts
|
152295
152296
|
var TRACE_VERSION = "trace-v1";
|
152296
|
-
function makeCreateTailUrl(accountId, workerName,
|
152297
|
-
return
|
152297
|
+
function makeCreateTailUrl(accountId, workerName, env5) {
|
152298
|
+
return env5 ? `/accounts/${accountId}/workers/services/${workerName}/environments/${env5}/tails` : `/accounts/${accountId}/workers/scripts/${workerName}/tails`;
|
152298
152299
|
}
|
152299
152300
|
__name(makeCreateTailUrl, "makeCreateTailUrl");
|
152300
|
-
function makeDeleteTailUrl(accountId, workerName, tailId,
|
152301
|
-
return
|
152301
|
+
function makeDeleteTailUrl(accountId, workerName, tailId, env5) {
|
152302
|
+
return env5 ? `/accounts/${accountId}/workers/services/${workerName}/environments/${env5}/tails/${tailId}` : `/accounts/${accountId}/workers/scripts/${workerName}/tails/${tailId}`;
|
152302
152303
|
}
|
152303
152304
|
__name(makeDeleteTailUrl, "makeDeleteTailUrl");
|
152304
152305
|
async function createPagesTail({
|
@@ -152342,8 +152343,8 @@ async function createPagesTail({
|
|
152342
152343
|
return { tail, deleteTail, expiration: tailRecord.expires_at };
|
152343
152344
|
}
|
152344
152345
|
__name(createPagesTail, "createPagesTail");
|
152345
|
-
async function createTail(accountId, workerName, filters, debug,
|
152346
|
-
const createTailUrl = makeCreateTailUrl(accountId, workerName,
|
152346
|
+
async function createTail(accountId, workerName, filters, debug, env5) {
|
152347
|
+
const createTailUrl = makeCreateTailUrl(accountId, workerName, env5);
|
152347
152348
|
const {
|
152348
152349
|
id: tailId,
|
152349
152350
|
url: websocketUrl,
|
@@ -152352,7 +152353,7 @@ async function createTail(accountId, workerName, filters, debug, env6) {
|
|
152352
152353
|
method: "POST",
|
152353
152354
|
body: JSON.stringify(filters)
|
152354
152355
|
});
|
152355
|
-
const deleteUrl = makeDeleteTailUrl(accountId, workerName, tailId,
|
152356
|
+
const deleteUrl = makeDeleteTailUrl(accountId, workerName, tailId, env5);
|
152356
152357
|
async function deleteTail() {
|
152357
152358
|
await fetchResult(deleteUrl, { method: "DELETE" });
|
152358
152359
|
}
|
@@ -153843,15 +153844,15 @@ function readFromStdin() {
|
|
153843
153844
|
__name(readFromStdin, "readFromStdin");
|
153844
153845
|
|
153845
153846
|
// src/pages/secret/index.ts
|
153846
|
-
function isPagesEnv(
|
153847
|
-
return ["production", "preview"].includes(
|
153847
|
+
function isPagesEnv(env5) {
|
153848
|
+
return ["production", "preview"].includes(env5);
|
153848
153849
|
}
|
153849
153850
|
__name(isPagesEnv, "isPagesEnv");
|
153850
|
-
async function pagesProject(
|
153851
|
-
|
153852
|
-
if (!isPagesEnv(
|
153851
|
+
async function pagesProject(env5, cliProjectName) {
|
153852
|
+
env5 ??= "production";
|
153853
|
+
if (!isPagesEnv(env5)) {
|
153853
153854
|
throw new FatalError(
|
153854
|
-
`Pages does not support the "${
|
153855
|
+
`Pages does not support the "${env5}" named environment. Please specify "production" (default) or "preview"`,
|
153855
153856
|
1
|
153856
153857
|
);
|
153857
153858
|
}
|
@@ -153892,7 +153893,7 @@ Ignoring configuration file for now.`
|
|
153892
153893
|
} else {
|
153893
153894
|
throw new FatalError("Must specify a project name.", 1);
|
153894
153895
|
}
|
153895
|
-
return { env:
|
153896
|
+
return { env: env5, project, accountId, config };
|
153896
153897
|
}
|
153897
153898
|
__name(pagesProject, "pagesProject");
|
153898
153899
|
var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
@@ -153911,7 +153912,7 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
153911
153912
|
},
|
153912
153913
|
async (args) => {
|
153913
153914
|
await printWranglerBanner();
|
153914
|
-
const { env:
|
153915
|
+
const { env: env5, project, accountId, config } = await pagesProject(
|
153915
153916
|
args.env,
|
153916
153917
|
args.projectName
|
153917
153918
|
);
|
@@ -153919,7 +153920,7 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
153919
153920
|
isInteractive2() ? await prompt("Enter a secret value:", { isSecret: true }) : await readFromStdin()
|
153920
153921
|
);
|
153921
153922
|
logger.log(
|
153922
|
-
`\u{1F300} Creating the secret for the Pages project "${project.name}" (${
|
153923
|
+
`\u{1F300} Creating the secret for the Pages project "${project.name}" (${env5})`
|
153923
153924
|
);
|
153924
153925
|
await fetchResult(
|
153925
153926
|
`/accounts/${accountId}/pages/projects/${project.name}`,
|
@@ -153927,14 +153928,14 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
153927
153928
|
method: "PATCH",
|
153928
153929
|
body: JSON.stringify({
|
153929
153930
|
deployment_configs: {
|
153930
|
-
[
|
153931
|
+
[env5]: {
|
153931
153932
|
env_vars: {
|
153932
153933
|
[args.key]: {
|
153933
153934
|
value: secretValue,
|
153934
153935
|
type: "secret_text"
|
153935
153936
|
}
|
153936
153937
|
},
|
153937
|
-
wrangler_config_hash: project.deployment_configs[
|
153938
|
+
wrangler_config_hash: project.deployment_configs[env5].wrangler_config_hash
|
153938
153939
|
}
|
153939
153940
|
}
|
153940
153941
|
})
|
@@ -153960,12 +153961,12 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
153960
153961
|
},
|
153961
153962
|
async (args) => {
|
153962
153963
|
await printWranglerBanner();
|
153963
|
-
const { env:
|
153964
|
+
const { env: env5, project, accountId } = await pagesProject(
|
153964
153965
|
args.env,
|
153965
153966
|
args.projectName
|
153966
153967
|
);
|
153967
153968
|
logger.log(
|
153968
|
-
`\u{1F300} Creating the secrets for the Pages project "${project.name}" (${
|
153969
|
+
`\u{1F300} Creating the secrets for the Pages project "${project.name}" (${env5})`
|
153969
153970
|
);
|
153970
153971
|
let content;
|
153971
153972
|
if (args.json) {
|
@@ -154011,11 +154012,11 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
154011
154012
|
method: "PATCH",
|
154012
154013
|
body: JSON.stringify({
|
154013
154014
|
deployment_configs: {
|
154014
|
-
[
|
154015
|
+
[env5]: {
|
154015
154016
|
env_vars: {
|
154016
154017
|
...upsertBindings
|
154017
154018
|
},
|
154018
|
-
wrangler_config_hash: project.deployment_configs[
|
154019
|
+
wrangler_config_hash: project.deployment_configs[env5].wrangler_config_hash
|
154019
154020
|
}
|
154020
154021
|
}
|
154021
154022
|
})
|
@@ -154048,15 +154049,15 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
154048
154049
|
},
|
154049
154050
|
async (args) => {
|
154050
154051
|
await printWranglerBanner();
|
154051
|
-
const { env:
|
154052
|
+
const { env: env5, project, accountId, config } = await pagesProject(
|
154052
154053
|
args.env,
|
154053
154054
|
args.projectName
|
154054
154055
|
);
|
154055
154056
|
if (await confirm(
|
154056
|
-
`Are you sure you want to permanently delete the secret ${args.key} on the Pages project ${project.name} (${
|
154057
|
+
`Are you sure you want to permanently delete the secret ${args.key} on the Pages project ${project.name} (${env5})?`
|
154057
154058
|
)) {
|
154058
154059
|
logger.log(
|
154059
|
-
`\u{1F300} Deleting the secret ${args.key} on the Pages project ${project.name} (${
|
154060
|
+
`\u{1F300} Deleting the secret ${args.key} on the Pages project ${project.name} (${env5})`
|
154060
154061
|
);
|
154061
154062
|
await fetchResult(
|
154062
154063
|
`/accounts/${accountId}/pages/projects/${project.name}`,
|
@@ -154064,11 +154065,11 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
154064
154065
|
method: "PATCH",
|
154065
154066
|
body: JSON.stringify({
|
154066
154067
|
deployment_configs: {
|
154067
|
-
[
|
154068
|
+
[env5]: {
|
154068
154069
|
env_vars: {
|
154069
154070
|
[args.key]: null
|
154070
154071
|
},
|
154071
|
-
wrangler_config_hash: project.deployment_configs[
|
154072
|
+
wrangler_config_hash: project.deployment_configs[env5].wrangler_config_hash
|
154072
154073
|
}
|
154073
154074
|
}
|
154074
154075
|
})
|
@@ -154092,16 +154093,16 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
154092
154093
|
},
|
154093
154094
|
async (args) => {
|
154094
154095
|
await printWranglerBanner();
|
154095
|
-
const { env:
|
154096
|
+
const { env: env5, project, config } = await pagesProject(
|
154096
154097
|
args.env,
|
154097
154098
|
args.projectName
|
154098
154099
|
);
|
154099
154100
|
const secrets = Object.entries(
|
154100
|
-
project.deployment_configs[
|
154101
|
+
project.deployment_configs[env5].env_vars ?? {}
|
154101
154102
|
).filter(([_3, val]) => val?.type === "secret_text");
|
154102
154103
|
const message = [
|
154103
154104
|
`The "${source_default.blue(
|
154104
|
-
|
154105
|
+
env5
|
154105
154106
|
)}" environment of your Pages project "${source_default.blue(
|
154106
154107
|
project.name
|
154107
154108
|
)}" has access to the following secrets:`,
|
@@ -163952,17 +163953,17 @@ var BaseClient = class {
|
|
163952
163953
|
*/
|
163953
163954
|
sendEvent(event, hint = {}) {
|
163954
163955
|
this.emit("beforeSendEvent", event, hint);
|
163955
|
-
let
|
163956
|
+
let env5 = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
|
163956
163957
|
for (const attachment of hint.attachments || []) {
|
163957
|
-
|
163958
|
-
|
163958
|
+
env5 = addItemToEnvelope(
|
163959
|
+
env5,
|
163959
163960
|
createAttachmentEnvelopeItem(
|
163960
163961
|
attachment,
|
163961
163962
|
this._options.transportOptions && this._options.transportOptions.textEncoder
|
163962
163963
|
)
|
163963
163964
|
);
|
163964
163965
|
}
|
163965
|
-
const promise = this._sendEnvelope(
|
163966
|
+
const promise = this._sendEnvelope(env5);
|
163966
163967
|
if (promise) {
|
163967
163968
|
promise.then((sendResponse) => this.emit("afterSendEvent", event, sendResponse), null);
|
163968
163969
|
}
|
@@ -163971,8 +163972,8 @@ var BaseClient = class {
|
|
163971
163972
|
* @inheritDoc
|
163972
163973
|
*/
|
163973
163974
|
sendSession(session) {
|
163974
|
-
const
|
163975
|
-
void this._sendEnvelope(
|
163975
|
+
const env5 = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
|
163976
|
+
void this._sendEnvelope(env5);
|
163976
163977
|
}
|
163977
163978
|
/**
|
163978
163979
|
* @inheritDoc
|
@@ -169003,10 +169004,10 @@ var import_miniflare20 = require("miniflare");
|
|
169003
169004
|
// src/dev/dev-vars.ts
|
169004
169005
|
init_import_meta_url();
|
169005
169006
|
var path59 = __toESM(require("node:path"));
|
169006
|
-
function getVarsForDev(config,
|
169007
|
+
function getVarsForDev(config, env5, silent = false) {
|
169007
169008
|
const configDir = path59.resolve(path59.dirname(config.configPath ?? "."));
|
169008
169009
|
const devVarsPath = path59.resolve(configDir, ".dev.vars");
|
169009
|
-
const loaded = loadDotEnv(devVarsPath,
|
169010
|
+
const loaded = loadDotEnv(devVarsPath, env5);
|
169010
169011
|
if (loaded !== void 0) {
|
169011
169012
|
const devVarsRelativePath = path59.relative(process.cwd(), loaded.path);
|
169012
169013
|
if (!silent) {
|
@@ -171510,6 +171511,13 @@ __name(validateTrafficSubtotal, "validateTrafficSubtotal");
|
|
171510
171511
|
|
171511
171512
|
// src/versions/deployments/index.ts
|
171512
171513
|
init_import_meta_url();
|
171514
|
+
var deploymentsNamespace = createNamespace({
|
171515
|
+
metadata: {
|
171516
|
+
description: "\u{1F6A2} List and view the current and past deployments for your Worker",
|
171517
|
+
owner: "Workers: Authoring and Testing",
|
171518
|
+
status: "stable"
|
171519
|
+
}
|
171520
|
+
});
|
171513
171521
|
|
171514
171522
|
// src/versions/deployments/list.ts
|
171515
171523
|
init_import_meta_url();
|
@@ -171613,57 +171621,156 @@ __name(formatTrigger2, "formatTrigger");
|
|
171613
171621
|
|
171614
171622
|
// src/versions/deployments/list.ts
|
171615
171623
|
var BLANK_INPUT3 = "-";
|
171616
|
-
|
171617
|
-
|
171618
|
-
|
171619
|
-
|
171620
|
-
|
171621
|
-
}
|
171622
|
-
|
171623
|
-
|
171624
|
-
|
171624
|
+
var deploymentsListCommand = createCommand({
|
171625
|
+
metadata: {
|
171626
|
+
description: "Displays the 10 most recent deployments of your Worker",
|
171627
|
+
owner: "Workers: Authoring and Testing",
|
171628
|
+
status: "stable"
|
171629
|
+
},
|
171630
|
+
args: {
|
171631
|
+
name: {
|
171632
|
+
describe: "Name of the Worker",
|
171633
|
+
type: "string",
|
171634
|
+
requiresArg: true
|
171635
|
+
},
|
171636
|
+
json: {
|
171637
|
+
describe: "Display output as clean JSON",
|
171638
|
+
type: "boolean",
|
171639
|
+
default: false
|
171640
|
+
}
|
171641
|
+
},
|
171642
|
+
behaviour: {
|
171643
|
+
printBanner: false
|
171644
|
+
},
|
171645
|
+
handler: /* @__PURE__ */ __name(async function versionsDeploymentsListHandler(args, { config }) {
|
171646
|
+
sendMetricsEvent(
|
171647
|
+
"list versioned deployments",
|
171648
|
+
{ json: args.json },
|
171649
|
+
{
|
171650
|
+
sendMetrics: config.send_metrics
|
171651
|
+
}
|
171652
|
+
);
|
171653
|
+
const accountId = await requireAuth(config);
|
171654
|
+
const workerName = args.name ?? config.name;
|
171655
|
+
if (workerName === void 0) {
|
171656
|
+
throw new UserError(
|
171657
|
+
'You need to provide a name for your Worker. Either pass it as a cli arg with `--name <name>` or in your configuration file as `name = "<name>"`'
|
171658
|
+
);
|
171659
|
+
}
|
171660
|
+
const deployments2 = (await fetchLatestDeployments(accountId, workerName)).sort((a, b2) => a.created_on.localeCompare(b2.created_on));
|
171661
|
+
if (args.json) {
|
171662
|
+
logRaw(JSON.stringify(deployments2, null, 2));
|
171663
|
+
return;
|
171664
|
+
}
|
171665
|
+
const versionCache = /* @__PURE__ */ new Map();
|
171666
|
+
const versionIds = deployments2.flatMap(
|
171667
|
+
(d2) => d2.versions.map((v2) => v2.version_id)
|
171668
|
+
);
|
171669
|
+
await fetchVersions(accountId, workerName, versionCache, ...versionIds);
|
171670
|
+
const formattedDeployments = deployments2.map((deployment) => {
|
171671
|
+
const formattedVersions = deployment.versions.map((traffic) => {
|
171672
|
+
const version4 = versionCache.get(traffic.version_id);
|
171673
|
+
(0, import_assert4.default)(version4);
|
171674
|
+
const percentage = brandColor(`(${traffic.percentage}%)`);
|
171675
|
+
const details = formatLabelledValues(
|
171676
|
+
{
|
171677
|
+
Created: new Date(version4.metadata["created_on"]).toISOString(),
|
171678
|
+
Tag: version4.annotations?.["workers/tag"] || BLANK_INPUT3,
|
171679
|
+
Message: version4.annotations?.["workers/message"] || BLANK_INPUT3
|
171680
|
+
},
|
171681
|
+
{
|
171682
|
+
indentationCount: 4,
|
171683
|
+
labelJustification: "right",
|
171684
|
+
formatLabel: (label) => gray(label + ":"),
|
171685
|
+
formatValue: (value) => gray(value)
|
171686
|
+
}
|
171687
|
+
);
|
171688
|
+
return `${percentage} ${version4.id}
|
171689
|
+
${details}`;
|
171690
|
+
});
|
171691
|
+
return formatLabelledValues({
|
171692
|
+
// explicitly not outputting Deployment ID
|
171693
|
+
Created: new Date(deployment.created_on).toISOString(),
|
171694
|
+
Author: deployment.author_email,
|
171695
|
+
Source: getDeploymentSource(deployment),
|
171696
|
+
Message: deployment.annotations?.["workers/message"] || BLANK_INPUT3,
|
171697
|
+
"Version(s)": formattedVersions.join("\n\n")
|
171698
|
+
});
|
171699
|
+
});
|
171700
|
+
logRaw(formattedDeployments.join("\n\n"));
|
171701
|
+
}, "versionsDeploymentsListHandler")
|
171702
|
+
});
|
171703
|
+
function getDeploymentSource(deployment) {
|
171704
|
+
return getVersionSource({
|
171705
|
+
metadata: { source: deployment.source },
|
171706
|
+
annotations: deployment.annotations
|
171625
171707
|
});
|
171626
171708
|
}
|
171627
|
-
__name(
|
171628
|
-
|
171629
|
-
|
171630
|
-
|
171631
|
-
|
171632
|
-
|
171633
|
-
|
171634
|
-
|
171635
|
-
|
171636
|
-
|
171637
|
-
|
171709
|
+
__name(getDeploymentSource, "getDeploymentSource");
|
171710
|
+
|
171711
|
+
// src/versions/deployments/status.ts
|
171712
|
+
init_import_meta_url();
|
171713
|
+
var import_assert5 = __toESM(require("assert"));
|
171714
|
+
var BLANK_INPUT4 = "-";
|
171715
|
+
var deploymentsStatusCommand = createCommand({
|
171716
|
+
metadata: {
|
171717
|
+
description: "View the current state of your production",
|
171718
|
+
owner: "Workers: Authoring and Testing",
|
171719
|
+
status: "stable"
|
171720
|
+
},
|
171721
|
+
args: {
|
171722
|
+
name: {
|
171723
|
+
describe: "Name of the Worker",
|
171724
|
+
type: "string",
|
171725
|
+
requiresArg: true
|
171726
|
+
},
|
171727
|
+
json: {
|
171728
|
+
describe: "Display output as clean JSON",
|
171729
|
+
type: "boolean",
|
171730
|
+
default: false
|
171638
171731
|
}
|
171639
|
-
|
171640
|
-
|
171641
|
-
|
171642
|
-
|
171643
|
-
|
171644
|
-
|
171732
|
+
},
|
171733
|
+
behaviour: {
|
171734
|
+
printBanner: false
|
171735
|
+
},
|
171736
|
+
handler: /* @__PURE__ */ __name(async function versionsDeploymentsStatusHandler(args, { config }) {
|
171737
|
+
if (!args.json) {
|
171738
|
+
await printWranglerBanner();
|
171739
|
+
}
|
171740
|
+
sendMetricsEvent(
|
171741
|
+
"view latest versioned deployment",
|
171742
|
+
{},
|
171743
|
+
{
|
171744
|
+
sendMetrics: config.send_metrics
|
171745
|
+
}
|
171645
171746
|
);
|
171646
|
-
|
171647
|
-
|
171648
|
-
|
171649
|
-
|
171650
|
-
|
171651
|
-
|
171652
|
-
|
171653
|
-
|
171654
|
-
|
171655
|
-
|
171656
|
-
|
171657
|
-
|
171658
|
-
|
171747
|
+
const accountId = await requireAuth(config);
|
171748
|
+
const workerName = args.name ?? config.name;
|
171749
|
+
if (workerName === void 0) {
|
171750
|
+
throw new UserError(
|
171751
|
+
'You need to provide a name for your Worker. Either pass it as a cli arg with `--name <name>` or in your configuration file as `name = "<name>"`'
|
171752
|
+
);
|
171753
|
+
}
|
171754
|
+
const latestDeployment = await fetchLatestDeployment(accountId, workerName);
|
171755
|
+
if (!latestDeployment) {
|
171756
|
+
throw new UserError(`The Worker ${workerName} has no deployments.`);
|
171757
|
+
}
|
171758
|
+
if (args.json) {
|
171759
|
+
logRaw(JSON.stringify(latestDeployment, null, 2));
|
171760
|
+
return;
|
171761
|
+
}
|
171762
|
+
const versionCache = /* @__PURE__ */ new Map();
|
171763
|
+
const versionIds = latestDeployment.versions.map((v2) => v2.version_id);
|
171764
|
+
await fetchVersions(accountId, workerName, versionCache, ...versionIds);
|
171765
|
+
const formattedVersions = latestDeployment.versions.map((traffic) => {
|
171659
171766
|
const version4 = versionCache.get(traffic.version_id);
|
171660
|
-
(0,
|
171767
|
+
(0, import_assert5.default)(version4);
|
171661
171768
|
const percentage = brandColor(`(${traffic.percentage}%)`);
|
171662
171769
|
const details = formatLabelledValues(
|
171663
171770
|
{
|
171664
171771
|
Created: new Date(version4.metadata["created_on"]).toISOString(),
|
171665
|
-
Tag: version4.annotations?.["workers/tag"] ||
|
171666
|
-
Message: version4.annotations?.["workers/message"] ||
|
171772
|
+
Tag: version4.annotations?.["workers/tag"] || BLANK_INPUT4,
|
171773
|
+
Message: version4.annotations?.["workers/message"] || BLANK_INPUT4
|
171667
171774
|
},
|
171668
171775
|
{
|
171669
171776
|
indentationCount: 4,
|
@@ -171675,261 +171782,160 @@ async function versionsDeploymentsListHandler(args) {
|
|
171675
171782
|
return `${percentage} ${version4.id}
|
171676
171783
|
${details}`;
|
171677
171784
|
});
|
171678
|
-
|
171785
|
+
const formattedDeployment = formatLabelledValues({
|
171679
171786
|
// explicitly not outputting Deployment ID
|
171680
|
-
Created: new Date(
|
171681
|
-
Author:
|
171682
|
-
Source: getDeploymentSource(
|
171683
|
-
Message:
|
171787
|
+
Created: new Date(latestDeployment.created_on).toISOString(),
|
171788
|
+
Author: latestDeployment.author_email,
|
171789
|
+
Source: getDeploymentSource(latestDeployment),
|
171790
|
+
Message: latestDeployment.annotations?.["workers/message"] || BLANK_INPUT4,
|
171684
171791
|
"Version(s)": formattedVersions.join("\n\n")
|
171685
171792
|
});
|
171686
|
-
|
171687
|
-
|
171688
|
-
}
|
171689
|
-
__name(versionsDeploymentsListHandler, "versionsDeploymentsListHandler");
|
171690
|
-
function getDeploymentSource(deployment) {
|
171691
|
-
return getVersionSource({
|
171692
|
-
metadata: { source: deployment.source },
|
171693
|
-
annotations: deployment.annotations
|
171694
|
-
});
|
171695
|
-
}
|
171696
|
-
__name(getDeploymentSource, "getDeploymentSource");
|
171697
|
-
|
171698
|
-
// src/versions/deployments/status.ts
|
171699
|
-
init_import_meta_url();
|
171700
|
-
var import_assert5 = __toESM(require("assert"));
|
171701
|
-
var BLANK_INPUT4 = "-";
|
171702
|
-
function versionsDeploymentsStatusOptions(yargs) {
|
171703
|
-
return yargs.option("name", {
|
171704
|
-
describe: "Name of the worker",
|
171705
|
-
type: "string",
|
171706
|
-
requiresArg: true
|
171707
|
-
}).option("json", {
|
171708
|
-
describe: "Display output as clean JSON",
|
171709
|
-
type: "boolean",
|
171710
|
-
default: false
|
171711
|
-
});
|
171712
|
-
}
|
171713
|
-
__name(versionsDeploymentsStatusOptions, "versionsDeploymentsStatusOptions");
|
171714
|
-
async function versionsDeploymentsStatusHandler(args) {
|
171715
|
-
if (!args.json) {
|
171716
|
-
await printWranglerBanner();
|
171717
|
-
}
|
171718
|
-
const config = readConfig(args);
|
171719
|
-
sendMetricsEvent(
|
171720
|
-
"view latest versioned deployment",
|
171721
|
-
{},
|
171722
|
-
{
|
171723
|
-
sendMetrics: config.send_metrics
|
171724
|
-
}
|
171725
|
-
);
|
171726
|
-
const accountId = await requireAuth(config);
|
171727
|
-
const workerName = args.name ?? config.name;
|
171728
|
-
if (workerName === void 0) {
|
171729
|
-
throw new UserError(
|
171730
|
-
'You need to provide a name of your worker. Either pass it as a cli arg with `--name <name>` or in your config file as `name = "<name>"`'
|
171731
|
-
);
|
171732
|
-
}
|
171733
|
-
const latestDeployment = await fetchLatestDeployment(accountId, workerName);
|
171734
|
-
if (!latestDeployment) {
|
171735
|
-
throw new UserError(`The worker ${workerName} has no deployments.`);
|
171736
|
-
}
|
171737
|
-
if (args.json) {
|
171738
|
-
logRaw(JSON.stringify(latestDeployment, null, 2));
|
171739
|
-
return;
|
171740
|
-
}
|
171741
|
-
const versionCache = /* @__PURE__ */ new Map();
|
171742
|
-
const versionIds = latestDeployment.versions.map((v2) => v2.version_id);
|
171743
|
-
await fetchVersions(accountId, workerName, versionCache, ...versionIds);
|
171744
|
-
const formattedVersions = latestDeployment.versions.map((traffic) => {
|
171745
|
-
const version4 = versionCache.get(traffic.version_id);
|
171746
|
-
(0, import_assert5.default)(version4);
|
171747
|
-
const percentage = brandColor(`(${traffic.percentage}%)`);
|
171748
|
-
const details = formatLabelledValues(
|
171749
|
-
{
|
171750
|
-
Created: new Date(version4.metadata["created_on"]).toISOString(),
|
171751
|
-
Tag: version4.annotations?.["workers/tag"] || BLANK_INPUT4,
|
171752
|
-
Message: version4.annotations?.["workers/message"] || BLANK_INPUT4
|
171753
|
-
},
|
171754
|
-
{
|
171755
|
-
indentationCount: 4,
|
171756
|
-
labelJustification: "right",
|
171757
|
-
formatLabel: (label) => gray(label + ":"),
|
171758
|
-
formatValue: (value) => gray(value)
|
171759
|
-
}
|
171760
|
-
);
|
171761
|
-
return `${percentage} ${version4.id}
|
171762
|
-
${details}`;
|
171763
|
-
});
|
171764
|
-
const formattedDeployment = formatLabelledValues({
|
171765
|
-
// explicitly not outputting Deployment ID
|
171766
|
-
Created: new Date(latestDeployment.created_on).toISOString(),
|
171767
|
-
Author: latestDeployment.author_email,
|
171768
|
-
Source: getDeploymentSource(latestDeployment),
|
171769
|
-
Message: latestDeployment.annotations?.["workers/message"] || BLANK_INPUT4,
|
171770
|
-
"Version(s)": formattedVersions.join("\n\n")
|
171771
|
-
});
|
171772
|
-
logRaw(formattedDeployment);
|
171773
|
-
}
|
171774
|
-
__name(versionsDeploymentsStatusHandler, "versionsDeploymentsStatusHandler");
|
171793
|
+
logRaw(formattedDeployment);
|
171794
|
+
}, "versionsDeploymentsStatusHandler")
|
171795
|
+
});
|
171775
171796
|
|
171776
171797
|
// src/versions/deployments/view.ts
|
171777
171798
|
init_import_meta_url();
|
171778
|
-
|
171779
|
-
|
171780
|
-
|
171781
|
-
|
171782
|
-
|
171783
|
-
|
171784
|
-
|
171785
|
-
|
171786
|
-
|
171787
|
-
|
171788
|
-
|
171789
|
-
|
171790
|
-
|
171791
|
-
|
171792
|
-
|
171793
|
-
|
171794
|
-
|
171795
|
-
|
171796
|
-
}
|
171797
|
-
|
171798
|
-
|
171799
|
-
)
|
171800
|
-
|
171801
|
-
|
171802
|
-
|
171803
|
-
|
171804
|
-
|
171805
|
-
|
171806
|
-
|
171807
|
-
|
171808
|
-
|
171809
|
-
|
171810
|
-
versionsDeploymentsListHandler
|
171811
|
-
).command(
|
171812
|
-
"status",
|
171813
|
-
"View the current state of your production",
|
171814
|
-
versionsDeploymentsStatusOptions,
|
171815
|
-
versionsDeploymentsStatusHandler
|
171816
|
-
).command(
|
171817
|
-
"view [deployment-id]",
|
171818
|
-
false,
|
171819
|
-
versionsDeploymentsViewOptions,
|
171820
|
-
versionsDeploymentsViewHandler
|
171821
|
-
);
|
171822
|
-
}
|
171823
|
-
__name(registerVersionsDeploymentsSubcommands, "registerVersionsDeploymentsSubcommands");
|
171799
|
+
var deploymentsViewCommand = createCommand({
|
171800
|
+
metadata: {
|
171801
|
+
description: "View a deployment of a Worker",
|
171802
|
+
owner: "Workers: Authoring and Testing",
|
171803
|
+
status: "stable",
|
171804
|
+
hidden: true
|
171805
|
+
},
|
171806
|
+
args: {
|
171807
|
+
name: {
|
171808
|
+
describe: "Name of the Worker",
|
171809
|
+
type: "string",
|
171810
|
+
requiresArg: true
|
171811
|
+
},
|
171812
|
+
["deployment-id"]: {
|
171813
|
+
describe: "Deprecated. Deployment ID is now referred to as Version ID. Please use `wrangler versions view [version-id]` instead.",
|
171814
|
+
type: "string",
|
171815
|
+
requiresArg: true
|
171816
|
+
}
|
171817
|
+
},
|
171818
|
+
positionalArgs: ["deployment-id"],
|
171819
|
+
handler: /* @__PURE__ */ __name(async function versionsDeploymentsViewHandler(args) {
|
171820
|
+
if (args.deploymentId === void 0) {
|
171821
|
+
throw new UserError(
|
171822
|
+
"`wrangler deployments view` has been renamed `wrangler deployments status`. Please use that command instead."
|
171823
|
+
);
|
171824
|
+
} else {
|
171825
|
+
throw new UserError(
|
171826
|
+
"`wrangler deployments view <deployment-id>` has been renamed `wrangler versions view [version-id]`. Please use that command instead."
|
171827
|
+
);
|
171828
|
+
}
|
171829
|
+
}, "versionsDeploymentsViewHandler")
|
171830
|
+
});
|
171824
171831
|
|
171825
171832
|
// src/versions/rollback/index.ts
|
171826
171833
|
init_import_meta_url();
|
171827
171834
|
var CANNOT_ROLLBACK_WITH_MODIFIED_SECERT_CODE = 10220;
|
171828
|
-
|
171829
|
-
|
171830
|
-
"
|
171831
|
-
|
171832
|
-
|
171833
|
-
|
171834
|
-
|
171835
|
-
|
171836
|
-
|
171837
|
-
|
171838
|
-
|
171839
|
-
|
171840
|
-
|
171841
|
-
|
171842
|
-
|
171843
|
-
|
171844
|
-
|
171845
|
-
|
171846
|
-
|
171847
|
-
|
171848
|
-
|
171849
|
-
|
171850
|
-
}).option("yes", {
|
171851
|
-
alias: "y",
|
171852
|
-
describe: "Automatically accept defaults to prompts",
|
171853
|
-
type: "boolean",
|
171854
|
-
default: false
|
171855
|
-
});
|
171856
|
-
}
|
171857
|
-
__name(versionsRollbackOptions, "versionsRollbackOptions");
|
171858
|
-
async function versionsRollbackHandler(args) {
|
171859
|
-
const config = readConfig(args);
|
171860
|
-
const accountId = await requireAuth(config);
|
171861
|
-
const workerName = args.name ?? config.name;
|
171862
|
-
if (workerName === void 0) {
|
171863
|
-
throw new UserError(
|
171864
|
-
'You need to provide a name of your worker. Either pass it as a cli arg with `--name <name>` or in your config file as `name = "<name>"`'
|
171865
|
-
);
|
171866
|
-
}
|
171867
|
-
await printLatestDeployment(accountId, workerName, /* @__PURE__ */ new Map());
|
171868
|
-
const versionId = args.versionId ?? await spinnerWhile({
|
171869
|
-
promise: fetchDefaultRollbackVersionId(accountId, workerName),
|
171870
|
-
startMessage: "Finding latest stable Worker Version to rollback to",
|
171871
|
-
endMessage: ""
|
171872
|
-
});
|
171873
|
-
const message = await prompt(
|
171874
|
-
"Please provide an optional message for this rollback (120 characters max)",
|
171875
|
-
{
|
171876
|
-
defaultValue: args.message ?? "Rollback"
|
171835
|
+
var versionsRollbackCommand = createCommand({
|
171836
|
+
args: {
|
171837
|
+
"version-id": {
|
171838
|
+
describe: "The ID of the Worker Version to rollback to",
|
171839
|
+
type: "string",
|
171840
|
+
demandOption: false
|
171841
|
+
},
|
171842
|
+
name: {
|
171843
|
+
describe: "The name of your Worker",
|
171844
|
+
type: "string"
|
171845
|
+
},
|
171846
|
+
message: {
|
171847
|
+
alias: "m",
|
171848
|
+
describe: "The reason for this rollback",
|
171849
|
+
type: "string",
|
171850
|
+
default: void 0
|
171851
|
+
},
|
171852
|
+
yes: {
|
171853
|
+
alias: "y",
|
171854
|
+
describe: "Automatically accept defaults to prompts",
|
171855
|
+
type: "boolean",
|
171856
|
+
default: false
|
171877
171857
|
}
|
171878
|
-
|
171879
|
-
|
171880
|
-
|
171881
|
-
|
171858
|
+
},
|
171859
|
+
positionalArgs: ["version-id"],
|
171860
|
+
metadata: {
|
171861
|
+
description: "\u{1F519} Rollback a deployment for a Worker",
|
171862
|
+
owner: "Workers: Authoring and Testing",
|
171863
|
+
status: "stable"
|
171864
|
+
},
|
171865
|
+
handler: /* @__PURE__ */ __name(async function handleRollback(args, { config }) {
|
171866
|
+
const accountId = await requireAuth(config);
|
171867
|
+
const workerName = args.name ?? config.name;
|
171868
|
+
if (workerName === void 0) {
|
171869
|
+
throw new UserError(
|
171870
|
+
'You need to provide a name for your Worker. Either pass it as a cli arg with `--name <name>` or in your configuration file as `name = "<name>"`'
|
171871
|
+
);
|
171872
|
+
}
|
171873
|
+
await printLatestDeployment(accountId, workerName, /* @__PURE__ */ new Map());
|
171874
|
+
const versionId = args.versionId ?? await spinnerWhile({
|
171875
|
+
promise: fetchDefaultRollbackVersionId(accountId, workerName),
|
171876
|
+
startMessage: "Finding latest stable Worker Version to rollback to",
|
171877
|
+
endMessage: ""
|
171878
|
+
});
|
171879
|
+
const message = await prompt(
|
171880
|
+
"Please provide an optional message for this rollback (120 characters max)",
|
171881
|
+
{
|
171882
|
+
defaultValue: args.message ?? "Rollback"
|
171883
|
+
}
|
171884
|
+
);
|
171885
|
+
const version4 = await fetchVersion(accountId, workerName, versionId);
|
171886
|
+
warn(
|
171887
|
+
`You are about to rollback to Worker Version ${versionId}.
|
171882
171888
|
This will immediately replace the current deployment and become the active deployment across all your deployed triggers.
|
171883
171889
|
However, your local development environment will not be affected by this rollback.
|
171884
171890
|
Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc).`,
|
171885
|
-
|
171886
|
-
|
171887
|
-
|
171888
|
-
|
171889
|
-
|
171890
|
-
|
171891
|
-
|
171892
|
-
|
171893
|
-
|
171894
|
-
|
171895
|
-
|
171896
|
-
|
171897
|
-
|
171898
|
-
|
171899
|
-
|
171900
|
-
|
171901
|
-
|
171902
|
-
|
171903
|
-
|
171904
|
-
|
171905
|
-
|
171906
|
-
|
171907
|
-
|
171908
|
-
|
171909
|
-
|
171891
|
+
{ multiline: true, shape: shapes.leftT }
|
171892
|
+
);
|
171893
|
+
const rollbackTraffic = /* @__PURE__ */ new Map([[versionId, 100]]);
|
171894
|
+
printVersions([version4], rollbackTraffic);
|
171895
|
+
const confirmed = await confirm(
|
171896
|
+
"Are you sure you want to deploy this Worker Version to 100% of traffic?",
|
171897
|
+
{ defaultValue: true }
|
171898
|
+
);
|
171899
|
+
if (!confirmed) {
|
171900
|
+
cancel("Aborting rollback...");
|
171901
|
+
return;
|
171902
|
+
}
|
171903
|
+
logger.log("Performing rollback...");
|
171904
|
+
try {
|
171905
|
+
await createDeployment(accountId, workerName, rollbackTraffic, message);
|
171906
|
+
} catch (e3) {
|
171907
|
+
if (e3 instanceof APIError && e3.code === CANNOT_ROLLBACK_WITH_MODIFIED_SECERT_CODE) {
|
171908
|
+
const errorMsg = e3.notes[0].text.replace(
|
171909
|
+
` [code: ${CANNOT_ROLLBACK_WITH_MODIFIED_SECERT_CODE}]`,
|
171910
|
+
""
|
171911
|
+
);
|
171912
|
+
const targetString = "The following secrets have changed:";
|
171913
|
+
const changedSecrets = errorMsg.substring(errorMsg.indexOf(targetString) + targetString.length + 1).split(", ");
|
171914
|
+
const secretConfirmation = await confirm(
|
171915
|
+
`The following secrets have changed since version ${versionId} was deployed. Please confirm you wish to continue with the rollback
|
171910
171916
|
` + changedSecrets.map((secret3) => ` * ${secret3}`).join("\n")
|
171911
|
-
);
|
171912
|
-
if (secretConfirmation) {
|
171913
|
-
await createDeployment(
|
171914
|
-
accountId,
|
171915
|
-
workerName,
|
171916
|
-
rollbackTraffic,
|
171917
|
-
message,
|
171918
|
-
true
|
171919
171917
|
);
|
171918
|
+
if (secretConfirmation) {
|
171919
|
+
await createDeployment(
|
171920
|
+
accountId,
|
171921
|
+
workerName,
|
171922
|
+
rollbackTraffic,
|
171923
|
+
message,
|
171924
|
+
true
|
171925
|
+
);
|
171926
|
+
} else {
|
171927
|
+
cancel("Aborting rollback...");
|
171928
|
+
}
|
171920
171929
|
} else {
|
171921
|
-
|
171930
|
+
throw e3;
|
171922
171931
|
}
|
171923
|
-
} else {
|
171924
|
-
throw e3;
|
171925
171932
|
}
|
171926
|
-
|
171927
|
-
|
171928
|
-
|
171929
|
-
|
171930
|
-
|
171931
|
-
}
|
171932
|
-
__name(versionsRollbackHandler, "versionsRollbackHandler");
|
171933
|
+
success(
|
171934
|
+
`Worker Version ${versionId} has been deployed to 100% of traffic.`
|
171935
|
+
);
|
171936
|
+
logger.log("\nCurrent Version ID: " + versionId);
|
171937
|
+
}, "handleRollback")
|
171938
|
+
});
|
171933
171939
|
async function fetchDefaultRollbackVersionId(accountId, workerName) {
|
171934
171940
|
const deployments2 = await fetchLatestDeployments(accountId, workerName);
|
171935
171941
|
deployments2.sort((a, b2) => b2.created_on.localeCompare(a.created_on));
|
@@ -175107,17 +175113,27 @@ function createCLIParser(argv) {
|
|
175107
175113
|
deployOptions,
|
175108
175114
|
deployHandler
|
175109
175115
|
);
|
175110
|
-
const deploymentsDescription = "\u{1F6A2} List and view the current and past deployments for your Worker";
|
175111
175116
|
if (experimentalGradualRollouts) {
|
175112
|
-
|
175113
|
-
"deployments",
|
175114
|
-
|
175115
|
-
|
175116
|
-
|
175117
|
+
registry.define([
|
175118
|
+
{ command: "wrangler deployments", definition: deploymentsNamespace },
|
175119
|
+
{
|
175120
|
+
command: "wrangler deployments list",
|
175121
|
+
definition: deploymentsListCommand
|
175122
|
+
},
|
175123
|
+
{
|
175124
|
+
command: "wrangler deployments status",
|
175125
|
+
definition: deploymentsStatusCommand
|
175126
|
+
},
|
175127
|
+
{
|
175128
|
+
command: "wrangler deployments view",
|
175129
|
+
definition: deploymentsViewCommand
|
175130
|
+
}
|
175131
|
+
]);
|
175132
|
+
registry.registerNamespace("deployments");
|
175117
175133
|
} else {
|
175118
175134
|
wrangler.command(
|
175119
175135
|
"deployments",
|
175120
|
-
|
175136
|
+
"\u{1F6A2} List and view the current and past deployments for your Worker",
|
175121
175137
|
(yargs) => yargs.option("name", {
|
175122
175138
|
describe: "The name of your Worker",
|
175123
175139
|
type: "string"
|
@@ -175151,7 +175167,10 @@ function createCLIParser(argv) {
|
|
175151
175167
|
}
|
175152
175168
|
const rollbackDescription = "\u{1F519} Rollback a deployment for a Worker";
|
175153
175169
|
if (experimentalGradualRollouts) {
|
175154
|
-
|
175170
|
+
registry.define([
|
175171
|
+
{ command: "wrangler rollback", definition: versionsRollbackCommand }
|
175172
|
+
]);
|
175173
|
+
registry.registerNamespace("rollback");
|
175155
175174
|
} else {
|
175156
175175
|
wrangler.command(
|
175157
175176
|
"rollback [deployment-id]",
|
@@ -177338,18 +177357,18 @@ init_import_meta_url();
|
|
177338
177357
|
|
177339
177358
|
// src/cli-hotkeys.ts
|
177340
177359
|
init_import_meta_url();
|
177341
|
-
var
|
177360
|
+
var import_readline = __toESM(require("readline"));
|
177342
177361
|
var import_miniflare21 = require("miniflare");
|
177343
177362
|
|
177344
177363
|
// src/utils/onKeyPress.ts
|
177345
177364
|
init_import_meta_url();
|
177346
|
-
var
|
177365
|
+
var import_node_readline7 = __toESM(require("node:readline"));
|
177347
177366
|
var import_stream4 = require("stream");
|
177348
177367
|
function onKeyPress(callback) {
|
177349
177368
|
const stream2 = new import_stream4.PassThrough();
|
177350
177369
|
process.stdin.pipe(stream2);
|
177351
177370
|
if (isInteractive2()) {
|
177352
|
-
|
177371
|
+
import_node_readline7.default.emitKeypressEvents(stream2);
|
177353
177372
|
process.stdin.setRawMode(true);
|
177354
177373
|
}
|
177355
177374
|
const handler30 = /* @__PURE__ */ __name(async (_char, key) => {
|
@@ -177388,16 +177407,20 @@ function cli_hotkeys_default(options30) {
|
|
177388
177407
|
}
|
177389
177408
|
__name(formatInstructions, "formatInstructions");
|
177390
177409
|
const unregisterKeyPress = onKeyPress(async (key) => {
|
177391
|
-
|
177392
|
-
if (key
|
177393
|
-
|
177410
|
+
const entries = [];
|
177411
|
+
if (key.name) {
|
177412
|
+
entries.push(key.name.toLowerCase());
|
177413
|
+
}
|
177414
|
+
if (key.meta) {
|
177415
|
+
entries.unshift("meta");
|
177394
177416
|
}
|
177395
|
-
if (key
|
177396
|
-
|
177417
|
+
if (key.ctrl) {
|
177418
|
+
entries.unshift("ctrl");
|
177397
177419
|
}
|
177398
|
-
if (key
|
177399
|
-
|
177420
|
+
if (key.shift) {
|
177421
|
+
entries.unshift("shift");
|
177400
177422
|
}
|
177423
|
+
const char = entries.join("+");
|
177401
177424
|
for (const { keys, handler: handler30, disabled } of options30) {
|
177402
177425
|
if (unwrapHook(disabled)) {
|
177403
177426
|
continue;
|
@@ -177414,8 +177437,8 @@ function cli_hotkeys_default(options30) {
|
|
177414
177437
|
let previousInstructionsLineCount = 0;
|
177415
177438
|
function clearPreviousInstructions() {
|
177416
177439
|
if (previousInstructionsLineCount) {
|
177417
|
-
|
177418
|
-
|
177440
|
+
import_readline.default.moveCursor(process.stdout, 0, -previousInstructionsLineCount);
|
177441
|
+
import_readline.default.clearScreenDown(process.stdout);
|
177419
177442
|
}
|
177420
177443
|
}
|
177421
177444
|
__name(clearPreviousInstructions, "clearPreviousInstructions");
|
@@ -178245,7 +178268,7 @@ function getResolvedLegacyAssetPaths(args, configParam) {
|
|
178245
178268
|
return legacyAssetPaths;
|
178246
178269
|
}
|
178247
178270
|
__name(getResolvedLegacyAssetPaths, "getResolvedLegacyAssetPaths");
|
178248
|
-
function getBindings2(configParam,
|
178271
|
+
function getBindings2(configParam, env5, local, args) {
|
178249
178272
|
const kvConfig = (configParam.kv_namespaces || []).map(
|
178250
178273
|
({ binding, preview_id, id }) => {
|
178251
178274
|
if (!preview_id && !local) {
|
@@ -178340,7 +178363,7 @@ function getBindings2(configParam, env6, local, args) {
|
|
178340
178363
|
// non-inheritable fields
|
178341
178364
|
vars: {
|
178342
178365
|
// Use a copy of combinedVars since we're modifying it later
|
178343
|
-
...getVarsForDev(configParam,
|
178366
|
+
...getVarsForDev(configParam, env5),
|
178344
178367
|
...args.vars
|
178345
178368
|
},
|
178346
178369
|
durable_objects: {
|
@@ -180356,10 +180379,10 @@ __name(maybeGetRegisteredWorkers, "maybeGetRegisteredWorkers");
|
|
180356
180379
|
|
180357
180380
|
// src/api/integrations/platform/index.ts
|
180358
180381
|
async function getPlatformProxy(options30 = {}) {
|
180359
|
-
const
|
180382
|
+
const env5 = options30.environment;
|
180360
180383
|
const rawConfig = readConfig({
|
180361
180384
|
config: options30.configPath,
|
180362
|
-
env:
|
180385
|
+
env: env5
|
180363
180386
|
});
|
180364
180387
|
const miniflareOptions = await run(
|
180365
180388
|
{
|
@@ -180367,7 +180390,7 @@ async function getPlatformProxy(options30 = {}) {
|
|
180367
180390
|
MULTIWORKER: false,
|
180368
180391
|
RESOURCES_PROVISION: false
|
180369
180392
|
},
|
180370
|
-
() => getMiniflareOptionsFromConfig(rawConfig,
|
180393
|
+
() => getMiniflareOptionsFromConfig(rawConfig, env5, options30)
|
180371
180394
|
);
|
180372
180395
|
const mf = new import_miniflare25.Miniflare({
|
180373
180396
|
script: "",
|
@@ -180375,7 +180398,7 @@ async function getPlatformProxy(options30 = {}) {
|
|
180375
180398
|
...miniflareOptions
|
180376
180399
|
});
|
180377
180400
|
const bindings = await mf.getBindings();
|
180378
|
-
const vars = getVarsForDev(rawConfig,
|
180401
|
+
const vars = getVarsForDev(rawConfig, env5);
|
180379
180402
|
const cf = await mf.getCf();
|
180380
180403
|
deepFreeze(cf);
|
180381
180404
|
return {
|
@@ -180390,8 +180413,8 @@ async function getPlatformProxy(options30 = {}) {
|
|
180390
180413
|
};
|
180391
180414
|
}
|
180392
180415
|
__name(getPlatformProxy, "getPlatformProxy");
|
180393
|
-
async function getMiniflareOptionsFromConfig(rawConfig,
|
180394
|
-
const bindings = getBindings2(rawConfig,
|
180416
|
+
async function getMiniflareOptionsFromConfig(rawConfig, env5, options30) {
|
180417
|
+
const bindings = getBindings2(rawConfig, env5, true, {});
|
180395
180418
|
const workerDefinitions = await getBoundRegisteredWorkers({
|
180396
180419
|
name: rawConfig.name,
|
180397
180420
|
services: bindings.services,
|
@@ -180456,14 +180479,14 @@ function deepFreeze(obj) {
|
|
180456
180479
|
});
|
180457
180480
|
}
|
180458
180481
|
__name(deepFreeze, "deepFreeze");
|
180459
|
-
function unstable_getMiniflareWorkerOptions(configOrConfigPath,
|
180460
|
-
const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env:
|
180482
|
+
function unstable_getMiniflareWorkerOptions(configOrConfigPath, env5) {
|
180483
|
+
const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env: env5 }) : configOrConfigPath;
|
180461
180484
|
const modulesRules = config.rules.concat(DEFAULT_MODULE_RULES).map((rule) => ({
|
180462
180485
|
type: rule.type,
|
180463
180486
|
include: rule.globs,
|
180464
180487
|
fallthrough: rule.fallthrough
|
180465
180488
|
}));
|
180466
|
-
const bindings = getBindings2(config,
|
180489
|
+
const bindings = getBindings2(config, env5, true, {});
|
180467
180490
|
const { bindingOptions } = buildMiniflareBindingOptions({
|
180468
180491
|
name: void 0,
|
180469
180492
|
bindings,
|
@@ -180519,9 +180542,9 @@ init_import_meta_url();
|
|
180519
180542
|
// src/api/integrations/deprecated/getBindingsProxy.ts
|
180520
180543
|
init_import_meta_url();
|
180521
180544
|
async function getBindingsProxy(options30 = {}) {
|
180522
|
-
const { env:
|
180545
|
+
const { env: env5, ...restOfPlatformProxy } = await getPlatformProxy(options30);
|
180523
180546
|
return {
|
180524
|
-
bindings:
|
180547
|
+
bindings: env5,
|
180525
180548
|
...restOfPlatformProxy
|
180526
180549
|
};
|
180527
180550
|
}
|
@@ -181087,4 +181110,3 @@ yargs-parser/build/lib/index.js:
|
|
181087
181110
|
* SPDX-License-Identifier: ISC
|
181088
181111
|
*)
|
181089
181112
|
*/
|
181090
|
-
//# sourceMappingURL=cli.js.map
|