wrangler 4.40.3 → 4.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27379,7 +27379,7 @@ async function prepareContainerImagesForDev(args) {
27379
27379
  if (!isCloudflareRegistryLink(options.image_uri)) {
27380
27380
  throw new UserError(
27381
27381
  `Image "${options.image_uri}" is a registry link but does not point to the Cloudflare container registry.
27382
- To use an existing image from another repository, see https://developers.cloudflare.com/containers/image-management/#using-existing-images`
27382
+ To use an existing image from another repository, see https://developers.cloudflare.com/containers/platform-details/image-management/#using-pre-built-container-images`
27383
27383
  );
27384
27384
  }
27385
27385
  const pull = await pullImage(dockerPath, options);
@@ -27414,6 +27414,19 @@ function resolveImageName(accountId, image) {
27414
27414
  if (url4.pathname.startsWith(`/${accountId}`)) {
27415
27415
  return image;
27416
27416
  }
27417
+ const accountIdPattern = /^\/([a-f0-9]{32})\//;
27418
+ const match2 = accountIdPattern.exec(url4.pathname);
27419
+ if (match2) {
27420
+ const foundAccountId = match2[1];
27421
+ if (foundAccountId !== accountId) {
27422
+ throw new Error(
27423
+ `Image "${image}" does not belong to your account
27424
+ Image appears to belong to account: "${foundAccountId}"
27425
+ Current account: "${accountId}"`
27426
+ );
27427
+ }
27428
+ return image;
27429
+ }
27417
27430
  return `${url4.hostname}/${accountId}${url4.pathname}`;
27418
27431
  }
27419
27432
  var init_images = __esm({
@@ -33628,7 +33641,7 @@ function getComplianceRegionSubdomain(complianceConfig) {
33628
33641
  function getStagingSubdomain() {
33629
33642
  return getCloudflareApiEnvironmentFromEnv() === "staging" ? ".staging" : "";
33630
33643
  }
33631
- var import_node_path2, getC3CommandFromEnv, getWranglerSendMetricsFromEnv, getCloudflareApiEnvironmentFromEnv, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareComplianceRegionFromEnv, getCloudflareComplianceRegion, getCloudflareApiBaseUrlFromEnv, getCloudflareApiBaseUrl, getSanitizeLogs, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCIGeneratePreviewAlias, getWorkersCIBranchName, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getRegistryPath, getD1ExtraLocationChoices, getDockerPath, getCloudflareLoadDevVarsFromDotEnv, getCloudflareIncludeProcessEnvFromEnv, getTraceHeader, getDisableConfigWatching;
33644
+ var import_node_path2, getC3CommandFromEnv, getWranglerSendMetricsFromEnv, getCloudflareApiEnvironmentFromEnv, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareComplianceRegionFromEnv, getCloudflareComplianceRegion, getCloudflareApiBaseUrlFromEnv, getCloudflareApiBaseUrl, getSanitizeLogs, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCIGeneratePreviewAlias, getWorkersCIBranchName, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getRegistryPath, getD1ExtraLocationChoices, getDockerPath, getSubdomainMixedStateCheckDisabled, getCloudflareLoadDevVarsFromDotEnv, getCloudflareIncludeProcessEnvFromEnv, getTraceHeader, getDisableConfigWatching;
33632
33645
  var init_misc_variables = __esm({
33633
33646
  "src/environment-variables/misc-variables.ts"() {
33634
33647
  init_import_meta_url();
@@ -33727,6 +33740,10 @@ var init_misc_variables = __esm({
33727
33740
  return "docker";
33728
33741
  }
33729
33742
  });
33743
+ getSubdomainMixedStateCheckDisabled = getBooleanEnvironmentVariableFactory({
33744
+ variableName: "WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK",
33745
+ defaultValue: false
33746
+ });
33730
33747
  getCloudflareLoadDevVarsFromDotEnv = getBooleanEnvironmentVariableFactory({
33731
33748
  variableName: "CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV",
33732
33749
  defaultValue: true
@@ -34117,6 +34134,7 @@ var init_logger = __esm({
34117
34134
  import_esbuild = require("esbuild");
34118
34135
  init_factory();
34119
34136
  init_misc_variables();
34137
+ init_parse();
34120
34138
  init_log_file();
34121
34139
  LOGGER_LEVELS = {
34122
34140
  none: -1,
@@ -34175,7 +34193,13 @@ var init_logger = __esm({
34175
34193
  info = /* @__PURE__ */ __name((...args) => this.doLog("info", args), "info");
34176
34194
  log = /* @__PURE__ */ __name((...args) => this.doLog("log", args), "log");
34177
34195
  warn = /* @__PURE__ */ __name((...args) => this.doLog("warn", args), "warn");
34178
- error = /* @__PURE__ */ __name((...args) => this.doLog("error", args), "error");
34196
+ error(...args) {
34197
+ if (args.length === 1 && args[0] instanceof ParseError) {
34198
+ this.doLog("error", formatMessage(args[0]));
34199
+ } else {
34200
+ this.doLog("error", args);
34201
+ }
34202
+ }
34179
34203
  table(data, options) {
34180
34204
  const derivedHead = data.length === 0 ? [] : Object.keys(data[0]);
34181
34205
  const wordWrap = options?.wordWrap ?? false;
@@ -34221,7 +34245,7 @@ var init_logger = __esm({
34221
34245
  }
34222
34246
  }
34223
34247
  doLog(messageLevel, args) {
34224
- const message = this.formatMessage(messageLevel, (0, import_node_util.format)(...args));
34248
+ const message = Array.isArray(args) ? this.formatMessage(messageLevel, (0, import_node_util.format)(...args)) : args;
34225
34249
  const inUnitTests = typeof vitest !== "undefined";
34226
34250
  if (!inUnitTests) {
34227
34251
  void appendToDebugLogFile(messageLevel, message);
@@ -93871,7 +93895,7 @@ var name, version;
93871
93895
  var init_package = __esm({
93872
93896
  "package.json"() {
93873
93897
  name = "wrangler";
93874
- version = "4.40.3";
93898
+ version = "4.41.0";
93875
93899
  }
93876
93900
  });
93877
93901
 
@@ -100531,7 +100555,13 @@ var init_check_macos_version = __esm({
100531
100555
  });
100532
100556
 
100533
100557
  // ../cli/index.ts
100534
- var import_process, shapes, status, space, logRaw, log, newline, format6, updateStatus, startSection, endSection, cancel, warn, success, stripAnsi3, linkRegex, crash, error;
100558
+ function setLogLevel(level) {
100559
+ currentLogLevel = level;
100560
+ }
100561
+ function getLogLevel() {
100562
+ return currentLogLevel;
100563
+ }
100564
+ var import_process, shapes, status, space, LOGGER_LEVELS2, currentLogLevel, logRaw, log, newline, format6, updateStatus, startSection, endSection, cancel, warn, success, stripAnsi3, linkRegex, crash, error;
100535
100565
  var init_cli = __esm({
100536
100566
  "../cli/index.ts"() {
100537
100567
  init_import_meta_url();
@@ -100570,9 +100600,23 @@ var init_cli = __esm({
100570
100600
  space = /* @__PURE__ */ __name((n7 = 1) => {
100571
100601
  return hidden("\u200A".repeat(n7));
100572
100602
  }, "space");
100603
+ LOGGER_LEVELS2 = {
100604
+ none: -1,
100605
+ error: 0,
100606
+ warn: 1,
100607
+ info: 2,
100608
+ log: 3,
100609
+ debug: 4
100610
+ };
100611
+ currentLogLevel = "log";
100612
+ __name(setLogLevel, "setLogLevel");
100613
+ __name(getLogLevel, "getLogLevel");
100573
100614
  logRaw = /* @__PURE__ */ __name((msg) => {
100574
- stdout.write(`${msg}
100615
+ const currentLevel = getLogLevel();
100616
+ if (LOGGER_LEVELS2[currentLevel] >= LOGGER_LEVELS2.log) {
100617
+ stdout.write(`${msg}
100575
100618
  `);
100619
+ }
100576
100620
  }, "logRaw");
100577
100621
  log = /* @__PURE__ */ __name((msg) => {
100578
100622
  const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}${ln.length > 0 ? " " + white(ln) : ""}`);
@@ -100691,7 +100735,8 @@ var init_cli = __esm({
100691
100735
  (0, import_process.exit)(1);
100692
100736
  }, "crash");
100693
100737
  error = /* @__PURE__ */ __name((msg, extra, corner = shapes.corners.bl) => {
100694
- if (msg) {
100738
+ const currentLevel = getLogLevel();
100739
+ if (msg && LOGGER_LEVELS2[currentLevel] >= LOGGER_LEVELS2.error) {
100695
100740
  stderr.write(
100696
100741
  `${gray(corner)} ${status.error} ${dim(msg)}
100697
100742
  ${extra ? space() + extra + "\n" : ""}`
@@ -106289,8 +106334,18 @@ function validateContainerApp(envName, topLevelName, configPath) {
106289
106334
  "instance_type",
106290
106335
  containerAppOptional.instance_type,
106291
106336
  "string",
106292
- ["dev", "basic", "standard"]
106337
+ ALLOWED_INSTANCE_TYPES
106293
106338
  );
106339
+ if (containerAppOptional.instance_type === "dev") {
106340
+ diagnostics.warnings.push(
106341
+ `The "dev" instance_type has been renamed to "lite" and will be removed in a subsequent version. Please update your configuration to use "lite" instead.`
106342
+ );
106343
+ }
106344
+ if (containerAppOptional.instance_type === "standard") {
106345
+ diagnostics.warnings.push(
106346
+ `The "standard" instance_type has been renamed to "standard-1" and will be removed in a subsequent version. Please update your configuration to use "standard-1" instead.`
106347
+ );
106348
+ }
106294
106349
  } else if (validateOptionalProperty(
106295
106350
  diagnostics,
106296
106351
  field,
@@ -106464,7 +106519,7 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
106464
106519
  }
106465
106520
  return true;
106466
106521
  }
106467
- var import_node_assert, import_node_path9, ENGLISH, isRoute, isRouteArray, validateTailConsumers, validateAndNormalizeRules, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateHelloWorldBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validateMigrations, validateObservability;
106522
+ var import_node_assert, import_node_path9, ENGLISH, ALLOWED_INSTANCE_TYPES, isRoute, isRouteArray, validateTailConsumers, validateAndNormalizeRules, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateHelloWorldBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validateMigrations, validateObservability;
106468
106523
  var init_validation = __esm({
106469
106524
  "src/config/validation.ts"() {
106470
106525
  init_import_meta_url();
@@ -106483,6 +106538,18 @@ var init_validation = __esm({
106483
106538
  init_validation_helpers();
106484
106539
  init_config5();
106485
106540
  ENGLISH = new Intl.ListFormat("en-US");
106541
+ ALLOWED_INSTANCE_TYPES = [
106542
+ "lite",
106543
+ "basic",
106544
+ "standard-1",
106545
+ "standard-2",
106546
+ "standard-3",
106547
+ "standard-4",
106548
+ "dev",
106549
+ // legacy
106550
+ "standard"
106551
+ // legacy
106552
+ ];
106486
106553
  __name(isPagesConfig, "isPagesConfig");
106487
106554
  __name(normalizeAndValidateConfig, "normalizeAndValidateConfig");
106488
106555
  __name(applyPythonConfig, "applyPythonConfig");
@@ -107266,9 +107333,9 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
107266
107333
  });
107267
107334
  });
107268
107335
  if ("instance_type" in value && value.instance_type !== void 0) {
107269
- if (typeof value.instance_type !== "string" || !["dev", "basic", "standard"].includes(value.instance_type)) {
107336
+ if (typeof value.instance_type !== "string" || !ALLOWED_INSTANCE_TYPES.includes(value.instance_type)) {
107270
107337
  diagnostics.errors.push(
107271
- `"instance_type" should be one of 'dev', 'basic', or 'standard', but got ${value.instance_type}`
107338
+ `"instance_type" should be one of 'lite', 'basic', 'standard-1', 'standard-2', 'standard-3', or 'standard-4', but got ${value.instance_type}`
107272
107339
  );
107273
107340
  }
107274
107341
  if ("memory" in value && value.memory !== void 0 || "vcpu" in value && value.vcpu !== void 0) {
@@ -108616,37 +108683,46 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
108616
108683
  return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
108617
108684
  }
108618
108685
  }
108619
- async function updateConfigFile(snippet, configPath, env6, offerToUpdate = true) {
108620
- const resource = Object.keys(snippet())[0];
108686
+ async function updateConfigFile(resource, snippet, configPath, env6, defaults2) {
108621
108687
  const envString = env6 ? ` in the "${env6}" environment` : "";
108622
108688
  logger.log(
108623
108689
  `To access your new ${friendlyBindingNames[resource]} in your Worker, add the following snippet to your configuration file${envString}:`
108624
108690
  );
108625
- logger.log(formatConfigSnippet(snippet(), configPath));
108626
- if (configPath && offerToUpdate && configFormat(configPath) === "jsonc") {
108627
- const autoAdd = await select(
108628
- "Would you like Wrangler to add it on your behalf?",
108691
+ logger.log(
108692
+ formatConfigSnippet(
108629
108693
  {
108630
- choices: [
108631
- { title: "Yes", value: "yes" },
108694
+ [resource]: [
108632
108695
  {
108633
- title: "Yes, but let me choose the binding name",
108634
- value: "yes-but"
108635
- },
108636
- { title: "No", value: "no" }
108637
- ],
108638
- defaultOption: 0,
108639
- fallbackOption: 2
108640
- }
108641
- );
108642
- let bindingName;
108643
- if (autoAdd === "yes-but") {
108644
- bindingName = await prompt("What binding name would you like to use?");
108645
- }
108646
- if (autoAdd !== "no") {
108696
+ ...snippet(defaults2?.binding),
108697
+ ...defaults2?.useRemote === true ? { remote: true } : {}
108698
+ }
108699
+ ]
108700
+ },
108701
+ configPath
108702
+ )
108703
+ );
108704
+ if (configPath && configFormat(configPath) === "jsonc") {
108705
+ const writeToConfig = defaults2?.binding ?? defaults2?.updateConfig ?? await confirm("Would you like Wrangler to add it on your behalf?", {
108706
+ defaultValue: true,
108707
+ // We don't want to automatically write to config in CI
108708
+ fallbackValue: false
108709
+ });
108710
+ if (writeToConfig) {
108711
+ const bindingName = defaults2?.binding ?? await prompt("What binding name would you like to use?", {
108712
+ defaultValue: snippet().binding
108713
+ });
108714
+ const useRemote = defaults2?.useRemote ?? (defaults2?.binding || defaults2?.updateConfig ? false : await confirm(
108715
+ "For local dev, do you want to connect to the remote resource instead of a local resource?",
108716
+ { defaultValue: false }
108717
+ ));
108718
+ const configFilePatch = {
108719
+ [resource]: [
108720
+ { ...snippet(bindingName), ...useRemote ? { remote: true } : {} }
108721
+ ]
108722
+ };
108647
108723
  experimental_patchConfig(
108648
108724
  configPath,
108649
- env6 ? { env: { [env6]: snippet(bindingName) } } : snippet(bindingName),
108725
+ env6 ? { env: { [env6]: configFilePatch } } : configFilePatch,
108650
108726
  true
108651
108727
  );
108652
108728
  }
@@ -108720,7 +108796,7 @@ function readPagesConfig(args, options = {}) {
108720
108796
  }
108721
108797
  return config;
108722
108798
  }
108723
- var import_toml3, parseRawConfigFile, experimental_readRawConfig;
108799
+ var import_toml3, sharedResourceCreationArgs, parseRawConfigFile, experimental_readRawConfig;
108724
108800
  var init_config5 = __esm({
108725
108801
  "src/config/index.ts"() {
108726
108802
  init_import_meta_url();
@@ -108738,6 +108814,20 @@ var init_config5 = __esm({
108738
108814
  __name(configFormat, "configFormat");
108739
108815
  __name(configFileName, "configFileName");
108740
108816
  __name(formatConfigSnippet, "formatConfigSnippet");
108817
+ sharedResourceCreationArgs = {
108818
+ "use-remote": {
108819
+ type: "boolean",
108820
+ description: "Use a remote binding when adding the newly created resource to your config"
108821
+ },
108822
+ "update-config": {
108823
+ type: "boolean",
108824
+ description: "Automatically update your config file with the newly added resource"
108825
+ },
108826
+ binding: {
108827
+ type: "string",
108828
+ description: "The binding name of this resource in your Worker"
108829
+ }
108830
+ };
108741
108831
  __name(updateConfigFile, "updateConfigFile");
108742
108832
  __name(readConfig, "readConfig");
108743
108833
  __name(readPagesConfig, "readPagesConfig");
@@ -110372,11 +110462,19 @@ async function fetchInternal(complianceConfig, resource, init4 = {}, queryParams
110372
110462
  logger.debugWithSanitization("RESPONSE:", jsonText);
110373
110463
  logger.debug("-- END CF API RESPONSE");
110374
110464
  if (!jsonText && (response.status === 204 || response.status === 205)) {
110375
- const emptyBody = `{"result": {}, "success": true, "errors": [], "messages": []}`;
110376
- return parseJSON(emptyBody);
110465
+ return {
110466
+ response: {
110467
+ result: {},
110468
+ success: true,
110469
+ errors: [],
110470
+ messages: []
110471
+ },
110472
+ status: response.status
110473
+ };
110377
110474
  }
110378
110475
  try {
110379
- return parseJSON(jsonText);
110476
+ const json = parseJSON(jsonText);
110477
+ return { response: json, status: response.status };
110380
110478
  } catch {
110381
110479
  throw new APIError({
110382
110480
  text: "Received a malformed response from the API",
@@ -110542,22 +110640,15 @@ var init_internal = __esm({
110542
110640
 
110543
110641
  // src/cfetch/index.ts
110544
110642
  async function fetchResult(complianceConfig, resource, init4 = {}, queryParams, abortSignal, apiToken) {
110545
- const json = await fetchInternal(
110546
- complianceConfig,
110547
- resource,
110548
- init4,
110549
- queryParams,
110550
- abortSignal,
110551
- apiToken
110552
- );
110643
+ const { response: json, status: status2 } = await fetchInternal(complianceConfig, resource, init4, queryParams, abortSignal, apiToken);
110553
110644
  if (json.success) {
110554
110645
  return json.result;
110555
110646
  } else {
110556
- throwFetchError(resource, json);
110647
+ throwFetchError(resource, json, status2);
110557
110648
  }
110558
110649
  }
110559
110650
  async function fetchGraphqlResult(complianceConfig, init4 = {}, abortSignal) {
110560
- const json = await fetchInternal(
110651
+ const { response: json } = await fetchInternal(
110561
110652
  complianceConfig,
110562
110653
  "/graphql",
110563
110654
  { ...init4, method: "POST" },
@@ -110580,12 +110671,7 @@ async function fetchListResult(complianceConfig, resource, init4 = {}, queryPara
110580
110671
  queryParams = new import_node_url5.URLSearchParams(queryParams);
110581
110672
  queryParams.set("cursor", cursor);
110582
110673
  }
110583
- const json = await fetchInternal(
110584
- complianceConfig,
110585
- resource,
110586
- init4,
110587
- queryParams
110588
- );
110674
+ const { response: json, status: status2 } = await fetchInternal(complianceConfig, resource, init4, queryParams);
110589
110675
  if (json.success) {
110590
110676
  results.push(...json.result);
110591
110677
  if (hasCursor(json.result_info)) {
@@ -110594,7 +110680,7 @@ async function fetchListResult(complianceConfig, resource, init4 = {}, queryPara
110594
110680
  getMoreResults = false;
110595
110681
  }
110596
110682
  } else {
110597
- throwFetchError(resource, json);
110683
+ throwFetchError(resource, json, status2);
110598
110684
  }
110599
110685
  }
110600
110686
  return results;
@@ -110606,12 +110692,7 @@ async function fetchPagedListResult(complianceConfig, resource, init4 = {}, quer
110606
110692
  while (getMoreResults) {
110607
110693
  queryParams = new import_node_url5.URLSearchParams(queryParams);
110608
110694
  queryParams.set("page", String(page));
110609
- const json = await fetchInternal(
110610
- complianceConfig,
110611
- resource,
110612
- init4,
110613
- queryParams
110614
- );
110695
+ const { response: json, status: status2 } = await fetchInternal(complianceConfig, resource, init4, queryParams);
110615
110696
  if (json.success) {
110616
110697
  results.push(...json.result);
110617
110698
  if (hasMorePages(json.result_info)) {
@@ -110620,7 +110701,7 @@ async function fetchPagedListResult(complianceConfig, resource, init4 = {}, quer
110620
110701
  getMoreResults = false;
110621
110702
  }
110622
110703
  } else {
110623
- throwFetchError(resource, json);
110704
+ throwFetchError(resource, json, status2);
110624
110705
  }
110625
110706
  }
110626
110707
  return results;
@@ -110631,7 +110712,7 @@ function hasMorePages(result_info) {
110631
110712
  const total = result_info?.total_count;
110632
110713
  return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
110633
110714
  }
110634
- function throwFetchError(resource, response) {
110715
+ function throwFetchError(resource, response, status2) {
110635
110716
  if (typeof vitest !== "undefined" && !("errors" in response)) {
110636
110717
  throw response;
110637
110718
  }
@@ -110643,7 +110724,8 @@ function throwFetchError(resource, response) {
110643
110724
  notes: [
110644
110725
  ...response.errors.map((err) => ({ text: renderError(err) })),
110645
110726
  ...response.messages?.map((text) => ({ text })) ?? []
110646
- ]
110727
+ ],
110728
+ status: status2
110647
110729
  });
110648
110730
  const code = response.errors[0]?.code;
110649
110731
  if (code) {
@@ -127051,9 +127133,24 @@ var init_dist2 = __esm({
127051
127133
  // src/cloudchamber/instance-type/instance-type.ts
127052
127134
  async function promptForInstanceType(allowSkipping) {
127053
127135
  let options = [
127054
- { label: "dev: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "dev" },
127136
+ { label: "lite: 1/16 vCPU, 256 MiB memory, 2 GB disk", value: "lite" },
127055
127137
  { label: "basic: 1/4 vCPU, 1 GiB memory, 4 GB disk", value: "basic" },
127056
- { label: "standard: 1/2 vCPU, 4 GiB memory, 4 GB disk", value: "standard" }
127138
+ {
127139
+ label: "standard-1: 1/2 vCPU, 4 GiB memory, 8 GB disk",
127140
+ value: "standard-1"
127141
+ },
127142
+ {
127143
+ label: "standard-2: 1/2 vCPU, 4 GiB memory, 12 GB disk",
127144
+ value: "standard-2"
127145
+ },
127146
+ {
127147
+ label: "standard-3: 1/2 vCPU, 4 GiB memory, 16 GB disk",
127148
+ value: "standard-3"
127149
+ },
127150
+ {
127151
+ label: "standard-4: 4 vCPU, 4 GiB memory, 20 GB disk",
127152
+ value: "standard-4"
127153
+ }
127057
127154
  ];
127058
127155
  if (allowSkipping) {
127059
127156
  options = [{ label: "Do not set", value: "skip" }].concat(options);
@@ -127066,14 +127163,10 @@ async function promptForInstanceType(allowSkipping) {
127066
127163
  type: "select",
127067
127164
  options
127068
127165
  });
127069
- switch (action) {
127070
- case "dev":
127071
- case "basic":
127072
- case "standard":
127073
- return action;
127074
- default:
127075
- return void 0;
127166
+ if (instanceTypeNames.includes(action)) {
127167
+ return action;
127076
127168
  }
127169
+ return void 0;
127077
127170
  }
127078
127171
  function checkInstanceType(args, config) {
127079
127172
  const instance_type = args.instanceType ?? config.instance_type;
@@ -127085,15 +127178,12 @@ function checkInstanceType(args, config) {
127085
127178
  `Field "instance_type" is mutually exclusive with "memory" and "vcpu". These fields cannot be set together.`
127086
127179
  );
127087
127180
  }
127088
- switch (instance_type) {
127089
- case "dev":
127090
- case "basic":
127091
- case "standard":
127092
- return instance_type;
127093
- default:
127094
- throw new UserError2(
127095
- `"instance_type" field value is expected to be one of "dev", "basic", or "standard", but got "${instance_type}"`
127096
- );
127181
+ if (instanceTypeNames.includes(instance_type)) {
127182
+ return instance_type;
127183
+ } else {
127184
+ throw new UserError2(
127185
+ `"instance_type" field value is expected to be one of 'lite', 'basic', 'standard-1', 'standard-2', 'standard-3', 'standard-4', but got "${instance_type}"`
127186
+ );
127097
127187
  }
127098
127188
  }
127099
127189
  function getInstanceTypeUsage(instanceType) {
@@ -127120,14 +127210,19 @@ function cleanForInstanceType(app) {
127120
127210
  delete app.configuration.vcpu;
127121
127211
  return app;
127122
127212
  }
127123
- var instanceTypes;
127213
+ var instanceTypes, instanceTypeNames;
127124
127214
  var init_instance_type = __esm({
127125
127215
  "src/cloudchamber/instance-type/instance-type.ts"() {
127126
127216
  init_import_meta_url();
127127
127217
  init_interactive();
127128
127218
  init_errors();
127129
127219
  instanceTypes = {
127130
- // dev is the default instance type when REQUIRE_INSTANCE_TYPE is set
127220
+ // lite is the default instance type when REQUIRE_INSTANCE_TYPE is set
127221
+ lite: {
127222
+ vcpu: 0.0625,
127223
+ memory_mib: 256,
127224
+ disk_mb: 2e3
127225
+ },
127131
127226
  dev: {
127132
127227
  vcpu: 0.0625,
127133
127228
  memory_mib: 256,
@@ -127141,9 +127236,30 @@ var init_instance_type = __esm({
127141
127236
  standard: {
127142
127237
  vcpu: 0.5,
127143
127238
  memory_mib: 4096,
127144
- disk_mb: 4e3
127239
+ disk_mb: 8e3
127240
+ },
127241
+ "standard-1": {
127242
+ vcpu: 0.5,
127243
+ memory_mib: 4096,
127244
+ disk_mb: 8e3
127245
+ },
127246
+ "standard-2": {
127247
+ vcpu: 1,
127248
+ memory_mib: 6144,
127249
+ disk_mb: 12e3
127250
+ },
127251
+ "standard-3": {
127252
+ vcpu: 2,
127253
+ memory_mib: 8192,
127254
+ disk_mb: 16e3
127255
+ },
127256
+ "standard-4": {
127257
+ vcpu: 4,
127258
+ memory_mib: 12288,
127259
+ disk_mb: 2e4
127145
127260
  }
127146
127261
  };
127262
+ instanceTypeNames = Object.keys(instanceTypes);
127147
127263
  __name(promptForInstanceType, "promptForInstanceType");
127148
127264
  __name(checkInstanceType, "checkInstanceType");
127149
127265
  __name(getInstanceTypeUsage, "getInstanceTypeUsage");
@@ -137551,7 +137667,7 @@ var init_config6 = __esm({
137551
137667
  const shared = {
137552
137668
  name: container.name,
137553
137669
  class_name: container.class_name,
137554
- max_instances: container.max_instances ?? 1,
137670
+ max_instances: container.max_instances ?? 20,
137555
137671
  scheduling_policy: container.scheduling_policy ?? "default" /* DEFAULT */,
137556
137672
  constraints: {
137557
137673
  // if the tier is -1, then we allow all tiers
@@ -137584,7 +137700,7 @@ var init_config6 = __esm({
137584
137700
  };
137585
137701
  } else if (typeof container.instance_type === "string" || container.instance_type === void 0) {
137586
137702
  instanceTypeOrLimits = {
137587
- instance_type: container.instance_type ?? "dev" /* DEV */
137703
+ instance_type: container.instance_type ?? "lite" /* LITE */
137588
137704
  };
137589
137705
  } else {
137590
137706
  instanceTypeOrLimits = {
@@ -137742,10 +137858,11 @@ var init_create = __esm({
137742
137858
  enam: Eastern North America
137743
137859
 
137744
137860
  `
137745
- }
137861
+ },
137862
+ ...sharedResourceCreationArgs
137746
137863
  },
137747
137864
  positionalArgs: ["name"],
137748
- async handler({ name: name2, location, env: env6 }, { config }) {
137865
+ async handler({ name: name2, location, env: env6, ...args }, { config }) {
137749
137866
  const accountId = await requireAuth(config);
137750
137867
  const db = await createD1Database(config, accountId, name2, location);
137751
137868
  logger.log(
@@ -137753,17 +137870,15 @@ var init_create = __esm({
137753
137870
  );
137754
137871
  logger.log("Created your new D1 database.\n");
137755
137872
  await updateConfigFile(
137873
+ "d1_databases",
137756
137874
  (bindingName) => ({
137757
- d1_databases: [
137758
- {
137759
- binding: getValidBindingName(bindingName ?? db.name, "DB"),
137760
- database_name: db.name,
137761
- database_id: db.uuid
137762
- }
137763
- ]
137875
+ binding: getValidBindingName(bindingName ?? db.name, "DB"),
137876
+ database_name: db.name,
137877
+ database_id: db.uuid
137764
137878
  }),
137765
137879
  config.configPath,
137766
- env6
137880
+ env6,
137881
+ args
137767
137882
  );
137768
137883
  }
137769
137884
  });
@@ -140708,7 +140823,7 @@ async function retryOnAPIFailure(action, backoff = 0, attempts = MAX_ATTEMPTS) {
140708
140823
  } else if (!(err instanceof TypeError)) {
140709
140824
  throw err;
140710
140825
  }
140711
- logger.info(source_default.dim(`Retrying API call after error...`));
140826
+ logger.debug(source_default.dim(`Retrying API call after error...`));
140712
140827
  logger.debug(err);
140713
140828
  if (attempts <= 1) {
140714
140829
  throw err;
@@ -141119,10 +141234,71 @@ function getSubdomainValues(config_workers_dev, config_preview_urls, routes) {
141119
141234
  preview_urls: config_preview_urls ?? defaultPreviewUrls
141120
141235
  };
141121
141236
  }
141237
+ async function validateSubdomainMixedState(props, accountId, scriptName, configFlags, desired, remote, firstDeploy) {
141238
+ const { config } = props;
141239
+ const changed = desired.workers_dev !== remote.workers_dev || desired.preview_urls !== remote.preview_urls;
141240
+ if (!changed) {
141241
+ return desired;
141242
+ }
141243
+ if (getSubdomainMixedStateCheckDisabled()) {
141244
+ return desired;
141245
+ }
141246
+ if (isNonInteractiveOrCI()) {
141247
+ return desired;
141248
+ }
141249
+ if (firstDeploy) {
141250
+ return desired;
141251
+ }
141252
+ if (desired.workers_dev === desired.preview_urls) {
141253
+ return desired;
141254
+ }
141255
+ const userSubdomain = await getWorkersDevSubdomain(
141256
+ config,
141257
+ accountId,
141258
+ config.configPath
141259
+ );
141260
+ const previewUrl = `https://<VERSION_PREFIX>-${scriptName}.${userSubdomain}`;
141261
+ if (!desired.workers_dev && desired.preview_urls) {
141262
+ logger.warn(
141263
+ [
141264
+ "You are disabling the 'workers.dev' subdomain for this Worker, but Preview URLs are still enabled.",
141265
+ "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
141266
+ ` ${previewUrl}`,
141267
+ "",
141268
+ "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 Wrangler config file."
141269
+ ].join("\n")
141270
+ );
141271
+ }
141272
+ if (desired.workers_dev && !desired.preview_urls) {
141273
+ logger.warn(
141274
+ [
141275
+ "You are enabling the 'workers.dev' subdomain for this Worker, but Preview URLs are still disabled.",
141276
+ "Preview URLs will automatically generate a unique, shareable link for each new version which will be accessible at:",
141277
+ ` ${previewUrl}`,
141278
+ "",
141279
+ "You may want to enable the Preview URLs as well by setting `preview_urls = true` in your Wrangler config file."
141280
+ ].join("\n")
141281
+ );
141282
+ }
141283
+ return desired;
141284
+ }
141122
141285
  async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl, routes, deployments, firstDeploy) {
141123
141286
  const { config } = props;
141124
- const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config.workers_dev, config.preview_urls, routes);
141125
141287
  const { enabled: currWorkersDev, previews_enabled: currPreviews } = await fetchResult(config, `${workerUrl}/subdomain`);
141288
+ const desiredSubdomain = await getSubdomainValues(
141289
+ config.workers_dev,
141290
+ config.preview_urls,
141291
+ routes
141292
+ );
141293
+ const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = await validateSubdomainMixedState(
141294
+ props,
141295
+ accountId,
141296
+ scriptName,
141297
+ config,
141298
+ desiredSubdomain,
141299
+ { workers_dev: currWorkersDev, preview_urls: currPreviews },
141300
+ firstDeploy
141301
+ );
141126
141302
  const workersDevInSync = wantWorkersDev === currWorkersDev;
141127
141303
  const previewsInSync = wantPreviews === currPreviews;
141128
141304
  const allInSync = [workersDevInSync, previewsInSync].every((v8) => v8);
@@ -141154,17 +141330,19 @@ async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl,
141154
141330
  workersDevURL = props.legacyEnv || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
141155
141331
  }
141156
141332
  if (!allInSync) {
141157
- await fetchResult(config, `${workerUrl}/subdomain`, {
141158
- method: "POST",
141159
- body: JSON.stringify({
141160
- enabled: wantWorkersDev,
141161
- previews_enabled: wantPreviews
141162
- }),
141163
- headers: {
141164
- "Content-Type": "application/json",
141165
- "Cloudflare-Workers-Script-Api-Date": "2025-08-01"
141166
- }
141167
- });
141333
+ await retryOnAPIFailure(
141334
+ async () => fetchResult(config, `${workerUrl}/subdomain`, {
141335
+ method: "POST",
141336
+ body: JSON.stringify({
141337
+ enabled: wantWorkersDev,
141338
+ previews_enabled: wantPreviews
141339
+ }),
141340
+ headers: {
141341
+ "Content-Type": "application/json",
141342
+ "Cloudflare-Workers-Script-Api-Date": "2025-08-01"
141343
+ }
141344
+ })
141345
+ );
141168
141346
  }
141169
141347
  if (workersDevURL) {
141170
141348
  deployments.push(Promise.resolve([workersDevURL]));
@@ -141183,7 +141361,9 @@ var init_deploy3 = __esm({
141183
141361
  init_dist2();
141184
141362
  init_cfetch();
141185
141363
  init_deploy8();
141364
+ init_misc_variables();
141186
141365
  init_errors();
141366
+ init_is_interactive();
141187
141367
  init_logger();
141188
141368
  init_client2();
141189
141369
  init_routes5();
@@ -141191,6 +141371,7 @@ var init_deploy3 = __esm({
141191
141371
  init_zones3();
141192
141372
  __name(triggersDeploy, "triggersDeploy");
141193
141373
  __name(getSubdomainValues, "getSubdomainValues");
141374
+ __name(validateSubdomainMixedState, "validateSubdomainMixedState");
141194
141375
  __name(subdomainDeploy, "subdomainDeploy");
141195
141376
  }
141196
141377
  });
@@ -149476,7 +149657,7 @@ function containerAppToInstanceType(containerApp) {
149476
149657
  };
149477
149658
  }
149478
149659
  if (configuration.disk?.size_mb === void 0 && configuration.vcpu === void 0 && configuration.memory_mib === void 0) {
149479
- return { instance_type: "dev" /* DEV */ };
149660
+ return { instance_type: "lite" /* LITE */ };
149480
149661
  }
149481
149662
  return configuration;
149482
149663
  }
@@ -149551,7 +149732,7 @@ async function apply2(args, config) {
149551
149732
  image: "docker.io/cloudflare/hello-world:1.0",
149552
149733
  instances: 2,
149553
149734
  name: config.name ?? "my-containers-application",
149554
- instance_type: "dev"
149735
+ instance_type: "lite"
149555
149736
  };
149556
149737
  const endConfig = args.env !== void 0 ? {
149557
149738
  env: { [args.env]: { containers: [configuration] } }
@@ -150667,7 +150848,14 @@ function createCommandOptionalYargs(yargs) {
150667
150848
  describe: "ID of the SSH key to add to the deployment"
150668
150849
  }).option("instance-type", {
150669
150850
  requiresArg: true,
150670
- choices: ["dev", "basic", "standard"],
150851
+ choices: [
150852
+ "lite",
150853
+ "basic",
150854
+ "standard-1",
150855
+ "standard-2",
150856
+ "standard-3",
150857
+ "standard-4"
150858
+ ],
150671
150859
  demandOption: false,
150672
150860
  describe: "Instance type to allocate to this deployment"
150673
150861
  }).option("vcpu", {
@@ -155684,10 +155872,15 @@ var init_deploy4 = __esm({
155684
155872
  choices: ["immediate", "gradual"]
155685
155873
  },
155686
155874
  "experimental-deploy-remote-diff-check": {
155687
- describe: `Experimental: Enable The Deployment Remote Diff check`,
155875
+ describe: "Experimental: Enable The Deployment Remote Diff check",
155688
155876
  type: "boolean",
155689
155877
  hidden: true,
155690
155878
  alias: ["x-remote-diff-check"]
155879
+ },
155880
+ strict: {
155881
+ describe: "Enables strict mode for the deploy command, this prevents deployments to occur when there are even small potential risks.",
155882
+ type: "boolean",
155883
+ default: false
155691
155884
  }
155692
155885
  },
155693
155886
  behaviour: {
@@ -155703,7 +155896,7 @@ var init_deploy4 = __esm({
155703
155896
  validateArgs(args) {
155704
155897
  if (args.nodeCompat) {
155705
155898
  throw new UserError2(
155706
- `The --node-compat flag is no longer supported as of Wrangler v4. Instead, use the \`nodejs_compat\` compatibility flag. This includes the functionality from legacy \`node_compat\` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.`,
155899
+ "The --node-compat flag is no longer supported as of Wrangler v4. Instead, use the `nodejs_compat` compatibility flag. This includes the functionality from legacy `node_compat` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.",
155707
155900
  { telemetryMessage: true }
155708
155901
  );
155709
155902
  }
@@ -155811,7 +156004,8 @@ var init_deploy4 = __esm({
155811
156004
  projectRoot,
155812
156005
  dispatchNamespace: args.dispatchNamespace,
155813
156006
  experimentalAutoCreate: args.experimentalAutoCreate,
155814
- containersRollout: args.containersRollout
156007
+ containersRollout: args.containersRollout,
156008
+ strict: args.strict
155815
156009
  });
155816
156010
  writeOutput({
155817
156011
  type: "deploy",
@@ -156659,7 +156853,19 @@ var init_create4 = __esm({
156659
156853
  demandOption: true,
156660
156854
  description: "The name of the Hyperdrive config"
156661
156855
  },
156662
- ...upsertOptions("postgresql")
156856
+ ...upsertOptions("postgresql"),
156857
+ binding: {
156858
+ type: "string",
156859
+ description: "The binding name of this resource in your Worker"
156860
+ },
156861
+ "use-remote": {
156862
+ type: "boolean",
156863
+ description: "Use a remote binding when adding the newly created resource to your config"
156864
+ },
156865
+ "update-config": {
156866
+ type: "boolean",
156867
+ description: "Automatically update your config file with the newly added resource"
156868
+ }
156663
156869
  },
156664
156870
  positionalArgs: ["name"],
156665
156871
  async handler(args, { config }) {
@@ -156676,16 +156882,14 @@ var init_create4 = __esm({
156676
156882
  `\u2705 Created new Hyperdrive ${capitalizeScheme(database.origin.scheme)} config: ${database.id}`
156677
156883
  );
156678
156884
  await updateConfigFile(
156885
+ "hyperdrive",
156679
156886
  (name2) => ({
156680
- hyperdrive: [
156681
- {
156682
- binding: getValidBindingName(name2 ?? "HYPERDRIVE", "HYPERDRIVE"),
156683
- id: database.id
156684
- }
156685
- ]
156887
+ binding: getValidBindingName(name2 ?? "HYPERDRIVE", "HYPERDRIVE"),
156888
+ id: database.id
156686
156889
  }),
156687
156890
  config.configPath,
156688
- args.env
156891
+ args.env,
156892
+ args
156689
156893
  );
156690
156894
  }
156691
156895
  });
@@ -157343,7 +157547,8 @@ var init_kv2 = __esm({
157343
157547
  preview: {
157344
157548
  type: "boolean",
157345
157549
  describe: "Interact with a preview namespace"
157346
- }
157550
+ },
157551
+ ...sharedResourceCreationArgs
157347
157552
  },
157348
157553
  positionalArgs: ["namespace"],
157349
157554
  async handler(args, { sdk }) {
@@ -157364,17 +157569,14 @@ var init_kv2 = __esm({
157364
157569
  logger.log("\u2728 Success!");
157365
157570
  const previewString = args.preview ? "preview_" : "";
157366
157571
  await updateConfigFile(
157572
+ "kv_namespaces",
157367
157573
  (name2) => ({
157368
- kv_namespaces: [
157369
- {
157370
- binding: getValidBindingName(name2 ?? args.namespace, "KV"),
157371
- [`${previewString}id`]: namespaceId
157372
- }
157373
- ]
157574
+ binding: getValidBindingName(name2 ?? args.namespace, "KV"),
157575
+ [`${previewString}id`]: namespaceId
157374
157576
  }),
157375
157577
  config.configPath,
157376
157578
  args.env,
157377
- !args.preview
157579
+ { ...args, updateConfig: preview ? false : args.updateConfig }
157378
157580
  );
157379
157581
  }
157380
157582
  });
@@ -164379,7 +164581,8 @@ var init_deployments4 = __esm({
164379
164581
  hideGlobalFlags: ["config", "env"]
164380
164582
  },
164381
164583
  behaviour: {
164382
- provideConfig: false
164584
+ provideConfig: false,
164585
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
164383
164586
  },
164384
164587
  args: {
164385
164588
  "project-name": {
@@ -199865,18 +200068,14 @@ async function displayUsageExamples(stream2, config, args) {
199865
200068
  Send your first event to stream '${stream2.name}':`);
199866
200069
  logger.log("\nWorker Integration:");
199867
200070
  await updateConfigFile(
200071
+ "pipelines",
199868
200072
  (customBindingName) => ({
199869
- pipelines: [
199870
- {
199871
- pipeline: stream2.id,
199872
- binding: customBindingName ?? bindingName
199873
- }
199874
- ]
200073
+ pipeline: stream2.id,
200074
+ binding: customBindingName ?? bindingName
199875
200075
  }),
199876
200076
  config.configPath,
199877
200077
  args.env,
199878
- false
199879
- // Don't offer to update automatically
200078
+ { updateConfig: false }
199880
200079
  );
199881
200080
  logger.log("\nIn your Worker:");
199882
200081
  logger.log(`await env.${bindingName}.send([${exampleData}]);`);
@@ -200500,6 +200699,9 @@ var init_get2 = __esm({
200500
200699
  owner: "Product: Pipelines",
200501
200700
  status: "open-beta"
200502
200701
  },
200702
+ behaviour: {
200703
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
200704
+ },
200503
200705
  args: {
200504
200706
  pipeline: {
200505
200707
  type: "string",
@@ -200595,6 +200797,9 @@ var init_list5 = __esm({
200595
200797
  owner: "Product: Pipelines",
200596
200798
  status: "open-beta"
200597
200799
  },
200800
+ behaviour: {
200801
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
200802
+ },
200598
200803
  args: {
200599
200804
  page: {
200600
200805
  describe: "Page number for pagination",
@@ -201800,6 +202005,9 @@ var init_get3 = __esm({
201800
202005
  owner: "Product: Pipelines",
201801
202006
  status: "open-beta"
201802
202007
  },
202008
+ behaviour: {
202009
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202010
+ },
201803
202011
  positionalArgs: ["sink"],
201804
202012
  args: {
201805
202013
  sink: {
@@ -201848,6 +202056,9 @@ var init_list6 = __esm({
201848
202056
  owner: "Product: Pipelines",
201849
202057
  status: "open-beta"
201850
202058
  },
202059
+ behaviour: {
202060
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202061
+ },
201851
202062
  args: {
201852
202063
  page: {
201853
202064
  describe: "Page number for pagination",
@@ -202092,6 +202303,9 @@ var init_get4 = __esm({
202092
202303
  owner: "Product: Pipelines",
202093
202304
  status: "open-beta"
202094
202305
  },
202306
+ behaviour: {
202307
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202308
+ },
202095
202309
  positionalArgs: ["stream"],
202096
202310
  args: {
202097
202311
  stream: {
@@ -202136,6 +202350,9 @@ var init_list7 = __esm({
202136
202350
  owner: "Product: Pipelines",
202137
202351
  status: "open-beta"
202138
202352
  },
202353
+ behaviour: {
202354
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
202355
+ },
202139
202356
  args: {
202140
202357
  page: {
202141
202358
  describe: "Page number for pagination",
@@ -203940,6 +204157,9 @@ var init_get5 = __esm({
203940
204157
  owner: "Product: Queues",
203941
204158
  status: "stable"
203942
204159
  },
204160
+ behaviour: {
204161
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
204162
+ },
203943
204163
  positionalArgs: ["queue"],
203944
204164
  args: {
203945
204165
  queue: {
@@ -204001,6 +204221,9 @@ var init_list9 = __esm({
204001
204221
  owner: "Product: Queues",
204002
204222
  status: "stable"
204003
204223
  },
204224
+ behaviour: {
204225
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
204226
+ },
204004
204227
  positionalArgs: ["queue"],
204005
204228
  args: {
204006
204229
  queue: {
@@ -204068,6 +204291,9 @@ var init_update3 = __esm({
204068
204291
  owner: "Product: Queues",
204069
204292
  status: "stable"
204070
204293
  },
204294
+ behaviour: {
204295
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
204296
+ },
204071
204297
  positionalArgs: ["queue"],
204072
204298
  args: {
204073
204299
  queue: {
@@ -204307,7 +204533,8 @@ var init_bucket = __esm({
204307
204533
  alias: "J",
204308
204534
  requiresArg: true,
204309
204535
  type: "string"
204310
- }
204536
+ },
204537
+ ...sharedResourceCreationArgs
204311
204538
  },
204312
204539
  async handler(args, { config }) {
204313
204540
  const accountId = await requireAuth(config);
@@ -204338,16 +204565,14 @@ var init_bucket = __esm({
204338
204565
  logger.log(esm_default2`
204339
204566
  ✅ Created bucket '${fullBucketName}' with${location ? ` location hint ${location} and` : ``} default storage class of ${storageClass ? storageClass : `Standard`}.`);
204340
204567
  await updateConfigFile(
204568
+ "r2_buckets",
204341
204569
  (bindingName) => ({
204342
- r2_buckets: [
204343
- {
204344
- bucket_name: args.name,
204345
- binding: getValidBindingName(bindingName ?? args.name, "r2")
204346
- }
204347
- ]
204570
+ bucket_name: args.name,
204571
+ binding: getValidBindingName(bindingName ?? args.name, "r2")
204348
204572
  }),
204349
204573
  config.configPath,
204350
- args.env
204574
+ args.env,
204575
+ args
204351
204576
  );
204352
204577
  sendMetricsEvent("create r2 bucket", {
204353
204578
  sendMetrics: config.send_metrics
@@ -220313,7 +220538,8 @@ var init_create10 = __esm({
220313
220538
  deprecated: true,
220314
220539
  default: deprecatedV1DefaultFlag,
220315
220540
  description: "Create a deprecated Vectorize V1 index. This is not recommended and indexes created with this option need all other Vectorize operations to have this option enabled."
220316
- }
220541
+ },
220542
+ ...sharedResourceCreationArgs
220317
220543
  },
220318
220544
  positionalArgs: ["name"],
220319
220545
  async handler(args, { config }) {
@@ -220359,16 +220585,14 @@ var init_create10 = __esm({
220359
220585
  `\u2705 Successfully created a new Vectorize index: '${indexResult.name}'`
220360
220586
  );
220361
220587
  await updateConfigFile(
220588
+ "vectorize",
220362
220589
  (name2) => ({
220363
- vectorize: [
220364
- {
220365
- binding: getValidBindingName(name2 ?? bindingName, bindingName),
220366
- index_name: indexResult.name
220367
- }
220368
- ]
220590
+ binding: getValidBindingName(name2 ?? bindingName, bindingName),
220591
+ index_name: indexResult.name
220369
220592
  }),
220370
220593
  config.configPath,
220371
- args.env
220594
+ args.env,
220595
+ args
220372
220596
  );
220373
220597
  }
220374
220598
  });
@@ -222102,7 +222326,7 @@ var init_list12 = __esm({
222102
222326
  }
222103
222327
  },
222104
222328
  behaviour: {
222105
- printBanner: false
222329
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
222106
222330
  },
222107
222331
  handler: /* @__PURE__ */ __name(async function versionsDeploymentsListHandler(args, { config }) {
222108
222332
  sendMetricsEvent(
@@ -222186,7 +222410,6 @@ var init_status3 = __esm({
222186
222410
  init_metrics2();
222187
222411
  init_user3();
222188
222412
  init_render_labelled_values();
222189
- init_wrangler_banner();
222190
222413
  init_api();
222191
222414
  init_list12();
222192
222415
  BLANK_INPUT4 = "-";
@@ -222209,12 +222432,9 @@ var init_status3 = __esm({
222209
222432
  }
222210
222433
  },
222211
222434
  behaviour: {
222212
- printBanner: false
222435
+ printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
222213
222436
  },
222214
222437
  handler: /* @__PURE__ */ __name(async function versionsDeploymentsStatusHandler(args, { config }) {
222215
- if (!args.json) {
222216
- await printWranglerBanner();
222217
- }
222218
222438
  sendMetricsEvent(
222219
222439
  "view latest versioned deployment",
222220
222440
  {},
@@ -229282,6 +229502,13 @@ async function main(argv) {
229282
229502
  (args) => {
229283
229503
  if (Object.keys(LOGGER_LEVELS).includes(args.logLevel)) {
229284
229504
  logger.loggerLevel = args.logLevel;
229505
+ setLogLevel(args.logLevel);
229506
+ }
229507
+ const envLogLevel = getEnvironmentVariableFactory({
229508
+ variableName: "WRANGLER_LOG"
229509
+ })()?.toLowerCase();
229510
+ if (envLogLevel) {
229511
+ setLogLevel(envLogLevel);
229285
229512
  }
229286
229513
  if (recordedCommand) {
229287
229514
  return;
@@ -229346,7 +229573,7 @@ async function main(argv) {
229346
229573
  logger.error(e8.cause);
229347
229574
  } else {
229348
229575
  (0, import_node_assert22.default)(isAuthenticationError(e8));
229349
- logger.log(formatMessage(e8));
229576
+ logger.error(e8);
229350
229577
  }
229351
229578
  const envAuth = getAuthFromEnv();
229352
229579
  if (envAuth !== void 0 && "apiToken" in envAuth) {
@@ -229367,7 +229594,7 @@ async function main(argv) {
229367
229594
  e8.notes.push({
229368
229595
  text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose"
229369
229596
  });
229370
- logger.log(formatMessage(e8));
229597
+ logger.error(e8);
229371
229598
  } else if (e8 instanceof JsonFriendlyFatalError) {
229372
229599
  logger.log(e8.message);
229373
229600
  } else if (e8 instanceof Error && e8.message.includes("Raw mode is not supported on")) {
@@ -229398,7 +229625,7 @@ ${tryRunningItIn}${oneOfThese}`
229398
229625
  error2.notes.push({
229399
229626
  text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose"
229400
229627
  });
229401
- logger.log(formatMessage(error2));
229628
+ logger.error(error2);
229402
229629
  } else {
229403
229630
  if (
229404
229631
  // Is this a StartDevEnv error event? If so, unwrap the cause, which is usually the user-recognisable error
@@ -229512,6 +229739,7 @@ var init_src2 = __esm({
229512
229739
  init_dev2();
229513
229740
  init_dispatch_namespace();
229514
229741
  init_docs();
229742
+ init_factory();
229515
229743
  init_misc_variables();
229516
229744
  init_errors();
229517
229745
  init_hello_world();
@@ -230263,6 +230491,7 @@ Update them to point to this script instead?`;
230263
230491
  return domains.map((domain2) => renderRoute(domain2));
230264
230492
  }
230265
230493
  async function deploy(props) {
230494
+ const deployConfirm = getDeployConfirmFunction(props.strict);
230266
230495
  const { config, accountId, name: name2, entry } = props;
230267
230496
  let workerTag = null;
230268
230497
  let versionId = null;
@@ -230305,7 +230534,7 @@ ${configDiff.diff}
230305
230534
 
230306
230535
  Deploying the Worker will override the remote configuration with your local one.`
230307
230536
  );
230308
- if (!await confirm("Would you like to continue?")) {
230537
+ if (!await deployConfirm("Would you like to continue?")) {
230309
230538
  return { versionId, workerTag };
230310
230539
  }
230311
230540
  }
@@ -230314,7 +230543,7 @@ Deploying the Worker will override the remote configuration with your local one.
230314
230543
  `You are about to publish a Workers Service that was last published via the Cloudflare Dashboard.
230315
230544
  Edits that have been made via the dashboard will be overridden by your local code and config.`
230316
230545
  );
230317
- if (!await confirm("Would you like to continue?")) {
230546
+ if (!await deployConfirm("Would you like to continue?")) {
230318
230547
  return { versionId, workerTag };
230319
230548
  }
230320
230549
  }
@@ -230323,7 +230552,7 @@ Edits that have been made via the dashboard will be overridden by your local cod
230323
230552
  `You are about to publish a Workers Service that was last updated via the script API.
230324
230553
  Edits that have been made via the script API will be overridden by your local code and config.`
230325
230554
  );
230326
- if (!await confirm("Would you like to continue?")) {
230555
+ if (!await deployConfirm("Would you like to continue?")) {
230327
230556
  return { versionId, workerTag };
230328
230557
  }
230329
230558
  }
@@ -230902,7 +231131,7 @@ async function publishRoutesFallback(complianceConfig, routes, {
230902
231131
  { telemetryMessage: true }
230903
231132
  );
230904
231133
  }
230905
- logger.warn(
231134
+ logger.info(
230906
231135
  "The current authentication token does not have 'All Zones' permissions.\nFalling back to using the zone-based API endpoint to update each route individually.\nNote that there is no access to routes associated with zones that the API token does not have permission for.\nExisting routes for this Worker in such zones will not be deleted."
230907
231136
  );
230908
231137
  const deployedRoutes = [];
@@ -231067,6 +231296,19 @@ async function updateQueueConsumers(scriptName, config) {
231067
231296
  }
231068
231297
  return updateConsumers;
231069
231298
  }
231299
+ function getDeployConfirmFunction(strictMode = false) {
231300
+ const nonInteractive = isNonInteractiveOrCI();
231301
+ if (nonInteractive && strictMode) {
231302
+ return async () => {
231303
+ logger.error(
231304
+ "Aborting the deployment operation because of conflicts. To override and deploy anyway remove the `--strict` flag"
231305
+ );
231306
+ process.exitCode = 1;
231307
+ return false;
231308
+ };
231309
+ }
231310
+ return confirm;
231311
+ }
231070
231312
  var import_node_assert23, import_node_fs36, import_node_path56, import_node_url10, import_undici22, validateRoutes3;
231071
231313
  var init_deploy8 = __esm({
231072
231314
  "src/deploy/deploy.ts"() {
@@ -231099,6 +231341,7 @@ var init_deploy8 = __esm({
231099
231341
  init_environments();
231100
231342
  init_errors();
231101
231343
  init_experimental_flags();
231344
+ init_is_interactive();
231102
231345
  init_logger();
231103
231346
  init_metrics2();
231104
231347
  init_navigator_user_agent();
@@ -231178,6 +231421,7 @@ ${mountedAssetRoutes.map((route) => {
231178
231421
  __name(publishRoutesFallback, "publishRoutesFallback");
231179
231422
  __name(isAuthenticationError, "isAuthenticationError");
231180
231423
  __name(updateQueueConsumers, "updateQueueConsumers");
231424
+ __name(getDeployConfirmFunction, "getDeployConfirmFunction");
231181
231425
  }
231182
231426
  });
231183
231427
 
@@ -252412,7 +252656,7 @@ var init_ProxyController = __esm({
252412
252656
 
252413
252657
  // src/utils/isAbortError.ts
252414
252658
  function isAbortError(err) {
252415
- const legacyAbortErroCheck = err.code !== "ABORT_ERR";
252659
+ const legacyAbortErroCheck = err.code == "ABORT_ERR";
252416
252660
  const abortErrorCheck = err instanceof Error && err.name == "AbortError";
252417
252661
  return legacyAbortErroCheck || abortErrorCheck;
252418
252662
  }
@@ -252584,7 +252828,7 @@ var init_create_worker_preview = __esm({
252584
252828
  // src/dev/remote.ts
252585
252829
  function handlePreviewSessionUploadError(err, accountId) {
252586
252830
  (0, import_node_assert30.default)(err && typeof err === "object");
252587
- if (isAbortError(err)) {
252831
+ if (!isAbortError(err)) {
252588
252832
  if ("code" in err && err.code === 10049) {
252589
252833
  logger.log("Preview token expired, fetching a new one");
252590
252834
  return true;
@@ -252597,12 +252841,9 @@ function handlePreviewSessionUploadError(err, accountId) {
252597
252841
  function handlePreviewSessionCreationError(err, accountId) {
252598
252842
  (0, import_node_assert30.default)(err && typeof err === "object");
252599
252843
  if ("code" in err && err.code === 10063) {
252600
- const errorMessage = "Error: You need to register a workers.dev subdomain before running the dev command in remote mode";
252601
- const solutionMessage = "You can either enable local mode by pressing l, or register a workers.dev subdomain here:";
252602
- const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
252603
- logger.error(`${errorMessage}
252604
- ${solutionMessage}
252605
- ${onboardingLink}`);
252844
+ logger.error(
252845
+ `You need to register a workers.dev subdomain before running the dev command in remote mode. You can either enable local mode by pressing l, or register a workers.dev subdomain here: https://dash.cloudflare.com/${accountId}/workers/onboarding`
252846
+ );
252606
252847
  } else if ("cause" in err && err.cause?.code === "ENOTFOUND") {
252607
252848
  logger.error(
252608
252849
  `Could not access \`${err.cause.hostname}\`. Make sure the domain is set up to be proxied by Cloudflare.
@@ -252610,7 +252851,7 @@ For more details, refer to https://developers.cloudflare.com/workers/configurati
252610
252851
  );
252611
252852
  } else if (err instanceof UserError2) {
252612
252853
  logger.error(err.message);
252613
- } else if (isAbortError(err)) {
252854
+ } else if (!isAbortError(err)) {
252614
252855
  logger.error("Error while creating remote dev session:", err);
252615
252856
  }
252616
252857
  }
@@ -252723,34 +252964,30 @@ async function getWorkerAccountAndContext(props) {
252723
252964
  return { workerAccount, workerContext };
252724
252965
  }
252725
252966
  function handleUserFriendlyError(error2, accountId) {
252726
- switch (error2.code) {
252727
- // code 10021 is a validation error
252728
- case 10021: {
252729
- if (error2.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
252730
- const errorMessage = "Error: You must use a real database in the preview_database_id configuration.";
252731
- const solutionMessage = "You can find your databases using 'wrangler d1 list', or read how to develop locally with D1 here:";
252732
- const documentationLink = `https://developers.cloudflare.com/d1/configuration/local-development`;
252967
+ if (error2 instanceof APIError) {
252968
+ switch (error2.code) {
252969
+ // code 10021 is a validation error
252970
+ case 10021: {
252971
+ if (error2.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
252972
+ logger.error(
252973
+ `You must use a real database in the preview_database_id configuration. You can find your databases using 'wrangler d1 list', or read how to develop locally with D1 here: https://developers.cloudflare.com/d1/configuration/local-development`
252974
+ );
252975
+ return true;
252976
+ }
252977
+ return false;
252978
+ }
252979
+ // for error 10063 (workers.dev subdomain required)
252980
+ case 10063: {
252981
+ const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
252733
252982
  logger.error(
252734
- `${errorMessage}
252735
- ${solutionMessage}
252736
- ${documentationLink}`
252983
+ `You need to register a workers.dev subdomain before running the dev command in remote mode. You can either enable local mode by pressing l, or register a workers.dev subdomain here: ${onboardingLink}`
252737
252984
  );
252738
252985
  return true;
252739
252986
  }
252740
- return false;
252741
- }
252742
- // for error 10063 (workers.dev subdomain required)
252743
- case 10063: {
252744
- const errorMessage = "Error: You need to register a workers.dev subdomain before running the dev command in remote mode";
252745
- const solutionMessage = "You can either enable local mode by pressing l, or register a workers.dev subdomain here:";
252746
- const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
252747
- logger.error(`${errorMessage}
252748
- ${solutionMessage}
252749
- ${onboardingLink}`);
252750
- return true;
252751
- }
252752
- default: {
252753
- return false;
252987
+ default: {
252988
+ logger.error(error2);
252989
+ return true;
252990
+ }
252754
252991
  }
252755
252992
  }
252756
252993
  }
@@ -252767,6 +253004,7 @@ var init_remote = __esm({
252767
253004
  init_dev2();
252768
253005
  init_errors();
252769
253006
  init_logger();
253007
+ init_parse();
252770
253008
  init_sites2();
252771
253009
  init_user3();
252772
253010
  init_isAbortError();
@@ -253241,7 +253479,7 @@ var init_DevEnv = __esm({
253241
253479
  `, ev.cause);
253242
253480
  logger.debug("=> Error contextual data:", ev.data);
253243
253481
  } else if (ev.source === "ConfigController" && ev.cause instanceof ParseError) {
253244
- logger.log(formatMessage(ev.cause));
253482
+ logger.error(ev.cause);
253245
253483
  } else {
253246
253484
  this.emit("error", ev);
253247
253485
  }