wrangler 4.28.0 → 4.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/wrangler-dist/cli.d.ts +267 -11
- package/wrangler-dist/cli.js +612 -442
- package/wrangler-dist/metafile-cjs.json +1 -1
package/wrangler-dist/cli.js
CHANGED
@@ -16970,7 +16970,7 @@ var require_response = __commonJS({
|
|
16970
16970
|
var assert45 = require("assert");
|
16971
16971
|
var { types } = require("util");
|
16972
16972
|
var textEncoder = new TextEncoder("utf-8");
|
16973
|
-
var
|
16973
|
+
var Response12 = class _Response {
|
16974
16974
|
static {
|
16975
16975
|
__name(this, "Response");
|
16976
16976
|
}
|
@@ -17142,13 +17142,13 @@ var require_response = __commonJS({
|
|
17142
17142
|
response.#state = newState;
|
17143
17143
|
}
|
17144
17144
|
};
|
17145
|
-
var { getResponseHeaders, setResponseHeaders, getResponseState, setResponseState } =
|
17146
|
-
Reflect.deleteProperty(
|
17147
|
-
Reflect.deleteProperty(
|
17148
|
-
Reflect.deleteProperty(
|
17149
|
-
Reflect.deleteProperty(
|
17150
|
-
mixinBody(
|
17151
|
-
Object.defineProperties(
|
17145
|
+
var { getResponseHeaders, setResponseHeaders, getResponseState, setResponseState } = Response12;
|
17146
|
+
Reflect.deleteProperty(Response12, "getResponseHeaders");
|
17147
|
+
Reflect.deleteProperty(Response12, "setResponseHeaders");
|
17148
|
+
Reflect.deleteProperty(Response12, "getResponseState");
|
17149
|
+
Reflect.deleteProperty(Response12, "setResponseState");
|
17150
|
+
mixinBody(Response12, getResponseState);
|
17151
|
+
Object.defineProperties(Response12.prototype, {
|
17152
17152
|
type: kEnumerableProperty,
|
17153
17153
|
url: kEnumerableProperty,
|
17154
17154
|
status: kEnumerableProperty,
|
@@ -17164,7 +17164,7 @@ var require_response = __commonJS({
|
|
17164
17164
|
configurable: true
|
17165
17165
|
}
|
17166
17166
|
});
|
17167
|
-
Object.defineProperties(
|
17167
|
+
Object.defineProperties(Response12, {
|
17168
17168
|
json: kEnumerableProperty,
|
17169
17169
|
redirect: kEnumerableProperty,
|
17170
17170
|
error: kEnumerableProperty
|
@@ -17305,7 +17305,7 @@ var require_response = __commonJS({
|
|
17305
17305
|
}
|
17306
17306
|
__name(initializeResponse, "initializeResponse");
|
17307
17307
|
function fromInnerResponse(innerResponse, guard) {
|
17308
|
-
const response = new
|
17308
|
+
const response = new Response12(kConstruct);
|
17309
17309
|
setResponseState(response, innerResponse);
|
17310
17310
|
const headers = new Headers5(kConstruct);
|
17311
17311
|
setResponseHeaders(response, headers);
|
@@ -17360,14 +17360,14 @@ var require_response = __commonJS({
|
|
17360
17360
|
converter: webidl.converters.HeadersInit
|
17361
17361
|
}
|
17362
17362
|
]);
|
17363
|
-
webidl.is.Response = webidl.util.MakeTypeAssertion(
|
17363
|
+
webidl.is.Response = webidl.util.MakeTypeAssertion(Response12);
|
17364
17364
|
module3.exports = {
|
17365
17365
|
isNetworkError,
|
17366
17366
|
makeNetworkError,
|
17367
17367
|
makeResponse,
|
17368
17368
|
makeAppropriateNetworkError,
|
17369
17369
|
filterResponse,
|
17370
|
-
Response:
|
17370
|
+
Response: Response12,
|
17371
17371
|
cloneResponse,
|
17372
17372
|
fromInnerResponse,
|
17373
17373
|
getResponseState
|
@@ -18250,7 +18250,7 @@ var require_fetch = __commonJS({
|
|
18250
18250
|
finalizeAndReportTiming(response, "fetch");
|
18251
18251
|
}
|
18252
18252
|
__name(handleFetchDone, "handleFetchDone");
|
18253
|
-
function
|
18253
|
+
function fetch13(input, init3 = void 0) {
|
18254
18254
|
webidl.argumentLengthCheck(arguments, 1, "globalThis.fetch");
|
18255
18255
|
let p6 = createDeferredPromise();
|
18256
18256
|
let requestObject;
|
@@ -18307,7 +18307,7 @@ var require_fetch = __commonJS({
|
|
18307
18307
|
});
|
18308
18308
|
return p6.promise;
|
18309
18309
|
}
|
18310
|
-
__name(
|
18310
|
+
__name(fetch13, "fetch");
|
18311
18311
|
function finalizeAndReportTiming(response, initiatorType = "other") {
|
18312
18312
|
if (response.type === "error" && response.aborted) {
|
18313
18313
|
return;
|
@@ -19222,7 +19222,7 @@ var require_fetch = __commonJS({
|
|
19222
19222
|
}
|
19223
19223
|
__name(httpNetworkFetch, "httpNetworkFetch");
|
19224
19224
|
module3.exports = {
|
19225
|
-
fetch:
|
19225
|
+
fetch: fetch13,
|
19226
19226
|
Fetch,
|
19227
19227
|
fetching,
|
19228
19228
|
finalizeAndReportTiming
|
@@ -23168,7 +23168,7 @@ var require_undici = __commonJS({
|
|
23168
23168
|
module3.exports.setGlobalDispatcher = setGlobalDispatcher2;
|
23169
23169
|
module3.exports.getGlobalDispatcher = getGlobalDispatcher2;
|
23170
23170
|
var fetchImpl = require_fetch().fetch;
|
23171
|
-
module3.exports.fetch = /* @__PURE__ */ __name(async function
|
23171
|
+
module3.exports.fetch = /* @__PURE__ */ __name(async function fetch13(init3, options = void 0) {
|
23172
23172
|
try {
|
23173
23173
|
return await fetchImpl(init3, options);
|
23174
23174
|
} catch (err) {
|
@@ -23923,7 +23923,8 @@ var init_OpenAPI = __esm({
|
|
23923
23923
|
USERNAME: void 0,
|
23924
23924
|
PASSWORD: void 0,
|
23925
23925
|
HEADERS: void 0,
|
23926
|
-
ENCODE_PATH: void 0
|
23926
|
+
ENCODE_PATH: void 0,
|
23927
|
+
LOGGER: void 0
|
23927
23928
|
};
|
23928
23929
|
}
|
23929
23930
|
});
|
@@ -24387,7 +24388,7 @@ var init_UpdateApplicationRolloutRequest = __esm({
|
|
24387
24388
|
});
|
24388
24389
|
|
24389
24390
|
// ../containers-shared/src/client/core/request.ts
|
24390
|
-
var isDefined, isString, isStringWithValue, isBlob, base64, getQueryString, getUrl, getFormData, resolve5, getHeaders, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, request;
|
24391
|
+
var isDefined, isString, isStringWithValue, isBlob, base64, getQueryString, getUrl, getFormData, resolve5, getHeaders, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, request, debugLogRequest, debugLogResponse;
|
24391
24392
|
var init_request = __esm({
|
24392
24393
|
"../containers-shared/src/client/core/request.ts"() {
|
24393
24394
|
init_import_meta_url();
|
@@ -24623,6 +24624,7 @@ var init_request = __esm({
|
|
24623
24624
|
const formData = getFormData(options);
|
24624
24625
|
const body = getRequestBody(options);
|
24625
24626
|
const headers = await getHeaders(config, options);
|
24627
|
+
debugLogRequest(config, url4, headers, formData ?? body ?? {});
|
24626
24628
|
if (!onCancel.isCancelled) {
|
24627
24629
|
const response = await sendRequest(
|
24628
24630
|
config,
|
@@ -24655,6 +24657,7 @@ var init_request = __esm({
|
|
24655
24657
|
body: responseHeader ?? responseBody
|
24656
24658
|
};
|
24657
24659
|
}
|
24660
|
+
debugLogResponse(config, result);
|
24658
24661
|
catchErrorCodes(options, result);
|
24659
24662
|
resolve25(result.body);
|
24660
24663
|
}
|
@@ -24663,6 +24666,33 @@ var init_request = __esm({
|
|
24663
24666
|
}
|
24664
24667
|
});
|
24665
24668
|
}, "request");
|
24669
|
+
debugLogRequest = /* @__PURE__ */ __name(async (config, url4, headers, body) => {
|
24670
|
+
config.LOGGER?.debug(`-- START CF API REQUEST: ${url4}`);
|
24671
|
+
const logHeaders = new Headers(headers);
|
24672
|
+
logHeaders.delete("Authorization");
|
24673
|
+
config.LOGGER?.debugWithSanitization(
|
24674
|
+
"HEADERS:",
|
24675
|
+
JSON.stringify(logHeaders, null, 2)
|
24676
|
+
);
|
24677
|
+
config.LOGGER?.debugWithSanitization(
|
24678
|
+
"BODY:",
|
24679
|
+
JSON.stringify(
|
24680
|
+
body instanceof FormData ? await new Response(body).text() : body,
|
24681
|
+
null,
|
24682
|
+
2
|
24683
|
+
)
|
24684
|
+
);
|
24685
|
+
config.LOGGER?.debug("-- END CF API REQUEST");
|
24686
|
+
}, "debugLogRequest");
|
24687
|
+
debugLogResponse = /* @__PURE__ */ __name((config, response) => {
|
24688
|
+
config.LOGGER?.debug(
|
24689
|
+
"-- START CF API RESPONSE:",
|
24690
|
+
response.statusText,
|
24691
|
+
response.status
|
24692
|
+
);
|
24693
|
+
config.LOGGER?.debugWithSanitization("RESPONSE:", response.body);
|
24694
|
+
config.LOGGER?.debug("-- END CF API RESPONSE");
|
24695
|
+
}, "debugLogResponse");
|
24666
24696
|
}
|
24667
24697
|
});
|
24668
24698
|
|
@@ -33117,6 +33147,38 @@ var require_signal_exit = __commonJS({
|
|
33117
33147
|
}
|
33118
33148
|
});
|
33119
33149
|
|
33150
|
+
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
33151
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
33152
|
+
const pattern = [
|
33153
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
33154
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
33155
|
+
].join("|");
|
33156
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
33157
|
+
}
|
33158
|
+
var init_ansi_regex = __esm({
|
33159
|
+
"../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js"() {
|
33160
|
+
init_import_meta_url();
|
33161
|
+
__name(ansiRegex, "ansiRegex");
|
33162
|
+
}
|
33163
|
+
});
|
33164
|
+
|
33165
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
33166
|
+
function stripAnsi2(string) {
|
33167
|
+
if (typeof string !== "string") {
|
33168
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
33169
|
+
}
|
33170
|
+
return string.replace(regex, "");
|
33171
|
+
}
|
33172
|
+
var regex;
|
33173
|
+
var init_strip_ansi = __esm({
|
33174
|
+
"../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js"() {
|
33175
|
+
init_import_meta_url();
|
33176
|
+
init_ansi_regex();
|
33177
|
+
regex = ansiRegex();
|
33178
|
+
__name(stripAnsi2, "stripAnsi");
|
33179
|
+
}
|
33180
|
+
});
|
33181
|
+
|
33120
33182
|
// src/utils/filesystem.ts
|
33121
33183
|
async function ensureDirectoryExists(filepath) {
|
33122
33184
|
const dirpath = import_path6.default.dirname(filepath);
|
@@ -33148,7 +33210,7 @@ function getDebugFilepath() {
|
|
33148
33210
|
async function appendToDebugLogFile(messageLevel, message) {
|
33149
33211
|
const entry = `
|
33150
33212
|
--- ${(/* @__PURE__ */ new Date()).toISOString()} ${messageLevel}
|
33151
|
-
${message}
|
33213
|
+
${stripAnsi2(message)}
|
33152
33214
|
---
|
33153
33215
|
`;
|
33154
33216
|
if (!hasLoggedLocation) {
|
@@ -33187,6 +33249,7 @@ var init_log_file = __esm({
|
|
33187
33249
|
import_node_path3 = __toESM(require("path"));
|
33188
33250
|
import_miniflare = require("miniflare");
|
33189
33251
|
import_signal_exit = __toESM(require_signal_exit());
|
33252
|
+
init_strip_ansi();
|
33190
33253
|
init_factory();
|
33191
33254
|
init_global_wrangler_config_path();
|
33192
33255
|
init_logger();
|
@@ -33752,7 +33815,7 @@ var name, version;
|
|
33752
33815
|
var init_package = __esm({
|
33753
33816
|
"package.json"() {
|
33754
33817
|
name = "wrangler";
|
33755
|
-
version = "4.
|
33818
|
+
version = "4.29.0";
|
33756
33819
|
}
|
33757
33820
|
});
|
33758
33821
|
|
@@ -34426,17 +34489,6 @@ async function ensureQueuesExist(config, queueNames) {
|
|
34426
34489
|
async function getQueueById(config, accountId, queueId) {
|
34427
34490
|
return fetchResult(config, queuesUrl(accountId, queueId), {});
|
34428
34491
|
}
|
34429
|
-
async function putQueue(config, queueName, body) {
|
34430
|
-
const queue = await getQueue(config, queueName);
|
34431
|
-
return putQueueById(config, queue.queue_id, body);
|
34432
|
-
}
|
34433
|
-
async function putQueueById(config, queueId, body) {
|
34434
|
-
const accountId = await requireAuth(config);
|
34435
|
-
return fetchResult(config, queuesUrl(accountId, queueId), {
|
34436
|
-
method: "PUT",
|
34437
|
-
body: JSON.stringify(body)
|
34438
|
-
});
|
34439
|
-
}
|
34440
34492
|
async function postConsumer(config, queueName, body) {
|
34441
34493
|
const queue = await getQueue(config, queueName);
|
34442
34494
|
return postConsumerById(config, queue.queue_id, body);
|
@@ -34589,8 +34641,6 @@ var init_client2 = __esm({
|
|
34589
34641
|
__name(ensureQueuesExistByConfig, "ensureQueuesExistByConfig");
|
34590
34642
|
__name(ensureQueuesExist, "ensureQueuesExist");
|
34591
34643
|
__name(getQueueById, "getQueueById");
|
34592
|
-
__name(putQueue, "putQueue");
|
34593
|
-
__name(putQueueById, "putQueueById");
|
34594
34644
|
__name(postConsumer, "postConsumer");
|
34595
34645
|
__name(postConsumerById, "postConsumerById");
|
34596
34646
|
__name(putConsumerById, "putConsumerById");
|
@@ -35501,38 +35551,6 @@ var init_helpers = __esm({
|
|
35501
35551
|
}
|
35502
35552
|
});
|
35503
35553
|
|
35504
|
-
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
35505
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
35506
|
-
const pattern = [
|
35507
|
-
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
35508
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
35509
|
-
].join("|");
|
35510
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
35511
|
-
}
|
35512
|
-
var init_ansi_regex = __esm({
|
35513
|
-
"../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js"() {
|
35514
|
-
init_import_meta_url();
|
35515
|
-
__name(ansiRegex, "ansiRegex");
|
35516
|
-
}
|
35517
|
-
});
|
35518
|
-
|
35519
|
-
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
35520
|
-
function stripAnsi2(string) {
|
35521
|
-
if (typeof string !== "string") {
|
35522
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
35523
|
-
}
|
35524
|
-
return string.replace(regex, "");
|
35525
|
-
}
|
35526
|
-
var regex;
|
35527
|
-
var init_strip_ansi = __esm({
|
35528
|
-
"../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js"() {
|
35529
|
-
init_import_meta_url();
|
35530
|
-
init_ansi_regex();
|
35531
|
-
regex = ansiRegex();
|
35532
|
-
__name(stripAnsi2, "stripAnsi");
|
35533
|
-
}
|
35534
|
-
});
|
35535
|
-
|
35536
35554
|
// src/utils/print-bindings.ts
|
35537
35555
|
function printBindings(bindings, tailConsumers = [], context2 = {}) {
|
35538
35556
|
let hasConnectionStatus = false;
|
@@ -36324,7 +36342,7 @@ function unwindPropertyPath(root, path72) {
|
|
36324
36342
|
}
|
36325
36343
|
return { container, field: parts[parts.length - 1] };
|
36326
36344
|
}
|
36327
|
-
var appendEnvName, isString2, isValidName, isValidDateTimeStringFormat, isStringArray, isOneOf, all, isMutuallyExclusiveWith, isBoolean, validateRequiredProperty, validateAtLeastOnePropertyRequired, validateOptionalProperty, validateTypedArray, validateOptionalTypedArray, isRequiredProperty, isOptionalProperty, hasProperty, validateAdditionalProperties, getBindingNames, isBindingList, isNamespaceList, isRecord;
|
36345
|
+
var appendEnvName, isString2, isValidName, isValidDateTimeStringFormat, isStringArray, isOneOf, all, isMutuallyExclusiveWith, isBoolean, validateRequiredProperty, validateAtLeastOnePropertyRequired, validateOptionalProperty, validateTypedArray, validateOptionalTypedArray, isRequiredProperty, isOptionalProperty, hasProperty, validateAdditionalProperties, getBindingNames, isBindingList, isNamespaceList, isRecord, validateUniqueNameProperty;
|
36328
36346
|
var init_validation_helpers = __esm({
|
36329
36347
|
"src/config/validation-helpers.ts"() {
|
36330
36348
|
init_import_meta_url();
|
@@ -36565,6 +36583,23 @@ var init_validation_helpers = __esm({
|
|
36565
36583
|
(entry) => isRecord(entry) && "binding" in entry && typeof entry.binding === "string"
|
36566
36584
|
), "isNamespaceList");
|
36567
36585
|
isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
36586
|
+
validateUniqueNameProperty = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
36587
|
+
if (Array.isArray(value)) {
|
36588
|
+
const nameCount = /* @__PURE__ */ new Map();
|
36589
|
+
Object.entries(value).forEach(([_4, entry]) => {
|
36590
|
+
nameCount.set(entry.name, (nameCount.get(entry.name) ?? 0) + 1);
|
36591
|
+
});
|
36592
|
+
const duplicates = Array.from(nameCount.entries()).filter(([_4, count]) => count > 1).map(([name2]) => name2);
|
36593
|
+
if (duplicates.length > 0) {
|
36594
|
+
const list = duplicates.join('", "');
|
36595
|
+
diagnostics.errors.push(
|
36596
|
+
`"${field}" bindings must have unique "name" values; duplicate(s) found: "${list}"`
|
36597
|
+
);
|
36598
|
+
return false;
|
36599
|
+
}
|
36600
|
+
}
|
36601
|
+
return true;
|
36602
|
+
}, "validateUniqueNameProperty");
|
36568
36603
|
}
|
36569
36604
|
});
|
36570
36605
|
|
@@ -37343,7 +37378,10 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
37343
37378
|
rawEnv,
|
37344
37379
|
envName,
|
37345
37380
|
"workflows",
|
37346
|
-
|
37381
|
+
all(
|
37382
|
+
validateBindingArray(envName, validateWorkflowBinding),
|
37383
|
+
validateUniqueNameProperty
|
37384
|
+
),
|
37347
37385
|
[]
|
37348
37386
|
),
|
37349
37387
|
migrations: inheritable(
|
@@ -49451,14 +49489,14 @@ var init_user2 = __esm({
|
|
49451
49489
|
});
|
49452
49490
|
|
49453
49491
|
// src/cfetch/internal.ts
|
49454
|
-
async function performApiFetch(complianceConfig, resource, init3 = {}, queryParams, abortSignal) {
|
49492
|
+
async function performApiFetch(complianceConfig, resource, init3 = {}, queryParams, abortSignal, apiToken) {
|
49455
49493
|
const method = init3.method ?? "GET";
|
49456
49494
|
(0, import_node_assert3.default)(
|
49457
49495
|
resource.startsWith("/"),
|
49458
49496
|
`CF API fetch - resource path must start with a "/" but got "${resource}"`
|
49459
49497
|
);
|
49460
49498
|
await requireLoggedIn(complianceConfig);
|
49461
|
-
|
49499
|
+
apiToken ??= requireApiToken();
|
49462
49500
|
const headers = cloneHeaders(new import_undici3.Headers(init3.headers));
|
49463
49501
|
addAuthorizationHeaderIfUnspecified(headers, apiToken);
|
49464
49502
|
addUserAgent(headers);
|
@@ -49490,14 +49528,15 @@ async function performApiFetch(complianceConfig, resource, init3 = {}, queryPara
|
|
49490
49528
|
}
|
49491
49529
|
);
|
49492
49530
|
}
|
49493
|
-
async function fetchInternal(complianceConfig, resource, init3 = {}, queryParams, abortSignal) {
|
49531
|
+
async function fetchInternal(complianceConfig, resource, init3 = {}, queryParams, abortSignal, apiToken) {
|
49494
49532
|
const method = init3.method ?? "GET";
|
49495
49533
|
const response = await performApiFetch(
|
49496
49534
|
complianceConfig,
|
49497
49535
|
resource,
|
49498
49536
|
init3,
|
49499
49537
|
queryParams,
|
49500
|
-
abortSignal
|
49538
|
+
abortSignal,
|
49539
|
+
apiToken
|
49501
49540
|
);
|
49502
49541
|
const jsonText = await response.text();
|
49503
49542
|
logger.debug(
|
@@ -49668,13 +49707,14 @@ var init_internal = __esm({
|
|
49668
49707
|
});
|
49669
49708
|
|
49670
49709
|
// src/cfetch/index.ts
|
49671
|
-
async function fetchResult(complianceConfig, resource, init3 = {}, queryParams, abortSignal) {
|
49710
|
+
async function fetchResult(complianceConfig, resource, init3 = {}, queryParams, abortSignal, apiToken) {
|
49672
49711
|
const json = await fetchInternal(
|
49673
49712
|
complianceConfig,
|
49674
49713
|
resource,
|
49675
49714
|
init3,
|
49676
49715
|
queryParams,
|
49677
|
-
abortSignal
|
49716
|
+
abortSignal,
|
49717
|
+
apiToken
|
49678
49718
|
);
|
49679
49719
|
if (json.success) {
|
49680
49720
|
return json.result;
|
@@ -58912,11 +58952,11 @@ function buildMiniflareBindingOptions(config, remoteProxyConnectionString, remot
|
|
58912
58952
|
{
|
58913
58953
|
className,
|
58914
58954
|
useSQLite: classNameToUseSQLite.get(className),
|
58915
|
-
container: getImageNameFromDOClassName({
|
58955
|
+
container: config.containerDOClassNames?.size && config.enableContainers ? getImageNameFromDOClassName({
|
58916
58956
|
doClassName: className,
|
58917
58957
|
containerDOClassNames: config.containerDOClassNames,
|
58918
58958
|
containerBuildId: config.containerBuildId
|
58919
|
-
})
|
58959
|
+
}) : void 0
|
58920
58960
|
}
|
58921
58961
|
];
|
58922
58962
|
}),
|
@@ -59093,9 +59133,6 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
59093
59133
|
return { options, internalObjects, entrypointNames };
|
59094
59134
|
}
|
59095
59135
|
function getImageNameFromDOClassName(options) {
|
59096
|
-
if (!options.containerDOClassNames || !options.containerDOClassNames.size) {
|
59097
|
-
return void 0;
|
59098
|
-
}
|
59099
59136
|
(0, import_node_assert5.default)(
|
59100
59137
|
options.containerBuildId,
|
59101
59138
|
"Build ID should be set if containers are defined and enabled"
|
@@ -65731,6 +65768,199 @@ var init_dist2 = __esm({
|
|
65731
65768
|
}
|
65732
65769
|
});
|
65733
65770
|
|
65771
|
+
// src/cloudchamber/instance-type/instance-type.ts
|
65772
|
+
async function promptForInstanceType(allowSkipping) {
|
65773
|
+
let options = [
|
65774
|
+
{ label: "dev: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "dev" },
|
65775
|
+
{ label: "basic: 1/4 vCPU, 1 GiB memory, 4 GB disk", value: "basic" },
|
65776
|
+
{ label: "standard: 1/2 vCPU, 4 GiB memory, 4 GB disk", value: "standard" }
|
65777
|
+
];
|
65778
|
+
if (allowSkipping) {
|
65779
|
+
options = [{ label: "Do not set", value: "skip" }].concat(options);
|
65780
|
+
}
|
65781
|
+
const action = await inputPrompt({
|
65782
|
+
question: "Which instance type should we use for your container?",
|
65783
|
+
label: "",
|
65784
|
+
defaultValue: false,
|
65785
|
+
helpText: "",
|
65786
|
+
type: "select",
|
65787
|
+
options
|
65788
|
+
});
|
65789
|
+
switch (action) {
|
65790
|
+
case "dev":
|
65791
|
+
case "basic":
|
65792
|
+
case "standard":
|
65793
|
+
return action;
|
65794
|
+
default:
|
65795
|
+
return void 0;
|
65796
|
+
}
|
65797
|
+
}
|
65798
|
+
function checkInstanceType(args, config) {
|
65799
|
+
const instance_type = args.instanceType ?? config.instance_type;
|
65800
|
+
if (instance_type === void 0) {
|
65801
|
+
return;
|
65802
|
+
}
|
65803
|
+
if (args.memory !== void 0 || args.vcpu !== void 0) {
|
65804
|
+
throw new UserError(
|
65805
|
+
`Field "instance_type" is mutually exclusive with "memory" and "vcpu". These fields cannot be set together.`
|
65806
|
+
);
|
65807
|
+
}
|
65808
|
+
switch (instance_type) {
|
65809
|
+
case "dev":
|
65810
|
+
case "basic":
|
65811
|
+
case "standard":
|
65812
|
+
return instance_type;
|
65813
|
+
default:
|
65814
|
+
throw new UserError(
|
65815
|
+
`"instance_type" field value is expected to be one of "dev", "basic", or "standard", but got "${instance_type}"`
|
65816
|
+
);
|
65817
|
+
}
|
65818
|
+
}
|
65819
|
+
function getInstanceTypeUsage(instanceType) {
|
65820
|
+
return instanceTypes[instanceType];
|
65821
|
+
}
|
65822
|
+
function inferInstanceType(config) {
|
65823
|
+
for (const [instanceType, configuration] of Object.entries(instanceTypes)) {
|
65824
|
+
if (config.vcpu === configuration.vcpu && config.memory_mib === configuration.memory_mib && config.disk?.size_mb === configuration.disk_mb) {
|
65825
|
+
return instanceType;
|
65826
|
+
}
|
65827
|
+
}
|
65828
|
+
}
|
65829
|
+
function cleanForInstanceType(app) {
|
65830
|
+
if (!("configuration" in app)) {
|
65831
|
+
return app;
|
65832
|
+
}
|
65833
|
+
const instance_type = inferInstanceType(app.configuration);
|
65834
|
+
if (instance_type !== void 0) {
|
65835
|
+
app.configuration.instance_type = instance_type;
|
65836
|
+
}
|
65837
|
+
delete app.configuration.disk;
|
65838
|
+
delete app.configuration.memory;
|
65839
|
+
delete app.configuration.memory_mib;
|
65840
|
+
delete app.configuration.vcpu;
|
65841
|
+
return app;
|
65842
|
+
}
|
65843
|
+
var instanceTypes;
|
65844
|
+
var init_instance_type = __esm({
|
65845
|
+
"src/cloudchamber/instance-type/instance-type.ts"() {
|
65846
|
+
init_import_meta_url();
|
65847
|
+
init_interactive();
|
65848
|
+
init_errors();
|
65849
|
+
instanceTypes = {
|
65850
|
+
// dev is the default instance type when REQUIRE_INSTANCE_TYPE is set
|
65851
|
+
dev: {
|
65852
|
+
vcpu: 0.0625,
|
65853
|
+
memory_mib: 256,
|
65854
|
+
disk_mb: 2e3
|
65855
|
+
},
|
65856
|
+
basic: {
|
65857
|
+
vcpu: 0.25,
|
65858
|
+
memory_mib: 1024,
|
65859
|
+
disk_mb: 4e3
|
65860
|
+
},
|
65861
|
+
standard: {
|
65862
|
+
vcpu: 0.5,
|
65863
|
+
memory_mib: 4096,
|
65864
|
+
disk_mb: 4e3
|
65865
|
+
}
|
65866
|
+
};
|
65867
|
+
__name(promptForInstanceType, "promptForInstanceType");
|
65868
|
+
__name(checkInstanceType, "checkInstanceType");
|
65869
|
+
__name(getInstanceTypeUsage, "getInstanceTypeUsage");
|
65870
|
+
__name(inferInstanceType, "inferInstanceType");
|
65871
|
+
__name(cleanForInstanceType, "cleanForInstanceType");
|
65872
|
+
}
|
65873
|
+
});
|
65874
|
+
|
65875
|
+
// src/cloudchamber/limits.ts
|
65876
|
+
function configToUsage(containerConfig) {
|
65877
|
+
if ("instance_type" in containerConfig) {
|
65878
|
+
return getInstanceTypeUsage(containerConfig.instance_type);
|
65879
|
+
}
|
65880
|
+
return {
|
65881
|
+
vcpu: containerConfig.vcpu,
|
65882
|
+
memory_mib: containerConfig.memory_mib,
|
65883
|
+
disk_mb: containerConfig.disk_bytes / MB
|
65884
|
+
};
|
65885
|
+
}
|
65886
|
+
function accountToLimits(account) {
|
65887
|
+
return {
|
65888
|
+
vcpu: account.limits.vcpu_per_deployment,
|
65889
|
+
memory_mib: account.limits.memory_mib_per_deployment,
|
65890
|
+
disk_mb: account.limits.disk_mb_per_deployment
|
65891
|
+
};
|
65892
|
+
}
|
65893
|
+
async function ensureContainerLimits(options) {
|
65894
|
+
const limits = accountToLimits(options.account);
|
65895
|
+
if (!options.containerConfig) {
|
65896
|
+
await ensureImageFitsLimits({
|
65897
|
+
availableSizeInBytes: limits.disk_mb * MB,
|
65898
|
+
pathToDocker: options.pathToDocker,
|
65899
|
+
imageTag: options.imageTag
|
65900
|
+
});
|
65901
|
+
return;
|
65902
|
+
}
|
65903
|
+
const usage2 = configToUsage(options.containerConfig);
|
65904
|
+
const errors = [];
|
65905
|
+
if (usage2.vcpu > limits.vcpu) {
|
65906
|
+
errors.push(
|
65907
|
+
`Your container configuration uses ${usage2.vcpu} vCPU which exceeds the account limit of ${limits.vcpu} vCPU.`
|
65908
|
+
);
|
65909
|
+
}
|
65910
|
+
if (usage2.memory_mib > limits.memory_mib) {
|
65911
|
+
errors.push(
|
65912
|
+
`Your container configuration uses ${usage2.memory_mib} MiB of memory which exceeds the account limit of ${limits.memory_mib} MiB.`
|
65913
|
+
);
|
65914
|
+
}
|
65915
|
+
if (usage2.disk_mb > limits.disk_mb) {
|
65916
|
+
errors.push(
|
65917
|
+
`Your container configuration uses ${usage2.disk_mb} MB of disk which exceeds the account limit of ${limits.disk_mb} MB.`
|
65918
|
+
);
|
65919
|
+
}
|
65920
|
+
if (errors.length > 0) {
|
65921
|
+
throw new UserError(`Exceeded account limits: ${errors.join(" ")}`);
|
65922
|
+
}
|
65923
|
+
await ensureImageFitsLimits({
|
65924
|
+
availableSizeInBytes: usage2.disk_mb * MB,
|
65925
|
+
pathToDocker: options.pathToDocker,
|
65926
|
+
imageTag: options.imageTag
|
65927
|
+
});
|
65928
|
+
}
|
65929
|
+
async function ensureImageFitsLimits(options) {
|
65930
|
+
const inspectOutput = await dockerImageInspect(options.pathToDocker, {
|
65931
|
+
imageTag: options.imageTag,
|
65932
|
+
formatString: "{{ .Size }} {{ len .RootFS.Layers }}"
|
65933
|
+
});
|
65934
|
+
const [sizeStr, layerStr] = inspectOutput.split(" ");
|
65935
|
+
const size = parseInt(sizeStr, 10);
|
65936
|
+
const layers = parseInt(layerStr, 10);
|
65937
|
+
const requiredSizeInBytes = Math.ceil(size * 1.1 + layers * 16 * MiB);
|
65938
|
+
logger.debug(
|
65939
|
+
`Disk size limits when building container image: availableSize=${Math.ceil(options.availableSizeInBytes / MB)}MB, requiredSize=${Math.ceil(requiredSizeInBytes / MB)}MB`
|
65940
|
+
);
|
65941
|
+
if (options.availableSizeInBytes < requiredSizeInBytes) {
|
65942
|
+
throw new UserError(
|
65943
|
+
`Image too large: needs ${Math.ceil(requiredSizeInBytes / MB)}MB, but your app is limited to images with size ${options.availableSizeInBytes / MB}MB. Your need more disk for this image.`
|
65944
|
+
);
|
65945
|
+
}
|
65946
|
+
}
|
65947
|
+
var MB, MiB;
|
65948
|
+
var init_limits = __esm({
|
65949
|
+
"src/cloudchamber/limits.ts"() {
|
65950
|
+
init_import_meta_url();
|
65951
|
+
init_containers_shared();
|
65952
|
+
init_errors();
|
65953
|
+
init_logger();
|
65954
|
+
init_instance_type();
|
65955
|
+
MB = 1e3 * 1e3;
|
65956
|
+
MiB = 1024 * 1024;
|
65957
|
+
__name(configToUsage, "configToUsage");
|
65958
|
+
__name(accountToLimits, "accountToLimits");
|
65959
|
+
__name(ensureContainerLimits, "ensureContainerLimits");
|
65960
|
+
__name(ensureImageFitsLimits, "ensureImageFitsLimits");
|
65961
|
+
}
|
65962
|
+
});
|
65963
|
+
|
65734
65964
|
// src/cloudchamber/locations.ts
|
65735
65965
|
async function loadAccount() {
|
65736
65966
|
if (cachedAccount !== void 0) {
|
@@ -65804,7 +66034,7 @@ function pushYargs(yargs) {
|
|
65804
66034
|
demandOption: false
|
65805
66035
|
}).positional("TAG", { type: "string", demandOption: true });
|
65806
66036
|
}
|
65807
|
-
async function buildAndMaybePush(args, pathToDocker, push,
|
66037
|
+
async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
|
65808
66038
|
try {
|
65809
66039
|
const imageTag = `${getCloudflareContainerRegistry()}/${args.tag}`;
|
65810
66040
|
const { buildCmd, dockerfile } = await constructBuildCommand(
|
@@ -65822,35 +66052,37 @@ async function buildAndMaybePush(args, pathToDocker, push, configDiskInBytes) {
|
|
65822
66052
|
buildCmd,
|
65823
66053
|
dockerfile
|
65824
66054
|
}).ready;
|
65825
|
-
const inspectOutput = await dockerImageInspect(pathToDocker, {
|
65826
|
-
imageTag,
|
65827
|
-
formatString: "{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}"
|
65828
|
-
});
|
65829
|
-
const [sizeStr, layerStr, repoDigests] = inspectOutput.split(" ");
|
65830
66055
|
let pushed = false;
|
65831
66056
|
if (push) {
|
66057
|
+
const imageInfo = await dockerImageInspect(pathToDocker, {
|
66058
|
+
imageTag,
|
66059
|
+
formatString: "{{ json .RepoDigests }} {{ .Id }}"
|
66060
|
+
});
|
66061
|
+
logger.debug(`'docker image inspect ${imageTag}':`, imageInfo);
|
65832
66062
|
const account = await loadAccount();
|
65833
|
-
|
65834
|
-
|
65835
|
-
|
65836
|
-
const requiredSizeInBytes = Math.ceil(size * 1.1 + layers * 16 * MiB);
|
65837
|
-
await ensureDiskLimits({
|
65838
|
-
requiredSizeInBytes,
|
66063
|
+
await ensureContainerLimits({
|
66064
|
+
pathToDocker,
|
66065
|
+
imageTag,
|
65839
66066
|
account,
|
65840
|
-
|
66067
|
+
containerConfig
|
65841
66068
|
});
|
65842
66069
|
await dockerLoginManagedRegistry(pathToDocker);
|
65843
66070
|
try {
|
65844
|
-
const
|
66071
|
+
const [digests, imageId] = imageInfo.split(" ");
|
66072
|
+
const parsedDigests = JSON.parse(digests);
|
65845
66073
|
if (!Array.isArray(parsedDigests)) {
|
65846
66074
|
throw new Error(
|
65847
66075
|
`Expected RepoDigests from docker inspect to be an array but got ${JSON.stringify(parsedDigests)}`
|
65848
66076
|
);
|
65849
66077
|
}
|
65850
|
-
const repositoryOnly =
|
65851
|
-
|
65852
|
-
|
65853
|
-
);
|
66078
|
+
const repositoryOnly = resolveImageName(
|
66079
|
+
account.external_account_id,
|
66080
|
+
imageTag
|
66081
|
+
).split(":")[0];
|
66082
|
+
const [digest, ...rest] = parsedDigests.filter((d6) => {
|
66083
|
+
const resolved = resolveImageName(account.external_account_id, d6);
|
66084
|
+
return typeof d6 === "string" && resolved.split("@")[0] === repositoryOnly;
|
66085
|
+
});
|
65854
66086
|
if (rest.length > 0) {
|
65855
66087
|
throw new Error(
|
65856
66088
|
`Expected there to only be 1 valid digests for this repository: ${repositoryOnly} but there were ${rest.length + 1}`
|
@@ -65862,35 +66094,43 @@ async function buildAndMaybePush(args, pathToDocker, push, configDiskInBytes) {
|
|
65862
66094
|
image
|
65863
66095
|
);
|
65864
66096
|
const remoteDigest = `${resolvedImage}@${hash}`;
|
65865
|
-
|
65866
|
-
|
65867
|
-
|
65868
|
-
"
|
65869
|
-
|
65870
|
-
|
66097
|
+
const remoteManifest = runDockerCmdWithOutput(pathToDocker, [
|
66098
|
+
"manifest",
|
66099
|
+
"inspect",
|
66100
|
+
"-v",
|
66101
|
+
remoteDigest
|
66102
|
+
]);
|
65871
66103
|
logger.debug(
|
65872
|
-
`
|
66104
|
+
`'docker manifest inspect -v ${remoteDigest}:`,
|
66105
|
+
remoteManifest
|
65873
66106
|
);
|
65874
|
-
|
65875
|
-
|
66107
|
+
const parsedRemoteManifest = JSON.parse(remoteManifest);
|
66108
|
+
if (parsedRemoteManifest.Descriptor.digest === imageId) {
|
66109
|
+
logger.log("Image already exists remotely, skipping push");
|
66110
|
+
logger.debug(
|
66111
|
+
`Untagging built image: ${args.tag} since there was no change.`
|
66112
|
+
);
|
66113
|
+
await runDockerCmd(pathToDocker, ["image", "rm", imageTag]);
|
66114
|
+
return { image: remoteDigest, pushed: false };
|
66115
|
+
}
|
65876
66116
|
} catch (error2) {
|
65877
66117
|
if (error2 instanceof Error) {
|
65878
66118
|
logger.debug(
|
65879
66119
|
`Checking for local image ${args.tag} failed with error: ${error2.message}`
|
65880
66120
|
);
|
65881
66121
|
}
|
65882
|
-
const namespacedImageTag = getCloudflareRegistryWithAccountNamespace(
|
65883
|
-
account.external_account_id,
|
65884
|
-
args.tag
|
65885
|
-
);
|
65886
|
-
logger.log(
|
65887
|
-
`Image does not exist remotely, pushing: ${namespacedImageTag}`
|
65888
|
-
);
|
65889
|
-
await runDockerCmd(pathToDocker, ["tag", imageTag, namespacedImageTag]);
|
65890
|
-
await runDockerCmd(pathToDocker, ["push", namespacedImageTag]);
|
65891
|
-
await runDockerCmd(pathToDocker, ["image", "rm", namespacedImageTag]);
|
65892
|
-
pushed = true;
|
65893
66122
|
}
|
66123
|
+
const namespacedImageTag = getCloudflareRegistryWithAccountNamespace(
|
66124
|
+
account.external_account_id,
|
66125
|
+
args.tag
|
66126
|
+
);
|
66127
|
+
logger.log(
|
66128
|
+
`Image does not exist remotely, pushing: ${namespacedImageTag}`
|
66129
|
+
);
|
66130
|
+
await runDockerCmd(pathToDocker, ["tag", imageTag, namespacedImageTag]);
|
66131
|
+
await runDockerCmd(pathToDocker, ["push", namespacedImageTag]);
|
66132
|
+
await runDockerCmd(pathToDocker, ["image", "rm", namespacedImageTag]);
|
66133
|
+
pushed = true;
|
65894
66134
|
}
|
65895
66135
|
return { image: imageTag, pushed };
|
65896
66136
|
} catch (error2) {
|
@@ -65922,8 +66162,8 @@ async function buildCommand(args) {
|
|
65922
66162
|
},
|
65923
66163
|
getDockerPath() ?? args.pathToDocker,
|
65924
66164
|
args.push,
|
65925
|
-
// this means we
|
65926
|
-
//
|
66165
|
+
// this means we aren't validating defined limits for a container when building an image
|
66166
|
+
// we will, however, still validate the image size against account level disk limits
|
65927
66167
|
void 0
|
65928
66168
|
);
|
65929
66169
|
}
|
@@ -65958,24 +66198,6 @@ async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "li
|
|
65958
66198
|
);
|
65959
66199
|
}
|
65960
66200
|
}
|
65961
|
-
async function ensureDiskLimits(options) {
|
65962
|
-
const MB = 1e3 * 1e3;
|
65963
|
-
const accountDiskSizeInBytes = (options.account.limits.disk_mb_per_deployment ?? 2e3) * MB;
|
65964
|
-
if (options.configDiskInBytes && options.configDiskInBytes > accountDiskSizeInBytes) {
|
65965
|
-
throw new UserError(
|
65966
|
-
`Exceeded account limits: Your container is configured to use a disk size of ${Math.ceil(options.configDiskInBytes / MB)}MB. However, that exceeds the account limit of ${accountDiskSizeInBytes / MB}MB`
|
65967
|
-
);
|
65968
|
-
}
|
65969
|
-
const maxAllowedImageSizeBytes = options.configDiskInBytes ?? accountDiskSizeInBytes;
|
65970
|
-
logger.debug(
|
65971
|
-
`Disk size limits when building the container: appDiskSize: ${options.configDiskInBytes ? Math.ceil(options.configDiskInBytes / MB) : "n/a"}MB, accountDiskSize:${accountDiskSizeInBytes / MB}MB, maxAllowedImageSizeBytes=${maxAllowedImageSizeBytes}(${maxAllowedImageSizeBytes / MB}MB), requiredSize=${options.requiredSizeInBytes}(${Math.ceil(options.requiredSizeInBytes / MB)}MB)`
|
65972
|
-
);
|
65973
|
-
if (maxAllowedImageSizeBytes < options.requiredSizeInBytes) {
|
65974
|
-
throw new UserError(
|
65975
|
-
`Image too large: needs ${Math.ceil(options.requiredSizeInBytes / MB)}MB, but your app is limited to images with size ${maxAllowedImageSizeBytes / MB}MB. Your account needs more disk size per instance to run this container. The default disk size is 2GB.`
|
65976
|
-
);
|
65977
|
-
}
|
65978
|
-
}
|
65979
66201
|
var import_fs13, import_path10;
|
65980
66202
|
var init_build2 = __esm({
|
65981
66203
|
"src/cloudchamber/build.ts"() {
|
@@ -65987,6 +66209,7 @@ var init_build2 = __esm({
|
|
65987
66209
|
init_errors();
|
65988
66210
|
init_logger();
|
65989
66211
|
init_user2();
|
66212
|
+
init_limits();
|
65990
66213
|
init_locations();
|
65991
66214
|
__name(buildYargs, "buildYargs");
|
65992
66215
|
__name(pushYargs, "pushYargs");
|
@@ -65994,7 +66217,6 @@ var init_build2 = __esm({
|
|
65994
66217
|
__name(buildCommand, "buildCommand");
|
65995
66218
|
__name(pushCommand, "pushCommand");
|
65996
66219
|
__name(checkImagePlatform, "checkImagePlatform");
|
65997
|
-
__name(ensureDiskLimits, "ensureDiskLimits");
|
65998
66220
|
}
|
65999
66221
|
});
|
66000
66222
|
|
@@ -66748,6 +66970,7 @@ async function fillOpenAPIConfiguration(config, scope) {
|
|
66748
66970
|
...OpenAPI.HEADERS ?? {},
|
66749
66971
|
...Object.fromEntries(headers.entries())
|
66750
66972
|
};
|
66973
|
+
OpenAPI.LOGGER = logger;
|
66751
66974
|
}
|
66752
66975
|
function checkEverythingIsSet(object, keys) {
|
66753
66976
|
keys.forEach((key) => {
|
@@ -66995,90 +67218,14 @@ async function promptForLabels(labels, initiallySelected, allowSkipping) {
|
|
66995
67218
|
}
|
66996
67219
|
return [];
|
66997
67220
|
}
|
66998
|
-
async function promptForInstanceType(allowSkipping) {
|
66999
|
-
let options = [
|
67000
|
-
{ label: "dev: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "dev" },
|
67001
|
-
{ label: "basic: 1/4 vCPU, 1 GiB memory, 4 GB disk", value: "basic" },
|
67002
|
-
{ label: "standard: 1/2 vCPU, 4 GiB memory, 4 GB disk", value: "standard" }
|
67003
|
-
];
|
67004
|
-
if (allowSkipping) {
|
67005
|
-
options = [{ label: "Do not set", value: "skip" }].concat(options);
|
67006
|
-
}
|
67007
|
-
const action = await inputPrompt({
|
67008
|
-
question: "Which instance type should we use for your container?",
|
67009
|
-
label: "",
|
67010
|
-
defaultValue: false,
|
67011
|
-
helpText: "",
|
67012
|
-
type: "select",
|
67013
|
-
options
|
67014
|
-
});
|
67015
|
-
switch (action) {
|
67016
|
-
case "dev":
|
67017
|
-
return "dev" /* DEV */;
|
67018
|
-
case "basic":
|
67019
|
-
return "basic" /* BASIC */;
|
67020
|
-
case "standard":
|
67021
|
-
return "standard" /* STANDARD */;
|
67022
|
-
default:
|
67023
|
-
return void 0;
|
67024
|
-
}
|
67025
|
-
}
|
67026
67221
|
function resolveMemory(args, config) {
|
67027
|
-
const
|
67222
|
+
const MiB2 = 1024 * 1024;
|
67028
67223
|
const memory = args.memory ?? config.memory;
|
67029
67224
|
if (memory !== void 0) {
|
67030
|
-
return Math.round(parseByteSize(memory, 1024) /
|
67225
|
+
return Math.round(parseByteSize(memory, 1024) / MiB2);
|
67031
67226
|
}
|
67032
67227
|
return void 0;
|
67033
67228
|
}
|
67034
|
-
function checkInstanceType(args, config) {
|
67035
|
-
const instance_type = args.instanceType ?? config.instance_type;
|
67036
|
-
if (instance_type === void 0) {
|
67037
|
-
return;
|
67038
|
-
}
|
67039
|
-
if (args.memory !== void 0 || args.vcpu !== void 0) {
|
67040
|
-
throw new UserError(
|
67041
|
-
`Field "instance_type" is mutually exclusive with "memory" and "vcpu". These fields cannot be set together.`
|
67042
|
-
);
|
67043
|
-
}
|
67044
|
-
switch (instance_type) {
|
67045
|
-
case "dev":
|
67046
|
-
return "dev" /* DEV */;
|
67047
|
-
case "basic":
|
67048
|
-
return "basic" /* BASIC */;
|
67049
|
-
case "standard":
|
67050
|
-
return "standard" /* STANDARD */;
|
67051
|
-
default:
|
67052
|
-
throw new UserError(
|
67053
|
-
`"instance_type" field value is expected to be one of "dev", "basic", or "standard", but got "${instance_type}"`
|
67054
|
-
);
|
67055
|
-
}
|
67056
|
-
}
|
67057
|
-
function inferInstanceType(configuration) {
|
67058
|
-
if (configuration?.disk?.size_mb !== void 0 && configuration?.memory_mib !== void 0 && configuration?.vcpu !== void 0) {
|
67059
|
-
if (configuration.disk.size_mb === 2e3 && configuration.memory_mib === 256 && configuration.vcpu === 0.0625) {
|
67060
|
-
return "dev" /* DEV */;
|
67061
|
-
} else if (configuration.disk.size_mb === 4e3 && configuration.memory_mib === 1024 && configuration.vcpu === 0.25) {
|
67062
|
-
return "basic" /* BASIC */;
|
67063
|
-
} else if (configuration.disk.size_mb === 4e3 && configuration.memory_mib === 4096 && configuration.vcpu === 0.5) {
|
67064
|
-
return "standard" /* STANDARD */;
|
67065
|
-
}
|
67066
|
-
}
|
67067
|
-
}
|
67068
|
-
function cleanForInstanceType(app) {
|
67069
|
-
if (!("configuration" in app)) {
|
67070
|
-
return app;
|
67071
|
-
}
|
67072
|
-
const instance_type = inferInstanceType(app.configuration);
|
67073
|
-
if (instance_type !== void 0) {
|
67074
|
-
app.configuration.instance_type = instance_type;
|
67075
|
-
}
|
67076
|
-
delete app.configuration.disk;
|
67077
|
-
delete app.configuration.memory;
|
67078
|
-
delete app.configuration.memory_mib;
|
67079
|
-
delete app.configuration.vcpu;
|
67080
|
-
return app;
|
67081
|
-
}
|
67082
67229
|
var cloudchamberScope, imageRe;
|
67083
67230
|
var init_common = __esm({
|
67084
67231
|
"src/cloudchamber/common.ts"() {
|
@@ -67125,11 +67272,7 @@ var init_common = __esm({
|
|
67125
67272
|
__name(sortLabels, "sortLabels");
|
67126
67273
|
__name(collectLabels, "collectLabels");
|
67127
67274
|
__name(promptForLabels, "promptForLabels");
|
67128
|
-
__name(promptForInstanceType, "promptForInstanceType");
|
67129
67275
|
__name(resolveMemory, "resolveMemory");
|
67130
|
-
__name(checkInstanceType, "checkInstanceType");
|
67131
|
-
__name(inferInstanceType, "inferInstanceType");
|
67132
|
-
__name(cleanForInstanceType, "cleanForInstanceType");
|
67133
67276
|
}
|
67134
67277
|
});
|
67135
67278
|
|
@@ -67359,13 +67502,15 @@ var init_args = __esm({
|
|
67359
67502
|
function deleteYargs(args) {
|
67360
67503
|
return args.positional("ID", {
|
67361
67504
|
describe: "id of the containers to delete",
|
67362
|
-
type: "string"
|
67505
|
+
type: "string",
|
67506
|
+
demandOption: true
|
67363
67507
|
});
|
67364
67508
|
}
|
67365
67509
|
async function deleteCommand(deleteArgs, _config) {
|
67366
|
-
|
67367
|
-
|
67368
|
-
|
67510
|
+
const uuidRegex2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
67511
|
+
if (!uuidRegex2.test(deleteArgs.ID)) {
|
67512
|
+
throw new UserError(
|
67513
|
+
`Expected a container ID but got ${deleteArgs.ID}. Use \`wrangler containers list\` to view your containers and corresponding IDs.`
|
67369
67514
|
);
|
67370
67515
|
}
|
67371
67516
|
startSection("Delete your container");
|
@@ -68158,6 +68303,7 @@ var init_deploy = __esm({
|
|
68158
68303
|
init_containers_shared();
|
68159
68304
|
init_common();
|
68160
68305
|
init_diff();
|
68306
|
+
init_instance_type();
|
68161
68307
|
init_config2();
|
68162
68308
|
init_errors();
|
68163
68309
|
init_user2();
|
@@ -68268,9 +68414,12 @@ ${err.message}`
|
|
68268
68414
|
);
|
68269
68415
|
}
|
68270
68416
|
}
|
68271
|
-
success(
|
68272
|
-
|
68273
|
-
|
68417
|
+
success(
|
68418
|
+
`Modified application ${brandColor(action.name)} (Application ID: ${action.id})`,
|
68419
|
+
{
|
68420
|
+
shape: shapes.bar
|
68421
|
+
}
|
68422
|
+
);
|
68274
68423
|
}
|
68275
68424
|
}, "doAction");
|
68276
68425
|
__name(cleanApplicationFromAPI, "cleanApplicationFromAPI");
|
@@ -68411,7 +68560,7 @@ async function maybeBuildContainer(containerConfig, imageTag, dryRun, pathToDock
|
|
68411
68560
|
},
|
68412
68561
|
pathToDocker,
|
68413
68562
|
!dryRun,
|
68414
|
-
|
68563
|
+
containerConfig
|
68415
68564
|
);
|
68416
68565
|
if (buildResult.pushed) {
|
68417
68566
|
return { newImageLink: buildResult.image };
|
@@ -68509,7 +68658,10 @@ var init_config3 = __esm({
|
|
68509
68658
|
max_instances: container.max_instances ?? 0,
|
68510
68659
|
scheduling_policy: container.scheduling_policy ?? "default" /* DEFAULT */,
|
68511
68660
|
constraints: {
|
68512
|
-
|
68661
|
+
// if the tier is -1, then we allow all tiers
|
68662
|
+
// Wrangler will default an input value to 1. The API, however, will
|
68663
|
+
// treat an undefined value to mean no constraints on tier (i.e. "all tiers")
|
68664
|
+
tier: container.constraints?.tier === -1 ? void 0 : container.constraints?.tier ?? 1,
|
68513
68665
|
regions: container.constraints?.regions?.map(
|
68514
68666
|
(region) => region.toUpperCase()
|
68515
68667
|
),
|
@@ -68524,10 +68676,10 @@ var init_config3 = __esm({
|
|
68524
68676
|
}
|
68525
68677
|
};
|
68526
68678
|
let instanceTypeOrLimits;
|
68527
|
-
const
|
68679
|
+
const MB2 = 1e3 * 1e3;
|
68528
68680
|
if (container.configuration?.disk !== void 0 || container.configuration?.vcpu !== void 0 || container.configuration?.memory_mib !== void 0) {
|
68529
68681
|
instanceTypeOrLimits = {
|
68530
|
-
disk_bytes: (container.configuration?.disk?.size_mb ?? 2e3) *
|
68682
|
+
disk_bytes: (container.configuration?.disk?.size_mb ?? 2e3) * MB2,
|
68531
68683
|
// defaults to 2GB in bytes
|
68532
68684
|
vcpu: container.configuration?.vcpu ?? 0.0625,
|
68533
68685
|
memory_mib: container.configuration?.memory_mib ?? 256
|
@@ -68538,7 +68690,7 @@ var init_config3 = __esm({
|
|
68538
68690
|
};
|
68539
68691
|
} else {
|
68540
68692
|
instanceTypeOrLimits = {
|
68541
|
-
disk_bytes: (container.instance_type.disk_mb ?? 2e3) *
|
68693
|
+
disk_bytes: (container.instance_type.disk_mb ?? 2e3) * MB2,
|
68542
68694
|
vcpu: container.instance_type.vcpu ?? 0.0625,
|
68543
68695
|
memory_mib: container.instance_type.memory_mib ?? 256
|
68544
68696
|
};
|
@@ -71886,8 +72038,11 @@ ${dashLink}`);
|
|
71886
72038
|
);
|
71887
72039
|
}
|
71888
72040
|
if (config.queues.producers && config.queues.producers.length) {
|
71889
|
-
|
71890
|
-
|
72041
|
+
deployments.push(
|
72042
|
+
...config.queues.producers.map(
|
72043
|
+
(producer) => Promise.resolve([`Producer for ${producer.queue}`])
|
72044
|
+
)
|
72045
|
+
);
|
71891
72046
|
}
|
71892
72047
|
if (config.queues.consumers && config.queues.consumers.length) {
|
71893
72048
|
const updateConsumers = await updateQueueConsumers(scriptName, config);
|
@@ -74332,7 +74487,7 @@ var require_websocket2 = __commonJS({
|
|
74332
74487
|
var http5 = require("http");
|
74333
74488
|
var net2 = require("net");
|
74334
74489
|
var tls = require("tls");
|
74335
|
-
var { randomBytes: randomBytes2, createHash:
|
74490
|
+
var { randomBytes: randomBytes2, createHash: createHash8 } = require("crypto");
|
74336
74491
|
var { Duplex: Duplex2, Readable: Readable8 } = require("stream");
|
74337
74492
|
var { URL: URL7 } = require("url");
|
74338
74493
|
var PerMessageDeflate = require_permessage_deflate2();
|
@@ -74992,7 +75147,7 @@ var require_websocket2 = __commonJS({
|
|
74992
75147
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
74993
75148
|
return;
|
74994
75149
|
}
|
74995
|
-
const digest =
|
75150
|
+
const digest = createHash8("sha1").update(key + GUID).digest("base64");
|
74996
75151
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
74997
75152
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
74998
75153
|
return;
|
@@ -75284,7 +75439,7 @@ var require_websocket_server = __commonJS({
|
|
75284
75439
|
var EventEmitter5 = require("events");
|
75285
75440
|
var http5 = require("http");
|
75286
75441
|
var { Duplex: Duplex2 } = require("stream");
|
75287
|
-
var { createHash:
|
75442
|
+
var { createHash: createHash8 } = require("crypto");
|
75288
75443
|
var extension = require_extension();
|
75289
75444
|
var PerMessageDeflate = require_permessage_deflate2();
|
75290
75445
|
var subprotocol = require_subprotocol();
|
@@ -75582,7 +75737,7 @@ var require_websocket_server = __commonJS({
|
|
75582
75737
|
);
|
75583
75738
|
}
|
75584
75739
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
75585
|
-
const digest =
|
75740
|
+
const digest = createHash8("sha1").update(key + GUID).digest("base64");
|
75586
75741
|
const headers = [
|
75587
75742
|
"HTTP/1.1 101 Switching Protocols",
|
75588
75743
|
"Upgrade: websocket",
|
@@ -79384,13 +79539,14 @@ var init_build3 = __esm({
|
|
79384
79539
|
provideConfig: false
|
79385
79540
|
},
|
79386
79541
|
async handler(buildArgs) {
|
79387
|
-
|
79542
|
+
const { wrangler } = createCLIParser([
|
79388
79543
|
"deploy",
|
79389
79544
|
"--dry-run",
|
79390
79545
|
"--outdir=dist",
|
79391
79546
|
...buildArgs.env ? ["--env", buildArgs.env] : [],
|
79392
79547
|
...buildArgs.config ? ["--config", buildArgs.config] : []
|
79393
|
-
])
|
79548
|
+
]);
|
79549
|
+
await wrangler.parse();
|
79394
79550
|
}
|
79395
79551
|
});
|
79396
79552
|
}
|
@@ -80112,6 +80268,7 @@ var init_apply = __esm({
|
|
80112
80268
|
init_sortObjectRecursive();
|
80113
80269
|
init_common();
|
80114
80270
|
init_diff();
|
80271
|
+
init_instance_type();
|
80115
80272
|
__name(mergeDeep3, "mergeDeep");
|
80116
80273
|
__name(isObject2, "isObject");
|
80117
80274
|
__name(applyCommandOptionalYargs, "applyCommandOptionalYargs");
|
@@ -81202,6 +81359,7 @@ var init_create2 = __esm({
|
|
81202
81359
|
init_locations2();
|
81203
81360
|
init_common();
|
81204
81361
|
init_wrap();
|
81362
|
+
init_instance_type();
|
81205
81363
|
init_locations();
|
81206
81364
|
init_network();
|
81207
81365
|
init_ssh();
|
@@ -82204,6 +82362,7 @@ var init_modify = __esm({
|
|
82204
82362
|
init_locations2();
|
82205
82363
|
init_common();
|
82206
82364
|
init_wrap();
|
82365
|
+
init_instance_type();
|
82207
82366
|
init_locations();
|
82208
82367
|
init_ssh();
|
82209
82368
|
__name(modifyCommandOptionalYargs, "modifyCommandOptionalYargs");
|
@@ -85307,7 +85466,7 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
85307
85466
|
`The entrypoint ${import_node_path28.default.relative(
|
85308
85467
|
process.cwd(),
|
85309
85468
|
entryFile
|
85310
|
-
)} defines a Python worker, support for Python workers is currently experimental
|
85469
|
+
)} defines a Python worker, support for Python workers is currently experimental.`
|
85311
85470
|
);
|
85312
85471
|
return { format: "modules", exports: [] };
|
85313
85472
|
}
|
@@ -85897,6 +86056,13 @@ var init_deploy4 = __esm({
|
|
85897
86056
|
requiresArg: true,
|
85898
86057
|
array: true
|
85899
86058
|
},
|
86059
|
+
domains: {
|
86060
|
+
describe: "Custom domains to deploy to",
|
86061
|
+
alias: "domain",
|
86062
|
+
type: "string",
|
86063
|
+
requiresArg: true,
|
86064
|
+
array: true
|
86065
|
+
},
|
85900
86066
|
"jsx-factory": {
|
85901
86067
|
describe: "The function that is called for each JSX element",
|
85902
86068
|
type: "string",
|
@@ -86067,6 +86233,7 @@ var init_deploy4 = __esm({
|
|
86067
86233
|
jsxFragment: args.jsxFragment,
|
86068
86234
|
tsconfig: args.tsconfig,
|
86069
86235
|
routes: args.routes,
|
86236
|
+
domains: args.domains,
|
86070
86237
|
assetsOptions,
|
86071
86238
|
legacyAssetPaths: siteAssetPaths,
|
86072
86239
|
legacyEnv: isLegacyEnv(config),
|
@@ -95462,9 +95629,14 @@ var init_deployments2 = __esm({
|
|
95462
95629
|
type: "string",
|
95463
95630
|
choices: ["production", "preview"],
|
95464
95631
|
description: "Environment type to list deployments for"
|
95632
|
+
},
|
95633
|
+
json: {
|
95634
|
+
type: "boolean",
|
95635
|
+
description: "Return output as clean JSON",
|
95636
|
+
default: false
|
95465
95637
|
}
|
95466
95638
|
},
|
95467
|
-
async handler({ projectName, environment }) {
|
95639
|
+
async handler({ projectName, environment, json }) {
|
95468
95640
|
const config = getConfigCache(
|
95469
95641
|
PAGES_CONFIG_CACHE_FILENAME
|
95470
95642
|
);
|
@@ -95506,7 +95678,11 @@ var init_deployments2 = __esm({
|
|
95506
95678
|
saveToConfigCache(PAGES_CONFIG_CACHE_FILENAME, {
|
95507
95679
|
account_id: accountId
|
95508
95680
|
});
|
95509
|
-
|
95681
|
+
if (json) {
|
95682
|
+
logger.log(JSON.stringify(data, null, 2));
|
95683
|
+
} else {
|
95684
|
+
logger.table(data);
|
95685
|
+
}
|
95510
95686
|
sendMetricsEvent("list pages deployments");
|
95511
95687
|
}
|
95512
95688
|
});
|
@@ -151641,6 +151817,31 @@ Changes to triggers (routes, custom domains, cron schedules, etc) must be applie
|
|
151641
151817
|
function formatTime3(duration) {
|
151642
151818
|
return `(${(duration / 1e3).toFixed(2)} sec)`;
|
151643
151819
|
}
|
151820
|
+
function sanitizeBranchName(branchName) {
|
151821
|
+
return branchName.replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
151822
|
+
}
|
151823
|
+
function getBranchName() {
|
151824
|
+
const ciBranchName = getWorkersCIBranchName();
|
151825
|
+
if (ciBranchName) {
|
151826
|
+
return ciBranchName;
|
151827
|
+
}
|
151828
|
+
try {
|
151829
|
+
(0, import_node_child_process7.execSync)(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
|
151830
|
+
return (0, import_node_child_process7.execSync)(`git rev-parse --abbrev-ref HEAD`).toString().trim();
|
151831
|
+
} catch {
|
151832
|
+
return void 0;
|
151833
|
+
}
|
151834
|
+
}
|
151835
|
+
function createTruncatedAlias(branchName, sanitizedAlias, availableSpace) {
|
151836
|
+
const spaceForHash = HASH_LENGTH + 1;
|
151837
|
+
const maxPrefixLength = availableSpace - spaceForHash;
|
151838
|
+
if (maxPrefixLength < 1) {
|
151839
|
+
return void 0;
|
151840
|
+
}
|
151841
|
+
const hash = (0, import_node_crypto12.createHash)("sha256").update(branchName).digest("hex").slice(0, HASH_LENGTH);
|
151842
|
+
const truncatedPrefix = sanitizedAlias.slice(0, maxPrefixLength);
|
151843
|
+
return `${truncatedPrefix}-${hash}`;
|
151844
|
+
}
|
151644
151845
|
function generatePreviewAlias(scriptName) {
|
151645
151846
|
const warnAndExit = /* @__PURE__ */ __name(() => {
|
151646
151847
|
logger.warn(
|
@@ -151648,38 +151849,32 @@ function generatePreviewAlias(scriptName) {
|
|
151648
151849
|
);
|
151649
151850
|
return void 0;
|
151650
151851
|
}, "warnAndExit");
|
151651
|
-
|
151652
|
-
if (!branchName) {
|
151653
|
-
try {
|
151654
|
-
(0, import_node_child_process7.execSync)(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
|
151655
|
-
branchName = (0, import_node_child_process7.execSync)(`git rev-parse --abbrev-ref HEAD`).toString().trim();
|
151656
|
-
} catch {
|
151657
|
-
return warnAndExit();
|
151658
|
-
}
|
151659
|
-
}
|
151852
|
+
const branchName = getBranchName();
|
151660
151853
|
if (!branchName) {
|
151661
151854
|
return warnAndExit();
|
151662
151855
|
}
|
151663
|
-
const sanitizedAlias = branchName
|
151664
|
-
|
151665
|
-
sanitizedAlias
|
151666
|
-
);
|
151667
|
-
if (!isValidAlias) {
|
151856
|
+
const sanitizedAlias = sanitizeBranchName(branchName);
|
151857
|
+
if (!ALIAS_VALIDATION_REGEX.test(sanitizedAlias)) {
|
151668
151858
|
return warnAndExit();
|
151669
151859
|
}
|
151670
|
-
const
|
151671
|
-
|
151672
|
-
|
151673
|
-
return warnAndExit();
|
151860
|
+
const availableSpace = MAX_DNS_LABEL_LENGTH - scriptName.length - 1;
|
151861
|
+
if (sanitizedAlias.length <= availableSpace) {
|
151862
|
+
return sanitizedAlias;
|
151674
151863
|
}
|
151675
|
-
|
151864
|
+
const truncatedAlias = createTruncatedAlias(
|
151865
|
+
branchName,
|
151866
|
+
sanitizedAlias,
|
151867
|
+
availableSpace
|
151868
|
+
);
|
151869
|
+
return truncatedAlias || warnAndExit();
|
151676
151870
|
}
|
151677
|
-
var import_node_assert24, import_node_child_process7, import_node_fs32, import_node_path54, import_undici19, versionsUploadCommand;
|
151871
|
+
var import_node_assert24, import_node_child_process7, import_node_crypto12, import_node_fs32, import_node_path54, import_undici19, versionsUploadCommand, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX;
|
151678
151872
|
var init_upload2 = __esm({
|
151679
151873
|
"src/versions/upload.ts"() {
|
151680
151874
|
init_import_meta_url();
|
151681
151875
|
import_node_assert24 = __toESM(require("assert"));
|
151682
151876
|
import_node_child_process7 = require("child_process");
|
151877
|
+
import_node_crypto12 = require("crypto");
|
151683
151878
|
import_node_fs32 = require("fs");
|
151684
151879
|
import_node_path54 = __toESM(require("path"));
|
151685
151880
|
init_colors();
|
@@ -152001,6 +152196,12 @@ var init_upload2 = __esm({
|
|
152001
152196
|
});
|
152002
152197
|
__name(versionsUpload, "versionsUpload");
|
152003
152198
|
__name(formatTime3, "formatTime");
|
152199
|
+
MAX_DNS_LABEL_LENGTH = 63;
|
152200
|
+
HASH_LENGTH = 4;
|
152201
|
+
ALIAS_VALIDATION_REGEX = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
152202
|
+
__name(sanitizeBranchName, "sanitizeBranchName");
|
152203
|
+
__name(getBranchName, "getBranchName");
|
152204
|
+
__name(createTruncatedAlias, "createTruncatedAlias");
|
152004
152205
|
__name(generatePreviewAlias, "generatePreviewAlias");
|
152005
152206
|
}
|
152006
152207
|
});
|
@@ -156874,13 +157075,13 @@ function createCLIParser(argv) {
|
|
156874
157075
|
wrangler.version(false);
|
156875
157076
|
registry.registerAll();
|
156876
157077
|
wrangler.exitProcess(false);
|
156877
|
-
return wrangler;
|
157078
|
+
return { wrangler, registry };
|
156878
157079
|
}
|
156879
157080
|
async function main(argv) {
|
156880
157081
|
setupSentry();
|
156881
157082
|
checkMacOSVersion({ shouldThrow: false });
|
156882
157083
|
const startTime = Date.now();
|
156883
|
-
const wrangler = createCLIParser(argv);
|
157084
|
+
const { wrangler } = createCLIParser(argv);
|
156884
157085
|
let command2;
|
156885
157086
|
let metricsArgs;
|
156886
157087
|
let dispatcher;
|
@@ -156942,7 +157143,8 @@ async function main(argv) {
|
|
156942
157143
|
logger.log("");
|
156943
157144
|
if (e7 instanceof CommandLineArgsError) {
|
156944
157145
|
logger.error(e7.message);
|
156945
|
-
|
157146
|
+
const { wrangler: helpWrangler } = createCLIParser([...argv, "--help"]);
|
157147
|
+
await helpWrangler.parse();
|
156946
157148
|
} else if (isAuthenticationError(e7) || // Is this a Containers/Cloudchamber-based auth error?
|
156947
157149
|
// This is different because it uses a custom OpenAPI-based generated client
|
156948
157150
|
e7 instanceof UserError && e7.cause instanceof ApiError && e7.cause.status === 403) {
|
@@ -157253,20 +157455,23 @@ async function checkStartupHandler({
|
|
157253
157455
|
logger.loggerLevel = "error";
|
157254
157456
|
}
|
157255
157457
|
await spinnerWhile({
|
157256
|
-
promise: /* @__PURE__ */ __name(async () =>
|
157257
|
-
|
157258
|
-
|
157259
|
-
|
157260
|
-
|
157261
|
-
|
157262
|
-
|
157263
|
-
|
157264
|
-
|
157265
|
-
|
157266
|
-
|
157267
|
-
|
157268
|
-
|
157269
|
-
|
157458
|
+
promise: /* @__PURE__ */ __name(async () => {
|
157459
|
+
const { wrangler } = createCLIParser(
|
157460
|
+
config.pages_build_output_dir || pages ? [
|
157461
|
+
"pages",
|
157462
|
+
"functions",
|
157463
|
+
"build",
|
157464
|
+
...args?.split(" ") ?? [],
|
157465
|
+
`--outfile=${workerBundle}`
|
157466
|
+
] : [
|
157467
|
+
"deploy",
|
157468
|
+
...args?.split(" ") ?? [],
|
157469
|
+
"--dry-run",
|
157470
|
+
`--outfile=${workerBundle}`
|
157471
|
+
]
|
157472
|
+
);
|
157473
|
+
await wrangler.parse();
|
157474
|
+
}, "promise"),
|
157270
157475
|
startMessage: "Building your Worker",
|
157271
157476
|
endMessage: source_default.green("Worker Built! \u{1F389}")
|
157272
157477
|
});
|
@@ -157725,8 +157930,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
157725
157930
|
{ telemetryMessage: "missing compatibility date when deploying" }
|
157726
157931
|
);
|
157727
157932
|
}
|
157933
|
+
const domainRoutes = (props.domains || []).map((domain2) => ({
|
157934
|
+
pattern: domain2,
|
157935
|
+
custom_domain: true
|
157936
|
+
}));
|
157728
157937
|
const routes = props.routes ?? config.routes ?? (config.route ? [config.route] : []) ?? [];
|
157729
|
-
|
157938
|
+
const allRoutes = [...routes, ...domainRoutes];
|
157939
|
+
validateRoutes3(allRoutes, props.assetsOptions);
|
157730
157940
|
const jsxFactory = props.jsxFactory || config.jsx_factory;
|
157731
157941
|
const jsxFragment = props.jsxFragment || config.jsx_fragment;
|
157732
157942
|
const keepVars = props.keepVars || config.keep_vars;
|
@@ -158191,7 +158401,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
158191
158401
|
dryRun: props.dryRun ?? false
|
158192
158402
|
});
|
158193
158403
|
}
|
158194
|
-
const targets = await triggersDeploy(
|
158404
|
+
const targets = await triggersDeploy({
|
158405
|
+
...props,
|
158406
|
+
routes: allRoutes
|
158407
|
+
});
|
158195
158408
|
logger.log("Current Version ID:", versionId);
|
158196
158409
|
return {
|
158197
158410
|
sourceMapSize,
|
@@ -158341,24 +158554,6 @@ async function publishRoutesFallback(complianceConfig, routes, {
|
|
158341
158554
|
function isAuthenticationError(e7) {
|
158342
158555
|
return e7 instanceof ParseError && e7.code === 1e4;
|
158343
158556
|
}
|
158344
|
-
async function updateQueueProducers(config) {
|
158345
|
-
const producers = config.queues.producers || [];
|
158346
|
-
const updateProducers = [];
|
158347
|
-
for (const producer of producers) {
|
158348
|
-
const body = {
|
158349
|
-
queue_name: producer.queue,
|
158350
|
-
settings: {
|
158351
|
-
delivery_delay: producer.delivery_delay
|
158352
|
-
}
|
158353
|
-
};
|
158354
|
-
updateProducers.push(
|
158355
|
-
putQueue(config, producer.queue, body).then(() => [
|
158356
|
-
`Producer for ${producer.queue}`
|
158357
|
-
])
|
158358
|
-
);
|
158359
|
-
}
|
158360
|
-
return updateProducers;
|
158361
|
-
}
|
158362
158557
|
async function updateQueueConsumers(scriptName, config) {
|
158363
158558
|
const consumers = config.queues.consumers || [];
|
158364
158559
|
const updateConsumers = [];
|
@@ -158539,7 +158734,6 @@ ${mountedAssetRoutes.map((route) => {
|
|
158539
158734
|
__name(publishRoutes, "publishRoutes");
|
158540
158735
|
__name(publishRoutesFallback, "publishRoutesFallback");
|
158541
158736
|
__name(isAuthenticationError, "isAuthenticationError");
|
158542
|
-
__name(updateQueueProducers, "updateQueueProducers");
|
158543
158737
|
__name(updateQueueConsumers, "updateQueueConsumers");
|
158544
158738
|
}
|
158545
158739
|
});
|
@@ -178105,12 +178299,12 @@ function didMiniflareOptionsChange(prev, next) {
|
|
178105
178299
|
}
|
178106
178300
|
return !deepEquality(prev, next);
|
178107
178301
|
}
|
178108
|
-
var import_node_assert30,
|
178302
|
+
var import_node_assert30, import_node_crypto13, import_node_events4, import_node_path62, import_miniflare23, ProxyController, ProxyControllerLogger;
|
178109
178303
|
var init_ProxyController = __esm({
|
178110
178304
|
"src/api/startDevWorker/ProxyController.ts"() {
|
178111
178305
|
init_import_meta_url();
|
178112
178306
|
import_node_assert30 = __toESM(require("assert"));
|
178113
|
-
|
178307
|
+
import_node_crypto13 = require("crypto");
|
178114
178308
|
import_node_events4 = __toESM(require("events"));
|
178115
178309
|
import_node_path62 = __toESM(require("path"));
|
178116
178310
|
import_miniflare23 = require("miniflare");
|
@@ -178137,7 +178331,7 @@ var init_ProxyController = __esm({
|
|
178137
178331
|
inspectorProxyWorkerWebSocket;
|
178138
178332
|
latestConfig;
|
178139
178333
|
latestBundle;
|
178140
|
-
secret = (0,
|
178334
|
+
secret = (0, import_node_crypto13.randomUUID)();
|
178141
178335
|
createProxyWorker() {
|
178142
178336
|
if (this._torndown) {
|
178143
178337
|
return;
|
@@ -178607,14 +178801,15 @@ function switchHost(originalUrl, host, zonePreview) {
|
|
178607
178801
|
return url4;
|
178608
178802
|
}
|
178609
178803
|
async function createPreviewSession(complianceConfig, account, ctx, abortSignal) {
|
178610
|
-
const { accountId } = account;
|
178804
|
+
const { accountId, apiToken } = account;
|
178611
178805
|
const initUrl = ctx.zone ? `/zones/${ctx.zone}/workers/edge-preview` : `/accounts/${accountId}/workers/subdomain/edge-preview`;
|
178612
178806
|
const { exchange_url } = await fetchResult(
|
178613
178807
|
complianceConfig,
|
178614
178808
|
initUrl,
|
178615
178809
|
void 0,
|
178616
178810
|
void 0,
|
178617
|
-
abortSignal
|
178811
|
+
abortSignal,
|
178812
|
+
apiToken
|
178618
178813
|
);
|
178619
178814
|
const switchedExchangeUrl = switchHost(
|
178620
178815
|
exchange_url,
|
@@ -178643,7 +178838,7 @@ async function createPreviewSession(complianceConfig, account, ctx, abortSignal)
|
|
178643
178838
|
const inspector = new import_node_url12.URL(inspector_websocket);
|
178644
178839
|
inspector.searchParams.append("cf_workers_preview_token", token);
|
178645
178840
|
return {
|
178646
|
-
id:
|
178841
|
+
id: import_node_crypto14.default.randomUUID(),
|
178647
178842
|
value: token,
|
178648
178843
|
host: ctx.host ?? inspector.host,
|
178649
178844
|
inspectorUrl: switchHost(inspector.href, ctx.host, !!ctx.zone),
|
@@ -178736,11 +178931,11 @@ async function createWorkerPreview(complianceConfig, init3, account, ctx, sessio
|
|
178736
178931
|
);
|
178737
178932
|
return token;
|
178738
178933
|
}
|
178739
|
-
var
|
178934
|
+
var import_node_crypto14, import_node_url12, import_undici23;
|
178740
178935
|
var init_create_worker_preview = __esm({
|
178741
178936
|
"src/dev/create-worker-preview.ts"() {
|
178742
178937
|
init_import_meta_url();
|
178743
|
-
|
178938
|
+
import_node_crypto14 = __toESM(require("crypto"));
|
178744
178939
|
import_node_url12 = require("url");
|
178745
178940
|
import_undici23 = __toESM(require_undici());
|
178746
178941
|
init_cfetch();
|
@@ -178881,7 +179076,7 @@ async function createRemoteWorkerInit(props) {
|
|
178881
179076
|
async function getWorkerAccountAndContext(props) {
|
178882
179077
|
const workerAccount = {
|
178883
179078
|
accountId: props.accountId,
|
178884
|
-
apiToken: requireApiToken()
|
179079
|
+
apiToken: props.apiToken ?? requireApiToken()
|
178885
179080
|
};
|
178886
179081
|
const zoneId = await getZoneIdForPreview(props.complianceConfig, {
|
178887
179082
|
host: props.host,
|
@@ -179113,6 +179308,7 @@ var init_RemoteRuntimeController = __esm({
|
|
179113
179308
|
this.#session ??= await this.#previewSession({
|
179114
179309
|
complianceConfig: { compliance_region: config.complianceRegion },
|
179115
179310
|
accountId: auth.accountId,
|
179311
|
+
apiToken: auth.apiToken,
|
179116
179312
|
env: config.env,
|
179117
179313
|
// deprecated service environments -- just pass it through for now
|
179118
179314
|
legacyEnv: !config.legacy?.enableServiceEnvironments,
|
@@ -179503,34 +179699,54 @@ function pickRemoteBindings(bindings) {
|
|
179503
179699
|
})
|
179504
179700
|
);
|
179505
179701
|
}
|
179506
|
-
async function maybeStartOrUpdateRemoteProxySession(
|
179507
|
-
|
179508
|
-
|
179509
|
-
const
|
179702
|
+
async function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObject, preExistingRemoteProxySessionData, auth) {
|
179703
|
+
let config;
|
179704
|
+
if ("path" in wranglerOrWorkerConfigObject) {
|
179705
|
+
const wranglerConfigObject = wranglerOrWorkerConfigObject;
|
179706
|
+
config = readConfig({
|
179707
|
+
config: wranglerConfigObject.path,
|
179708
|
+
env: wranglerConfigObject.environment
|
179709
|
+
});
|
179510
179710
|
(0, import_node_assert33.default)(config.name);
|
179511
|
-
|
179711
|
+
wranglerOrWorkerConfigObject = {
|
179512
179712
|
name: config.name,
|
179513
179713
|
complianceRegion: getCloudflareComplianceRegion(config),
|
179514
179714
|
bindings: convertConfigBindingsToStartWorkerBindings(config) ?? {}
|
179515
179715
|
};
|
179516
179716
|
}
|
179517
|
-
const
|
179518
|
-
const remoteBindings = pickRemoteBindings(
|
179519
|
-
|
179520
|
-
|
179521
|
-
|
179522
|
-
preExistingRemoteProxySessionData?.remoteBindings
|
179717
|
+
const workerConfigObject = wranglerOrWorkerConfigObject;
|
179718
|
+
const remoteBindings = pickRemoteBindings(workerConfigObject.bindings);
|
179719
|
+
const authSameAsBefore = deepStrictEqual(
|
179720
|
+
auth,
|
179721
|
+
preExistingRemoteProxySessionData?.auth
|
179523
179722
|
);
|
179524
|
-
|
179525
|
-
|
179526
|
-
|
179527
|
-
|
179528
|
-
|
179529
|
-
|
179530
|
-
|
179723
|
+
let remoteProxySession = preExistingRemoteProxySessionData?.session;
|
179724
|
+
if (!authSameAsBefore) {
|
179725
|
+
if (preExistingRemoteProxySessionData?.session) {
|
179726
|
+
await preExistingRemoteProxySessionData.session.dispose();
|
179727
|
+
}
|
179728
|
+
remoteProxySession = await startRemoteProxySession(remoteBindings, {
|
179729
|
+
workerName: workerConfigObject.name,
|
179730
|
+
complianceRegion: workerConfigObject.complianceRegion,
|
179731
|
+
auth: getAuthHook(auth, config)
|
179732
|
+
});
|
179733
|
+
} else {
|
179734
|
+
const remoteBindingsAreSameAsBefore = deepStrictEqual(
|
179735
|
+
remoteBindings,
|
179736
|
+
preExistingRemoteProxySessionData?.remoteBindings
|
179737
|
+
);
|
179738
|
+
if (!remoteBindingsAreSameAsBefore) {
|
179739
|
+
if (!remoteProxySession) {
|
179740
|
+
if (Object.keys(remoteBindings).length > 0) {
|
179741
|
+
remoteProxySession = await startRemoteProxySession(remoteBindings, {
|
179742
|
+
workerName: workerConfigObject.name,
|
179743
|
+
complianceRegion: workerConfigObject.complianceRegion,
|
179744
|
+
auth: getAuthHook(auth, config)
|
179745
|
+
});
|
179746
|
+
}
|
179747
|
+
} else {
|
179748
|
+
await remoteProxySession.updateBindings(remoteBindings);
|
179531
179749
|
}
|
179532
|
-
} else {
|
179533
|
-
await remoteProxySession.updateBindings(remoteBindings);
|
179534
179750
|
}
|
179535
179751
|
}
|
179536
179752
|
await remoteProxySession?.ready;
|
@@ -179542,6 +179758,20 @@ async function maybeStartOrUpdateRemoteProxySession(configPathOrWorkerConfig, pr
|
|
179542
179758
|
remoteBindings
|
179543
179759
|
};
|
179544
179760
|
}
|
179761
|
+
function getAuthHook(auth, config) {
|
179762
|
+
if (auth) {
|
179763
|
+
return auth;
|
179764
|
+
}
|
179765
|
+
if (config?.account_id) {
|
179766
|
+
return async () => {
|
179767
|
+
return {
|
179768
|
+
accountId: await requireAuth(config),
|
179769
|
+
apiToken: requireApiToken()
|
179770
|
+
};
|
179771
|
+
};
|
179772
|
+
}
|
179773
|
+
return void 0;
|
179774
|
+
}
|
179545
179775
|
function deepStrictEqual(source, target) {
|
179546
179776
|
try {
|
179547
179777
|
import_node_assert33.default.deepStrictEqual(source, target);
|
@@ -179560,10 +179790,12 @@ var init_remoteBindings = __esm({
|
|
179560
179790
|
init_config2();
|
179561
179791
|
init_misc_variables();
|
179562
179792
|
init_paths();
|
179793
|
+
init_user2();
|
179563
179794
|
init_startDevWorker();
|
179564
179795
|
__name(startRemoteProxySession, "startRemoteProxySession");
|
179565
179796
|
__name(pickRemoteBindings, "pickRemoteBindings");
|
179566
179797
|
__name(maybeStartOrUpdateRemoteProxySession, "maybeStartOrUpdateRemoteProxySession");
|
179798
|
+
__name(getAuthHook, "getAuthHook");
|
179567
179799
|
__name(deepStrictEqual, "deepStrictEqual");
|
179568
179800
|
}
|
179569
179801
|
});
|
@@ -179674,7 +179906,8 @@ async function convertToConfigBundle(event) {
|
|
179674
179906
|
event.config.containers?.map((c6) => c6.class_name)
|
179675
179907
|
),
|
179676
179908
|
containerBuildId: event.config.dev?.containerBuildId,
|
179677
|
-
containerEngine: event.config.dev.containerEngine
|
179909
|
+
containerEngine: event.config.dev.containerEngine,
|
179910
|
+
enableContainers: event.config.dev.enableContainers ?? true
|
179678
179911
|
};
|
179679
179912
|
}
|
179680
179913
|
async function getContainerDevOptions(containersConfig, containerBuildId) {
|
@@ -179704,12 +179937,12 @@ async function getContainerDevOptions(containersConfig, containerBuildId) {
|
|
179704
179937
|
}
|
179705
179938
|
return containers2;
|
179706
179939
|
}
|
179707
|
-
var import_node_assert34,
|
179940
|
+
var import_node_assert34, import_node_crypto15, import_promises36, import_miniflare26, LocalRuntimeController;
|
179708
179941
|
var init_LocalRuntimeController = __esm({
|
179709
179942
|
"src/api/startDevWorker/LocalRuntimeController.ts"() {
|
179710
179943
|
init_import_meta_url();
|
179711
179944
|
import_node_assert34 = __toESM(require("assert"));
|
179712
|
-
|
179945
|
+
import_node_crypto15 = require("crypto");
|
179713
179946
|
import_promises36 = require("fs/promises");
|
179714
179947
|
init_containers_shared();
|
179715
179948
|
init_source();
|
@@ -179736,7 +179969,7 @@ var init_LocalRuntimeController = __esm({
|
|
179736
179969
|
// This is given as a shared secret to the Proxy and User workers
|
179737
179970
|
// so that the User Worker can trust aspects of HTTP requests from the Proxy Worker
|
179738
179971
|
// if it provides the secret in a `MF-Proxy-Shared-Secret` header.
|
179739
|
-
#proxyToUserWorkerAuthenticationSecret = (0,
|
179972
|
+
#proxyToUserWorkerAuthenticationSecret = (0, import_node_crypto15.randomUUID)();
|
179740
179973
|
// `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
|
179741
179974
|
// updates were submitted, the second may apply before the first. Therefore,
|
179742
179975
|
// wrap updates in a mutex, so they're always applied in invocation order.
|
@@ -179764,14 +179997,22 @@ var init_LocalRuntimeController = __esm({
|
|
179764
179997
|
const configBundle = await convertToConfigBundle(data);
|
179765
179998
|
const experimentalRemoteBindings = data.config.dev.experimentalRemoteBindings ?? false;
|
179766
179999
|
if (experimentalRemoteBindings && !data.config.dev?.remote) {
|
179767
|
-
const { maybeStartOrUpdateRemoteProxySession: maybeStartOrUpdateRemoteProxySession2 } = await Promise.resolve().then(() => (init_remoteBindings(), remoteBindings_exports));
|
180000
|
+
const { maybeStartOrUpdateRemoteProxySession: maybeStartOrUpdateRemoteProxySession2, pickRemoteBindings: pickRemoteBindings2 } = await Promise.resolve().then(() => (init_remoteBindings(), remoteBindings_exports));
|
180001
|
+
const remoteBindings = pickRemoteBindings2(
|
180002
|
+
convertCfWorkerInitBindingsToBindings(configBundle.bindings) ?? {}
|
180003
|
+
);
|
180004
|
+
const auth = Object.keys(remoteBindings).length === 0 ? (
|
180005
|
+
// If there are no remote bindings (this is a local only session) there's no need to get auth data
|
180006
|
+
void 0
|
180007
|
+
) : await unwrapHook(data.config.dev.auth);
|
179768
180008
|
this.#remoteProxySessionData = await maybeStartOrUpdateRemoteProxySession2(
|
179769
180009
|
{
|
179770
180010
|
name: configBundle.name,
|
179771
180011
|
complianceRegion: configBundle.complianceRegion,
|
179772
|
-
bindings:
|
180012
|
+
bindings: remoteBindings
|
179773
180013
|
},
|
179774
|
-
this.#remoteProxySessionData ?? null
|
180014
|
+
this.#remoteProxySessionData ?? null,
|
180015
|
+
auth
|
179775
180016
|
);
|
179776
180017
|
}
|
179777
180018
|
if (data.config.containers?.length && data.config.dev.enableContainers && this.#currentContainerBuildId !== data.config.dev.containerBuildId) {
|
@@ -179958,12 +180199,12 @@ function ensureMatchingSql(options) {
|
|
179958
180199
|
}
|
179959
180200
|
return options;
|
179960
180201
|
}
|
179961
|
-
var import_node_assert35,
|
180202
|
+
var import_node_assert35, import_node_crypto16, import_miniflare27, MultiworkerRuntimeController;
|
179962
180203
|
var init_MultiworkerRuntimeController = __esm({
|
179963
180204
|
"src/api/startDevWorker/MultiworkerRuntimeController.ts"() {
|
179964
180205
|
init_import_meta_url();
|
179965
180206
|
import_node_assert35 = __toESM(require("assert"));
|
179966
|
-
|
180207
|
+
import_node_crypto16 = require("crypto");
|
179967
180208
|
init_containers_shared();
|
179968
180209
|
init_source();
|
179969
180210
|
import_miniflare27 = require("miniflare");
|
@@ -179990,7 +180231,7 @@ var init_MultiworkerRuntimeController = __esm({
|
|
179990
180231
|
// This is given as a shared secret to the Proxy and User workers
|
179991
180232
|
// so that the User Worker can trust aspects of HTTP requests from the Proxy Worker
|
179992
180233
|
// if it provides the secret in a `MF-Proxy-Shared-Secret` header.
|
179993
|
-
#proxyToUserWorkerAuthenticationSecret = (0,
|
180234
|
+
#proxyToUserWorkerAuthenticationSecret = (0, import_node_crypto16.randomUUID)();
|
179994
180235
|
// `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
|
179995
180236
|
// updates were submitted, the second may apply before the first. Therefore,
|
179996
180237
|
// wrap updates in a mutex, so they're always applied in invocation order.
|
@@ -184067,85 +184308,6 @@ var init_executionContext = __esm({
|
|
184067
184308
|
}
|
184068
184309
|
});
|
184069
184310
|
|
184070
|
-
// src/api/integrations/platform/services.ts
|
184071
|
-
async function getServiceBindings(services = []) {
|
184072
|
-
if (services.length === 0) {
|
184073
|
-
return;
|
184074
|
-
}
|
184075
|
-
const registeredWorkers = await maybeGetRegisteredWorkers();
|
184076
|
-
if (!registeredWorkers) {
|
184077
|
-
return;
|
184078
|
-
}
|
184079
|
-
const foundServices = [];
|
184080
|
-
for (const { binding: bindingName, service: serviceName } of services) {
|
184081
|
-
const worker = registeredWorkers[serviceName];
|
184082
|
-
if (worker) {
|
184083
|
-
foundServices.push({
|
184084
|
-
bindingName,
|
184085
|
-
serviceName,
|
184086
|
-
workerDefinition: worker
|
184087
|
-
});
|
184088
|
-
}
|
184089
|
-
}
|
184090
|
-
const serviceBindings = {};
|
184091
|
-
for (const bindingInfo of foundServices) {
|
184092
|
-
serviceBindings[bindingInfo.bindingName] = getServiceBindingProxyFetch(bindingInfo);
|
184093
|
-
}
|
184094
|
-
return serviceBindings;
|
184095
|
-
}
|
184096
|
-
function getServiceBindingProxyFetch({
|
184097
|
-
workerDefinition,
|
184098
|
-
bindingName,
|
184099
|
-
serviceName
|
184100
|
-
}) {
|
184101
|
-
const { protocol, host, port } = workerDefinition;
|
184102
|
-
const getExternalUrl = /* @__PURE__ */ __name((request4) => {
|
184103
|
-
const newUrl = new URL(request4.url);
|
184104
|
-
if (protocol) {
|
184105
|
-
newUrl.protocol = protocol;
|
184106
|
-
}
|
184107
|
-
if (host) {
|
184108
|
-
newUrl.host = host;
|
184109
|
-
}
|
184110
|
-
if (port) {
|
184111
|
-
newUrl.port = `${port}`;
|
184112
|
-
}
|
184113
|
-
return newUrl;
|
184114
|
-
}, "getExternalUrl");
|
184115
|
-
return async (request4) => {
|
184116
|
-
const newUrl = getExternalUrl(request4);
|
184117
|
-
try {
|
184118
|
-
const resp = await (0, import_undici26.fetch)(newUrl, request4);
|
184119
|
-
const respBody = await resp.arrayBuffer();
|
184120
|
-
return new import_miniflare30.Response(respBody, resp);
|
184121
|
-
} catch {
|
184122
|
-
return new import_miniflare30.Response(
|
184123
|
-
`Error: Unable to fetch from external service (${serviceName} bound with ${bindingName} binding), please make sure that the service is still running with \`wrangler dev\``,
|
184124
|
-
{ status: 500 }
|
184125
|
-
);
|
184126
|
-
}
|
184127
|
-
};
|
184128
|
-
}
|
184129
|
-
async function maybeGetRegisteredWorkers() {
|
184130
|
-
try {
|
184131
|
-
return await getRegisteredWorkers2();
|
184132
|
-
} catch {
|
184133
|
-
return void 0;
|
184134
|
-
}
|
184135
|
-
}
|
184136
|
-
var import_miniflare30, import_undici26;
|
184137
|
-
var init_services = __esm({
|
184138
|
-
"src/api/integrations/platform/services.ts"() {
|
184139
|
-
init_import_meta_url();
|
184140
|
-
import_miniflare30 = require("miniflare");
|
184141
|
-
import_undici26 = __toESM(require_undici());
|
184142
|
-
init_dev_registry();
|
184143
|
-
__name(getServiceBindings, "getServiceBindings");
|
184144
|
-
__name(getServiceBindingProxyFetch, "getServiceBindingProxyFetch");
|
184145
|
-
__name(maybeGetRegisteredWorkers, "maybeGetRegisteredWorkers");
|
184146
|
-
}
|
184147
|
-
});
|
184148
|
-
|
184149
184311
|
// src/api/integrations/platform/index.ts
|
184150
184312
|
async function getPlatformProxy(options = {}) {
|
184151
184313
|
const experimentalRemoteBindings = !!options.experimental?.remoteBindings;
|
@@ -184156,7 +184318,10 @@ async function getPlatformProxy(options = {}) {
|
|
184156
184318
|
});
|
184157
184319
|
let remoteProxySession = void 0;
|
184158
184320
|
if (experimentalRemoteBindings && config.configPath) {
|
184159
|
-
remoteProxySession = (await maybeStartOrUpdateRemoteProxySession(
|
184321
|
+
remoteProxySession = (await maybeStartOrUpdateRemoteProxySession({
|
184322
|
+
path: config.configPath,
|
184323
|
+
environment: env6
|
184324
|
+
}) ?? {}).session;
|
184160
184325
|
}
|
184161
184326
|
const miniflareOptions = await getMiniflareOptionsFromConfig({
|
184162
184327
|
config,
|
@@ -184164,7 +184329,7 @@ async function getPlatformProxy(options = {}) {
|
|
184164
184329
|
remoteProxyConnectionString: remoteProxySession?.remoteProxyConnectionString,
|
184165
184330
|
remoteBindingsEnabled: experimentalRemoteBindings
|
184166
184331
|
});
|
184167
|
-
const mf = new
|
184332
|
+
const mf = new import_miniflare30.Miniflare(miniflareOptions);
|
184168
184333
|
const bindings = await mf.getBindings();
|
184169
184334
|
const cf2 = await mf.getCf();
|
184170
184335
|
deepFreeze(cf2);
|
@@ -184207,18 +184372,12 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184207
184372
|
`);
|
184208
184373
|
}
|
184209
184374
|
}
|
184210
|
-
const workerDefinitions = await getBoundRegisteredWorkers({
|
184211
|
-
name: config.name,
|
184212
|
-
services: bindings.services,
|
184213
|
-
durableObjects: config["durable_objects"],
|
184214
|
-
tailConsumers: []
|
184215
|
-
});
|
184216
184375
|
const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions(
|
184217
184376
|
{
|
184218
184377
|
name: config.name,
|
184219
184378
|
complianceRegion: config.compliance_region,
|
184220
184379
|
bindings,
|
184221
|
-
workerDefinitions,
|
184380
|
+
workerDefinitions: null,
|
184222
184381
|
queueConsumers: void 0,
|
184223
184382
|
services: bindings.services,
|
184224
184383
|
serviceBindings: {},
|
@@ -184228,7 +184387,8 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184228
184387
|
containerDOClassNames: new Set(
|
184229
184388
|
config.containers?.map((c6) => c6.class_name)
|
184230
184389
|
),
|
184231
|
-
containerBuildId: void 0
|
184390
|
+
containerBuildId: void 0,
|
184391
|
+
enableContainers: config.dev.enable_containers
|
184232
184392
|
},
|
184233
184393
|
remoteProxyConnectionString,
|
184234
184394
|
remoteBindingsEnabled
|
@@ -184244,7 +184404,6 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184244
184404
|
}
|
184245
184405
|
const assetOptions = processedAssetOptions ? buildAssetOptions({ assets: processedAssetOptions }) : {};
|
184246
184406
|
const defaultPersistRoot = getMiniflarePersistRoot(options.persist);
|
184247
|
-
const serviceBindings = await getServiceBindings(bindings.services);
|
184248
184407
|
const miniflareOptions = {
|
184249
184408
|
workers: [
|
184250
184409
|
{
|
@@ -184252,10 +184411,6 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184252
184411
|
modules: true,
|
184253
184412
|
name: config.name,
|
184254
184413
|
...bindingOptions,
|
184255
|
-
serviceBindings: {
|
184256
|
-
...serviceBindings,
|
184257
|
-
...bindingOptions.serviceBindings
|
184258
|
-
},
|
184259
184414
|
...assetOptions
|
184260
184415
|
},
|
184261
184416
|
...externalWorkers
|
@@ -184265,7 +184420,9 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184265
184420
|
return {
|
184266
184421
|
script: "",
|
184267
184422
|
modules: true,
|
184268
|
-
...miniflareOptions
|
184423
|
+
...miniflareOptions,
|
184424
|
+
unsafeDevRegistryPath: getRegistryPath(),
|
184425
|
+
unsafeDevRegistryDurableObjectProxy: true
|
184269
184426
|
};
|
184270
184427
|
}
|
184271
184428
|
function getMiniflarePersistRoot(persist) {
|
@@ -184295,6 +184452,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184295
184452
|
config.containers?.map((c6) => c6.class_name)
|
184296
184453
|
);
|
184297
184454
|
const bindings = getBindings2(config, env6, options?.envFiles, true, {}, true);
|
184455
|
+
const enableContainers = options?.overrides?.enableContainers !== void 0 ? options?.overrides?.enableContainers : config.dev.enable_containers;
|
184298
184456
|
const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions(
|
184299
184457
|
{
|
184300
184458
|
name: config.name,
|
@@ -184308,7 +184466,8 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184308
184466
|
imagesLocalMode: !!options?.imagesLocalMode,
|
184309
184467
|
tails: config.tail_consumers,
|
184310
184468
|
containerDOClassNames,
|
184311
|
-
containerBuildId: options?.containerBuildId
|
184469
|
+
containerBuildId: options?.containerBuildId,
|
184470
|
+
enableContainers
|
184312
184471
|
},
|
184313
184472
|
options?.remoteProxyConnectionString,
|
184314
184473
|
options?.remoteBindingsEnabled ?? false
|
@@ -184316,7 +184475,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184316
184475
|
if (bindings.services !== void 0) {
|
184317
184476
|
bindingOptions.serviceBindings = Object.fromEntries(
|
184318
184477
|
bindings.services.map((binding) => {
|
184319
|
-
const name2 = binding.service === config.name ?
|
184478
|
+
const name2 = binding.service === config.name ? import_miniflare30.kCurrentWorker : binding.service;
|
184320
184479
|
if (options?.remoteProxyConnectionString && binding.experimental_remote) {
|
184321
184480
|
return [
|
184322
184481
|
binding.binding,
|
@@ -184342,11 +184501,11 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184342
184501
|
className: binding.class_name,
|
184343
184502
|
scriptName: binding.script_name,
|
184344
184503
|
useSQLite,
|
184345
|
-
container: getImageNameFromDOClassName({
|
184504
|
+
container: enableContainers && config.containers?.length ? getImageNameFromDOClassName({
|
184346
184505
|
doClassName: binding.class_name,
|
184347
184506
|
containerDOClassNames,
|
184348
184507
|
containerBuildId: options?.containerBuildId
|
184349
|
-
})
|
184508
|
+
}) : void 0
|
184350
184509
|
}
|
184351
184510
|
];
|
184352
184511
|
})
|
@@ -184377,18 +184536,17 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184377
184536
|
externalWorkers
|
184378
184537
|
};
|
184379
184538
|
}
|
184380
|
-
var
|
184539
|
+
var import_miniflare30;
|
184381
184540
|
var init_platform = __esm({
|
184382
184541
|
"src/api/integrations/platform/index.ts"() {
|
184383
184542
|
init_import_meta_url();
|
184384
184543
|
init_containers_shared();
|
184385
|
-
|
184544
|
+
import_miniflare30 = require("miniflare");
|
184386
184545
|
init_assets();
|
184387
184546
|
init_config2();
|
184388
184547
|
init_entry();
|
184389
184548
|
init_rules();
|
184390
184549
|
init_dev2();
|
184391
|
-
init_dev_registry();
|
184392
184550
|
init_class_names_sqlite();
|
184393
184551
|
init_miniflare();
|
184394
184552
|
init_misc_variables();
|
@@ -184398,7 +184556,6 @@ var init_platform = __esm({
|
|
184398
184556
|
init_remoteBindings();
|
184399
184557
|
init_caches();
|
184400
184558
|
init_executionContext();
|
184401
|
-
init_services();
|
184402
184559
|
init_dev_vars();
|
184403
184560
|
__name(getPlatformProxy, "getPlatformProxy");
|
184404
184561
|
__name(getMiniflareOptionsFromConfig, "getMiniflareOptionsFromConfig");
|
@@ -184432,6 +184589,7 @@ var init_api3 = __esm({
|
|
184432
184589
|
// src/cli.ts
|
184433
184590
|
var cli_exports2 = {};
|
184434
184591
|
__export(cli_exports2, {
|
184592
|
+
experimental_getWranglerCommands: () => experimental_getWranglerCommands,
|
184435
184593
|
experimental_maybeStartOrUpdateRemoteProxySession: () => maybeStartOrUpdateRemoteProxySession,
|
184436
184594
|
experimental_patchConfig: () => experimental_patchConfig,
|
184437
184595
|
experimental_pickRemoteBindings: () => pickRemoteBindings,
|
@@ -184530,6 +184688,17 @@ var PatchConfigError = class extends Error {
|
|
184530
184688
|
|
184531
184689
|
// src/cli.ts
|
184532
184690
|
init_api3();
|
184691
|
+
|
184692
|
+
// src/experimental-commands-api.ts
|
184693
|
+
init_import_meta_url();
|
184694
|
+
init_src();
|
184695
|
+
function experimental_getWranglerCommands() {
|
184696
|
+
const { registry } = createCLIParser([]);
|
184697
|
+
return registry.getDefinitionTreeRoot();
|
184698
|
+
}
|
184699
|
+
__name(experimental_getWranglerCommands, "experimental_getWranglerCommands");
|
184700
|
+
|
184701
|
+
// src/cli.ts
|
184533
184702
|
if (typeof vitest === "undefined" && require.main === module) {
|
184534
184703
|
main(hideBin(import_process5.default.argv)).catch((e7) => {
|
184535
184704
|
const exitCode = e7 instanceof FatalError && e7.code || 1;
|
@@ -184542,6 +184711,7 @@ var generateASSETSBinding2 = (
|
|
184542
184711
|
);
|
184543
184712
|
// Annotate the CommonJS export names for ESM import in node:
|
184544
184713
|
0 && (module.exports = {
|
184714
|
+
experimental_getWranglerCommands,
|
184545
184715
|
experimental_maybeStartOrUpdateRemoteProxySession,
|
184546
184716
|
experimental_patchConfig,
|
184547
184717
|
experimental_pickRemoteBindings,
|