wrangler 4.39.0 → 4.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.39.0",
3
+ "version": "4.40.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -54,15 +54,15 @@
54
54
  "esbuild": "0.25.4",
55
55
  "path-to-regexp": "6.3.0",
56
56
  "unenv": "2.0.0-rc.21",
57
- "workerd": "1.20250923.0",
57
+ "workerd": "1.20250924.0",
58
58
  "@cloudflare/kv-asset-handler": "0.4.0",
59
59
  "@cloudflare/unenv-preset": "2.7.4",
60
- "miniflare": "4.20250923.0"
60
+ "miniflare": "4.20250924.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
64
64
  "@cloudflare/types": "6.18.4",
65
- "@cloudflare/workers-types": "^4.20250923.0",
65
+ "@cloudflare/workers-types": "^4.20250924.0",
66
66
  "@cspotcode/source-map-support": "0.8.1",
67
67
  "@iarna/toml": "^3.0.0",
68
68
  "@sentry/node": "^7.86.0",
@@ -138,15 +138,15 @@
138
138
  "xdg-app-paths": "^8.3.0",
139
139
  "xxhash-wasm": "^1.0.1",
140
140
  "yargs": "^17.7.2",
141
- "@cloudflare/cli": "1.1.2",
142
141
  "@cloudflare/containers-shared": "0.2.10",
142
+ "@cloudflare/cli": "1.1.2",
143
143
  "@cloudflare/eslint-config-shared": "1.1.0",
144
- "@cloudflare/pages-shared": "^0.13.74",
145
144
  "@cloudflare/workers-shared": "0.18.8",
146
- "@cloudflare/workers-tsconfig": "0.0.0"
145
+ "@cloudflare/workers-tsconfig": "0.0.0",
146
+ "@cloudflare/pages-shared": "^0.13.75"
147
147
  },
148
148
  "peerDependencies": {
149
- "@cloudflare/workers-types": "^4.20250923.0"
149
+ "@cloudflare/workers-types": "^4.20250924.0"
150
150
  },
151
151
  "peerDependenciesMeta": {
152
152
  "@cloudflare/workers-types": {
@@ -93842,7 +93842,7 @@ var name, version;
93842
93842
  var init_package = __esm({
93843
93843
  "package.json"() {
93844
93844
  name = "wrangler";
93845
- version = "4.39.0";
93845
+ version = "4.40.0";
93846
93846
  }
93847
93847
  });
93848
93848
 
@@ -102805,7 +102805,6 @@ function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvaila
102805
102805
  };
102806
102806
  }
