@cloudflare/vite-plugin 1.53.1 → 1.54.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/dist/index.mjs CHANGED
@@ -43,8 +43,8 @@ import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$
43
43
  import { fileURLToPath as fileURLToPath$1 } from "url";
44
44
  import { createRequire as createRequire$1 } from "module";
45
45
 
46
- //#region ../workers-utils/dist/chunk-QKX75RGI.mjs
47
- var DEFAULT_COMPAT_DATE = "2026-08-20";
46
+ //#region ../workers-utils/dist/chunk-SUQD2A5M.mjs
47
+ var DEFAULT_COMPAT_DATE = "2026-08-25";
48
48
  function assertNever(_value) {}
49
49
  __name$5(assertNever, "assertNever");
50
50
  function mapWorkerMetadataBindings(bindings$1) {
@@ -41745,6 +41745,14 @@ var validateDurableObjectBinding$1 = /* @__PURE__ */ __name$5((diagnostics, fiel
41745
41745
  return isValid;
41746
41746
  }, "validateDurableObjectBinding");
41747
41747
  var workflowNameFormatMessage$1 = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
41748
+ function validateWorkflowRetentionValue$1(diagnostics, field, key, value) {
41749
+ const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
41750
+ const isValidString = typeof value === "string" && value.length > 0;
41751
+ if (isValidNumber || isValidString) return true;
41752
+ diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
41753
+ return false;
41754
+ }
41755
+ __name$5(validateWorkflowRetentionValue$1, "validateWorkflowRetentionValue");
41748
41756
  var validateWorkflowBinding$1 = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
41749
41757
  if (typeof value !== "object" || value === null) {
41750
41758
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -41803,13 +41811,22 @@ var validateWorkflowBinding$1 = /* @__PURE__ */ __name$5((diagnostics, field, va
41803
41811
  }
41804
41812
  validateAdditionalProperties$1(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
41805
41813
  }
41814
+ if (hasProperty$1(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
41815
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
41816
+ isValid = false;
41817
+ } else {
41818
+ const defaultRetention = value.default_retention;
41819
+ for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue$1(diagnostics, field, key, defaultRetention[key])) isValid = false;
41820
+ validateAdditionalProperties$1(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
41821
+ }
41806
41822
  validateAdditionalProperties$1(diagnostics, field, Object.keys(value), [
41807
41823
  "binding",
41808
41824
  "name",
41809
41825
  "class_name",
41810
41826
  "script_name",
41811
41827
  "limits",
41812
- "schedules"
41828
+ "schedules",
41829
+ "default_retention"
41813
41830
  ]);
41814
41831
  return isValid;
41815
41832
  }, "validateWorkflowBinding");
@@ -53906,6 +53923,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
53906
53923
  var __commonJS$2 = (cb, mod$1) => function() {
53907
53924
  return mod$1 || (0, cb[__getOwnPropNames(cb)[0]])((mod$1 = { exports: {} }).exports, mod$1), mod$1.exports;
53908
53925
  };
53926
+ const RemoteBindingDevSchema = strictObject$1({ remote: boolean$1().optional() });
53909
53927
  const AssetsSchema = strictObject$1({
53910
53928
  htmlHandling: _enum$1([
53911
53929
  "auto-trailing-slash",
@@ -53922,38 +53940,37 @@ const AssetsSchema = strictObject$1({
53922
53940
  });
53923
53941
  const BrowserBindingSchema = strictObject$1({
53924
53942
  type: literal$2("browser"),
53925
- remote: boolean$1().optional()
53943
+ dev: RemoteBindingDevSchema.optional()
53926
53944
  });
53927
53945
  const WorkerBindingSchema = strictObject$1({
53928
53946
  type: literal$2("worker"),
53929
53947
  workerName: string$1(),
53930
53948
  exportName: string$1().optional(),
53931
53949
  props: record$1(string$1(), unknown$1()).optional(),
53932
- remote: boolean$1().optional()
53950
+ dev: RemoteBindingDevSchema.optional()
53933
53951
  });
53934
53952
  const D1BindingSchema = strictObject$1({
53935
53953
  type: literal$2("d1"),
53936
53954
  name: string$1().optional(),
53937
53955
  id: string$1().optional(),
53938
- remote: boolean$1().optional()
53956
+ dev: RemoteBindingDevSchema.optional()
53939
53957
  });
53940
53958
  const KVBindingSchema = strictObject$1({
53941
53959
  type: literal$2("kv"),
53942
53960
  id: string$1().optional(),
53943
- remote: boolean$1().optional()
53961
+ dev: RemoteBindingDevSchema.optional()
53944
53962
  });
53945
53963
  const QueueBindingSchema = strictObject$1({
53946
53964
  type: literal$2("queue"),
53947
53965
  name: string$1().optional(),
53948
53966
  deliveryDelay: number$1().optional(),
53949
- remote: boolean$1().optional()
53967
+ dev: RemoteBindingDevSchema.optional()
53950
53968
  });
53951
53969
  const R2BindingSchema = strictObject$1({
53952
53970
  type: literal$2("r2"),
53953
53971
  name: string$1().optional(),
53954
53972
  jurisdiction: string$1().optional(),
53955
- remote: boolean$1().optional(),
53956
- localDev: strictObject$1({ experimentalS3Credentials: object$1({
53973
+ dev: RemoteBindingDevSchema.extend({ experimentalS3Credentials: object$1({
53957
53974
  accessKeyId: string$1(),
53958
53975
  secretAccessKey: string$1()
53959
53976
  }).optional() }).optional()
@@ -53965,38 +53982,38 @@ const AnalyticsEngineDatasetBindingSchema = strictObject$1({
53965
53982
  const FlagshipBindingSchema = strictObject$1({
53966
53983
  type: literal$2("flagship"),
53967
53984
  id: string$1().optional(),
53968
- remote: boolean$1().optional()
53985
+ dev: RemoteBindingDevSchema.optional()
53969
53986
  });
53970
53987
  const HyperdriveBindingSchema = strictObject$1({
53971
53988
  type: literal$2("hyperdrive"),
53972
53989
  id: string$1(),
53973
- localConnectionString: string$1().optional()
53990
+ dev: strictObject$1({ connectionString: string$1().optional() }).optional()
53974
53991
  });
53975
53992
  const KnownBindingSchema = discriminatedUnion$1("type", [
53976
53993
  strictObject$1({
53977
53994
  type: literal$2("agent-memory"),
53978
53995
  namespace: string$1(),
53979
- remote: boolean$1().optional()
53996
+ dev: RemoteBindingDevSchema.optional()
53980
53997
  }),
53981
53998
  strictObject$1({
53982
53999
  type: literal$2("ai"),
53983
- remote: boolean$1().optional()
54000
+ dev: RemoteBindingDevSchema.optional()
53984
54001
  }),
53985
54002
  strictObject$1({
53986
54003
  type: literal$2("ai-search"),
53987
54004
  name: string$1(),
53988
- remote: boolean$1().optional()
54005
+ dev: RemoteBindingDevSchema.optional()
53989
54006
  }),
53990
54007
  strictObject$1({
53991
54008
  type: literal$2("ai-search-namespace"),
53992
54009
  namespace: string$1(),
53993
- remote: boolean$1().optional()
54010
+ dev: RemoteBindingDevSchema.optional()
53994
54011
  }),
53995
54012
  AnalyticsEngineDatasetBindingSchema,
53996
54013
  strictObject$1({
53997
54014
  type: literal$2("artifacts"),
53998
54015
  namespace: string$1(),
53999
- remote: boolean$1().optional()
54016
+ dev: RemoteBindingDevSchema.optional()
54000
54017
  }),
54001
54018
  strictObject$1({ type: literal$2("assets") }),
54002
54019
  BrowserBindingSchema,
@@ -54008,7 +54025,7 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
54008
54025
  workerName: string$1(),
54009
54026
  parameters: array$1(string$1()).optional()
54010
54027
  }).optional(),
54011
- remote: boolean$1().optional()
54028
+ dev: RemoteBindingDevSchema.optional()
54012
54029
  }),
54013
54030
  strictObject$1({
54014
54031
  type: literal$2("durable-object"),
@@ -54019,7 +54036,7 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
54019
54036
  HyperdriveBindingSchema,
54020
54037
  strictObject$1({
54021
54038
  type: literal$2("images"),
54022
- remote: boolean$1().optional()
54039
+ dev: RemoteBindingDevSchema.optional()
54023
54040
  }),
54024
54041
  strictObject$1({
54025
54042
  type: literal$2("json"),
@@ -54032,17 +54049,17 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
54032
54049
  }),
54033
54050
  strictObject$1({
54034
54051
  type: literal$2("media"),
54035
- remote: boolean$1().optional()
54052
+ dev: RemoteBindingDevSchema.optional()
54036
54053
  }),
54037
54054
  strictObject$1({
54038
54055
  type: literal$2("mtls-certificate"),
54039
54056
  id: string$1(),
54040
- remote: boolean$1().optional()
54057
+ dev: RemoteBindingDevSchema.optional()
54041
54058
  }),
54042
54059
  strictObject$1({
54043
54060
  type: literal$2("pipeline"),
54044
54061
  name: string$1(),
54045
- remote: boolean$1().optional()
54062
+ dev: RemoteBindingDevSchema.optional()
54046
54063
  }),
54047
54064
  QueueBindingSchema,
54048
54065
  strictObject$1({
@@ -54065,11 +54082,11 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
54065
54082
  destinationAddress: string$1().optional(),
54066
54083
  allowedDestinationAddresses: array$1(string$1()).optional(),
54067
54084
  allowedSenderAddresses: array$1(string$1()).optional(),
54068
- remote: boolean$1().optional()
54069
- }),
54085
+ dev: RemoteBindingDevSchema.optional()
54086
+ }).refine((value) => value.destinationAddress === void 0 || value.allowedDestinationAddresses === void 0, { message: "\"send-email\" bindings cannot specify both \"destinationAddress\" and \"allowedDestinationAddresses\"" }),
54070
54087
  strictObject$1({
54071
54088
  type: literal$2("stream"),
54072
- remote: boolean$1().optional()
54089
+ dev: RemoteBindingDevSchema.optional()
54073
54090
  }),
54074
54091
  strictObject$1({
54075
54092
  type: literal$2("text"),
@@ -54078,29 +54095,26 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
54078
54095
  strictObject$1({
54079
54096
  type: literal$2("vectorize"),
54080
54097
  name: string$1(),
54081
- remote: boolean$1().optional()
54098
+ dev: RemoteBindingDevSchema.optional()
54082
54099
  }),
54083
54100
  strictObject$1({ type: literal$2("version-metadata") }),
54084
54101
  strictObject$1({
54085
54102
  type: literal$2("vpc-service"),
54086
54103
  id: string$1(),
54087
- remote: boolean$1().optional()
54104
+ dev: RemoteBindingDevSchema.optional()
54088
54105
  }),
54089
54106
  strictObject$1({
54090
54107
  type: literal$2("vpc-network"),
54091
54108
  tunnelId: string$1().optional(),
54092
54109
  networkId: string$1().optional(),
54093
- remote: boolean$1().optional()
54094
- }).superRefine((value, ctx) => {
54095
- const hasTunnel = value.tunnelId !== void 0;
54096
- if (hasTunnel === (value.networkId !== void 0)) ctx.addIssue({
54097
- code: "custom",
54098
- message: hasTunnel ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`
54099
- });
54100
- }),
54110
+ dev: RemoteBindingDevSchema.optional()
54111
+ }).refine((value) => value.tunnelId !== void 0 !== (value.networkId !== void 0), { error: ({ input }) => {
54112
+ const value = input;
54113
+ return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
54114
+ } }),
54101
54115
  strictObject$1({
54102
54116
  type: literal$2("web-search"),
54103
- remote: boolean$1().optional()
54117
+ dev: RemoteBindingDevSchema.optional()
54104
54118
  }),
54105
54119
  WorkerBindingSchema,
54106
54120
  strictObject$1({ type: literal$2("worker-loader") })
@@ -54324,30 +54338,39 @@ const BaseWorkerSchema = strictObject$1({
54324
54338
  */
54325
54339
  const InputWorkerSchema = BaseWorkerSchema.extend({ entrypoint: union$1([string$1(), strictObject$1({ default: string$1() })]).transform((value) => typeof value === "string" ? value : value.default).optional() });
54326
54340
  /**
54327
- * Settings schema — validates the named `settings` export of a
54341
+ * Input settings schema — validates the named `settings` export of a
54328
54342
  * `cloudflare.config.ts`. Holds account/deployment settings shared by the other exports.
54329
54343
  */
54330
- const SettingsSchema = strictObject$1({
54344
+ const InputSettingsSchema = strictObject$1({
54331
54345
  type: literal$2("settings"),
54332
54346
  accountId: string$1().optional(),
54333
54347
  complianceRegion: _enum$1(["public", "fedramp-high"]).optional()
54334
54348
  });
54335
54349
  /**
54336
- * Discriminated union of the config kinds a single export may resolve to.
54350
+ * Output settings schema the shape of the top-level `config.json` in the
54351
+ * Build Output Specification. Adds the `mode` the build was produced in.
54337
54352
  */
54338
- const ConfigExportSchema = discriminatedUnion$1("type", [InputWorkerSchema, SettingsSchema]);
54353
+ const OutputSettingsSchema = InputSettingsSchema.extend({ mode: string$1().optional() });
54339
54354
  const SETTINGS_EXPORT_NAME = "settings";
54340
- /**
54341
- * Schema for the resolved config exports, keyed by export
54342
- * name. Each value is discriminated on its `type` field. Reserves the
54343
- * `settings` export name exclusively for settings configs: a `settings`
54344
- * config must live on the `settings` export, and the `settings` export
54345
- * may only hold a `settings` config.
54346
- */
54347
- const ConfigExportsSchema = record$1(string$1(), ConfigExportSchema).check((ctx) => {
54355
+ const SUPPORTED_EXPORT_TYPES = new Set(["worker", "settings"]);
54356
+ function invalidConfigExportMessage(exportName) {
54357
+ return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
54358
+ }
54359
+ const ConfigExportsTypeSchema = record$1(string$1(), unknown$1()).check((ctx) => {
54348
54360
  for (const [key, value] of Object.entries(ctx.value)) {
54361
+ const isObject$5 = typeof value === "object" && value !== null;
54362
+ const type = isObject$5 && "type" in value ? value.type : void 0;
54363
+ if (typeof type !== "string" || !SUPPORTED_EXPORT_TYPES.has(type)) {
54364
+ ctx.issues.push({
54365
+ code: "custom",
54366
+ input: value,
54367
+ path: isObject$5 ? [key, "type"] : [key],
54368
+ message: invalidConfigExportMessage(key)
54369
+ });
54370
+ continue;
54371
+ }
54349
54372
  const isSettingsName = key === SETTINGS_EXPORT_NAME;
54350
- const isSettingsType = value.type === "settings";
54373
+ const isSettingsType = type === "settings";
54351
54374
  if (isSettingsType && !isSettingsName) ctx.issues.push({
54352
54375
  code: "custom",
54353
54376
  input: value,
@@ -54358,10 +54381,19 @@ const ConfigExportsSchema = record$1(string$1(), ConfigExportSchema).check((ctx)
54358
54381
  code: "custom",
54359
54382
  input: value,
54360
54383
  path: [key],
54361
- message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${value.type}\` config.`
54384
+ message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${type}\` config.`
54362
54385
  });
54363
54386
  }
54364
54387
  });
54388
+ const ConfigExportsObjectSchema = object$1({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
54389
+ /**
54390
+ * Schema for the resolved config exports, keyed by export
54391
+ * name. Each value is discriminated on its `type` field. Reserves the
54392
+ * `settings` export name exclusively for settings configs: a `settings`
54393
+ * config must live on the `settings` export, and the `settings` export
54394
+ * may only hold a `settings` config.
54395
+ */
54396
+ const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
54365
54397
  const ModuleTypeSchema = _enum$1([
54366
54398
  "esm",
54367
54399
  "cjs",
@@ -57090,27 +57122,27 @@ function convertBindingsAndAssets(config$3, result) {
57090
57122
  agentMemory.push(omitUndefined({
57091
57123
  binding: name,
57092
57124
  namespace: binding.namespace,
57093
- remote: binding.remote
57125
+ remote: binding.dev?.remote
57094
57126
  }));
57095
57127
  break;
57096
57128
  case "ai":
57097
57129
  result.ai = omitUndefined({
57098
57130
  binding: name,
57099
- remote: binding.remote
57131
+ remote: binding.dev?.remote
57100
57132
  });
57101
57133
  break;
57102
57134
  case "ai-search":
57103
57135
  aiSearch.push(omitUndefined({
57104
57136
  binding: name,
57105
57137
  instance_name: binding.name,
57106
- remote: binding.remote
57138
+ remote: binding.dev?.remote
57107
57139
  }));
57108
57140
  break;
57109
57141
  case "ai-search-namespace":
57110
57142
  aiSearchNamespaces.push(omitUndefined({
57111
57143
  binding: name,
57112
57144
  namespace: binding.namespace,
57113
- remote: binding.remote
57145
+ remote: binding.dev?.remote
57114
57146
  }));
57115
57147
  break;
57116
57148
  case "analytics-engine-dataset":
@@ -57123,7 +57155,7 @@ function convertBindingsAndAssets(config$3, result) {
57123
57155
  artifacts.push(omitUndefined({
57124
57156
  binding: name,
57125
57157
  namespace: binding.namespace,
57126
- remote: binding.remote
57158
+ remote: binding.dev?.remote
57127
57159
  }));
57128
57160
  break;
57129
57161
  case "assets":
@@ -57132,7 +57164,7 @@ function convertBindingsAndAssets(config$3, result) {
57132
57164
  case "browser":
57133
57165
  result.browser = omitUndefined({
57134
57166
  binding: name,
57135
- remote: binding.remote
57167
+ remote: binding.dev?.remote
57136
57168
  });
57137
57169
  break;
57138
57170
  case "d1":
@@ -57140,7 +57172,7 @@ function convertBindingsAndAssets(config$3, result) {
57140
57172
  binding: name,
57141
57173
  database_id: binding.id,
57142
57174
  database_name: binding.name,
57143
- remote: binding.remote
57175
+ remote: binding.dev?.remote
57144
57176
  }));
57145
57177
  break;
57146
57178
  case "dispatch-namespace": {
@@ -57152,7 +57184,7 @@ function convertBindingsAndAssets(config$3, result) {
57152
57184
  service: binding.outbound.workerName,
57153
57185
  parameters: binding.outbound.parameters
57154
57186
  });
57155
- if (binding.remote !== void 0) entry.remote = binding.remote;
57187
+ if (binding.dev?.remote !== void 0) entry.remote = binding.dev.remote;
57156
57188
  dispatchNamespaces.push(entry);
57157
57189
  break;
57158
57190
  }
@@ -57167,20 +57199,20 @@ function convertBindingsAndAssets(config$3, result) {
57167
57199
  flagship.push(omitUndefined({
57168
57200
  binding: name,
57169
57201
  app_id: binding.id,
57170
- remote: binding.remote
57202
+ remote: binding.dev?.remote
57171
57203
  }));
57172
57204
  break;
57173
57205
  case "hyperdrive":
57174
57206
  hyperdrive.push(omitUndefined({
57175
57207
  binding: name,
57176
57208
  id: binding.id,
57177
- localConnectionString: binding.localConnectionString
57209
+ localConnectionString: binding.dev?.connectionString
57178
57210
  }));
57179
57211
  break;
57180
57212
  case "images":
57181
57213
  result.images = omitUndefined({
57182
57214
  binding: name,
57183
- remote: binding.remote
57215
+ remote: binding.dev?.remote
57184
57216
  });
57185
57217
  break;
57186
57218
  case "json":
@@ -57190,7 +57222,7 @@ function convertBindingsAndAssets(config$3, result) {
57190
57222
  kvNamespaces.push(omitUndefined({
57191
57223
  binding: name,
57192
57224
  id: binding.id,
57193
- remote: binding.remote
57225
+ remote: binding.dev?.remote
57194
57226
  }));
57195
57227
  break;
57196
57228
  case "logfwdr":
@@ -57202,21 +57234,21 @@ function convertBindingsAndAssets(config$3, result) {
57202
57234
  case "media":
57203
57235
  result.media = omitUndefined({
57204
57236
  binding: name,
57205
- remote: binding.remote
57237
+ remote: binding.dev?.remote
57206
57238
  });
57207
57239
  break;
57208
57240
  case "mtls-certificate":
57209
57241
  mtlsCertificates.push(omitUndefined({
57210
57242
  binding: name,
57211
57243
  certificate_id: binding.id,
57212
- remote: binding.remote
57244
+ remote: binding.dev?.remote
57213
57245
  }));
57214
57246
  break;
57215
57247
  case "pipeline":
57216
57248
  pipelines.push(omitUndefined({
57217
57249
  binding: name,
57218
57250
  stream: binding.name,
57219
- remote: binding.remote
57251
+ remote: binding.dev?.remote
57220
57252
  }));
57221
57253
  break;
57222
57254
  case "queue":
@@ -57224,7 +57256,7 @@ function convertBindingsAndAssets(config$3, result) {
57224
57256
  binding: name,
57225
57257
  queue: binding.name,
57226
57258
  delivery_delay: binding.deliveryDelay,
57227
- remote: binding.remote
57259
+ remote: binding.dev?.remote
57228
57260
  }));
57229
57261
  break;
57230
57262
  case "rate-limit":
@@ -57235,12 +57267,12 @@ function convertBindingsAndAssets(config$3, result) {
57235
57267
  });
57236
57268
  break;
57237
57269
  case "r2": {
57238
- const experimentalS3Credentials = binding.localDev?.experimentalS3Credentials;
57270
+ const experimentalS3Credentials = binding.dev?.experimentalS3Credentials;
57239
57271
  r2Buckets.push(omitUndefined({
57240
57272
  binding: name,
57241
57273
  bucket_name: binding.name,
57242
57274
  jurisdiction: binding.jurisdiction,
57243
- remote: binding.remote,
57275
+ remote: binding.dev?.remote,
57244
57276
  local_dev: experimentalS3Credentials === void 0 ? void 0 : { experimental_s3_credentials: experimentalS3Credentials }
57245
57277
  }));
57246
57278
  break;
@@ -57261,13 +57293,13 @@ function convertBindingsAndAssets(config$3, result) {
57261
57293
  destination_address: binding.destinationAddress,
57262
57294
  allowed_destination_addresses: binding.allowedDestinationAddresses,
57263
57295
  allowed_sender_addresses: binding.allowedSenderAddresses,
57264
- remote: binding.remote
57296
+ remote: binding.dev?.remote
57265
57297
  }));
57266
57298
  break;
57267
57299
  case "stream":
57268
57300
  result.stream = omitUndefined({
57269
57301
  binding: name,
57270
- remote: binding.remote
57302
+ remote: binding.dev?.remote
57271
57303
  });
57272
57304
  break;
57273
57305
  case "text":
@@ -57277,7 +57309,7 @@ function convertBindingsAndAssets(config$3, result) {
57277
57309
  vectorize.push(omitUndefined({
57278
57310
  binding: name,
57279
57311
  index_name: binding.name,
57280
- remote: binding.remote
57312
+ remote: binding.dev?.remote
57281
57313
  }));
57282
57314
  break;
57283
57315
  case "version-metadata":
@@ -57287,25 +57319,25 @@ function convertBindingsAndAssets(config$3, result) {
57287
57319
  vpcServices.push(omitUndefined({
57288
57320
  binding: name,
57289
57321
  service_id: binding.id,
57290
- remote: binding.remote
57322
+ remote: binding.dev?.remote
57291
57323
  }));
57292
57324
  break;
57293
57325
  case "vpc-network":
57294
57326
  if (binding.tunnelId !== void 0) vpcNetworks.push(omitUndefined({
57295
57327
  binding: name,
57296
57328
  tunnel_id: binding.tunnelId,
57297
- remote: binding.remote
57329
+ remote: binding.dev?.remote
57298
57330
  }));
57299
57331
  else if (binding.networkId !== void 0) vpcNetworks.push(omitUndefined({
57300
57332
  binding: name,
57301
57333
  network_id: binding.networkId,
57302
- remote: binding.remote
57334
+ remote: binding.dev?.remote
57303
57335
  }));
57304
57336
  break;
57305
57337
  case "web-search":
57306
57338
  result.websearch = omitUndefined({
57307
57339
  binding: name,
57308
- remote: binding.remote
57340
+ remote: binding.dev?.remote
57309
57341
  });
57310
57342
  break;
57311
57343
  case "worker":
@@ -57314,7 +57346,7 @@ function convertBindingsAndAssets(config$3, result) {
57314
57346
  service: binding.workerName,
57315
57347
  entrypoint: binding.exportName,
57316
57348
  props: binding.props,
57317
- remote: binding.remote
57349
+ remote: binding.dev?.remote
57318
57350
  }));
57319
57351
  break;
57320
57352
  case "worker-loader":
@@ -98638,6 +98670,14 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name$3((diagnostics, field,
98638
98670
  return isValid;
98639
98671
  }, "validateDurableObjectBinding");
98640
98672
  var workflowNameFormatMessage = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
98673
+ function validateWorkflowRetentionValue(diagnostics, field, key, value) {
98674
+ const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
98675
+ const isValidString = typeof value === "string" && value.length > 0;
98676
+ if (isValidNumber || isValidString) return true;
98677
+ diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
98678
+ return false;
98679
+ }
98680
+ __name$3(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
98641
98681
  var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
98642
98682
  if (typeof value !== "object" || value === null) {
98643
98683
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -98696,13 +98736,22 @@ var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, valu
98696
98736
  }
98697
98737
  validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
98698
98738
  }
98739
+ if (hasProperty(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
98740
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
98741
+ isValid = false;
98742
+ } else {
98743
+ const defaultRetention = value.default_retention;
98744
+ for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, key, defaultRetention[key])) isValid = false;
98745
+ validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
98746
+ }
98699
98747
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
98700
98748
  "binding",
98701
98749
  "name",
98702
98750
  "class_name",
98703
98751
  "script_name",
98704
98752
  "limits",
98705
- "schedules"
98753
+ "schedules",
98754
+ "default_retention"
98706
98755
  ]);
98707
98756
  return isValid;
98708
98757
  }, "validateWorkflowBinding");
@@ -102431,9 +102480,11 @@ function getBuildOutputDir(root) {
102431
102480
  /**
102432
102481
  * Absolute path to the top-level `config.json` for the current project.
102433
102482
  *
102434
- * This corresponds with the `settings` export in the input `cloudflare.config.ts`.
102483
+ * Holds the project-level settings shared by every Worker: those declared by
102484
+ * the `settings` export of the input `cloudflare.config.ts`, including the
102485
+ * mode the build was produced in.
102435
102486
  */
102436
- function getRootConfigPath(root) {
102487
+ function getSettingsConfigPath(root) {
102437
102488
  return path2.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, CONFIG_FILENAME);
102438
102489
  }
102439
102490
  /**
@@ -102518,13 +102569,25 @@ async function writeWorkerConfig(root, parsedConfig, manifest) {
102518
102569
  await fsp.writeFile(getWorkerConfigPath(root), JSON.stringify(outputConfig));
102519
102570
  }
102520
102571
  /**
102521
- * Write the top-level `config.json` holding shared settings to the Build
102522
- * Output Specification tree.
102572
+ * Write the top-level `config.json` to the Build Output Specification tree.
102573
+ *
102574
+ * Holds the project-level settings shared by every Worker: those declared by
102575
+ * the `settings` export, including the `mode`, which is supplied at build time
102576
+ * rather than declared. Always written, even when there are no declared
102577
+ * settings and no mode: the result then degrades to `{ "type": "settings" }`.
102578
+ *
102579
+ * `mode` is omitted when undefined, which is the case for Wrangler builds that
102580
+ * selected no mode (Vite always resolves one).
102523
102581
  */
102524
- async function writeRootConfig(root, settings) {
102525
- const configPath = getRootConfigPath(root);
102582
+ async function writeSettingsConfig(root, settings, mode) {
102583
+ const outputConfig = {
102584
+ ...settings,
102585
+ type: "settings",
102586
+ ...mode !== void 0 ? { mode } : {}
102587
+ };
102588
+ const configPath = getSettingsConfigPath(root);
102526
102589
  await fsp.mkdir(path2.dirname(configPath), { recursive: true });
102527
- await fsp.writeFile(configPath, JSON.stringify(settings));
102590
+ await fsp.writeFile(configPath, JSON.stringify(outputConfig));
102528
102591
  }
102529
102592
  const BUILD_OUTPUT_ERROR_PREFIX = "Build Output Specification: ";
102530
102593
  /**
@@ -102541,7 +102604,7 @@ var BuildOutputError = class extends Error {
102541
102604
  * Read and validate the Build Output Specification tree at
102542
102605
  * `<root>/.cloudflare/output/v0/`.
102543
102606
  *
102544
- * Reads the optional top-level `config.json` settings, then reads and
102607
+ * Reads the optional top-level settings `config.json`, then reads and
102545
102608
  * schema-validates the Worker's `config.json` and resolves its
102546
102609
  * `bundle/` / `assets/` directories.
102547
102610
  *
@@ -102560,12 +102623,13 @@ async function readBuildOutput(root) {
102560
102623
  * Read and schema-validate the Worker's `config.json` and resolve its
102561
102624
  * `bundle/` / `assets/` directories.
102562
102625
  *
102626
+ * @returns the Worker, with whichever of its directories exist resolved.
102563
102627
  * @throws {BuildOutputError} if the config is missing, is not valid JSON, or
102564
102628
  * fails schema validation.
102565
102629
  */
102566
102630
  async function readWorker(root) {
102567
102631
  const configPath = getWorkerConfigPath(root);
102568
- if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`No Worker config found at ${configPath}.`);
102632
+ if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`no Worker config found at ${configPath}.`);
102569
102633
  const contents = await fsp.readFile(configPath, "utf-8");
102570
102634
  const result = OutputWorkerSchema.safeParse(parseJson(contents, configPath));
102571
102635
  if (!result.success) throw new BuildOutputError(`invalid Worker config at ${configPath}.\n${result.error.message}`);
@@ -102590,18 +102654,22 @@ async function readWorker(root) {
102590
102654
  }
102591
102655
  /**
102592
102656
  * Read and schema-validate the optional top-level `config.json` holding the
102593
- * project-level settings shared by every Worker.
102657
+ * project-level settings shared by every Worker, including the mode the build
102658
+ * was produced in.
102659
+ *
102660
+ * Returned whole: consumers that need only the settings the user declared
102661
+ * narrow it themselves.
102594
102662
  *
102595
102663
  * @returns the parsed settings, or `undefined` when the file is absent.
102596
102664
  * @throws {BuildOutputError} if the file is not valid JSON or fails schema
102597
102665
  * validation.
102598
102666
  */
102599
102667
  async function readSettings(root) {
102600
- const configPath = getRootConfigPath(root);
102668
+ const configPath = getSettingsConfigPath(root);
102601
102669
  if (!fs$1.existsSync(configPath)) return;
102602
102670
  const contents = await fsp.readFile(configPath, "utf-8");
102603
- const result = SettingsSchema.safeParse(parseJson(contents, configPath));
102604
- if (!result.success) throw new BuildOutputError(`invalid root config at ${configPath}.\n${result.error.message}`);
102671
+ const result = OutputSettingsSchema.safeParse(parseJson(contents, configPath));
102672
+ if (!result.success) throw new BuildOutputError(`invalid settings config at ${configPath}.\n${result.error.message}`);
102605
102673
  return result.data;
102606
102674
  }
102607
102675
  function parseJson(contents, configPath) {
@@ -111665,7 +111733,7 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
111665
111733
  const workerNewConfig$1 = defaultExport?.type === "worker" ? defaultExport : void 0;
111666
111734
  assert2(workerNewConfig$1, "Expected a default worker export on assets-only resolved config");
111667
111735
  await writeWorkerConfig(ctx.resolvedViteConfig.root, workerNewConfig$1);
111668
- await writeSettingsConfig();
111736
+ await writeSettings();
111669
111737
  return;
111670
111738
  }
111671
111739
  if (ctx.resolvedPluginConfig.type === "workers" && this.environment.name !== ctx.resolvedPluginConfig.entryWorkerEnvironmentName) return;
@@ -111685,14 +111753,20 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
111685
111753
  mainModule: entryChunk.fileName,
111686
111754
  modules
111687
111755
  });
111688
- await writeSettingsConfig();
111756
+ await writeSettings();
111689
111757
  } };
111690
- async function writeSettingsConfig() {
111758
+ /**
111759
+ * Write the top-level `config.json`, recording the settings shared by every
111760
+ * Worker, including the Vite mode the build ran in.
111761
+ *
111762
+ * Written even when there is no `settings` export, so the mode is always
111763
+ * captured.
111764
+ */
111765
+ async function writeSettings() {
111691
111766
  if (ctx.resolvedPluginConfig.type === "preview") return;
111692
111767
  const settingsExport = ctx.resolvedPluginConfig.parsedNewConfig?.settings;
111693
111768
  const settings = settingsExport?.type === "settings" ? settingsExport : void 0;
111694
- if (!settings) return;
111695
- await writeRootConfig(ctx.resolvedViteConfig.root, settings);
111769
+ await writeSettingsConfig(ctx.resolvedViteConfig.root, settings, ctx.resolvedViteConfig.mode);
111696
111770
  }
111697
111771
  });
111698
111772
  /**
@@ -118387,7 +118461,7 @@ var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
118387
118461
  });
118388
118462
 
118389
118463
  //#endregion
118390
- //#region ../workers-auth/dist/chunk-EGLFJKUK.mjs
118464
+ //#region ../workers-auth/dist/chunk-LQW53VED.mjs
118391
118465
  var import_undici$2 = require_undici();
118392
118466
  var hasWarnedAboutDeprecatedV1ApiToken = false;
118393
118467
  function readStoredAuthState(options) {
@@ -121008,7 +121082,7 @@ function probeSecretTool() {
121008
121082
  if (cachedProbeResult !== void 0) return cachedProbeResult;
121009
121083
  let result;
121010
121084
  try {
121011
- result = runner(["--version"]).status === 0;
121085
+ result = runner(["--version"]).error === void 0;
121012
121086
  } catch {
121013
121087
  result = false;
121014
121088
  }
@@ -121343,7 +121417,7 @@ function scrubEncryptedCredentials(options) {
121343
121417
  __name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
121344
121418
 
121345
121419
  //#endregion
121346
- //#region ../workers-auth/dist/chunk-X7ZLU22G.mjs
121420
+ //#region ../workers-auth/dist/chunk-YCVYA5LL.mjs
121347
121421
  function createPreferences(getConfigPath) {
121348
121422
  function getUserPreferencesPath() {
121349
121423
  return path2__default.resolve(getConfigPath(), "preferences.json");
@@ -122906,7 +122980,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$4({ "../../node_modules/
122906
122980
  }) });
122907
122981
 
122908
122982
  //#endregion
122909
- //#region ../deploy-helpers/dist/chunk-LRKPOFWK.mjs
122983
+ //#region ../deploy-helpers/dist/chunk-ZV7SJ2MZ.mjs
122910
122984
  var import_undici$1 = require_undici();
122911
122985
  var import_command_exists = require_command_exists();
122912
122986
  function assertNever$1(_value) {}
@@ -122937,10 +123011,22 @@ function convertConfigToBindings(config$3, options) {
122937
123011
  break;
122938
123012
  case "send_email":
122939
123013
  if (pages) break;
122940
- for (const { name,...x } of info$1) output[name] = {
122941
- type: "send_email",
122942
- ...x
122943
- };
123014
+ for (const { name, destination_address, allowed_destination_addresses, allowed_sender_addresses, remote } of info$1) {
123015
+ const shared = {
123016
+ type: "send_email",
123017
+ allowed_sender_addresses,
123018
+ remote
123019
+ };
123020
+ if (destination_address !== void 0) output[name] = {
123021
+ ...shared,
123022
+ destination_address
123023
+ };
123024
+ else if (allowed_destination_addresses !== void 0) output[name] = {
123025
+ ...shared,
123026
+ allowed_destination_addresses
123027
+ };
123028
+ else output[name] = shared;
123029
+ }
122944
123030
  break;
122945
123031
  case "wasm_modules":
122946
123032
  if (pages) break;
@@ -123368,16 +123454,20 @@ function createWorkerUploadForm(worker, bindings$1, options) {
123368
123454
  });
123369
123455
  });
123370
123456
  send_email.forEach((emailBinding) => {
123371
- const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
123372
- const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
123373
- const allowed_sender_addresses = "allowed_sender_addresses" in emailBinding ? emailBinding.allowed_sender_addresses : void 0;
123374
- metadataBindings.push({
123457
+ const shared = {
123375
123458
  name: emailBinding.name,
123376
123459
  type: "send_email",
123377
- destination_address,
123378
- allowed_destination_addresses,
123379
- allowed_sender_addresses
123460
+ allowed_sender_addresses: emailBinding.allowed_sender_addresses
123461
+ };
123462
+ if (emailBinding.destination_address !== void 0) metadataBindings.push({
123463
+ ...shared,
123464
+ destination_address: emailBinding.destination_address
123465
+ });
123466
+ else if (emailBinding.allowed_destination_addresses !== void 0) metadataBindings.push({
123467
+ ...shared,
123468
+ allowed_destination_addresses: emailBinding.allowed_destination_addresses
123380
123469
  });
123470
+ else metadataBindings.push(shared);
123381
123471
  });
123382
123472
  durable_objects.forEach(({ name, class_name, script_name, environment }) => {
123383
123473
  metadataBindings.push({
@@ -123777,7 +123867,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
123777
123867
  //#endregion
123778
123868
  //#region ../remote-bindings/dist/index.mjs
123779
123869
  var import_undici = require_undici();
123780
- var version$2 = "0.0.14";
123870
+ var version$2 = "0.0.15";
123781
123871
  var NoDefaultValueProvided = class extends UserError {
123782
123872
  constructor() {
123783
123873
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });