@cloudflare/vite-plugin 1.54.8 → 1.54.10

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
@@ -137,7 +137,7 @@ function createFatalError$1(message, isJson, options) {
137
137
  __name$6(createFatalError$1, "createFatalError");
138
138
 
139
139
  //#endregion
140
- //#region ../workers-utils/dist/chunk-R5MIV2EH.mjs
140
+ //#region ../workers-utils/dist/chunk-JGKSDUFK.mjs
141
141
  function hasKnownExportType(entry) {
142
142
  const type = entry?.type;
143
143
  return type === "durable-object" || type === "worker";
@@ -173,6 +173,17 @@ function getDurableObjectContainerApps(containers) {
173
173
  return Array.isArray(containers) ? containers.filter(isDurableObjectContainerApp) : [];
174
174
  }
175
175
  __name$6(getDurableObjectContainerApps, "getDurableObjectContainerApps");
176
+ function getResolvedDurableObjectContainerApps(containers, exports$1) {
177
+ return getDurableObjectContainerApps(containers).map((container) => {
178
+ const className = resolveContainerClassName(container, exports$1);
179
+ if (typeof className !== "string" || className.length === 0) throw new UserError(`The container "${container.name}" is not linked to a Durable Object. Either set "containers.class_name", or reference this container from a Durable Object's \`exports\` entry via its "container" field.`, { telemetryMessage: "durable object container class unresolved" });
180
+ return {
181
+ ...container,
182
+ class_name: className
183
+ };
184
+ });
185
+ }
186
+ __name$6(getResolvedDurableObjectContainerApps, "getResolvedDurableObjectContainerApps");
176
187
  function getContainerNameToClassNameMap(exports$1) {
177
188
  const containerNameToClassName = /* @__PURE__ */ new Map();
178
189
  for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1))) if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) containerNameToClassName.set(entry.container, className);
@@ -225,9 +236,9 @@ function getDurableObjectClassNameToUseSQLiteMap(migrations, exports$1) {
225
236
  return durableObjectClassNameToUseSQLiteMap;
226
237
  }
227
238
  __name$6(getDurableObjectClassNameToUseSQLiteMap, "getDurableObjectClassNameToUseSQLiteMap");
