wrangler 4.28.1 → 4.29.1
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 +10 -10
- package/wrangler-dist/cli.d.ts +236 -2
- package/wrangler-dist/cli.js +296 -257
- 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
|
|
@@ -33785,7 +33815,7 @@ var name, version;
|
|
33785
33815
|
var init_package = __esm({
|
33786
33816
|
"package.json"() {
|
33787
33817
|
name = "wrangler";
|
33788
|
-
version = "4.
|
33818
|
+
version = "4.29.1";
|
33789
33819
|
}
|
33790
33820
|
});
|
33791
33821
|
|
@@ -34459,17 +34489,6 @@ async function ensureQueuesExist(config, queueNames) {
|
|
34459
34489
|
async function getQueueById(config, accountId, queueId) {
|
34460
34490
|
return fetchResult(config, queuesUrl(accountId, queueId), {});
|
34461
34491
|
}
|
34462
|
-
async function putQueue(config, queueName, body) {
|
34463
|
-
const queue = await getQueue(config, queueName);
|
34464
|
-
return putQueueById(config, queue.queue_id, body);
|
34465
|
-
}
|
34466
|
-
async function putQueueById(config, queueId, body) {
|
34467
|
-
const accountId = await requireAuth(config);
|
34468
|
-
return fetchResult(config, queuesUrl(accountId, queueId), {
|
34469
|
-
method: "PUT",
|
34470
|
-
body: JSON.stringify(body)
|
34471
|
-
});
|
34472
|
-
}
|
34473
34492
|
async function postConsumer(config, queueName, body) {
|
34474
34493
|
const queue = await getQueue(config, queueName);
|
34475
34494
|
return postConsumerById(config, queue.queue_id, body);
|
@@ -34622,8 +34641,6 @@ var init_client2 = __esm({
|
|
34622
34641
|
__name(ensureQueuesExistByConfig, "ensureQueuesExistByConfig");
|
34623
34642
|
__name(ensureQueuesExist, "ensureQueuesExist");
|
34624
34643
|
__name(getQueueById, "getQueueById");
|
34625
|
-
__name(putQueue, "putQueue");
|
34626
|
-
__name(putQueueById, "putQueueById");
|
34627
34644
|
__name(postConsumer, "postConsumer");
|
34628
34645
|
__name(postConsumerById, "postConsumerById");
|
34629
34646
|
__name(putConsumerById, "putConsumerById");
|
@@ -36325,7 +36342,7 @@ function unwindPropertyPath(root, path72) {
|
|
36325
36342
|
}
|
36326
36343
|
return { container, field: parts[parts.length - 1] };
|
36327
36344
|
}
|
36328
|
-
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;
|
36329
36346
|
var init_validation_helpers = __esm({
|
36330
36347
|
"src/config/validation-helpers.ts"() {
|
36331
36348
|
init_import_meta_url();
|
@@ -36566,6 +36583,23 @@ var init_validation_helpers = __esm({
|
|
36566
36583
|
(entry) => isRecord(entry) && "binding" in entry && typeof entry.binding === "string"
|
36567
36584
|
), "isNamespaceList");
|
36568
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");
|
36569
36603
|
}
|
36570
36604
|
});
|
36571
36605
|
|
@@ -37344,7 +37378,10 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
37344
37378
|
rawEnv,
|
37345
37379
|
envName,
|
37346
37380
|
"workflows",
|
37347
|
-
|
37381
|
+
all(
|
37382
|
+
validateBindingArray(envName, validateWorkflowBinding),
|
37383
|
+
validateUniqueNameProperty
|
37384
|
+
),
|
37348
37385
|
[]
|
37349
37386
|
),
|
37350
37387
|
migrations: inheritable(
|
@@ -66015,12 +66052,13 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
|
|
66015
66052
|
buildCmd,
|
66016
66053
|
dockerfile
|
66017
66054
|
}).ready;
|
66018
|
-
const repoDigests = await dockerImageInspect(pathToDocker, {
|
66019
|
-
imageTag,
|
66020
|
-
formatString: "{{json .RepoDigests}}"
|
66021
|
-
});
|
66022
66055
|
let pushed = false;
|
66023
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);
|
66024
66062
|
const account = await loadAccount();
|
66025
66063
|
await ensureContainerLimits({
|
66026
66064
|
pathToDocker,
|
@@ -66030,16 +66068,21 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
|
|
66030
66068
|
});
|
66031
66069
|
await dockerLoginManagedRegistry(pathToDocker);
|
66032
66070
|
try {
|
66033
|
-
const
|
66071
|
+
const [digests, imageId] = imageInfo.split(" ");
|
66072
|
+
const parsedDigests = JSON.parse(digests);
|
66034
66073
|
if (!Array.isArray(parsedDigests)) {
|
66035
66074
|
throw new Error(
|
66036
66075
|
`Expected RepoDigests from docker inspect to be an array but got ${JSON.stringify(parsedDigests)}`
|
66037
66076
|
);
|
66038
66077
|
}
|
66039
|
-
const repositoryOnly =
|
66040
|
-
|
66041
|
-
|
66042
|
-
);
|
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
|
+
});
|
66043
66086
|
if (rest.length > 0) {
|
66044
66087
|
throw new Error(
|
66045
66088
|
`Expected there to only be 1 valid digests for this repository: ${repositoryOnly} but there were ${rest.length + 1}`
|
@@ -66051,35 +66094,43 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
|
|
66051
66094
|
image
|
66052
66095
|
);
|
66053
66096
|
const remoteDigest = `${resolvedImage}@${hash}`;
|
66054
|
-
|
66055
|
-
|
66056
|
-
|
66057
|
-
"
|
66058
|
-
|
66059
|
-
|
66097
|
+
const remoteManifest = runDockerCmdWithOutput(pathToDocker, [
|
66098
|
+
"manifest",
|
66099
|
+
"inspect",
|
66100
|
+
"-v",
|
66101
|
+
remoteDigest
|
66102
|
+
]);
|
66060
66103
|
logger.debug(
|
66061
|
-
`
|
66104
|
+
`'docker manifest inspect -v ${remoteDigest}:`,
|
66105
|
+
remoteManifest
|
66062
66106
|
);
|
66063
|
-
|
66064
|
-
|
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
|
+
}
|
66065
66116
|
} catch (error2) {
|
66066
66117
|
if (error2 instanceof Error) {
|
66067
66118
|
logger.debug(
|
66068
66119
|
`Checking for local image ${args.tag} failed with error: ${error2.message}`
|
66069
66120
|
);
|
66070
66121
|
}
|
66071
|
-
const namespacedImageTag = getCloudflareRegistryWithAccountNamespace(
|
66072
|
-
account.external_account_id,
|
66073
|
-
args.tag
|
66074
|
-
);
|
66075
|
-
logger.log(
|
66076
|
-
`Image does not exist remotely, pushing: ${namespacedImageTag}`
|
66077
|
-
);
|
66078
|
-
await runDockerCmd(pathToDocker, ["tag", imageTag, namespacedImageTag]);
|
66079
|
-
await runDockerCmd(pathToDocker, ["push", namespacedImageTag]);
|
66080
|
-
await runDockerCmd(pathToDocker, ["image", "rm", namespacedImageTag]);
|
66081
|
-
pushed = true;
|
66082
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;
|
66083
66134
|
}
|
66084
66135
|
return { image: imageTag, pushed };
|
66085
66136
|
} catch (error2) {
|
@@ -66919,6 +66970,7 @@ async function fillOpenAPIConfiguration(config, scope) {
|
|
66919
66970
|
...OpenAPI.HEADERS ?? {},
|
66920
66971
|
...Object.fromEntries(headers.entries())
|
66921
66972
|
};
|
66973
|
+
OpenAPI.LOGGER = logger;
|
66922
66974
|
}
|
66923
66975
|
function checkEverythingIsSet(object, keys) {
|
66924
66976
|
keys.forEach((key) => {
|
@@ -67450,13 +67502,15 @@ var init_args = __esm({
|
|
67450
67502
|
function deleteYargs(args) {
|
67451
67503
|
return args.positional("ID", {
|
67452
67504
|
describe: "id of the containers to delete",
|
67453
|
-
type: "string"
|
67505
|
+
type: "string",
|
67506
|
+
demandOption: true
|
67454
67507
|
});
|
67455
67508
|
}
|
67456
67509
|
async function deleteCommand(deleteArgs, _config) {
|
67457
|
-
|
67458
|
-
|
67459
|
-
|
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.`
|
67460
67514
|
);
|
67461
67515
|
}
|
67462
67516
|
startSection("Delete your container");
|
@@ -68360,9 +68414,12 @@ ${err.message}`
|
|
68360
68414
|
);
|
68361
68415
|
}
|
68362
68416
|
}
|
68363
|
-
success(
|
68364
|
-
|
68365
|
-
|
68417
|
+
success(
|
68418
|
+
`Modified application ${brandColor(action.name)} (Application ID: ${action.id})`,
|
68419
|
+
{
|
68420
|
+
shape: shapes.bar
|
68421
|
+
}
|
68422
|
+
);
|
68366
68423
|
}
|
68367
68424
|
}, "doAction");
|
68368
68425
|
__name(cleanApplicationFromAPI, "cleanApplicationFromAPI");
|
@@ -68601,7 +68658,10 @@ var init_config3 = __esm({
|
|
68601
68658
|
max_instances: container.max_instances ?? 0,
|
68602
68659
|
scheduling_policy: container.scheduling_policy ?? "default" /* DEFAULT */,
|
68603
68660
|
constraints: {
|
68604
|
-
|
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,
|
68605
68665
|
regions: container.constraints?.regions?.map(
|
68606
68666
|
(region) => region.toUpperCase()
|
68607
68667
|
),
|
@@ -71978,8 +72038,11 @@ ${dashLink}`);
|
|
71978
72038
|
);
|
71979
72039
|
}
|
71980
72040
|
if (config.queues.producers && config.queues.producers.length) {
|
71981
|
-
|
71982
|
-
|
72041
|
+
deployments.push(
|
72042
|
+
...config.queues.producers.map(
|
72043
|
+
(producer) => Promise.resolve([`Producer for ${producer.queue}`])
|
72044
|
+
)
|
72045
|
+
);
|
71983
72046
|
}
|
71984
72047
|
if (config.queues.consumers && config.queues.consumers.length) {
|
71985
72048
|
const updateConsumers = await updateQueueConsumers(scriptName, config);
|
@@ -74424,7 +74487,7 @@ var require_websocket2 = __commonJS({
|
|
74424
74487
|
var http5 = require("http");
|
74425
74488
|
var net2 = require("net");
|
74426
74489
|
var tls = require("tls");
|
74427
|
-
var { randomBytes: randomBytes2, createHash:
|
74490
|
+
var { randomBytes: randomBytes2, createHash: createHash8 } = require("crypto");
|
74428
74491
|
var { Duplex: Duplex2, Readable: Readable8 } = require("stream");
|
74429
74492
|
var { URL: URL7 } = require("url");
|
74430
74493
|
var PerMessageDeflate = require_permessage_deflate2();
|
@@ -75084,7 +75147,7 @@ var require_websocket2 = __commonJS({
|
|
75084
75147
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
75085
75148
|
return;
|
75086
75149
|
}
|
75087
|
-
const digest =
|
75150
|
+
const digest = createHash8("sha1").update(key + GUID).digest("base64");
|
75088
75151
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
75089
75152
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
75090
75153
|
return;
|
@@ -75376,7 +75439,7 @@ var require_websocket_server = __commonJS({
|
|
75376
75439
|
var EventEmitter5 = require("events");
|
75377
75440
|
var http5 = require("http");
|
75378
75441
|
var { Duplex: Duplex2 } = require("stream");
|
75379
|
-
var { createHash:
|
75442
|
+
var { createHash: createHash8 } = require("crypto");
|
75380
75443
|
var extension = require_extension();
|
75381
75444
|
var PerMessageDeflate = require_permessage_deflate2();
|
75382
75445
|
var subprotocol = require_subprotocol();
|
@@ -75674,7 +75737,7 @@ var require_websocket_server = __commonJS({
|
|
75674
75737
|
);
|
75675
75738
|
}
|
75676
75739
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
75677
|
-
const digest =
|
75740
|
+
const digest = createHash8("sha1").update(key + GUID).digest("base64");
|
75678
75741
|
const headers = [
|
75679
75742
|
"HTTP/1.1 101 Switching Protocols",
|
75680
75743
|
"Upgrade: websocket",
|
@@ -79476,13 +79539,14 @@ var init_build3 = __esm({
|
|
79476
79539
|
provideConfig: false
|
79477
79540
|
},
|
79478
79541
|
async handler(buildArgs) {
|
79479
|
-
|
79542
|
+
const { wrangler } = createCLIParser([
|
79480
79543
|
"deploy",
|
79481
79544
|
"--dry-run",
|
79482
79545
|
"--outdir=dist",
|
79483
79546
|
...buildArgs.env ? ["--env", buildArgs.env] : [],
|
79484
79547
|
...buildArgs.config ? ["--config", buildArgs.config] : []
|
79485
|
-
])
|
79548
|
+
]);
|
79549
|
+
await wrangler.parse();
|
79486
79550
|
}
|
79487
79551
|
});
|
79488
79552
|
}
|
@@ -85402,7 +85466,7 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
85402
85466
|
`The entrypoint ${import_node_path28.default.relative(
|
85403
85467
|
process.cwd(),
|
85404
85468
|
entryFile
|
85405
|
-
)} defines a Python worker, support for Python workers is currently experimental
|
85469
|
+
)} defines a Python worker, support for Python workers is currently experimental.`
|
85406
85470
|
);
|
85407
85471
|
return { format: "modules", exports: [] };
|
85408
85472
|
}
|
@@ -85992,6 +86056,13 @@ var init_deploy4 = __esm({
|
|
85992
86056
|
requiresArg: true,
|
85993
86057
|
array: true
|
85994
86058
|
},
|
86059
|
+
domains: {
|
86060
|
+
describe: "Custom domains to deploy to",
|
86061
|
+
alias: "domain",
|
86062
|
+
type: "string",
|
86063
|
+
requiresArg: true,
|
86064
|
+
array: true
|
86065
|
+
},
|
85995
86066
|
"jsx-factory": {
|
85996
86067
|
describe: "The function that is called for each JSX element",
|
85997
86068
|
type: "string",
|
@@ -86162,6 +86233,7 @@ var init_deploy4 = __esm({
|
|
86162
86233
|
jsxFragment: args.jsxFragment,
|
86163
86234
|
tsconfig: args.tsconfig,
|
86164
86235
|
routes: args.routes,
|
86236
|
+
domains: args.domains,
|
86165
86237
|
assetsOptions,
|
86166
86238
|
legacyAssetPaths: siteAssetPaths,
|
86167
86239
|
legacyEnv: isLegacyEnv(config),
|
@@ -95557,9 +95629,14 @@ var init_deployments2 = __esm({
|
|
95557
95629
|
type: "string",
|
95558
95630
|
choices: ["production", "preview"],
|
95559
95631
|
description: "Environment type to list deployments for"
|
95632
|
+
},
|
95633
|
+
json: {
|
95634
|
+
type: "boolean",
|
95635
|
+
description: "Return output as clean JSON",
|
95636
|
+
default: false
|
95560
95637
|
}
|
95561
95638
|
},
|
95562
|
-
async handler({ projectName, environment }) {
|
95639
|
+
async handler({ projectName, environment, json }) {
|
95563
95640
|
const config = getConfigCache(
|
95564
95641
|
PAGES_CONFIG_CACHE_FILENAME
|
95565
95642
|
);
|
@@ -95601,7 +95678,11 @@ var init_deployments2 = __esm({
|
|
95601
95678
|
saveToConfigCache(PAGES_CONFIG_CACHE_FILENAME, {
|
95602
95679
|
account_id: accountId
|
95603
95680
|
});
|
95604
|
-
|
95681
|
+
if (json) {
|
95682
|
+
logger.log(JSON.stringify(data, null, 2));
|
95683
|
+
} else {
|
95684
|
+
logger.table(data);
|
95685
|
+
}
|
95605
95686
|
sendMetricsEvent("list pages deployments");
|
95606
95687
|
}
|
95607
95688
|
});
|
@@ -151736,6 +151817,31 @@ Changes to triggers (routes, custom domains, cron schedules, etc) must be applie
|
|
151736
151817
|
function formatTime3(duration) {
|
151737
151818
|
return `(${(duration / 1e3).toFixed(2)} sec)`;
|
151738
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
|
+
}
|
151739
151845
|
function generatePreviewAlias(scriptName) {
|
151740
151846
|
const warnAndExit = /* @__PURE__ */ __name(() => {
|
151741
151847
|
logger.warn(
|
@@ -151743,38 +151849,32 @@ function generatePreviewAlias(scriptName) {
|
|
151743
151849
|
);
|
151744
151850
|
return void 0;
|
151745
151851
|
}, "warnAndExit");
|
151746
|
-
|
151747
|
-
if (!branchName) {
|
151748
|
-
try {
|
151749
|
-
(0, import_node_child_process7.execSync)(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
|
151750
|
-
branchName = (0, import_node_child_process7.execSync)(`git rev-parse --abbrev-ref HEAD`).toString().trim();
|
151751
|
-
} catch {
|
151752
|
-
return warnAndExit();
|
151753
|
-
}
|
151754
|
-
}
|
151852
|
+
const branchName = getBranchName();
|
151755
151853
|
if (!branchName) {
|
151756
151854
|
return warnAndExit();
|
151757
151855
|
}
|
151758
|
-
const sanitizedAlias = branchName
|
151759
|
-
|
151760
|
-
sanitizedAlias
|
151761
|
-
);
|
151762
|
-
if (!isValidAlias) {
|
151856
|
+
const sanitizedAlias = sanitizeBranchName(branchName);
|
151857
|
+
if (!ALIAS_VALIDATION_REGEX.test(sanitizedAlias)) {
|
151763
151858
|
return warnAndExit();
|
151764
151859
|
}
|
151765
|
-
const
|
151766
|
-
|
151767
|
-
|
151768
|
-
return warnAndExit();
|
151860
|
+
const availableSpace = MAX_DNS_LABEL_LENGTH - scriptName.length - 1;
|
151861
|
+
if (sanitizedAlias.length <= availableSpace) {
|
151862
|
+
return sanitizedAlias;
|
151769
151863
|
}
|
151770
|
-
|
151864
|
+
const truncatedAlias = createTruncatedAlias(
|
151865
|
+
branchName,
|
151866
|
+
sanitizedAlias,
|
151867
|
+
availableSpace
|
151868
|
+
);
|
151869
|
+
return truncatedAlias || warnAndExit();
|
151771
151870
|
}
|
151772
|
-
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;
|
151773
151872
|
var init_upload2 = __esm({
|
151774
151873
|
"src/versions/upload.ts"() {
|
151775
151874
|
init_import_meta_url();
|
151776
151875
|
import_node_assert24 = __toESM(require("assert"));
|
151777
151876
|
import_node_child_process7 = require("child_process");
|
151877
|
+
import_node_crypto12 = require("crypto");
|
151778
151878
|
import_node_fs32 = require("fs");
|
151779
151879
|
import_node_path54 = __toESM(require("path"));
|
151780
151880
|
init_colors();
|
@@ -152096,6 +152196,12 @@ var init_upload2 = __esm({
|
|
152096
152196
|
});
|
152097
152197
|
__name(versionsUpload, "versionsUpload");
|
152098
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");
|
152099
152205
|
__name(generatePreviewAlias, "generatePreviewAlias");
|
152100
152206
|
}
|
152101
152207
|
});
|
@@ -156969,13 +157075,13 @@ function createCLIParser(argv) {
|
|
156969
157075
|
wrangler.version(false);
|
156970
157076
|
registry.registerAll();
|
156971
157077
|
wrangler.exitProcess(false);
|
156972
|
-
return wrangler;
|
157078
|
+
return { wrangler, registry };
|
156973
157079
|
}
|
156974
157080
|
async function main(argv) {
|
156975
157081
|
setupSentry();
|
156976
157082
|
checkMacOSVersion({ shouldThrow: false });
|
156977
157083
|
const startTime = Date.now();
|
156978
|
-
const wrangler = createCLIParser(argv);
|
157084
|
+
const { wrangler } = createCLIParser(argv);
|
156979
157085
|
let command2;
|
156980
157086
|
let metricsArgs;
|
156981
157087
|
let dispatcher;
|
@@ -157037,7 +157143,8 @@ async function main(argv) {
|
|
157037
157143
|
logger.log("");
|
157038
157144
|
if (e7 instanceof CommandLineArgsError) {
|
157039
157145
|
logger.error(e7.message);
|
157040
|
-
|
157146
|
+
const { wrangler: helpWrangler } = createCLIParser([...argv, "--help"]);
|
157147
|
+
await helpWrangler.parse();
|
157041
157148
|
} else if (isAuthenticationError(e7) || // Is this a Containers/Cloudchamber-based auth error?
|
157042
157149
|
// This is different because it uses a custom OpenAPI-based generated client
|
157043
157150
|
e7 instanceof UserError && e7.cause instanceof ApiError && e7.cause.status === 403) {
|
@@ -157348,20 +157455,23 @@ async function checkStartupHandler({
|
|
157348
157455
|
logger.loggerLevel = "error";
|
157349
157456
|
}
|
157350
157457
|
await spinnerWhile({
|
157351
|
-
promise: /* @__PURE__ */ __name(async () =>
|
157352
|
-
|
157353
|
-
|
157354
|
-
|
157355
|
-
|
157356
|
-
|
157357
|
-
|
157358
|
-
|
157359
|
-
|
157360
|
-
|
157361
|
-
|
157362
|
-
|
157363
|
-
|
157364
|
-
|
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"),
|
157365
157475
|
startMessage: "Building your Worker",
|
157366
157476
|
endMessage: source_default.green("Worker Built! \u{1F389}")
|
157367
157477
|
});
|
@@ -157820,8 +157930,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
157820
157930
|
{ telemetryMessage: "missing compatibility date when deploying" }
|
157821
157931
|
);
|
157822
157932
|
}
|
157933
|
+
const domainRoutes = (props.domains || []).map((domain2) => ({
|
157934
|
+
pattern: domain2,
|
157935
|
+
custom_domain: true
|
157936
|
+
}));
|
157823
157937
|
const routes = props.routes ?? config.routes ?? (config.route ? [config.route] : []) ?? [];
|
157824
|
-
|
157938
|
+
const allRoutes = [...routes, ...domainRoutes];
|
157939
|
+
validateRoutes3(allRoutes, props.assetsOptions);
|
157825
157940
|
const jsxFactory = props.jsxFactory || config.jsx_factory;
|
157826
157941
|
const jsxFragment = props.jsxFragment || config.jsx_fragment;
|
157827
157942
|
const keepVars = props.keepVars || config.keep_vars;
|
@@ -158286,7 +158401,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
158286
158401
|
dryRun: props.dryRun ?? false
|
158287
158402
|
});
|
158288
158403
|
}
|
158289
|
-
const targets = await triggersDeploy(
|
158404
|
+
const targets = await triggersDeploy({
|
158405
|
+
...props,
|
158406
|
+
routes: allRoutes
|
158407
|
+
});
|
158290
158408
|
logger.log("Current Version ID:", versionId);
|
158291
158409
|
return {
|
158292
158410
|
sourceMapSize,
|
@@ -158436,24 +158554,6 @@ async function publishRoutesFallback(complianceConfig, routes, {
|
|
158436
158554
|
function isAuthenticationError(e7) {
|
158437
158555
|
return e7 instanceof ParseError && e7.code === 1e4;
|
158438
158556
|
}
|
158439
|
-
async function updateQueueProducers(config) {
|
158440
|
-
const producers = config.queues.producers || [];
|
158441
|
-
const updateProducers = [];
|
158442
|
-
for (const producer of producers) {
|
158443
|
-
const body = {
|
158444
|
-
queue_name: producer.queue,
|
158445
|
-
settings: {
|
158446
|
-
delivery_delay: producer.delivery_delay
|
158447
|
-
}
|
158448
|
-
};
|
158449
|
-
updateProducers.push(
|
158450
|
-
putQueue(config, producer.queue, body).then(() => [
|
158451
|
-
`Producer for ${producer.queue}`
|
158452
|
-
])
|
158453
|
-
);
|
158454
|
-
}
|
158455
|
-
return updateProducers;
|
158456
|
-
}
|
158457
158557
|
async function updateQueueConsumers(scriptName, config) {
|
158458
158558
|
const consumers = config.queues.consumers || [];
|
158459
158559
|
const updateConsumers = [];
|
@@ -158634,7 +158734,6 @@ ${mountedAssetRoutes.map((route) => {
|
|
158634
158734
|
__name(publishRoutes, "publishRoutes");
|
158635
158735
|
__name(publishRoutesFallback, "publishRoutesFallback");
|
158636
158736
|
__name(isAuthenticationError, "isAuthenticationError");
|
158637
|
-
__name(updateQueueProducers, "updateQueueProducers");
|
158638
158737
|
__name(updateQueueConsumers, "updateQueueConsumers");
|
158639
158738
|
}
|
158640
158739
|
});
|
@@ -159553,10 +159652,10 @@ var init_ConfigController = __esm({
|
|
159553
159652
|
}
|
159554
159653
|
});
|
159555
159654
|
|
159556
|
-
// embed-worker:/
|
159655
|
+
// embed-worker:/Users/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
|
159557
159656
|
var import_node_path59, scriptPath, InspectorProxyWorker_default;
|
159558
159657
|
var init_InspectorProxyWorker = __esm({
|
159559
|
-
"embed-worker:/
|
159658
|
+
"embed-worker:/Users/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts"() {
|
159560
159659
|
init_import_meta_url();
|
159561
159660
|
import_node_path59 = __toESM(require("path"));
|
159562
159661
|
scriptPath = import_node_path59.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
|
@@ -159564,10 +159663,10 @@ var init_InspectorProxyWorker = __esm({
|
|
159564
159663
|
}
|
159565
159664
|
});
|
159566
159665
|
|
159567
|
-
// embed-worker:/
|
159666
|
+
// embed-worker:/Users/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts
|
159568
159667
|
var import_node_path60, scriptPath2, ProxyWorker_default;
|
159569
159668
|
var init_ProxyWorker = __esm({
|
159570
|
-
"embed-worker:/
|
159669
|
+
"embed-worker:/Users/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts"() {
|
159571
159670
|
init_import_meta_url();
|
159572
159671
|
import_node_path60 = __toESM(require("path"));
|
159573
159672
|
scriptPath2 = import_node_path60.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
|
@@ -178200,12 +178299,12 @@ function didMiniflareOptionsChange(prev, next) {
|
|
178200
178299
|
}
|
178201
178300
|
return !deepEquality(prev, next);
|
178202
178301
|
}
|
178203
|
-
var import_node_assert30,
|
178302
|
+
var import_node_assert30, import_node_crypto13, import_node_events4, import_node_path62, import_miniflare23, ProxyController, ProxyControllerLogger;
|
178204
178303
|
var init_ProxyController = __esm({
|
178205
178304
|
"src/api/startDevWorker/ProxyController.ts"() {
|
178206
178305
|
init_import_meta_url();
|
178207
178306
|
import_node_assert30 = __toESM(require("assert"));
|
178208
|
-
|
178307
|
+
import_node_crypto13 = require("crypto");
|
178209
178308
|
import_node_events4 = __toESM(require("events"));
|
178210
178309
|
import_node_path62 = __toESM(require("path"));
|
178211
178310
|
import_miniflare23 = require("miniflare");
|
@@ -178232,7 +178331,7 @@ var init_ProxyController = __esm({
|
|
178232
178331
|
inspectorProxyWorkerWebSocket;
|
178233
178332
|
latestConfig;
|
178234
178333
|
latestBundle;
|
178235
|
-
secret = (0,
|
178334
|
+
secret = (0, import_node_crypto13.randomUUID)();
|
178236
178335
|
createProxyWorker() {
|
178237
178336
|
if (this._torndown) {
|
178238
178337
|
return;
|
@@ -178739,7 +178838,7 @@ async function createPreviewSession(complianceConfig, account, ctx, abortSignal)
|
|
178739
178838
|
const inspector = new import_node_url12.URL(inspector_websocket);
|
178740
178839
|
inspector.searchParams.append("cf_workers_preview_token", token);
|
178741
178840
|
return {
|
178742
|
-
id:
|
178841
|
+
id: import_node_crypto14.default.randomUUID(),
|
178743
178842
|
value: token,
|
178744
178843
|
host: ctx.host ?? inspector.host,
|
178745
178844
|
inspectorUrl: switchHost(inspector.href, ctx.host, !!ctx.zone),
|
@@ -178832,11 +178931,11 @@ async function createWorkerPreview(complianceConfig, init3, account, ctx, sessio
|
|
178832
178931
|
);
|
178833
178932
|
return token;
|
178834
178933
|
}
|
178835
|
-
var
|
178934
|
+
var import_node_crypto14, import_node_url12, import_undici23;
|
178836
178935
|
var init_create_worker_preview = __esm({
|
178837
178936
|
"src/dev/create-worker-preview.ts"() {
|
178838
178937
|
init_import_meta_url();
|
178839
|
-
|
178938
|
+
import_node_crypto14 = __toESM(require("crypto"));
|
178840
178939
|
import_node_url12 = require("url");
|
178841
178940
|
import_undici23 = __toESM(require_undici());
|
178842
178941
|
init_cfetch();
|
@@ -179601,9 +179700,10 @@ function pickRemoteBindings(bindings) {
|
|
179601
179700
|
);
|
179602
179701
|
}
|
179603
179702
|
async function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObject, preExistingRemoteProxySessionData, auth) {
|
179703
|
+
let config;
|
179604
179704
|
if ("path" in wranglerOrWorkerConfigObject) {
|
179605
179705
|
const wranglerConfigObject = wranglerOrWorkerConfigObject;
|
179606
|
-
|
179706
|
+
config = readConfig({
|
179607
179707
|
config: wranglerConfigObject.path,
|
179608
179708
|
env: wranglerConfigObject.environment
|
179609
179709
|
});
|
@@ -179628,7 +179728,7 @@ async function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObject
|
|
179628
179728
|
remoteProxySession = await startRemoteProxySession(remoteBindings, {
|
179629
179729
|
workerName: workerConfigObject.name,
|
179630
179730
|
complianceRegion: workerConfigObject.complianceRegion,
|
179631
|
-
auth
|
179731
|
+
auth: getAuthHook(auth, config)
|
179632
179732
|
});
|
179633
179733
|
} else {
|
179634
179734
|
const remoteBindingsAreSameAsBefore = deepStrictEqual(
|
@@ -179641,7 +179741,7 @@ async function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObject
|
|
179641
179741
|
remoteProxySession = await startRemoteProxySession(remoteBindings, {
|
179642
179742
|
workerName: workerConfigObject.name,
|
179643
179743
|
complianceRegion: workerConfigObject.complianceRegion,
|
179644
|
-
auth
|
179744
|
+
auth: getAuthHook(auth, config)
|
179645
179745
|
});
|
179646
179746
|
}
|
179647
179747
|
} else {
|
@@ -179658,6 +179758,20 @@ async function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObject
|
|
179658
179758
|
remoteBindings
|
179659
179759
|
};
|
179660
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
|
+
}
|
179661
179775
|
function deepStrictEqual(source, target) {
|
179662
179776
|
try {
|
179663
179777
|
import_node_assert33.default.deepStrictEqual(source, target);
|
@@ -179676,10 +179790,12 @@ var init_remoteBindings = __esm({
|
|
179676
179790
|
init_config2();
|
179677
179791
|
init_misc_variables();
|
179678
179792
|
init_paths();
|
179793
|
+
init_user2();
|
179679
179794
|
init_startDevWorker();
|
179680
179795
|
__name(startRemoteProxySession, "startRemoteProxySession");
|
179681
179796
|
__name(pickRemoteBindings, "pickRemoteBindings");
|
179682
179797
|
__name(maybeStartOrUpdateRemoteProxySession, "maybeStartOrUpdateRemoteProxySession");
|
179798
|
+
__name(getAuthHook, "getAuthHook");
|
179683
179799
|
__name(deepStrictEqual, "deepStrictEqual");
|
179684
179800
|
}
|
179685
179801
|
});
|
@@ -179821,12 +179937,12 @@ async function getContainerDevOptions(containersConfig, containerBuildId) {
|
|
179821
179937
|
}
|
179822
179938
|
return containers2;
|
179823
179939
|
}
|
179824
|
-
var import_node_assert34,
|
179940
|
+
var import_node_assert34, import_node_crypto15, import_promises36, import_miniflare26, LocalRuntimeController;
|
179825
179941
|
var init_LocalRuntimeController = __esm({
|
179826
179942
|
"src/api/startDevWorker/LocalRuntimeController.ts"() {
|
179827
179943
|
init_import_meta_url();
|
179828
179944
|
import_node_assert34 = __toESM(require("assert"));
|
179829
|
-
|
179945
|
+
import_node_crypto15 = require("crypto");
|
179830
179946
|
import_promises36 = require("fs/promises");
|
179831
179947
|
init_containers_shared();
|
179832
179948
|
init_source();
|
@@ -179853,7 +179969,7 @@ var init_LocalRuntimeController = __esm({
|
|
179853
179969
|
// This is given as a shared secret to the Proxy and User workers
|
179854
179970
|
// so that the User Worker can trust aspects of HTTP requests from the Proxy Worker
|
179855
179971
|
// if it provides the secret in a `MF-Proxy-Shared-Secret` header.
|
179856
|
-
#proxyToUserWorkerAuthenticationSecret = (0,
|
179972
|
+
#proxyToUserWorkerAuthenticationSecret = (0, import_node_crypto15.randomUUID)();
|
179857
179973
|
// `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
|
179858
179974
|
// updates were submitted, the second may apply before the first. Therefore,
|
179859
179975
|
// wrap updates in a mutex, so they're always applied in invocation order.
|
@@ -180083,12 +180199,12 @@ function ensureMatchingSql(options) {
|
|
180083
180199
|
}
|
180084
180200
|
return options;
|
180085
180201
|
}
|
180086
|
-
var import_node_assert35,
|
180202
|
+
var import_node_assert35, import_node_crypto16, import_miniflare27, MultiworkerRuntimeController;
|
180087
180203
|
var init_MultiworkerRuntimeController = __esm({
|
180088
180204
|
"src/api/startDevWorker/MultiworkerRuntimeController.ts"() {
|
180089
180205
|
init_import_meta_url();
|
180090
180206
|
import_node_assert35 = __toESM(require("assert"));
|
180091
|
-
|
180207
|
+
import_node_crypto16 = require("crypto");
|
180092
180208
|
init_containers_shared();
|
180093
180209
|
init_source();
|
180094
180210
|
import_miniflare27 = require("miniflare");
|
@@ -180115,7 +180231,7 @@ var init_MultiworkerRuntimeController = __esm({
|
|
180115
180231
|
// This is given as a shared secret to the Proxy and User workers
|
180116
180232
|
// so that the User Worker can trust aspects of HTTP requests from the Proxy Worker
|
180117
180233
|
// if it provides the secret in a `MF-Proxy-Shared-Secret` header.
|
180118
|
-
#proxyToUserWorkerAuthenticationSecret = (0,
|
180234
|
+
#proxyToUserWorkerAuthenticationSecret = (0, import_node_crypto16.randomUUID)();
|
180119
180235
|
// `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
|
180120
180236
|
// updates were submitted, the second may apply before the first. Therefore,
|
180121
180237
|
// wrap updates in a mutex, so they're always applied in invocation order.
|
@@ -184192,85 +184308,6 @@ var init_executionContext = __esm({
|
|
184192
184308
|
}
|
184193
184309
|
});
|
184194
184310
|
|
184195
|
-
// src/api/integrations/platform/services.ts
|
184196
|
-
async function getServiceBindings(services = []) {
|
184197
|
-
if (services.length === 0) {
|
184198
|
-
return;
|
184199
|
-
}
|
184200
|
-
const registeredWorkers = await maybeGetRegisteredWorkers();
|
184201
|
-
if (!registeredWorkers) {
|
184202
|
-
return;
|
184203
|
-
}
|
184204
|
-
const foundServices = [];
|
184205
|
-
for (const { binding: bindingName, service: serviceName } of services) {
|
184206
|
-
const worker = registeredWorkers[serviceName];
|
184207
|
-
if (worker) {
|
184208
|
-
foundServices.push({
|
184209
|
-
bindingName,
|
184210
|
-
serviceName,
|
184211
|
-
workerDefinition: worker
|
184212
|
-
});
|
184213
|
-
}
|
184214
|
-
}
|
184215
|
-
const serviceBindings = {};
|
184216
|
-
for (const bindingInfo of foundServices) {
|
184217
|
-
serviceBindings[bindingInfo.bindingName] = getServiceBindingProxyFetch(bindingInfo);
|
184218
|
-
}
|
184219
|
-
return serviceBindings;
|
184220
|
-
}
|
184221
|
-
function getServiceBindingProxyFetch({
|
184222
|
-
workerDefinition,
|
184223
|
-
bindingName,
|
184224
|
-
serviceName
|
184225
|
-
}) {
|
184226
|
-
const { protocol, host, port } = workerDefinition;
|
184227
|
-
const getExternalUrl = /* @__PURE__ */ __name((request4) => {
|
184228
|
-
const newUrl = new URL(request4.url);
|
184229
|
-
if (protocol) {
|
184230
|
-
newUrl.protocol = protocol;
|
184231
|
-
}
|
184232
|
-
if (host) {
|
184233
|
-
newUrl.host = host;
|
184234
|
-
}
|
184235
|
-
if (port) {
|
184236
|
-
newUrl.port = `${port}`;
|
184237
|
-
}
|
184238
|
-
return newUrl;
|
184239
|
-
}, "getExternalUrl");
|
184240
|
-
return async (request4) => {
|
184241
|
-
const newUrl = getExternalUrl(request4);
|
184242
|
-
try {
|
184243
|
-
const resp = await (0, import_undici26.fetch)(newUrl, request4);
|
184244
|
-
const respBody = await resp.arrayBuffer();
|
184245
|
-
return new import_miniflare30.Response(respBody, resp);
|
184246
|
-
} catch {
|
184247
|
-
return new import_miniflare30.Response(
|
184248
|
-
`Error: Unable to fetch from external service (${serviceName} bound with ${bindingName} binding), please make sure that the service is still running with \`wrangler dev\``,
|
184249
|
-
{ status: 500 }
|
184250
|
-
);
|
184251
|
-
}
|
184252
|
-
};
|
184253
|
-
}
|
184254
|
-
async function maybeGetRegisteredWorkers() {
|
184255
|
-
try {
|
184256
|
-
return await getRegisteredWorkers2();
|
184257
|
-
} catch {
|
184258
|
-
return void 0;
|
184259
|
-
}
|
184260
|
-
}
|
184261
|
-
var import_miniflare30, import_undici26;
|
184262
|
-
var init_services = __esm({
|
184263
|
-
"src/api/integrations/platform/services.ts"() {
|
184264
|
-
init_import_meta_url();
|
184265
|
-
import_miniflare30 = require("miniflare");
|
184266
|
-
import_undici26 = __toESM(require_undici());
|
184267
|
-
init_dev_registry();
|
184268
|
-
__name(getServiceBindings, "getServiceBindings");
|
184269
|
-
__name(getServiceBindingProxyFetch, "getServiceBindingProxyFetch");
|
184270
|
-
__name(maybeGetRegisteredWorkers, "maybeGetRegisteredWorkers");
|
184271
|
-
}
|
184272
|
-
});
|
184273
|
-
|
184274
184311
|
// src/api/integrations/platform/index.ts
|
184275
184312
|
async function getPlatformProxy(options = {}) {
|
184276
184313
|
const experimentalRemoteBindings = !!options.experimental?.remoteBindings;
|
@@ -184292,7 +184329,7 @@ async function getPlatformProxy(options = {}) {
|
|
184292
184329
|
remoteProxyConnectionString: remoteProxySession?.remoteProxyConnectionString,
|
184293
184330
|
remoteBindingsEnabled: experimentalRemoteBindings
|
184294
184331
|
});
|
184295
|
-
const mf = new
|
184332
|
+
const mf = new import_miniflare30.Miniflare(miniflareOptions);
|
184296
184333
|
const bindings = await mf.getBindings();
|
184297
184334
|
const cf2 = await mf.getCf();
|
184298
184335
|
deepFreeze(cf2);
|
@@ -184335,18 +184372,12 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184335
184372
|
`);
|
184336
184373
|
}
|
184337
184374
|
}
|
184338
|
-
const workerDefinitions = await getBoundRegisteredWorkers({
|
184339
|
-
name: config.name,
|
184340
|
-
services: bindings.services,
|
184341
|
-
durableObjects: config["durable_objects"],
|
184342
|
-
tailConsumers: []
|
184343
|
-
});
|
184344
184375
|
const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions(
|
184345
184376
|
{
|
184346
184377
|
name: config.name,
|
184347
184378
|
complianceRegion: config.compliance_region,
|
184348
184379
|
bindings,
|
184349
|
-
workerDefinitions,
|
184380
|
+
workerDefinitions: null,
|
184350
184381
|
queueConsumers: void 0,
|
184351
184382
|
services: bindings.services,
|
184352
184383
|
serviceBindings: {},
|
@@ -184373,7 +184404,6 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184373
184404
|
}
|
184374
184405
|
const assetOptions = processedAssetOptions ? buildAssetOptions({ assets: processedAssetOptions }) : {};
|
184375
184406
|
const defaultPersistRoot = getMiniflarePersistRoot(options.persist);
|
184376
|
-
const serviceBindings = await getServiceBindings(bindings.services);
|
184377
184407
|
const miniflareOptions = {
|
184378
184408
|
workers: [
|
184379
184409
|
{
|
@@ -184381,10 +184411,6 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184381
184411
|
modules: true,
|
184382
184412
|
name: config.name,
|
184383
184413
|
...bindingOptions,
|
184384
|
-
serviceBindings: {
|
184385
|
-
...serviceBindings,
|
184386
|
-
...bindingOptions.serviceBindings
|
184387
|
-
},
|
184388
184414
|
...assetOptions
|
184389
184415
|
},
|
184390
184416
|
...externalWorkers
|
@@ -184394,7 +184420,9 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
184394
184420
|
return {
|
184395
184421
|
script: "",
|
184396
184422
|
modules: true,
|
184397
|
-
...miniflareOptions
|
184423
|
+
...miniflareOptions,
|
184424
|
+
unsafeDevRegistryPath: getRegistryPath(),
|
184425
|
+
unsafeDevRegistryDurableObjectProxy: true
|
184398
184426
|
};
|
184399
184427
|
}
|
184400
184428
|
function getMiniflarePersistRoot(persist) {
|
@@ -184447,7 +184475,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184447
184475
|
if (bindings.services !== void 0) {
|
184448
184476
|
bindingOptions.serviceBindings = Object.fromEntries(
|
184449
184477
|
bindings.services.map((binding) => {
|
184450
|
-
const name2 = binding.service === config.name ?
|
184478
|
+
const name2 = binding.service === config.name ? import_miniflare30.kCurrentWorker : binding.service;
|
184451
184479
|
if (options?.remoteProxyConnectionString && binding.experimental_remote) {
|
184452
184480
|
return [
|
184453
184481
|
binding.binding,
|
@@ -184508,18 +184536,17 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
184508
184536
|
externalWorkers
|
184509
184537
|
};
|
184510
184538
|
}
|
184511
|
-
var
|
184539
|
+
var import_miniflare30;
|
184512
184540
|
var init_platform = __esm({
|
184513
184541
|
"src/api/integrations/platform/index.ts"() {
|
184514
184542
|
init_import_meta_url();
|
184515
184543
|
init_containers_shared();
|
184516
|
-
|
184544
|
+
import_miniflare30 = require("miniflare");
|
184517
184545
|
init_assets();
|
184518
184546
|
init_config2();
|
184519
184547
|
init_entry();
|
184520
184548
|
init_rules();
|
184521
184549
|
init_dev2();
|
184522
|
-
init_dev_registry();
|
184523
184550
|
init_class_names_sqlite();
|
184524
184551
|
init_miniflare();
|
184525
184552
|
init_misc_variables();
|
@@ -184529,7 +184556,6 @@ var init_platform = __esm({
|
|
184529
184556
|
init_remoteBindings();
|
184530
184557
|
init_caches();
|
184531
184558
|
init_executionContext();
|
184532
|
-
init_services();
|
184533
184559
|
init_dev_vars();
|
184534
184560
|
__name(getPlatformProxy, "getPlatformProxy");
|
184535
184561
|
__name(getMiniflareOptionsFromConfig, "getMiniflareOptionsFromConfig");
|
@@ -184563,6 +184589,7 @@ var init_api3 = __esm({
|
|
184563
184589
|
// src/cli.ts
|
184564
184590
|
var cli_exports2 = {};
|
184565
184591
|
__export(cli_exports2, {
|
184592
|
+
experimental_getWranglerCommands: () => experimental_getWranglerCommands,
|
184566
184593
|
experimental_maybeStartOrUpdateRemoteProxySession: () => maybeStartOrUpdateRemoteProxySession,
|
184567
184594
|
experimental_patchConfig: () => experimental_patchConfig,
|
184568
184595
|
experimental_pickRemoteBindings: () => pickRemoteBindings,
|
@@ -184661,6 +184688,17 @@ var PatchConfigError = class extends Error {
|
|
184661
184688
|
|
184662
184689
|
// src/cli.ts
|
184663
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
|
184664
184702
|
if (typeof vitest === "undefined" && require.main === module) {
|
184665
184703
|
main(hideBin(import_process5.default.argv)).catch((e7) => {
|
184666
184704
|
const exitCode = e7 instanceof FatalError && e7.code || 1;
|
@@ -184673,6 +184711,7 @@ var generateASSETSBinding2 = (
|
|
184673
184711
|
);
|
184674
184712
|
// Annotate the CommonJS export names for ESM import in node:
|
184675
184713
|
0 && (module.exports = {
|
184714
|
+
experimental_getWranglerCommands,
|
184676
184715
|
experimental_maybeStartOrUpdateRemoteProxySession,
|
184677
184716
|
experimental_patchConfig,
|
184678
184717
|
experimental_pickRemoteBindings,
|