102807
102807
  function findRedirectedWranglerConfig(cwd2, userConfigPath) {
102808
- const PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
102809
102808
  const deployConfigPath = findUpSync(PATH_TO_DEPLOY_CONFIG, { cwd: cwd2 });
102810
102809
  if (deployConfigPath === void 0) {
102811
102810
  return userConfigPath;
@@ -102861,7 +102860,7 @@ function findRedirectedWranglerConfig(cwd2, userConfigPath) {
102861
102860
  function isRedirectedRawConfig(rawConfig, configPath, userConfigPath) {
102862
102861
  return configPath !== void 0 && configPath !== userConfigPath;
102863
102862
  }
102864
- var import_node_fs5, import_node_path7;
102863
+ var import_node_fs5, import_node_path7, PATH_TO_DEPLOY_CONFIG;
102865
102864
  var init_config_helpers = __esm({
102866
102865
  "src/config/config-helpers.ts"() {
102867
102866
  init_import_meta_url();
@@ -102872,6 +102871,7 @@ var init_config_helpers = __esm({
102872
102871
  init_errors();
102873
102872
  init_logger();
102874
102873
  init_parse();
102874
+ PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
102875
102875
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
102876
102876
  __name(findWranglerConfig, "findWranglerConfig");
102877
102877
  __name(findRedirectedWranglerConfig, "findRedirectedWranglerConfig");
@@ -104899,7 +104899,7 @@ Consider adding an environment configuration section to the ${configFileName(con
104899
104899
  const config = {
104900
104900
  configPath,
104901
104901
  userConfigPath,
104902
- topLevelName: rawConfig.name,
104902
+ topLevelName: isRedirectedConfig ? rawConfig.topLevelName : rawConfig.name,
104903
104903
  definedEnvironments: isRedirectedConfig ? rawConfig.definedEnvironments : definedEnvironments,
104904
104904
  targetEnvironment: isRedirectedConfig ? rawConfig.targetEnvironment : envName,
104905
104905
  pages_build_output_dir: normalizeAndValidatePagesBuildOutputDir(
@@ -132484,55 +132484,35 @@ var init_durable = __esm({
132484
132484
  function hasDefinedEnvironments(config) {
132485
132485
  return isLegacyEnv(config) && Boolean(config.definedEnvironments?.length);
132486
132486
  }
132487
- async function applyServiceAndEnvironmentTags(config, accountId, scriptName, tags) {
132488
- tags ??= [];
132487
+ function applyServiceAndEnvironmentTags(config, tags) {
132489
132488
  const env6 = config.targetEnvironment;
132490
132489
  const serviceName = config.topLevelName;
132491
- if (!serviceName) {
132490
+ const shouldApplyTags = hasDefinedEnvironments(config);
132491
+ if (shouldApplyTags && !serviceName) {
132492
132492
  logger.warn(
132493
132493
  "No top-level `name` has been defined in Wrangler configuration. Add a top-level `name` to group this Worker together with its sibling environments in the Cloudflare dashboard."
132494
132494
  );
132495
- if (tags.some((tag) => tag.startsWith(SERVICE_TAG_PREFIX))) {
132496
- try {
132497
- return await patchNonVersionedScriptSettings(
132498
- config,
132499
- accountId,
132500
- scriptName,
132501
- {
132502
- tags: tags.filter((tag) => !tag.startsWith(SERVICE_TAG_PREFIX))
132503
- }
132504
- );
132505
- } catch {
132506
- }
132507
- }
132508
- return;
132509
132495
  }
132510
- const serviceTag = `${SERVICE_TAG_PREFIX}${serviceName}`;
132511
- const environmentTag = env6 ? `${ENVIRONMENT_TAG_PREFIX}${env6}` : null;
132512
- const hasMissingServiceTag = !tags.includes(serviceTag);
132513
- const hasMissingOrStaleEnvironmentTag = environmentTag ? !tags.includes(environmentTag) : tags.some((tag) => tag.startsWith(ENVIRONMENT_TAG_PREFIX));
132514
- if (hasMissingServiceTag || hasMissingOrStaleEnvironmentTag) {
132515
- const nextTags = tags.filter(
132516
- (tag) => !tag.startsWith(SERVICE_TAG_PREFIX) && !tag.startsWith(ENVIRONMENT_TAG_PREFIX)
132517
- ).concat([serviceTag]);
132518
- if (environmentTag) {
132519
- nextTags.push(environmentTag);
132520
- }
132521
- try {
132522
- return await patchNonVersionedScriptSettings(
132523
- config,
132524
- accountId,
132525
- scriptName,
132526
- {
132527
- tags: nextTags
132528
- }
132529
- );
132530
- } catch {
132531
- logger.warn(
132532
- "Could not apply service and environment tags. This Worker will not appear grouped together with its sibling environments in the Cloudflare dashboard."
132533
- );
132534
- }
132496
+ const serviceTag = shouldApplyTags && serviceName ? `${SERVICE_TAG_PREFIX}${serviceName}` : null;
132497
+ const environmentTag = serviceTag && env6 ? `${ENVIRONMENT_TAG_PREFIX}${env6}` : null;
132498
+ tags = tags.filter(
132499
+ (tag) => !tag.startsWith(SERVICE_TAG_PREFIX) && !tag.startsWith(ENVIRONMENT_TAG_PREFIX)
132500
+ );
132501
+ if (serviceTag) {
132502
+ tags.push(serviceTag);
132503
+ }
132504
+ if (environmentTag) {
132505
+ tags.push(environmentTag);
132535
132506
  }
132507
+ return tags;
132508
+ }
132509
+ function warnOnErrorUpdatingServiceAndEnvironmentTags() {
132510
+ logger.warn(
132511
+ "Could not apply service and environment tags. This Worker will not appear grouped together with its sibling environments in the Cloudflare dashboard."
132512
+ );
132513
+ }
132514
+ function tagsAreEqual(a6, b7) {
132515
+ return a6.length === b7.length && a6.every((el, i6) => b7[i6] === el);
132536
132516
  }
132537
132517
  var SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX;
132538
132518
  var init_environments = __esm({
@@ -132540,11 +132520,12 @@ var init_environments = __esm({
132540
132520
  init_import_meta_url();
132541
132521
  init_logger();
132542
132522
  init_isLegacyEnv();
132543
- init_api();
132544
132523
  SERVICE_TAG_PREFIX = "cf:service=";
132545
132524
  ENVIRONMENT_TAG_PREFIX = "cf:environment=";
132546
132525
  __name(hasDefinedEnvironments, "hasDefinedEnvironments");
132547
132526
  __name(applyServiceAndEnvironmentTags, "applyServiceAndEnvironmentTags");
132527
+ __name(warnOnErrorUpdatingServiceAndEnvironmentTags, "warnOnErrorUpdatingServiceAndEnvironmentTags");
132528
+ __name(tagsAreEqual, "tagsAreEqual");
132548
132529
  }
132549
132530
  });
132550
132531
 
@@ -144970,15 +144951,8 @@ function createHandler(def, commandName) {
144970
144951
  useRedirectIfAvailable: def.behaviour?.useConfigRedirectIfAvailable
144971
144952
  }) : defaultWranglerConfig;
144972
144953
  if (def.behaviour?.warnIfMultipleEnvsConfiguredButNoneSpecified) {
144973
- if (!("env" in args) && config.configPath) {
144974
- const { rawConfig } = experimental_readRawConfig(
144975
- {
144976
- config: config.configPath
144977
- },
144978
- { hideWarnings: true }
144979
- );
144980
- const availableEnvs = Object.keys(rawConfig.env ?? {});
144981
- if (availableEnvs.length > 0) {
144954
+ if (!("env" in args)) {
144955
+ if (hasDefinedEnvironments(config)) {
144982
144956
  logger.warn(
144983
144957
  dedent2`
144984
144958
  Multiple environments are defined in the Wrangler configuration file, but no target environment was specified for the ${commandName.replace(/^wrangler\s+/, "")} command.
@@ -145010,6 +144984,7 @@ var init_register_yargs_command = __esm({
145010
144984
  init_internal();
145011
144985
  init_config5();
145012
144986
  init_config4();
144987
+ init_environments();
145013
144988
  init_errors();
145014
144989
  init_experimental_flags();
145015
144990
  init_logger();
@@ -192164,8 +192139,8 @@ function generateSampleValue(field) {
192164
192139
  case "int64":
192165
192140
  return "9223372036854775807";
192166
192141
  // Large numbers as strings to avoid JS precision issues
192167
- case "f32":
192168
- case "f64":
192142
+ case "float32":
192143
+ case "float64":
192169
192144
  return 3.14;
192170
192145
  case "json":
192171
192146
  return { example: "json_value" };
@@ -193040,6 +193015,72 @@ var init_list5 = __esm({
193040
193015
  }
193041
193016
  });
193042
193017
 
193018
+ // src/pipelines/defaults.ts
193019
+ function applyDefaultsToSink(sink) {
193020
+ const withDefaults = {
193021
+ ...sink,
193022
+ format: { ...sink.format },
193023
+ config: { ...sink.config }
193024
+ };
193025
+ if (withDefaults.format.type === "parquet") {
193026
+ if (!withDefaults.format.compression) {
193027
+ withDefaults.format.compression = SINK_DEFAULTS.format.compression;
193028
+ }
193029
+ if (!withDefaults.format.row_group_bytes) {
193030
+ withDefaults.format.row_group_bytes = SINK_DEFAULTS.format.row_group_bytes;
193031
+ }
193032
+ }
193033
+ if (!withDefaults.config.rolling_policy) {
193034
+ withDefaults.config.rolling_policy = {
193035
+ interval_seconds: SINK_DEFAULTS.rolling_policy.interval_seconds
193036
+ };
193037
+ if (SINK_DEFAULTS.rolling_policy.file_size_bytes !== void 0) {
193038
+ withDefaults.config.rolling_policy.file_size_bytes = SINK_DEFAULTS.rolling_policy.file_size_bytes;
193039
+ }
193040
+ } else {
193041
+ if (!withDefaults.config.rolling_policy.file_size_bytes && SINK_DEFAULTS.rolling_policy.file_size_bytes !== void 0) {
193042
+ withDefaults.config.rolling_policy.file_size_bytes = SINK_DEFAULTS.rolling_policy.file_size_bytes;
193043
+ }
193044
+ if (!withDefaults.config.rolling_policy.interval_seconds) {
193045
+ withDefaults.config.rolling_policy.interval_seconds = SINK_DEFAULTS.rolling_policy.interval_seconds;
193046
+ }
193047
+ }
193048
+ if (withDefaults.type === "r2") {
193049
+ if (!withDefaults.config.path) {
193050
+ withDefaults.config.path = SINK_DEFAULTS.r2.path;
193051
+ }
193052
+ if (!withDefaults.config.partitioning) {
193053
+ withDefaults.config.partitioning = SINK_DEFAULTS.r2.partitioning;
193054
+ }
193055
+ }
193056
+ return withDefaults;
193057
+ }
193058
+ var SINK_DEFAULTS;
193059
+ var init_defaults = __esm({
193060
+ "src/pipelines/defaults.ts"() {
193061
+ init_import_meta_url();
193062
+ SINK_DEFAULTS = {
193063
+ format: {
193064
+ type: "parquet",
193065
+ compression: "zstd",
193066
+ row_group_bytes: 1024 * 1024 * 1024
193067
+ },
193068
+ rolling_policy: {
193069
+ file_size_bytes: void 0,
193070
+ interval_seconds: 300
193071
+ },
193072
+ r2: {
193073
+ path: "",
193074
+ partitioning: {
193075
+ time_pattern: "year=%Y/month=%m/day=%d"
193076
+ }
193077
+ },
193078
+ r2_data_catalog: {}
193079
+ };
193080
+ __name(applyDefaultsToSink, "applyDefaultsToSink");
193081
+ }
193082
+ });
193083
+
193043
193084
  // src/pipelines/cli/setup.ts
193044
193085
  async function setupPipelineNaming(providedName) {
193045
193086
  const pipelineName = providedName || await prompt("What would you like to name your pipeline?");
@@ -193160,10 +193201,8 @@ async function buildField(fieldNumber, depth = 0) {
193160
193201
  { title: "string", value: "string" },
193161
193202
  { title: "int32", value: "int32" },
193162
193203
  { title: "int64", value: "int64" },
193163
- { title: "u_int32", value: "u_int32" },
193164
- { title: "u_int64", value: "u_int64" },
193165
- { title: "f32", value: "f32" },
193166
- { title: "f64", value: "f64" },
193204
+ { title: "float32", value: "float32" },
193205
+ { title: "float64", value: "float64" },
193167
193206
  { title: "bool", value: "bool" },
193168
193207
  { title: "timestamp", value: "timestamp" },
193169
193208
  { title: "json", value: "json" },
@@ -193311,13 +193350,16 @@ async function setupR2Sink(config, accountId, setupConfig) {
193311
193350
  fallbackOption: 3
193312
193351
  });
193313
193352
  }
193314
- const fileSizeMB = await prompt("Roll file when size reaches (MB):", {
193315
- defaultValue: "100"
193316
- });
193353
+ const fileSizeMB = await prompt(
193354
+ "Roll file when size reaches (MB, minimum 5):",
193355
+ {
193356
+ defaultValue: "100"
193357
+ }
193358
+ );
193317
193359
  const intervalSeconds = await prompt(
193318
- "Roll file when time reaches (seconds):",
193360
+ "Roll file when time reaches (seconds, minimum 10):",
193319
193361
  {
193320
- defaultValue: "300"
193362
+ defaultValue: String(SINK_DEFAULTS.rolling_policy.interval_seconds)
193321
193363
  }
193322
193364
  );
193323
193365
  const useOAuth = await confirm(
@@ -193396,16 +193438,19 @@ async function setupDataCatalogSink(setupConfig) {
193396
193438
  { title: "zstd", value: "zstd" },
193397
193439
  { title: "lz4", value: "lz4" }
193398
193440
  ],
193399
- defaultOption: 0,
193400
- fallbackOption: 0
193401
- });
193402
- const fileSizeMB = await prompt("Roll file when size reaches (MB):", {
193403
- defaultValue: "100"
193441
+ defaultOption: 3,
193442
+ fallbackOption: 3
193404
193443
  });
193444
+ const fileSizeMB = await prompt(
193445
+ "Roll file when size reaches (MB, minimum 5):",
193446
+ {
193447
+ defaultValue: "100"
193448
+ }
193449
+ );
193405
193450
  const intervalSeconds = await prompt(
193406
- "Roll file when time reaches (seconds):",
193451
+ "Roll file when time reaches (seconds, minimum 10):",
193407
193452
  {
193408
- defaultValue: "300"
193453
+ defaultValue: String(SINK_DEFAULTS.rolling_policy.interval_seconds)
193409
193454
  }
193410
193455
  );
193411
193456
  setupConfig.sinkConfig = {
@@ -193644,6 +193689,7 @@ var init_setup = __esm({
193644
193689
  init_helpers();
193645
193690
  init_user3();
193646
193691
  init_client7();
193692
+ init_defaults();
193647
193693
  init_pipelines2();
193648
193694
  init_utils12();
193649
193695
  pipelinesSetupCommand = createCommand({
@@ -193713,70 +193759,6 @@ var init_sinks = __esm({
193713
193759
  }
193714
193760
  });
193715
193761
 
193716
- // src/pipelines/defaults.ts
193717
- function applyDefaultsToSink(sink) {
193718
- const withDefaults = {
193719
- ...sink,
193720
- format: { ...sink.format },
193721
- config: { ...sink.config }
193722
- };
193723
- if (withDefaults.format.type === "parquet") {
193724
- if (!withDefaults.format.compression) {
193725
- withDefaults.format.compression = SINK_DEFAULTS.format.compression;
193726
- }
193727
- if (!withDefaults.format.row_group_bytes) {
193728
- withDefaults.format.row_group_bytes = SINK_DEFAULTS.format.row_group_bytes;
193729
- }
193730
- }
193731
- if (!withDefaults.config.rolling_policy) {
193732
- withDefaults.config.rolling_policy = {
193733
- file_size_bytes: SINK_DEFAULTS.rolling_policy.file_size_bytes,
193734
- interval_seconds: SINK_DEFAULTS.rolling_policy.interval_seconds
193735
- };
193736
- } else {
193737
- if (!withDefaults.config.rolling_policy.file_size_bytes) {
193738
- withDefaults.config.rolling_policy.file_size_bytes = SINK_DEFAULTS.rolling_policy.file_size_bytes;
193739
- }
193740
- if (!withDefaults.config.rolling_policy.interval_seconds) {
193741
- withDefaults.config.rolling_policy.interval_seconds = SINK_DEFAULTS.rolling_policy.interval_seconds;
193742
- }
193743
- }
193744
- if (withDefaults.type === "r2") {
193745
- if (!withDefaults.config.path) {
193746
- withDefaults.config.path = SINK_DEFAULTS.r2.path;
193747
- }
193748
- if (!withDefaults.config.partitioning) {
193749
- withDefaults.config.partitioning = SINK_DEFAULTS.r2.partitioning;
193750
- }
193751
- }
193752
- return withDefaults;
193753
- }
193754
- var SINK_DEFAULTS;
193755
- var init_defaults = __esm({
193756
- "src/pipelines/defaults.ts"() {
193757
- init_import_meta_url();
193758
- SINK_DEFAULTS = {
193759
- format: {
193760
- type: "parquet",
193761
- compression: "zstd",
193762
- row_group_bytes: 1024 * 1024 * 1024
193763
- },
193764
- rolling_policy: {
193765
- file_size_bytes: 0,
193766
- interval_seconds: 30
193767
- },
193768
- r2: {
193769
- path: "",
193770
- partitioning: {
193771
- time_pattern: "year=%Y/month=%m/day=%d"
193772
- }
193773
- },
193774
- r2_data_catalog: {}
193775
- };
193776
- __name(applyDefaultsToSink, "applyDefaultsToSink");
193777
- }
193778
- });
193779
-
193780
193762
  // src/pipelines/cli/sinks/utils.ts
193781
193763
  function displaySinkConfiguration(sink, title = "Configuration", options = {}) {
193782
193764
  const { includeTimestamps = true } = options;
@@ -193808,7 +193790,7 @@ ${title}:`);
193808
193790
  const fileSizeBytes = sink.config.rolling_policy?.file_size_bytes ?? SINK_DEFAULTS.rolling_policy.file_size_bytes;
193809
193791
  const intervalSeconds = sink.config.rolling_policy?.interval_seconds ?? SINK_DEFAULTS.rolling_policy.interval_seconds;
193810
193792
  const batching = {
193811
- "File Size": fileSizeBytes === 0 ? "none" : `${Math.round(fileSizeBytes / (1024 * 1024))}MB`,
193793
+ "File Size": fileSizeBytes === void 0 || fileSizeBytes === 0 ? "none" : `${Math.round(fileSizeBytes / (1024 * 1024))}MB`,
193812
193794
  "Time Interval": `${intervalSeconds}s`
193813
193795
  };
193814
193796
  const format9 = {
@@ -193926,8 +193908,7 @@ var init_create6 = __esm({
193926
193908
  },
193927
193909
  "roll-size": {
193928
193910
  describe: "Roll file size in MB",
193929
- type: "number",
193930
- default: SINK_DEFAULTS.rolling_policy.file_size_bytes / (1024 * 1024)
193911
+ type: "number"
193931
193912
  },
193932
193913
  "roll-interval": {
193933
193914
  describe: "Roll file interval in seconds",
@@ -194033,7 +194014,7 @@ var init_create6 = __esm({
194033
194014
  interval_seconds = args.rollInterval;
194034
194015
  }
194035
194016
  sinkConfig.config.rolling_policy = {
194036
- file_size_bytes,
194017
+ ...file_size_bytes !== void 0 && { file_size_bytes },
194037
194018
  interval_seconds
194038
194019
  };
194039
194020
  }
@@ -197050,8 +197031,8 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
197050
197031
  type: "string",
197051
197032
  demandOption: true
197052
197033
  },
197053
- targetSizeMb: {
197054
- describe: "The target size for compacted files (allowed values: 64, 128, 256, 512)",
197034
+ "target-size": {
197035
+ describe: "The target size for compacted files in MB (allowed values: 64, 128, 256, 512)",
197055
197036
  type: "number",
197056
197037
  demandOption: false,
197057
197038
  default: 128
@@ -197074,7 +197055,7 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
197074
197055
  config,
197075
197056
  accountId,
197076
197057
  args.bucket,
197077
- args.targetSizeMb
197058
+ args.targetSize
197078
197059
  );
197079
197060
  logger.log(
197080
197061
  `\u2728 Successfully enabled file compaction for the data catalog for bucket '${args.bucket}'.`
@@ -215440,7 +215421,7 @@ async function versionsUpload(props) {
215440
215421
  const { config, accountId, name: name2 } = props;
215441
215422
  let versionId = null;
215442
215423
  let workerTag = null;
215443
- let tags = null;
215424
+ let tags = [];
215444
215425
  if (accountId && name2) {
215445
215426
  try {
215446
215427
  const {
@@ -215451,7 +215432,7 @@ async function versionsUpload(props) {
215451
215432
  // TODO(consider): should this be a /versions endpoint?
215452
215433
  );
215453
215434
  workerTag = script.tag;
215454
- tags = script.tags;
215435
+ tags = script.tags ?? tags;
215455
215436
  if (script.last_deployed_from === "dash") {
215456
215437
  logger.warn(
215457
215438
  `You are about to upload a Worker Version that was last published via the Cloudflare Dashboard.
@@ -215757,13 +215738,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
215757
215738
  }
215758
215739
  throw err;
215759
215740
  }
215760
- if (hasDefinedEnvironments(config)) {
215761
- await applyServiceAndEnvironmentTags(
215762
- config,
215763
- accountId,
215764
- scriptName,
215765
- tags
215766
- );
215741
+ const nextTags = applyServiceAndEnvironmentTags(config, tags);
215742
+ if (!tagsAreEqual(tags, nextTags)) {
215743
+ try {
215744
+ await patchNonVersionedScriptSettings(config, accountId, scriptName, {
215745
+ tags: nextTags
215746
+ });
215747
+ } catch {
215748
+ warnOnErrorUpdatingServiceAndEnvironmentTags();
215749
+ }
215767
215750
  }
215768
215751
  }
215769
215752
  if (props.outFile) {
@@ -215923,6 +215906,7 @@ var init_upload5 = __esm({
215923
215906
  init_isLegacyEnv();
215924
215907
  init_print_bindings();
215925
215908
  init_retry();
215909
+ init_api();
215926
215910
  versionsUploadCommand = createCommand({
215927
215911
  metadata: {
215928
215912
  description: "Uploads your Worker code and config as a new Version",
@@ -222702,7 +222686,7 @@ async function deploy(props) {
222702
222686
  const { config, accountId, name: name2, entry } = props;
222703
222687
  let workerTag = null;
222704
222688
  let versionId = null;
222705
- let tags = null;
222689
+ let tags = [];
222706
222690
  let workerExists = true;
222707
222691
  const domainRoutes = (props.domains || []).map((domain2) => ({
222708
222692
  pattern: domain2,
@@ -222717,7 +222701,7 @@ async function deploy(props) {
222717
222701
  default_environment: { script }
222718
222702
  } = serviceMetaData;
222719
222703
  workerTag = script.tag;
222720
- tags = script.tags;
222704
+ tags = script.tags ?? tags;
222721
222705
  if (script.last_deployed_from === "dash") {
222722
222706
  let configDiff;
222723
222707
  if (getFlag("DEPLOY_REMOTE_DIFF_CHECK")) {
@@ -223111,19 +223095,25 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
223111
223095
  versionMap,
223112
223096
  void 0
223113
223097
  );
223114
- await patchNonVersionedScriptSettings(
223115
- props.config,
223116
- accountId,
223117
- scriptName,
223118
- {
223119
- tail_consumers: worker.tail_consumers,
223120
- logpush: worker.logpush,
223121
- // If the user hasn't specified observability assume that they want it disabled if they have it on.
223122
- // This is a no-op in the event that they don't have observability enabled, but will remove observability
223123
- // if it has been removed from their Wrangler configuration file
223124
- observability: worker.observability ?? { enabled: false }
223125
- }
223126
- );
223098
+ const nextTags = applyServiceAndEnvironmentTags(config, tags);
223099
+ try {
223100
+ await patchNonVersionedScriptSettings(
223101
+ props.config,
223102
+ accountId,
223103
+ scriptName,
223104
+ {
223105
+ tail_consumers: worker.tail_consumers,
223106
+ logpush: worker.logpush,
223107
+ // If the user hasn't specified observability assume that they want it disabled if they have it on.
223108
+ // This is a no-op in the event that they don't have observability enabled, but will remove observability
223109
+ // if it has been removed from their Wrangler configuration file
223110
+ observability: worker.observability ?? { enabled: false },
223111
+ tags: nextTags
223112
+ }
223113
+ );
223114
+ } catch {
223115
+ warnOnErrorUpdatingServiceAndEnvironmentTags();
223116
+ }
223127
223117
  result = {
223128
223118
  id: null,
223129
223119
  // fpw - ignore
@@ -223153,14 +223143,21 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
223153
223143
  })
223154
223144
  )
223155
223145
  );
223156
- }
223157
- if (hasDefinedEnvironments(config)) {
223158
- await applyServiceAndEnvironmentTags(
223159
- config,
223160
- accountId,
223161
- scriptName,
223162
- tags
223163
- );
223146
+ const nextTags = applyServiceAndEnvironmentTags(config, tags);
223147
+ if (!tagsAreEqual(tags, nextTags)) {
223148
+ try {
223149
+ await patchNonVersionedScriptSettings(
223150
+ props.config,
223151
+ accountId,
223152
+ scriptName,
223153
+ {
223154
+ tags: nextTags
223155
+ }
223156
+ );
223157
+ } catch {
223158
+ warnOnErrorUpdatingServiceAndEnvironmentTags();
223159
+ }
223160
+ }
223164
223161
  }
223165
223162
  if (result.startup_time_ms) {
223166
223163
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");