228
- function validateDurableObjectContainerApplications(config$2) {
239
+ function validateDurableObjectContainerApplications(config$2, containers = getDurableObjectContainerApps(config$2.containers)) {
229
240
  const allDOs = getDurableObjectClassNameToUseSQLiteMap(config$2.migrations, config$2.exports);
230
- for (const container of getDurableObjectContainerApps(config$2.containers)) {
241
+ for (const container of getResolvedDurableObjectContainerApps(containers, config$2.exports)) {
231
242
  const maybeBoundDO = config$2.durable_objects.bindings.find((durableObject) => durableObject.class_name === container.class_name);
232
243
  const useSQLite = allDOs.get(container.class_name);
233
244
  if (useSQLite === void 0 && maybeBoundDO === void 0) throw new UserError(`The container class_name ${container.class_name} does not match any durable object class_name defined in your Wrangler config file. Note that the durable object must be defined in the same script as the container.`, { telemetryMessage: "no DO defined that matches container class_name" });
@@ -2195,7 +2206,12 @@ var APIError = class extends ParseError {
2195
2206
  return this.#status;
2196
2207
  }
2197
2208
  isGatewayError() {
2198
- if (this.#status !== void 0) return [524].includes(this.#status);
2209
+ if (this.#status !== void 0) return [
2210
+ 502,
2211
+ 503,
2212
+ 504,
2213
+ 524
2214
+ ].includes(this.#status);
2199
2215
  return false;
2200
2216
  }
2201
2217
  isRetryable() {
@@ -2599,8 +2615,8 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
2599
2615
  __name$6(formatConfigSnippet, "formatConfigSnippet");
2600
2616
 
2601
2617
  //#endregion
2602
- //#region ../workers-utils/dist/chunk-KBTXSRPS.mjs
2603
- var DEFAULT_COMPAT_DATE = "2026-09-11";
2618
+ //#region ../workers-utils/dist/chunk-5H6GBNUC.mjs
2619
+ var DEFAULT_COMPAT_DATE = "2026-09-15";
2604
2620
  function assertNever(_value) {}
2605
2621
  __name$6(assertNever, "assertNever");
2606
2622
  function mapWorkerMetadataBindings(bindings) {
@@ -2772,9 +2788,6 @@ function mapWorkerMetadataBindings(bindings) {
2772
2788
  instance_name: binding.instance_name
2773
2789
  }];
2774
2790
  break;
2775
- case "websearch":
2776
- configObj.websearch = { binding: binding.name };
2777
- break;
2778
2791
  case "agent_memory":
2779
2792
  configObj.agent_memory = [...configObj.agent_memory ?? [], {
2780
2793
  binding: binding.name,
@@ -27263,7 +27276,6 @@ var defaultWranglerConfig = {
27263
27276
  vectorize: [],
27264
27277
  ai_search_namespaces: [],
27265
27278
  ai_search: [],
27266
- websearch: void 0,
27267
27279
  agent_memory: [],
27268
27280
  hyperdrive: [],
27269
27281
  workflows: [],
@@ -41341,7 +41353,6 @@ var friendlyBindingNames = {
41341
41353
  vectorize: "Vectorize Index",
41342
41354
  ai_search_namespaces: "AI Search Namespace",
41343
41355
  ai_search: "AI Search Instance",
41344
- websearch: "Web Search",
41345
41356
  agent_memory: "Agent Memory",
41346
41357
  hyperdrive: "Hyperdrive Config",
41347
41358
  r2_buckets: "R2 Bucket",
@@ -41394,7 +41405,6 @@ var bindingTypeFriendlyNames = {
41394
41405
  vectorize: "Vectorize Index",
41395
41406
  ai_search_namespace: "AI Search Namespace",
41396
41407
  ai_search: "AI Search Instance",
41397
- websearch: "Web Search",
41398
41408
  agent_memory: "Agent Memory",
41399
41409
  hyperdrive: "Hyperdrive Config",
41400
41410
  service: "Worker",
@@ -41897,7 +41907,6 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
41897
41907
  vectorize: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vectorize", validateBindingArray(envName, validateVectorizeBinding), []),
41898
41908
  ai_search_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search_namespaces", validateBindingArray(envName, validateAISearchNamespaceBinding), []),
41899
41909
  ai_search: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search", validateBindingArray(envName, validateAISearchBinding), []),
41900
- websearch: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "websearch", validateNamedSimpleBinding(envName), void 0),
41901
41910
  agent_memory: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "agent_memory", validateBindingArray(envName, validateAgentMemoryBinding), []),
41902
41911
  hyperdrive: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "hyperdrive", validateBindingArray(envName, validateHyperdriveBinding), []),
41903
41912
  services: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "services", validateBindingArray(envName, validateServiceBinding), []),
@@ -41939,7 +41948,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
41939
41948
  warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
41940
41949
  errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
41941
41950
  const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
41942
- validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
41951
+ validateContainerExportLinks$1(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
41943
41952
  if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
41944
41953
  return environment;
41945
41954
  }
@@ -42437,7 +42446,6 @@ var validateUnsafeBinding = /* @__PURE__ */ __name$6((diagnostics, field, value)
42437
42446
  "ai",
42438
42447
  "ai_search_namespace",
42439
42448
  "ai_search",
42440
- "websearch",
42441
42449
  "agent_memory",
42442
42450
  "kv_namespace",
42443
42451
  "durable_object_namespace",
@@ -42583,7 +42591,18 @@ function validateDurableObjectContainerImages(diagnostics, field, images, compli
42583
42591
  valid$2 = false;
42584
42592
  }
42585
42593
  }
42586
- const unsupportedFields = Object.keys(image).filter((property) => property !== "dockerfile" && property !== "image");
42594
+ const isDockerfileBuild = hasDockerfile && !hasImage;
42595
+ if (isDockerfileBuild) {
42596
+ if (image.build_context !== void 0 && (typeof image.build_context !== "string" || image.build_context.length === 0)) {
42597
+ diagnostics.errors.push(`"${imageField}.build_context" must be a non-empty string.`);
42598
+ valid$2 = false;
42599
+ }
42600
+ if (image.build_vars !== void 0 && (typeof image.build_vars !== "object" || image.build_vars === null || Array.isArray(image.build_vars) || Object.values(image.build_vars).some((value) => typeof value !== "string"))) {
42601
+ diagnostics.errors.push(`"${imageField}.build_vars" must be an object with string values.`);
42602
+ valid$2 = false;
42603
+ }
42604
+ }
42605
+ const unsupportedFields = Object.keys(image).filter((property) => property !== "dockerfile" && property !== "image" && !(isDockerfileBuild && (property === "build_context" || property === "build_vars")));
42587
42606
  if (unsupportedFields.length > 0) {
42588
42607
  diagnostics.errors.push(`Unexpected fields found in ${imageField} field: ${unsupportedFields.map((property) => `"${property}"`).join(", ")}`);
42589
42608
  valid$2 = false;
@@ -42592,6 +42611,24 @@ function validateDurableObjectContainerImages(diagnostics, field, images, compli
42592
42611
  return valid$2;
42593
42612
  }
42594
42613
  __name$6(validateDurableObjectContainerImages, "validateDurableObjectContainerImages");
42614
+ function validateDurableObjectContainerUnsafe(diagnostics, field, value) {
42615
+ if (value === void 0) return;
42616
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
42617
+ diagnostics.errors.push(`"${field}" should be an object.`);
42618
+ return;
42619
+ }
42620
+ const unsafe = value;
42621
+ const configuration = unsafe.configuration;
42622
+ if (Object.keys(unsafe).some((key) => key !== "configuration") || configuration !== void 0 && (typeof configuration !== "object" || configuration === null || Array.isArray(configuration) || Object.keys(configuration).some((key) => key !== "experimental_flags"))) {
42623
+ diagnostics.errors.push(`Only "${field}.configuration.experimental_flags" is supported for Durable Object-managed Containers.`);
42624
+ return;
42625
+ }
42626
+ if (configuration !== void 0) {
42627
+ const flags = configuration.experimental_flags;
42628
+ if (flags !== void 0 && (!Array.isArray(flags) || flags.some((flag) => typeof flag !== "string"))) diagnostics.errors.push(`"${field}.configuration.experimental_flags" should be an array of strings.`);
42629
+ }
42630
+ }
42631
+ __name$6(validateDurableObjectContainerUnsafe, "validateDurableObjectContainerUnsafe");
42595
42632
  function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42596
42633
  const { generateDefaultName = true } = options;
42597
42634
  return (diagnostics, field, value, config2) => {
@@ -42603,11 +42640,10 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42603
42640
  for (const containerAppOptional of value) {
42604
42641
  const isDurableObjectManaged = containerAppOptional.scheduling_policy === "durable_object";
42605
42642
  const hasValidDurableObjectClassName = typeof containerAppOptional.class_name === "string" && containerAppOptional.class_name.length > 0;
42606
- if (isDurableObjectManaged) {
42607
- if (!hasValidDurableObjectClassName) diagnostics.errors.push(`"containers.class_name" must be a non-empty string when "containers.scheduling_policy" is "durable_object".`);
42608
- } else validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
42643
+ validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
42644
+ if (isDurableObjectManaged && containerAppOptional.class_name === "") diagnostics.errors.push(`"containers.class_name" must be a non-empty string when specified for a Durable Object-managed Container.`);
42609
42645
  validateOptionalProperty(diagnostics, field, "name", containerAppOptional.name, "string");
42610
- if (generateDefaultName && !containerAppOptional.name && (!isDurableObjectManaged || hasValidDurableObjectClassName)) if (containerAppOptional.class_name === void 0) diagnostics.errors.push(`"containers.name" is required when "containers.class_name" is not defined, because there is no class name to derive a default name from. Either name this container and reference it from a Durable Object's \`exports\` entry, or set "containers.class_name".`);
42646
+ if (generateDefaultName && !containerAppOptional.name && (!isDurableObjectManaged || containerAppOptional.class_name === void 0 || hasValidDurableObjectClassName)) if (containerAppOptional.class_name === void 0) diagnostics.errors.push(`"containers.name" is required when "containers.class_name" is not defined, because there is no class name to derive a default name from. Either name this container and reference it from a Durable Object's \`exports\` entry, or set "containers.class_name".`);
42611
42647
  else if (!topLevelName) diagnostics.errors.push(`Must have either a top level "name" and "containers.class_name" field defined, or have field "containers.name" defined.`);
42612
42648
  else {
42613
42649
  let name = `${topLevelName}-${containerAppOptional.class_name}`;
@@ -42616,13 +42652,18 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42616
42652
  }
42617
42653
  if (isDurableObjectManaged) {
42618
42654
  validateDurableObjectContainerImages(diagnostics, `${field}.images`, containerAppOptional.images, options.complianceConfig);
42655
+ validateContainerObservability(diagnostics, `${field}.observability`, containerAppOptional.observability, config2);
42656
+ if (containerAppOptional.observability?.target_instance_count !== void 0 || containerAppOptional.observability?.target_instance_percentage !== void 0) diagnostics.errors.push(`"${field}.observability" only supports enabling or disabling logs for Durable Object-managed Containers; instance targeting is not supported.`);
42657
+ validateDurableObjectContainerUnsafe(diagnostics, `${field}.unsafe`, containerAppOptional.unsafe);
42619
42658
  const unsupportedFields = Object.keys(containerAppOptional).filter((key) => ![
42620
42659
  "name",
42621
42660
  "class_name",
42622
42661
  "scheduling_policy",
42623
- "images"
42662
+ "images",
42663
+ "observability",
42664
+ "unsafe"
42624
42665
  ].includes(key));
42625
- if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", and "images" are supported.`);
42666
+ if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", and restricted "unsafe" settings are supported.`);
42626
42667
  continue;
42627
42668
  }
42628
42669
  if (!containerAppOptional.configuration?.image && !containerAppOptional.image) diagnostics.errors.push(`"containers.image" field must be defined for each container app. This should be the path to your Dockerfile or an image URI pointing to the Cloudflare registry.`);
@@ -43693,6 +43734,8 @@ var validatePreviewsConfig = /* @__PURE__ */ __name$6((envName, configPath) => (
43693
43734
  "d1_databases",
43694
43735
  "r2_buckets",
43695
43736
  "vectorize",
43737
+ "ai_search_namespaces",
43738
+ "ai_search",
43696
43739
  "hyperdrive",
43697
43740
  "services",
43698
43741
  "analytics_engine_datasets",
@@ -43731,6 +43774,8 @@ var validatePreviewsConfig = /* @__PURE__ */ __name$6((envName, configPath) => (
43731
43774
  isValid = validateBindingArray(envName, validateD1Binding)(diagnostics, `${field}.d1_databases`, previews.d1_databases, void 0) && isValid;
43732
43775
  isValid = validateBindingArray(envName, validateR2Binding)(diagnostics, `${field}.r2_buckets`, previews.r2_buckets, void 0) && isValid;
43733
43776
  isValid = validateBindingArray(envName, validateVectorizeBinding)(diagnostics, `${field}.vectorize`, previews.vectorize, void 0) && isValid;
43777
+ isValid = validateBindingArray(envName, validateAISearchNamespaceBinding)(diagnostics, `${field}.ai_search_namespaces`, previews.ai_search_namespaces, void 0) && isValid;
43778
+ isValid = validateBindingArray(envName, validateAISearchBinding)(diagnostics, `${field}.ai_search`, previews.ai_search, void 0) && isValid;
43734
43779
  isValid = validateBindingArray(envName, validateHyperdriveBinding)(diagnostics, `${field}.hyperdrive`, previews.hyperdrive, void 0) && isValid;
43735
43780
  isValid = validateBindingArray(envName, validateServiceBinding)(diagnostics, `${field}.services`, previews.services, void 0) && isValid;
43736
43781
  isValid = validateBindingArray(envName, validateAnalyticsEngineBinding)(diagnostics, `${field}.analytics_engine_datasets`, previews.analytics_engine_datasets, void 0) && isValid;
@@ -44149,7 +44194,7 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
44149
44194
  if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
44150
44195
  }
44151
44196
  __name$6(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
44152
- function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
44197
+ function validateContainerExportLinks$1(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
44153
44198
  if (containers !== void 0 && !Array.isArray(containers)) return;
44154
44199
  if (containers === void 0 && containersDeclaredElsewhere) return;
44155
44200
  const containersByName = /* @__PURE__ */ new Map();
@@ -44209,7 +44254,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1, contai
44209
44254
  if (referencedContainerName === void 0 && exportEntry !== void 0 && "storage" in exportEntry && exportEntry.storage === "legacy-kv") diagnostics.errors.push(`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.storage" is "legacy-kv". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`);
44210
44255
  }
44211
44256
  }
44212
- __name$6(validateContainerExportLinks, "validateContainerExportLinks");
44257
+ __name$6(validateContainerExportLinks$1, "validateContainerExportLinks");
44213
44258
  var validatePythonModules = /* @__PURE__ */ __name$6((diagnostics, field, value, topLevelEnv) => {
44214
44259
  if (value === void 0) return true;
44215
44260
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -44291,7 +44336,6 @@ var BINDING_LOCAL_SUPPORT = {
44291
44336
  flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
44292
44337
  vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
44293
44338
  vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
44294
- websearch: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
44295
44339
  agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
44296
44340
  };
44297
44341
  function getBindingLocalSupport(type) {
@@ -44649,14 +44693,6 @@ function convertConfigToBindings(config2, options) {
44649
44693
  ...x
44650
44694
  };
44651
44695
  break;
44652
- case "websearch": {
44653
- const { binding,...x } = info$1;
44654
- output[binding] = {
44655
- type: "websearch",
44656
- ...x
44657
- };
44658
- break;
44659
- }
44660
44696
  case "agent_memory":
44661
44697
  for (const { binding,...x } of info$1) output[binding] = {
44662
44698
  type: "agent_memory",
@@ -44802,7 +44838,6 @@ function printBindings(bindings, options) {
44802
44838
  const vectorize = extractBindingsOfType("vectorize", bindings);
44803
44839
  const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
44804
44840
  const ai_search = extractBindingsOfType("ai_search", bindings);
44805
- const websearch = extractBindingsOfType("websearch", bindings);
44806
44841
  const agent_memory = extractBindingsOfType("agent_memory", bindings);
44807
44842
  const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
44808
44843
  const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
@@ -44942,12 +44977,6 @@ function printBindings(bindings, options) {
44942
44977
  value: instance_name ? String(instance_name) : void 0,
44943
44978
  mode: getMode({ isSimulatedLocally: false })
44944
44979
  })));
44945
- if (websearch.length > 0) output.push(...websearch.map(({ binding }) => ({
44946
- name: binding,
44947
- type: getBindingTypeFriendlyName("websearch"),
44948
- value: void 0,
44949
- mode: getMode({ isSimulatedLocally: false })
44950
- })));
44951
44980
  if (agent_memory.length > 0) output.push(...agent_memory.map(({ binding, namespace }) => ({
44952
44981
  name: binding,
44953
44982
  type: getBindingTypeFriendlyName("agent_memory"),
@@ -45236,7 +45265,7 @@ ${allTailConsumers.map(({ service, streaming }) => {
45236
45265
  let containersTitle = "The following containers are available:";
45237
45266
  if (context.name && isMultiWorker) containersTitle = `The following containers are available from ${source_default.blue(context.name)}:`;
45238
45267
  log$2(`${containersTitle}
45239
- ${containers.map((container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name} (durable_object)` : `- ${container.name} (${container.image})`).join("\n")}`);
45268
+ ${containers.map((container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name ?? container.name} (durable_object)` : `- ${container.name} (${container.image})`).join("\n")}`);
45240
45269
  log$2("");
45241
45270
  }
45242
45271
  if (context.unsafeMetadata) {
@@ -55442,10 +55471,6 @@ const KnownBindingSchema = discriminatedUnion("type", [
55442
55471
  const value = input;
55443
55472
  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"`;
55444
55473
  } }),
55445
- strictObject({
55446
- type: literal$1("web-search"),
55447
- dev: RemoteBindingDevSchema.optional()
55448
- }),
55449
55474
  WorkerBindingSchema,
55450
55475
  strictObject({ type: literal$1("worker-loader") })
55451
55476
  ]);
@@ -55484,8 +55509,7 @@ const SINGLETON_BINDING_TYPES = new Set([
55484
55509
  "images",
55485
55510
  "media",
55486
55511
  "stream",
55487
- "version-metadata",
55488
- "web-search"
55512
+ "version-metadata"
55489
55513
  ]);
55490
55514
  const listFormatter = new Intl.ListFormat("en-US");
55491
55515
  function validateSingletonBindings(env$3, ctx) {
@@ -55504,6 +55528,136 @@ function validateSingletonBindings(env$3, ctx) {
55504
55528
  });
55505
55529
  }
55506
55530
  const EnvSchema = record(string(), BindingSchema).superRefine(validateSingletonBindings).optional();
55531
+ const ContainerImageDockerfileSchema = strictObject({
55532
+ dockerfile: string().min(1),
55533
+ buildContext: string().optional(),
55534
+ buildVars: record(string(), string()).optional()
55535
+ });
55536
+ const ContainerImageReferenceSchema = strictObject({ reference: string().min(1) });
55537
+ const ContainerImageLocalReferenceSchema = strictObject({ localReference: string().min(1) });
55538
+ const InputContainerImageSchema = union([ContainerImageDockerfileSchema, ContainerImageReferenceSchema]);
55539
+ const OutputContainerImageSchema = union([ContainerImageReferenceSchema, ContainerImageLocalReferenceSchema]);
55540
+ const VALID_ROLLOUT_STEP_PERCENTAGES = new Set([
55541
+ 5,
55542
+ 10,
55543
+ 20,
55544
+ 25,
55545
+ 50,
55546
+ 100
55547
+ ]);
55548
+ const ContainerRolloutStepPercentageSchema = union([number(), array(number())]).superRefine((stepPercentage, ctx) => {
55549
+ if (typeof stepPercentage === "number") {
55550
+ if (!VALID_ROLLOUT_STEP_PERCENTAGES.has(stepPercentage)) ctx.addIssue({
55551
+ code: "custom",
55552
+ message: "A rollout step percentage must be one of 5, 10, 20, 25, 50, or 100"
55553
+ });
55554
+ return;
55555
+ }
55556
+ if (stepPercentage.length === 0) {
55557
+ ctx.addIssue({
55558
+ code: "custom",
55559
+ message: "A rollout must contain at least one step percentage"
55560
+ });
55561
+ return;
55562
+ }
55563
+ for (const [index, step] of stepPercentage.entries()) {
55564
+ if (step < 10 || step > 100) ctx.addIssue({
55565
+ code: "custom",
55566
+ path: [index],
55567
+ message: "Rollout step percentages must be between 10 and 100"
55568
+ });
55569
+ const previousStep = stepPercentage[index - 1];
55570
+ if (previousStep !== void 0 && step < previousStep) ctx.addIssue({
55571
+ code: "custom",
55572
+ path: [index],
55573
+ message: "Rollout step percentages must be in ascending order"
55574
+ });
55575
+ }
55576
+ const lastIndex = stepPercentage.length - 1;
55577
+ if (stepPercentage[lastIndex] !== 100) ctx.addIssue({
55578
+ code: "custom",
55579
+ path: [lastIndex],
55580
+ message: "The final rollout step percentage must be 100"
55581
+ });
55582
+ });
55583
+ function validateContainerRelationships(container, ctx) {
55584
+ const stepPercentage = container.rollout?.stepPercentage;
55585
+ if (Array.isArray(stepPercentage) && container.maxInstances !== void 0 && stepPercentage.length > container.maxInstances) ctx.addIssue({
55586
+ code: "custom",
55587
+ path: ["rollout", "stepPercentage"],
55588
+ message: "A rollout cannot contain more steps than the maximum number of instances"
55589
+ });
55590
+ }
55591
+ const ContainerObservabilityBaseSchema = strictObject({
55592
+ enabled: boolean().optional(),
55593
+ logs: strictObject({ enabled: boolean().optional() }).optional()
55594
+ });
55595
+ const ContainerObservabilitySchema = union([ContainerObservabilityBaseSchema.extend({ targetInstancePercentage: number().min(0).max(100).optional() }), ContainerObservabilityBaseSchema.extend({ targetInstanceCount: number().int().nonnegative().optional() })]);
55596
+ const BaseContainerSchema = strictObject({
55597
+ type: literal$1("container"),
55598
+ name: string().min(1),
55599
+ observability: ContainerObservabilitySchema.optional(),
55600
+ unsafe: record(string(), unknown()).optional()
55601
+ });
55602
+ const StandardContainerBaseSchema = BaseContainerSchema.extend({
55603
+ maxInstances: number().int().nonnegative().default(20),
55604
+ instanceType: union([_enum([
55605
+ "basic",
55606
+ "lite",
55607
+ "standard-1",
55608
+ "standard-2",
55609
+ "standard-3",
55610
+ "standard-4"
55611
+ ]), strictObject({
55612
+ vcpu: number().min(.0625).optional(),
55613
+ memoryMib: number().nonnegative().optional(),
55614
+ diskMb: number().nonnegative().optional()
55615
+ })]).optional(),
55616
+ schedulingPolicy: _enum(["default", "regional"]).optional(),
55617
+ ssh: strictObject({
55618
+ enabled: boolean(),
55619
+ port: number().int().min(1).max(65535).optional()
55620
+ }).optional(),
55621
+ authorizedKeys: array(strictObject({
55622
+ name: string(),
55623
+ publicKey: string()
55624
+ })).optional(),
55625
+ constraints: strictObject({
55626
+ regions: array(_enum([
55627
+ "ENAM",
55628
+ "WNAM",
55629
+ "EEUR",
55630
+ "WEUR",
55631
+ "APAC",
55632
+ "SAM",
55633
+ "ME",
55634
+ "OC",
55635
+ "AFR"
55636
+ ])).optional(),
55637
+ jurisdiction: _enum(["eu", "fedramp"]).optional()
55638
+ }).optional(),
55639
+ rollout: strictObject({
55640
+ kind: _enum([
55641
+ "full-auto",
55642
+ "none",
55643
+ "full-manual"
55644
+ ]).optional(),
55645
+ stepPercentage: ContainerRolloutStepPercentageSchema.optional(),
55646
+ activeGracePeriod: number().nonnegative().optional()
55647
+ }).optional()
55648
+ });
55649
+ const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({ schedulingPolicy: literal$1("durable-object") });
55650
+ /**
55651
+ * Input Container schema — validates user-authored `cloudflare.config.ts`
55652
+ * Container exports. Dockerfiles are built by the consuming build tool.
55653
+ */
55654
+ const InputContainerSchema = union([StandardContainerBaseSchema.extend({ image: InputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: record(string(), InputContainerImageSchema).optional() })]);
55655
+ /**
55656
+ * Output Container schema — validates Container configs in the Build Output
55657
+ * Specification, after any Dockerfile has been built into a local or remote
55658
+ * image reference.
55659
+ */
55660
+ const OutputContainerSchema = union([StandardContainerBaseSchema.extend({ image: OutputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: record(string(), OutputContainerImageSchema).optional() })]);
55507
55661
  const DurableObjectCreatedExportSchema = strictObject({
55508
55662
  type: literal$1("durable-object"),
55509
55663
  state: literal$1("created").optional(),
@@ -55682,8 +55836,13 @@ const InputSettingsSchema = strictObject({
55682
55836
  * Build Output Specification. Adds the `mode` the build was produced in.
55683
55837
  */
55684
55838
  const OutputSettingsSchema = InputSettingsSchema.extend({ mode: string().optional() });
55839
+ const DEFAULT_EXPORT_NAME = "default";
55685
55840
  const SETTINGS_EXPORT_NAME = "settings";
55686
- const SUPPORTED_EXPORT_TYPES = new Set(["worker", "settings"]);
55841
+ const SUPPORTED_EXPORT_TYPES = new Set([
55842
+ "container",
55843
+ "worker",
55844
+ "settings"
55845
+ ]);
55687
55846
  function invalidConfigExportMessage(exportName) {
55688
55847
  return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
55689
55848
  }
@@ -55700,6 +55859,15 @@ const ConfigExportsTypeSchema = record(string(), unknown()).check((ctx) => {
55700
55859
  });
55701
55860
  continue;
55702
55861
  }
55862
+ if (key === DEFAULT_EXPORT_NAME && type !== "worker") {
55863
+ ctx.issues.push({
55864
+ code: "custom",
55865
+ input: value,
55866
+ path: [key],
55867
+ message: `The \`${DEFAULT_EXPORT_NAME}\` export is reserved for a \`worker\` config; found a \`${type}\` config.`
55868
+ });
55869
+ continue;
55870
+ }
55703
55871
  const isSettingsName = key === SETTINGS_EXPORT_NAME;
55704
55872
  const isSettingsType = type === "settings";
55705
55873
  if (isSettingsType && !isSettingsName) ctx.issues.push({
@@ -55881,18 +56049,26 @@ function createFatalError(message, isJson, options) {
55881
56049
  return new FatalError$1(`${message}`, options);
55882
56050
  }
55883
56051
  __name$5(createFatalError, "createFatalError");
56052
+ const ROLLOUT_KIND_MAP = {
56053
+ "full-auto": "full_auto",
56054
+ "full-manual": "full_manual",
56055
+ none: "none"
56056
+ };
55884
56057
  /**
55885
56058
  * Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
55886
56059
  *
55887
- * The caller is responsible for unwrapping any function/promise wrapper around
55888
- * the config and validating it against `InputWorkerSchema` before passing it in.
56060
+ * The caller is responsible for unwrapping any function/promise wrappers and
56061
+ * validating the configs against their corresponding input schemas before
56062
+ * passing them in.
55889
56063
  *
55890
56064
  * @param workerConfig The parsed (post-validation) Worker config.
55891
56065
  * @param settingsConfig The optional parsed settings config, whose fields
55892
56066
  * are merged onto the result.
56067
+ * @param containerExports The parsed Container exports to include in the
56068
+ * result.
55893
56069
  * @returns The corresponding Wrangler `RawConfig`.
55894
56070
  */
55895
- function convertToWranglerConfig(workerConfig, settingsConfig) {
56071
+ function convertToWranglerConfig(workerConfig, settingsConfig, containerExports = []) {
55896
56072
  const result = {};
55897
56073
  convertTopLevel(workerConfig, result);
55898
56074
  convertBindingsAndAssets(workerConfig, result);
@@ -55901,8 +56077,50 @@ function convertToWranglerConfig(workerConfig, settingsConfig) {
55901
56077
  convertTriggers(workerConfig, result);
55902
56078
  convertTailConsumers(workerConfig, result);
55903
56079
  if (settingsConfig !== void 0) convertSettings(settingsConfig, result);
56080
+ if (containerExports.length > 0) result.containers = containerExports.map((container) => convertContainer(container));
55904
56081
  return result;
55905
56082
  }
56083
+ function convertContainer(container) {
56084
+ if (container.schedulingPolicy === "durable-object") throw new UserError$1("Durable Object-managed Containers are not currently supported by `convertToWranglerConfig()`.", { telemetryMessage: false });
56085
+ const converted = { name: container.name };
56086
+ if (container.observability !== void 0) converted.observability = convertContainerObservability(container.observability);
56087
+ if (container.unsafe !== void 0) converted.unsafe = container.unsafe;
56088
+ converted.image = "dockerfile" in container.image ? container.image.dockerfile : container.image.reference;
56089
+ converted.max_instances = container.maxInstances;
56090
+ if ("dockerfile" in container.image) {
56091
+ if (container.image.buildContext !== void 0) converted.image_build_context = container.image.buildContext;
56092
+ if (container.image.buildVars !== void 0) converted.image_vars = container.image.buildVars;
56093
+ }
56094
+ if (container.instanceType !== void 0) if (typeof container.instanceType === "string") converted.instance_type = container.instanceType;
56095
+ else {
56096
+ const instanceType = {};
56097
+ if (container.instanceType.vcpu !== void 0) instanceType.vcpu = container.instanceType.vcpu;
56098
+ if (container.instanceType.memoryMib !== void 0) instanceType.memory_mib = container.instanceType.memoryMib;
56099
+ if (container.instanceType.diskMb !== void 0) instanceType.disk_mb = container.instanceType.diskMb;
56100
+ converted.instance_type = instanceType;
56101
+ }
56102
+ if (container.schedulingPolicy !== void 0) converted.scheduling_policy = container.schedulingPolicy;
56103
+ if (container.ssh !== void 0) converted.ssh = container.ssh;
56104
+ if (container.authorizedKeys !== void 0) converted.authorized_keys = container.authorizedKeys.map(({ name, publicKey }) => ({
56105
+ name,
56106
+ public_key: publicKey
56107
+ }));
56108
+ if (container.constraints !== void 0) converted.constraints = container.constraints;
56109
+ if (container.rollout !== void 0) {
56110
+ if (container.rollout.kind !== void 0) converted.rollout_kind = ROLLOUT_KIND_MAP[container.rollout.kind];
56111
+ if (container.rollout.stepPercentage !== void 0) converted.rollout_step_percentage = container.rollout.stepPercentage;
56112
+ if (container.rollout.activeGracePeriod !== void 0) converted.rollout_active_grace_period = container.rollout.activeGracePeriod;
56113
+ }
56114
+ return converted;
56115
+ }
56116
+ function convertContainerObservability(observability) {
56117
+ const converted = {};
56118
+ if (observability.enabled !== void 0) converted.enabled = observability.enabled;
56119
+ if (observability.logs !== void 0) converted.logs = observability.logs;
56120
+ if ("targetInstancePercentage" in observability && observability.targetInstancePercentage !== void 0) converted.target_instance_percentage = observability.targetInstancePercentage;
56121
+ if ("targetInstanceCount" in observability && observability.targetInstanceCount !== void 0) converted.target_instance_count = observability.targetInstanceCount;
56122
+ return converted;
56123
+ }
55906
56124
  /**
55907
56125
  * Merge a parsed settings config's fields (`account_id`, `compliance_region`)
55908
56126
  * onto an existing Wrangler `RawConfig`.
@@ -56230,12 +56448,6 @@ function convertBindingsAndAssets(config$2, result) {
56230
56448
  remote: binding.dev?.remote
56231
56449
  }));
56232
56450
  break;
56233
- case "web-search":
56234
- result.websearch = omitUndefined({
56235
- binding: name,
56236
- remote: binding.dev?.remote
56237
- });
56238
- break;
56239
56451
  case "worker":
56240
56452
  services.push(omitUndefined({
56241
56453
  binding: name,
@@ -56570,6 +56782,9 @@ function isRecord(value) {
56570
56782
  function isConfigReference(value) {
56571
56783
  return typeof value === "function" || isRecord(value);
56572
56784
  }
56785
+ function normalizeConfigReference(reference, resolved, expectedType) {
56786
+ return isRecord(resolved) && resolved.type === expectedType && typeof resolved.name === "string" ? resolved.name : reference;
56787
+ }
56573
56788
  function createDefinitionResolver(ctx) {
56574
56789
  const resolvedDefinitions = /* @__PURE__ */ new Map();
56575
56790
  return (input) => {
@@ -56590,7 +56805,7 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
56590
56805
  const target$1 = await resolveDefinition(binding.worker);
56591
56806
  env$3[bindingName] = {
56592
56807
  ...binding,
56593
- worker: isRecord(target$1) ? target$1.name : void 0
56808
+ worker: normalizeConfigReference(binding.worker, target$1, "worker")
56594
56809
  };
56595
56810
  }
56596
56811
  return {
@@ -56598,22 +56813,151 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
56598
56813
  env: env$3
56599
56814
  };
56600
56815
  }
56816
+ async function normalizeContainerReferences(resolved, resolveDefinition, resolvedExports) {
56817
+ const issues = [];
56818
+ if (!isRecord(resolved) || !isRecord(resolved.exports)) return {
56819
+ value: resolved,
56820
+ issues
56821
+ };
56822
+ const workerExports = { ...resolved.exports };
56823
+ for (const [exportName, workerExport] of Object.entries(workerExports)) {
56824
+ if (!isRecord(workerExport) || workerExport.type !== "durable-object" || workerExport.container === void 0) continue;
56825
+ const reference = workerExport.container;
56826
+ if (typeof reference === "string") {
56827
+ issues.push({
56828
+ code: "custom",
56829
+ input: reference,
56830
+ path: [
56831
+ "exports",
56832
+ exportName,
56833
+ "container"
56834
+ ],
56835
+ message: "Container provided as a string. Reference an exported Container definition instead."
56836
+ });
56837
+ workerExports[exportName] = {
56838
+ ...workerExport,
56839
+ container: void 0
56840
+ };
56841
+ continue;
56842
+ }
56843
+ const target$1 = await resolveDefinition(reference);
56844
+ if (isRecord(target$1) && target$1.type === "container" && typeof target$1.name === "string" && !Object.values(resolvedExports).includes(target$1)) {
56845
+ issues.push({
56846
+ code: "custom",
56847
+ input: reference,
56848
+ path: [
56849
+ "exports",
56850
+ exportName,
56851
+ "container"
56852
+ ],
56853
+ message: `The referenced Container "${target$1.name}" is not exported.`
56854
+ });
56855
+ workerExports[exportName] = {
56856
+ ...workerExport,
56857
+ container: void 0
56858
+ };
56859
+ continue;
56860
+ }
56861
+ workerExports[exportName] = {
56862
+ ...workerExport,
56863
+ container: normalizeConfigReference(reference, target$1, "container")
56864
+ };
56865
+ }
56866
+ return {
56867
+ value: {
56868
+ ...resolved,
56869
+ exports: workerExports
56870
+ },
56871
+ issues
56872
+ };
56873
+ }
56874
+ async function normalizeConfigReferences(resolved, resolveDefinition, resolvedExports) {
56875
+ return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition, resolvedExports);
56876
+ }
56601
56877
  function prefixIssues(issues, prefix) {
56602
56878
  return issues.map((issue$2) => ({
56603
56879
  ...issue$2,
56604
56880
  path: [prefix, ...issue$2.path]
56605
56881
  }));
56606
56882
  }
56883
+ function validateUniqueResourceNames(configExports) {
56884
+ const issues = [];
56885
+ const exportNameByResourceName = {
56886
+ container: /* @__PURE__ */ new Map(),
56887
+ worker: /* @__PURE__ */ new Map()
56888
+ };
56889
+ for (const [exportName, config$2] of Object.entries(configExports)) {
56890
+ if (config$2.type !== "container" && config$2.type !== "worker") continue;
56891
+ const resourceType = config$2.type === "container" ? "Container" : "Worker";
56892
+ const exportNames = exportNameByResourceName[config$2.type];
56893
+ const previousExportName = exportNames.get(config$2.name);
56894
+ if (previousExportName !== void 0) {
56895
+ issues.push({
56896
+ code: "custom",
56897
+ input: config$2.name,
56898
+ path: [exportName, "name"],
56899
+ message: `The ${resourceType} name "${config$2.name}" is also used by the "${previousExportName}" export. ${resourceType} names must be unique.`
56900
+ });
56901
+ continue;
56902
+ }
56903
+ exportNames.set(config$2.name, exportName);
56904
+ }
56905
+ return issues;
56906
+ }
56907
+ function validateContainerExportLinks(configExports) {
56908
+ const issues = [];
56909
+ const containerNames = /* @__PURE__ */ new Set();
56910
+ for (const config$2 of Object.values(configExports)) if (config$2.type === "container") containerNames.add(config$2.name);
56911
+ const firstReferenceByContainerName = /* @__PURE__ */ new Map();
56912
+ for (const [workerExportName, config$2] of Object.entries(configExports)) {
56913
+ if (config$2.type !== "worker") continue;
56914
+ for (const [durableObjectExportName, workerExport] of Object.entries(config$2.exports ?? {})) {
56915
+ if (workerExport.type !== "durable-object" || !("container" in workerExport) || workerExport.container === void 0) continue;
56916
+ const containerName = workerExport.container;
56917
+ const path$2 = [
56918
+ workerExportName,
56919
+ "exports",
56920
+ durableObjectExportName,
56921
+ "container"
56922
+ ];
56923
+ if (!containerNames.has(containerName)) {
56924
+ issues.push({
56925
+ code: "custom",
56926
+ input: containerName,
56927
+ path: path$2,
56928
+ message: `The Container "${containerName}" is not exported from this configuration.`
56929
+ });
56930
+ continue;
56931
+ }
56932
+ const firstReference = firstReferenceByContainerName.get(containerName);
56933
+ if (firstReference !== void 0) {
56934
+ issues.push({
56935
+ code: "custom",
56936
+ input: containerName,
56937
+ path: path$2,
56938
+ message: `The Container "${containerName}" is already referenced by "${firstReference.workerExportName}.exports.${firstReference.durableObjectExportName}". A Container can only be linked to one Durable Object.`
56939
+ });
56940
+ continue;
56941
+ }
56942
+ firstReferenceByContainerName.set(containerName, {
56943
+ workerExportName,
56944
+ durableObjectExportName
56945
+ });
56946
+ }
56947
+ }
56948
+ return issues;
56949
+ }
56607
56950
  /**
56608
56951
  * Resolve and validate loaded `cloudflare.config.ts` exports.
56609
56952
  *
56610
- * Config inputs are resolved once by identity. Top-level Worker exports are
56611
- * also parsed once by identity; unexported references are resolved only far
56612
- * enough to replace the reference with the Worker's name.
56953
+ * Config inputs are resolved once by identity. Top-level Worker and Container
56954
+ * exports are also parsed once by identity. References are resolved only far
56955
+ * enough to replace them with resource names, then Container links are
56956
+ * validated across the exported resources.
56613
56957
  */
56614
56958
  async function resolveAndValidateConfigExports(exports$2, ctx) {
56615
56959
  const resolveDefinition = createDefinitionResolver(ctx);
56616
- const parsedWorkers = /* @__PURE__ */ new Map();
56960
+ const parsedResources = /* @__PURE__ */ new Map();
56617
56961
  const resolvedExports = {};
56618
56962
  for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
56619
56963
  const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
@@ -56627,17 +56971,20 @@ async function resolveAndValidateConfigExports(exports$2, ctx) {
56627
56971
  for (const [name, input] of Object.entries(exports$2)) {
56628
56972
  const resolved = resolvedExports[name];
56629
56973
  if (!isRecord(resolved)) continue;
56630
- if (resolved.type === "worker") {
56631
- let result = parsedWorkers.get(input);
56632
- if (!result) {
56633
- result = InputWorkerSchema.safeParse(await normalizeWorkerReferences(resolved, resolveDefinition));
56634
- parsedWorkers.set(input, result);
56635
- if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
56636
- }
56637
- if (result.success) data$1[name] = result.data;
56638
- continue;
56639
- }
56640
- }
56974
+ if (resolved.type !== "worker" && resolved.type !== "container") continue;
56975
+ let result = parsedResources.get(input);
56976
+ if (!result) {
56977
+ if (resolved.type === "worker") {
56978
+ const normalized = await normalizeConfigReferences(resolved, resolveDefinition, resolvedExports);
56979
+ issues.push(...prefixIssues(normalized.issues, name));
56980
+ result = InputWorkerSchema.safeParse(normalized.value);
56981
+ } else result = InputContainerSchema.safeParse(resolved);
56982
+ parsedResources.set(input, result);
56983
+ if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
56984
+ }
56985
+ if (result.success) data$1[name] = result.data;
56986
+ }
56987
+ issues.push(...validateUniqueResourceNames(data$1), ...validateContainerExportLinks(data$1));
56641
56988
  return issues.length > 0 ? {
56642
56989
  success: false,
56643
56990
  error: new ZodError(issues)
@@ -56815,9 +57162,25 @@ const MAX_ROUTES_RULE_LENGTH = 100;
56815
57162
 
56816
57163
  //#endregion
56817
57164
  //#region ../workers-shared/utils/configuration/parseStaticRouting.ts
57165
+ const MAX_REPORTED_DUPLICATED_RULES = 5;
56818
57166
  function parseStaticRouting(input) {
56819
57167
  if (input.length === 0) throw new Error("No `run_worker_first` rules were provided; must provide at least 1 rule.");
56820
- if (input.length > MAX_ROUTES_RULES) throw new Error(`Too many \`run_worker_first\` rules were provided; ${input.length} rules provided exceeds max of ${MAX_ROUTES_RULES}.`);
57168
+ if (input.length > MAX_ROUTES_RULES) {
57169
+ const seenRules = /* @__PURE__ */ new Set();
57170
+ const duplicatedRules = /* @__PURE__ */ new Set();
57171
+ for (const rule of input) {
57172
+ if (seenRules.has(rule)) duplicatedRules.add(rule);
57173
+ seenRules.add(rule);
57174
+ }
57175
+ if (duplicatedRules.size > 0) {
57176
+ const duplicateEntryCount = input.length - seenRules.size;
57177
+ const reportedDuplicatedRules = [...seenRules].filter((rule) => duplicatedRules.has(rule)).slice(0, MAX_REPORTED_DUPLICATED_RULES);
57178
+ const unreportedDuplicatedRuleCount = duplicatedRules.size - reportedDuplicatedRules.length;
57179
+ const unreportedDuplicatedRulesMessage = unreportedDuplicatedRuleCount > 0 ? `\n...and ${unreportedDuplicatedRuleCount} more duplicated ${unreportedDuplicatedRuleCount === 1 ? "rule" : "rules"}.` : "";
57180
+ throw new Error(`Too many \`run_worker_first\` rules were provided; ${input.length} rules provided (${seenRules.size} distinct, ${duplicateEntryCount} duplicate ${duplicateEntryCount === 1 ? "entry" : "entries"}) exceeds max of ${MAX_ROUTES_RULES}. Note: duplicate entries count towards the route limit. Ensure that no duplicate rules are present in your \`run_worker_first\` configuration.\n\nThe duplicated rules found are:\n${reportedDuplicatedRules.map((rule) => `- ${JSON.stringify(rule)}`).join("\n")}${unreportedDuplicatedRulesMessage}`);
57181
+ }
57182
+ throw new Error(`Too many \`run_worker_first\` rules were provided; ${input.length} rules provided exceeds max of ${MAX_ROUTES_RULES}.`);
57183
+ }
56821
57184
  const rawAssetWorkerRules = [];
56822
57185
  const assetWorkerRules = [];
56823
57186
  const userWorkerRules = [];
@@ -56946,13 +57309,36 @@ function getWorkersDir(root) {
56946
57309
  return path.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
56947
57310
  }
56948
57311
  /**
57312
+ * Absolute path to the Containers output directory.
57313
+ */
57314
+ function getContainersDir(root) {
57315
+ return path.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "containers");
57316
+ }
57317
+ function validateDirectoryName(name, resourceName) {
57318
+ if (name.length === 0 || name === "." || name === ".." || name.includes("/") || name.includes("\\") || name.includes("\0")) throw new Error(`${resourceName} directory names must be non-empty, single path segments. Received ${JSON.stringify(name)}.`);
57319
+ }
57320
+ /**
56949
57321
  * Absolute path to a Worker's directory (`workers/<worker-directory-name>`).
56950
57322
  */
56951
57323
  function getWorkerDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
56952
- if (workerDirectoryName.length === 0 || workerDirectoryName === "." || workerDirectoryName === ".." || workerDirectoryName.includes("/") || workerDirectoryName.includes("\\") || workerDirectoryName.includes("\0")) throw new Error("Worker directory names must be non-empty, single path segments.");
57324
+ validateDirectoryName(workerDirectoryName, "Worker");
56953
57325
  return path.join(getWorkersDir(root), workerDirectoryName);
56954
57326
  }
56955
57327
  /**
57328
+ * Absolute path to a Container's directory
57329
+ * (`containers/<container-directory-name>`).
57330
+ */
57331
+ function getContainerDir(root, containerDirectoryName) {
57332
+ validateDirectoryName(containerDirectoryName, "Container");
57333
+ return path.join(getContainersDir(root), containerDirectoryName);
57334
+ }
57335
+ /**
57336
+ * Absolute path to the Container's config file.
57337
+ */
57338
+ function getContainerConfigPath(root, containerDirectoryName) {
57339
+ return path.join(getContainerDir(root, containerDirectoryName), CONFIG_FILENAME);
57340
+ }
57341
+ /**
56956
57342
  * Absolute path to the Worker's config file.
56957
57343
  */
56958
57344
  function getWorkerConfigPath(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
@@ -57011,14 +57397,14 @@ async function cleanBuildOutputDir(root) {
57011
57397
  * - Workers mode: `manifest` is provided (bundle/ present on disk).
57012
57398
  * - Assets-only mode: `manifest` is omitted (no bundle/ directory).
57013
57399
  */
57014
- async function writeWorkerConfig({ root, config: config$2, manifest, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME }) {
57400
+ async function writeWorkerConfig({ root, config: config$2, manifest, directoryName = DEFAULT_WORKER_DIRECTORY_NAME }) {
57015
57401
  const { entrypoint: _entrypoint,...rest } = config$2;
57016
57402
  const outputConfig = {
57017
57403
  ...rest,
57018
57404
  manifest
57019
57405
  };
57020
- await fsp.mkdir(getWorkerDir(root, workerDirectoryName), { recursive: true });
57021
- await fsp.writeFile(getWorkerConfigPath(root, workerDirectoryName), JSON.stringify(outputConfig));
57406
+ await fsp.mkdir(getWorkerDir(root, directoryName), { recursive: true });
57407
+ await fsp.writeFile(getWorkerConfigPath(root, directoryName), JSON.stringify(outputConfig));
57022
57408
  }
57023
57409
  /**
57024
57410
  * Write the top-level `config.json` to the Build Output Specification tree.
@@ -57057,12 +57443,13 @@ var BuildOutputError = class extends Error {
57057
57443
  * `<root>/.cloudflare/output/v0/`.
57058
57444
  *
57059
57445
  * Reads the optional top-level settings `config.json`, then reads and
57060
- * schema-validates the Worker's `config.json` and resolves its
57061
- * `bundle/` / `assets/` directories. Partial manifests are resolved into
57062
- * complete manifests using the files in `bundle/`.
57446
+ * schema-validates each Worker and Container `config.json`, and resolves each
57447
+ * Worker's `bundle/` / `assets/` directories. Partial manifests are resolved
57448
+ * into complete manifests using the files in `bundle/`.
57063
57449
  *
57064
57450
  * @throws {BuildOutputError} if the top-level `config.json` is invalid, or if
57065
- * the Worker config is missing, is not valid JSON, or fails schema validation.
57451
+ * a Worker or Container config is missing, is not valid JSON, or fails schema
57452
+ * validation.
57066
57453
  */
57067
57454
  async function readBuildOutput(root) {
57068
57455
  const settings = await readSettings(root);
@@ -57076,7 +57463,28 @@ async function readBuildOutput(root) {
57076
57463
  workers: {
57077
57464
  default: defaultWorker,
57078
57465
  ...Object.fromEntries(additionalWorkers)
57079
- }
57466
+ },
57467
+ containers: await readContainers(root)
57468
+ };
57469
+ }
57470
+ /** Read and schema-validate all Container configs, if any. */
57471
+ async function readContainers(root) {
57472
+ const containersDir = getContainersDir(root);
57473
+ if (!fs$1.existsSync(containersDir)) return {};
57474
+ const containerDirectoryNames = (await fsp.readdir(containersDir, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
57475
+ const containers = await Promise.all(containerDirectoryNames.map(async (containerDirectoryName) => [containerDirectoryName, await readContainer(root, containerDirectoryName)]));
57476
+ return Object.fromEntries(containers);
57477
+ }
57478
+ /** Read and schema-validate one Container config. */
57479
+ async function readContainer(root, containerDirectoryName) {
57480
+ const configPath = getContainerConfigPath(root, containerDirectoryName);
57481
+ if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`no Container config found at ${configPath}.`);
57482
+ const contents = await fsp.readFile(configPath, "utf-8");
57483
+ const result = OutputContainerSchema.safeParse(parseJson(contents, configPath));
57484
+ if (!result.success) throw new BuildOutputError(`invalid Container config at ${configPath}.\n${result.error.message}`);
57485
+ return {
57486
+ configPath,
57487
+ config: result.data
57080
57488
  };
57081
57489
  }
57082
57490
  /**
@@ -65975,8 +66383,9 @@ function maybeAddAgentHint(server, mode) {
65975
66383
  * Prints the Local Explorer API URL and useful routes to stdout so that
65976
66384
  * headless AI agents can discover and call them programmatically.
65977
66385
  *
65978
- * Keep the message in sync with the wrangler copy in
65979
- * packages/wrangler/src/dev/start-dev.ts.
66386
+ * Keep the message in sync with:
66387
+ * - packages/wrangler/src/dev/start-dev.ts (printLocalExplorerAgentHint)
66388
+ * - packages/create-cloudflare/src/agents-md.ts (Local Explorer section)
65980
66389
  *
65981
66390
  * @param server - The Vite dev or preview server (must have `resolvedUrls` populated)
65982
66391
  * @param mode - Whether this is a "dev" or "preview" session
@@ -65998,6 +66407,7 @@ function printLocalExplorerAgentHint(server, mode) {
65998
66407
  ` GET ${explorerApiUrl}/workflows - Workflows`,
65999
66408
  ` POST ${explorerApiUrl}/local/observability/query - run a read-only SQL query (SELECT/WITH only) over captured request traces and console logs. Tables: spans, logs (read attributes via json(attributes)). Example:`,
66000
66409
  ` curl -X POST ${explorerApiUrl}/local/observability/query -H 'Content-Type: application/json' -d '{"sql":"SELECT service, name, outcome, duration_ms FROM spans WHERE parent_id IS NULL LIMIT 20"}'`,
66410
+ ` POST ${explorerApiUrl}/local/observability/clear - clear all captured traces and logs`,
66001
66411
  `If the routes above don't cover what you need, fetch the full OpenAPI schema (large - use only as a last resort):`,
66002
66412
  ` GET ${explorerApiUrl} - OpenAPI schema`,
66003
66413
  ""
@@ -68562,6 +68972,39 @@ function validateWorkerEnvironmentOptions(resolvedPluginConfig, resolvedViteConf
68562
68972
  }
68563
68973
  }
68564
68974
 
68975
+ //#endregion
68976
+ //#region src/plugins/wrangler-watch-ignore.ts
68977
+ const WRANGLER_STATE_WATCH_IGNORE = "**/.wrangler/**";
68978
+ /**
68979
+ * Keep Miniflare persistence writes out of Vite's file watcher without
68980
+ * replacing any ignore patterns the user already configured.
68981
+ *
68982
+ * @param userIgnored - Existing `server.watch.ignored` patterns, if any
68983
+ * @returns Ignore patterns that always include `.wrangler` directories
68984
+ */
68985
+ function withWranglerStateIgnored(userIgnored) {
68986
+ if (userIgnored == null) return WRANGLER_STATE_WATCH_IGNORE;
68987
+ if (Array.isArray(userIgnored)) return [...userIgnored, WRANGLER_STATE_WATCH_IGNORE];
68988
+ return [userIgnored, WRANGLER_STATE_WATCH_IGNORE];
68989
+ }
68990
+ /**
68991
+ * Merge `.wrangler` into Vite's `server.watch` config.
68992
+ *
68993
+ * Returns `null` when the user disabled watching with `server.watch: null`,
68994
+ * so this plugin does not turn the watcher back on.
68995
+ *
68996
+ * @param userWatch - The user's `server.watch` value from Vite config
68997
+ * @returns `null` when watching is disabled, otherwise a watch object whose
68998
+ * `ignored` list includes `.wrangler` directories
68999
+ */
69000
+ function getServerWatchConfig(userWatch) {
69001
+ if (userWatch === null) return null;
69002
+ return {
69003
+ ...userWatch,
69004
+ ignored: withWranglerStateIgnored(userWatch?.ignored)
69005
+ };
69006
+ }
69007
+
68565
69008
  //#endregion
68566
69009
  //#region src/plugins/config.ts
68567
69010
  /**
@@ -68580,6 +69023,7 @@ const configPlugin = createPlugin("config", (ctx) => {
68580
69023
  appType: "custom",
68581
69024
  server: {
68582
69025
  allowedHosts: getAllowedHosts(ctx.getTunnelHostnames(), userConfig.server?.allowedHosts),
69026
+ watch: getServerWatchConfig(userConfig.server?.watch),
68583
69027
  fs: { deny: [...[
68584
69028
  ".env",
68585
69029
  ".env.*",
@@ -74143,7 +74587,7 @@ async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIs
74143
74587
  }
74144
74588
  })).ready;
74145
74589
  return {
74146
- containerConfig,
74590
+ container: containerConfig,
74147
74591
  localTag
74148
74592
  };
74149
74593
  } catch (error$2) {
@@ -74156,12 +74600,14 @@ async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIs
74156
74600
  }
74157
74601
  __name$2(buildContainerImage, "buildContainerImage");
74158
74602
  async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunning) {
74159
- const builtContainerDeployments = [];
74160
- for (const container of containers.filter(isDockerfileContainerConfig)) builtContainerDeployments.push({
74161
- container,
74162
- builtImage: await buildContainerImage(container, pathToDocker, verifyDockerIsRunning)
74163
- });
74164
- return builtContainerDeployments;
74603
+ const builtImages = [];
74604
+ try {
74605
+ for (const container of containers.filter(isDockerfileContainerConfig)) builtImages.push(await buildContainerImage(container, pathToDocker, verifyDockerIsRunning));
74606
+ } catch (error$2) {
74607
+ await cleanupBuiltImages(builtImages, pathToDocker);
74608
+ throw error$2;
74609
+ }
74610
+ return builtImages;
74165
74611
  }
74166
74612
  __name$2(buildContainerImages, "buildContainerImages");
74167
74613
  async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, accountId, complianceConfig) {
@@ -74169,8 +74615,8 @@ async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, acco
74169
74615
  const imageRef = await pushImageIfChanged({
74170
74616
  pathToDocker,
74171
74617
  sourceTag: builtImage.localTag,
74172
- targetTag: getContainerImageTag(builtImage.containerConfig, versionId),
74173
- containerConfig: builtImage.containerConfig,
74618
+ targetTag: getContainerImageTag(builtImage.container, versionId),
74619
+ containerConfig: builtImage.container,
74174
74620
  accountId,
74175
74621
  complianceConfig,
74176
74622
  cleanupSourceTag: true
@@ -74186,23 +74632,29 @@ async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, acco
74186
74632
  }
74187
74633
  }
74188
74634
  __name$2(pushBuiltContainerImage, "pushBuiltContainerImage");
74189
- async function cleanupBuiltContainerImages(builtContainerDeployments, pathToDocker) {
74190
- for (const { builtImage } of builtContainerDeployments) {
74191
- if (builtImage.localTagCleaned) continue;
74192
- try {
74193
- logger$1.debug(`Untagging built image: ${builtImage.localTag}.`);
74635
+ async function cleanupBuiltImages(builtImages, pathToDocker) {
74636
+ const aliasesByTag = /* @__PURE__ */ new Map();
74637
+ for (const builtImage of builtImages) {
74638
+ const aliases = aliasesByTag.get(builtImage.localTag);
74639
+ if (aliases) aliases.push(builtImage);
74640
+ else aliasesByTag.set(builtImage.localTag, [builtImage]);
74641
+ }
74642
+ for (const [localTag, aliases] of aliasesByTag) {
74643
+ if (!aliases.some((alias) => alias.localTagCleaned)) try {
74644
+ logger$1.debug(`Untagging built image: ${localTag}.`);
74194
74645
  await runDockerCmd(pathToDocker, [
74195
74646
  "image",
74196
74647
  "rm",
74197
- builtImage.localTag
74648
+ localTag
74198
74649
  ]);
74199
- builtImage.localTagCleaned = true;
74200
74650
  } catch (error$2) {
74201
- if (error$2 instanceof Error) logger$1.debug(`Cleaning up built image ${builtImage.localTag} failed with error: ${error$2.message}`);
74651
+ if (error$2 instanceof Error) logger$1.debug(`Cleaning up built image ${localTag} failed with error: ${error$2.message}`);
74652
+ continue;
74202
74653
  }
74654
+ for (const alias of aliases) alias.localTagCleaned = true;
74203
74655
  }
74204
74656
  }
74205
- __name$2(cleanupBuiltContainerImages, "cleanupBuiltContainerImages");
74657
+ __name$2(cleanupBuiltImages, "cleanupBuiltImages");
74206
74658
  function getContainerImageTag(containerConfig, imageTag) {
74207
74659
  return `${getContainerImageRepositoryName(containerConfig)}:${imageTag.split("-")[0]}`;
74208
74660
  }
@@ -77992,7 +78444,7 @@ function scrubEncryptedCredentials(options) {
77992
78444
  __name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
77993
78445
 
77994
78446
  //#endregion
77995
- //#region ../workers-auth/dist/chunk-YCVYA5LL.mjs
78447
+ //#region ../workers-auth/dist/chunk-T63LVVAX.mjs
77996
78448
  function createPreferences(getConfigPath) {
77997
78449
  function getUserPreferencesPath() {
77998
78450
  return path__default.resolve(getConfigPath(), "preferences.json");
@@ -78771,7 +79223,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
78771
79223
  return oauthFlow.requireApiToken();
78772
79224
  }
78773
79225
  __name$1(requireApiToken$1, "requireApiToken");
78774
- function withDefaultScopes(complianceConfig, props) {
79226
+ function withLoginDefaults(complianceConfig, props) {
78775
79227
  return {
78776
79228
  complianceConfig,
78777
79229
  scopes: props?.scopes ?? descriptor.getDefaultScopeKeys(),
@@ -78779,12 +79231,12 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
78779
79231
  callbackHost: props?.callbackHost,
78780
79232
  callbackPort: props?.callbackPort,
78781
79233
  profile: props?.profile,
78782
- device: props?.device
79234
+ device: props?.device ?? descriptor.useDeviceFlowByDefault ?? false
78783
79235
  };
78784
79236
  }
78785
- __name$1(withDefaultScopes, "withDefaultScopes");
79237
+ __name$1(withLoginDefaults, "withLoginDefaults");
78786
79238
  async function login(complianceConfig, props) {
78787
- return oauthFlow.login(withDefaultScopes(complianceConfig, props));
79239
+ return oauthFlow.login(withLoginDefaults(complianceConfig, props));
78788
79240
  }
78789
79241
  __name$1(login, "login");
78790
79242
  async function logout(profile) {
@@ -78793,7 +79245,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
78793
79245
  __name$1(logout, "logout");
78794
79246
  async function loginOrRefreshIfRequired(complianceConfig, props) {
78795
79247
  if (oauthFlow.getActiveTemporaryAccount()) return { loggedIn: true };
78796
- return oauthFlow.loginOrRefreshIfRequired(withDefaultScopes(complianceConfig, props));
79248
+ return oauthFlow.loginOrRefreshIfRequired(withLoginDefaults(complianceConfig, props));
78797
79249
  }
78798
79250
  __name$1(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
78799
79251
  async function getOAuthTokenFromLocalState() {
@@ -78826,10 +79278,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
78826
79278
  return configCache.getConfigCache(getAccountCacheFileName()).account;
78827
79279
  }
78828
79280
  __name$1(getAccountFromCache, "getAccountFromCache");
78829
- async function fetchAccountsPaged(complianceConfig, resource) {
78830
- const result = await loginOrRefreshIfRequired(complianceConfig);
78831
- if (!result.loggedIn) throw new UserError(`Not logged in. ${NOT_LOGGED_IN_ERROR_BODIES[result.reason]}${NOT_LOGGED_IN_WHOAMI_TIP}`, { telemetryMessage: "cfetch auth login required" });
78832
- const credentials = requireApiToken$1();
79281
+ async function fetchAccountsPaged(complianceConfig, resource, credentials) {
78833
79282
  const results = [];
78834
79283
  let getMoreResults = true;
78835
79284
  let page = 1;
@@ -78849,7 +79298,10 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
78849
79298
  __name$1(fetchAccountsPaged, "fetchAccountsPaged");
78850
79299
  async function fetchAllAccounts(complianceConfig, options = {}) {
78851
79300
  const { throwOnEmpty = true } = options;
78852
- const [accountsRes, membershipsRes] = await Promise.allSettled([fetchAccountsPaged(complianceConfig, `/accounts`), fetchAccountsPaged(complianceConfig, `/memberships`)]);
79301
+ const loginResult = await loginOrRefreshIfRequired(complianceConfig);
79302
+ if (!loginResult.loggedIn) throw new UserError(`Not logged in. ${NOT_LOGGED_IN_ERROR_BODIES[loginResult.reason]}${NOT_LOGGED_IN_WHOAMI_TIP}`, { telemetryMessage: "cfetch auth login required" });
79303
+ const credentials = requireApiToken$1();
79304
+ const [accountsRes, membershipsRes] = await Promise.allSettled([fetchAccountsPaged(complianceConfig, `/accounts`, credentials), fetchAccountsPaged(complianceConfig, `/memberships`, credentials)]);
78853
79305
  if (accountsRes.status === "rejected") throw accountsRes.reason;
78854
79306
  if (membershipsRes.status === "rejected") if (isMembershipsInaccessible(membershipsRes.reason)) {
78855
79307
  if (accountsRes.status === "fulfilled" && accountsRes.value.length > 0) return accountsRes.value;
@@ -79146,7 +79598,483 @@ function getCfConfigPath() {
79146
79598
  });
79147
79599
  }
79148
79600
  __name$1(getCfConfigPath, "getCfConfigPath");
79149
- var CF_SCOPES = [
79601
+ var CF_REGISTERED_SCOPES = [
79602
+ "access:read",
79603
+ "access:write",
79604
+ "account:read",
79605
+ "agw:read",
79606
+ "agw:run",
79607
+ "agw:write",
79608
+ "ai:read",
79609
+ "ai:write",
79610
+ "ai-search:read",
79611
+ "ai-search:run",
79612
+ "ai-search:write",
79613
+ "aiaudit:read",
79614
+ "aiaudit:write",
79615
+ "aig:read",
79616
+ "aig:write",
79617
+ "auditlogs:read",
79618
+ "billing:read",
79619
+ "billing:write",
79620
+ "browser:read",
79621
+ "browser:write",
79622
+ "cfone:read",
79623
+ "cfone:write",
79624
+ "cloudchamber:write",
79625
+ "connectivity:admin",
79626
+ "connectivity:bind",
79627
+ "connectivity:read",
79628
+ "constellation:write",
79629
+ "containers:write",
79630
+ "d1:write",
79631
+ "dex:read",
79632
+ "dex:write",
79633
+ "dns_analytics:read",
79634
+ "dns_records:edit",
79635
+ "dns_records:read",
79636
+ "dns_settings:read",
79637
+ "email_routing:read",
79638
+ "email_routing:write",
79639
+ "email_sending:read",
79640
+ "email_sending:write",
79641
+ "firstpartytags:write",
79642
+ "images:read",
79643
+ "images:write",
79644
+ "lb:edit",
79645
+ "lb:read",
79646
+ "logpush:read",
79647
+ "logpush:write",
79648
+ "mcp_portals:read",
79649
+ "mcp_portals:write",
79650
+ "notebook-examples:read",
79651
+ "notebook-managed:read",
79652
+ "notification:read",
79653
+ "notification:write",
79654
+ "oauth_account_ssl_and_certificates_write",
79655
+ "offline",
79656
+ "openid",
79657
+ "pages:read",
79658
+ "pages:write",
79659
+ "pipelines:read",
79660
+ "pipelines:setup",
79661
+ "pipelines:write",
79662
+ "query_cache:write",
79663
+ "queues:write",
79664
+ "r2_catalog:write",
79665
+ "radar:read",
79666
+ "rag:read",
79667
+ "rag:write",
79668
+ "registrar:read",
79669
+ "registrar:write",
79670
+ "secrets_store:read",
79671
+ "secrets_store:write",
79672
+ "sso-connector:read",
79673
+ "sso-connector:write",
79674
+ "ssl_certs:write",
79675
+ "teams:pii",
79676
+ "teams:read",
79677
+ "teams:secure_location",
79678
+ "teams:write",
79679
+ "url_scanner:read",
79680
+ "url_scanner:write",
79681
+ "user:read",
79682
+ "vectorize:write",
79683
+ "workers:read",
79684
+ "workers:write",
79685
+ "workers_builds:read",
79686
+ "workers_builds:write",
79687
+ "workers_deployments:read",
79688
+ "workers_kv:write",
79689
+ "workers_observability:read",
79690
+ "workers_observability:write",
79691
+ "workers_observability_telemetry:write",
79692
+ "workers_routes:write",
79693
+ "workers_scripts:write",
79694
+ "workers_tail:read",
79695
+ "zone:read",
79696
+ "account-analytics.read",
79697
+ "account-ssl-and-certificates.write",
79698
+ "ssl-and-certificates.read",
79699
+ "ssl-and-certificates.write",
79700
+ "registrar-domains.read",
79701
+ "registrar-domains.admin",
79702
+ "logs.read",
79703
+ "logs.write",
79704
+ "websearch.run",
79705
+ "snippets.read",
79706
+ "snippets.write",
79707
+ "access-acct.read",
79708
+ "access-acct.revoke",
79709
+ "access-acct.write",
79710
+ "access-app.read",
79711
+ "access-app.revoke",
79712
+ "access-app.write",
79713
+ "access-audit-log.read",
79714
+ "access-certificate.read",
79715
+ "access-certificate.write",
79716
+ "access-custom-page.read",
79717
+ "access-custom-page.write",
79718
+ "access-device-posture.read",
79719
+ "access-device-posture.write",
79720
+ "access-group.read",
79721
+ "access-group.write",
79722
+ "access-idp.read",
79723
+ "access-idp.write",
79724
+ "access-key.read",
79725
+ "access-key.write",
79726
+ "access-org.read",
79727
+ "access-org.revoke",
79728
+ "access-org.write",
79729
+ "access-policy-test.read",
79730
+ "access-policy-test.write",
79731
+ "access-policy.read",
79732
+ "access-policy.write",
79733
+ "access-population.read",
79734
+ "access-population.write",
79735
+ "access-saml-certificate.read",
79736
+ "access-saml-certificate.write",
79737
+ "access-scim-log.read",
79738
+ "access-seats.write",
79739
+ "access-service-token.read",
79740
+ "access-service-token.write",
79741
+ "access-ssh-auditing.read",
79742
+ "access-ssh-auditing.write",
79743
+ "access-tag.read",
79744
+ "access-tag.write",
79745
+ "access-users.read",
79746
+ "access-users.write",
79747
+ "access.read",
79748
+ "access.revoke",
79749
+ "access.write",
79750
+ "account-api-gateway.read",
79751
+ "account-api-gateway.write",
79752
+ "account-custom-asset.read",
79753
+ "account-custom-asset.write",
79754
+ "account-custom-error-rules.read",
79755
+ "account-custom-error-rules.write",
79756
+ "account-custom-pages.read",
79757
+ "account-custom-pages.write",
79758
+ "account-disable-esc.read",
79759
+ "account-disable-esc.write",
79760
+ "account-dns-settings.read",
79761
+ "account-dns-settings.write",
79762
+ "account-firewall-access-rules.read",
79763
+ "account-firewall-access-rules.write",
79764
+ "account-logs.read",
79765
+ "account-logs.write",
79766
+ "account-rule-lists.read",
79767
+ "account-rule-lists.write",
79768
+ "account-rulesets.read",
79769
+ "account-rulesets.write",
79770
+ "account-security-center-insights.read",
79771
+ "account-security-center-insights.write",
79772
+ "account-settings.read",
79773
+ "account-settings.write",
79774
+ "account-ssl-and-certificates.read",
79775
+ "account-waf.read",
79776
+ "account-waf.write",
79777
+ "account-waiting-rooms.read",
79778
+ "address-maps.read",
79779
+ "address-maps.write",
79780
+ "agent-memory.write",
79781
+ "agw.read",
79782
+ "agw.run",
79783
+ "agw.write",
79784
+ "ai-search.index",
79785
+ "ai-search.metadata_read",
79786
+ "ai-search.read",
79787
+ "ai-search.run",
79788
+ "ai-search.write",
79789
+ "ai.read",
79790
+ "ai.write",
79791
+ "aiaudit.read",
79792
+ "aiaudit.write",
79793
+ "aig.metadata_read",
79794
+ "aig.read",
79795
+ "aig.run",
79796
+ "aig.write",
79797
+ "analytics.read",
79798
+ "api-gateway.read",
79799
+ "api-gateway.write",
79800
+ "apps.write",
79801
+ "argotunnel.read",
79802
+ "argotunnel.write",
79803
+ "artifacts.read",
79804
+ "artifacts.write",
79805
+ "bot-management-feedback.read",
79806
+ "bot-management-feedback.write",
79807
+ "bot-management.read",
79808
+ "bot-management.write",
79809
+ "browser-rendering.read",
79810
+ "browser-rendering.write",
79811
+ "cache-settings.read",
79812
+ "cache-settings.write",
79813
+ "cache.purge",
79814
+ "calls.read",
79815
+ "calls.write",
79816
+ "casb.read",
79817
+ "casb.write",
79818
+ "cf-agents.read",
79819
+ "cf-agents.write",
79820
+ "challenge-widgets.read",
79821
+ "challenge-widgets.write",
79822
+ "chinanetwork-steering.read",
79823
+ "chinanetwork-steering.write",
79824
+ "cloud-connector.read",
79825
+ "cloud-connector.write",
79826
+ "cloud-email-security.read",
79827
+ "cloud-email-security.write",
79828
+ "cloudchamber.read",
79829
+ "cloudchamber.write",
79830
+ "cloudforce-one.read",
79831
+ "cloudforce-one.write",
79832
+ "config-settings.read",
79833
+ "config-settings.write",
79834
+ "connectivity-directory.admin",
79835
+ "connectivity-directory.bind",
79836
+ "connectivity-directory.read",
79837
+ "constellation.read",
79838
+ "constellation.write",
79839
+ "containers.read",
79840
+ "containers.write",
79841
+ "custom-errors.read",
79842
+ "custom-errors.write",
79843
+ "custom-pages.read",
79844
+ "custom-pages.write",
79845
+ "d1.metadata_read",
79846
+ "d1.read",
79847
+ "d1.write",
79848
+ "ddos-botnet-feed.read",
79849
+ "ddos-botnet-feed.write",
79850
+ "ddos-protection.read",
79851
+ "ddos-protection.write",
79852
+ "dls.read",
79853
+ "dls.write",
79854
+ "dns-firewall.read",
79855
+ "dns-firewall.write",
79856
+ "dns-view.read",
79857
+ "dns-view.write",
79858
+ "dns.read",
79859
+ "dns.write",
79860
+ "domain-page-shield.read",
79861
+ "domain-page.shield",
79862
+ "dynamic-redirect.read",
79863
+ "dynamic-redirect.write",
79864
+ "email-routing-account-rule.read",
79865
+ "email-routing-address.read",
79866
+ "email-routing-address.write",
79867
+ "email-routing-rule.read",
79868
+ "email-routing-rule.write",
79869
+ "email-routing-suppression.read",
79870
+ "email-routing-suppression.write",
79871
+ "email-security-dmarcreports.read",
79872
+ "email-security-dmarcreports.write",
79873
+ "email-sending.read",
79874
+ "email-sending.write",
79875
+ "fbm.admin",
79876
+ "fbm.read",
79877
+ "fbm.write",
79878
+ "field-extractor.read",
79879
+ "field-extractor.write",
79880
+ "firewall-for-ai.read",
79881
+ "firewall-for-ai.write",
79882
+ "firewall-services.read",
79883
+ "firewall-services.write",
79884
+ "flagship.evaluate",
79885
+ "flagship.read",
79886
+ "flagship.write",
79887
+ "fraud-detection-pii.read",
79888
+ "fraud-detection.read",
79889
+ "fraud-detection.write",
79890
+ "fraud-events.write",
79891
+ "fraud-feedback.read",
79892
+ "fraud-feedback.write",
79893
+ "healthcheck.read",
79894
+ "healthcheck.write",
79895
+ "http-applications.read",
79896
+ "http-applications.write",
79897
+ "http-ddos-managed-ruleset.read",
79898
+ "http-ddos-managed-ruleset.write",
79899
+ "images.metadata_read",
79900
+ "images.read",
79901
+ "images.write",
79902
+ "integration.write",
79903
+ "intel.read",
79904
+ "intel.write",
79905
+ "iot.read",
79906
+ "iot.write",
79907
+ "ip-prefix-bgp-on-demand.read",
79908
+ "ip-prefix-bgp-on-demand.write",
79909
+ "ip-prefix.read",
79910
+ "ip-prefix.write",
79911
+ "l4-ddos-managed-ruleset.read",
79912
+ "l4-ddos-managed-ruleset.write",
79913
+ "load-balancers-account.read",
79914
+ "load-balancers-account.write",
79915
+ "load-balancers.read",
79916
+ "load-balancers.write",
79917
+ "load-balancing-monitors-and-pools.read",
79918
+ "load-balancing-monitors-and-pools.write",
79919
+ "magic-firewall.read",
79920
+ "magic-firewall.write",
79921
+ "magic-transit.read",
79922
+ "magic-transit.write",
79923
+ "magic-wan.read",
79924
+ "magic-wan.write",
79925
+ "managed-headers.read",
79926
+ "managed-headers.write",
79927
+ "mass-url-redirects.read",
79928
+ "mass-url-redirects.write",
79929
+ "mcp-portals.read",
79930
+ "mcp-portals.write",
79931
+ "memberships.read",
79932
+ "memberships.write",
79933
+ "messaging.edit",
79934
+ "messaging.metadata_read",
79935
+ "messaging.read",
79936
+ "moq.read",
79937
+ "moq.write",
79938
+ "notifications.read",
79939
+ "notifications.write",
79940
+ "origin.read",
79941
+ "origin.write",
79942
+ "page-rules.read",
79943
+ "page-rules.write",
79944
+ "page-shield.read",
79945
+ "page.read",
79946
+ "page.shield",
79947
+ "page.write",
79948
+ "pages.metadata_read",
79949
+ "payments-gateway.read",
79950
+ "payments-gateway.write",
79951
+ "pcaps-api.read",
79952
+ "pcaps-api.write",
79953
+ "pipelines.read",
79954
+ "pipelines.send",
79955
+ "pipelines.write",
79956
+ "precursor.read",
79957
+ "precursor.write",
79958
+ "pubsub.read",
79959
+ "pubsub.write",
79960
+ "query-cache.read",
79961
+ "query-cache.write",
79962
+ "queues.metadata_read",
79963
+ "queues.read",
79964
+ "queues.write",
79965
+ "r2-catalog-sql.read",
79966
+ "r2-catalog.read",
79967
+ "r2-catalog.write",
79968
+ "radar.read",
79969
+ "rag.read",
79970
+ "rag.run",
79971
+ "rag.write",
79972
+ "realtime.admin",
79973
+ "realtime.read",
79974
+ "realtime.write",
79975
+ "registrar-sandbox-domains.admin",
79976
+ "registrar-sandbox-domains.read",
79977
+ "reports-application-security-report.read",
79978
+ "request-tracer.read",
79979
+ "resource-library.read",
79980
+ "resource-library.write",
79981
+ "resource-sharing.read",
79982
+ "response-compression.read",
79983
+ "response-compression.write",
79984
+ "sanitize.read",
79985
+ "sanitize.write",
79986
+ "secrets-store.read",
79987
+ "secrets-store.write",
79988
+ "select-configuration.read",
79989
+ "select-configuration.write",
79990
+ "stream.metadata_read",
79991
+ "stream.read",
79992
+ "stream.write",
79993
+ "tag.read",
79994
+ "tag.write",
79995
+ "teams-cds-compute-account.read",
79996
+ "teams-cds-compute-account.write",
79997
+ "teams-connector-cloudflared.monitoring",
79998
+ "teams-connector-cloudflared.read",
79999
+ "teams-connector-cloudflared.write",
80000
+ "teams-connector-warp.read",
80001
+ "teams-connector-warp.write",
80002
+ "teams-connectors.read",
80003
+ "teams-connectors.write",
80004
+ "teams-dex.read",
80005
+ "teams-dex.write",
80006
+ "teams-networks.read",
80007
+ "teams-networks.write",
80008
+ "teams-pii.read",
80009
+ "teams-resilience.read",
80010
+ "teams-resilience.write",
80011
+ "teams-secure.location",
80012
+ "teams.read",
80013
+ "teams.report",
80014
+ "teams.write",
80015
+ "transform-rules.read",
80016
+ "transform-rules.write",
80017
+ "trust-and-safety.read",
80018
+ "trust-and-safety.write",
80019
+ "url-scanner.read",
80020
+ "url-scanner.write",
80021
+ "user-details.read",
80022
+ "user-details.write",
80023
+ "vectorize.read",
80024
+ "vectorize.write",
80025
+ "waiting-rooms.read",
80026
+ "waiting-rooms.write",
80027
+ "web3-hostnames.read",
80028
+ "web3-hostnames.write",
80029
+ "websearch.metadata_read",
80030
+ "websearch.read",
80031
+ "websearch.write",
80032
+ "workers-ci.read",
80033
+ "workers-ci.write",
80034
+ "workers-kv-storage.metadata_read",
80035
+ "workers-kv-storage.read",
80036
+ "workers-kv-storage.write",
80037
+ "workers-observability-telemetry.write",
80038
+ "workers-observability.read",
80039
+ "workers-observability.write",
80040
+ "workers-r2-bucket-item.read",
80041
+ "workers-r2-bucket-item.write",
80042
+ "workers-r2.metadata_read",
80043
+ "workers-r2.read",
80044
+ "workers-r2.write",
80045
+ "workers-routes.read",
80046
+ "workers-routes.write",
80047
+ "workers-scripts.bind",
80048
+ "workers-scripts.read",
80049
+ "workers-scripts.write",
80050
+ "workers-tail.read",
80051
+ "workers_ai.metadata_read",
80052
+ "zaraz.edit",
80053
+ "zaraz.read",
80054
+ "zaraz.write",
80055
+ "zone-access.read",
80056
+ "zone-access.revoke",
80057
+ "zone-access.write",
80058
+ "zone-custom-asset.read",
80059
+ "zone-custom-asset.write",
80060
+ "zone-disable-esc.read",
80061
+ "zone-disable-esc.write",
80062
+ "zone-dns-settings.read",
80063
+ "zone-dns-settings.write",
80064
+ "zone-security-center-insights.read",
80065
+ "zone-security-center-insights.write",
80066
+ "zone-settings.read",
80067
+ "zone-settings.write",
80068
+ "zone-transform-rules.read",
80069
+ "zone-transform-rules.write",
80070
+ "zone-versioning.read",
80071
+ "zone-versioning.write",
80072
+ "zone-waf.read",
80073
+ "zone-waf.write",
80074
+ "zone.read",
80075
+ "zone.write"
80076
+ ];
80077
+ var DefaultScopeKeys$1 = [...[
79150
80078
  "openid",
79151
80079
  "offline",
79152
80080
  "user:read",
@@ -79235,13 +80163,12 @@ var CF_SCOPES = [
79235
80163
  "workers_scripts:write",
79236
80164
  "workers_tail:read",
79237
80165
  "zone:read"
79238
- ];
79239
- var DefaultScopeKeys$1 = [...CF_SCOPES];
80166
+ ]];
79240
80167
  function setLoginScopeKeys$1(scopes) {
79241
80168
  DefaultScopeKeys$1 = scopes;
79242
80169
  }
79243
80170
  __name$1(setLoginScopeKeys$1, "setLoginScopeKeys");
79244
- var CF_SCOPE_SET = new Set(CF_SCOPES);
80171
+ var CF_SCOPE_SET = new Set(CF_REGISTERED_SCOPES);
79245
80172
  function validateScopeKeys$1(scopes) {
79246
80173
  return scopes.every((scope) => CF_SCOPE_SET.has(scope));
79247
80174
  }
@@ -79270,12 +80197,13 @@ var CF_CLI = {
79270
80197
  login: "cf auth login",
79271
80198
  whoami: "cf auth whoami",
79272
80199
  createProfile: "cf auth create",
79273
- deviceLogin: "cf auth login --device"
80200
+ deviceLogin: "cf auth login"
79274
80201
  },
79275
80202
  keyringServiceName: CF_KEYRING_SERVICE_NAME,
79276
80203
  clientId: getClientIdFromEnv$1,
79277
80204
  consent: CF_CONSENT_PAGES,
79278
80205
  redirectUri: CF_OAUTH_CALLBACK_URL,
80206
+ useDeviceFlowByDefault: true,
79279
80207
  allowGlobalAuthKey: false,
79280
80208
  getConfigPath: getCfConfigPath,
79281
80209
  getTemporaryAccountConfigPath: getCfTemporaryAccountConfigPath,
@@ -79330,7 +80258,6 @@ var DefaultScopes = {
79330
80258
  "ai:write": "See and change Workers AI catalog and assets",
79331
80259
  "ai-search:write": "See and change AI Search data",
79332
80260
  "ai-search:run": "Run search queries on your AI Search instances",
79333
- "websearch.run": "Run search queries against Cloudflare Web Search",
79334
80261
  "agent-memory:write": "See and change Agent Memory data such as keys and namespaces.",
79335
80262
  "queues:write": "See and change Cloudflare Queues settings and data",
79336
80263
  "pipelines:write": "See and change Cloudflare Pipelines configurations and data",
@@ -79557,7 +80484,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$2({ "../../node_modules/
79557
80484
  }) });
79558
80485
 
79559
80486
  //#endregion
79560
- //#region ../deploy-helpers/dist/chunk-3G6JZQDH.mjs
80487
+ //#region ../deploy-helpers/dist/chunk-QBZBEHZB.mjs
79561
80488
  var import_undici$1 = require_undici();
79562
80489
  var import_command_exists = require_command_exists();
79563
80490
  function handleUnsafeCapnp(capnp) {
@@ -79634,7 +80561,6 @@ function createWorkerUploadForm(worker, bindings, options) {
79634
80561
  const vectorize = extractBindingsOfType("vectorize", bindings);
79635
80562
  const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
79636
80563
  const ai_search = extractBindingsOfType("ai_search", bindings);
79637
- const websearch = extractBindingsOfType("websearch", bindings)[0];
79638
80564
  const agent_memory = extractBindingsOfType("agent_memory", bindings);
79639
80565
  const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
79640
80566
  const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
@@ -79810,10 +80736,6 @@ function createWorkerUploadForm(worker, bindings, options) {
79810
80736
  instance_name
79811
80737
  });
79812
80738
  });
79813
- if (websearch !== void 0) metadataBindings.push({
79814
- name: websearch.binding,
79815
- type: "websearch"
79816
- });
79817
80739
  agent_memory.forEach(({ binding, namespace }) => {
79818
80740
  if (options?.dryRun) namespace ??= INHERIT_SYMBOL;
79819
80741
  if (namespace === void 0) throw new UserError(`${binding} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the namespace to bind to.`, { telemetryMessage: false });
@@ -80117,7 +81039,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
80117
81039
  //#endregion
80118
81040
  //#region ../remote-bindings/dist/index.mjs
80119
81041
  var import_undici = require_undici();
80120
- var version$2 = "0.0.23";
81042
+ var version$2 = "0.0.25";
80121
81043
  var NoDefaultValueProvided = class extends UserError {
80122
81044
  constructor() {
80123
81045
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });