wrangler 4.151.1 → 4.151.3

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.
@@ -32928,7 +32928,7 @@ var DEFAULT_COMPAT_DATE;
32928
32928
  var init_default_compat_date = __esm({
32929
32929
  "../workers-utils/src/default-compat-date.ts"() {
32930
32930
  init_import_meta_url();
32931
- DEFAULT_COMPAT_DATE = "2026-10-12";
32931
+ DEFAULT_COMPAT_DATE = "2026-10-19";
32932
32932
  }
32933
32933
  });
32934
32934
 
@@ -63787,58 +63787,6 @@ var init_tunnel = __esm({
63787
63787
  __name(createTunnelStartupError, "createTunnelStartupError");
63788
63788
  }
63789
63789
  });
63790
-
63791
- // ../workers-utils/src/cli-presentation.ts
63792
- function resolveCliPresentation(overrides) {
63793
- return {
63794
- cliName: overrides?.cliName ?? WRANGLER_CLI_PRESENTATION.cliName,
63795
- displayName: overrides?.displayName ?? WRANGLER_CLI_PRESENTATION.displayName,
63796
- displayConfigFileName: overrides?.displayConfigFileName ?? WRANGLER_CLI_PRESENTATION.displayConfigFileName,
63797
- configFieldAssignmentSeparator: overrides?.configFieldAssignmentSeparator ?? WRANGLER_CLI_PRESENTATION.configFieldAssignmentSeparator,
63798
- commands: {
63799
- ...WRANGLER_COMMANDS,
63800
- ...overrides?.commands
63801
- },
63802
- configFields: {
63803
- ...WRANGLER_CONFIG_FIELDS,
63804
- ...overrides?.configFields
63805
- }
63806
- };
63807
- }
63808
- var WRANGLER_COMMANDS, WRANGLER_CONFIG_FIELDS, WRANGLER_CLI_PRESENTATION;
63809
- var init_cli_presentation = __esm({
63810
- "../workers-utils/src/cli-presentation.ts"() {
63811
- init_import_meta_url();
63812
- WRANGLER_COMMANDS = {
63813
- deploy: "wrangler deploy",
63814
- preview: "wrangler preview",
63815
- versionsUpload: "wrangler versions upload",
63816
- versionsDeploy: "wrangler versions deploy",
63817
- versionsDeployAt: /* @__PURE__ */ __name((n10) => `wrangler versions deploy <new-version-id>@${n10}%`, "versionsDeployAt"),
63818
- triggersDeploy: "wrangler triggers deploy",
63819
- d1List: "wrangler d1 list",
63820
- d1Delete: "wrangler d1 delete",
63821
- queuesCreate: "wrangler queues create",
63822
- secretPut: "wrangler secret put",
63823
- versionsSecretPut: "wrangler versions secret put",
63824
- containerRegistryConfigure: "wrangler containers registries configure"
63825
- };
63826
- WRANGLER_CONFIG_FIELDS = {
63827
- workersDev: "workers_dev",
63828
- containerObservabilityTargetPercentage: "target_instance_percentage",
63829
- containerObservabilityTargetCount: "target_instance_count"
63830
- };
63831
- WRANGLER_CLI_PRESENTATION = {
63832
- cliName: "wrangler",
63833
- displayName: "Wrangler",
63834
- displayConfigFileName: "Wrangler config file",
63835
- configFieldAssignmentSeparator: " = ",
63836
- commands: WRANGLER_COMMANDS,
63837
- configFields: WRANGLER_CONFIG_FIELDS
63838
- };
63839
- __name(resolveCliPresentation, "resolveCliPresentation");
63840
- }
63841
- });
63842
63790
  async function fetchLatestNpmVersion(name2, version7) {
63843
63791
  const distTag = version7.startsWith("0.0.0") ? "beta" : "latest";
63844
63792
  let latest;
@@ -65919,7 +65867,6 @@ var init_src = __esm({
65919
65867
  init_wrangler_tmp_dir();
65920
65868
  init_tunnel();
65921
65869
  init_cloudflared();
65922
- init_cli_presentation();
65923
65870
  init_cfetch();
65924
65871
  init_update_check();
65925
65872
  init_logger();
@@ -67705,7 +67652,6 @@ var init_esm2 = __esm({
67705
67652
 
67706
67653
  // ../deploy-helpers/src/shared/context.ts
67707
67654
  function initDeployHelpersContext(ctx) {
67708
- cliPresentation = resolveCliPresentation(ctx.cliPresentation);
67709
67655
  logger = ctx.logger;
67710
67656
  fetchResult = ctx.fetchResult;
67711
67657
  fetchListResult = ctx.fetchListResult;
@@ -67715,12 +67661,10 @@ function initDeployHelpersContext(ctx) {
67715
67661
  prompt = ctx.prompt;
67716
67662
  select = ctx.select;
67717
67663
  }
67718
- var logger, fetchResult, fetchListResult, fetchPagedListResult, confirm, prompt, select, cliPresentation;
67664
+ var logger, fetchResult, fetchListResult, fetchPagedListResult, confirm, prompt, select;
67719
67665
  var init_context = __esm({
67720
67666
  "../deploy-helpers/src/shared/context.ts"() {
67721
67667
  init_import_meta_url();
67722
- init_src();
67723
- cliPresentation = resolveCliPresentation();
67724
67668
  __name(initDeployHelpersContext, "initDeployHelpersContext");
67725
67669
  }
67726
67670
  });
@@ -67730,7 +67674,7 @@ var name, version2;
67730
67674
  var init_package = __esm({
67731
67675
  "package.json"() {
67732
67676
  name = "wrangler";
67733
- version2 = "4.151.1";
67677
+ version2 = "4.151.3";
67734
67678
  }
67735
67679
  });
67736
67680
 
@@ -144815,7 +144759,6 @@ ${grayBar} ${msg}`);
144815
144759
  }
144816
144760
  });
144817
144761
  function initContainersSharedContext(ctx) {
144818
- cliPresentation2 = resolveCliPresentation(ctx.cliPresentation);
144819
144762
  logger3 = ctx.logger;
144820
144763
  fetchResult3 = ctx.fetchResult;
144821
144764
  if (ctx.fetchPagedListResult !== void 0) {
@@ -145009,7 +144952,7 @@ async function pullEgressInterceptorImage(dockerPath) {
145009
144952
  }
145010
144953
  await runDockerCmd(dockerPath, args);
145011
144954
  }
145012
- async function pullImage(dockerPath, options, logger22, complianceConfig) {
144955
+ async function pullImage(dockerPath, options, logger22, complianceConfig, registryConfigureCommand2) {
145013
144956
  const domain3 = new URL(`http://${options.image_uri}`).hostname;
145014
144957
  const isExternalRegistry = domain3 !== getCloudflareContainerRegistry2(complianceConfig);
145015
144958
  try {
@@ -145020,7 +144963,7 @@ async function pullImage(dockerPath, options, logger22, complianceConfig) {
145020
144963
  }
145021
144964
  logger22?.warn(
145022
144965
  `Unable to retrieve configured registry credentials from Cloudflare.
145023
- Unless this is a public image, you will need to run \`${cliPresentation2.commands.containerRegistryConfigure}\` before deploying.
144966
+ Unless this is a public image, you will need to run \`${registryConfigureCommand2}\` before deploying.
145024
144967
  Attempting to pull image anyway...`
145025
144968
  );
145026
144969
  }
@@ -145066,7 +145009,7 @@ async function prepareContainerImagesForDev(args) {
145066
145009
  dockerPath,
145067
145010
  operation: "running dev",
145068
145011
  imageNoun: containerOptions.length !== 1 ? "the configured images" : "the configured image",
145069
- hint: `To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your ${cliPresentation2.displayConfigFileName} or pass --enable-containers=false.`
145012
+ hint: `To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your ${args.configFileName} or pass --enable-containers=false.`
145070
145013
  });
145071
145014
  for (const options of containerOptions) {
145072
145015
  if ("dockerfile" in options) {
@@ -145097,7 +145040,8 @@ async function prepareContainerImagesForDev(args) {
145097
145040
  dockerPath,
145098
145041
  options,
145099
145042
  args.logger,
145100
- args.complianceConfig
145043
+ args.complianceConfig,
145044
+ args.registryConfigureCommand
145101
145045
  );
145102
145046
  onContainerImagePreparationStart({
145103
145047
  containerOptions: options,
@@ -146202,7 +146146,12 @@ async function promiseSpinner(promise2, {
146202
146146
  stop();
146203
146147
  return t14;
146204
146148
  }
146205
- function createDurableObjectNamespaceResolver(config2, { versionId, accountId, scriptName, dispatchNamespace }) {
146149
+ function createDurableObjectNamespaceResolver(config2, {
146150
+ versionId,
146151
+ accountId,
146152
+ scriptName,
146153
+ dispatchNamespace
146154
+ }) {
146206
146155
  const boundDOs = new Set(
146207
146156
  config2.durable_objects.bindings.map((binding) => binding.class_name)
146208
146157
  );
@@ -146244,7 +146193,15 @@ function createDurableObjectNamespaceResolver(config2, { versionId, accountId, s
146244
146193
  return targetDurableObject.id;
146245
146194
  };
146246
146195
  }
146247
- async function deployContainers(config2, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace }) {
146196
+ async function deployContainers(config2, containerDeployments, {
146197
+ versionId,
146198
+ accountId,
146199
+ scriptName,
146200
+ dispatchNamespace,
146201
+ configFileName: configFileName2,
146202
+ observabilityTargetPercentageField,
146203
+ observabilityTargetCountField
146204
+ }) {
146248
146205
  const resolveNamespaceId = createDurableObjectNamespaceResolver(config2, {
146249
146206
  versionId,
146250
146207
  accountId,
@@ -146256,7 +146213,10 @@ async function deployContainers(config2, containerDeployments, { versionId, acco
146256
146213
  await apply(
146257
146214
  {
146258
146215
  imageRef,
146259
- durable_object_namespace_id: namespaceId
146216
+ durable_object_namespace_id: namespaceId,
146217
+ configFileName: configFileName2,
146218
+ observabilityTargetPercentageField,
146219
+ observabilityTargetCountField
146260
146220
  },
146261
146221
  container,
146262
146222
  config2,
@@ -146431,7 +146391,7 @@ function buildApplicationObservabilityPatch(observability, writeTarget, prevApp)
146431
146391
  }
146432
146392
  return nextTopLevelObservability !== void 0 ? { observability: nextTopLevelObservability } : {};
146433
146393
  }
146434
- function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig) {
146394
+ function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, options) {
146435
146395
  if (!hasTopLevelOnlyObservabilityFields(containerConfig.observability)) {
146436
146396
  return;
146437
146397
  }
@@ -146439,7 +146399,7 @@ function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig)
146439
146399
  return;
146440
146400
  }
146441
146401
  throw new UserError(
146442
- `Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${cliPresentation2.displayConfigFileName} and deploy once, then deploy again with ${cliPresentation2.configFields.containerObservabilityTargetPercentage} or ${cliPresentation2.configFields.containerObservabilityTargetCount}.`,
146402
+ `Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${options.configFileName} and deploy once, then deploy again with ${options.observabilityTargetPercentageField} or ${options.observabilityTargetCountField}.`,
146443
146403
  {
146444
146404
  telemetryMessage: "containers deploy observability migration blocked"
146445
146405
  }
@@ -146572,7 +146532,11 @@ async function apply(args, containerConfig, config2, accountId) {
146572
146532
  }
146573
146533
  const observabilityWriteTarget = selectObservabilityWriteTarget(prevApp);
146574
146534
  if (prevApp !== void 0) {
146575
- assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig);
146535
+ assertCanUseApplicationObservabilityTargeting(
146536
+ prevApp,
146537
+ containerConfig,
146538
+ args
146539
+ );
146576
146540
  }
146577
146541
  const appConfig = stripUndefined(
146578
146542
  mergeIfUnsafe(
@@ -146968,7 +146932,7 @@ function indexContainersByName(containers) {
146968
146932
  }
146969
146933
  return containersByName;
146970
146934
  }
146971
- async function sshCommand(sshArgs) {
146935
+ async function sshCommand(sshArgs, userAgent) {
146972
146936
  const useStdio = shouldUseStdio(sshArgs);
146973
146937
  let sshResponse;
146974
146938
  try {
@@ -146990,7 +146954,7 @@ async function sshCommand(sshArgs) {
146990
146954
  const ws = new import_websocket.default(sshResponse.url, {
146991
146955
  headers: {
146992
146956
  authorization: `Bearer ${sshResponse.token}`,
146993
- "user-agent": cliPresentation2.cliName
146957
+ "user-agent": userAgent
146994
146958
  }
146995
146959
  });
146996
146960
  ws.binaryType = "arraybuffer";
@@ -147418,18 +147382,18 @@ async function getCreds(permissions, complianceConfig) {
147418
147382
  function isValidImageTag(value) {
147419
147383
  return IMAGE_TAG_REGEXP.test(value);
147420
147384
  }
147421
- var require$13, __create2, __defProp5, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf2, __hasOwnProp2, __name5, __require2, __commonJS3, __copyProps2, __toESM2, require_constants7, require_buffer_util, require_limiter, require_permessage_deflate2, require_validation, require_receiver2, require_sender2, require_event_target, require_extension, require_websocket2, require_stream, require_subprotocol, require_websocket_server, ApiError, CancelError2, CancelablePromise, OpenAPI, isDefined, isString2, isStringWithValue, isBlob3, isErrorResponse, base643, getQueryString, getUrl, getFormData, resolve10, getHeaders2, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, executeRequest, buildApiResult, request, requestPaginated, debugLogRequest, debugLogResponse, ApplicationRollout, AssignIPv4, AssignIPv6, BadRequestWithCodeError, ContainerImagePreparationStatus, CreateApplicationRolloutRequest, DeploymentMutationError, DeploymentNotFoundError, ExternalRegistryKind, ImageRegistryAlreadyExistsError, ImageRegistryIsPublic, ImageRegistryNotAllowedError, ImageRegistryNotFoundError, ImageRegistryProtocolAlreadyExists, ImageRegistryProtocolIsReferencedError, ImageRegistryProtocolNotFound, InstanceType, ProvisionerConfiguration, RolloutStep, SchedulingPolicy, SecretNameAlreadyExists, SecretNotFound, SSHPublicKeyNotFoundError, UpdateApplicationRolloutRequest, AccountService, ApplicationsService, ContainerImagePreparationsService, DeploymentsService, ImageRegistriesService, PlacementsService, RolloutsService, SshPublicKeysService, noop, logger3, fetchResult3, fetchPagedListResult3, cliPresentation2, getCloudflareRegistryWithAccountNamespace, MF_DEV_CONTAINER_PREFIX, getDevContainerImageName, runDockerCmd, runDockerCmdWithOutput, isDockerRunning, verifyDockerInstalled, cleanupContainers, getContainerIdsFromImage, DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE, getAndValidateRegistryType, MB, MiB, instanceTypes, LEGACY_TO_CANONICAL, MAX_DOCKER_REPOSITORY_NAME_LENGTH, DIGEST_SUFFIX_REGEXP, DIGEST_VALUE_REGEXP, TAG_SUFFIX_REGEXP, BUILD_OUTPUT_IMAGE_NAMESPACE, DOCKER_REPOSITORY_NAME_LENGTH, Diff, doAction, configRolloutStepsToAPI, MAX_DOCKER_REPOSITORY_NAME_LENGTH2, MAX_NAMED_IMAGE_SLUG_LENGTH, IMAGE_ID_HASH_LENGTH, import_websocket, containersSshOptions, MAX_REPOSITORY_LENGTH, REPOSITORY_COMPONENT_REGEXP, TAG_REGEXP, IMAGE_TAG_REGEXP;
147385
+ var require$13, __create2, __defProp5, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf2, __hasOwnProp2, __name5, __require2, __commonJS3, __copyProps2, __toESM2, require_constants7, require_buffer_util, require_limiter, require_permessage_deflate2, require_validation, require_receiver2, require_sender2, require_event_target, require_extension, require_websocket2, require_stream, require_subprotocol, require_websocket_server, ApiError, CancelError2, CancelablePromise, OpenAPI, isDefined, isString2, isStringWithValue, isBlob3, isErrorResponse, base643, getQueryString, getUrl, getFormData, resolve10, getHeaders2, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, executeRequest, buildApiResult, request, requestPaginated, debugLogRequest, debugLogResponse, ApplicationRollout, AssignIPv4, AssignIPv6, BadRequestWithCodeError, ContainerImagePreparationStatus, CreateApplicationRolloutRequest, DeploymentMutationError, DeploymentNotFoundError, ExternalRegistryKind, ImageRegistryAlreadyExistsError, ImageRegistryIsPublic, ImageRegistryNotAllowedError, ImageRegistryNotFoundError, ImageRegistryProtocolAlreadyExists, ImageRegistryProtocolIsReferencedError, ImageRegistryProtocolNotFound, InstanceType, ProvisionerConfiguration, RolloutStep, SchedulingPolicy, SecretNameAlreadyExists, SecretNotFound, SSHPublicKeyNotFoundError, UpdateApplicationRolloutRequest, AccountService, ApplicationsService, ContainerImagePreparationsService, DeploymentsService, ImageRegistriesService, PlacementsService, RolloutsService, SshPublicKeysService, noop, logger3, fetchResult3, fetchPagedListResult3, getCloudflareRegistryWithAccountNamespace, MF_DEV_CONTAINER_PREFIX, getDevContainerImageName, runDockerCmd, runDockerCmdWithOutput, isDockerRunning, verifyDockerInstalled, cleanupContainers, getContainerIdsFromImage, DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE, getAndValidateRegistryType, MB, MiB, instanceTypes, LEGACY_TO_CANONICAL, MAX_DOCKER_REPOSITORY_NAME_LENGTH, DIGEST_SUFFIX_REGEXP, DIGEST_VALUE_REGEXP, TAG_SUFFIX_REGEXP, BUILD_OUTPUT_IMAGE_NAMESPACE, DOCKER_REPOSITORY_NAME_LENGTH, Diff, doAction, configRolloutStepsToAPI, MAX_DOCKER_REPOSITORY_NAME_LENGTH2, MAX_NAMED_IMAGE_SLUG_LENGTH, IMAGE_ID_HASH_LENGTH, import_websocket, containersSshOptions, MAX_REPOSITORY_LENGTH, REPOSITORY_COMPONENT_REGEXP, TAG_REGEXP, IMAGE_TAG_REGEXP;
147422
147386
  var init_dist9 = __esm({
147423
147387
  "../containers-shared/dist/index.mjs"() {
147424
147388
  init_import_meta_url();
147425
147389
  init_docker_path();
147426
147390
  init_errors();
147427
147391
  init_fs_helpers();
147428
- init_src();
147429
147392
  init_compliance();
147430
147393
  init_dist4();
147431
147394
  init_dist5();
147432
147395
  init_colors();
147396
+ init_src();
147433
147397
  init_interactive();
147434
147398
  require$13 = nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
147435
147399
  __create2 = Object.create;
@@ -153427,7 +153391,6 @@ var init_dist9 = __esm({
153427
153391
  fetchPagedListResult3 = /* @__PURE__ */ __name5(() => {
153428
153392
  throw new Error("initContainersSharedContext() must be called first");
153429
153393
  }, "fetchPagedListResult");
153430
- cliPresentation2 = resolveCliPresentation();
153431
153394
  __name(initContainersSharedContext, "initContainersSharedContext");
153432
153395
  __name5(initContainersSharedContext, "initContainersSharedContext");
153433
153396
  getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name5((accountID, tag, complianceConfig) => {
@@ -163847,7 +163810,7 @@ function describeConflictOwner(remote) {
163847
163810
  if (remote.source === "wrangler") {
163848
163811
  return remote.owner_worker_name ? `owned by worker "${remote.owner_worker_name}"` : "owned by another Worker";
163849
163812
  }
163850
- return `managed outside ${cliPresentation.displayName}`;
163813
+ return "managed outside this deployment";
163851
163814
  }
163852
163815
  function renderEmailRoutingPlan(plan, workerName) {
163853
163816
  const lines = [];
@@ -163908,7 +163871,6 @@ var init_email_routing_plan = __esm({
163908
163871
  "../deploy-helpers/src/triggers/email-routing-plan.ts"() {
163909
163872
  init_import_meta_url();
163910
163873
  init_source();
163911
- init_context();
163912
163874
  __name(isCatchAllAddress, "isCatchAllAddress");
163913
163875
  __name(ruleShapeForTarget, "ruleShapeForTarget");
163914
163876
  __name(buildEmailRoutingPlanRequest, "buildEmailRoutingPlanRequest");
@@ -164566,18 +164528,24 @@ async function listQueues(complianceConfig, accountId, page, name2) {
164566
164528
  params
164567
164529
  );
164568
164530
  }
164569
- async function getQueue(complianceConfig, accountId, queueName) {
164531
+ async function getQueue(complianceConfig, accountId, queueName, queueCreateCommand2) {
164570
164532
  const queues = await listQueues(complianceConfig, accountId, 1, queueName);
164571
164533
  if (queues.length === 0) {
164534
+ const createQueueGuidance = queueCreateCommand2 ? ` To create it, run: ${queueCreateCommand2(queueName)}` : "";
164572
164535
  throw new UserError(
164573
- `Queue "${queueName}" does not exist. To create it, run: ${cliPresentation.commands.queuesCreate} ${queueName}`,
164536
+ `Queue "${queueName}" does not exist.${createQueueGuidance}`,
164574
164537
  { telemetryMessage: "queues lookup missing queue" }
164575
164538
  );
164576
164539
  }
164577
164540
  return queues[0];
164578
164541
  }
164579
- async function postConsumer(complianceConfig, accountId, queueName, body) {
164580
- const queue = await getQueue(complianceConfig, accountId, queueName);
164542
+ async function postConsumer(complianceConfig, accountId, queueName, body, queueCreateCommand2) {
164543
+ const queue = await getQueue(
164544
+ complianceConfig,
164545
+ accountId,
164546
+ queueName,
164547
+ queueCreateCommand2
164548
+ );
164581
164549
  return postConsumerById(complianceConfig, accountId, queue.queue_id, body);
164582
164550
  }
164583
164551
  async function postConsumerById(config2, accountId, queueId, body) {
@@ -164600,8 +164568,13 @@ async function putConsumerById(complianceConfig, accountId, queueId, consumerId,
164600
164568
  }
164601
164569
  );
164602
164570
  }
164603
- async function putConsumer(complianceConfig, accountId, queueName, scriptName, envName, body) {
164604
- const queue = await getQueue(complianceConfig, accountId, queueName);
164571
+ async function putConsumer(complianceConfig, accountId, queueName, scriptName, envName, body, queueCreateCommand2) {
164572
+ const queue = await getQueue(
164573
+ complianceConfig,
164574
+ accountId,
164575
+ queueName,
164576
+ queueCreateCommand2
164577
+ );
164605
164578
  const targetConsumer = await resolveWorkerConsumerByName(
164606
164579
  complianceConfig,
164607
164580
  accountId,
@@ -164672,8 +164645,13 @@ async function deleteConsumerById(complianceConfig, accountId, queueId, consumer
164672
164645
  }
164673
164646
  );
164674
164647
  }
164675
- async function deletePullConsumer(complianceConfig, accountId, queueName) {
164676
- const queue = await getQueue(complianceConfig, accountId, queueName);
164648
+ async function deletePullConsumer(complianceConfig, accountId, queueName, queueCreateCommand2) {
164649
+ const queue = await getQueue(
164650
+ complianceConfig,
164651
+ accountId,
164652
+ queueName,
164653
+ queueCreateCommand2
164654
+ );
164677
164655
  const consumer = queue.consumers[0];
164678
164656
  if (consumer?.type !== "http_pull") {
164679
164657
  throw new UserError(`No http_pull consumer exists for queue ${queueName}`, {
@@ -164687,12 +164665,22 @@ async function deletePullConsumer(complianceConfig, accountId, queueName) {
164687
164665
  consumer.consumer_id
164688
164666
  );
164689
164667
  }
164690
- async function listConsumers(complianceConfig, accountId, queueName) {
164691
- const queue = await getQueue(complianceConfig, accountId, queueName);
164668
+ async function listConsumers(complianceConfig, accountId, queueName, queueCreateCommand2) {
164669
+ const queue = await getQueue(
164670
+ complianceConfig,
164671
+ accountId,
164672
+ queueName,
164673
+ queueCreateCommand2
164674
+ );
164692
164675
  return queue.consumers;
164693
164676
  }
164694
- async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scriptName, envName) {
164695
- const queue = await getQueue(complianceConfig, accountId, queueName);
164677
+ async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scriptName, envName, queueCreateCommand2) {
164678
+ const queue = await getQueue(
164679
+ complianceConfig,
164680
+ accountId,
164681
+ queueName,
164682
+ queueCreateCommand2
164683
+ );
164696
164684
  const targetConsumer = await resolveWorkerConsumerByName(
164697
164685
  complianceConfig,
164698
164686
  accountId,
@@ -164707,11 +164695,16 @@ async function deleteWorkerConsumer(complianceConfig, accountId, queueName, scri
164707
164695
  targetConsumer.consumer_id
164708
164696
  );
164709
164697
  }
164710
- async function updateQueueConsumers(complianceConfig, accountId, scriptName, config2) {
164698
+ async function updateQueueConsumers(complianceConfig, accountId, scriptName, config2, queueCreateCommand2) {
164711
164699
  const consumers = config2.queues.consumers || [];
164712
164700
  const updateConsumers = [];
164713
164701
  for (const consumer of consumers) {
164714
- const queue = await getQueue(complianceConfig, accountId, consumer.queue);
164702
+ const queue = await getQueue(
164703
+ complianceConfig,
164704
+ accountId,
164705
+ consumer.queue,
164706
+ queueCreateCommand2
164707
+ );
164715
164708
  const body = {
164716
164709
  type: "worker",
164717
164710
  dead_letter_queue: consumer.dead_letter_queue,
@@ -164736,7 +164729,8 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
164736
164729
  consumer.queue,
164737
164730
  scriptName,
164738
164731
  envName,
164739
- body
164732
+ body,
164733
+ queueCreateCommand2
164740
164734
  ).then(
164741
164735
  () => ({ targets: [`Consumer for ${consumer.queue}`] }),
164742
164736
  (error64) => ({ targets: [], error: error64 })
@@ -164745,7 +164739,13 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
164745
164739
  continue;
164746
164740
  }
164747
164741
  updateConsumers.push(
164748
- postConsumer(complianceConfig, accountId, consumer.queue, body).then(
164742
+ postConsumer(
164743
+ complianceConfig,
164744
+ accountId,
164745
+ consumer.queue,
164746
+ body,
164747
+ queueCreateCommand2
164748
+ ).then(
164749
164749
  () => ({
164750
164750
  targets: [`Consumer for ${consumer.queue}`]
164751
164751
  }),
@@ -164755,7 +164755,7 @@ async function updateQueueConsumers(complianceConfig, accountId, scriptName, con
164755
164755
  }
164756
164756
  return updateConsumers;
164757
164757
  }
164758
- async function ensureQueuesExistByConfig(config2, accountId, includeProducers = true, scriptName) {
164758
+ async function ensureQueuesExistByConfig(config2, accountId, includeProducers = true, scriptName, queueCreateCommand2) {
164759
164759
  const producerNames = (config2.queues.producers || []).flatMap((producer) => {
164760
164760
  if (producer.queue) {
164761
164761
  return [producer.queue];
@@ -164786,8 +164786,9 @@ async function ensureQueuesExistByConfig(config2, accountId, includeProducers =
164786
164786
  const queueSet = new Set(existingQueues);
164787
164787
  for (const queue of queueNames) {
164788
164788
  if (!queueSet.has(queue)) {
164789
+ const createQueueGuidance = queueCreateCommand2 ? ` To create it, run: ${queueCreateCommand2(queue)}` : "";
164789
164790
  throw new UserError(
164790
- `Queue "${queue}" does not exist. To create it, run: ${cliPresentation.commands.queuesCreate} ${queue}`,
164791
+ `Queue "${queue}" does not exist.${createQueueGuidance}`,
164791
164792
  { telemetryMessage: "queues config missing queue" }
164792
164793
  );
164793
164794
  }
@@ -164983,7 +164984,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
164983
164984
  if (subdomainAvailabilityCheckError.code === 10032) ; else if (subdomainAvailabilityCheckError.code === 10031) {
164984
164985
  if (automaticSubdomain) {
164985
164986
  throw new UserError(
164986
- `${cliPresentation.displayName} could not automatically register "${potentialName}" as your workers.dev subdomain because the name is unavailable. Register a different subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
164987
+ `Could not automatically register "${potentialName}" as your workers.dev subdomain because the name is unavailable. Register a different subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
164987
164988
  {
164988
164989
  telemetryMessage: "workers dev automatic registration name unavailable"
164989
164990
  }
@@ -164996,7 +164997,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
164996
164997
  } else {
164997
164998
  if (automaticSubdomain) {
164998
164999
  throw new UserError(
164999
- `${cliPresentation.displayName} could not verify whether "${potentialName}" is available as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
165000
+ `Could not verify whether "${potentialName}" is available as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
165000
165001
  {
165001
165002
  telemetryMessage: "workers dev automatic registration availability check failed"
165002
165003
  }
@@ -165035,7 +165036,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
165035
165036
  const subdomainCreationError = err;
165036
165037
  if (automaticSubdomain) {
165037
165038
  throw new UserError(
165038
- `${cliPresentation.displayName} could not automatically register "${potentialName}" as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
165039
+ `Could not automatically register "${potentialName}" as your \`workers.dev\` subdomain. Register a subdomain at https://dash.cloudflare.com/${accountId}/workers/onboarding.`,
165039
165040
  {
165040
165041
  telemetryMessage: "workers dev automatic registration creation failed"
165041
165042
  }
@@ -165094,7 +165095,13 @@ async function triggersDeploy(props) {
165094
165095
  const { accountId } = props;
165095
165096
  assert38__default.default(accountId);
165096
165097
  if (props.validated !== true) {
165097
- await ensureQueuesExistByConfig(config2, accountId, true, scriptName);
165098
+ await ensureQueuesExistByConfig(
165099
+ config2,
165100
+ accountId,
165101
+ true,
165102
+ scriptName,
165103
+ props.queueCreateCommand
165104
+ );
165098
165105
  }
165099
165106
  const routesOnly = [];
165100
165107
  const customDomainsOnly = [];
@@ -165248,7 +165255,8 @@ ${dashLink}`, {
165248
165255
  config2,
165249
165256
  accountId,
165250
165257
  scriptName,
165251
- config2
165258
+ config2,
165259
+ props.queueCreateCommand
165252
165260
  );
165253
165261
  deployments.push(
165254
165262
  ...consumerUpdates.map(
@@ -165525,9 +165533,8 @@ function getSubdomainValuesAPIMock(config_workers_dev, config_preview_urls, rout
165525
165533
  preview_urls
165526
165534
  };
165527
165535
  }
165528
- function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled) {
165529
- const workersDevField = cliPresentation.configFields.workersDev;
165530
- const workersDevAssignment = `${workersDevField}${cliPresentation.configFieldAssignmentSeparator}${beforeEnabled}`;
165536
+ function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled, configFile, workersDevConfigFieldName, workersDevConfigAssignment) {
165537
+ const workersDevAssignment = workersDevConfigAssignment(beforeEnabled);
165531
165538
  const status2 = /* @__PURE__ */ __name((enabled, past) => {
165532
165539
  if (past) {
165533
165540
  return enabled ? "enabled" : "disabled";
@@ -165536,11 +165543,11 @@ function renderWorkersDevDefaultWarning(beforeEnabled, afterEnabled) {
165536
165543
  }
165537
165544
  }, "status");
165538
165545
  return [
165539
- `Because '${workersDevField}' is not in your ${cliPresentation.displayConfigFileName}, it will be ${status2(afterEnabled, true)} for this deployment by default.`,
165540
- `To override this setting, you can ${status2(beforeEnabled, false)} workers.dev by explicitly setting '${workersDevAssignment}' in your ${cliPresentation.displayConfigFileName}.`
165546
+ `Because '${workersDevConfigFieldName}' is not in your ${configFile}, it will be ${status2(afterEnabled, true)} for this deployment by default.`,
165547
+ `To override this setting, you can ${status2(beforeEnabled, false)} workers.dev by explicitly setting '${workersDevAssignment}' in your ${configFile}.`
165541
165548
  ].join("\n");
165542
165549
  }
165543
- async function validateSubdomainMixedState(scriptName, before, after, previewURLSuffix, firstDeploy) {
165550
+ async function validateSubdomainMixedState(scriptName, before, after, previewURLSuffix, firstDeploy, configFile, previewUrlsConfigAssignment) {
165544
165551
  const changed = after.workers_dev !== before.workers_dev || after.preview_urls !== before.preview_urls;
165545
165552
  if (!changed) {
165546
165553
  return after;
@@ -165565,7 +165572,7 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
165565
165572
  "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
165566
165573
  ` ${previewUrl}`,
165567
165574
  "",
165568
- `To prevent this Worker from being unintentionally public, you may want to disable the Preview URLs as well by setting \`preview_urls = false\` in your ${cliPresentation.displayConfigFileName}.`
165575
+ `To prevent this Worker from being unintentionally public, you may want to disable the Preview URLs as well by setting \`${previewUrlsConfigAssignment(false)}\` in your ${configFile}.`
165569
165576
  ].join("\n")
165570
165577
  );
165571
165578
  }
@@ -165576,7 +165583,7 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
165576
165583
  "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
165577
165584
  ` ${previewUrl}`,
165578
165585
  "",
165579
- `You may want to enable the Preview URLs as well by setting \`preview_urls = true\` in your ${cliPresentation.displayConfigFileName}.`
165586
+ `You may want to enable the Preview URLs as well by setting \`${previewUrlsConfigAssignment(true)}\` in your ${configFile}.`
165580
165587
  ].join("\n")
165581
165588
  );
165582
165589
  }
@@ -165584,6 +165591,10 @@ async function validateSubdomainMixedState(scriptName, before, after, previewURL
165584
165591
  }
165585
165592
  async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes, deployments, firstDeploy) {
165586
165593
  const { config: config2 } = props;
165594
+ const displayConfigFileName = configFileName(
165595
+ config2.configPath,
165596
+ config2.userConfigPath
165597
+ );
165587
165598
  const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config2.workers_dev, config2.preview_urls, routes);
165588
165599
  const before = await getWorkerSubdomain(config2, accountId, scriptName);
165589
165600
  if (wantWorkersDev) {
@@ -165611,7 +165622,15 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
165611
165622
  logger
165612
165623
  );
165613
165624
  if (!firstDeploy && config2.workers_dev == void 0 && after.enabled !== before.enabled) {
165614
- logger.warn(renderWorkersDevDefaultWarning(before.enabled, after.enabled));
165625
+ logger.warn(
165626
+ renderWorkersDevDefaultWarning(
165627
+ before.enabled,
165628
+ after.enabled,
165629
+ displayConfigFileName,
165630
+ props.workersDevConfigFieldName,
165631
+ props.workersDevConfigAssignment
165632
+ )
165633
+ );
165615
165634
  }
165616
165635
  if (!firstDeploy && config2.preview_urls == void 0 && after.previews_enabled !== before.previews_enabled) {
165617
165636
  const status2 = /* @__PURE__ */ __name((enabled, past) => {
@@ -165623,8 +165642,8 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
165623
165642
  }, "status");
165624
165643
  logger.warn(
165625
165644
  [
165626
- `Because your 'workers.dev' route is ${status2(after.enabled, true)} and your 'preview_urls' setting is not in your ${cliPresentation.displayConfigFileName}, Preview URLs will be ${status2(after.previews_enabled, true)} for this deployment by default.`,
165627
- `To override this setting, you can ${status2(before.previews_enabled, false)} Preview URLs by explicitly setting 'preview_urls = ${before.previews_enabled}' in your ${cliPresentation.displayConfigFileName}.`
165645
+ `Because your 'workers.dev' route is ${status2(after.enabled, true)} and your '${props.previewUrlsConfigFieldName}' setting is not in your ${displayConfigFileName}, Preview URLs will be ${status2(after.previews_enabled, true)} for this deployment by default.`,
165646
+ `To override this setting, you can ${status2(before.previews_enabled, false)} Preview URLs by explicitly setting '${props.previewUrlsConfigAssignment(before.previews_enabled)}' in your ${displayConfigFileName}.`
165628
165647
  ].join("\n")
165629
165648
  );
165630
165649
  }
@@ -165633,7 +165652,9 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
165633
165652
  { workers_dev: before.enabled, preview_urls: before.previews_enabled },
165634
165653
  { workers_dev: after.enabled, preview_urls: after.previews_enabled },
165635
165654
  before.preview_url_suffix,
165636
- firstDeploy
165655
+ firstDeploy,
165656
+ displayConfigFileName,
165657
+ props.previewUrlsConfigAssignment
165637
165658
  );
165638
165659
  return {
165639
165660
  wantWorkersDev,
@@ -168374,13 +168395,13 @@ var init_versions_api = __esm({
168374
168395
  });
168375
168396
 
168376
168397
  // ../deploy-helpers/src/deploy/helpers/confirm-latest-deployment-overwrite.ts
168377
- async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId, scriptName) {
168398
+ async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId, scriptName, deployCommand2, versionsDeployCommand2) {
168378
168399
  try {
168379
168400
  const latest = await fetchLatestDeployment(config2, accountId, scriptName);
168380
168401
  if (latest && latest.versions.length >= 2) {
168381
168402
  const versionCache = /* @__PURE__ */ new Map();
168382
168403
  warn(
168383
- `Your last deployment has multiple versions. To progress that deployment use "${cliPresentation.commands.versionsDeploy}" instead.`,
168404
+ `Your last deployment has multiple versions. To progress that deployment use "${versionsDeployCommand2}" instead.`,
168384
168405
  { shape: shapes.corners.tl, newlineBefore: false }
168385
168406
  );
168386
168407
  newline();
@@ -168394,7 +168415,7 @@ async function confirmLatestDeploymentOverwriteAndGetLatest(config2, accountId,
168394
168415
  );
168395
168416
  const confirmed = await inputPrompt({
168396
168417
  type: "confirm",
168397
- question: `"${cliPresentation.commands.deploy}" will upload a new version and deploy it globally immediately.
168418
+ question: `"${deployCommand2}" will upload a new version and deploy it globally immediately.
168398
168419
  Are you sure you want to continue?`,
168399
168420
  label: "",
168400
168421
  defaultValue: isNonInteractiveOrCI(),
@@ -168446,7 +168467,6 @@ var init_confirm_latest_deployment_overwrite = __esm({
168446
168467
  init_colors();
168447
168468
  init_interactive();
168448
168469
  init_src();
168449
- init_context();
168450
168470
  init_versions_api();
168451
168471
  init_worker_not_found_error();
168452
168472
  BLANK_INPUT = "-";
@@ -169539,7 +169559,12 @@ function validateApplicationIdentity(application, namespaceId, existing) {
169539
169559
  );
169540
169560
  }
169541
169561
  }
169542
- async function validateImageLessContainerApplicationsForUpload(config2, containers, { accountId, scriptName }) {
169562
+ async function validateImageLessContainerApplicationsForUpload(config2, containers, {
169563
+ accountId,
169564
+ scriptName,
169565
+ deployCommand: deployCommand2,
169566
+ versionsUploadCommand: versionsUploadCommand2
169567
+ }) {
169543
169568
  const imageLessContainers = getResolvedDurableObjectContainerApps(
169544
169569
  containers,
169545
169570
  config2.exports
@@ -169564,7 +169589,7 @@ async function validateImageLessContainerApplicationsForUpload(config2, containe
169564
169589
  }
169565
169590
  if (namespace === void 0 || existing === void 0) {
169566
169591
  throw new UserError(
169567
- `Container "${container.name}" has no named images and has not been provisioned. Run \`${cliPresentation.commands.deploy}\` to create its Durable Object-managed application before using \`${cliPresentation.commands.versionsUpload}\`, or configure at least one named image.`,
169592
+ `Container "${container.name}" has no named images and has not been provisioned. Run \`${deployCommand2}\` to create its Durable Object-managed application before using \`${versionsUploadCommand2}\`, or configure at least one named image.`,
169568
169593
  {
169569
169594
  telemetryMessage: "versions upload image less container application missing"
169570
169595
  }
@@ -169733,12 +169758,14 @@ async function prepareDurableObjectContainerApplications(config2, durableObjectC
169733
169758
  dryRun,
169734
169759
  scriptName,
169735
169760
  dispatchNamespace,
169736
- requireExistingImageLessApplications = false
169761
+ requireExistingImageLessApplications = false,
169762
+ deployCommand: deployCommand2,
169763
+ versionsUploadCommand: versionsUploadCommand2
169737
169764
  }) {
169738
169765
  validateDurableObjectContainerApplications(
169739
169766
  config2,
169740
169767
  durableObjectContainerConfig,
169741
- cliPresentation.displayConfigFileName
169768
+ configFileName(config2.configPath, config2.userConfigPath)
169742
169769
  );
169743
169770
  const managedContainers = getResolvedDurableObjectContainerApps(
169744
169771
  durableObjectContainerConfig,
@@ -169771,10 +169798,15 @@ async function prepareDurableObjectContainerApplications(config2, durableObjectC
169771
169798
  }
169772
169799
  if (!dryRun && requireExistingImageLessApplications) {
169773
169800
  assert38__default.default(accountId);
169801
+ assert38__default.default(deployCommand2, "Expected deploy command for versions upload");
169802
+ assert38__default.default(
169803
+ versionsUploadCommand2,
169804
+ "Expected versions upload command for versions upload"
169805
+ );
169774
169806
  await validateImageLessContainerApplicationsForUpload(
169775
169807
  config2,
169776
169808
  durableObjectContainerConfig,
169777
- { accountId, scriptName }
169809
+ { accountId, scriptName, deployCommand: deployCommand2, versionsUploadCommand: versionsUploadCommand2 }
169778
169810
  );
169779
169811
  }
169780
169812
  const containers = managedContainers.filter(
@@ -169863,7 +169895,6 @@ var init_durable_object_container_applications = __esm({
169863
169895
  init_dist5();
169864
169896
  init_dist9();
169865
169897
  init_src();
169866
- init_context();
169867
169898
  IMAGE_PREPARATION_POLL_INTERVAL_MS = 2e3;
169868
169899
  IMAGE_PREPARATION_TIMEOUT_MS = 15 * 6e4;
169869
169900
  __name(getApplicationSettings, "getApplicationSettings");
@@ -169897,7 +169928,7 @@ function applyServiceAndEnvironmentTags(config2, tags) {
169897
169928
  const shouldApplyTags = hasDefinedEnvironments(config2);
169898
169929
  if (shouldApplyTags && !serviceName) {
169899
169930
  logger.warn(
169900
- `No top-level \`name\` has been defined in your ${cliPresentation.displayConfigFileName}. Add a top-level \`name\` to group this Worker together with its sibling environments in the Cloudflare dashboard.`
169931
+ `No top-level \`name\` has been defined in your ${configFileName(config2.configPath, config2.userConfigPath)}. Add a top-level \`name\` to group this Worker together with its sibling environments in the Cloudflare dashboard.`
169901
169932
  );
169902
169933
  }
169903
169934
  const serviceTag = shouldApplyTags && serviceName ? `${SERVICE_TAG_PREFIX}${serviceName}` : null;
@@ -175313,12 +175344,19 @@ function inheritIfNoConfiguredResourceIdentifier(handler) {
175313
175344
  function isProvisionableBinding(binding) {
175314
175345
  return binding.type in HANDLERS;
175315
175346
  }
175316
- function createHandler(bindingName, binding, complianceConfig, accountId) {
175347
+ function createHandler(bindingName, binding, complianceConfig, accountId, d1ListCommand2, d1DeleteCommand2) {
175317
175348
  switch (binding.type) {
175318
175349
  case "kv_namespace":
175319
175350
  return new KVHandler(bindingName, binding, complianceConfig, accountId);
175320
175351
  case "d1":
175321
- return new D1Handler(bindingName, binding, complianceConfig, accountId);
175352
+ return new D1Handler(
175353
+ bindingName,
175354
+ binding,
175355
+ complianceConfig,
175356
+ accountId,
175357
+ d1ListCommand2,
175358
+ d1DeleteCommand2
175359
+ );
175322
175360
  case "r2_bucket":
175323
175361
  return new R2Handler(bindingName, binding, complianceConfig, accountId);
175324
175362
  case "ai_search_namespace":
@@ -175378,7 +175416,7 @@ function toConfigBinding(bindingName, binding) {
175378
175416
  return HANDLERS.flagship.toConfig(bindingName, binding);
175379
175417
  }
175380
175418
  }
175381
- async function collectPendingResources(complianceConfig, accountId, scriptName, bindings) {
175419
+ async function collectPendingResources(complianceConfig, accountId, scriptName, bindings, d1ListCommand2, d1DeleteCommand2) {
175382
175420
  let settings;
175383
175421
  try {
175384
175422
  settings = await getSettings(complianceConfig, accountId, scriptName);
@@ -175396,7 +175434,9 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
175396
175434
  bindingName,
175397
175435
  binding,
175398
175436
  complianceConfig,
175399
- accountId
175437
+ accountId,
175438
+ d1ListCommand2,
175439
+ d1DeleteCommand2
175400
175440
  );
175401
175441
  const resource = {
175402
175442
  binding: bindingName,
@@ -175431,7 +175471,14 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
175431
175471
  }
175432
175472
  async function provisionBindings(bindings, accountId, scriptName, autoCreate, config2, options) {
175433
175473
  const configPath = config2.userConfigPath ?? config2.configPath;
175434
- const { pendingResources, resolvedResources, skippedProvisioning } = await collectPendingResources(config2, accountId, scriptName, bindings);
175474
+ const { pendingResources, resolvedResources, skippedProvisioning } = await collectPendingResources(
175475
+ config2,
175476
+ accountId,
175477
+ scriptName,
175478
+ bindings,
175479
+ options.d1ListCommand,
175480
+ options.d1DeleteCommand
175481
+ );
175435
175482
  if (pendingResources.length > 0) {
175436
175483
  assert38__default.default(
175437
175484
  configPath,
@@ -175661,7 +175708,7 @@ async function listFlagshipApps(complianceConfig, accountId) {
175661
175708
  `/accounts/${accountId}/flagship/apps`
175662
175709
  );
175663
175710
  }
175664
- async function createD1Database(complianceConfig, accountId, name2) {
175711
+ async function createD1Database(complianceConfig, accountId, name2, d1ListCommand2, d1DeleteCommand2) {
175665
175712
  try {
175666
175713
  return await fetchResult(
175667
175714
  complianceConfig,
@@ -175682,14 +175729,17 @@ async function createD1Database(complianceConfig, accountId, name2) {
175682
175729
  });
175683
175730
  }
175684
175731
  if (errorCode === 7406) {
175685
- throw new UserError(renderD1DatabaseLimitError(accountId), {
175686
- telemetryMessage: "d1 create database limit reached"
175687
- });
175732
+ throw new UserError(
175733
+ renderD1DatabaseLimitError(accountId, d1ListCommand2, d1DeleteCommand2),
175734
+ {
175735
+ telemetryMessage: "d1 create database limit reached"
175736
+ }
175737
+ );
175688
175738
  }
175689
175739
  throw e11;
175690
175740
  }
175691
175741
  }
175692
- function renderD1DatabaseLimitError(accountId) {
175742
+ function renderD1DatabaseLimitError(accountId, d1ListCommand2, d1DeleteCommand2) {
175693
175743
  return esm_default`
175694
175744
  You have reached the maximum number of D1 databases for your account.
175695
175745
 
@@ -175700,8 +175750,8 @@ function renderD1DatabaseLimitError(accountId) {
175700
175750
  https://developers.cloudflare.com/d1/
175701
175751
 
175702
175752
  Or free up space:
175703
- To list your existing databases, run: ${cliPresentation.commands.d1List}
175704
- To delete a database, run: ${cliPresentation.commands.d1Delete} <database-name>
175753
+ To list your existing databases, run: ${d1ListCommand2}
175754
+ To delete a database, run: ${d1DeleteCommand2}
175705
175755
  `;
175706
175756
  }
175707
175757
  async function listDatabases(complianceConfig, accountId, limitCalls = false, pageSize = 10) {
@@ -176225,6 +176275,18 @@ var init_provision_bindings = __esm({
176225
176275
  }
176226
176276
  };
176227
176277
  D1Handler = class extends ProvisionResourceHandler {
176278
+ constructor(bindingName, binding, complianceConfig, accountId, d1ListCommand2, d1DeleteCommand2) {
176279
+ super(
176280
+ "d1",
176281
+ bindingName,
176282
+ binding,
176283
+ "database_id",
176284
+ complianceConfig,
176285
+ accountId
176286
+ );
176287
+ this.d1ListCommand = d1ListCommand2;
176288
+ this.d1DeleteCommand = d1DeleteCommand2;
176289
+ }
176228
176290
  static {
176229
176291
  __name(this, "D1Handler");
176230
176292
  }
@@ -176235,20 +176297,12 @@ var init_provision_bindings = __esm({
176235
176297
  const db = await createD1Database(
176236
176298
  this.complianceConfig,
176237
176299
  this.accountId,
176238
- name2
176300
+ name2,
176301
+ this.d1ListCommand,
176302
+ this.d1DeleteCommand
176239
176303
  );
176240
176304
  return db.uuid;
176241
176305
  }
176242
- constructor(bindingName, binding, complianceConfig, accountId) {
176243
- super(
176244
- "d1",
176245
- bindingName,
176246
- binding,
176247
- "database_id",
176248
- complianceConfig,
176249
- accountId
176250
- );
176251
- }
176252
176306
  async canInherit(settings) {
176253
176307
  const maybeInherited = settings?.bindings.find(
176254
176308
  (existing) => existing.type === this.type && existing.name === this.bindingName
@@ -176501,9 +176555,9 @@ function addRequiredSecretsInheritBindings(config2, bindings, options) {
176501
176555
  if (options.type === "deploy" && !options.workerExists) {
176502
176556
  throw new UserError(
176503
176557
  `The following required secrets have not been set: ${inheritedSecrets.join(", ")}
176504
- This Worker does not exist yet, so secrets cannot be set in advance with \`${cliPresentation.commands.secretPut}\`.
176558
+ This Worker does not exist yet, so secrets cannot be set in advance with \`${options.secretPutCommand}\`.
176505
176559
  To deploy a new Worker with secrets, supply them via a secrets file:
176506
- ${cliPresentation.commands.deploy} --secrets-file <path-to-file>
176560
+ ${options.uploadCommand} --secrets-file <path-to-file>
176507
176561
  where the file contains lines in the format \`SECRET_NAME=value\` (or JSON).
176508
176562
  See https://developers.cloudflare.com/workers/configuration/secrets/#secrets-on-deployed-workers for more information.`,
176509
176563
  { telemetryMessage: "required secrets missing before first deploy" }
@@ -176520,12 +176574,11 @@ function handleMissingSecretsError(err, config2, options) {
176520
176574
  const missingSecretNames = err.notes.map((note) => note.text.match(/^inherit binding '(.+?)' is invalid/)).filter((match4) => match4 !== null).map((match4) => match4[1]).filter((secretName) => config2.secrets?.required?.includes(secretName));
176521
176575
  if (missingSecretNames.length > 0) {
176522
176576
  err.preventReport();
176523
- const secretPutCommand2 = options.type === "deploy" ? cliPresentation.commands.secretPut : cliPresentation.commands.versionsSecretPut;
176524
- const secretsFileCommand = `${options.type === "deploy" ? cliPresentation.commands.deploy : cliPresentation.commands.versionsUpload} --secrets-file <path-to-file>`;
176577
+ const secretsFileCommand = `${options.uploadCommand} --secrets-file <path-to-file>`;
176525
176578
  const action = options.type === "deploy" ? "deploying" : "uploading";
176526
176579
  throw new UserError(
176527
176580
  `The following required secrets have not been set: ${missingSecretNames.join(", ")}
176528
- Use \`${secretPutCommand2} <NAME>\` to set secrets before ${action},
176581
+ Use \`${options.secretPutCommand} <NAME>\` to set secrets before ${action},
176529
176582
  or supply them when ${action} with \`${secretsFileCommand}\`.
176530
176583
  See https://developers.cloudflare.com/workers/configuration/secrets/#secrets-on-deployed-workers for more information.`,
176531
176584
  { telemetryMessage: "required secrets missing during upload or deploy" }
@@ -176536,7 +176589,6 @@ var init_secrets_validation = __esm({
176536
176589
  "../deploy-helpers/src/deploy/helpers/secrets-validation.ts"() {
176537
176590
  init_import_meta_url();
176538
176591
  init_src();
176539
- init_context();
176540
176592
  init_error_codes();
176541
176593
  __name(addRequiredSecretsInheritBindings, "addRequiredSecretsInheritBindings");
176542
176594
  __name(handleMissingSecretsError, "handleMissingSecretsError");
@@ -177427,7 +177479,7 @@ async function checkWorkflowConflicts(config2, accountId, scriptName) {
177427
177479
  const message = `The following workflow(s) already exist and belong to different workers:
177428
177480
  ${conflictList}
177429
177481
 
177430
- Deploying will reassign these workflows to "${scriptName}". Workflow names must be unique per account. If this reassignment is unintended, rename the workflow(s) in your ${cliPresentation.displayConfigFileName}.`;
177482
+ Deploying will reassign these workflows to "${scriptName}". Workflow names must be unique per account. If this reassignment is unintended, rename the workflow(s) in your ${configFileName(config2.configPath, config2.userConfigPath)}.`;
177431
177483
  return { hasConflicts: true, conflicts, message };
177432
177484
  }
177433
177485
  var WORKFLOW_NOT_FOUND_CODE;
@@ -177435,6 +177487,7 @@ var init_check_workflow_conflicts = __esm({
177435
177487
  "../deploy-helpers/src/deploy/helpers/check-workflow-conflicts.ts"() {
177436
177488
  init_import_meta_url();
177437
177489
  init_src();
177490
+ init_src();
177438
177491
  init_context();
177439
177492
  init_owned_workflows();
177440
177493
  WORKFLOW_NOT_FOUND_CODE = 10200;
@@ -179857,14 +179910,29 @@ function getRemoteConfigDiff(remoteConfig, localResolvedConfig) {
179857
179910
  normalizedLocalConfig
179858
179911
  );
179859
179912
  const diff = diffJsonObjects(
179860
- normalizedRemoteConfig,
179861
- normalizedLocalConfig
179913
+ omitUndefinedProperties(
179914
+ normalizedRemoteConfig
179915
+ ),
179916
+ omitUndefinedProperties(
179917
+ normalizedLocalConfig
179918
+ )
179862
179919
  );
179863
179920
  return {
179864
179921
  diff,
179865
179922
  nonDestructive: isNonDestructive(diff)
179866
179923
  };
179867
179924
  }
179925
+ function omitUndefinedProperties(value) {
179926
+ if (Array.isArray(value)) {
179927
+ return value.map(omitUndefinedProperties);
179928
+ }
179929
+ if (value === null || typeof value !== "object") {
179930
+ return value;
179931
+ }
179932
+ return Object.fromEntries(
179933
+ Object.entries(value).filter(([, fieldValue]) => fieldValue !== void 0).map(([key, fieldValue]) => [key, omitUndefinedProperties(fieldValue)])
179934
+ );
179935
+ }
179868
179936
  function normalizeLocalResolvedConfigAsRemote(localResolvedConfig) {
179869
179937
  const subdomainValues = getSubdomainValuesAPIMock(
179870
179938
  localResolvedConfig.workers_dev,
@@ -180319,6 +180387,7 @@ var init_config_diffs = __esm({
180319
180387
  assets: false
180320
180388
  };
180321
180389
  __name(getRemoteConfigDiff, "getRemoteConfigDiff");
180390
+ __name(omitUndefinedProperties, "omitUndefinedProperties");
180322
180391
  __name(normalizeLocalResolvedConfigAsRemote, "normalizeLocalResolvedConfigAsRemote");
180323
180392
  __name(normalizeCustomDomainRoute, "normalizeCustomDomainRoute");
180324
180393
  __name(normalizeRemoteCustomDomainRoute, "normalizeRemoteCustomDomainRoute");
@@ -180363,7 +180432,7 @@ var init_deploy_confirm = __esm({
180363
180432
  });
180364
180433
 
180365
180434
  // ../deploy-helpers/src/deploy/helpers/download-worker-config.ts
180366
- async function fetchWorkerConfig(accountId, workerName, environment) {
180435
+ async function fetchWorkerConfig(complianceConfig, accountId, workerName, environment) {
180367
180436
  const [
180368
180437
  bindings,
180369
180438
  routes,
@@ -180373,27 +180442,27 @@ async function fetchWorkerConfig(accountId, workerName, environment) {
180373
180442
  cronTriggers
180374
180443
  ] = await Promise.all([
180375
180444
  fetchResult(
180376
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
180445
+ complianceConfig,
180377
180446
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/bindings`
180378
180447
  ),
180379
180448
  fetchResult(
180380
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
180449
+ complianceConfig,
180381
180450
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/routes?show_zonename=true`
180382
180451
  ),
180383
180452
  fetchResult(
180384
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
180453
+ complianceConfig,
180385
180454
  `/accounts/${accountId}/workers/domains/records?page=0&per_page=5&service=${workerName}&environment=${environment}`
180386
180455
  ),
180387
180456
  fetchResult(
180388
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
180457
+ complianceConfig,
180389
180458
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/subdomain`
180390
180459
  ),
180391
180460
  fetchResult(
180392
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
180461
+ complianceConfig,
180393
180462
  `/accounts/${accountId}/workers/services/${workerName}/environments/${environment}`
180394
180463
  ),
180395
180464
  fetchResult(
180396
- COMPLIANCE_REGION_CONFIG_UNKNOWN,
180465
+ complianceConfig,
180397
180466
  `/accounts/${accountId}/workers/scripts/${workerName}/schedules`
180398
180467
  )
180399
180468
  ]).catch((e11) => {
@@ -180411,7 +180480,7 @@ async function fetchWorkerConfig(accountId, workerName, environment) {
180411
180480
  cronTriggers
180412
180481
  };
180413
180482
  }
180414
- async function downloadWorkerConfig(workerName, environment, entrypoint, accountId) {
180483
+ async function downloadWorkerConfig(complianceConfig, workerName, environment, entrypoint, accountId) {
180415
180484
  const {
180416
180485
  bindings,
180417
180486
  routes,
@@ -180419,7 +180488,12 @@ async function downloadWorkerConfig(workerName, environment, entrypoint, account
180419
180488
  subdomainStatus,
180420
180489
  serviceEnvMetadata,
180421
180490
  cronTriggers
180422
- } = await fetchWorkerConfig(accountId, workerName, environment);
180491
+ } = await fetchWorkerConfig(
180492
+ complianceConfig,
180493
+ accountId,
180494
+ workerName,
180495
+ environment
180496
+ );
180423
180497
  return constructWranglerConfig({
180424
180498
  name: workerName,
180425
180499
  entrypoint,
@@ -180490,7 +180564,7 @@ async function verifyWorkerMatchesCITag(complianceConfig, accountId, workerName,
180490
180564
  );
180491
180565
  } else {
180492
180566
  throw new FatalError(
180493
- `${cliPresentation.displayName} cannot validate that your Worker name matches what is expected by the build system. Please retry the build. If the problem persists, please contact support.`,
180567
+ "The Worker name could not be validated against what is expected by the build system. Please retry the build. If the problem persists, please contact support.",
180494
180568
  { telemetryMessage: "ci match tag validation failed" }
180495
180569
  );
180496
180570
  }
@@ -180740,7 +180814,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
180740
180814
  }
180741
180815
  return { ...props, name: name2 };
180742
180816
  }
180743
- async function preUploadApiChecks(props, config2) {
180817
+ async function preUploadApiChecks(props, config2, queueCreateCommand2) {
180744
180818
  const { accountId, name: name2 } = props;
180745
180819
  if (props.dryRun || !accountId || !name2) {
180746
180820
  return {
@@ -180780,12 +180854,13 @@ async function preUploadApiChecks(props, config2) {
180780
180854
  tags = script.tags ?? tags;
180781
180855
  if (props.command === "deploy" && props.failIfWorkerNameTaken) {
180782
180856
  throw new UserError(
180783
- `A Worker named "${name2}" already exists in your account. This deploy could not confirm that it should update that Worker, so it stopped instead of overwriting it. To update the existing Worker, add a ${cliPresentation.displayConfigFileName} that names "${name2}"; to deploy separately, use a different name.`,
180857
+ `A Worker named "${name2}" already exists in your account. This deploy could not confirm that it should update that Worker, so it stopped instead of overwriting it. To update the existing Worker, add a ${configFileName(config2.configPath, config2.userConfigPath)} that names "${name2}"; to deploy separately, use a different name.`,
180784
180858
  { telemetryMessage: "deploy unverified worker name already exists" }
180785
180859
  );
180786
180860
  }
180787
180861
  if (script.last_deployed_from === "dash") {
180788
180862
  const remoteWorkerConfig = await downloadWorkerConfig(
180863
+ config2,
180789
180864
  name2,
180790
180865
  serviceMetaData.default_environment.environment,
180791
180866
  props.entry.file,
@@ -180873,7 +180948,8 @@ Edits that have been made via the script API will be overridden by your local co
180873
180948
  config2,
180874
180949
  accountId,
180875
180950
  !props.resourcesProvision,
180876
- name2
180951
+ name2,
180952
+ queueCreateCommand2
180877
180953
  );
180878
180954
  const wantsWorkersDev = props.command === "deploy" && props.dispatchNamespace === void 0 && getSubdomainValues(config2.workers_dev, config2.preview_urls, props.routes).workers_dev;
180879
180955
  if (!workerExists && wantsWorkersDev) {
@@ -180929,8 +181005,8 @@ var init_workers_sites_bindings = __esm({
180929
181005
  __name(addWorkersSitesBindings, "addWorkersSitesBindings");
180930
181006
  }
180931
181007
  });
180932
- async function deploy(props, config2, buildResult, callbacks) {
180933
- const result = await deployWorker(props, config2, buildResult, callbacks);
181008
+ async function deploy(props, config2, buildResult, options) {
181009
+ const result = await deployWorker(props, config2, buildResult, options);
180934
181010
  writeOutput({
180935
181011
  type: "deploy",
180936
181012
  version: 1,
@@ -180947,13 +181023,14 @@ async function deploy(props, config2, buildResult, callbacks) {
180947
181023
  });
180948
181024
  return result;
180949
181025
  }
180950
- async function deployWorker(props, config2, buildResult, callbacks) {
181026
+ async function deployWorker(props, config2, buildResult, options) {
180951
181027
  const { entry, compatibilityDate, compatibilityFlags, keepVars, accountId } = props;
180952
181028
  const assetsOptions = resolveAssetOptions(props, config2);
180953
181029
  const { name: name2 } = validateWorkerProps({ ...props, assetsOptions }, config2);
180954
181030
  const { workerTag, tags, workerExists, aborted: aborted2 } = await preUploadApiChecks(
180955
181031
  props,
180956
- config2
181032
+ config2,
181033
+ options.queueCreateCommand
180957
181034
  );
180958
181035
  if (aborted2) {
180959
181036
  return { versionId: null, workerTag };
@@ -180970,7 +181047,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
180970
181047
  const confirmation = await confirmLatestDeploymentOverwriteAndGetLatest(
180971
181048
  config2,
180972
181049
  accountId,
180973
- scriptName
181050
+ scriptName,
181051
+ options.deployCommand,
181052
+ options.versionsDeployCommand
180974
181053
  );
180975
181054
  latestDeployment = confirmation.latestDeployment;
180976
181055
  if (!confirmation.confirmed) {
@@ -181039,7 +181118,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181039
181118
  if (assetsOptions && isDryRun) {
181040
181119
  await buildAssetManifest(assetsOptions.directory);
181041
181120
  }
181042
- const workersSitesAssets = callbacks.syncWorkersSite ? await callbacks.syncWorkersSite(
181121
+ const workersSitesAssets = options.syncWorkersSite ? await options.syncWorkersSite(
181043
181122
  config2,
181044
181123
  accountId,
181045
181124
  scriptName,
@@ -181071,7 +181150,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181071
181150
  }
181072
181151
  addRequiredSecretsInheritBindings(config2, bindings, {
181073
181152
  type: "deploy",
181074
- workerExists
181153
+ workerExists,
181154
+ secretPutCommand: options.secretPutCommand,
181155
+ uploadCommand: options.deployCommand
181075
181156
  });
181076
181157
  if (workersSitesAssets.manifest) {
181077
181158
  modules.push({
@@ -181175,7 +181256,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181175
181256
  props.experimentalAutoCreate,
181176
181257
  config2,
181177
181258
  {
181178
- skipConfigWriteback: props.skipProvisioningConfigWriteback
181259
+ skipConfigWriteback: props.skipProvisioningConfigWriteback,
181260
+ d1ListCommand: options.d1ListCommand,
181261
+ d1DeleteCommand: options.d1DeleteCommand
181179
181262
  }
181180
181263
  );
181181
181264
  }
@@ -181341,18 +181424,21 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181341
181424
  workerBundle,
181342
181425
  projectRoot,
181343
181426
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility callback for existing deploy-helpers consumers
181344
- callbacks.analyseBundle
181427
+ options.analyseBundle
181345
181428
  );
181346
181429
  if (message !== null) {
181347
181430
  logger.error(message);
181348
181431
  }
181349
181432
  handleMissingSecretsError(err, config2, {
181350
- type: "deploy"});
181433
+ type: "deploy",
181434
+ secretPutCommand: options.secretPutCommand,
181435
+ uploadCommand: options.deployCommand
181436
+ });
181351
181437
  if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
181352
181438
  err.preventReport();
181353
181439
  if (err.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
181354
181440
  throw new UserError(
181355
- `You must use a real database in the database_id configuration. You can find your databases using '${cliPresentation.commands.d1List}', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`,
181441
+ `You must use a real database in the database_id configuration. You can find your databases using '${options.d1ListCommand}', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`,
181356
181442
  { telemetryMessage: "deploy d1 database binding invalid id" }
181357
181443
  );
181358
181444
  }
@@ -181392,7 +181478,6 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181392
181478
  if (shouldDeployContainers) {
181393
181479
  assert38__default.default(versionId && accountId);
181394
181480
  initContainersSharedContext({
181395
- cliPresentation,
181396
181481
  logger,
181397
181482
  fetchPagedListResult,
181398
181483
  fetchResult
@@ -181431,7 +181516,10 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181431
181516
  versionId,
181432
181517
  accountId,
181433
181518
  scriptName,
181434
- dispatchNamespace: props.dispatchNamespace
181519
+ dispatchNamespace: props.dispatchNamespace,
181520
+ configFileName: options.configFileName,
181521
+ observabilityTargetPercentageField: options.observabilityTargetPercentageField,
181522
+ observabilityTargetCountField: options.observabilityTargetCountField
181435
181523
  }
181436
181524
  );
181437
181525
  }
@@ -181450,7 +181538,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181450
181538
  );
181451
181539
  } catch (error64) {
181452
181540
  throw new UserError(
181453
- `The Worker version was deployed, but ${cliPresentation.displayName} could not finish applying its Durable Object-managed Container application settings. Re-run the same \`${cliPresentation.commands.deploy}\` command to retry and finish deployment.`,
181541
+ `The Worker version was deployed, but its Durable Object-managed Container application settings were not fully applied. Re-run the same \`${options.deployCommand}\` command to retry and finish deployment.`,
181454
181542
  {
181455
181543
  telemetryMessage: "deploy durable object container application creation failed after deployment",
181456
181544
  cause: error64
@@ -181472,7 +181560,12 @@ async function deployWorker(props, config2, buildResult, callbacks) {
181472
181560
  firstDeploy: !workerExists,
181473
181561
  routes: props.routes,
181474
181562
  validated: true,
181475
- dryRun: false
181563
+ dryRun: false,
181564
+ queueCreateCommand: options.queueCreateCommand,
181565
+ workersDevConfigFieldName: options.workersDevConfigFieldName,
181566
+ workersDevConfigAssignment: options.workersDevConfigAssignment,
181567
+ previewUrlsConfigFieldName: options.previewUrlsConfigFieldName,
181568
+ previewUrlsConfigAssignment: options.previewUrlsConfigAssignment
181476
181569
  });
181477
181570
  logger.log("Current Version ID:", versionId);
181478
181571
  return {
@@ -181534,13 +181627,8 @@ var init_binding_depends_on_export = __esm({
181534
181627
  __name(renderBindingDependsOnExportError, "renderBindingDependsOnExportError");
181535
181628
  }
181536
181629
  });
181537
- async function versionsUpload(props, config2, buildResult, callbacks = {}) {
181538
- const result = await uploadWorkerVersion(
181539
- props,
181540
- config2,
181541
- buildResult,
181542
- callbacks
181543
- );
181630
+ async function versionsUpload(props, config2, buildResult, options) {
181631
+ const result = await uploadWorkerVersion(props, config2, buildResult, options);
181544
181632
  writeOutput({
181545
181633
  type: "version-upload",
181546
181634
  version: 1,
@@ -181558,11 +181646,15 @@ async function versionsUpload(props, config2, buildResult, callbacks = {}) {
181558
181646
  });
181559
181647
  return result;
181560
181648
  }
181561
- async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
181649
+ async function uploadWorkerVersion(props, config2, buildResult, options) {
181562
181650
  const { entry, compatibilityDate, compatibilityFlags, keepVars, accountId } = props;
181563
181651
  const assetsOptions = resolveAssetOptions(props, config2);
181564
181652
  const { name: name2 } = validateWorkerProps(props, config2);
181565
- const { workerTag, tags, aborted: aborted2 } = await preUploadApiChecks(props, config2);
181653
+ const { workerTag, tags, aborted: aborted2 } = await preUploadApiChecks(
181654
+ props,
181655
+ config2,
181656
+ options.queueCreateCommand
181657
+ );
181566
181658
  if (aborted2) {
181567
181659
  return { versionId: null, workerTag };
181568
181660
  }
@@ -181598,7 +181690,7 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
181598
181690
  });
181599
181691
  if (migrations !== void 0) {
181600
181692
  throw new UserError(
181601
- `This Worker has a pending Durable Object migration, which cannot be applied by \`${cliPresentation.commands.versionsUpload}\`. Durable Object migrations must be applied with \`${cliPresentation.commands.deploy}\`. Run \`${cliPresentation.commands.deploy}\` to apply the migration, then retry \`${cliPresentation.commands.versionsUpload}\`.`,
181693
+ `This Worker has a pending Durable Object migration, which cannot be applied by \`${options.versionsUploadCommand}\`. Durable Object migrations must be applied with \`${options.deployCommand}\`. Run \`${options.deployCommand}\` to apply the migration, then retry \`${options.versionsUploadCommand}\`.`,
181602
181694
  { telemetryMessage: "versions upload pending durable object migration" }
181603
181695
  );
181604
181696
  }
@@ -181613,7 +181705,9 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
181613
181705
  accountId,
181614
181706
  dryRun: Boolean(props.dryRun),
181615
181707
  scriptName,
181616
- requireExistingImageLessApplications: true
181708
+ requireExistingImageLessApplications: true,
181709
+ deployCommand: options.deployCommand,
181710
+ versionsUploadCommand: options.versionsUploadCommand
181617
181711
  }
181618
181712
  );
181619
181713
  const assetsUploadResult = assetsOptions && !props.dryRun ? await syncAssets(config2, accountId, assetsOptions.directory, scriptName) : void 0;
@@ -181710,7 +181804,9 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
181710
181804
  props.experimentalAutoCreate,
181711
181805
  config2,
181712
181806
  {
181713
- skipConfigWriteback: props.skipProvisioningConfigWriteback
181807
+ skipConfigWriteback: props.skipProvisioningConfigWriteback,
181808
+ d1ListCommand: options.d1ListCommand,
181809
+ d1DeleteCommand: options.d1DeleteCommand
181714
181810
  }
181715
181811
  );
181716
181812
  }
@@ -181765,12 +181861,16 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
181765
181861
  workerBundle,
181766
181862
  projectRoot,
181767
181863
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- compatibility callback for existing deploy-helpers consumers
181768
- callbacks.analyseBundle
181864
+ options.analyseBundle
181769
181865
  );
181770
181866
  if (message) {
181771
181867
  logger.error(message);
181772
181868
  }
181773
- handleMissingSecretsError(err, config2, { type: "upload" });
181869
+ handleMissingSecretsError(err, config2, {
181870
+ type: "upload",
181871
+ secretPutCommand: options.versionsSecretPutCommand,
181872
+ uploadCommand: options.versionsUploadCommand
181873
+ });
181774
181874
  if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
181775
181875
  const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
181776
181876
  if (bundleType === "commonjs") {
@@ -181850,8 +181950,8 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
181850
181950
  }
181851
181951
  }
181852
181952
  }
181853
- const cmdVersionsDeploy = blue(cliPresentation.commands.versionsDeploy);
181854
- const cmdTriggersDeploy = blue(cliPresentation.commands.triggersDeploy);
181953
+ const cmdVersionsDeploy = blue(options.versionsDeployCommand);
181954
+ const cmdTriggersDeploy = blue(options.triggersDeployCommand);
181855
181955
  logger.info(
181856
181956
  gray(`
181857
181957
  To deploy this version to production traffic use the command ${cmdVersionsDeploy}
@@ -182037,7 +182137,7 @@ function validateNodeCompatMode(compatibilityDateStr = "2000-01-01", compatibili
182037
182137
  }
182038
182138
  if (noBundle && hasNodejsCompatV2Flag) {
182039
182139
  logger.warn(
182040
- `\`nodejs_compat_v2\` compatibility flag and \`--no-bundle\` can't be used together. If you want to polyfill Node.js built-ins and disable ${cliPresentation.displayName}'s bundling, please polyfill as part of your own bundling process.`
182140
+ "`nodejs_compat_v2` compatibility flag and `--no-bundle` can't be used together. If you want to polyfill Node.js built-ins while disabling bundling, please polyfill as part of your own bundling process."
182041
182141
  );
182042
182142
  }
182043
182143
  return mode;
@@ -182059,7 +182159,7 @@ var init_versions_types = __esm({
182059
182159
  });
182060
182160
 
182061
182161
  // ../deploy-helpers/src/deploy/helpers/inconsistent-exports.ts
182062
- function renderInconsistentExportsAcrossVersionsError(serverMessage) {
182162
+ function renderInconsistentExportsAcrossVersionsError(serverMessage, versionsDeployAt100Command) {
182063
182163
  return [
182064
182164
  serverMessage,
182065
182165
  "",
@@ -182067,7 +182167,7 @@ function renderInconsistentExportsAcrossVersionsError(serverMessage) {
182067
182167
  "",
182068
182168
  "What to do:",
182069
182169
  " 1. Deploy the version that changes `exports` at 100% first:",
182070
- ` ${cliPresentation.commands.versionsDeployAt(100)}`,
182170
+ ` ${versionsDeployAt100Command}`,
182071
182171
  " 2. Once that deploy is stable, run your percentage-split deploy.",
182072
182172
  "",
182073
182173
  "Learn more: https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#gradual-deployments-for-durable-objects"
@@ -182076,7 +182176,6 @@ function renderInconsistentExportsAcrossVersionsError(serverMessage) {
182076
182176
  var init_inconsistent_exports = __esm({
182077
182177
  "../deploy-helpers/src/deploy/helpers/inconsistent-exports.ts"() {
182078
182178
  init_import_meta_url();
182079
- init_context();
182080
182179
  __name(renderInconsistentExportsAcrossVersionsError, "renderInconsistentExportsAcrossVersionsError");
182081
182180
  }
182082
182181
  });
@@ -182836,9 +182935,9 @@ function getPreviewExports(exports$1) {
182836
182935
  }
182837
182936
  return previewExports;
182838
182937
  }
182839
- async function prepareContainersForPreview(config2, workerName, previewSlug, callbacks, localImageReferences) {
182938
+ async function prepareContainersForPreview(config2, workerName, previewSlug, options, localImageReferences) {
182840
182939
  const previewContainers = config2.previews?.containers ?? [];
182841
- if (previewContainers.length === 0 || !callbacks.getNormalizedContainerOptions) {
182940
+ if (previewContainers.length === 0 || !options.getNormalizedContainerOptions) {
182842
182941
  return { scopedContainerConfig: void 0, normalisedContainerConfig: [] };
182843
182942
  }
182844
182943
  const scopedContainerConfig = buildPreviewContainerConfig(
@@ -182850,9 +182949,12 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
182850
182949
  if (!scopedContainerConfig) {
182851
182950
  return { scopedContainerConfig: void 0, normalisedContainerConfig: [] };
182852
182951
  }
182853
- const normalisedContainerConfig = await callbacks.getNormalizedContainerOptions(scopedContainerConfig, {
182854
- dryRun: false
182855
- });
182952
+ const normalisedContainerConfig = await options.getNormalizedContainerOptions(
182953
+ scopedContainerConfig,
182954
+ {
182955
+ dryRun: false
182956
+ }
182957
+ );
182856
182958
  const containersNeedingDocker = normalisedContainerConfig.filter(
182857
182959
  (container) => "dockerfile" in container
182858
182960
  );
@@ -182864,8 +182966,8 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
182864
182966
  hint: 'If you cannot run Docker locally, set "image" to a prebuilt registry image instead of a Dockerfile path for the affected entries in "previews.containers".'
182865
182967
  });
182866
182968
  }
182867
- if (callbacks.verifyContainersScope) {
182868
- await callbacks.verifyContainersScope(scopedContainerConfig);
182969
+ if (options.verifyContainersScope) {
182970
+ await options.verifyContainersScope(scopedContainerConfig);
182869
182971
  }
182870
182972
  return { scopedContainerConfig, normalisedContainerConfig };
182871
182973
  }
@@ -182882,7 +182984,7 @@ function formatPreviewConfigUpdate(config2, update) {
182882
182984
  configPath
182883
182985
  ).trimEnd();
182884
182986
  }
182885
- function formatNoActivePreviewUrlsMessage(config2) {
182987
+ function formatNoActivePreviewUrlsMessage(config2, deployCommand2 = "your deploy command", previewCommand2 = "the preview command") {
182886
182988
  const customDomainRouteEntries = (config2.routes ?? []).filter(isCustomDomainRoute).map((route) => ({ route, singular: false }));
182887
182989
  if (config2.route && isCustomDomainRoute(config2.route)) {
182888
182990
  customDomainRouteEntries.push({ route: config2.route, singular: true });
@@ -182932,7 +183034,7 @@ function formatNoActivePreviewUrlsMessage(config2) {
182932
183034
  }
182933
183035
  const workersDevAlreadyConfigured = config2.preview_urls === true;
182934
183036
  const customDomainAlreadyConfigured = customDomainRoute?.previews_enabled === true;
182935
- const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? `Caution: \`${cliPresentation.commands.deploy}\` publishes the code in your current checkout to the deployed Worker. If you have already made this change, confirm it was applied by running \`${cliPresentation.commands.deploy}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${cliPresentation.commands.preview}\` again.` : `Caution: \`${cliPresentation.commands.deploy}\` publishes the code in your current checkout to the deployed Worker, not only these settings. If you use Git, commit the configuration change and run \`${cliPresentation.commands.deploy}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${cliPresentation.commands.preview}\` again.`;
183037
+ const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? `Caution: \`${deployCommand2}\` publishes the code in your current checkout to the deployed Worker. If you have already made this change, confirm it was applied by running \`${deployCommand2}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${previewCommand2}\` again.` : `Caution: \`${deployCommand2}\` publishes the code in your current checkout to the deployed Worker, not only these settings. If you use Git, commit the configuration change and run \`${deployCommand2}\` from a clean checkout of your production branch. Then return to your feature branch and run \`${previewCommand2}\` again.`;
182936
183038
  let workersDevInstruction = `Add this to your ${configName}:`;
182937
183039
  if (config2.preview_urls === true) {
182938
183040
  workersDevInstruction = `Your ${configName} already contains:`;
@@ -183183,7 +183285,7 @@ function formatUrlLines(label, urls) {
183183
183285
  ...urls.map((url4) => ` ${source_default.underline(url4)}`)
183184
183286
  ];
183185
183287
  }
183186
- function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest) {
183288
+ function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest, deployCommand2, previewCommand2) {
183187
183289
  const statusLabel = isNew ? source_default.green("(new)") : source_default.dim("(updated)");
183188
183290
  const pullRequestUrl = deployment.annotations?.["workers/pull_request_url"] ?? pullRequest?.url;
183189
183291
  const pullRequestNumber = deployment.annotations?.["workers/pull_request_number"] ?? pullRequest?.number;
@@ -183195,7 +183297,13 @@ function formatPreviewDeploymentSummary(config2, previewResource, deployment, is
183195
183297
  `${source_default.bold("Pull Request:")} ${pullRequestUrl ?? `#${pullRequestNumber}`}`
183196
183298
  ] : [],
183197
183299
  ...formatUrlLines("Unique Deployment", deployment.urls),
183198
- ...hasActiveUrls ? [] : [formatNoActivePreviewUrlsMessage(config2)]
183300
+ ...hasActiveUrls ? [] : [
183301
+ formatNoActivePreviewUrlsMessage(
183302
+ config2,
183303
+ deployCommand2,
183304
+ previewCommand2
183305
+ )
183306
+ ]
183199
183307
  ].join("\n");
183200
183308
  }
183201
183309
  function getPreviewCustomDomainHostnames(config2) {
@@ -183225,7 +183333,7 @@ function previewUrlMatchesCustomDomain(url4, customDomains) {
183225
183333
  return false;
183226
183334
  }
183227
183335
  }
183228
- function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, deployment) {
183336
+ function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, deployment, deployCommand2 = "your deploy command", previewCommand2 = "the preview command") {
183229
183337
  const customDomains = getPreviewCustomDomainHostnames(config2);
183230
183338
  const urls = [...previewResource.urls ?? [], ...deployment.urls ?? []];
183231
183339
  if (customDomains.length === 0 || urls.length === 0 || urls.some((url4) => previewUrlMatchesCustomDomain(url4, customDomains))) {
@@ -183233,7 +183341,7 @@ function logMissingCustomDomainPreviewUrlsWarning(config2, previewResource, depl
183233
183341
  }
183234
183342
  logger.log("");
183235
183343
  logger.warn(
183236
- `Custom domain Preview URLs are configured, but none are active for this Preview. If you added \`previews_enabled = true\` after your last deployment, run \`${cliPresentation.commands.deploy}\` once to publish the custom domain Preview route, then run \`${cliPresentation.commands.preview}\` again. If you already deployed with that setting, the custom domain may still be provisioning.`
183344
+ `Custom domain Preview URLs are configured, but none are active for this Preview. If you enabled Preview URLs after your last deployment, run \`${deployCommand2}\` once to publish the custom domain Preview route, then run \`${previewCommand2}\` again. If you already deployed with that setting, the custom domain may still be provisioning.`
183237
183345
  );
183238
183346
  }
183239
183347
  function logMissingPreviewsBindingsWarning(productionBindingsExpectedInPreview, remotePreviewDefaultBindings, localPreviewBindings) {
@@ -183289,7 +183397,7 @@ async function provisionParentWorker(config2, accountId, workerName, json2) {
183289
183397
  preview_urls ?? workers_dev
183290
183398
  );
183291
183399
  }
183292
- async function runPreview(accountId, args, config2, buildResult, assetsOptions, callbacks, workerName, replaceTailConsumersAfterCreate = false, localImageReferences = /* @__PURE__ */ new Map()) {
183400
+ async function runPreview(accountId, args, config2, buildResult, assetsOptions, options, workerName, replaceTailConsumersAfterCreate = false, localImageReferences = /* @__PURE__ */ new Map()) {
183293
183401
  let secrets;
183294
183402
  if (args.secretsFile) {
183295
183403
  secrets = (await parseBulkInputToObject(args.secretsFile))?.content;
@@ -183368,7 +183476,7 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
183368
183476
  config2,
183369
183477
  workerName,
183370
183478
  previewResource.slug,
183371
- callbacks,
183479
+ options,
183372
183480
  localImageReferences
183373
183481
  );
183374
183482
  const deploymentRequest = await assemblePreviewDeploymentSettings(
@@ -183401,9 +183509,9 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
183401
183509
  delete binding.text;
183402
183510
  }
183403
183511
  }
183404
- if (normalisedContainerConfig.length > 0 && scopedContainerConfig && callbacks.deployPreviewContainers) {
183512
+ if (normalisedContainerConfig.length > 0 && scopedContainerConfig && options.deployPreviewContainers) {
183405
183513
  try {
183406
- await callbacks.deployPreviewContainers(
183514
+ await options.deployPreviewContainers(
183407
183515
  scopedContainerConfig,
183408
183516
  normalisedContainerConfig,
183409
183517
  deployment,
@@ -183422,7 +183530,7 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
183422
183530
  JSON.stringify({ preview: previewResource, deployment }, null, 2)
183423
183531
  );
183424
183532
  } else {
183425
- const productionBindingsExpectedInPreview = callbacks.productionBindingsExpectedInPreview ?? {};
183533
+ const productionBindingsExpectedInPreview = options.productionBindingsExpectedInPreview ?? {};
183426
183534
  if (Object.keys(productionBindingsExpectedInPreview).length > 0) {
183427
183535
  const previewBaseConfig = await getPreviewBaseConfig(
183428
183536
  config2,
@@ -183441,25 +183549,29 @@ async function runPreview(accountId, args, config2, buildResult, assetsOptions,
183441
183549
  previewResource,
183442
183550
  deployment,
183443
183551
  isNewPreview,
183444
- pullRequest
183552
+ pullRequest,
183553
+ options.deployCommand,
183554
+ options.previewCommand
183445
183555
  )
183446
183556
  );
183447
183557
  logMissingCustomDomainPreviewUrlsWarning(
183448
183558
  config2,
183449
183559
  previewResource,
183450
- deployment
183560
+ deployment,
183561
+ options.deployCommand,
183562
+ options.previewCommand
183451
183563
  );
183452
183564
  }
183453
183565
  return { preview: previewResource, deployment, isNewPreview };
183454
183566
  }
183455
- async function preview(accountId, args, config2, buildResult, assetsOptions, callbacks) {
183567
+ async function preview(accountId, args, config2, buildResult, assetsOptions, options) {
183456
183568
  return runPreview(
183457
183569
  accountId,
183458
183570
  args,
183459
183571
  config2,
183460
183572
  buildResult,
183461
183573
  assetsOptions,
183462
- callbacks,
183574
+ options,
183463
183575
  resolveWorkerName(args, config2)
183464
183576
  );
183465
183577
  }
@@ -185797,6 +185909,7 @@ function findRemoteSessionAuthError(error64) {
185797
185909
  }
185798
185910
  async function startRemoteProxySession(bindings, options) {
185799
185911
  for (const [name2, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError(`Flagship binding "${name2}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
185912
+ if (process.versions.bun) throw new UserError("Remote bindings can't work under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js, or turn remote bindings off.", { telemetryMessage: "remote proxy session under bun" });
185800
185913
  options.logger.log(source_default.dim("\u2394 Establishing remote connection..."));
185801
185914
  initLogger(getInternalLogger(options.logger));
185802
185915
  const rawBindings = toRawBindings(bindings);
@@ -185948,7 +186061,7 @@ var init_dist14 = __esm({
185948
186061
  init_wrapper();
185949
186062
  init_create_worker_upload_form();
185950
186063
  import_undici14 = __toESM(require_undici(), 1);
185951
- version3 = "0.0.49";
186064
+ version3 = "0.0.51";
185952
186065
  NoDefaultValueProvided2 = class extends UserError {
185953
186066
  static {
185954
186067
  __name(this, "NoDefaultValueProvided");
@@ -189624,7 +189737,13 @@ var init_dedent = __esm({
189624
189737
  __name(dedent3, "dedent");
189625
189738
  }
189626
189739
  });
189740
+ function shouldApplyMiddlewareLoaderFacade(entry) {
189741
+ return entry.format !== "modules" || entry.exports.length === 0 || entry.exports.includes("default");
189742
+ }
189627
189743
  async function applyMiddlewareLoaderFacade(entry, tmpDirPath, middleware) {
189744
+ if (!shouldApplyMiddlewareLoaderFacade(entry)) {
189745
+ return { entry };
189746
+ }
189628
189747
  tmpDirPath = fs14__namespace.realpathSync(tmpDirPath);
189629
189748
  const middlewareIdentifiers = middleware.map((m7, index) => [
189630
189749
  `__MIDDLEWARE_${index}__`,
@@ -189708,6 +189827,7 @@ var init_apply_middleware = __esm({
189708
189827
  init_import_meta_url();
189709
189828
  init_paths();
189710
189829
  init_dedent();
189830
+ __name(shouldApplyMiddlewareLoaderFacade, "shouldApplyMiddlewareLoaderFacade");
189711
189831
  __name(applyMiddlewareLoaderFacade, "applyMiddlewareLoaderFacade");
189712
189832
  __name(prepareFilePath, "prepareFilePath");
189713
189833
  }
@@ -190194,6 +190314,7 @@ async function bundleWorker(entry, destination, {
190194
190314
  const tmpDir = getWranglerTmpDir(projectRoot, "bundle");
190195
190315
  const entryFile = entry.file;
190196
190316
  const middlewareToLoad = [];
190317
+ const middlewareConfig = {};
190197
190318
  if (targetConsumer === "dev" && !process.env.WRANGLER_DISABLE_REQUEST_BODY_DRAINING) {
190198
190319
  middlewareToLoad.push({
190199
190320
  name: "ensure-req-body-drained",
@@ -190239,14 +190360,16 @@ async function bundleWorker(entry, destination, {
190239
190360
  inject.push(checkedFetchFileToInject);
190240
190361
  }
190241
190362
  if (getFlag("MULTIWORKER")) {
190242
- middlewareToLoad.push({
190243
- name: "patch-console-prefix",
190244
- path: "templates/middleware/middleware-patch-console-prefix.ts",
190245
- supports: ["modules", "service-worker"],
190246
- config: {
190247
- prefix: source_default.blue(`[${entry.name}]`)
190248
- }
190249
- });
190363
+ const name2 = "patch-console-prefix";
190364
+ inject.push(
190365
+ path29__namespace.resolve(
190366
+ getBasePath(),
190367
+ "templates/middleware/middleware-patch-console-prefix.ts"
190368
+ )
190369
+ );
190370
+ middlewareConfig[name2] = {
190371
+ prefix: source_default.blue(`[${entry.name}]`)
190372
+ };
190250
190373
  }
190251
190374
  for (const middleware of middlewareToLoad) {
190252
190375
  if (!middleware.supports.includes(entry.format)) {
@@ -190344,11 +190467,12 @@ async function bundleWorker(entry, destination, {
190344
190467
  cloudflareInternalPlugin,
190345
190468
  buildResultPlugin,
190346
190469
  ...plugins || [],
190347
- configProviderPlugin(
190348
- Object.fromEntries(
190470
+ configProviderPlugin({
190471
+ ...Object.fromEntries(
190349
190472
  middlewareToLoad.filter((m7) => m7.config !== void 0).map((m7) => [m7.name, m7.config])
190350
- )
190351
- )
190473
+ ),
190474
+ ...middlewareConfig
190475
+ })
190352
190476
  ],
190353
190477
  ...jsxFactory && { jsxFactory },
190354
190478
  ...jsxFragment && { jsxFragment },
@@ -190505,6 +190629,60 @@ var init_bundle = __esm({
190505
190629
  __name(shouldCheckFetch, "shouldCheckFetch");
190506
190630
  }
190507
190631
  });
190632
+ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
190633
+ const parsedEntryPath = path29__namespace.default.parse(entryFile);
190634
+ if (parsedEntryPath.ext == ".py") {
190635
+ return { format: "modules", exports: [] };
190636
+ }
190637
+ const result = await esbuild__namespace.build({
190638
+ ...COMMON_ESBUILD_OPTIONS,
190639
+ entryPoints: [entryFile],
190640
+ absWorkingDir: entryWorkingDirectory,
190641
+ metafile: true,
190642
+ bundle: false,
190643
+ write: false,
190644
+ ...tsconfig && { tsconfig },
190645
+ define: {
190646
+ addEventListener: SERVICE_WORKER_EVENT_LISTENER,
190647
+ "globalThis.addEventListener": SERVICE_WORKER_EVENT_LISTENER,
190648
+ "self.addEventListener": SERVICE_WORKER_EVENT_LISTENER
190649
+ },
190650
+ logLevel: "silent"
190651
+ });
190652
+ const metafile = result.metafile;
190653
+ const { exports: exports$1 } = getEntryPointFromMetafile(entryFile, metafile);
190654
+ const usesServiceWorkerEventListener = result.outputFiles.some(
190655
+ ({ text }) => text.includes(SERVICE_WORKER_EVENT_LISTENER)
190656
+ );
190657
+ let guessedWorkerFormat;
190658
+ if (exports$1.length === 0) {
190659
+ guessedWorkerFormat = "service-worker";
190660
+ } else if (exports$1.includes("default")) {
190661
+ guessedWorkerFormat = "modules";
190662
+ } else if (usesServiceWorkerEventListener) {
190663
+ logger2.warn(
190664
+ `The entrypoint ${path29__namespace.default.relative(
190665
+ process.cwd(),
190666
+ entryFile
190667
+ )} has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...`
190668
+ );
190669
+ guessedWorkerFormat = "service-worker";
190670
+ } else {
190671
+ guessedWorkerFormat = "modules";
190672
+ }
190673
+ return { format: guessedWorkerFormat, exports: exports$1 };
190674
+ }
190675
+ var SERVICE_WORKER_EVENT_LISTENER;
190676
+ var init_guess_worker_format = __esm({
190677
+ "src/deployment-bundle/guess-worker-format.ts"() {
190678
+ init_import_meta_url();
190679
+ init_logger2();
190680
+ init_bundle();
190681
+ init_entry_point_from_metafile();
190682
+ SERVICE_WORKER_EVENT_LISTENER = "__WRANGLER_SERVICE_WORKER_EVENT_LISTENER__";
190683
+ __name(guessWorkerFormat, "guessWorkerFormat");
190684
+ }
190685
+ });
190508
190686
 
190509
190687
  // src/deployment-bundle/no-bundle-worker.ts
190510
190688
  async function noBundleWorker(entry, rules, outDir, pythonModulesExcludes = [], findAdditionalModulesEnabled = true) {
@@ -192095,12 +192273,48 @@ function runBuild({
192095
192273
  projectRoot,
192096
192274
  onStart,
192097
192275
  onRebuildError,
192276
+ onExportShapeChange,
192098
192277
  defineNavigatorUserAgent,
192099
192278
  checkFetch,
192100
192279
  pythonModulesExcludes
192101
192280
  }, setBundle, onErr) {
192102
192281
  let stopWatching = void 0;
192103
192282
  const entryDirectory = path29__namespace.default.dirname(entry.file);
192283
+ let currentExports = entry.exports;
192284
+ async function refreshExports() {
192285
+ if (!watch2 || entry.format !== "modules") {
192286
+ return void 0;
192287
+ }
192288
+ try {
192289
+ currentExports = (await guessWorkerFormat(entry.file, entry.projectRoot, tsconfig)).exports;
192290
+ return currentExports;
192291
+ } catch (error64) {
192292
+ if (!isBuildFailure(error64)) {
192293
+ throw error64;
192294
+ }
192295
+ return void 0;
192296
+ }
192297
+ }
192298
+ __name(refreshExports, "refreshExports");
192299
+ const exportShapePlugin = {
192300
+ name: "watch-entry-export-shape",
192301
+ setup(pluginBuild) {
192302
+ let exportShapeChanged = false;
192303
+ pluginBuild.onStart(async () => {
192304
+ exportShapeChanged = false;
192305
+ const exports$1 = await refreshExports();
192306
+ exportShapeChanged = exports$1 !== void 0 && shouldApplyMiddlewareLoaderFacade(entry) !== shouldApplyMiddlewareLoaderFacade({
192307
+ format: entry.format,
192308
+ exports: exports$1
192309
+ });
192310
+ });
192311
+ pluginBuild.onEnd(() => {
192312
+ if (exportShapeChanged) {
192313
+ onExportShapeChange?.(currentExports);
192314
+ }
192315
+ });
192316
+ }
192317
+ };
192104
192318
  const moduleCollector = noBundle ? noopModuleCollector : createModuleCollector({
192105
192319
  wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
192106
192320
  entryDirectory,
@@ -192140,6 +192354,7 @@ function runBuild({
192140
192354
  }
192141
192355
  return {
192142
192356
  ...previousBundle,
192357
+ entry: { ...previousBundle.entry, exports: currentExports },
192143
192358
  modules: dedupeModulesByName([
192144
192359
  ...moduleCollector?.modules ?? [],
192145
192360
  ...newAdditionalModules
@@ -192175,6 +192390,7 @@ function runBuild({
192175
192390
  targetConsumer,
192176
192391
  testScheduled,
192177
192392
  plugins: [
192393
+ exportShapePlugin,
192178
192394
  logBuildOutput(
192179
192395
  nodejsCompatMode,
192180
192396
  onStart,
@@ -192207,6 +192423,7 @@ function runBuild({
192207
192423
  // matching, so a regex on path segments works cross-platform.
192208
192424
  ignored: /[/\\](\.git|node_modules|\.wrangler)([/\\]|$)/
192209
192425
  }).on("change", async (_event) => {
192426
+ await refreshExports();
192210
192427
  await updateBundle();
192211
192428
  });
192212
192429
  stopWatching = /* @__PURE__ */ __name(() => watcher.close(), "stopWatching");
@@ -192239,11 +192456,14 @@ var init_use_esbuild = __esm({
192239
192456
  "src/dev/use-esbuild.ts"() {
192240
192457
  init_import_meta_url();
192241
192458
  init_esm6();
192459
+ init_apply_middleware();
192460
+ init_build_failures();
192242
192461
  init_bundle();
192243
192462
  init_bundle_type();
192244
192463
  init_dedupe_modules();
192245
192464
  init_log_build_output();
192246
192465
  init_find_additional_modules();
192466
+ init_guess_worker_format();
192247
192467
  init_module_collection();
192248
192468
  init_logger2();
192249
192469
  __name(runBuild, "runBuild");
@@ -192331,6 +192551,7 @@ var init_BundlerController = __esm({
192331
192551
  init_build_failures();
192332
192552
  init_bundle();
192333
192553
  init_bundle_type();
192554
+ init_guess_worker_format();
192334
192555
  init_module_collection();
192335
192556
  init_no_bundle_worker();
192336
192557
  init_run_custom_build();
@@ -192422,6 +192643,7 @@ var init_BundlerController = __esm({
192422
192643
  async #runCustomBuild(config2, filePath, buildAborter, runBuildCommand = true) {
192423
192644
  this.emitBundleStartEvent(config2);
192424
192645
  try {
192646
+ let exports$1 = config2.build.exports;
192425
192647
  if (runBuildCommand) {
192426
192648
  const relativeFile = path29__namespace.default.relative(config2.projectRoot, config2.entrypoint) || ".";
192427
192649
  logger2.log(`The file ${filePath} changed, restarting build...`);
@@ -192438,6 +192660,16 @@ var init_BundlerController = __esm({
192438
192660
  if (buildAborter.signal.aborted) {
192439
192661
  return;
192440
192662
  }
192663
+ if (config2.build.format === "modules") {
192664
+ exports$1 = (await guessWorkerFormat(
192665
+ config2.entrypoint,
192666
+ config2.projectRoot,
192667
+ config2.build.tsconfig
192668
+ )).exports;
192669
+ if (buildAborter.signal.aborted) {
192670
+ return;
192671
+ }
192672
+ }
192441
192673
  }
192442
192674
  assert38__default.default(this.#tmpDir);
192443
192675
  if (!config2.build?.bundle) {
@@ -192453,7 +192685,7 @@ var init_BundlerController = __esm({
192453
192685
  configPath: config2.config,
192454
192686
  format: config2.build.format,
192455
192687
  moduleRoot: config2.build.moduleRoot,
192456
- exports: config2.build.exports
192688
+ exports: exports$1
192457
192689
  };
192458
192690
  const entryDirectory = path29__namespace.default.dirname(config2.entrypoint);
192459
192691
  const moduleCollector = createModuleCollector({
@@ -192614,6 +192846,7 @@ var init_BundlerController = __esm({
192614
192846
  this.#bundleBuildAborter.abort();
192615
192847
  this.#bundleBuildAborter = new AbortController();
192616
192848
  const buildAborter = this.#bundleBuildAborter;
192849
+ let restartingForExportShape = false;
192617
192850
  if (config2.build?.custom?.command) {
192618
192851
  return;
192619
192852
  }
@@ -192678,6 +192911,25 @@ var init_BundlerController = __esm({
192678
192911
  });
192679
192912
  }
192680
192913
  }, "onRebuildError"),
192914
+ onExportShapeChange: /* @__PURE__ */ __name((exports$1) => {
192915
+ if (restartingForExportShape || buildAborter.signal.aborted || this.tearingDown) {
192916
+ return;
192917
+ }
192918
+ restartingForExportShape = true;
192919
+ buildAborter.abort();
192920
+ void this.#startBundle({
192921
+ ...config2,
192922
+ build: { ...config2.build, exports: exports$1 }
192923
+ }).catch((err) => {
192924
+ this.emitErrorEvent({
192925
+ type: "error",
192926
+ reason: "Failed to restart bundler after exports changed",
192927
+ cause: castErrorCause(err),
192928
+ source: "BundlerController",
192929
+ data: { config: config2 }
192930
+ });
192931
+ });
192932
+ }, "onExportShapeChange"),
192681
192933
  checkFetch: shouldCheckFetch(
192682
192934
  config2.compatibilityDate,
192683
192935
  config2.compatibilityFlags
@@ -202398,12 +202650,18 @@ var init_ssh = __esm({
202398
202650
  positionalArgs: ["ID"],
202399
202651
  async handler(args, { config: config2 }) {
202400
202652
  await fillOpenAPIConfiguration(config2, containersScope);
202401
- initContainersSharedContext({ logger: logger2, fetchResult: fetchResult2 });
202402
- await sshCommand({
202403
- ...args,
202404
- id: args.ID,
202405
- command: args._.slice(2).map(String)
202653
+ initContainersSharedContext({
202654
+ logger: logger2,
202655
+ fetchResult: fetchResult2
202406
202656
  });
202657
+ await sshCommand(
202658
+ {
202659
+ ...args,
202660
+ id: args.ID,
202661
+ command: args._.slice(2).map(String)
202662
+ },
202663
+ "wrangler"
202664
+ );
202407
202665
  }
202408
202666
  });
202409
202667
  }
@@ -204021,7 +204279,10 @@ var init_build = __esm({
204021
204279
  },
204022
204280
  positionalArgs: ["PATH"],
204023
204281
  async handler(args, { config: config2 }) {
204024
- initContainersSharedContext({ logger: logger2, fetchResult: fetchResult2 });
204282
+ initContainersSharedContext({
204283
+ logger: logger2,
204284
+ fetchResult: fetchResult2
204285
+ });
204025
204286
  await fillOpenAPIConfiguration(config2, containersScope);
204026
204287
  await buildCommand(args, config2);
204027
204288
  }
@@ -204049,7 +204310,10 @@ var init_build = __esm({
204049
204310
  },
204050
204311
  positionalArgs: ["TAG"],
204051
204312
  async handler(args, { config: config2 }) {
204052
- initContainersSharedContext({ logger: logger2, fetchResult: fetchResult2 });
204313
+ initContainersSharedContext({
204314
+ logger: logger2,
204315
+ fetchResult: fetchResult2
204316
+ });
204053
204317
  await fillOpenAPIConfiguration(config2, containersScope);
204054
204318
  await pushCommand(args, await getOrSelectAccountId(config2), config2);
204055
204319
  }
@@ -204401,60 +204665,6 @@ var init_config7 = __esm({
204401
204665
  }, "getNormalizedContainerOptions");
204402
204666
  }
204403
204667
  });
204404
- async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
204405
- const parsedEntryPath = path29__namespace.default.parse(entryFile);
204406
- if (parsedEntryPath.ext == ".py") {
204407
- return { format: "modules", exports: [] };
204408
- }
204409
- const result = await esbuild__namespace.build({
204410
- ...COMMON_ESBUILD_OPTIONS,
204411
- entryPoints: [entryFile],
204412
- absWorkingDir: entryWorkingDirectory,
204413
- metafile: true,
204414
- bundle: false,
204415
- write: false,
204416
- ...tsconfig && { tsconfig },
204417
- define: {
204418
- addEventListener: SERVICE_WORKER_EVENT_LISTENER,
204419
- "globalThis.addEventListener": SERVICE_WORKER_EVENT_LISTENER,
204420
- "self.addEventListener": SERVICE_WORKER_EVENT_LISTENER
204421
- },
204422
- logLevel: "silent"
204423
- });
204424
- const metafile = result.metafile;
204425
- const { exports: exports$1 } = getEntryPointFromMetafile(entryFile, metafile);
204426
- const usesServiceWorkerEventListener = result.outputFiles.some(
204427
- ({ text }) => text.includes(SERVICE_WORKER_EVENT_LISTENER)
204428
- );
204429
- let guessedWorkerFormat;
204430
- if (exports$1.length === 0) {
204431
- guessedWorkerFormat = "service-worker";
204432
- } else if (exports$1.includes("default")) {
204433
- guessedWorkerFormat = "modules";
204434
- } else if (usesServiceWorkerEventListener) {
204435
- logger2.warn(
204436
- `The entrypoint ${path29__namespace.default.relative(
204437
- process.cwd(),
204438
- entryFile
204439
- )} has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...`
204440
- );
204441
- guessedWorkerFormat = "service-worker";
204442
- } else {
204443
- guessedWorkerFormat = "modules";
204444
- }
204445
- return { format: guessedWorkerFormat, exports: exports$1 };
204446
- }
204447
- var SERVICE_WORKER_EVENT_LISTENER;
204448
- var init_guess_worker_format = __esm({
204449
- "src/deployment-bundle/guess-worker-format.ts"() {
204450
- init_import_meta_url();
204451
- init_logger2();
204452
- init_bundle();
204453
- init_entry_point_from_metafile();
204454
- SERVICE_WORKER_EVENT_LISTENER = "__WRANGLER_SERVICE_WORKER_EVENT_LISTENER__";
204455
- __name(guessWorkerFormat, "guessWorkerFormat");
204456
- }
204457
- });
204458
204668
  function resolveEntryWithScript(script) {
204459
204669
  const file3 = path29__namespace.default.resolve(script);
204460
204670
  const relativePath = path29__namespace.default.relative(process.cwd(), file3) || ".";
@@ -213410,6 +213620,19 @@ var init_https_options = __esm({
213410
213620
  __name(validateHttpsOptions, "validateHttpsOptions");
213411
213621
  }
213412
213622
  });
213623
+
213624
+ // src/utils/is-bun.ts
213625
+ function isBun() {
213626
+ return !!process.versions.bun;
213627
+ }
213628
+ var BUN_UNSUPPORTED_MESSAGE;
213629
+ var init_is_bun = __esm({
213630
+ "src/utils/is-bun.ts"() {
213631
+ init_import_meta_url();
213632
+ __name(isBun, "isBun");
213633
+ BUN_UNSUPPORTED_MESSAGE = "Wrangler can't forward requests to your Worker under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js.";
213634
+ }
213635
+ });
213413
213636
  function deepEquality(a8, b11) {
213414
213637
  return JSON.stringify(a8) === JSON.stringify(b11);
213415
213638
  }
@@ -213433,6 +213656,7 @@ var init_ProxyController = __esm({
213433
213656
  init_https_options();
213434
213657
  init_logger2();
213435
213658
  init_sourcemap2();
213659
+ init_is_bun();
213436
213660
  init_BaseController();
213437
213661
  init_events7();
213438
213662
  init_utils3();
@@ -213489,7 +213713,13 @@ var init_ProxyController = __esm({
213489
213713
  }, "PROXY_CONTROLLER")
213490
213714
  },
213491
213715
  bindings: {
213492
- PROXY_CONTROLLER_AUTH_SECRET: this.secret
213716
+ PROXY_CONTROLLER_AUTH_SECRET: this.secret,
213717
+ // Bun's `fetch()` ignores the undici `dispatcher` that carries
213718
+ // control messages here, so the ProxyWorker would queue every
213719
+ // request forever waiting for a `play` message.
213720
+ ...isBun() && {
213721
+ UNSUPPORTED_RUNTIME_MESSAGE: BUN_UNSUPPORTED_MESSAGE
213722
+ }
213493
213723
  },
213494
213724
  // no need to use file-system, so don't
213495
213725
  cacheAPI: false,
@@ -220618,7 +220848,10 @@ async function writeBuildOutput({
220618
220848
  buildResult,
220619
220849
  assetsOptions
220620
220850
  });
220621
- initContainersSharedContext({ logger: logger2, fetchResult: fetchResult2 });
220851
+ initContainersSharedContext({
220852
+ logger: logger2,
220853
+ fetchResult: fetchResult2
220854
+ });
220622
220855
  const pathToDocker = getDockerPath();
220623
220856
  await buildAndWriteContainerOutput({
220624
220857
  containers: parsedConfig.containers,
@@ -223790,7 +224023,10 @@ var init_build3 = __esm({
223790
224023
  },
223791
224024
  positionalArgs: ["PATH"],
223792
224025
  async handler(args, { config: config2 }) {
223793
- initContainersSharedContext({ logger: logger2, fetchResult: fetchResult2 });
224026
+ initContainersSharedContext({
224027
+ logger: logger2,
224028
+ fetchResult: fetchResult2
224029
+ });
223794
224030
  await fillOpenAPIConfiguration(config2, cloudchamberScope);
223795
224031
  await buildCommand(
223796
224032
  args,
@@ -223819,7 +224055,10 @@ var init_build3 = __esm({
223819
224055
  },
223820
224056
  positionalArgs: ["TAG"],
223821
224057
  async handler(args, { config: config2 }) {
223822
- initContainersSharedContext({ logger: logger2, fetchResult: fetchResult2 });
224058
+ initContainersSharedContext({
224059
+ logger: logger2,
224060
+ fetchResult: fetchResult2
224061
+ });
223823
224062
  await fillOpenAPIConfiguration(config2, cloudchamberScope);
223824
224063
  await pushCommand(
223825
224064
  args,
@@ -296215,6 +296454,22 @@ async function runDeployCommandHandler(args, {
296215
296454
  config2,
296216
296455
  buildResult,
296217
296456
  {
296457
+ deployCommand: "wrangler deploy",
296458
+ versionsDeployCommand: "wrangler versions deploy",
296459
+ d1ListCommand: "wrangler d1 list",
296460
+ d1DeleteCommand: "wrangler d1 delete <database-name>",
296461
+ queueCreateCommand: /* @__PURE__ */ __name((queueName) => `wrangler queues create ${queueName}`, "queueCreateCommand"),
296462
+ secretPutCommand: "wrangler secret put",
296463
+ workersDevConfigFieldName: "workers_dev",
296464
+ workersDevConfigAssignment: /* @__PURE__ */ __name((value) => `workers_dev = ${value}`, "workersDevConfigAssignment"),
296465
+ previewUrlsConfigFieldName: "preview_urls",
296466
+ previewUrlsConfigAssignment: /* @__PURE__ */ __name((value) => `preview_urls = ${value}`, "previewUrlsConfigAssignment"),
296467
+ configFileName: configFileName(
296468
+ config2.configPath,
296469
+ config2.userConfigPath
296470
+ ),
296471
+ observabilityTargetPercentageField: "target_instance_percentage",
296472
+ observabilityTargetCountField: "target_instance_count",
296218
296473
  syncWorkersSite
296219
296474
  }
296220
296475
  );
@@ -302526,8 +302781,9 @@ var init_create_batches = __esm({
302526
302781
  });
302527
302782
 
302528
302783
  // src/utils/download-worker-config.ts
302529
- async function downloadWorkerConfig2(workerName, environment, entrypoint, accountId) {
302784
+ async function downloadWorkerConfig2(complianceConfig, workerName, environment, entrypoint, accountId) {
302530
302785
  return downloadWorkerConfig(
302786
+ complianceConfig,
302531
302787
  workerName,
302532
302788
  environment,
302533
302789
  entrypoint,
@@ -303011,6 +303267,7 @@ async function downloadWorker(accountId, workerName) {
303011
303267
  `/accounts/${accountId}/workers/services/${workerName}/environments/${defaultEnvironment}/content/v2`
303012
303268
  );
303013
303269
  const config2 = await downloadWorkerConfig2(
303270
+ COMPLIANCE_REGION_CONFIG_UNKNOWN,
303014
303271
  workerName,
303015
303272
  defaultEnvironment,
303016
303273
  entrypoint,
@@ -348212,7 +348469,11 @@ async function deployPreviewContainers(scopedConfig, normalisedContainerConfig,
348212
348469
  }
348213
348470
  }
348214
348471
  async function applyPreviewContainers(scopedConfig, normalisedContainerConfig, deployment, accountId, localImageReferences) {
348215
- initContainersSharedContext({ logger: logger2, fetchPagedListResult: fetchPagedListResult2, fetchResult: fetchResult2 });
348472
+ initContainersSharedContext({
348473
+ logger: logger2,
348474
+ fetchPagedListResult: fetchPagedListResult2,
348475
+ fetchResult: fetchResult2
348476
+ });
348216
348477
  await fillOpenAPIConfiguration(scopedConfig, containersScope);
348217
348478
  const dockerPath = getDockerPath();
348218
348479
  const classNameToNamespaceId = /* @__PURE__ */ new Map();
@@ -348268,7 +348529,13 @@ async function applyPreviewContainers(scopedConfig, normalisedContainerConfig, d
348268
348529
  imageRef = { newTag: container.image_uri };
348269
348530
  }
348270
348531
  await apply(
348271
- { imageRef, durable_object_namespace_id: namespaceId },
348532
+ {
348533
+ imageRef,
348534
+ durable_object_namespace_id: namespaceId,
348535
+ configFileName: "Wrangler config",
348536
+ observabilityTargetPercentageField: "target_instance_percentage",
348537
+ observabilityTargetCountField: "target_instance_count"
348538
+ },
348272
348539
  container,
348273
348540
  scopedConfig,
348274
348541
  accountId
@@ -349257,6 +349524,8 @@ var init_preview3 = __esm({
349257
349524
  buildResult,
349258
349525
  assetsOptions,
349259
349526
  {
349527
+ deployCommand: "wrangler deploy",
349528
+ previewCommand: "wrangler preview",
349260
349529
  productionBindingsExpectedInPreview,
349261
349530
  getNormalizedContainerOptions,
349262
349531
  deployPreviewContainers,
@@ -349373,7 +349642,7 @@ var init_bulk3 = __esm({
349373
349642
  logger2.log(
349374
349643
  `\u2728 Success! Created Preview deployment ${deployment.id} with ${created.length} created and ${deleted.length} deleted secrets.` + (liveUrls.length > 0 ? `
349375
349644
  \u27A1\uFE0F Your Preview "${previewName}" is now live at ${liveUrls.map((url4) => source_default.bold.underline(url4)).join(", ")}` : `
349376
- ${formatNoActivePreviewUrlsMessage(config2)}`)
349645
+ ${formatNoActivePreviewUrlsMessage(config2, "wrangler deploy", "wrangler preview")}`)
349377
349646
  );
349378
349647
  }, "previewSecretBulkHandler")
349379
349648
  });
@@ -349465,7 +349734,7 @@ var init_delete18 = __esm({
349465
349734
  logger2.log(
349466
349735
  `\u2728 Success! Created Preview deployment ${deployment.id} with deleted secret ${args.key}.` + (liveUrls.length > 0 ? `
349467
349736
  \u27A1\uFE0F Your Preview "${previewName}" is now live at ${liveUrls.map((url4) => source_default.bold.underline(url4)).join(", ")}` : `
349468
- ${formatNoActivePreviewUrlsMessage(config2)}`)
349737
+ ${formatNoActivePreviewUrlsMessage(config2, "wrangler deploy", "wrangler preview")}`)
349469
349738
  );
349470
349739
  }
349471
349740
  }, "previewSecretDeleteHandler")
@@ -349670,7 +349939,7 @@ var init_put2 = __esm({
349670
349939
  logger2.log(
349671
349940
  `\u2728 Success! Created Preview deployment ${deployment.id} with secret ${args.key}.` + (liveUrls.length > 0 ? `
349672
349941
  \u27A1\uFE0F Your Preview "${previewName}" is now live at ${liveUrls.map((url4) => source_default.bold.underline(url4)).join(", ")}` : `
349673
- ${formatNoActivePreviewUrlsMessage(config2)}`)
349942
+ ${formatNoActivePreviewUrlsMessage(config2, "wrangler deploy", "wrangler preview")}`)
349674
349943
  );
349675
349944
  }, "previewSecretPutHandler")
349676
349945
  });
@@ -349725,6 +349994,9 @@ var init_http_pull = __esm({
349725
349994
  });
349726
349995
  }
349727
349996
  });
349997
+ function queueCreateCommand(queueName) {
349998
+ return `wrangler queues create ${queueName}`;
349999
+ }
349728
350000
  async function createQueue(config2, body) {
349729
350001
  const accountId = await requireAuth(config2);
349730
350002
  return fetchResult2(config2, queuesUrl2(accountId), {
@@ -349755,22 +350027,33 @@ async function listQueues2(config2, page, name2) {
349755
350027
  }
349756
350028
  async function getQueue2(config2, queueName) {
349757
350029
  const accountId = await requireAuth(config2);
349758
- return getQueue(config2, accountId, queueName);
350030
+ return getQueue(config2, accountId, queueName, queueCreateCommand);
349759
350031
  }
349760
350032
  async function getQueueById(config2, accountId, queueId) {
349761
350033
  return fetchResult2(config2, queuesUrl2(accountId, queueId), {});
349762
350034
  }
349763
350035
  async function postConsumer2(config2, queueName, body) {
349764
350036
  const accountId = await requireAuth(config2);
349765
- return postConsumer(config2, accountId, queueName, body);
350037
+ return postConsumer(
350038
+ config2,
350039
+ accountId,
350040
+ queueName,
350041
+ body,
350042
+ queueCreateCommand
350043
+ );
349766
350044
  }
349767
350045
  async function deletePullConsumer2(config2, queueName) {
349768
350046
  const accountId = await requireAuth(config2);
349769
- return deletePullConsumer(config2, accountId, queueName);
350047
+ return deletePullConsumer(
350048
+ config2,
350049
+ accountId,
350050
+ queueName,
350051
+ queueCreateCommand
350052
+ );
349770
350053
  }
349771
350054
  async function listConsumers2(config2, queueName) {
349772
350055
  const accountId = await requireAuth(config2);
349773
- return listConsumers(config2, accountId, queueName);
350056
+ return listConsumers(config2, accountId, queueName, queueCreateCommand);
349774
350057
  }
349775
350058
  async function deleteWorkerConsumer2(config2, queueName, scriptName, envName) {
349776
350059
  const accountId = await requireAuth(config2);
@@ -349779,7 +350062,8 @@ async function deleteWorkerConsumer2(config2, queueName, scriptName, envName) {
349779
350062
  accountId,
349780
350063
  queueName,
349781
350064
  scriptName,
349782
- envName
350065
+ envName,
350066
+ queueCreateCommand
349783
350067
  );
349784
350068
  }
349785
350069
  async function purgeQueue(config2, queueName) {
@@ -349880,6 +350164,7 @@ var init_client14 = __esm({
349880
350164
  }
349881
350165
  return url4;
349882
350166
  }, "queuesUrl");
350167
+ __name(queueCreateCommand, "queueCreateCommand");
349883
350168
  __name(createQueue, "createQueue");
349884
350169
  __name(updateQueue, "updateQueue");
349885
350170
  __name(deleteQueue, "deleteQueue");
@@ -355950,6 +356235,11 @@ var init_triggers = __esm({
355950
356235
  firstDeploy: false,
355951
356236
  dryRun: args.dryRun,
355952
356237
  validated: false,
356238
+ queueCreateCommand: /* @__PURE__ */ __name((queueName) => `wrangler queues create ${queueName}`, "queueCreateCommand"),
356239
+ workersDevConfigFieldName: "workers_dev",
356240
+ workersDevConfigAssignment: /* @__PURE__ */ __name((value) => `workers_dev = ${value}`, "workersDevConfigAssignment"),
356241
+ previewUrlsConfigFieldName: "preview_urls",
356242
+ previewUrlsConfigAssignment: /* @__PURE__ */ __name((value) => `preview_urls = ${value}`, "previewUrlsConfigAssignment"),
355953
356243
  ...props
355954
356244
  });
355955
356245
  }
@@ -360200,7 +360490,10 @@ var init_deploy6 = __esm({
360200
360490
  ""
360201
360491
  ).trim() ?? "All versions in a multi-version deployment must declare identical `exports`.";
360202
360492
  throw new UserError(
360203
- renderInconsistentExportsAcrossVersionsError(serverMessage),
360493
+ renderInconsistentExportsAcrossVersionsError(
360494
+ serverMessage,
360495
+ "wrangler versions deploy <new-version-id>@100%"
360496
+ ),
360204
360497
  {
360205
360498
  telemetryMessage: "versions deploy inconsistent exports across versions"
360206
360499
  }
@@ -361390,7 +361683,17 @@ var init_upload5 = __esm({
361390
361683
  const { assetUploadStats: uploadStats } = await versionsUpload(
361391
361684
  props,
361392
361685
  config2,
361393
- buildResult
361686
+ buildResult,
361687
+ {
361688
+ deployCommand: "wrangler deploy",
361689
+ versionsUploadCommand: "wrangler versions upload",
361690
+ versionsDeployCommand: "wrangler versions deploy",
361691
+ triggersDeployCommand: "wrangler triggers deploy",
361692
+ d1ListCommand: "wrangler d1 list",
361693
+ d1DeleteCommand: "wrangler d1 delete <database-name>",
361694
+ queueCreateCommand: /* @__PURE__ */ __name((queueName) => `wrangler queues create ${queueName}`, "queueCreateCommand"),
361695
+ versionsSecretPutCommand: "wrangler versions secret put"
361696
+ }
361394
361697
  );
361395
361698
  assetUploadStats = uploadStats;
361396
361699
  } finally {
@@ -367086,7 +367389,10 @@ function createCLIParser(argv) {
367086
367389
  registry2.registerNamespace("versions");
367087
367390
  registry2.define([
367088
367391
  { command: "wrangler triggers", definition: triggersNamespace },
367089
- { command: "wrangler triggers deploy", definition: triggersDeployCommand }
367392
+ {
367393
+ command: "wrangler triggers deploy",
367394
+ definition: triggersDeployCommand
367395
+ }
367090
367396
  ]);
367091
367397
  registry2.registerNamespace("triggers");
367092
367398
  registry2.define([{ command: "wrangler delete", definition: deleteCommand3 }]);
@@ -367179,7 +367485,10 @@ function createCLIParser(argv) {
367179
367485
  registry2.define([
367180
367486
  { command: "wrangler queues", definition: queuesNamespace },
367181
367487
  { command: "wrangler queues list", definition: queuesListCommand },
367182
- { command: "wrangler queues create", definition: queuesCreateCommand },
367488
+ {
367489
+ command: "wrangler queues create",
367490
+ definition: queuesCreateCommand
367491
+ },
367183
367492
  { command: "wrangler queues update", definition: queuesUpdateCommand },
367184
367493
  { command: "wrangler queues delete", definition: queuesDeleteCommand },
367185
367494
  { command: "wrangler queues info", definition: queuesInfoCommand },
@@ -369085,7 +369394,7 @@ var init_src7 = __esm({
369085
369394
 
369086
369395
  // src/utils/logPossibleBugMessage.ts
369087
369396
  async function logPossibleBugMessage() {
369088
- if (process.versions.bun) {
369397
+ if (isBun()) {
369089
369398
  logger2.warn(
369090
369399
  `Wrangler does not support the Bun runtime. Please try this command again using Node.js via \`npm\` or \`pnpm\`. Alternatively, make sure you're not passing the \`--bun\` flag when running \`bun run wrangler ...\``
369091
369400
  );
@@ -369108,6 +369417,7 @@ var init_logPossibleBugMessage = __esm({
369108
369417
  init_logger2();
369109
369418
  init_update_check2();
369110
369419
  init_constants6();
369420
+ init_is_bun();
369111
369421
  __name(logPossibleBugMessage, "logPossibleBugMessage");
369112
369422
  }
369113
369423
  });
@@ -370697,6 +371007,7 @@ var init_LocalRuntimeController = __esm({
370697
371007
  async prepareContainerImages(data, previousState) {
370698
371008
  const nextState = {
370699
371009
  dockerPath: data.config.dev.dockerPath ?? getDockerPath(),
371010
+ configFileName: configFileName(data.config.config),
370700
371011
  complianceRegion: data.config.complianceRegion,
370701
371012
  hasContainers: Boolean(
370702
371013
  data.config.dev.enableContainers && data.config.containerDevPlan !== void 0
@@ -370726,7 +371037,9 @@ var init_LocalRuntimeController = __esm({
370726
371037
  logger: logger2,
370727
371038
  complianceConfig: {
370728
371039
  compliance_region: nextState.complianceRegion
370729
- }
371040
+ },
371041
+ configFileName: nextState.configFileName,
371042
+ registryConfigureCommand: "wrangler containers registries configure"
370730
371043
  });
370731
371044
  if (this.containerBeingBuilt) {
370732
371045
  this.containerBeingBuilt.abortRequested = false;
@@ -376000,6 +376313,7 @@ var init_introspection = __esm({
376000
376313
  static {
376001
376314
  __name(this, "WorkflowInstanceIntrospectorHandle");
376002
376315
  }
376316
+ #disposed = false;
376003
376317
  #instanceModifier;
376004
376318
  #instanceModifierPromise;
376005
376319
  async modify(fn2) {
@@ -376038,7 +376352,16 @@ var init_introspection = __esm({
376038
376352
  }
376039
376353
  /** Keep this bound; explicit resource management may call the disposer unbound. */
376040
376354
  dispose = /* @__PURE__ */ __name(async () => {
376041
- await this.workflow.unsafeAbort(this.instanceId, "Instance dispose");
376355
+ if (this.#disposed) {
376356
+ return;
376357
+ }
376358
+ this.#disposed = true;
376359
+ try {
376360
+ const modifier = this.#instanceModifier ?? await this.#instanceModifierPromise?.catch(() => void 0);
376361
+ modifier?.[Symbol.dispose]?.();
376362
+ } finally {
376363
+ await this.workflow.unsafeAbort(this.instanceId, "Instance dispose");
376364
+ }
376042
376365
  }, "dispose");
376043
376366
  async [Symbol.asyncDispose]() {
376044
376367
  await this.dispose();
@@ -376468,6 +376791,12 @@ function createTestHarness(options) {
376468
376791
  }
376469
376792
  __name(getInputUrl, "getInputUrl");
376470
376793
  async function dispatchFetch(miniflare$1, input2, init4, worker, event = "fetch") {
376794
+ if (isBun()) {
376795
+ throw new UserError(
376796
+ `${BUN_UNSUPPORTED_MESSAGE} \`server.getWorker().getEnv()\` and \`getExport()\` still work under Bun.`,
376797
+ { telemetryMessage: "test harness dispatch under bun" }
376798
+ );
376799
+ }
376471
376800
  let resolvedInput = input2;
376472
376801
  if (typeof input2 === "string" && !URL.canParse(input2)) {
376473
376802
  const session = await resolveSession();
@@ -376855,6 +377184,7 @@ var init_test_harness = __esm({
376855
377184
  init_class_names_sqlite();
376856
377185
  init_logger2();
376857
377186
  init_user3();
377187
+ init_is_bun();
376858
377188
  init_DevEnv();
376859
377189
  init_MultiworkerRuntimeController();
376860
377190
  init_NoOpProxyController();