wrangler 4.0.0 → 4.2.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 +15 -28
- package/package.json +7 -7
- package/wrangler-dist/cli.d.ts +12 -14
- package/wrangler-dist/cli.js +532 -254
- package/wrangler-dist/cli.js.map +7 -0
package/wrangler-dist/cli.js
CHANGED
@@ -15588,8 +15588,8 @@ var require_util6 = __commonJS({
|
|
15588
15588
|
}
|
15589
15589
|
}
|
15590
15590
|
__name(validateCookiePath, "validateCookiePath");
|
15591
|
-
function validateCookieDomain(
|
15592
|
-
if (
|
15591
|
+
function validateCookieDomain(domain4) {
|
15592
|
+
if (domain4.startsWith("-") || domain4.endsWith(".") || domain4.endsWith("-")) {
|
15593
15593
|
throw new Error("Invalid cookie domain");
|
15594
15594
|
}
|
15595
15595
|
}
|
@@ -29673,18 +29673,18 @@ var require_async = __commonJS({
|
|
29673
29673
|
];
|
29674
29674
|
}, "defaultPaths");
|
29675
29675
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb2) {
|
29676
|
-
fs23.stat(file, function(err,
|
29676
|
+
fs23.stat(file, function(err, stat9) {
|
29677
29677
|
if (!err) {
|
29678
|
-
return cb2(null,
|
29678
|
+
return cb2(null, stat9.isFile() || stat9.isFIFO());
|
29679
29679
|
}
|
29680
29680
|
if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb2(null, false);
|
29681
29681
|
return cb2(err);
|
29682
29682
|
});
|
29683
29683
|
}, "isFile");
|
29684
29684
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb2) {
|
29685
|
-
fs23.stat(dir, function(err,
|
29685
|
+
fs23.stat(dir, function(err, stat9) {
|
29686
29686
|
if (!err) {
|
29687
|
-
return cb2(null,
|
29687
|
+
return cb2(null, stat9.isDirectory());
|
29688
29688
|
}
|
29689
29689
|
if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb2(null, false);
|
29690
29690
|
return cb2(err);
|
@@ -30176,21 +30176,21 @@ var require_sync = __commonJS({
|
|
30176
30176
|
}, "defaultPaths");
|
30177
30177
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
|
30178
30178
|
try {
|
30179
|
-
var
|
30179
|
+
var stat9 = fs23.statSync(file, { throwIfNoEntry: false });
|
30180
30180
|
} catch (e7) {
|
30181
30181
|
if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR")) return false;
|
30182
30182
|
throw e7;
|
30183
30183
|
}
|
30184
|
-
return !!
|
30184
|
+
return !!stat9 && (stat9.isFile() || stat9.isFIFO());
|
30185
30185
|
}, "isFile");
|
30186
30186
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
|
30187
30187
|
try {
|
30188
|
-
var
|
30188
|
+
var stat9 = fs23.statSync(dir, { throwIfNoEntry: false });
|
30189
30189
|
} catch (e7) {
|
30190
30190
|
if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR")) return false;
|
30191
30191
|
throw e7;
|
30192
30192
|
}
|
30193
|
-
return !!
|
30193
|
+
return !!stat9 && stat9.isDirectory();
|
30194
30194
|
}, "isDirectory");
|
30195
30195
|
var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync4(x6) {
|
30196
30196
|
try {
|
@@ -53578,16 +53578,16 @@ var require_windows = __commonJS({
|
|
53578
53578
|
return false;
|
53579
53579
|
}
|
53580
53580
|
__name(checkPathExt, "checkPathExt");
|
53581
|
-
function checkStat(
|
53582
|
-
if (!
|
53581
|
+
function checkStat(stat9, path69, options32) {
|
53582
|
+
if (!stat9.isSymbolicLink() && !stat9.isFile()) {
|
53583
53583
|
return false;
|
53584
53584
|
}
|
53585
53585
|
return checkPathExt(path69, options32);
|
53586
53586
|
}
|
53587
53587
|
__name(checkStat, "checkStat");
|
53588
53588
|
function isexe(path69, options32, cb2) {
|
53589
|
-
fs23.stat(path69, function(er,
|
53590
|
-
cb2(er, er ? false : checkStat(
|
53589
|
+
fs23.stat(path69, function(er, stat9) {
|
53590
|
+
cb2(er, er ? false : checkStat(stat9, path69, options32));
|
53591
53591
|
});
|
53592
53592
|
}
|
53593
53593
|
__name(isexe, "isexe");
|
@@ -53606,8 +53606,8 @@ var require_mode = __commonJS({
|
|
53606
53606
|
isexe.sync = sync;
|
53607
53607
|
var fs23 = require("fs");
|
53608
53608
|
function isexe(path69, options32, cb2) {
|
53609
|
-
fs23.stat(path69, function(er,
|
53610
|
-
cb2(er, er ? false : checkStat(
|
53609
|
+
fs23.stat(path69, function(er, stat9) {
|
53610
|
+
cb2(er, er ? false : checkStat(stat9, options32));
|
53611
53611
|
});
|
53612
53612
|
}
|
53613
53613
|
__name(isexe, "isexe");
|
@@ -53615,14 +53615,14 @@ var require_mode = __commonJS({
|
|
53615
53615
|
return checkStat(fs23.statSync(path69), options32);
|
53616
53616
|
}
|
53617
53617
|
__name(sync, "sync");
|
53618
|
-
function checkStat(
|
53619
|
-
return
|
53618
|
+
function checkStat(stat9, options32) {
|
53619
|
+
return stat9.isFile() && checkMode(stat9, options32);
|
53620
53620
|
}
|
53621
53621
|
__name(checkStat, "checkStat");
|
53622
|
-
function checkMode(
|
53623
|
-
var mod =
|
53624
|
-
var uid =
|
53625
|
-
var gid =
|
53622
|
+
function checkMode(stat9, options32) {
|
53623
|
+
var mod = stat9.mode;
|
53624
|
+
var uid = stat9.uid;
|
53625
|
+
var gid = stat9.gid;
|
53626
53626
|
var myUid = options32.uid !== void 0 ? options32.uid : process.getuid && process.getuid();
|
53627
53627
|
var myGid = options32.gid !== void 0 ? options32.gid : process.getgid && process.getgid();
|
53628
53628
|
var u5 = parseInt("100", 8);
|
@@ -56650,12 +56650,12 @@ function defaultOptions() {
|
|
56650
56650
|
highWaterMark: 4096
|
56651
56651
|
};
|
56652
56652
|
}
|
56653
|
-
var import_fs10,
|
56653
|
+
var import_fs10, import_promises24, import_stream3, import_path14, RECURSIVE_ERROR_CODE, NORMAL_FLOW_ERRORS, FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError, wantBigintFsStats, emptyFn, normalizeFilter, ReaddirpStream, readdirp;
|
56654
56654
|
var init_esm = __esm({
|
56655
56655
|
"../../node_modules/.pnpm/readdirp@4.0.1/node_modules/readdirp/esm/index.js"() {
|
56656
56656
|
init_import_meta_url();
|
56657
56657
|
import_fs10 = require("fs");
|
56658
|
-
|
56658
|
+
import_promises24 = require("fs/promises");
|
56659
56659
|
import_stream3 = require("stream");
|
56660
56660
|
import_path14 = require("path");
|
56661
56661
|
__name(defaultOptions, "defaultOptions");
|
@@ -56772,7 +56772,7 @@ var init_esm = __esm({
|
|
56772
56772
|
async _exploreDir(path69, depth) {
|
56773
56773
|
let files;
|
56774
56774
|
try {
|
56775
|
-
files = await (0,
|
56775
|
+
files = await (0, import_promises24.readdir)(path69, this._rdOptions);
|
56776
56776
|
} catch (error2) {
|
56777
56777
|
this._onError(error2);
|
56778
56778
|
}
|
@@ -56810,7 +56810,7 @@ var init_esm = __esm({
|
|
56810
56810
|
if (stats && stats.isSymbolicLink()) {
|
56811
56811
|
const full = entry.fullPath;
|
56812
56812
|
try {
|
56813
|
-
const entryRealPath = await (0,
|
56813
|
+
const entryRealPath = await (0, import_promises24.realpath)(full);
|
56814
56814
|
const entryRealPathStats = (0, import_fs10.lstatSync)(entryRealPath);
|
56815
56815
|
if (entryRealPathStats.isFile()) {
|
56816
56816
|
return "file";
|
@@ -56872,12 +56872,12 @@ function createFsWatchInstance(path69, options32, listener, errHandler, emitRaw)
|
|
56872
56872
|
return void 0;
|
56873
56873
|
}
|
56874
56874
|
}
|
56875
|
-
var import_fs11,
|
56875
|
+
var import_fs11, import_promises25, sysPath, import_os4, STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows2, isMacos, isLinux, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
|
56876
56876
|
var init_handler = __esm({
|
56877
56877
|
"../../node_modules/.pnpm/chokidar@4.0.1/node_modules/chokidar/esm/handler.js"() {
|
56878
56878
|
init_import_meta_url();
|
56879
56879
|
import_fs11 = require("fs");
|
56880
|
-
|
56880
|
+
import_promises25 = require("fs/promises");
|
56881
56881
|
sysPath = __toESM(require("path"), 1);
|
56882
56882
|
import_os4 = require("os");
|
56883
56883
|
STR_DATA = "data";
|
@@ -56903,7 +56903,7 @@ var init_handler = __esm({
|
|
56903
56903
|
};
|
56904
56904
|
EV = EVENTS;
|
56905
56905
|
THROTTLE_MODE_WATCH = "watch";
|
56906
|
-
statMethods = { lstat:
|
56906
|
+
statMethods = { lstat: import_promises25.lstat, stat: import_promises25.stat };
|
56907
56907
|
KEY_LISTENERS = "listeners";
|
56908
56908
|
KEY_ERR = "errHandlers";
|
56909
56909
|
KEY_RAW = "rawEmitters";
|
@@ -57244,7 +57244,7 @@ var init_handler = __esm({
|
|
57244
57244
|
cont.watcherUnusable = true;
|
57245
57245
|
if (isWindows2 && error2.code === "EPERM") {
|
57246
57246
|
try {
|
57247
|
-
const fd = await (0,
|
57247
|
+
const fd = await (0, import_promises25.open)(path69, "r");
|
57248
57248
|
await fd.close();
|
57249
57249
|
broadcastErr(error2);
|
57250
57250
|
} catch (err) {
|
@@ -57376,7 +57376,7 @@ var init_handler = __esm({
|
|
57376
57376
|
return;
|
57377
57377
|
if (!newStats || newStats.mtimeMs === 0) {
|
57378
57378
|
try {
|
57379
|
-
const newStats2 = await (0,
|
57379
|
+
const newStats2 = await (0, import_promises25.stat)(file);
|
57380
57380
|
if (this.fsw.closed)
|
57381
57381
|
return;
|
57382
57382
|
const at2 = newStats2.atimeMs;
|
@@ -57431,7 +57431,7 @@ var init_handler = __esm({
|
|
57431
57431
|
this.fsw._incrReadyCount();
|
57432
57432
|
let linkPath;
|
57433
57433
|
try {
|
57434
|
-
linkPath = await (0,
|
57434
|
+
linkPath = await (0, import_promises25.realpath)(path69);
|
57435
57435
|
} catch (e7) {
|
57436
57436
|
this.fsw._emitReady();
|
57437
57437
|
return true;
|
@@ -57579,7 +57579,7 @@ var init_handler = __esm({
|
|
57579
57579
|
let closer;
|
57580
57580
|
if (stats.isDirectory()) {
|
57581
57581
|
const absPath = sysPath.resolve(path69);
|
57582
|
-
const targetPath = follow ? await (0,
|
57582
|
+
const targetPath = follow ? await (0, import_promises25.realpath)(path69) : path69;
|
57583
57583
|
if (this.fsw.closed)
|
57584
57584
|
return;
|
57585
57585
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
@@ -57589,7 +57589,7 @@ var init_handler = __esm({
|
|
57589
57589
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
57590
57590
|
}
|
57591
57591
|
} else if (stats.isSymbolicLink()) {
|
57592
|
-
const targetPath = follow ? await (0,
|
57592
|
+
const targetPath = follow ? await (0, import_promises25.realpath)(path69) : path69;
|
57593
57593
|
if (this.fsw.closed)
|
57594
57594
|
return;
|
57595
57595
|
const parent = sysPath.dirname(wh.watchPath);
|
@@ -57689,12 +57689,12 @@ function watch(paths, options32 = {}) {
|
|
57689
57689
|
watcher.add(paths);
|
57690
57690
|
return watcher;
|
57691
57691
|
}
|
57692
|
-
var import_fs12,
|
57692
|
+
var import_fs12, import_promises26, import_events4, sysPath2, SLASH, SLASH_SLASH, ONE_DOT, TWO_DOTS, STRING_TYPE, BACK_SLASH_RE, DOUBLE_SLASH_RE, DOT_RE, REPLACER_RE, isMatcherObject, unifyPaths, toUnix, normalizePathToUnix, normalizeIgnored, getAbsolutePath, EMPTY_SET, DirEntry, STAT_METHOD_F, STAT_METHOD_L, WatchHelper, FSWatcher;
|
57693
57693
|
var init_esm2 = __esm({
|
57694
57694
|
"../../node_modules/.pnpm/chokidar@4.0.1/node_modules/chokidar/esm/index.js"() {
|
57695
57695
|
init_import_meta_url();
|
57696
57696
|
import_fs12 = require("fs");
|
57697
|
-
|
57697
|
+
import_promises26 = require("fs/promises");
|
57698
57698
|
import_events4 = require("events");
|
57699
57699
|
sysPath2 = __toESM(require("path"), 1);
|
57700
57700
|
init_esm();
|
@@ -57775,7 +57775,7 @@ var init_esm2 = __esm({
|
|
57775
57775
|
return;
|
57776
57776
|
const dir = this.path;
|
57777
57777
|
try {
|
57778
|
-
await (0,
|
57778
|
+
await (0, import_promises26.readdir)(dir);
|
57779
57779
|
} catch (err) {
|
57780
57780
|
if (this._removeWatcher) {
|
57781
57781
|
this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
|
@@ -58106,7 +58106,7 @@ var init_esm2 = __esm({
|
|
58106
58106
|
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path69) : path69;
|
58107
58107
|
let stats2;
|
58108
58108
|
try {
|
58109
|
-
stats2 = await (0,
|
58109
|
+
stats2 = await (0, import_promises26.stat)(fullPath);
|
58110
58110
|
} catch (err) {
|
58111
58111
|
}
|
58112
58112
|
if (!stats2 || this.closed)
|
@@ -58234,8 +58234,8 @@ var init_esm2 = __esm({
|
|
58234
58234
|
}
|
58235
58235
|
return this._userIgnored(path69, stats);
|
58236
58236
|
}
|
58237
|
-
_isntIgnored(path69,
|
58238
|
-
return !this._isIgnored(path69,
|
58237
|
+
_isntIgnored(path69, stat9) {
|
58238
|
+
return !this._isIgnored(path69, stat9);
|
58239
58239
|
}
|
58240
58240
|
/**
|
58241
58241
|
* Provides a set of common helpers and properties relating to symlink handling.
|
@@ -69377,14 +69377,14 @@ var init_retry_wrapper = __esm({
|
|
69377
69377
|
});
|
69378
69378
|
|
69379
69379
|
// ../../node_modules/.pnpm/@aws-sdk+credential-provider-http@3.716.0/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
|
69380
|
-
var
|
69380
|
+
var import_promises28, AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, DEFAULT_LINK_LOCAL_HOST, AWS_CONTAINER_CREDENTIALS_FULL_URI, AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE, AWS_CONTAINER_AUTHORIZATION_TOKEN, fromHttp;
|
69381
69381
|
var init_fromHttp = __esm({
|
69382
69382
|
"../../node_modules/.pnpm/@aws-sdk+credential-provider-http@3.716.0/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js"() {
|
69383
69383
|
init_import_meta_url();
|
69384
69384
|
init_client2();
|
69385
69385
|
init_dist_es11();
|
69386
69386
|
init_dist_es16();
|
69387
|
-
|
69387
|
+
import_promises28 = __toESM(require("fs/promises"));
|
69388
69388
|
init_checkUrl();
|
69389
69389
|
init_requestHelpers();
|
69390
69390
|
init_retry_wrapper();
|
@@ -69428,7 +69428,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
69428
69428
|
if (token) {
|
69429
69429
|
request4.headers.Authorization = token;
|
69430
69430
|
} else if (tokenFile) {
|
69431
|
-
request4.headers.Authorization = (await
|
69431
|
+
request4.headers.Authorization = (await import_promises28.default.readFile(tokenFile)).toString();
|
69432
69432
|
}
|
69433
69433
|
try {
|
69434
69434
|
const result = await requestHandler.handle(request4);
|
@@ -81177,7 +81177,7 @@ var import_undici3 = __toESM(require_undici());
|
|
81177
81177
|
|
81178
81178
|
// package.json
|
81179
81179
|
var name = "wrangler";
|
81180
|
-
var version = "4.
|
81180
|
+
var version = "4.2.0";
|
81181
81181
|
|
81182
81182
|
// src/environment-variables/misc-variables.ts
|
81183
81183
|
init_import_meta_url();
|
@@ -83598,7 +83598,7 @@ function checkType(type) {
|
|
83598
83598
|
throw new Error(`Invalid type specified: ${type}`);
|
83599
83599
|
}
|
83600
83600
|
__name(checkType, "checkType");
|
83601
|
-
var matchType = /* @__PURE__ */ __name((type,
|
83601
|
+
var matchType = /* @__PURE__ */ __name((type, stat9) => type === void 0 || stat9[typeMappings[type]](), "matchType");
|
83602
83602
|
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath, "toPath");
|
83603
83603
|
function locatePathSync(paths, {
|
83604
83604
|
cwd: cwd2 = import_node_process2.default.cwd(),
|
@@ -83610,8 +83610,8 @@ function locatePathSync(paths, {
|
|
83610
83610
|
const statFunction = allowSymlinks ? import_node_fs3.default.statSync : import_node_fs3.default.lstatSync;
|
83611
83611
|
for (const path_ of paths) {
|
83612
83612
|
try {
|
83613
|
-
const
|
83614
|
-
if (matchType(type,
|
83613
|
+
const stat9 = statFunction(import_node_path6.default.resolve(cwd2, path_));
|
83614
|
+
if (matchType(type, stat9)) {
|
83615
83615
|
return path_;
|
83616
83616
|
}
|
83617
83617
|
} catch {
|
@@ -85513,7 +85513,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
85513
85513
|
envName,
|
85514
85514
|
"containers",
|
85515
85515
|
validateContainerAppConfig,
|
85516
|
-
|
85516
|
+
void 0
|
85517
85517
|
),
|
85518
85518
|
send_email: notInheritable(
|
85519
85519
|
diagnostics,
|
@@ -86335,52 +86335,45 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
|
|
86335
86335
|
}, "validateBindingArray");
|
86336
86336
|
var validateContainerAppConfig = /* @__PURE__ */ __name((diagnostics, _field, value) => {
|
86337
86337
|
if (!value) {
|
86338
|
-
|
86339
|
-
`"containers" should be an object, but got a falsy value`
|
86340
|
-
);
|
86341
|
-
return false;
|
86338
|
+
return true;
|
86342
86339
|
}
|
86343
86340
|
if (typeof value !== "object") {
|
86344
86341
|
diagnostics.errors.push(
|
86345
|
-
`"containers" should be an object, but got ${
|
86346
|
-
);
|
86347
|
-
return false;
|
86348
|
-
}
|
86349
|
-
if (Array.isArray(value)) {
|
86350
|
-
diagnostics.errors.push(
|
86351
|
-
`"containers" should be an object, but got an array`
|
86342
|
+
`"containers" should be an object, but got ${JSON.stringify(value)}`
|
86352
86343
|
);
|
86353
86344
|
return false;
|
86354
86345
|
}
|
86355
|
-
if (!("app" in value)) {
|
86356
|
-
return true;
|
86357
|
-
}
|
86358
|
-
value = value.app;
|
86359
86346
|
if (!Array.isArray(value)) {
|
86360
86347
|
diagnostics.errors.push(
|
86361
|
-
`"containers
|
86348
|
+
`"containers" should be an array, but got ${JSON.stringify(value)}`
|
86362
86349
|
);
|
86363
86350
|
return false;
|
86364
86351
|
}
|
86365
86352
|
for (const containerApp of value) {
|
86366
86353
|
const containerAppOptional = containerApp;
|
86367
|
-
if (!isRequiredProperty(containerAppOptional, "instances", "number")) {
|
86368
|
-
diagnostics.errors.push(
|
86369
|
-
`"containers.app.instances" should be defined and an integer`
|
86370
|
-
);
|
86371
|
-
}
|
86372
86354
|
if (!isRequiredProperty(containerAppOptional, "name", "string")) {
|
86373
86355
|
diagnostics.errors.push(
|
86374
|
-
`"containers.
|
86356
|
+
`"containers.name" should be defined and a string`
|
86375
86357
|
);
|
86376
86358
|
}
|
86359
|
+
if ("image" in containerAppOptional && containerAppOptional.image !== void 0) {
|
86360
|
+
if (containerAppOptional.configuration?.image !== void 0) {
|
86361
|
+
diagnostics.errors.push(
|
86362
|
+
`"containers.image" and "containers.configuration.image" can't be defined at the same time`
|
86363
|
+
);
|
86364
|
+
return false;
|
86365
|
+
}
|
86366
|
+
containerAppOptional.configuration ??= {
|
86367
|
+
image: containerAppOptional.image
|
86368
|
+
};
|
86369
|
+
containerAppOptional.configuration.image = containerAppOptional.image;
|
86370
|
+
delete containerAppOptional["image"];
|
86371
|
+
}
|
86377
86372
|
if (!("configuration" in containerAppOptional)) {
|
86378
|
-
diagnostics.errors.push(
|
86379
|
-
`"containers.app.configuration" should be defined`
|
86380
|
-
);
|
86373
|
+
diagnostics.errors.push(`"containers.configuration" should be defined`);
|
86381
86374
|
} else if (Array.isArray(containerAppOptional.configuration)) {
|
86382
86375
|
diagnostics.errors.push(
|
86383
|
-
`"containers.
|
86376
|
+
`"containers.configuration" is defined as an array, it should be an object`
|
86384
86377
|
);
|
86385
86378
|
} else if (!isRequiredProperty(
|
86386
86379
|
containerAppOptional.configuration,
|
@@ -86388,7 +86381,7 @@ var validateContainerAppConfig = /* @__PURE__ */ __name((diagnostics, _field, va
|
|
86388
86381
|
"string"
|
86389
86382
|
)) {
|
86390
86383
|
diagnostics.errors.push(
|
86391
|
-
`"containers.
|
86384
|
+
`"containers.image" should be defined and a string`
|
86392
86385
|
);
|
86393
86386
|
}
|
86394
86387
|
}
|
@@ -87399,7 +87392,7 @@ var defaultWranglerConfig = {
|
|
87399
87392
|
/** NON-INHERITABLE ENVIRONMENT FIELDS **/
|
87400
87393
|
define: {},
|
87401
87394
|
cloudchamber: {},
|
87402
|
-
containers:
|
87395
|
+
containers: void 0,
|
87403
87396
|
send_email: [],
|
87404
87397
|
browser: void 0,
|
87405
87398
|
unsafe: {},
|
@@ -87415,6 +87408,7 @@ var supportedPagesConfigFields = [
|
|
87415
87408
|
"compatibility_date",
|
87416
87409
|
"compatibility_flags",
|
87417
87410
|
"send_metrics",
|
87411
|
+
"no_bundle",
|
87418
87412
|
"limits",
|
87419
87413
|
"placement",
|
87420
87414
|
"vars",
|
@@ -89824,45 +89818,45 @@ var import_child_process = require("child_process");
|
|
89824
89818
|
var import_undici = __toESM(require_undici());
|
89825
89819
|
var cache = {};
|
89826
89820
|
var usesAccessCache = /* @__PURE__ */ new Map();
|
89827
|
-
async function domainUsesAccess(
|
89828
|
-
logger.debug("Checking if domain has Access enabled:",
|
89829
|
-
if (usesAccessCache.has(
|
89821
|
+
async function domainUsesAccess(domain4) {
|
89822
|
+
logger.debug("Checking if domain has Access enabled:", domain4);
|
89823
|
+
if (usesAccessCache.has(domain4)) {
|
89830
89824
|
logger.debug(
|
89831
89825
|
"Using cached Access switch for:",
|
89832
|
-
|
89833
|
-
usesAccessCache.get(
|
89826
|
+
domain4,
|
89827
|
+
usesAccessCache.get(domain4)
|
89834
89828
|
);
|
89835
|
-
return usesAccessCache.get(
|
89829
|
+
return usesAccessCache.get(domain4);
|
89836
89830
|
}
|
89837
|
-
logger.debug("Access switch not cached for:",
|
89831
|
+
logger.debug("Access switch not cached for:", domain4);
|
89838
89832
|
try {
|
89839
89833
|
const controller = new AbortController();
|
89840
89834
|
const cancel3 = setTimeout(() => {
|
89841
89835
|
controller.abort();
|
89842
89836
|
}, 1e3);
|
89843
|
-
const output = await (0, import_undici.fetch)(`https://${
|
89837
|
+
const output = await (0, import_undici.fetch)(`https://${domain4}`, {
|
89844
89838
|
redirect: "manual",
|
89845
89839
|
signal: controller.signal
|
89846
89840
|
});
|
89847
89841
|
clearTimeout(cancel3);
|
89848
89842
|
const usesAccess = !!(output.status === 302 && output.headers.get("location")?.includes("cloudflareaccess.com"));
|
89849
|
-
logger.debug("Caching access switch for:",
|
89850
|
-
usesAccessCache.set(
|
89843
|
+
logger.debug("Caching access switch for:", domain4);
|
89844
|
+
usesAccessCache.set(domain4, usesAccess);
|
89851
89845
|
return usesAccess;
|
89852
89846
|
} catch (e7) {
|
89853
|
-
usesAccessCache.set(
|
89847
|
+
usesAccessCache.set(domain4, false);
|
89854
89848
|
return false;
|
89855
89849
|
}
|
89856
89850
|
}
|
89857
89851
|
__name(domainUsesAccess, "domainUsesAccess");
|
89858
|
-
async function getAccessToken(
|
89859
|
-
if (!await domainUsesAccess(
|
89852
|
+
async function getAccessToken(domain4) {
|
89853
|
+
if (!await domainUsesAccess(domain4)) {
|
89860
89854
|
return void 0;
|
89861
89855
|
}
|
89862
|
-
if (cache[
|
89863
|
-
return cache[
|
89856
|
+
if (cache[domain4]) {
|
89857
|
+
return cache[domain4];
|
89864
89858
|
}
|
89865
|
-
const output = (0, import_child_process.spawnSync)("cloudflared", ["access", "login",
|
89859
|
+
const output = (0, import_child_process.spawnSync)("cloudflared", ["access", "login", domain4]);
|
89866
89860
|
if (output.error) {
|
89867
89861
|
throw new UserError(
|
89868
89862
|
"To use Wrangler with Cloudflare Access, please install `cloudflared` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation"
|
@@ -89871,7 +89865,7 @@ async function getAccessToken(domain3) {
|
|
89871
89865
|
const stringOutput = output.stdout.toString();
|
89872
89866
|
const matches = stringOutput.match(/fetched your token:\n\n(.*)/m);
|
89873
89867
|
if (matches && matches.length >= 2) {
|
89874
|
-
cache[
|
89868
|
+
cache[domain4] = matches[1];
|
89875
89869
|
return matches[1];
|
89876
89870
|
}
|
89877
89871
|
throw new Error("Failed to authenticate with Cloudflare Access");
|
@@ -94741,7 +94735,7 @@ var NoOpProxyController = class extends ProxyController {
|
|
94741
94735
|
init_import_meta_url();
|
94742
94736
|
var import_node_assert24 = __toESM(require("node:assert"));
|
94743
94737
|
var import_node_fs31 = require("node:fs");
|
94744
|
-
var
|
94738
|
+
var import_promises37 = require("node:fs/promises");
|
94745
94739
|
var path62 = __toESM(require("node:path"));
|
94746
94740
|
|
94747
94741
|
// ../workers-shared/index.ts
|
@@ -104078,6 +104072,7 @@ function createWorkerUploadForm(worker) {
|
|
104078
104072
|
const metadata = {
|
104079
104073
|
...main2.type !== "commonjs" ? { main_module: main2.name } : { body_part: main2.name },
|
104080
104074
|
bindings: metadataBindings,
|
104075
|
+
containers: worker.containers === void 0 ? void 0 : worker.containers.map((c6) => ({ class_name: c6.class_name })),
|
104081
104076
|
...compatibility_date && { compatibility_date },
|
104082
104077
|
...compatibility_flags && {
|
104083
104078
|
compatibility_flags
|
@@ -105163,22 +105158,22 @@ __name(triggersDeploy, "triggersDeploy");
|
|
105163
105158
|
|
105164
105159
|
// src/utils/friendly-validator-errors.ts
|
105165
105160
|
init_import_meta_url();
|
105166
|
-
var
|
105161
|
+
var import_promises36 = require("node:fs/promises");
|
105167
105162
|
var import_node_path58 = __toESM(require("node:path"));
|
105168
105163
|
|
105169
105164
|
// src/check/commands.ts
|
105170
105165
|
init_import_meta_url();
|
105171
105166
|
var import_crypto6 = require("crypto");
|
105172
|
-
var
|
105167
|
+
var import_promises34 = require("fs/promises");
|
105173
105168
|
var import_node_events4 = __toESM(require("node:events"));
|
105174
|
-
var
|
105169
|
+
var import_promises35 = require("node:fs/promises");
|
105175
105170
|
var import_path23 = __toESM(require("path"));
|
105176
105171
|
var import_miniflare22 = require("miniflare");
|
105177
105172
|
|
105178
105173
|
// src/index.ts
|
105179
105174
|
init_import_meta_url();
|
105180
105175
|
var import_node_os7 = __toESM(require("node:os"));
|
105181
|
-
var
|
105176
|
+
var import_promises33 = require("node:timers/promises");
|
105182
105177
|
var import_undici20 = __toESM(require_undici());
|
105183
105178
|
|
105184
105179
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/index.mjs
|
@@ -110165,12 +110160,12 @@ var ImageRegistriesService = class {
|
|
110165
110160
|
* @returns AccountRegistryToken Credentials with 'pull' or 'push' permissions to access the registry
|
110166
110161
|
* @throws ApiError
|
110167
110162
|
*/
|
110168
|
-
static generateImageRegistryCredentials(
|
110163
|
+
static generateImageRegistryCredentials(domain4, requestBody) {
|
110169
110164
|
return request(OpenAPI, {
|
110170
110165
|
method: "POST",
|
110171
110166
|
url: "/registries/{domain}/credentials",
|
110172
110167
|
path: {
|
110173
|
-
domain:
|
110168
|
+
domain: domain4
|
110174
110169
|
},
|
110175
110170
|
body: requestBody,
|
110176
110171
|
mediaType: "application/json",
|
@@ -110189,12 +110184,12 @@ var ImageRegistriesService = class {
|
|
110189
110184
|
* @returns EmptyResponse The image registry is deleted
|
110190
110185
|
* @throws ApiError
|
110191
110186
|
*/
|
110192
|
-
static deleteImageRegistry(
|
110187
|
+
static deleteImageRegistry(domain4) {
|
110193
110188
|
return request(OpenAPI, {
|
110194
110189
|
method: "DELETE",
|
110195
110190
|
url: "/registries/{domain}",
|
110196
110191
|
path: {
|
110197
|
-
domain:
|
110192
|
+
domain: domain4
|
110198
110193
|
},
|
110199
110194
|
errors: {
|
110200
110195
|
404: `The image registry does not exist`,
|
@@ -110437,8 +110432,8 @@ var imageRe = (() => {
|
|
110437
110432
|
const alphaNumeric = "[a-z0-9]+";
|
110438
110433
|
const separator = "(?:\\.|_|__|-+)";
|
110439
110434
|
const port = ":[0-9]+";
|
110440
|
-
const
|
110441
|
-
const name2 = `(?:${
|
110435
|
+
const domain4 = `${alphaNumeric}(?:${separator}${alphaNumeric})*`;
|
110436
|
+
const name2 = `(?:${domain4}(?:${port})?/)?(?:${domain4}/)*(?:${domain4})`;
|
110442
110437
|
const tag = ":([a-zA-Z0-9_][a-zA-Z0-9._-]{0,127})";
|
110443
110438
|
const digest = "@(sha256:[A-Fa-f0-9]+)";
|
110444
110439
|
const reference = `(?:${tag}(?:${digest})?|${digest})`;
|
@@ -111080,7 +111075,7 @@ function applicationToCreateApplication(application) {
|
|
111080
111075
|
__name(applicationToCreateApplication, "applicationToCreateApplication");
|
111081
111076
|
function containerAppToCreateApplication(containerApp, skipDefaults = false) {
|
111082
111077
|
const configuration = containerApp.configuration;
|
111083
|
-
|
111078
|
+
const app = {
|
111084
111079
|
...containerApp,
|
111085
111080
|
configuration,
|
111086
111081
|
scheduling_policy: containerApp.scheduling_policy ?? "regional" /* REGIONAL */,
|
@@ -111094,6 +111089,9 @@ function containerAppToCreateApplication(containerApp, skipDefaults = false) {
|
|
111094
111089
|
)
|
111095
111090
|
}
|
111096
111091
|
};
|
111092
|
+
delete app["class_name"];
|
111093
|
+
delete app["image"];
|
111094
|
+
return app;
|
111097
111095
|
}
|
111098
111096
|
__name(containerAppToCreateApplication, "containerAppToCreateApplication");
|
111099
111097
|
function isNumber(c6) {
|
@@ -111232,21 +111230,20 @@ async function applyCommand(args, config) {
|
|
111232
111230
|
"Deploy a container application",
|
111233
111231
|
"deploy changes to your application"
|
111234
111232
|
);
|
111235
|
-
|
111233
|
+
config.containers ??= [];
|
111234
|
+
if (config.containers.length === 0) {
|
111236
111235
|
endSection(
|
111237
111236
|
"You don't have any container applications defined in your wrangler.toml",
|
111238
111237
|
"You can set the following configuration in your wrangler.toml"
|
111239
111238
|
);
|
111240
111239
|
const configuration = {
|
111241
|
-
|
111242
|
-
image: "docker.io/cloudflare/hello-world:1.0"
|
111243
|
-
},
|
111240
|
+
image: "docker.io/cloudflare/hello-world:1.0",
|
111244
111241
|
instances: 2,
|
111245
111242
|
name: config.name ?? "my-containers-application"
|
111246
111243
|
};
|
111247
111244
|
const endConfig = args.env !== void 0 ? {
|
111248
|
-
env: { [args.env]: { containers:
|
111249
|
-
} : { containers:
|
111245
|
+
env: { [args.env]: { containers: [configuration] } }
|
111246
|
+
} : { containers: [configuration] };
|
111250
111247
|
formatConfigSnippet(endConfig, config.configPath).split("\n").forEach((el) => {
|
111251
111248
|
printLine(el, " ", logRaw);
|
111252
111249
|
});
|
@@ -111262,7 +111259,7 @@ async function applyCommand(args, config) {
|
|
111262
111259
|
}
|
111263
111260
|
const actions = [];
|
111264
111261
|
log(dim("Container application changes\n"));
|
111265
|
-
for (const appConfigNoDefaults of config.containers
|
111262
|
+
for (const appConfigNoDefaults of config.containers) {
|
111266
111263
|
const appConfig = containerAppToCreateApplication(
|
111267
111264
|
appConfigNoDefaults,
|
111268
111265
|
args.skipDefaults
|
@@ -111273,18 +111270,16 @@ async function applyCommand(args, config) {
|
|
111273
111270
|
stripUndefined(applicationToCreateApplication(application))
|
111274
111271
|
);
|
111275
111272
|
const prev = formatConfigSnippet(
|
111276
|
-
{ containers:
|
111273
|
+
{ containers: [prevApp] },
|
111277
111274
|
config.configPath
|
111278
111275
|
);
|
111279
111276
|
const now = formatConfigSnippet(
|
111280
111277
|
{
|
111281
|
-
containers:
|
111282
|
-
|
111283
|
-
|
111284
|
-
|
111285
|
-
|
111286
|
-
]
|
111287
|
-
}
|
111278
|
+
containers: [
|
111279
|
+
sortObjectRecursive(
|
111280
|
+
appConfig
|
111281
|
+
)
|
111282
|
+
]
|
111288
111283
|
},
|
111289
111284
|
config.configPath
|
111290
111285
|
);
|
@@ -111364,15 +111359,16 @@ async function applyCommand(args, config) {
|
|
111364
111359
|
}
|
111365
111360
|
updateStatus(bold.underline(green.underline("NEW")) + ` ${appConfig.name}`);
|
111366
111361
|
const s5 = formatConfigSnippet(
|
111367
|
-
{ containers:
|
111362
|
+
{ containers: [appConfig] },
|
111368
111363
|
config.configPath
|
111369
111364
|
);
|
111370
111365
|
s5.split("\n").map((line) => line.trim()).forEach((el) => {
|
111371
111366
|
printLine(el, " ");
|
111372
111367
|
});
|
111368
|
+
const configToPush = { ...appConfig };
|
111373
111369
|
actions.push({
|
111374
111370
|
action: "create",
|
111375
|
-
application:
|
111371
|
+
application: configToPush
|
111376
111372
|
});
|
111377
111373
|
}
|
111378
111374
|
if (actions.length == 0) {
|
@@ -111473,6 +111469,7 @@ __name(applyCommand, "applyCommand");
|
|
111473
111469
|
// src/cloudchamber/build.ts
|
111474
111470
|
init_import_meta_url();
|
111475
111471
|
var import_child_process2 = require("child_process");
|
111472
|
+
var import_promises10 = require("fs/promises");
|
111476
111473
|
var domain = "registry.cloudchamber.cfdata.org";
|
111477
111474
|
async function dockerLoginManagedRegistry(options32) {
|
111478
111475
|
const dockerPath = options32.pathToDocker ?? "docker";
|
@@ -111516,17 +111513,18 @@ async function constructBuildCommand(options32) {
|
|
111516
111513
|
return defaultBuildCommand;
|
111517
111514
|
}
|
111518
111515
|
__name(constructBuildCommand, "constructBuildCommand");
|
111519
|
-
|
111520
|
-
|
111521
|
-
|
111522
|
-
|
111523
|
-
"
|
111524
|
-
(
|
111525
|
-
|
111526
|
-
|
111527
|
-
|
111528
|
-
|
111529
|
-
|
111516
|
+
function dockerBuild(options32) {
|
111517
|
+
return new Promise((resolve24, reject) => {
|
111518
|
+
const buildCmd = options32.buildCmd.split(" ").slice(1);
|
111519
|
+
const buildExec = options32.buildCmd.split(" ").shift();
|
111520
|
+
const child = (0, import_child_process2.spawn)(String(buildExec), buildCmd, { stdio: "inherit" });
|
111521
|
+
child.on("exit", (code) => {
|
111522
|
+
if (code === 0) {
|
111523
|
+
resolve24();
|
111524
|
+
} else {
|
111525
|
+
reject(new Error(`Build exited with code: ${code}`));
|
111526
|
+
}
|
111527
|
+
});
|
111530
111528
|
});
|
111531
111529
|
}
|
111532
111530
|
__name(dockerBuild, "dockerBuild");
|
@@ -111596,13 +111594,28 @@ function pushYargs(yargs) {
|
|
111596
111594
|
}).positional("TAG", { type: "string", demandOption: true });
|
111597
111595
|
}
|
111598
111596
|
__name(pushYargs, "pushYargs");
|
111597
|
+
async function isDir(path69) {
|
111598
|
+
const stats = await (0, import_promises10.stat)(path69);
|
111599
|
+
return await stats.isDirectory();
|
111600
|
+
}
|
111601
|
+
__name(isDir, "isDir");
|
111599
111602
|
async function buildCommand(args, _4) {
|
111603
|
+
try {
|
111604
|
+
const dir = await isDir(args.PATH);
|
111605
|
+
if (!dir) {
|
111606
|
+
logRaw(`PATH must be a directory`);
|
111607
|
+
return;
|
111608
|
+
}
|
111609
|
+
} catch (error2) {
|
111610
|
+
logRaw(`Error when checking ${args.PATH}: ${error2}`);
|
111611
|
+
return;
|
111612
|
+
}
|
111600
111613
|
try {
|
111601
111614
|
await constructBuildCommand({
|
111602
111615
|
imageTag: args.tag,
|
111603
111616
|
pathToDockerfile: args.PATH,
|
111604
111617
|
pathToDocker: args.pathToDocker
|
111605
|
-
}).then(
|
111618
|
+
}).then((bc2) => dockerBuild({ buildCmd: bc2 })).then(async () => {
|
111606
111619
|
if (args.push) {
|
111607
111620
|
await dockerLoginManagedRegistry({
|
111608
111621
|
pathToDocker: args.pathToDocker
|
@@ -111615,7 +111628,7 @@ async function buildCommand(args, _4) {
|
|
111615
111628
|
if (error2 instanceof Error) {
|
111616
111629
|
logRaw(error2.message);
|
111617
111630
|
} else {
|
111618
|
-
logRaw("
|
111631
|
+
logRaw("Unknown error");
|
111619
111632
|
}
|
111620
111633
|
}
|
111621
111634
|
}
|
@@ -112078,7 +112091,7 @@ __name(getNetworkInput, "getNetworkInput");
|
|
112078
112091
|
|
112079
112092
|
// src/cloudchamber/ssh/ssh.ts
|
112080
112093
|
init_import_meta_url();
|
112081
|
-
var
|
112094
|
+
var import_promises11 = require("fs/promises");
|
112082
112095
|
var import_os3 = require("os");
|
112083
112096
|
var import_process4 = require("process");
|
112084
112097
|
|
@@ -112142,7 +112155,7 @@ function createSSHPublicKeyOptionalYargs(yargs) {
|
|
112142
112155
|
__name(createSSHPublicKeyOptionalYargs, "createSSHPublicKeyOptionalYargs");
|
112143
112156
|
async function retrieveSSHKey(sshKeyPath, { json } = { json: false }) {
|
112144
112157
|
try {
|
112145
|
-
const file = (await (0,
|
112158
|
+
const file = (await (0, import_promises11.readFile)(sshKeyPath)).toString();
|
112146
112159
|
validatePublicSSHKeyCLI(file, { json });
|
112147
112160
|
return file;
|
112148
112161
|
} catch (err) {
|
@@ -112223,10 +112236,10 @@ async function tryToRetrieveAllDefaultSSHKeyPaths() {
|
|
112223
112236
|
const path69 = `${HOME}/.ssh`;
|
112224
112237
|
const paths = [];
|
112225
112238
|
try {
|
112226
|
-
const dirList = await (0,
|
112239
|
+
const dirList = await (0, import_promises11.readdir)(path69);
|
112227
112240
|
for (const file of dirList) {
|
112228
112241
|
if (file.endsWith(".pub")) {
|
112229
|
-
const s5 = await (0,
|
112242
|
+
const s5 = await (0, import_promises11.stat)(`${path69}/${file}`);
|
112230
112243
|
if (s5.isFile()) {
|
112231
112244
|
paths.push(`${path69}/${file}`);
|
112232
112245
|
}
|
@@ -112268,7 +112281,7 @@ async function shouldPromptForNewSSHKeyAppear(keys = void 0) {
|
|
112268
112281
|
}
|
112269
112282
|
let foundValidSSHKeyThatDontExist = false;
|
112270
112283
|
for (const defaultSSHKeyPath of defaultSSHKeyPaths) {
|
112271
|
-
const file = (await (0,
|
112284
|
+
const file = (await (0, import_promises11.readFile)(defaultSSHKeyPath)).toString().trim();
|
112272
112285
|
try {
|
112273
112286
|
validateSSHKey(file);
|
112274
112287
|
} catch {
|
@@ -113130,7 +113143,7 @@ public_key: ${dim(
|
|
113130
113143
|
__name(handleListImageRegistriesCommand, "handleListImageRegistriesCommand");
|
113131
113144
|
async function handleConfigureImageRegistryCommand(args, _config) {
|
113132
113145
|
startSection("Configure a Docker registry in Cloudflare");
|
113133
|
-
const
|
113146
|
+
const domain4 = await processArgument({ domain: args.domain }, "domain", {
|
113134
113147
|
type: "text",
|
113135
113148
|
question: "What is the domain of your registry?",
|
113136
113149
|
validate: /* @__PURE__ */ __name((text) => {
|
@@ -113152,7 +113165,7 @@ async function handleConfigureImageRegistryCommand(args, _config) {
|
|
113152
113165
|
const [registry, err] = await wrap2(
|
113153
113166
|
promiseSpinner(
|
113154
113167
|
ImageRegistriesService.createImageRegistry({
|
113155
|
-
domain:
|
113168
|
+
domain: domain4,
|
113156
113169
|
is_public: isPublic
|
113157
113170
|
})
|
113158
113171
|
)
|
@@ -113184,6 +113197,199 @@ async function handleConfigureImageRegistryCommand(args, _config) {
|
|
113184
113197
|
}
|
113185
113198
|
__name(handleConfigureImageRegistryCommand, "handleConfigureImageRegistryCommand");
|
113186
113199
|
|
113200
|
+
// src/cloudchamber/images/list.ts
|
113201
|
+
init_import_meta_url();
|
113202
|
+
var domain2 = "registry.cloudchamber.cfdata.org";
|
113203
|
+
var imagesCommand = /* @__PURE__ */ __name((yargs) => {
|
113204
|
+
return yargs.command(
|
113205
|
+
"list",
|
113206
|
+
"perform operations on images in your cloudchamber registry",
|
113207
|
+
(args) => listImagesYargs(args),
|
113208
|
+
(args) => handleFailure(async (_args, config) => {
|
113209
|
+
await handleListImagesCommand(args, config);
|
113210
|
+
})(args)
|
113211
|
+
).command(
|
113212
|
+
"delete [image]",
|
113213
|
+
"remove an image from your cloudchamber registry",
|
113214
|
+
(args) => deleteImageYargs(args),
|
113215
|
+
(args) => handleFailure(async (_args, config) => {
|
113216
|
+
await handleDeleteImageCommand(args, config);
|
113217
|
+
})(args)
|
113218
|
+
);
|
113219
|
+
}, "imagesCommand");
|
113220
|
+
function deleteImageYargs(yargs) {
|
113221
|
+
return yargs.positional("image", {
|
113222
|
+
type: "string",
|
113223
|
+
description: "image to delete",
|
113224
|
+
demandOption: true
|
113225
|
+
});
|
113226
|
+
}
|
113227
|
+
__name(deleteImageYargs, "deleteImageYargs");
|
113228
|
+
function listImagesYargs(yargs) {
|
113229
|
+
return yargs.option("filter", {
|
113230
|
+
type: "string",
|
113231
|
+
description: "Regex to filter results"
|
113232
|
+
});
|
113233
|
+
}
|
113234
|
+
__name(listImagesYargs, "listImagesYargs");
|
113235
|
+
async function handleDeleteImageCommand(args, _config) {
|
113236
|
+
try {
|
113237
|
+
if (!args.image.includes(":")) {
|
113238
|
+
throw new Error(`Must provide a tag to delete`);
|
113239
|
+
}
|
113240
|
+
return await promiseSpinner(
|
113241
|
+
getCreds().then(async (creds) => {
|
113242
|
+
const url4 = new URL(`https://${domain2}`);
|
113243
|
+
const baseUrl = `${url4.protocol}//${url4.host}`;
|
113244
|
+
const [image, tag] = args.image.split(":");
|
113245
|
+
await deleteTag(baseUrl, image, tag, creds);
|
113246
|
+
const gcUrl = `${baseUrl}/v2/gc/layers`;
|
113247
|
+
const gcResponse = await fetch(gcUrl, {
|
113248
|
+
method: "PUT",
|
113249
|
+
headers: {
|
113250
|
+
Authorization: `Basic ${creds}`,
|
113251
|
+
"Content-Type": "application/json"
|
113252
|
+
}
|
113253
|
+
});
|
113254
|
+
if (!gcResponse.ok) {
|
113255
|
+
throw new Error(
|
113256
|
+
`Failed to delete image ${args.image}: ${gcResponse.status} ${gcResponse.statusText}`
|
113257
|
+
);
|
113258
|
+
}
|
113259
|
+
await logger.log(`Deleted tag: ${args.image}`);
|
113260
|
+
}),
|
113261
|
+
{ message: "Deleting", json: args.json }
|
113262
|
+
);
|
113263
|
+
} catch (error2) {
|
113264
|
+
logger.log(`Error when removing image: ${error2}`);
|
113265
|
+
}
|
113266
|
+
}
|
113267
|
+
__name(handleDeleteImageCommand, "handleDeleteImageCommand");
|
113268
|
+
async function handleListImagesCommand(args, _config) {
|
113269
|
+
try {
|
113270
|
+
return await promiseSpinner(
|
113271
|
+
getCreds().then(async (creds) => {
|
113272
|
+
const repos = await listRepos(creds);
|
113273
|
+
const tags = [];
|
113274
|
+
for (const repo of repos) {
|
113275
|
+
const stripped = repo.replace(/^\/+/, "");
|
113276
|
+
const regex2 = new RegExp(args.filter ?? "");
|
113277
|
+
if (regex2.test(stripped)) {
|
113278
|
+
const repoTags = await listTags(stripped, creds);
|
113279
|
+
tags.push({ name: stripped, tags: repoTags });
|
113280
|
+
}
|
113281
|
+
}
|
113282
|
+
await ListTags(tags, false, args.json);
|
113283
|
+
}),
|
113284
|
+
{ message: "Listing", json: args.json }
|
113285
|
+
);
|
113286
|
+
} catch (error2) {
|
113287
|
+
logger.log(`Error listing images: ${error2}`);
|
113288
|
+
}
|
113289
|
+
}
|
113290
|
+
__name(handleListImagesCommand, "handleListImagesCommand");
|
113291
|
+
async function ListTags(responses, digests = false, json = false) {
|
113292
|
+
if (!digests) {
|
113293
|
+
responses = responses.map((resp) => {
|
113294
|
+
return {
|
113295
|
+
name: resp.name,
|
113296
|
+
tags: resp.tags.filter((t7) => !t7.startsWith("sha256"))
|
113297
|
+
};
|
113298
|
+
});
|
113299
|
+
}
|
113300
|
+
responses = responses.filter((resp) => {
|
113301
|
+
return resp.tags !== void 0 && resp.tags.length != 0;
|
113302
|
+
});
|
113303
|
+
if (json) {
|
113304
|
+
logger.log(JSON.stringify(responses, null, 2));
|
113305
|
+
} else {
|
113306
|
+
const rows = responses.map((resp) => {
|
113307
|
+
return {
|
113308
|
+
REPOSITORY: resp.name,
|
113309
|
+
TAG: resp.tags.join(" ")
|
113310
|
+
};
|
113311
|
+
}).flat();
|
113312
|
+
logger.table(rows);
|
113313
|
+
}
|
113314
|
+
}
|
113315
|
+
__name(ListTags, "ListTags");
|
113316
|
+
async function listTags(repo, creds) {
|
113317
|
+
const url4 = new URL(`https://${domain2}`);
|
113318
|
+
const baseUrl = `${url4.protocol}//${url4.host}`;
|
113319
|
+
const tagsUrl = `${baseUrl}/v2/${repo}/tags/list`;
|
113320
|
+
const tagsResponse = await fetch(tagsUrl, {
|
113321
|
+
method: "GET",
|
113322
|
+
headers: {
|
113323
|
+
Authorization: `Basic ${creds}`
|
113324
|
+
}
|
113325
|
+
});
|
113326
|
+
const tagsData = await tagsResponse.json();
|
113327
|
+
return tagsData.tags || [];
|
113328
|
+
}
|
113329
|
+
__name(listTags, "listTags");
|
113330
|
+
async function listRepos(creds) {
|
113331
|
+
const url4 = new URL(`https://${domain2}`);
|
113332
|
+
const catalogUrl = `${url4.protocol}//${url4.host}/v2/_catalog`;
|
113333
|
+
const response = await fetch(catalogUrl, {
|
113334
|
+
method: "GET",
|
113335
|
+
headers: {
|
113336
|
+
Authorization: `Basic ${creds}`
|
113337
|
+
}
|
113338
|
+
});
|
113339
|
+
if (!response.ok) {
|
113340
|
+
console.log(JSON.stringify(response));
|
113341
|
+
throw new Error(
|
113342
|
+
`Failed to fetch repository catalog: ${response.status} ${response.statusText}`
|
113343
|
+
);
|
113344
|
+
}
|
113345
|
+
const data = await response.json();
|
113346
|
+
return data.repositories || [];
|
113347
|
+
}
|
113348
|
+
__name(listRepos, "listRepos");
|
113349
|
+
async function deleteTag(baseUrl, image, tag, creds) {
|
113350
|
+
const manifestAcceptHeader = "application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json";
|
113351
|
+
const manifestUrl = `${baseUrl}/v2/${image}/manifests/${tag}`;
|
113352
|
+
const headResponse = await fetch(manifestUrl, {
|
113353
|
+
method: "HEAD",
|
113354
|
+
headers: {
|
113355
|
+
Authorization: `Basic ${creds}`,
|
113356
|
+
Accept: manifestAcceptHeader
|
113357
|
+
}
|
113358
|
+
});
|
113359
|
+
if (!headResponse.ok) {
|
113360
|
+
throw new Error(
|
113361
|
+
`failed to retrieve tag info for ${tag}: ${headResponse.status} ${headResponse.statusText}`
|
113362
|
+
);
|
113363
|
+
}
|
113364
|
+
const digest = headResponse.headers.get("Docker-Content-Digest");
|
113365
|
+
if (!digest) {
|
113366
|
+
throw new Error(`Digest not found for tag "${tag}".`);
|
113367
|
+
}
|
113368
|
+
const deleteUrl = `${baseUrl}/v2/${image}/manifests/${tag}`;
|
113369
|
+
const deleteResponse = await fetch(deleteUrl, {
|
113370
|
+
method: "DELETE",
|
113371
|
+
headers: {
|
113372
|
+
Authorization: `Basic ${creds}`,
|
113373
|
+
Accept: manifestAcceptHeader
|
113374
|
+
}
|
113375
|
+
});
|
113376
|
+
if (!deleteResponse.ok) {
|
113377
|
+
throw new Error(
|
113378
|
+
`Failed to delete tag "${tag}" (digest: ${digest}): ${deleteResponse.status} ${deleteResponse.statusText}`
|
113379
|
+
);
|
113380
|
+
}
|
113381
|
+
}
|
113382
|
+
__name(deleteTag, "deleteTag");
|
113383
|
+
async function getCreds() {
|
113384
|
+
return await ImageRegistriesService.generateImageRegistryCredentials(domain2, {
|
113385
|
+
expiration_minutes: 5,
|
113386
|
+
permissions: ["pull", "push"]
|
113387
|
+
}).then(async (credentials) => {
|
113388
|
+
return Buffer.from(`v1:${credentials.password}`).toString("base64");
|
113389
|
+
});
|
113390
|
+
}
|
113391
|
+
__name(getCreds, "getCreds");
|
113392
|
+
|
113187
113393
|
// src/cloudchamber/list.ts
|
113188
113394
|
init_import_meta_url();
|
113189
113395
|
function listDeploymentsYargs(args) {
|
@@ -113592,6 +113798,10 @@ var cloudchamber = /* @__PURE__ */ __name((yargs, subHelp) => {
|
|
113592
113798
|
"push a tagged image to a Cloudflare managed registry, which is automatically integrated with your account",
|
113593
113799
|
(args) => pushYargs(args),
|
113594
113800
|
(args) => handleFailure(pushCommand)(args)
|
113801
|
+
).command(
|
113802
|
+
"images",
|
113803
|
+
"perform operations on images in your clouchamber registry",
|
113804
|
+
(args) => imagesCommand(args).command(subHelp)
|
113595
113805
|
);
|
113596
113806
|
}, "cloudchamber");
|
113597
113807
|
|
@@ -114778,7 +114988,7 @@ __name(checkForSQLiteBinary, "checkForSQLiteBinary");
|
|
114778
114988
|
|
114779
114989
|
// src/d1/export.ts
|
114780
114990
|
init_import_meta_url();
|
114781
|
-
var
|
114991
|
+
var import_promises12 = __toESM(require("node:fs/promises"));
|
114782
114992
|
var import_node_path29 = __toESM(require("node:path"));
|
114783
114993
|
var import_miniflare18 = require("miniflare");
|
114784
114994
|
var import_undici10 = __toESM(require_undici());
|
@@ -114859,7 +115069,7 @@ async function exportLocal(config, name2, output, tables, noSchema, noData) {
|
|
114859
115069
|
logger.log(`\u{1F300} Exporting SQL to ${output}...`);
|
114860
115070
|
try {
|
114861
115071
|
const dump = await db.prepare(`PRAGMA miniflare_d1_export(?,?,?);`).bind(noSchema, noData, ...tables).raw();
|
114862
|
-
await
|
115072
|
+
await import_promises12.default.writeFile(output, dump[0].join("\n"));
|
114863
115073
|
} catch (e7) {
|
114864
115074
|
throw new UserError(e7.message);
|
114865
115075
|
} finally {
|
@@ -114904,7 +115114,7 @@ async function exportRemotely(config, name2, output, tables, noSchema, noData) {
|
|
114904
115114
|
`There was an error while downloading from the presigned URL with status code: ${contents.status}`
|
114905
115115
|
);
|
114906
115116
|
}
|
114907
|
-
await
|
115117
|
+
await import_promises12.default.writeFile(output, contents.body || "");
|
114908
115118
|
}
|
114909
115119
|
});
|
114910
115120
|
logger.log(`\u{1F300} Downloaded to ${output} successfully!`);
|
@@ -117152,7 +117362,8 @@ async function handler4(args) {
|
|
117152
117362
|
const database = await createConfig(config, {
|
117153
117363
|
name: args.name,
|
117154
117364
|
origin,
|
117155
|
-
caching: getCacheOptionsFromArgs(args)
|
117365
|
+
caching: getCacheOptionsFromArgs(args),
|
117366
|
+
mtls: getMtlsFromArgs(args)
|
117156
117367
|
});
|
117157
117368
|
logger.log(`\u2705 Created new Hyperdrive config: ${database.id}`);
|
117158
117369
|
logger.log(
|
@@ -117223,7 +117434,8 @@ async function handler7(args) {
|
|
117223
117434
|
host: database.origin.host ?? "",
|
117224
117435
|
port: database.origin.port?.toString() ?? "",
|
117225
117436
|
database: database.origin.database ?? "",
|
117226
|
-
caching: JSON.stringify(database.caching)
|
117437
|
+
caching: JSON.stringify(database.caching),
|
117438
|
+
mtls: JSON.stringify(database.mtls)
|
117227
117439
|
}))
|
117228
117440
|
);
|
117229
117441
|
}
|
@@ -117249,7 +117461,8 @@ async function handler8(args) {
|
|
117249
117461
|
const updated = await patchConfig(config, args.id, {
|
117250
117462
|
name: args.name,
|
117251
117463
|
origin,
|
117252
|
-
caching: getCacheOptionsFromArgs(args)
|
117464
|
+
caching: getCacheOptionsFromArgs(args),
|
117465
|
+
mtls: getMtlsFromArgs(args)
|
117253
117466
|
});
|
117254
117467
|
logger.log(
|
117255
117468
|
`\u2705 Updated ${updated.id} Hyperdrive config
|
@@ -117346,6 +117559,14 @@ function upsertOptions(yargs) {
|
|
117346
117559
|
swr: {
|
117347
117560
|
type: "number",
|
117348
117561
|
describe: "Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled"
|
117562
|
+
},
|
117563
|
+
"ca-certificate-uuid": {
|
117564
|
+
type: "string",
|
117565
|
+
describe: "Sets custom CA certificate when connecting to origin database. Must be valid UUID of already uploaded CA certificate."
|
117566
|
+
},
|
117567
|
+
"mtls-certificate-uuid": {
|
117568
|
+
type: "string",
|
117569
|
+
describe: "Sets custom mTLS client certificates when connecting to origin database. Must be valid UUID of already uploaded public/private key certificates."
|
117349
117570
|
}
|
117350
117571
|
}).group(
|
117351
117572
|
["connection-string"],
|
@@ -117494,10 +117715,22 @@ function getCacheOptionsFromArgs(args) {
|
|
117494
117715
|
}
|
117495
117716
|
}
|
117496
117717
|
__name(getCacheOptionsFromArgs, "getCacheOptionsFromArgs");
|
117718
|
+
function getMtlsFromArgs(args) {
|
117719
|
+
const mtls = {
|
117720
|
+
ca_certificate_uuid: args.caCertificateUuid,
|
117721
|
+
mtls_certificate_uuid: args.mtlsCertificateUuid
|
117722
|
+
};
|
117723
|
+
if (JSON.stringify(mtls) === "{}") {
|
117724
|
+
return void 0;
|
117725
|
+
} else {
|
117726
|
+
return mtls;
|
117727
|
+
}
|
117728
|
+
}
|
117729
|
+
__name(getMtlsFromArgs, "getMtlsFromArgs");
|
117497
117730
|
|
117498
117731
|
// src/init.ts
|
117499
117732
|
init_import_meta_url();
|
117500
|
-
var
|
117733
|
+
var import_promises13 = require("node:fs/promises");
|
117501
117734
|
var import_node_path35 = __toESM(require("node:path"));
|
117502
117735
|
var import_toml4 = __toESM(require_toml());
|
117503
117736
|
|
@@ -117601,9 +117834,9 @@ async function initHandler(args) {
|
|
117601
117834
|
throw err;
|
117602
117835
|
}
|
117603
117836
|
const creationDir = import_node_path35.default.join(process.cwd(), args.fromDash);
|
117604
|
-
await (0,
|
117837
|
+
await (0, import_promises13.mkdir)(creationDir, { recursive: true });
|
117605
117838
|
const { modules, config } = await downloadWorker(accountId, args.fromDash);
|
117606
|
-
await (0,
|
117839
|
+
await (0, import_promises13.mkdir)(import_node_path35.default.join(creationDir, "./src"), {
|
117607
117840
|
recursive: true
|
117608
117841
|
});
|
117609
117842
|
config.main = `src/${config.main}`;
|
@@ -117613,12 +117846,12 @@ async function initHandler(args) {
|
|
117613
117846
|
files.map(async (file) => {
|
117614
117847
|
const filepath = import_node_path35.default.join(creationDir, `./src/${file.name}`);
|
117615
117848
|
const directory = (0, import_node_path35.dirname)(filepath);
|
117616
|
-
await (0,
|
117617
|
-
await (0,
|
117849
|
+
await (0, import_promises13.mkdir)(directory, { recursive: true });
|
117850
|
+
await (0, import_promises13.writeFile)(filepath, file.stream());
|
117618
117851
|
})
|
117619
117852
|
);
|
117620
117853
|
}
|
117621
|
-
await (0,
|
117854
|
+
await (0, import_promises13.writeFile)(
|
117622
117855
|
import_node_path35.default.join(creationDir, "wrangler.toml"),
|
117623
117856
|
import_toml4.default.stringify(config)
|
117624
117857
|
);
|
@@ -118963,7 +119196,7 @@ init_import_meta_url();
|
|
118963
119196
|
init_import_meta_url();
|
118964
119197
|
var import_node_crypto11 = require("node:crypto");
|
118965
119198
|
var import_node_fs20 = require("node:fs");
|
118966
|
-
var
|
119199
|
+
var import_promises18 = require("node:fs/promises");
|
118967
119200
|
var import_node_path44 = __toESM(require("node:path"));
|
118968
119201
|
|
118969
119202
|
// src/api/pages/create-worker-bundle-contents.ts
|
@@ -119020,7 +119253,7 @@ var import_node_path43 = require("node:path");
|
|
119020
119253
|
|
119021
119254
|
// src/pages/functions/buildPlugin.ts
|
119022
119255
|
init_import_meta_url();
|
119023
|
-
var
|
119256
|
+
var import_promises15 = require("node:fs/promises");
|
119024
119257
|
var import_node_path39 = require("node:path");
|
119025
119258
|
|
119026
119259
|
// src/pages/utils.ts
|
@@ -119086,7 +119319,7 @@ __name(debounce, "debounce");
|
|
119086
119319
|
// src/pages/functions/buildWorker.ts
|
119087
119320
|
init_import_meta_url();
|
119088
119321
|
var import_node_crypto10 = __toESM(require("node:crypto"));
|
119089
|
-
var
|
119322
|
+
var import_promises14 = require("node:fs/promises");
|
119090
119323
|
var import_node_path38 = require("node:path");
|
119091
119324
|
var import_esbuild3 = require("esbuild");
|
119092
119325
|
function buildWorkerFromFunctions({
|
@@ -119367,8 +119600,8 @@ function assetsPlugin(buildOutputDirectory) {
|
|
119367
119600
|
args.resolveDir,
|
119368
119601
|
args.path.slice("assets:".length)
|
119369
119602
|
);
|
119370
|
-
const exists = await (0,
|
119371
|
-
const isDirectory2 = exists && (await (0,
|
119603
|
+
const exists = await (0, import_promises14.access)(directory).then(() => true).catch(() => false);
|
119604
|
+
const isDirectory2 = exists && (await (0, import_promises14.lstat)(directory)).isDirectory();
|
119372
119605
|
if (!isDirectory2) {
|
119373
119606
|
return {
|
119374
119607
|
errors: [
|
@@ -119397,11 +119630,11 @@ function assetsPlugin(buildOutputDirectory) {
|
|
119397
119630
|
"pages-plugins",
|
119398
119631
|
identifier
|
119399
119632
|
);
|
119400
|
-
await (0,
|
119633
|
+
await (0, import_promises14.rm)(staticAssetsOutputDirectory, {
|
119401
119634
|
force: true,
|
119402
119635
|
recursive: true
|
119403
119636
|
});
|
119404
|
-
await (0,
|
119637
|
+
await (0, import_promises14.cp)(args.path, staticAssetsOutputDirectory, {
|
119405
119638
|
force: true,
|
119406
119639
|
recursive: true
|
119407
119640
|
});
|
@@ -119480,8 +119713,8 @@ function buildPluginFromFunctions({
|
|
119480
119713
|
args.resolveDir,
|
119481
119714
|
args.path.slice("assets:".length)
|
119482
119715
|
);
|
119483
|
-
const exists = await (0,
|
119484
|
-
const isDirectory2 = exists && (await (0,
|
119716
|
+
const exists = await (0, import_promises15.access)(directory).then(() => true).catch(() => false);
|
119717
|
+
const isDirectory2 = exists && (await (0, import_promises15.lstat)(directory)).isDirectory();
|
119485
119718
|
if (!isDirectory2) {
|
119486
119719
|
return {
|
119487
119720
|
errors: [
|
@@ -119531,7 +119764,7 @@ __name(buildPluginFromFunctions, "buildPluginFromFunctions");
|
|
119531
119764
|
|
119532
119765
|
// src/pages/functions/filepath-routing.ts
|
119533
119766
|
init_import_meta_url();
|
119534
|
-
var
|
119767
|
+
var import_promises16 = __toESM(require("node:fs/promises"));
|
119535
119768
|
var import_node_path40 = __toESM(require("node:path"));
|
119536
119769
|
var import_esbuild4 = require("esbuild");
|
119537
119770
|
async function generateConfigFromFileTree({
|
@@ -119663,7 +119896,7 @@ async function forEachFile(baseDir, fn) {
|
|
119663
119896
|
const returnValues = [];
|
119664
119897
|
while (isNotEmpty(searchPaths)) {
|
119665
119898
|
const cwd2 = searchPaths.shift();
|
119666
|
-
const dir = await
|
119899
|
+
const dir = await import_promises16.default.readdir(cwd2, { withFileTypes: true });
|
119667
119900
|
for (const entry of dir) {
|
119668
119901
|
const pathname = import_node_path40.default.join(cwd2, entry.name);
|
119669
119902
|
if (entry.isDirectory()) {
|
@@ -119708,7 +119941,7 @@ __name(convertSimpleParams, "convertSimpleParams");
|
|
119708
119941
|
|
119709
119942
|
// src/pages/functions/routes.ts
|
119710
119943
|
init_import_meta_url();
|
119711
|
-
var
|
119944
|
+
var import_promises17 = __toESM(require("node:fs/promises"));
|
119712
119945
|
var import_node_path41 = __toESM(require("node:path"));
|
119713
119946
|
|
119714
119947
|
// src/pages/functions/identifiers.ts
|
@@ -119786,7 +120019,7 @@ async function writeRoutesModule({
|
|
119786
120019
|
}) {
|
119787
120020
|
const { importMap, routes } = parseConfig(config, srcDir);
|
119788
120021
|
const routesModule = generateRoutesModule(importMap, routes);
|
119789
|
-
await
|
120022
|
+
await import_promises17.default.writeFile(outfile, routesModule);
|
119790
120023
|
return outfile;
|
119791
120024
|
}
|
119792
120025
|
__name(writeRoutesModule, "writeRoutesModule");
|
@@ -120331,7 +120564,7 @@ async function maybeReadPagesConfig(args) {
|
|
120331
120564
|
});
|
120332
120565
|
return {
|
120333
120566
|
...config,
|
120334
|
-
hash: (0, import_node_crypto11.createHash)("sha256").update(await (0,
|
120567
|
+
hash: (0, import_node_crypto11.createHash)("sha256").update(await (0, import_promises18.readFile)(configPath)).digest("hex")
|
120335
120568
|
};
|
120336
120569
|
} catch (e7) {
|
120337
120570
|
if (e7 instanceof FatalError && e7.code === EXIT_CODE_INVALID_PAGES_CONFIG) {
|
@@ -120538,26 +120771,26 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
|
|
120538
120771
|
// src/pages/deploy.ts
|
120539
120772
|
init_import_meta_url();
|
120540
120773
|
var import_node_child_process4 = require("node:child_process");
|
120541
|
-
var
|
120774
|
+
var import_promises22 = require("node:fs/promises");
|
120542
120775
|
var import_node_path50 = __toESM(require("node:path"));
|
120543
120776
|
|
120544
120777
|
// src/api/pages/deploy.ts
|
120545
120778
|
init_import_meta_url();
|
120546
120779
|
var import_node_crypto12 = require("node:crypto");
|
120547
120780
|
var import_node_fs23 = require("node:fs");
|
120548
|
-
var
|
120781
|
+
var import_promises21 = require("node:fs/promises");
|
120549
120782
|
var import_node_path49 = __toESM(require("node:path"));
|
120550
120783
|
var import_node_process11 = require("node:process");
|
120551
120784
|
var import_undici13 = __toESM(require_undici());
|
120552
120785
|
|
120553
120786
|
// src/pages/upload.ts
|
120554
120787
|
init_import_meta_url();
|
120555
|
-
var
|
120788
|
+
var import_promises20 = require("node:fs/promises");
|
120556
120789
|
var import_node_path48 = require("node:path");
|
120557
120790
|
|
120558
120791
|
// src/pages/validate.ts
|
120559
120792
|
init_import_meta_url();
|
120560
|
-
var
|
120793
|
+
var import_promises19 = require("node:fs/promises");
|
120561
120794
|
var import_node_path47 = require("node:path");
|
120562
120795
|
var import_mime2 = __toESM(require_mime());
|
120563
120796
|
var import_minimatch = __toESM(require_minimatch());
|
@@ -120591,12 +120824,12 @@ var validate = /* @__PURE__ */ __name(async (args) => {
|
|
120591
120824
|
].map((pattern) => new import_minimatch.Minimatch(pattern));
|
120592
120825
|
const directory = (0, import_node_path47.resolve)(args.directory);
|
120593
120826
|
const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
|
120594
|
-
const files = await (0,
|
120827
|
+
const files = await (0, import_promises19.readdir)(dir);
|
120595
120828
|
await Promise.all(
|
120596
120829
|
files.map(async (file) => {
|
120597
120830
|
const filepath = (0, import_node_path47.join)(dir, file);
|
120598
120831
|
const relativeFilepath = (0, import_node_path47.relative)(startingDir, filepath);
|
120599
|
-
const filestat = await (0,
|
120832
|
+
const filestat = await (0, import_promises19.stat)(filepath);
|
120600
120833
|
for (const minimatch of IGNORE_LIST) {
|
120601
120834
|
if (minimatch.match(relativeFilepath)) {
|
120602
120835
|
return;
|
@@ -120678,8 +120911,8 @@ var Handler11 = /* @__PURE__ */ __name(async ({
|
|
120678
120911
|
skipCaching: skipCaching ?? false
|
120679
120912
|
});
|
120680
120913
|
if (outputManifestPath) {
|
120681
|
-
await (0,
|
120682
|
-
await (0,
|
120914
|
+
await (0, import_promises20.mkdir)((0, import_node_path48.dirname)(outputManifestPath), { recursive: true });
|
120915
|
+
await (0, import_promises20.writeFile)(outputManifestPath, JSON.stringify(manifest));
|
120683
120916
|
}
|
120684
120917
|
logger.log(`\u2728 Upload complete!`);
|
120685
120918
|
}, "Handler");
|
@@ -120768,7 +121001,7 @@ var upload = /* @__PURE__ */ __name(async (args) => {
|
|
120768
121001
|
const payload = await Promise.all(
|
120769
121002
|
bucket.files.map(async (file) => ({
|
120770
121003
|
key: file.hash,
|
120771
|
-
value: (await (0,
|
121004
|
+
value: (await (0, import_promises20.readFile)(file.path)).toString("base64"),
|
120772
121005
|
metadata: {
|
120773
121006
|
contentType: file.contentType
|
120774
121007
|
},
|
@@ -121077,7 +121310,7 @@ async function deploy2({
|
|
121077
121310
|
);
|
121078
121311
|
}
|
121079
121312
|
if (config !== void 0 && config.configPath !== void 0 && config.pages_build_output_dir) {
|
121080
|
-
const configHash = (0, import_node_crypto12.createHash)("sha256").update(await (0,
|
121313
|
+
const configHash = (0, import_node_crypto12.createHash)("sha256").update(await (0, import_promises21.readFile)(config.configPath)).digest("hex");
|
121081
121314
|
const outputDir = import_node_path49.default.relative(
|
121082
121315
|
process.cwd(),
|
121083
121316
|
config.pages_build_output_dir
|
@@ -121546,7 +121779,8 @@ function Options12(yargs) {
|
|
121546
121779
|
},
|
121547
121780
|
"no-bundle": {
|
121548
121781
|
type: "boolean",
|
121549
|
-
default:
|
121782
|
+
default: void 0,
|
121783
|
+
conflicts: "bundle",
|
121550
121784
|
description: "Whether to run bundling on `_worker.js` before deploying"
|
121551
121785
|
},
|
121552
121786
|
config: {
|
@@ -121749,6 +121983,7 @@ To silence this warning, pass in --commit-dirty=true`
|
|
121749
121983
|
commitDirty = isGitDirty;
|
121750
121984
|
}
|
121751
121985
|
}
|
121986
|
+
const enableBundling = args.bundle ?? !(args.noBundle ?? config?.no_bundle);
|
121752
121987
|
const { deploymentResponse, formData } = await deploy2({
|
121753
121988
|
directory,
|
121754
121989
|
accountId,
|
@@ -121758,9 +121993,7 @@ To silence this warning, pass in --commit-dirty=true`
|
|
121758
121993
|
commitHash,
|
121759
121994
|
commitDirty,
|
121760
121995
|
skipCaching: args.skipCaching,
|
121761
|
-
|
121762
|
-
// There is no sane way to get the true value out of yargs, so here we are.
|
121763
|
-
bundle: args.bundle ?? !args.noBundle,
|
121996
|
+
bundle: enableBundling,
|
121764
121997
|
// Sourcemaps from deploy arguments will take precedence so people can try it for one-off deployments without updating their wrangler.toml
|
121765
121998
|
sourceMaps: config?.upload_source_maps || args.uploadSourceMaps,
|
121766
121999
|
args
|
@@ -121805,7 +122038,7 @@ To silence this warning, pass in --commit-dirty=true`
|
|
121805
122038
|
if (failureMessage.includes("Script startup exceeded CPU time limit")) {
|
121806
122039
|
const workerBundle = formData.get("_worker.bundle");
|
121807
122040
|
const filePath = import_node_path50.default.join(getPagesTmpDir(), "_worker.bundle");
|
121808
|
-
await (0,
|
122041
|
+
await (0, import_promises22.writeFile)(filePath, workerBundle.stream());
|
121809
122042
|
await handleStartupError(filePath, getPagesProjectRoot());
|
121810
122043
|
}
|
121811
122044
|
throw new FatalError(
|
@@ -121854,7 +122087,7 @@ __name(promptSelectExistingOrNewProject, "promptSelectExistingOrNewProject");
|
|
121854
122087
|
|
121855
122088
|
// src/pages/deployment-tails.ts
|
121856
122089
|
init_import_meta_url();
|
121857
|
-
var
|
122090
|
+
var import_promises23 = require("node:timers/promises");
|
121858
122091
|
var import_signal_exit5 = __toESM(require_signal_exit());
|
121859
122092
|
|
121860
122093
|
// src/tail/createTail.ts
|
@@ -122373,10 +122606,10 @@ async function Handler13({
|
|
122373
122606
|
while (tail.readyState !== tail.OPEN) {
|
122374
122607
|
switch (tail.readyState) {
|
122375
122608
|
case tail.CONNECTING:
|
122376
|
-
await (0,
|
122609
|
+
await (0, import_promises23.setTimeout)(100);
|
122377
122610
|
break;
|
122378
122611
|
case tail.CLOSING:
|
122379
|
-
await (0,
|
122612
|
+
await (0, import_promises23.setTimeout)(100);
|
122380
122613
|
break;
|
122381
122614
|
case tail.CLOSED:
|
122382
122615
|
sendMetricsEvent("end log stream", {
|
@@ -122562,7 +122795,8 @@ function Options14(yargs) {
|
|
122562
122795
|
},
|
122563
122796
|
"no-bundle": {
|
122564
122797
|
type: "boolean",
|
122565
|
-
default:
|
122798
|
+
default: void 0,
|
122799
|
+
conflicts: "bundle",
|
122566
122800
|
description: "Whether to run bundling on `_worker.js`"
|
122567
122801
|
},
|
122568
122802
|
binding: {
|
@@ -122747,7 +122981,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
122747
122981
|
const workerScriptPath = directory !== void 0 ? (0, import_node_path51.join)(directory, singleWorkerScriptPath) : (0, import_node_path51.resolve)(singleWorkerScriptPath);
|
122748
122982
|
const usingWorkerDirectory = (0, import_node_fs24.existsSync)(workerScriptPath) && (0, import_node_fs24.lstatSync)(workerScriptPath).isDirectory();
|
122749
122983
|
const usingWorkerScript = (0, import_node_fs24.existsSync)(workerScriptPath);
|
122750
|
-
const enableBundling = args.bundle ?? !args.noBundle;
|
122984
|
+
const enableBundling = args.bundle ?? !(args.noBundle ?? config.no_bundle);
|
122751
122985
|
const functionsDirectory = "./functions";
|
122752
122986
|
let usingFunctions = !usingWorkerScript && (0, import_node_fs24.existsSync)(functionsDirectory);
|
122753
122987
|
let scriptPath3 = "";
|
@@ -122755,7 +122989,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
122755
122989
|
args.compatibilityDate ?? config.compatibility_date,
|
122756
122990
|
args.compatibilityFlags ?? config.compatibility_flags ?? [],
|
122757
122991
|
{
|
122758
|
-
noBundle:
|
122992
|
+
noBundle: !enableBundling
|
122759
122993
|
}
|
122760
122994
|
);
|
122761
122995
|
const defineNavigatorUserAgent = isNavigatorDefined(
|
@@ -123379,7 +123613,7 @@ __name(getBindingsFromArgs, "getBindingsFromArgs");
|
|
123379
123613
|
// src/pages/download-config.ts
|
123380
123614
|
init_import_meta_url();
|
123381
123615
|
var import_fs13 = require("fs");
|
123382
|
-
var
|
123616
|
+
var import_promises27 = require("node:fs/promises");
|
123383
123617
|
var import_toml5 = __toESM(require_toml());
|
123384
123618
|
var import_miniflare19 = require("miniflare");
|
123385
123619
|
async function toEnvironment(deploymentConfig, accountId) {
|
@@ -123492,7 +123726,7 @@ __name(toEnvironment, "toEnvironment");
|
|
123492
123726
|
async function writeWranglerToml(toml) {
|
123493
123727
|
let tomlString = import_toml5.default.stringify(toml);
|
123494
123728
|
tomlString = tomlString.split("\n").map((line) => line.trimStart()).join("\n");
|
123495
|
-
await (0,
|
123729
|
+
await (0, import_promises27.writeFile)(
|
123496
123730
|
"wrangler.toml",
|
123497
123731
|
`# Generated by Wrangler on ${/* @__PURE__ */ new Date()}
|
123498
123732
|
${tomlString}`
|
@@ -124506,7 +124740,7 @@ __name(pages, "pages");
|
|
124506
124740
|
|
124507
124741
|
// src/pipelines/index.ts
|
124508
124742
|
init_import_meta_url();
|
124509
|
-
var
|
124743
|
+
var import_promises30 = require("node:timers/promises");
|
124510
124744
|
|
124511
124745
|
// ../../node_modules/.pnpm/@aws-sdk+client-s3@3.721.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
|
124512
124746
|
init_import_meta_url();
|
@@ -128242,14 +128476,14 @@ init_import_meta_url();
|
|
128242
128476
|
init_import_meta_url();
|
128243
128477
|
var import_node_assert21 = __toESM(require("node:assert"));
|
128244
128478
|
var import_node_http2 = __toESM(require("node:http"));
|
128245
|
-
var
|
128479
|
+
var import_promises29 = require("node:timers/promises");
|
128246
128480
|
var API_HEADERS = {
|
128247
128481
|
"Content-Type": "application/json"
|
128248
128482
|
};
|
128249
128483
|
async function generateR2ServiceToken(accountId, bucketName, pipelineName) {
|
128250
128484
|
const controller = new AbortController();
|
128251
128485
|
const signal = controller.signal;
|
128252
|
-
const timeoutPromise = (0,
|
128486
|
+
const timeoutPromise = (0, import_promises29.setTimeout)(12e4, "timeout", { signal });
|
128253
128487
|
const serverPromise = new Promise((resolve24, reject) => {
|
128254
128488
|
const server = import_node_http2.default.createServer(async (request4, response) => {
|
128255
128489
|
(0, import_node_assert21.default)(request4.url, "This request doesn't have a URL");
|
@@ -128922,7 +129156,7 @@ async function verifyBucketAccess(r22, bucketName) {
|
|
128922
129156
|
if (attempt === MAX_ATTEMPTS2) {
|
128923
129157
|
throw error2;
|
128924
129158
|
}
|
128925
|
-
await (0,
|
129159
|
+
await (0, import_promises30.setTimeout)(DELAY_MS);
|
128926
129160
|
}
|
128927
129161
|
}
|
128928
129162
|
}
|
@@ -130687,15 +130921,15 @@ var r2BucketDomainGetCommand = createCommand({
|
|
130687
130921
|
type: "string"
|
130688
130922
|
}
|
130689
130923
|
},
|
130690
|
-
async handler({ bucket, domain:
|
130924
|
+
async handler({ bucket, domain: domain4, jurisdiction }, { config }) {
|
130691
130925
|
const accountId = await requireAuth(config);
|
130692
130926
|
logger.log(
|
130693
|
-
`Retrieving custom domain '${
|
130927
|
+
`Retrieving custom domain '${domain4}' connected to bucket '${bucket}'...`
|
130694
130928
|
);
|
130695
130929
|
const domainResponse = await getCustomDomain(
|
130696
130930
|
accountId,
|
130697
130931
|
bucket,
|
130698
|
-
|
130932
|
+
domain4,
|
130699
130933
|
jurisdiction
|
130700
130934
|
);
|
130701
130935
|
const tableOutput = tableFromCustomDomainListResponse([domainResponse]);
|
@@ -130784,7 +131018,7 @@ var r2BucketDomainAddCommand = createCommand({
|
|
130784
131018
|
const accountId = await requireAuth(config);
|
130785
131019
|
const {
|
130786
131020
|
bucket,
|
130787
|
-
domain:
|
131021
|
+
domain: domain4,
|
130788
131022
|
zoneId,
|
130789
131023
|
minTls = "1.0",
|
130790
131024
|
jurisdiction,
|
@@ -130792,25 +131026,25 @@ var r2BucketDomainAddCommand = createCommand({
|
|
130792
131026
|
} = args;
|
130793
131027
|
if (!force) {
|
130794
131028
|
const confirmedAdd = await confirm(
|
130795
|
-
`Are you sure you want to add the custom domain '${
|
131029
|
+
`Are you sure you want to add the custom domain '${domain4}' to bucket '${bucket}'? The contents of your bucket will be made publicly available at 'https://${domain4}'`
|
130796
131030
|
);
|
130797
131031
|
if (!confirmedAdd) {
|
130798
131032
|
logger.log("Add cancelled.");
|
130799
131033
|
return;
|
130800
131034
|
}
|
130801
131035
|
}
|
130802
|
-
logger.log(`Connecting custom domain '${
|
131036
|
+
logger.log(`Connecting custom domain '${domain4}' to bucket '${bucket}'...`);
|
130803
131037
|
await attachCustomDomainToBucket(
|
130804
131038
|
accountId,
|
130805
131039
|
bucket,
|
130806
131040
|
{
|
130807
|
-
domain:
|
131041
|
+
domain: domain4,
|
130808
131042
|
zoneId,
|
130809
131043
|
minTLS: minTls
|
130810
131044
|
},
|
130811
131045
|
jurisdiction
|
130812
131046
|
);
|
130813
|
-
logger.log(`\u2728 Custom domain '${
|
131047
|
+
logger.log(`\u2728 Custom domain '${domain4}' connected successfully.`);
|
130814
131048
|
}
|
130815
131049
|
});
|
130816
131050
|
var r2BucketDomainRemoveCommand = createCommand({
|
@@ -130846,19 +131080,19 @@ var r2BucketDomainRemoveCommand = createCommand({
|
|
130846
131080
|
},
|
130847
131081
|
async handler(args, { config }) {
|
130848
131082
|
const accountId = await requireAuth(config);
|
130849
|
-
const { bucket, domain:
|
131083
|
+
const { bucket, domain: domain4, jurisdiction, force } = args;
|
130850
131084
|
if (!force) {
|
130851
131085
|
const confirmedRemoval = await confirm(
|
130852
|
-
`Are you sure you want to remove the custom domain '${
|
131086
|
+
`Are you sure you want to remove the custom domain '${domain4}' from bucket '${bucket}'? Your bucket will no longer be available from 'https://${domain4}'`
|
130853
131087
|
);
|
130854
131088
|
if (!confirmedRemoval) {
|
130855
131089
|
logger.log("Removal cancelled.");
|
130856
131090
|
return;
|
130857
131091
|
}
|
130858
131092
|
}
|
130859
|
-
logger.log(`Removing custom domain '${
|
130860
|
-
await removeCustomDomainFromBucket(accountId, bucket,
|
130861
|
-
logger.log(`Custom domain '${
|
131093
|
+
logger.log(`Removing custom domain '${domain4}' from bucket '${bucket}'...`);
|
131094
|
+
await removeCustomDomainFromBucket(accountId, bucket, domain4, jurisdiction);
|
131095
|
+
logger.log(`Custom domain '${domain4}' removed successfully.`);
|
130862
131096
|
}
|
130863
131097
|
});
|
130864
131098
|
var r2BucketDomainUpdateCommand = createCommand({
|
@@ -130893,19 +131127,19 @@ var r2BucketDomainUpdateCommand = createCommand({
|
|
130893
131127
|
},
|
130894
131128
|
async handler(args, { config }) {
|
130895
131129
|
const accountId = await requireAuth(config);
|
130896
|
-
const { bucket, domain:
|
130897
|
-
logger.log(`Updating custom domain '${
|
131130
|
+
const { bucket, domain: domain4, minTls, jurisdiction } = args;
|
131131
|
+
logger.log(`Updating custom domain '${domain4}' for bucket '${bucket}'...`);
|
130898
131132
|
await configureCustomDomainSettings(
|
130899
131133
|
accountId,
|
130900
131134
|
bucket,
|
130901
|
-
|
131135
|
+
domain4,
|
130902
131136
|
{
|
130903
|
-
domain:
|
131137
|
+
domain: domain4,
|
130904
131138
|
minTLS: minTls
|
130905
131139
|
},
|
130906
131140
|
jurisdiction
|
130907
131141
|
);
|
130908
|
-
logger.log(`\u2728 Custom domain '${
|
131142
|
+
logger.log(`\u2728 Custom domain '${domain4}' updated successfully.`);
|
130909
131143
|
}
|
130910
131144
|
});
|
130911
131145
|
|
@@ -139648,9 +139882,9 @@ var NODE_VERSION = parseSemver(process.versions.node);
|
|
139648
139882
|
|
139649
139883
|
// ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/async/domain.js
|
139650
139884
|
init_import_meta_url();
|
139651
|
-
var
|
139885
|
+
var domain3 = __toESM(require("domain"));
|
139652
139886
|
function getActiveDomain() {
|
139653
|
-
return
|
139887
|
+
return domain3.active;
|
139654
139888
|
}
|
139655
139889
|
__name(getActiveDomain, "getActiveDomain");
|
139656
139890
|
function getCurrentHub2() {
|
@@ -139673,7 +139907,7 @@ function runWithAsyncContext2(callback, options32) {
|
|
139673
139907
|
if (activeDomain && _optionalChain([options32, "optionalAccess", (_4) => _4.reuseExisting])) {
|
139674
139908
|
return callback();
|
139675
139909
|
}
|
139676
|
-
const local =
|
139910
|
+
const local = domain3.create();
|
139677
139911
|
const parentHub = activeDomain ? getHubFromCarrier(activeDomain) : void 0;
|
139678
139912
|
const newHub = createNewHub(parentHub);
|
139679
139913
|
setHubOnCarrier(local, newHub);
|
@@ -141775,7 +142009,7 @@ __name(closeSentry, "closeSentry");
|
|
141775
142009
|
|
141776
142010
|
// src/tail/index.ts
|
141777
142011
|
init_import_meta_url();
|
141778
|
-
var
|
142012
|
+
var import_promises31 = require("node:timers/promises");
|
141779
142013
|
var import_signal_exit6 = __toESM(require_signal_exit());
|
141780
142014
|
var tailCommand = createCommand({
|
141781
142015
|
metadata: {
|
@@ -141908,10 +142142,10 @@ var tailCommand = createCommand({
|
|
141908
142142
|
while (tail.readyState !== tail.OPEN) {
|
141909
142143
|
switch (tail.readyState) {
|
141910
142144
|
case tail.CONNECTING:
|
141911
|
-
await (0,
|
142145
|
+
await (0, import_promises31.setTimeout)(100);
|
141912
142146
|
break;
|
141913
142147
|
case tail.CLOSING:
|
141914
|
-
await (0,
|
142148
|
+
await (0, import_promises31.setTimeout)(100);
|
141915
142149
|
break;
|
141916
142150
|
case tail.CLOSED:
|
141917
142151
|
sendMetricsEvent("end log stream", {
|
@@ -142060,10 +142294,26 @@ function getVarsForDev(config, env6, silent = false) {
|
|
142060
142294
|
}
|
142061
142295
|
__name(getVarsForDev, "getVarsForDev");
|
142062
142296
|
|
142297
|
+
// src/process-env.ts
|
142298
|
+
init_import_meta_url();
|
142299
|
+
function isProcessEnvPopulated(compatibility_date, compatibility_flags = []) {
|
142300
|
+
if (compatibility_flags.includes("nodejs_compat_populate_process_env") && compatibility_flags.includes("nodejs_compat_do_not_populate_process_env")) {
|
142301
|
+
throw new UserError("Can't both enable and disable a flag");
|
142302
|
+
}
|
142303
|
+
if (compatibility_flags.includes("nodejs_compat_populate_process_env") && compatibility_flags.includes("nodejs_compat")) {
|
142304
|
+
return true;
|
142305
|
+
}
|
142306
|
+
if (compatibility_flags.includes("nodejs_compat_do_not_populate_process_env")) {
|
142307
|
+
return false;
|
142308
|
+
}
|
142309
|
+
return compatibility_flags.includes("nodejs_compat") && !!compatibility_date && compatibility_date >= "2025-04-01";
|
142310
|
+
}
|
142311
|
+
__name(isProcessEnvPopulated, "isProcessEnvPopulated");
|
142312
|
+
|
142063
142313
|
// src/type-generation/runtime/index.ts
|
142064
142314
|
init_import_meta_url();
|
142065
142315
|
var import_fs22 = require("fs");
|
142066
|
-
var
|
142316
|
+
var import_promises32 = require("fs/promises");
|
142067
142317
|
var import_miniflare20 = require("miniflare");
|
142068
142318
|
var import_workerd = require("workerd");
|
142069
142319
|
var DEFAULT_OUTFILE_RELATIVE_PATH = "worker-configuration.d.ts";
|
@@ -142076,7 +142326,7 @@ async function generateRuntimeTypes({
|
|
142076
142326
|
}
|
142077
142327
|
const header = `// Runtime types generated with workerd@${import_workerd.version} ${compatibility_date} ${compatibility_flags.sort().join(",")}`;
|
142078
142328
|
try {
|
142079
|
-
const lines = (await (0,
|
142329
|
+
const lines = (await (0, import_promises32.readFile)(outFile, "utf8")).split("\n");
|
142080
142330
|
const existingHeader = lines.find(
|
142081
142331
|
(line) => line.startsWith("// Runtime types generated with workerd@")
|
142082
142332
|
);
|
@@ -142379,6 +142629,7 @@ function generateImportSpecifier(from, to) {
|
|
142379
142629
|
}
|
142380
142630
|
__name(generateImportSpecifier, "generateImportSpecifier");
|
142381
142631
|
async function generateEnvTypes(config, args, envInterface, outputPath, entrypoint, log2 = true) {
|
142632
|
+
const stringKeys = [];
|
142382
142633
|
const secrets = getVarsForDev(
|
142383
142634
|
// We do not want `getVarsForDev()` to merge in the standard vars into the dev vars
|
142384
142635
|
// because we want to be able to work with secrets differently to vars.
|
@@ -142443,10 +142694,12 @@ async function generateEnvTypes(config, args, envInterface, outputPath, entrypoi
|
|
142443
142694
|
constructTypeKey(varName),
|
142444
142695
|
varValues.length === 1 ? varValues[0] : varValues.join(" | ")
|
142445
142696
|
]);
|
142697
|
+
stringKeys.push(varName);
|
142446
142698
|
}
|
142447
142699
|
}
|
142448
142700
|
for (const secretName in configToDTS.secrets) {
|
142449
142701
|
envTypeStructure.push([constructTypeKey(secretName), "string"]);
|
142702
|
+
stringKeys.push(secretName);
|
142450
142703
|
}
|
142451
142704
|
if (configToDTS.durable_objects?.bindings) {
|
142452
142705
|
const importPath = entrypoint?.file ? generateImportSpecifier(fullOutputPath, entrypoint.file) : void 0;
|
@@ -142612,7 +142865,10 @@ async function generateEnvTypes(config, args, envInterface, outputPath, entrypoi
|
|
142612
142865
|
entrypointFormat,
|
142613
142866
|
envInterface,
|
142614
142867
|
envTypeStructure.map(([key, value]) => `${key}: ${value};`),
|
142615
|
-
modulesTypeStructure
|
142868
|
+
modulesTypeStructure,
|
142869
|
+
stringKeys,
|
142870
|
+
config.compatibility_date,
|
142871
|
+
config.compatibility_flags
|
142616
142872
|
);
|
142617
142873
|
const hash = (0, import_node_crypto13.createHash)("sha256").update(consoleOutput).digest("hex").slice(0, 32);
|
142618
142874
|
const envHeader = `// Generated by Wrangler by running \`${wranglerCommandUsed}\` (hash: ${hash})`;
|
@@ -142650,16 +142906,29 @@ var checkPath = /* @__PURE__ */ __name((path69) => {
|
|
142650
142906
|
}
|
142651
142907
|
}
|
142652
142908
|
}, "checkPath");
|
142653
|
-
function generateTypeStrings(formatType, envInterface, envTypeStructure, modulesTypeStructure) {
|
142909
|
+
function generateTypeStrings(formatType, envInterface, envTypeStructure, modulesTypeStructure, stringKeys, compatibilityDate, compatibilityFlags) {
|
142654
142910
|
let baseContent = "";
|
142655
142911
|
let eslintDisable = "";
|
142912
|
+
let processEnv = "";
|
142656
142913
|
if (formatType === "modules") {
|
142657
142914
|
if (envTypeStructure.length === 0) {
|
142658
|
-
eslintDisable = "// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type\n";
|
142915
|
+
eslintDisable = " // eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type\n";
|
142659
142916
|
}
|
142660
|
-
|
142661
|
-
|
142917
|
+
if (isProcessEnvPopulated(compatibilityDate, compatibilityFlags) && stringKeys.length > 0) {
|
142918
|
+
processEnv = `
|
142919
|
+
type StringifyValues<EnvType extends Record<string, unknown>> = {
|
142920
|
+
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
|
142921
|
+
};
|
142922
|
+
declare namespace NodeJS {
|
142923
|
+
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, ${stringKeys.map((k6) => `"${k6}"`).join(" | ")}>> {}
|
142662
142924
|
}`;
|
142925
|
+
}
|
142926
|
+
baseContent = `declare namespace Cloudflare {
|
142927
|
+
${eslintDisable} interface Env {${envTypeStructure.map((value) => `
|
142928
|
+
${value}`).join("")}
|
142929
|
+
}
|
142930
|
+
}
|
142931
|
+
interface ${envInterface} extends Cloudflare.Env {}${processEnv}`;
|
142663
142932
|
} else {
|
142664
142933
|
baseContent = `export {};
|
142665
142934
|
declare global {
|
@@ -142668,7 +142937,7 @@ ${envTypeStructure.map((value) => ` const ${value}`).join("\n")}
|
|
142668
142937
|
}
|
142669
142938
|
const modulesContent = modulesTypeStructure.join("\n");
|
142670
142939
|
return {
|
142671
|
-
fileContent: `${
|
142940
|
+
fileContent: `${baseContent}
|
142672
142941
|
${modulesContent}`,
|
142673
142942
|
consoleOutput: `${baseContent}
|
142674
142943
|
${modulesContent}`
|
@@ -148666,7 +148935,7 @@ ${tryRunningItIn}${oneOfThese}`
|
|
148666
148935
|
const controller = new AbortController();
|
148667
148936
|
await Promise.race([
|
148668
148937
|
Promise.allSettled(dispatcher?.requests ?? []),
|
148669
|
-
(0,
|
148938
|
+
(0, import_promises33.setTimeout)(1e3, void 0, controller)
|
148670
148939
|
// Ensure we don't hang indefinitely
|
148671
148940
|
]).then(() => controller.abort());
|
148672
148941
|
} catch (e7) {
|
@@ -148730,7 +148999,7 @@ async function checkStartupHandler({
|
|
148730
148999
|
startMessage: "Analysing",
|
148731
149000
|
endMessage: source_default.green("Startup phase analysed")
|
148732
149001
|
});
|
148733
|
-
await (0,
|
149002
|
+
await (0, import_promises35.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
|
148734
149003
|
log(
|
148735
149004
|
`CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
|
148736
149005
|
);
|
@@ -148786,7 +149055,13 @@ async function getEntryValue(entry) {
|
|
148786
149055
|
__name(getEntryValue, "getEntryValue");
|
148787
149056
|
function getModuleType(entry) {
|
148788
149057
|
if (entry instanceof Blob) {
|
148789
|
-
|
149058
|
+
const type = ModuleTypeToRuleType[mimeTypeModuleType[entry.type]];
|
149059
|
+
if (!type) {
|
149060
|
+
throw new Error(
|
149061
|
+
`Unable to determine module type for ${entry.type} mime type`
|
149062
|
+
);
|
149063
|
+
}
|
149064
|
+
return type;
|
148790
149065
|
} else {
|
148791
149066
|
return "Text";
|
148792
149067
|
}
|
@@ -148803,7 +149078,7 @@ async function convertWorkerBundleToModules(workerBundle) {
|
|
148803
149078
|
}
|
148804
149079
|
__name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
|
148805
149080
|
async function parseFormDataFromFile(file) {
|
148806
|
-
const bundle = await (0,
|
149081
|
+
const bundle = await (0, import_promises34.readFile)(file);
|
148807
149082
|
const firstLine = bundle.findIndex((v7) => v7 === 10);
|
148808
149083
|
const boundary = Uint8Array.prototype.slice.call(bundle, 2, firstLine).toString();
|
148809
149084
|
return await new Response(bundle, {
|
@@ -148901,7 +149176,7 @@ async function handleStartupError(workerBundle, projectRoot) {
|
|
148901
149176
|
projectRoot ?? process.cwd(),
|
148902
149177
|
import_node_path58.default.join(tmpDir.path, `worker.cpuprofile`)
|
148903
149178
|
);
|
148904
|
-
await (0,
|
149179
|
+
await (0, import_promises36.writeFile)(profile, JSON.stringify(cpuProfile));
|
148905
149180
|
throw new UserError(esm_default2`
|
148906
149181
|
Your Worker failed validation because it exceeded startup limits.
|
148907
149182
|
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
|
@@ -149030,18 +149305,18 @@ async function publishCustomDomains(workerUrl, accountId, domains) {
|
|
149030
149305
|
}
|
149031
149306
|
);
|
149032
149307
|
const updatesRequired = changeset.updated.filter(
|
149033
|
-
(
|
149308
|
+
(domain4) => domain4.modified
|
149034
149309
|
);
|
149035
149310
|
if (updatesRequired.length > 0) {
|
149036
149311
|
const existing = await Promise.all(
|
149037
149312
|
updatesRequired.map(
|
149038
|
-
(
|
149039
|
-
`/accounts/${accountId}/workers/domains/records/${
|
149313
|
+
(domain4) => fetchResult(
|
149314
|
+
`/accounts/${accountId}/workers/domains/records/${domain4.id}`
|
149040
149315
|
)
|
149041
149316
|
)
|
149042
149317
|
);
|
149043
149318
|
const existingRendered = existing.map(
|
149044
|
-
(
|
149319
|
+
(domain4) => ` \u2022 ${domain4.hostname} (used as a domain for "${domain4.service}")`
|
149045
149320
|
).join("\n");
|
149046
149321
|
const message = `Custom Domains already exist for these domains:
|
149047
149322
|
${existingRendered}
|
@@ -149052,7 +149327,7 @@ Update them to point to this script instead?`;
|
|
149052
149327
|
config.override_existing_origin = true;
|
149053
149328
|
}
|
149054
149329
|
if (changeset.conflicting.length > 0) {
|
149055
|
-
const conflicitingRendered = changeset.conflicting.map((
|
149330
|
+
const conflicitingRendered = changeset.conflicting.map((domain4) => ` \u2022 ${domain4.hostname}`).join("\n");
|
149056
149331
|
const message = `You already have DNS records that conflict for these Custom Domains:
|
149057
149332
|
${conflicitingRendered}
|
149058
149333
|
Update them to point to this script instead?`;
|
@@ -149069,7 +149344,7 @@ Update them to point to this script instead?`;
|
|
149069
149344
|
"Content-Type": "application/json"
|
149070
149345
|
}
|
149071
149346
|
});
|
149072
|
-
return domains.map((
|
149347
|
+
return domains.map((domain4) => renderRoute(domain4));
|
149073
149348
|
}
|
149074
149349
|
__name(publishCustomDomains, "publishCustomDomains");
|
149075
149350
|
async function deploy(props) {
|
@@ -149324,6 +149599,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
149324
149599
|
bindings,
|
149325
149600
|
migrations,
|
149326
149601
|
modules,
|
149602
|
+
containers: config.containers ?? void 0,
|
149327
149603
|
sourceMaps: uploadSourceMaps ? loadSourceMaps(main2, modules, bundle) : void 0,
|
149328
149604
|
compatibility_date: props.compatibilityDate ?? config.compatibility_date,
|
149329
149605
|
compatibility_flags: compatibilityFlags,
|
@@ -149362,7 +149638,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
149362
149638
|
maskedVars[key] = "(hidden)";
|
149363
149639
|
}
|
149364
149640
|
}
|
149365
|
-
const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && prod && format9 === "modules" && migrations === void 0 && !config.first_party_worker;
|
149641
|
+
const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && prod && format9 === "modules" && migrations === void 0 && !config.first_party_worker && config.containers === void 0;
|
149366
149642
|
let workerBundle;
|
149367
149643
|
if (props.dryRun) {
|
149368
149644
|
workerBundle = createWorkerUploadForm(worker);
|
@@ -149842,7 +150118,7 @@ var syncAssets = /* @__PURE__ */ __name(async (accountId, assetDirectory, script
|
|
149842
150118
|
payload.append(
|
149843
150119
|
manifestEntry[1].hash,
|
149844
150120
|
new import_undici22.File(
|
149845
|
-
[(await (0,
|
150121
|
+
[(await (0, import_promises37.readFile)(absFilePath)).toString("base64")],
|
149846
150122
|
manifestEntry[1].hash,
|
149847
150123
|
{
|
149848
150124
|
// Most formdata body encoders (incl. undici's) will override with "application/octet-stream" if you use a falsy value here
|
@@ -149934,7 +150210,7 @@ Assets already uploaded have been saved, so the next attempt will automatically
|
|
149934
150210
|
return completionJwt;
|
149935
150211
|
}, "syncAssets");
|
149936
150212
|
var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
|
149937
|
-
const files = await (0,
|
150213
|
+
const files = await (0, import_promises37.readdir)(dir, { recursive: true });
|
149938
150214
|
const manifest = {};
|
149939
150215
|
let counter = 0;
|
149940
150216
|
const { assetsIgnoreFunction, assetsIgnoreFilePresent } = await createAssetsIgnoreFunction(dir);
|
@@ -149945,7 +150221,7 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
|
|
149945
150221
|
return;
|
149946
150222
|
}
|
149947
150223
|
const filepath = path62.join(dir, relativeFilepath);
|
149948
|
-
const filestat = await (0,
|
150224
|
+
const filestat = await (0, import_promises37.stat)(filepath);
|
149949
150225
|
if (filestat.isSymbolicLink() || filestat.isDirectory()) {
|
149950
150226
|
return;
|
149951
150227
|
} else {
|
@@ -150050,8 +150326,10 @@ ${resolvedAssetsPath}`,
|
|
150050
150326
|
"Cannot set run_worker_first=true without a Worker script.\nPlease remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (`main`)."
|
150051
150327
|
);
|
150052
150328
|
}
|
150053
|
-
const redirects = maybeGetFile(
|
150054
|
-
|
150329
|
+
const redirects = maybeGetFile(
|
150330
|
+
path62.join(resolvedAssetsPath, REDIRECTS_FILENAME)
|
150331
|
+
);
|
150332
|
+
const headers = maybeGetFile(path62.join(resolvedAssetsPath, HEADERS_FILENAME));
|
150055
150333
|
const assetConfig = {
|
150056
150334
|
html_handling: config.assets?.html_handling,
|
150057
150335
|
not_found_handling: config.assets?.not_found_handling
|
@@ -150115,7 +150393,7 @@ init_import_meta_url();
|
|
150115
150393
|
// src/dev-registry/file-registry.ts
|
150116
150394
|
init_import_meta_url();
|
150117
150395
|
var import_node_fs32 = require("node:fs");
|
150118
|
-
var
|
150396
|
+
var import_promises38 = require("node:fs/promises");
|
150119
150397
|
var import_node_path60 = __toESM(require("node:path"));
|
150120
150398
|
var util3 = __toESM(require("node:util"));
|
150121
150399
|
init_esm2();
|
@@ -150187,8 +150465,8 @@ async function registerWorker(name2, definition) {
|
|
150187
150465
|
if (existingHeartbeat) {
|
150188
150466
|
clearInterval(existingHeartbeat);
|
150189
150467
|
}
|
150190
|
-
await (0,
|
150191
|
-
await (0,
|
150468
|
+
await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
|
150469
|
+
await (0, import_promises38.writeFile)(
|
150192
150470
|
import_node_path60.default.join(DEV_REGISTRY_PATH, name2),
|
150193
150471
|
// We don't currently do anything with the stored Wrangler version,
|
150194
150472
|
// but if we need to make breaking changes to this format in the future
|
@@ -150211,7 +150489,7 @@ async function getRegisteredWorkers() {
|
|
150211
150489
|
__name(getRegisteredWorkers, "getRegisteredWorkers");
|
150212
150490
|
async function unregisterWorker(name2) {
|
150213
150491
|
try {
|
150214
|
-
await (0,
|
150492
|
+
await (0, import_promises38.unlink)(import_node_path60.default.join(DEV_REGISTRY_PATH, name2));
|
150215
150493
|
const existingHeartbeat = heartbeats.get(name2);
|
150216
150494
|
if (existingHeartbeat) {
|
150217
150495
|
clearInterval(existingHeartbeat);
|
@@ -150223,17 +150501,17 @@ async function unregisterWorker(name2) {
|
|
150223
150501
|
}
|
150224
150502
|
__name(unregisterWorker, "unregisterWorker");
|
150225
150503
|
async function loadWorkerDefinitions() {
|
150226
|
-
await (0,
|
150504
|
+
await (0, import_promises38.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
|
150227
150505
|
globalWorkers ??= {};
|
150228
150506
|
const newWorkers = /* @__PURE__ */ new Set();
|
150229
|
-
const workerDefinitions = await (0,
|
150507
|
+
const workerDefinitions = await (0, import_promises38.readdir)(DEV_REGISTRY_PATH);
|
150230
150508
|
for (const workerName of workerDefinitions) {
|
150231
150509
|
try {
|
150232
|
-
const file = await (0,
|
150510
|
+
const file = await (0, import_promises38.readFile)(
|
150233
150511
|
import_node_path60.default.join(DEV_REGISTRY_PATH, workerName),
|
150234
150512
|
"utf8"
|
150235
150513
|
);
|
150236
|
-
const stats = await (0,
|
150514
|
+
const stats = await (0, import_promises38.stat)(import_node_path60.default.join(DEV_REGISTRY_PATH, workerName));
|
150237
150515
|
if (stats.mtime.getTime() < Date.now() - 6e5) {
|
150238
150516
|
await unregisterWorker(workerName);
|
150239
150517
|
} else {
|
@@ -153434,7 +153712,7 @@ function deepFreeze(obj) {
|
|
153434
153712
|
});
|
153435
153713
|
}
|
153436
153714
|
__name(deepFreeze, "deepFreeze");
|
153437
|
-
function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6) {
|
153715
|
+
function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options32) {
|
153438
153716
|
const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env: env6 }) : configOrConfigPath;
|
153439
153717
|
const modulesRules = config.rules.concat(DEFAULT_MODULE_RULES).map((rule) => ({
|
153440
153718
|
type: rule.type,
|
@@ -153450,7 +153728,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6) {
|
|
153450
153728
|
services: [],
|
153451
153729
|
serviceBindings: {},
|
153452
153730
|
migrations: config.migrations,
|
153453
|
-
imagesLocalMode:
|
153731
|
+
imagesLocalMode: !!options32?.imagesLocalMode
|
153454
153732
|
});
|
153455
153733
|
if (bindings.services !== void 0) {
|
153456
153734
|
bindingOptions.serviceBindings = Object.fromEntries(
|