@cloudflare/vite-plugin 1.54.5 → 1.54.7

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
@@ -11,17 +11,17 @@ import path__default, { basename, dirname, isAbsolute, join, relative, resolve }
11
11
  import os, { arch } from "node:os";
12
12
  import process$1, { exit, stdin, stdout } from "node:process";
13
13
  import tty from "node:tty";
14
- import childProcess, { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
15
- import crypto$1, { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID, webcrypto } from "node:crypto";
14
+ import url, { URL as URL$1, URLSearchParams as URLSearchParams$1, fileURLToPath, pathToFileURL } from "node:url";
16
15
  import net from "node:net";
17
16
  import http from "node:http";
18
17
  import events, { EventEmitter } from "node:events";
19
18
  import { Buffer as Buffer$1 } from "node:buffer";
20
- import url, { URL as URL$1, URLSearchParams as URLSearchParams$1, fileURLToPath, pathToFileURL } from "node:url";
19
+ import crypto$1, { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID, webcrypto } from "node:crypto";
21
20
  import { AsyncLocalStorage } from "node:async_hooks";
22
21
  import { assert } from "node:console";
23
22
  import * as fsp from "node:fs/promises";
24
23
  import fs, { constants as constants$1 } from "node:fs/promises";
24
+ import childProcess, { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
25
25
  import * as timersPromises from "node:timers/promises";
26
26
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
27
27
  import { CoreHeaders, CorePaths, DeferredPromise, Log, LogLevel, Miniflare, MiniflareCoreError, Mutex, Request as Request$1, Response as Response$1, buildPublicUrl, convertV4MiniflareOptions, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
@@ -137,49 +137,58 @@ function createFatalError$1(message, isJson, options) {
137
137
  __name$5(createFatalError$1, "createFatalError");
138
138
 
139
139
  //#endregion
140
- //#region ../workers-utils/dist/chunk-V6JSHOVJ.mjs
140
+ //#region ../workers-utils/dist/chunk-IQDQ5WRD.mjs
141
141
  function hasKnownExportType(entry) {
142
142
  const type = entry?.type;
143
143
  return type === "durable-object" || type === "worker";
144
144
  }
145
145
  __name$5(hasKnownExportType, "hasKnownExportType");
146
- function partitionExports(exports$1$1) {
146
+ function partitionExports(exports$1) {
147
147
  const partitioned = {
148
148
  "durable-object": {},
149
149
  worker: {}
150
150
  };
151
- if (exports$1$1 === void 0) return partitioned;
152
- for (const [name, entry] of Object.entries(exports$1$1)) {
151
+ if (exports$1 === void 0) return partitioned;
152
+ for (const [name, entry] of Object.entries(exports$1)) {
153
153
  if (!hasKnownExportType(entry)) continue;
154
154
  partitioned[entry.type][name] = entry;
155
155
  }
156
156
  return partitioned;
157
157
  }
158
158
  __name$5(partitionExports, "partitionExports");
159
- function getDurableObjectExports(exports$1$1) {
160
- return partitionExports(exports$1$1)["durable-object"];
159
+ function getDurableObjectExports(exports$1) {
160
+ return partitionExports(exports$1)["durable-object"];
161
161
  }
162
162
  __name$5(getDurableObjectExports, "getDurableObjectExports");
163
- function hasDurableObjectExports(exports$1$1) {
164
- return Object.keys(getDurableObjectExports(exports$1$1)).length > 0;
163
+ function hasDurableObjectExports(exports$1) {
164
+ return Object.keys(getDurableObjectExports(exports$1)).length > 0;
165
165
  }
166
166
  __name$5(hasDurableObjectExports, "hasDurableObjectExports");
167
- function getContainerNameToClassNameMap(exports$1$1) {
167
+ var CONTAINER_IMAGES_BINDING = "EXPERIMENTAL_CLOUDFLARE_CONTAINER_IMAGES";
168
+ function isDurableObjectContainerApp(container) {
169
+ return container.scheduling_policy === "durable_object";
170
+ }
171
+ __name$5(isDurableObjectContainerApp, "isDurableObjectContainerApp");
172
+ function getDurableObjectContainerApps(containers) {
173
+ return Array.isArray(containers) ? containers.filter(isDurableObjectContainerApp) : [];
174
+ }
175
+ __name$5(getDurableObjectContainerApps, "getDurableObjectContainerApps");
176
+ function getContainerNameToClassNameMap(exports$1) {
168
177
  const containerNameToClassName = /* @__PURE__ */ new Map();
169
- for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1$1))) if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) containerNameToClassName.set(entry.container, className);
178
+ 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);
170
179
  return containerNameToClassName;
171
180
  }
172
181
  __name$5(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
173
- function resolveContainerClassName(container, exports$1$1) {
182
+ function resolveContainerClassName(container, exports$1) {
174
183
  if (container.class_name !== void 0) return container.class_name;
175
184
  if (container.name === void 0) return;
176
- return getContainerNameToClassNameMap(exports$1$1).get(container.name);
185
+ return getContainerNameToClassNameMap(exports$1).get(container.name);
177
186
  }
178
187
  __name$5(resolveContainerClassName, "resolveContainerClassName");
179
- function getContainerDurableObjectClassNames(containers, exports$1$1) {
188
+ function getContainerDurableObjectClassNames(containers, exports$1) {
180
189
  const classNames = /* @__PURE__ */ new Set();
181
190
  for (const container of containers ?? []) {
182
- const className = resolveContainerClassName(container, exports$1$1);
191
+ const className = resolveContainerClassName(container, exports$1);
183
192
  if (className !== void 0) classNames.add(className);
184
193
  }
185
194
  return classNames;
@@ -2548,12 +2557,12 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
2548
2557
  __name$5(formatConfigSnippet, "formatConfigSnippet");
2549
2558
 
2550
2559
  //#endregion
2551
- //#region ../workers-utils/dist/chunk-XADL62NU.mjs
2552
- var DEFAULT_COMPAT_DATE = "2026-09-07";
2560
+ //#region ../workers-utils/dist/chunk-S3ANQ67D.mjs
2561
+ var DEFAULT_COMPAT_DATE = "2026-09-10";
2553
2562
  function assertNever(_value) {}
2554
2563
  __name$5(assertNever, "assertNever");
2555
- function mapWorkerMetadataBindings(bindings$1) {
2556
- return bindings$1.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
2564
+ function mapWorkerMetadataBindings(bindings) {
2565
+ return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
2557
2566
  switch (binding.type) {
2558
2567
  case "plain_text":
2559
2568
  configObj.vars = {
@@ -3042,7 +3051,7 @@ function getGlobalWranglerCachePath() {
3042
3051
  __name$5(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
3043
3052
 
3044
3053
  //#endregion
3045
- //#region ../workers-utils/dist/chunk-XUGGRRBO.mjs
3054
+ //#region ../workers-utils/dist/chunk-IYSONYTF.mjs
3046
3055
  var getC3CommandFromEnv = getEnvironmentVariableFactory({
3047
3056
  variableName: "WRANGLER_C3_COMMAND",
3048
3057
  defaultValue: /* @__PURE__ */ __name$5(() => "create cloudflare", "defaultValue")
@@ -3093,6 +3102,11 @@ function getComplianceRegionSubdomain(complianceConfig) {
3093
3102
  return getCloudflareComplianceRegion(complianceConfig) === "fedramp_high" ? ".fed" : "";
3094
3103
  }
3095
3104
  __name$5(getComplianceRegionSubdomain, "getComplianceRegionSubdomain");
3105
+ function getCloudflareContainerRegistry(complianceConfig = COMPLIANCE_REGION_CONFIG_UNKNOWN) {
3106
+ if (process.env.CLOUDFLARE_CONTAINER_REGISTRY) return process.env.CLOUDFLARE_CONTAINER_REGISTRY;
3107
+ return `${process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging." : ""}registry${getComplianceRegionSubdomain(complianceConfig)}.cloudflare.com`;
3108
+ }
3109
+ __name$5(getCloudflareContainerRegistry, "getCloudflareContainerRegistry");
3096
3110
  function getStagingSubdomain() {
3097
3111
  return getCloudflareApiEnvironmentFromEnv() === "staging" ? ".staging" : "";
3098
3112
  }
@@ -9766,8 +9780,8 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
9766
9780
  * @param {import('net').Socket} socket
9767
9781
  * @param {*} llhttp
9768
9782
  */
9769
- constructor(client, socket, { exports: exports$2 }) {
9770
- this.llhttp = exports$2;
9783
+ constructor(client, socket, { exports: exports$1 }) {
9784
+ this.llhttp = exports$1;
9771
9785
  this.ptr = this.llhttp.llhttp_alloc(constants$6.TYPE.RESPONSE);
9772
9786
  this.client = client;
9773
9787
  /**
@@ -25884,7 +25898,7 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
25884
25898
  //#endregion
25885
25899
  //#region ../workers-utils/dist/index.mjs
25886
25900
  var import_undici$3 = require_undici();
25887
- var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1$1, module$1) {
25901
+ var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module$1) {
25888
25902
  module$1.exports = [
25889
25903
  {
25890
25904
  name: "Agola CI",
@@ -26210,26 +26224,26 @@ var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
26210
26224
  }
26211
26225
  ];
26212
26226
  } });
26213
- var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1$1) {
26227
+ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1) {
26214
26228
  var vendors$1 = require_vendors$1();
26215
26229
  var env$3 = process.env;
26216
- Object.defineProperty(exports$1$1, "_vendors", { value: vendors$1.map(function(v) {
26230
+ Object.defineProperty(exports$1, "_vendors", { value: vendors$1.map(function(v) {
26217
26231
  return v.constant;
26218
26232
  }) });
26219
- exports$1$1.name = null;
26220
- exports$1$1.isPR = null;
26221
- exports$1$1.id = null;
26233
+ exports$1.name = null;
26234
+ exports$1.isPR = null;
26235
+ exports$1.id = null;
26222
26236
  if (env$3.CI !== "false") vendors$1.forEach(function(vendor) {
26223
26237
  const isCI2 = (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every(function(obj) {
26224
26238
  return checkEnv$1(obj);
26225
26239
  });
26226
- exports$1$1[vendor.constant] = isCI2;
26240
+ exports$1[vendor.constant] = isCI2;
26227
26241
  if (!isCI2) return;
26228
- exports$1$1.name = vendor.name;
26229
- exports$1$1.isPR = checkPR$1(vendor);
26230
- exports$1$1.id = vendor.constant;
26242
+ exports$1.name = vendor.name;
26243
+ exports$1.isPR = checkPR$1(vendor);
26244
+ exports$1.id = vendor.constant;
26231
26245
  });
26232
- exports$1$1.isCI = !!(env$3.CI !== "false" && (env$3.BUILD_ID || env$3.BUILD_NUMBER || env$3.CI || env$3.CI_APP_ID || env$3.CI_BUILD_ID || env$3.CI_BUILD_NUMBER || env$3.CI_NAME || env$3.CONTINUOUS_INTEGRATION || env$3.RUN_ID || exports$1$1.name || false));
26246
+ exports$1.isCI = !!(env$3.CI !== "false" && (env$3.BUILD_ID || env$3.BUILD_NUMBER || env$3.CI || env$3.CI_APP_ID || env$3.CI_BUILD_ID || env$3.CI_BUILD_NUMBER || env$3.CI_NAME || env$3.CONTINUOUS_INTEGRATION || env$3.RUN_ID || exports$1.name || false));
26233
26247
  function checkEnv$1(obj) {
26234
26248
  if (typeof obj === "string") return !!env$3[obj];
26235
26249
  if ("env" in obj) return env$3[obj.env] && env$3[obj.env].includes(obj.includes);
@@ -26257,7 +26271,7 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
26257
26271
  }
26258
26272
  __name$5(checkPR$1, "checkPR");
26259
26273
  } });
26260
- var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1$1, module$1) {
26274
+ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module$1) {
26261
26275
  var exec$3 = __require$1("child_process").exec;
26262
26276
  var execSync$2 = __require$1("child_process").execSync;
26263
26277
  var fs3 = __require$1("fs");
@@ -26361,14 +26375,14 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
26361
26375
  else return commandExistsUnixSync$1(commandName, cleanedCommandName);
26362
26376
  };
26363
26377
  } });
26364
- var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1$1, module$1) {
26378
+ var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module$1) {
26365
26379
  module$1.exports = require_command_exists$2();
26366
26380
  } });
26367
- var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1$1) {
26368
- exports$1$1.parse = exports$1$1.decode = decode3;
26369
- exports$1$1.stringify = exports$1$1.encode = encode3;
26370
- exports$1$1.safe = safe;
26371
- exports$1$1.unsafe = unsafe;
26381
+ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
26382
+ exports$1.parse = exports$1.decode = decode3;
26383
+ exports$1.stringify = exports$1.encode = encode3;
26384
+ exports$1.safe = safe;
26385
+ exports$1.unsafe = unsafe;
26372
26386
  var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
26373
26387
  function encode3(obj, opt) {
26374
26388
  var children = [];
@@ -26500,7 +26514,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26500
26514
  }
26501
26515
  __name$5(unsafe, "unsafe");
26502
26516
  } });
26503
- var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1$1, module$1) {
26517
+ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1, module$1) {
26504
26518
  var singleComment = 1;
26505
26519
  var multiComment = 2;
26506
26520
  function stripWithoutWhitespace() {
@@ -26559,16 +26573,16 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
26559
26573
  return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
26560
26574
  };
26561
26575
  } });
26562
- var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1$1) {
26576
+ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
26563
26577
  var fs3 = __require$1("fs");
26564
26578
  var ini = require_ini();
26565
26579
  var path5 = __require$1("path");
26566
26580
  var stripJsonComments = require_strip_json_comments();
26567
- var parse3$1 = exports$1$1.parse = function(content) {
26581
+ var parse3$1 = exports$1.parse = function(content) {
26568
26582
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
26569
26583
  return ini.parse(content);
26570
26584
  };
26571
- var file2 = exports$1$1.file = function() {
26585
+ var file2 = exports$1.file = function() {
26572
26586
  var args = [].slice.call(arguments).filter(function(arg) {
26573
26587
  return arg != null;
26574
26588
  });
@@ -26580,11 +26594,11 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26580
26594
  return;
26581
26595
  }
26582
26596
  };
26583
- exports$1$1.json = function() {
26597
+ exports$1.json = function() {
26584
26598
  var content = file2.apply(null, arguments);
26585
26599
  return content ? parse3$1(content) : null;
26586
26600
  };
26587
- exports$1$1.env = function(prefix, env2) {
26601
+ exports$1.env = function(prefix, env2) {
26588
26602
  env2 = env2 || process.env;
26589
26603
  var obj = {};
26590
26604
  var l = prefix.length;
@@ -26602,7 +26616,7 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26602
26616
  }
26603
26617
  return obj;
26604
26618
  };
26605
- exports$1$1.find = function() {
26619
+ exports$1.find = function() {
26606
26620
  var rel = path5.join.apply(null, [].slice.call(arguments));
26607
26621
  function find2(start, rel2) {
26608
26622
  var file3 = path5.join(start, rel2);
@@ -26617,7 +26631,7 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26617
26631
  return find2(process.cwd(), rel);
26618
26632
  };
26619
26633
  } });
26620
- var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1$1, module$1) {
26634
+ var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1, module$1) {
26621
26635
  function isSpecificValue(val) {
26622
26636
  return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
26623
26637
  }
@@ -26680,7 +26694,7 @@ var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0
26680
26694
  return target$1;
26681
26695
  };
26682
26696
  } });
26683
- var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1$1, module$1) {
26697
+ var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1, module$1) {
26684
26698
  module$1.exports = function(args, opts) {
26685
26699
  if (!opts) opts = {};
26686
26700
  var flags = {
@@ -26855,7 +26869,7 @@ var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/n
26855
26869
  }
26856
26870
  __name$5(isConstructorOrProto, "isConstructorOrProto");
26857
26871
  } });
26858
- var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1$1, module$1) {
26872
+ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1, module$1) {
26859
26873
  var cc = require_utils$1();
26860
26874
  var join3 = __require$1("path").join;
26861
26875
  var deepExtend = require_deep_extend();
@@ -26899,14 +26913,14 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
26899
26913
  ]));
26900
26914
  };
26901
26915
  } });
26902
- var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1$1, module$1) {
26916
+ var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1, module$1) {
26903
26917
  module$1.exports = function(scope) {
26904
26918
  var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
26905
26919
  var url2 = rc[scope + ":registry"] || rc.registry;
26906
26920
  return url2.slice(-1) === "/" ? url2 : url2 + "/";
26907
26921
  };
26908
26922
  } });
26909
- var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1$1, module$1) {
26923
+ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1, module$1) {
26910
26924
  var buffer$1 = __require$1("buffer");
26911
26925
  var Buffer2 = buffer$1.Buffer;
26912
26926
  function copyProps(src$1, dst) {
@@ -26915,8 +26929,8 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
26915
26929
  __name$5(copyProps, "copyProps");
26916
26930
  if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) module$1.exports = buffer$1;
26917
26931
  else {
26918
- copyProps(buffer$1, exports$1$1);
26919
- exports$1$1.Buffer = SafeBuffer;
26932
+ copyProps(buffer$1, exports$1);
26933
+ exports$1.Buffer = SafeBuffer;
26920
26934
  }
26921
26935
  function SafeBuffer(arg, encodingOrOffset, length) {
26922
26936
  return Buffer2(arg, encodingOrOffset, length);
@@ -26945,7 +26959,7 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
26945
26959
  return buffer$1.SlowBuffer(size);
26946
26960
  };
26947
26961
  } });
26948
- var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1$1, module$1) {
26962
+ var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1, module$1) {
26949
26963
  var safeBuffer = require_safe_buffer().Buffer;
26950
26964
  function decodeBase64(base643) {
26951
26965
  return safeBuffer.from(base643, "base64").toString("utf8");
@@ -26960,7 +26974,7 @@ var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-toke
26960
26974
  encodeBase64
26961
26975
  };
26962
26976
  } });
26963
- var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1$1, module$1) {
26977
+ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1, module$1) {
26964
26978
  var url2 = __require$1("url");
26965
26979
  var base643 = require_base64();
26966
26980
  var decodeBase64 = base643.decodeBase64;
@@ -27035,7 +27049,7 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
27035
27049
  }
27036
27050
  __name$5(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
27037
27051
  } });
27038
- var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1$1, module$1) {
27052
+ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
27039
27053
  var { URL: URL2 } = __require$1("url");
27040
27054
  var { join: join3 } = __require$1("path");
27041
27055
  var fs3 = __require$1("fs");
@@ -27314,7 +27328,7 @@ __export(external_exports$1, {
27314
27328
  ZodEmail: () => ZodEmail$1,
27315
27329
  ZodEmoji: () => ZodEmoji$1,
27316
27330
  ZodEnum: () => ZodEnum$1,
27317
- ZodError: () => ZodError,
27331
+ ZodError: () => ZodError$1,
27318
27332
  ZodExactOptional: () => ZodExactOptional$1,
27319
27333
  ZodFile: () => ZodFile,
27320
27334
  ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
@@ -27928,7 +27942,7 @@ __export(util_exports$1, {
27928
27942
  parsedType: () => parsedType,
27929
27943
  partial: () => partial$1,
27930
27944
  pick: () => pick$1,
27931
- prefixIssues: () => prefixIssues$1,
27945
+ prefixIssues: () => prefixIssues$2,
27932
27946
  primitiveTypes: () => primitiveTypes$1,
27933
27947
  promiseAllObject: () => promiseAllObject,
27934
27948
  propertyKeyTypes: () => propertyKeyTypes$1,
@@ -28378,7 +28392,7 @@ function explicitlyAborted$1(x, startIndex = 0) {
28378
28392
  return false;
28379
28393
  }
28380
28394
  __name$5(explicitlyAborted$1, "explicitlyAborted");
28381
- function prefixIssues$1(path5, issues) {
28395
+ function prefixIssues$2(path5, issues) {
28382
28396
  return issues.map((iss) => {
28383
28397
  var _a3;
28384
28398
  (_a3 = iss).path ?? (_a3.path = []);
@@ -28386,7 +28400,7 @@ function prefixIssues$1(path5, issues) {
28386
28400
  return iss;
28387
28401
  });
28388
28402
  }
28389
- __name$5(prefixIssues$1, "prefixIssues");
28403
+ __name$5(prefixIssues$2, "prefixIssues");
28390
28404
  function unwrapMessage$1(message) {
28391
28405
  return typeof message === "string" ? message : message?.message;
28392
28406
  }
@@ -29351,7 +29365,7 @@ var $ZodCheckEndsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckEndsWith", (i
29351
29365
  };
29352
29366
  });
29353
29367
  function handleCheckPropertyResult(result, payload, property) {
29354
- if (result.issues.length) payload.issues.push(...prefixIssues$1(property, result.issues));
29368
+ if (result.issues.length) payload.issues.push(...prefixIssues$2(property, result.issues));
29355
29369
  }
29356
29370
  __name$5(handleCheckPropertyResult, "handleCheckPropertyResult");
29357
29371
  var $ZodCheckProperty = /* @__PURE__ */ $constructor$1("$ZodCheckProperty", (inst, def) => {
@@ -29974,7 +29988,7 @@ var $ZodDate = /* @__PURE__ */ $constructor$1("$ZodDate", (inst, def) => {
29974
29988
  };
29975
29989
  });
29976
29990
  function handleArrayResult$1(result, final, index) {
29977
- if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
29991
+ if (result.issues.length) final.issues.push(...prefixIssues$2(index, result.issues));
29978
29992
  final.value[index] = result.value;
29979
29993
  }
29980
29994
  __name$5(handleArrayResult$1, "handleArrayResult");
@@ -30010,7 +30024,7 @@ function handlePropertyResult$1(result, final, key, input, isOptionalIn, isOptio
30010
30024
  const isPresent = key in input;
30011
30025
  if (result.issues.length) {
30012
30026
  if (isOptionalIn && isOptionalOut && !isPresent) return;
30013
- final.issues.push(...prefixIssues$1(key, result.issues));
30027
+ final.issues.push(...prefixIssues$2(key, result.issues));
30014
30028
  }
30015
30029
  if (!isPresent && !isOptionalIn) {
30016
30030
  if (!result.issues.length) final.issues.push({
@@ -30582,7 +30596,7 @@ function getTupleOptStart(items, key) {
30582
30596
  }
30583
30597
  __name$5(getTupleOptStart, "getTupleOptStart");
30584
30598
  function handleTupleResult(result, final, index) {
30585
- if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
30599
+ if (result.issues.length) final.issues.push(...prefixIssues$2(index, result.issues));
30586
30600
  final.value[index] = result.value;
30587
30601
  }
30588
30602
  __name$5(handleTupleResult, "handleTupleResult");
@@ -30595,7 +30609,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
30595
30609
  final.value.length = i$1;
30596
30610
  break;
30597
30611
  }
30598
- final.issues.push(...prefixIssues$1(i$1, r2.issues));
30612
+ final.issues.push(...prefixIssues$2(i$1, r2.issues));
30599
30613
  }
30600
30614
  final.value[i$1] = r2.value;
30601
30615
  }
@@ -30646,11 +30660,11 @@ var $ZodRecord$1 = /* @__PURE__ */ $constructor$1("$ZodRecord", (inst, def) => {
30646
30660
  issues: []
30647
30661
  }, ctx);
30648
30662
  if (result instanceof Promise) proms.push(result.then((result2) => {
30649
- if (result2.issues.length) payload.issues.push(...prefixIssues$1(key, result2.issues));
30663
+ if (result2.issues.length) payload.issues.push(...prefixIssues$2(key, result2.issues));
30650
30664
  payload.value[outKey] = result2.value;
30651
30665
  }));
30652
30666
  else {
30653
- if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
30667
+ if (result.issues.length) payload.issues.push(...prefixIssues$2(key, result.issues));
30654
30668
  payload.value[outKey] = result.value;
30655
30669
  }
30656
30670
  }
@@ -30700,11 +30714,11 @@ var $ZodRecord$1 = /* @__PURE__ */ $constructor$1("$ZodRecord", (inst, def) => {
30700
30714
  issues: []
30701
30715
  }, ctx);
30702
30716
  if (result instanceof Promise) proms.push(result.then((result2) => {
30703
- if (result2.issues.length) payload.issues.push(...prefixIssues$1(key, result2.issues));
30717
+ if (result2.issues.length) payload.issues.push(...prefixIssues$2(key, result2.issues));
30704
30718
  payload.value[keyResult.value] = result2.value;
30705
30719
  }));
30706
30720
  else {
30707
- if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
30721
+ if (result.issues.length) payload.issues.push(...prefixIssues$2(key, result.issues));
30708
30722
  payload.value[keyResult.value] = result.value;
30709
30723
  }
30710
30724
  }
@@ -30747,7 +30761,7 @@ var $ZodMap = /* @__PURE__ */ $constructor$1("$ZodMap", (inst, def) => {
30747
30761
  };
30748
30762
  });
30749
30763
  function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
30750
- if (keyResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$1(key, keyResult.issues));
30764
+ if (keyResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$2(key, keyResult.issues));
30751
30765
  else final.issues.push({
30752
30766
  code: "invalid_key",
30753
30767
  origin: "map",
@@ -30755,7 +30769,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
30755
30769
  inst,
30756
30770
  issues: keyResult.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1()))
30757
30771
  });
30758
- if (valueResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$1(key, valueResult.issues));
30772
+ if (valueResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$2(key, valueResult.issues));
30759
30773
  else final.issues.push({
30760
30774
  origin: "map",
30761
30775
  code: "invalid_element",
@@ -39237,7 +39251,7 @@ var initializer2 = /* @__PURE__ */ __name$5((inst, issues) => {
39237
39251
  } }
39238
39252
  });
39239
39253
  }, "initializer");
39240
- var ZodError = /* @__PURE__ */ $constructor$1("ZodError", initializer2);
39254
+ var ZodError$1 = /* @__PURE__ */ $constructor$1("ZodError", initializer2);
39241
39255
  var ZodRealError$1 = /* @__PURE__ */ $constructor$1("ZodError", initializer2, { Parent: Error });
39242
39256
  var parse2 = /* @__PURE__ */ _parse$1(ZodRealError$1);
39243
39257
  var parseAsync2 = /* @__PURE__ */ _parseAsync$1(ZodRealError$1);
@@ -41247,14 +41261,14 @@ var getBindingNames = /* @__PURE__ */ __name$5((value) => {
41247
41261
  if (typeof value !== "object" || value === null) return [];
41248
41262
  if (isBindingList(value)) return value.bindings.map(({ name }) => name);
41249
41263
  else if (isNamespaceList(value)) return value.map(({ binding }) => binding);
41250
- else if (isRecord(value)) {
41264
+ else if (isRecord$1(value)) {
41251
41265
  if (value["binding"] !== void 0) return [value["binding"]];
41252
41266
  return Object.keys(value).filter((k) => value[k] !== void 0);
41253
41267
  } else return [];
41254
41268
  }, "getBindingNames");
41255
- var isBindingList = /* @__PURE__ */ __name$5((value) => isRecord(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
41256
- var isNamespaceList = /* @__PURE__ */ __name$5((value) => Array.isArray(value) && value.every((entry) => isRecord(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
41257
- var isRecord = /* @__PURE__ */ __name$5((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
41269
+ var isBindingList = /* @__PURE__ */ __name$5((value) => isRecord$1(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord$1(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
41270
+ var isNamespaceList = /* @__PURE__ */ __name$5((value) => Array.isArray(value) && value.every((entry) => isRecord$1(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
41271
+ var isRecord$1 = /* @__PURE__ */ __name$5((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
41258
41272
  var validateUniqueNameProperty = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
41259
41273
  if (Array.isArray(value)) {
41260
41274
  const nameCount = /* @__PURE__ */ new Map();
@@ -41829,7 +41843,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
41829
41843
  exports: inheritable(diagnostics, topLevelEnv, rawEnv, "exports", validateExports, {}),
41830
41844
  kv_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "kv_namespaces", validateBindingArray(envName, validateKVBinding), []),
41831
41845
  cloudchamber: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "cloudchamber", validateCloudchamberConfig, {}),
41832
- containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name ?? rawConfig?.name, configPath), void 0),
41846
+ containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name ?? rawConfig?.name, configPath, { complianceConfig: { compliance_region: rawEnv.compliance_region ?? topLevelEnv?.compliance_region } }), void 0),
41833
41847
  send_email: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "send_email", validateBindingArray(envName, validateSendEmailBinding), []),
41834
41848
  queues: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "queues", validateQueues(envName), {
41835
41849
  producers: [],
@@ -42450,6 +42464,11 @@ function validatePreviewsContainers(envName, configPath) {
42450
42464
  const innerValidator = validateContainerApp(envName, void 0, configPath, { generateDefaultName: false });
42451
42465
  return (diagnostics, field, value, config2) => {
42452
42466
  if (Array.isArray(value)) {
42467
+ const durableObjectPolicyFields = [...value.entries()].filter(([, entry]) => entry && typeof entry === "object" && entry.scheduling_policy === "durable_object").map(([index]) => `"${field}[${index}].scheduling_policy"`);
42468
+ if (durableObjectPolicyFields.length > 0) {
42469
+ diagnostics.errors.push(`${durableObjectPolicyFields.join(", ")} cannot be "durable_object". Durable Object-managed Containers are configured only in the top-level "containers" array.`);
42470
+ return false;
42471
+ }
42453
42472
  const nameFields = [...value.entries()].filter(([, entry]) => entry && typeof entry === "object" && "name" in entry).map(([index]) => `"${field}[${index}].name"`);
42454
42473
  if (nameFields.length > 0) {
42455
42474
  diagnostics.errors.push(`${nameFields.join(", ")} cannot be set. A preview container's application name is generated from the worker name, preview slug, and Durable Object class name, so that separate previews of the same Worker do not collide. Remove it and identify the container with "class_name".`);
@@ -42474,6 +42493,63 @@ function validatePreviewsContainers(envName, configPath) {
42474
42493
  };
42475
42494
  }
42476
42495
  __name$5(validatePreviewsContainers, "validatePreviewsContainers");
42496
+ function validateDurableObjectContainerImages(diagnostics, field, images, complianceConfig) {
42497
+ if (images === void 0) return true;
42498
+ if (typeof images !== "object" || images === null || Array.isArray(images) || Object.keys(images).length === 0) {
42499
+ diagnostics.errors.push(`"${field}" must be a non-empty object when present.`);
42500
+ return false;
42501
+ }
42502
+ let valid$2 = true;
42503
+ const entries = Object.entries(images);
42504
+ if (entries.length > 100) {
42505
+ diagnostics.errors.push(`"${field}" must contain at most 100 images.`);
42506
+ valid$2 = false;
42507
+ }
42508
+ for (const [imageName, imageValue] of entries) {
42509
+ const imageField = `${field}.${imageName}`;
42510
+ if (imageName.length === 0 || imageName.length > 128) {
42511
+ diagnostics.errors.push(`"${field}" image names must be between 1 and 128 characters.`);
42512
+ valid$2 = false;
42513
+ }
42514
+ if (typeof imageValue !== "object" || imageValue === null || Array.isArray(imageValue)) {
42515
+ diagnostics.errors.push(`"${imageField}" must be an object with either a "dockerfile" or "image" field.`);
42516
+ valid$2 = false;
42517
+ continue;
42518
+ }
42519
+ const image = imageValue;
42520
+ const hasDockerfile = image.dockerfile !== void 0;
42521
+ const hasImage = image.image !== void 0;
42522
+ if (hasDockerfile === hasImage) {
42523
+ diagnostics.errors.push(`"${imageField}" must specify exactly one of "dockerfile" or "image".`);
42524
+ valid$2 = false;
42525
+ }
42526
+ if (hasDockerfile && (typeof image.dockerfile !== "string" || image.dockerfile.length === 0)) {
42527
+ diagnostics.errors.push(`"${imageField}.dockerfile" must be a non-empty string.`);
42528
+ valid$2 = false;
42529
+ }
42530
+ if (hasImage && (typeof image.image !== "string" || image.image.length === 0)) {
42531
+ diagnostics.errors.push(`"${imageField}.image" must be a non-empty string.`);
42532
+ valid$2 = false;
42533
+ }
42534
+ if (typeof image.image === "string" && image.image.length > 0) {
42535
+ const registry2 = getCloudflareContainerRegistry(complianceConfig);
42536
+ const prefix = `${registry2}/`;
42537
+ const reference = image.image.slice(prefix.length);
42538
+ const digestReference = reference.match(/^[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*(?:\/[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*)+@sha256:[a-f0-9]{64}$/);
42539
+ if (!image.image.startsWith(prefix) || digestReference?.[0] !== reference) {
42540
+ diagnostics.errors.push(`"${imageField}.image" must be a digest-pinned image in the managed registry, in the form "${registry2}/<account-id>/<repository>@sha256:<64 lowercase hex characters>".`);
42541
+ valid$2 = false;
42542
+ }
42543
+ }
42544
+ const unsupportedFields = Object.keys(image).filter((property) => property !== "dockerfile" && property !== "image");
42545
+ if (unsupportedFields.length > 0) {
42546
+ diagnostics.errors.push(`Unexpected fields found in ${imageField} field: ${unsupportedFields.map((property) => `"${property}"`).join(", ")}`);
42547
+ valid$2 = false;
42548
+ }
42549
+ }
42550
+ return valid$2;
42551
+ }
42552
+ __name$5(validateDurableObjectContainerImages, "validateDurableObjectContainerImages");
42477
42553
  function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42478
42554
  const { generateDefaultName = true } = options;
42479
42555
  return (diagnostics, field, value, config2) => {
@@ -42483,15 +42559,30 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42483
42559
  return false;
42484
42560
  }
42485
42561
  for (const containerAppOptional of value) {
42486
- validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
42562
+ const isDurableObjectManaged = containerAppOptional.scheduling_policy === "durable_object";
42563
+ const hasValidDurableObjectClassName = typeof containerAppOptional.class_name === "string" && containerAppOptional.class_name.length > 0;
42564
+ if (isDurableObjectManaged) {
42565
+ if (!hasValidDurableObjectClassName) diagnostics.errors.push(`"containers.class_name" must be a non-empty string when "containers.scheduling_policy" is "durable_object".`);
42566
+ } else validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
42487
42567
  validateOptionalProperty(diagnostics, field, "name", containerAppOptional.name, "string");
42488
- if (generateDefaultName && !containerAppOptional.name) 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".`);
42568
+ 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".`);
42489
42569
  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.`);
42490
42570
  else {
42491
42571
  let name = `${topLevelName}-${containerAppOptional.class_name}`;
42492
42572
  name += config2 === void 0 ? "" : `-${envName}`;
42493
42573
  containerAppOptional.name = name.toLowerCase().replace(/ /g, "-");
42494
42574
  }
42575
+ if (isDurableObjectManaged) {
42576
+ validateDurableObjectContainerImages(diagnostics, `${field}.images`, containerAppOptional.images, options.complianceConfig);
42577
+ const unsupportedFields = Object.keys(containerAppOptional).filter((key) => ![
42578
+ "name",
42579
+ "class_name",
42580
+ "scheduling_policy",
42581
+ "images"
42582
+ ].includes(key));
42583
+ 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.`);
42584
+ continue;
42585
+ }
42495
42586
  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.`);
42496
42587
  if ("configuration" in containerAppOptional) {
42497
42588
  diagnostics.warnings.push(`"containers.configuration" is deprecated. Use top level "containers" fields instead. "configuration.image" should be "image", limits should be set via "instance_type".`);
@@ -42556,6 +42647,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42556
42647
  if (rolloutStepsCount > containerAppOptional.max_instances) diagnostics.errors.push(`"containers.rollout_step_percentage" cannot have more steps (${rolloutStepsCount}) than "max_instances" (${containerAppOptional.max_instances})`);
42557
42648
  }
42558
42649
  validateOptionalProperty(diagnostics, field, "image_vars", containerAppOptional.image_vars, "object");
42650
+ validateContainerObservability(diagnostics, `${field}.observability`, containerAppOptional.observability, config2);
42559
42651
  validateOptionalProperty(diagnostics, field, "scheduling_policy", containerAppOptional.scheduling_policy, "string", [
42560
42652
  "regional",
42561
42653
  "moon",
@@ -42574,6 +42666,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
42574
42666
  "image",
42575
42667
  "image_build_context",
42576
42668
  "image_vars",
42669
+ "observability",
42577
42670
  "class_name",
42578
42671
  "scheduling_policy",
42579
42672
  "instance_type",
@@ -43064,6 +43157,7 @@ var validateBindingsHaveUniqueNames = /* @__PURE__ */ __name$5((diagnostics, con
43064
43157
  const bindingNamesArray = Object.entries(friendlyBindingNames);
43065
43158
  const bindingsGroupedByType = Object.fromEntries(bindingNamesArray.map(([bindingType, binding]) => [binding, getBindingNames(bindingType === "queues" ? config2[bindingType]?.producers : config2[bindingType])]));
43066
43159
  bindingsGroupedByType["Secret"] = config2.secrets?.required ?? [];
43160
+ bindingsGroupedByType["Container images"] = [CONTAINER_IMAGES_BINDING];
43067
43161
  const bindingsGroupedByName = {};
43068
43162
  for (const bindingType in bindingsGroupedByType) {
43069
43163
  const bindingNames = bindingsGroupedByType[bindingType];
@@ -43811,6 +43905,77 @@ var validateExports = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
43811
43905
  }
43812
43906
  return valid$2;
43813
43907
  }, "validateExports");
43908
+ var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN = 1;
43909
+ var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX = 99;
43910
+ var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN = 1;
43911
+ function isContainerObservabilityEnabled(observability) {
43912
+ return observability?.logs?.enabled === true || observability?.enabled === true;
43913
+ }
43914
+ __name$5(isContainerObservabilityEnabled, "isContainerObservabilityEnabled");
43915
+ function hasConflictingContainerObservabilityEnabledValues(observability) {
43916
+ return typeof observability.enabled === "boolean" && typeof observability.logs?.enabled === "boolean" && observability.enabled !== observability.logs.enabled;
43917
+ }
43918
+ __name$5(hasConflictingContainerObservabilityEnabledValues, "hasConflictingContainerObservabilityEnabledValues");
43919
+ var validateContainerObservability = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
43920
+ if (value === void 0) return true;
43921
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
43922
+ diagnostics.errors.push(`"${field}" should be an object but got ${JSON.stringify(value)}.`);
43923
+ return false;
43924
+ }
43925
+ const val = value;
43926
+ let isValid = true;
43927
+ isValid = validateOptionalProperty(diagnostics, field, "enabled", val.enabled, "boolean") && isValid;
43928
+ if (val.logs !== void 0) if (typeof val.logs !== "object" || val.logs === null || Array.isArray(val.logs)) {
43929
+ diagnostics.errors.push(`Expected "${field}.logs" to be of type object but got ${JSON.stringify(val.logs)}.`);
43930
+ isValid = false;
43931
+ } else {
43932
+ isValid = validateOptionalProperty(diagnostics, field, "logs.enabled", val.logs.enabled, "boolean") && isValid;
43933
+ isValid = validateAdditionalProperties(diagnostics, `${field}.logs`, Object.keys(val.logs), ["enabled"]) && isValid;
43934
+ }
43935
+ if (val.enabled === void 0 && val.target_instance_percentage === void 0 && val.target_instance_count === void 0 && (val.logs === void 0 || typeof val.logs === "object" && val.logs !== null && !Array.isArray(val.logs) && val.logs.enabled === void 0)) isValid = validateAtLeastOnePropertyRequired(diagnostics, field, [{
43936
+ key: "enabled",
43937
+ value: val.enabled,
43938
+ type: "boolean"
43939
+ }, {
43940
+ key: "logs.enabled",
43941
+ value: val.logs?.enabled,
43942
+ type: "boolean"
43943
+ }]) && isValid;
43944
+ isValid = validateOptionalProperty(diagnostics, field, "target_instance_percentage", val.target_instance_percentage, "number") && isValid;
43945
+ isValid = validateOptionalProperty(diagnostics, field, "target_instance_count", val.target_instance_count, "number") && isValid;
43946
+ isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
43947
+ "enabled",
43948
+ "logs",
43949
+ "target_instance_percentage",
43950
+ "target_instance_count"
43951
+ ]) && isValid;
43952
+ if (hasConflictingContainerObservabilityEnabledValues(val)) {
43953
+ diagnostics.errors.push(`"${field}.enabled" and "${field}.logs.enabled" cannot be set to different values.`);
43954
+ isValid = false;
43955
+ }
43956
+ if (val.target_instance_percentage !== void 0 && val.target_instance_count !== void 0) {
43957
+ diagnostics.errors.push(`"${field}.target_instance_percentage" and "${field}.target_instance_count" cannot both be set.`);
43958
+ isValid = false;
43959
+ }
43960
+ if (typeof val.target_instance_percentage === "number" && (!Number.isInteger(val.target_instance_percentage) || val.target_instance_percentage < CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN || val.target_instance_percentage > CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX)) {
43961
+ diagnostics.errors.push(`"${field}.target_instance_percentage" must be an integer between ${CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN} and ${CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX} inclusive.`);
43962
+ isValid = false;
43963
+ }
43964
+ if (typeof val.target_instance_count === "number" && (!Number.isInteger(val.target_instance_count) || val.target_instance_count < CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN)) {
43965
+ diagnostics.errors.push(`"${field}.target_instance_count" must be a positive integer.`);
43966
+ isValid = false;
43967
+ }
43968
+ const observabilityEnabled = isContainerObservabilityEnabled(val);
43969
+ if (val.target_instance_percentage !== void 0 && !observabilityEnabled) {
43970
+ diagnostics.errors.push(`"${field}.target_instance_percentage" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
43971
+ isValid = false;
43972
+ }
43973
+ if (val.target_instance_count !== void 0 && !observabilityEnabled) {
43974
+ diagnostics.errors.push(`"${field}.target_instance_count" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
43975
+ isValid = false;
43976
+ }
43977
+ return isValid;
43978
+ }, "validateContainerObservability");
43814
43979
  var validateObservability = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
43815
43980
  if (value === void 0) return true;
43816
43981
  if (typeof value !== "object" || value === null) {
@@ -43912,11 +44077,11 @@ var validateCache = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
43912
44077
  isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled", "cross_version_cache"]) && isValid;
43913
44078
  return isValid;
43914
44079
  }, "validateCache");
43915
- function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1$1, configPath) {
44080
+ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1, configPath) {
43916
44081
  if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) return;
43917
44082
  const exportedDurableObjects = durableObjects.bindings.filter((binding) => !binding.script_name);
43918
44083
  const exportsCovers = /* @__PURE__ */ __name$5((className) => {
43919
- const entry = exports$1$1?.[className];
44084
+ const entry = exports$1?.[className];
43920
44085
  if (entry === void 0 || entry.type !== "durable-object") return false;
43921
44086
  const state = entry.state ?? "created";
43922
44087
  return state === "created" || state === "expecting-transfer";
@@ -43938,11 +44103,11 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
43938
44103
  \`\`\``);
43939
44104
  }
43940
44105
  __name$5(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
43941
- function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1$1) {
43942
- if (migrations.length > 0 && exports$1$1 !== void 0 && Object.values(exports$1$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.`);
44106
+ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1) {
44107
+ 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.`);
43943
44108
  }
43944
44109
  __name$5(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
43945
- function validateContainerExportLinks(diagnostics, containers, exports$1$1, containersDeclaredElsewhere) {
44110
+ function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
43946
44111
  if (containers !== void 0 && !Array.isArray(containers)) return;
43947
44112
  if (containers === void 0 && containersDeclaredElsewhere) return;
43948
44113
  const containersByName = /* @__PURE__ */ new Map();
@@ -43960,7 +44125,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
43960
44125
  }
43961
44126
  const overSubscribedClassNames = new Set([...containerCountByClassName].filter(([, count]) => count > 1).map(([className]) => className));
43962
44127
  for (const className of [...overSubscribedClassNames].sort()) diagnostics.errors.push(`More than one container is attached to the Durable Object "${className}". A Durable Object can only have one container attached to it.`);
43963
- const durableObjectExports = getDurableObjectExports(exports$1$1);
44128
+ const durableObjectExports = getDurableObjectExports(exports$1);
43964
44129
  const liveExportClassNames = /* @__PURE__ */ new Set();
43965
44130
  const classNamesByContainerName = /* @__PURE__ */ new Map();
43966
44131
  for (const [className, entry] of Object.entries(durableObjectExports)) {
@@ -43974,7 +44139,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
43974
44139
  classNamesByContainerName.set(entry.container, [...classNamesByContainerName.get(entry.container) ?? [], className]);
43975
44140
  }
43976
44141
  for (const [containerName, classNames] of classNamesByContainerName) if (classNames.length > 1) diagnostics.errors.push(`The container "${containerName}" is referenced by more than one Durable Object export (${classNames.join(", ")}). A container can only back a single Durable Object.`);
43977
- const containerNameToClassName = getContainerNameToClassNameMap(exports$1$1);
44142
+ const containerNameToClassName = getContainerNameToClassNameMap(exports$1);
43978
44143
  const usesDurableObjectExports = Object.keys(durableObjectExports).length > 0;
43979
44144
  for (const container of containers ?? []) {
43980
44145
  if (typeof container.name !== "string") continue;
@@ -44552,8 +44717,8 @@ function getBindingKey(type) {
44552
44717
  return "binding";
44553
44718
  }
44554
44719
  __name$5(getBindingKey, "getBindingKey");
44555
- function extractBindingsOfType(type, bindings$1) {
44556
- return Object.entries(bindings$1 ?? {}).filter((binding) => binding[1].type === type).map((binding) => ({
44720
+ function extractBindingsOfType(type, bindings) {
44721
+ return Object.entries(bindings ?? {}).filter((binding) => binding[1].type === type).map((binding) => ({
44557
44722
  ...binding[1],
44558
44723
  [getBindingKey(type)]: binding[0]
44559
44724
  }));
@@ -44570,7 +44735,7 @@ __name$5(getBindings, "getBindings");
44570
44735
  var { dim: dim$1, white: white$1 } = source_default;
44571
44736
  var brandColor$1 = source_default.hex("#BD5B08");
44572
44737
  var isConnectedStatusExplained = false;
44573
- function printBindings(bindings$1, options) {
44738
+ function printBindings(bindings, options) {
44574
44739
  const { containers = [], log: log$1, streamingTailConsumers = [], tailConsumers = [] } = options;
44575
44740
  const context = options;
44576
44741
  let hasConnectionStatus = false;
@@ -44585,48 +44750,48 @@ function printBindings(bindings$1, options) {
44585
44750
  return `${s.substring(0, maxLength - 3)}...`;
44586
44751
  }, "truncate");
44587
44752
  const output = [];
44588
- const data_blobs = extractBindingsOfType("data_blob", bindings$1);
44589
- const durable_objects = extractBindingsOfType("durable_object_namespace", bindings$1);
44590
- const workflows = extractBindingsOfType("workflow", bindings$1);
44591
- const kv_namespaces = extractBindingsOfType("kv_namespace", bindings$1);
44592
- const send_email = extractBindingsOfType("send_email", bindings$1);
44593
- const queues = extractBindingsOfType("queue", bindings$1);
44594
- const d1_databases = extractBindingsOfType("d1", bindings$1);
44595
- const vectorize = extractBindingsOfType("vectorize", bindings$1);
44596
- const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings$1);
44597
- const ai_search = extractBindingsOfType("ai_search", bindings$1);
44598
- const websearch = extractBindingsOfType("websearch", bindings$1);
44599
- const agent_memory = extractBindingsOfType("agent_memory", bindings$1);
44600
- const hyperdrive = extractBindingsOfType("hyperdrive", bindings$1);
44601
- const r2_buckets = extractBindingsOfType("r2_bucket", bindings$1);
44602
- const logfwdr = extractBindingsOfType("logfwdr", bindings$1);
44603
- const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings$1);
44604
- const artifacts = extractBindingsOfType("artifacts", bindings$1);
44605
- const services = extractBindingsOfType("service", bindings$1);
44606
- const vpc_services = extractBindingsOfType("vpc_service", bindings$1);
44607
- const vpc_networks = extractBindingsOfType("vpc_network", bindings$1);
44608
- const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings$1);
44609
- const text_blobs = extractBindingsOfType("text_blob", bindings$1);
44610
- const browser = extractBindingsOfType("browser", bindings$1);
44611
- const images = extractBindingsOfType("images", bindings$1);
44612
- const stream$2 = extractBindingsOfType("stream", bindings$1);
44613
- const ai = extractBindingsOfType("ai", bindings$1);
44614
- const version_metadata = extractBindingsOfType("version_metadata", bindings$1);
44615
- const vars = Object.entries(bindings$1 ?? {}).filter(([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text").map(([name, binding]) => ({
44753
+ const data_blobs = extractBindingsOfType("data_blob", bindings);
44754
+ const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
44755
+ const workflows = extractBindingsOfType("workflow", bindings);
44756
+ const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
44757
+ const send_email = extractBindingsOfType("send_email", bindings);
44758
+ const queues = extractBindingsOfType("queue", bindings);
44759
+ const d1_databases = extractBindingsOfType("d1", bindings);
44760
+ const vectorize = extractBindingsOfType("vectorize", bindings);
44761
+ const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
44762
+ const ai_search = extractBindingsOfType("ai_search", bindings);
44763
+ const websearch = extractBindingsOfType("websearch", bindings);
44764
+ const agent_memory = extractBindingsOfType("agent_memory", bindings);
44765
+ const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
44766
+ const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
44767
+ const logfwdr = extractBindingsOfType("logfwdr", bindings);
44768
+ const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
44769
+ const artifacts = extractBindingsOfType("artifacts", bindings);
44770
+ const services = extractBindingsOfType("service", bindings);
44771
+ const vpc_services = extractBindingsOfType("vpc_service", bindings);
44772
+ const vpc_networks = extractBindingsOfType("vpc_network", bindings);
44773
+ const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
44774
+ const text_blobs = extractBindingsOfType("text_blob", bindings);
44775
+ const browser = extractBindingsOfType("browser", bindings);
44776
+ const images = extractBindingsOfType("images", bindings);
44777
+ const stream$2 = extractBindingsOfType("stream", bindings);
44778
+ const ai = extractBindingsOfType("ai", bindings);
44779
+ const version_metadata = extractBindingsOfType("version_metadata", bindings);
44780
+ const vars = Object.entries(bindings ?? {}).filter(([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text").map(([name, binding]) => ({
44616
44781
  binding: name,
44617
44782
  ...binding
44618
44783
  }));
44619
- const wasm_modules = extractBindingsOfType("wasm_module", bindings$1);
44620
- const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings$1);
44621
- const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings$1);
44622
- const pipelines = extractBindingsOfType("pipeline", bindings$1);
44623
- const ratelimits = extractBindingsOfType("ratelimit", bindings$1);
44624
- const assets = extractBindingsOfType("assets", bindings$1);
44625
- const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings$1);
44626
- const flagship = extractBindingsOfType("flagship", bindings$1);
44627
- const media = extractBindingsOfType("media", bindings$1);
44628
- const worker_loaders = extractBindingsOfType("worker_loader", bindings$1);
44629
- const unsafe_bindings = Object.entries(bindings$1 ?? {}).filter(([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world").map(([name, binding]) => ({
44784
+ const wasm_modules = extractBindingsOfType("wasm_module", bindings);
44785
+ const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
44786
+ const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
44787
+ const pipelines = extractBindingsOfType("pipeline", bindings);
44788
+ const ratelimits = extractBindingsOfType("ratelimit", bindings);
44789
+ const assets = extractBindingsOfType("assets", bindings);
44790
+ const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
44791
+ const flagship = extractBindingsOfType("flagship", bindings);
44792
+ const media = extractBindingsOfType("media", bindings);
44793
+ const worker_loaders = extractBindingsOfType("worker_loader", bindings);
44794
+ const unsafe_bindings = Object.entries(bindings ?? {}).filter(([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world").map(([name, binding]) => ({
44630
44795
  name,
44631
44796
  ...binding
44632
44797
  }));
@@ -45029,7 +45194,7 @@ ${allTailConsumers.map(({ service, streaming }) => {
45029
45194
  let containersTitle = "The following containers are available:";
45030
45195
  if (context.name && isMultiWorker) containersTitle = `The following containers are available from ${source_default.blue(context.name)}:`;
45031
45196
  log$1(`${containersTitle}
45032
- ${containers.map((c$1) => `- ${c$1.name} (${c$1.image})`).join("\n")}`);
45197
+ ${containers.map((container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name} (durable_object)` : `- ${container.name} (${container.image})`).join("\n")}`);
45033
45198
  log$1("");
45034
45199
  }
45035
45200
  if (context.unsafeMetadata) {
@@ -45361,6 +45526,267 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
45361
45526
  };
45362
45527
  }
45363
45528
  __name$5(getWranglerTmpDir, "getWranglerTmpDir");
45529
+ function buildDetailedError(message, ...extra) {
45530
+ return new ParseError({
45531
+ text: message,
45532
+ notes: extra.map((text) => ({ text })),
45533
+ telemetryMessage: false
45534
+ });
45535
+ }
45536
+ __name$5(buildDetailedError, "buildDetailedError");
45537
+ function maybeThrowFriendlyError(error51) {
45538
+ if (error51.message === "workers.api.error.email_verification_required") throw buildDetailedError("Please verify your account's email address and try again.", "Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one.");
45539
+ }
45540
+ __name$5(maybeThrowFriendlyError, "maybeThrowFriendlyError");
45541
+ function logHeaders(headers, logger$1) {
45542
+ const clone2 = cloneHeaders(headers);
45543
+ clone2.delete("Authorization");
45544
+ logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
45545
+ }
45546
+ __name$5(logHeaders, "logHeaders");
45547
+ async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
45548
+ assert2(credentials, "credentials are required for performApiFetch");
45549
+ const method = init.method ?? "GET";
45550
+ assert2(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
45551
+ const headers = cloneHeaders(new import_undici$3.Headers(init.headers));
45552
+ addAuthorizationHeader(headers, credentials);
45553
+ headers.set("User-Agent", userAgent);
45554
+ maybeAddTraceHeader(headers);
45555
+ const queryString = queryParams ? `?${queryParams.toString()}` : "";
45556
+ logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
45557
+ logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
45558
+ logHeaders(headers, logger$1);
45559
+ logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
45560
+ if (init.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init.body).text(), null, 2);
45561
+ logger$1.debug("-- END CF API REQUEST");
45562
+ return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
45563
+ method,
45564
+ ...init,
45565
+ headers,
45566
+ signal: abortSignal
45567
+ });
45568
+ }
45569
+ __name$5(performApiFetchBase, "performApiFetchBase");
45570
+ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
45571
+ const method = init.method ?? "GET";
45572
+ const response = await performApiFetchBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
45573
+ const jsonText = await response.text();
45574
+ logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
45575
+ logHeaders(response.headers, logger$1);
45576
+ logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
45577
+ logger$1.debug("-- END CF API RESPONSE");
45578
+ const retryAfterMs = parseRetryAfterMs(response.headers);
45579
+ if (!jsonText && (response.status === 204 || response.status === 205)) return {
45580
+ response: {
45581
+ result: {},
45582
+ success: true,
45583
+ errors: [],
45584
+ messages: []
45585
+ },
45586
+ status: response.status,
45587
+ retryAfterMs
45588
+ };
45589
+ if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
45590
+ try {
45591
+ return {
45592
+ response: parseJSON(jsonText),
45593
+ status: response.status,
45594
+ retryAfterMs
45595
+ };
45596
+ } catch {
45597
+ const rayId = extractWAFBlockRayId(response.headers);
45598
+ throw new APIError({
45599
+ text: "Received a malformed response from the API",
45600
+ notes: [
45601
+ { text: truncate(jsonText, 100) },
45602
+ { text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
45603
+ ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
45604
+ ],
45605
+ status: response.status,
45606
+ retryAfterMs,
45607
+ telemetryMessage: false
45608
+ });
45609
+ }
45610
+ }
45611
+ __name$5(fetchInternalBase, "fetchInternalBase");
45612
+ async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
45613
+ const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
45614
+ if (json2.success) return json2.result;
45615
+ else throwFetchError(resource, json2, status$1, retryAfterMs);
45616
+ }
45617
+ __name$5(fetchResultBase, "fetchResultBase");
45618
+ async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, credentials) {
45619
+ const results = [];
45620
+ let getMoreResults = true;
45621
+ let cursor$1;
45622
+ while (getMoreResults) {
45623
+ if (cursor$1) {
45624
+ queryParams = new URLSearchParams$1(queryParams);
45625
+ queryParams.set("cursor", cursor$1);
45626
+ }
45627
+ const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, void 0, credentials);
45628
+ if (json2.success) {
45629
+ results.push(...json2.result);
45630
+ if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
45631
+ else getMoreResults = false;
45632
+ } else throwFetchError(resource, json2, status$1, retryAfterMs);
45633
+ }
45634
+ return results;
45635
+ }
45636
+ __name$5(fetchListResultBase, "fetchListResultBase");
45637
+ function truncate(text, maxLength) {
45638
+ const { length } = text;
45639
+ if (length <= maxLength) return text;
45640
+ return `${text.substring(0, maxLength)}... (length = ${length})`;
45641
+ }
45642
+ __name$5(truncate, "truncate");
45643
+ function isWAFBlockResponse(headers) {
45644
+ return headers.get("cf-mitigated") === "challenge";
45645
+ }
45646
+ __name$5(isWAFBlockResponse, "isWAFBlockResponse");
45647
+ function parseRetryAfterValue(retryAfter) {
45648
+ if (!retryAfter) return;
45649
+ if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
45650
+ const retryAfterDate = new Date(retryAfter);
45651
+ if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
45652
+ }
45653
+ __name$5(parseRetryAfterValue, "parseRetryAfterValue");
45654
+ function parseRetryAfterMs(headers) {
45655
+ return parseRetryAfterValue(headers.get("Retry-After"));
45656
+ }
45657
+ __name$5(parseRetryAfterMs, "parseRetryAfterMs");
45658
+ function extractWAFBlockRayId(headers) {
45659
+ return headers.get("cf-ray") ?? void 0;
45660
+ }
45661
+ __name$5(extractWAFBlockRayId, "extractWAFBlockRayId");
45662
+ function extractAccountTag(resource) {
45663
+ return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
45664
+ }
45665
+ __name$5(extractAccountTag, "extractAccountTag");
45666
+ function hasMorePages(result_info) {
45667
+ const page = result_info?.page;
45668
+ const per_page = result_info?.per_page;
45669
+ const total = result_info?.total_count;
45670
+ return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
45671
+ }
45672
+ __name$5(hasMorePages, "hasMorePages");
45673
+ function renderError(err, level = 0) {
45674
+ const indent = " ".repeat(level);
45675
+ const message = err.message ?? "";
45676
+ const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
45677
+
45678
+ ${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
45679
+ return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
45680
+ ${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
45681
+ }
45682
+ __name$5(renderError, "renderError");
45683
+ function addAuthorizationHeader(headers, auth, overrideExisting = false) {
45684
+ if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
45685
+ const authorizationHeader = `Bearer ${auth.apiToken}`;
45686
+ validateAuthorizationHeaderValue(authorizationHeader);
45687
+ headers.set("Authorization", authorizationHeader);
45688
+ } else {
45689
+ headers.set("X-Auth-Key", auth.authKey);
45690
+ headers.set("X-Auth-Email", auth.authEmail);
45691
+ }
45692
+ }
45693
+ __name$5(addAuthorizationHeader, "addAuthorizationHeader");
45694
+ function validateAuthorizationHeaderValue(value) {
45695
+ for (const character of value) {
45696
+ const codePoint = character.codePointAt(0);
45697
+ if (codePoint === void 0 || codePoint > 255) throw new UserError(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
45698
+ }
45699
+ }
45700
+ __name$5(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
45701
+ function formatAuthorizationHeaderCharacter(character, codePoint) {
45702
+ if (codePoint === void 0) return "\"\\u{unknown}\"";
45703
+ const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
45704
+ return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
45705
+ }
45706
+ __name$5(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
45707
+ function isPrintableCharacter(character) {
45708
+ return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
45709
+ }
45710
+ __name$5(isPrintableCharacter, "isPrintableCharacter");
45711
+ function escapeCharacter(character) {
45712
+ return Array.from(character).map((c$1) => {
45713
+ const codePoint = c$1.codePointAt(0);
45714
+ if (codePoint === void 0) return "";
45715
+ return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
45716
+ }).join("");
45717
+ }
45718
+ __name$5(escapeCharacter, "escapeCharacter");
45719
+ function throwFetchError(resource, response, status$1, retryAfterMs) {
45720
+ const errors$1 = response.errors ?? [];
45721
+ for (const error52 of errors$1) maybeThrowFriendlyError(error52);
45722
+ const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
45723
+ if (notes.length === 0) {
45724
+ const raw = response;
45725
+ const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
45726
+ if (fallbackMessage) notes.push({ text: fallbackMessage });
45727
+ }
45728
+ if (retryAfterMs !== void 0) notes.push({ text: `The API responded with a "Retry-After" header indicating you should wait ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying.` });
45729
+ const error51 = new APIError({
45730
+ text: `A request to the Cloudflare API (${resource}) failed.`,
45731
+ notes,
45732
+ status: status$1,
45733
+ retryAfterMs,
45734
+ telemetryMessage: false
45735
+ });
45736
+ const code = errors$1[0]?.code;
45737
+ if (code) error51.code = code;
45738
+ const meta3 = errors$1[0]?.meta;
45739
+ if (meta3) error51.meta = meta3;
45740
+ error51.accountTag = extractAccountTag(resource);
45741
+ throw error51;
45742
+ }
45743
+ __name$5(throwFetchError, "throwFetchError");
45744
+ function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
45745
+ const rayId = extractWAFBlockRayId(headers);
45746
+ throw new APIError({
45747
+ text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
45748
+ notes: [
45749
+ { text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
45750
+ ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
45751
+ { text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser." },
45752
+ { text: `${method} ${resource} -> ${status$1} ${statusText}` }
45753
+ ],
45754
+ status: status$1,
45755
+ retryAfterMs,
45756
+ telemetryMessage: false
45757
+ });
45758
+ }
45759
+ __name$5(throwWAFBlockError, "throwWAFBlockError");
45760
+ async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
45761
+ const headers = new import_undici$3.Headers();
45762
+ addAuthorizationHeader(headers, credentials);
45763
+ headers.set("User-Agent", userAgent);
45764
+ maybeAddTraceHeader(headers);
45765
+ const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
45766
+ logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
45767
+ logger$1.debug("-- END CF API REQUEST");
45768
+ const response = await (0, import_undici$3.fetch)(resource, {
45769
+ method: "GET",
45770
+ headers
45771
+ });
45772
+ if (response.ok) return await response.arrayBuffer();
45773
+ else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
45774
+ }
45775
+ __name$5(fetchKVGetValueBase, "fetchKVGetValueBase");
45776
+ function hasCursor(result_info) {
45777
+ const cursor$1 = result_info?.cursor;
45778
+ return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
45779
+ }
45780
+ __name$5(hasCursor, "hasCursor");
45781
+ function maybeAddTraceHeader(headers) {
45782
+ const traceHeader = getTraceHeader();
45783
+ if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
45784
+ }
45785
+ __name$5(maybeAddTraceHeader, "maybeAddTraceHeader");
45786
+ function cloneHeaders(headers) {
45787
+ return new import_undici$3.Headers(headers);
45788
+ }
45789
+ __name$5(cloneHeaders, "cloneHeaders");
45364
45790
  var import_command_exists$1 = __toESM(require_command_exists2());
45365
45791
  var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
45366
45792
  var CLOUDFLARED_VERSION_PATTERN = /^\d{4}\.\d+\.\d+$/;
@@ -45750,12 +46176,93 @@ function removeCloudflaredCache(version2) {
45750
46176
  }
45751
46177
  __name$5(removeCloudflaredCache, "removeCloudflaredCache");
45752
46178
  var TUNNEL_STARTUP_TIMEOUT_MS = 3e4;
46179
+ var TUNNEL_API_TIMEOUT_MS = 6e4;
45753
46180
  var TUNNEL_FORCE_KILL_TIMEOUT_MS = 5e3;
45754
46181
  var DEFAULT_TUNNEL_EXPIRY_MS = 3600 * 1e3;
45755
46182
  var DEFAULT_TUNNEL_EXTENSION_MS = 3600 * 1e3;
45756
46183
  var DEFAULT_TUNNEL_MAX_REMAINING_MS = 10800 * 1e3;
45757
46184
  var DEFAULT_TUNNEL_REMINDER_INTERVAL_MS = 600 * 1e3;
45758
46185
  var QUICK_TUNNEL_URL_REGEX = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
46186
+ var LOCAL_TUNNEL_HOSTNAMES = /* @__PURE__ */ new Set([
46187
+ "localhost",
46188
+ "127.0.0.1",
46189
+ "::1",
46190
+ "0.0.0.0",
46191
+ "::"
46192
+ ]);
46193
+ async function resolveNamedTunnel(name, origin, options) {
46194
+ const { accountId, apiToken, complianceRegion, logger: logger$1, userAgent, abortSignal } = options;
46195
+ const complianceConfig = { compliance_region: complianceRegion };
46196
+ const resource = `/accounts/${accountId}/cfd_tunnel`;
46197
+ const tunnel = (await fetchResultBase(complianceConfig, resource, void 0, userAgent, logger$1, new URLSearchParams({
46198
+ name,
46199
+ is_deleted: "false"
46200
+ }), createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).find((item) => item.name === name);
46201
+ if (!tunnel) throw new UserError(`No Cloudflare Tunnel named "${name}" was found in this account. Use "wrangler tunnel list" to see available tunnels.`, { telemetryMessage: "tunnel resolve named missing tunnel" });
46202
+ const tunnelId = tunnel.id;
46203
+ if (!tunnelId) throw new FatalError(`Tunnel "${name}" was found but has no ID. This is unexpected.`, { telemetryMessage: "tunnel resolve named missing tunnel id" });
46204
+ const ingress = (await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/configurations`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).config?.ingress ?? [];
46205
+ const hostnames = getMatchingIngressHostnames(origin, ingress);
46206
+ if (hostnames.length === 0) throw new UserError(createMissingIngressMessage(name, origin, {
46207
+ dashboardUrl: `https://dash.cloudflare.com/${accountId}/tunnels/${tunnelId}`,
46208
+ ingress
46209
+ }), { telemetryMessage: "tunnel resolve named ingress mismatch" });
46210
+ const token = await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/token`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken);
46211
+ return {
46212
+ hostnames,
46213
+ token: String(token)
46214
+ };
46215
+ }
46216
+ __name$5(resolveNamedTunnel, "resolveNamedTunnel");
46217
+ function getMatchingIngressHostnames(origin, ingressConfig) {
46218
+ const hostnames = /* @__PURE__ */ new Set();
46219
+ const originUrl = normalizeURL(origin);
46220
+ for (const ingress of ingressConfig) try {
46221
+ const serviceUrl = normalizeURL(ingress.service);
46222
+ if (ingress.hostname && serviceUrl.toString() === originUrl.toString()) hostnames.add(ingress.hostname);
46223
+ } catch {}
46224
+ return [...hostnames];
46225
+ }
46226
+ __name$5(getMatchingIngressHostnames, "getMatchingIngressHostnames");
46227
+ function normalizeURL(url2) {
46228
+ const normalizedUrl = new URL(url2);
46229
+ if (LOCAL_TUNNEL_HOSTNAMES.has(normalizedUrl.hostname)) normalizedUrl.hostname = "localhost";
46230
+ if (!normalizedUrl.port) switch (normalizedUrl.protocol) {
46231
+ case "http:":
46232
+ normalizedUrl.port = "80";
46233
+ break;
46234
+ case "https:":
46235
+ normalizedUrl.port = "443";
46236
+ break;
46237
+ }
46238
+ return normalizedUrl;
46239
+ }
46240
+ __name$5(normalizeURL, "normalizeURL");
46241
+ function createApiAbortSignal(timeoutMs, abortSignal) {
46242
+ const timeoutSignal = AbortSignal.timeout(timeoutMs);
46243
+ return abortSignal ? AbortSignal.any([abortSignal, timeoutSignal]) : timeoutSignal;
46244
+ }
46245
+ __name$5(createApiAbortSignal, "createApiAbortSignal");
46246
+ function createMissingIngressMessage(name, origin, { dashboardUrl, ingress }) {
46247
+ if (ingress.length === 0) return [
46248
+ `Tunnel "${name}" has no routes configured.`,
46249
+ "",
46250
+ `Add a route for ${origin} in the Cloudflare dashboard:`,
46251
+ dashboardUrl,
46252
+ ""
46253
+ ].join("\n");
46254
+ return [
46255
+ `Tunnel "${name}" has no route for ${origin}`,
46256
+ "",
46257
+ "Resolved routes:",
46258
+ ...ingress.map(({ hostname: hostname3, service }) => ` - ${hostname3 ?? "(no hostname)"} -> ${service}`),
46259
+ "",
46260
+ "Update your local server settings or the tunnel routes in the Cloudflare dashboard:",
46261
+ dashboardUrl,
46262
+ ""
46263
+ ].join("\n");
46264
+ }
46265
+ __name$5(createMissingIngressMessage, "createMissingIngressMessage");
45759
46266
  function startTunnel(options) {
45760
46267
  let disposed = false;
45761
46268
  let reminderInterval;
@@ -45936,267 +46443,6 @@ The local dev server started at ${origin.href}
45936
46443
  return new Error(errorMessage);
45937
46444
  }
45938
46445
  __name$5(createTunnelStartupError, "createTunnelStartupError");
45939
- function buildDetailedError(message, ...extra) {
45940
- return new ParseError({
45941
- text: message,
45942
- notes: extra.map((text) => ({ text })),
45943
- telemetryMessage: false
45944
- });
45945
- }
45946
- __name$5(buildDetailedError, "buildDetailedError");
45947
- function maybeThrowFriendlyError(error51) {
45948
- if (error51.message === "workers.api.error.email_verification_required") throw buildDetailedError("Please verify your account's email address and try again.", "Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one.");
45949
- }
45950
- __name$5(maybeThrowFriendlyError, "maybeThrowFriendlyError");
45951
- function logHeaders(headers, logger$1) {
45952
- const clone2 = cloneHeaders(headers);
45953
- clone2.delete("Authorization");
45954
- logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
45955
- }
45956
- __name$5(logHeaders, "logHeaders");
45957
- async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
45958
- assert2(credentials, "credentials are required for performApiFetch");
45959
- const method = init.method ?? "GET";
45960
- assert2(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
45961
- const headers = cloneHeaders(new import_undici$3.Headers(init.headers));
45962
- addAuthorizationHeader(headers, credentials);
45963
- headers.set("User-Agent", userAgent);
45964
- maybeAddTraceHeader(headers);
45965
- const queryString = queryParams ? `?${queryParams.toString()}` : "";
45966
- logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
45967
- logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
45968
- logHeaders(headers, logger$1);
45969
- logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
45970
- if (init.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init.body).text(), null, 2);
45971
- logger$1.debug("-- END CF API REQUEST");
45972
- return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
45973
- method,
45974
- ...init,
45975
- headers,
45976
- signal: abortSignal
45977
- });
45978
- }
45979
- __name$5(performApiFetchBase, "performApiFetchBase");
45980
- async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
45981
- const method = init.method ?? "GET";
45982
- const response = await performApiFetchBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
45983
- const jsonText = await response.text();
45984
- logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
45985
- logHeaders(response.headers, logger$1);
45986
- logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
45987
- logger$1.debug("-- END CF API RESPONSE");
45988
- const retryAfterMs = parseRetryAfterMs(response.headers);
45989
- if (!jsonText && (response.status === 204 || response.status === 205)) return {
45990
- response: {
45991
- result: {},
45992
- success: true,
45993
- errors: [],
45994
- messages: []
45995
- },
45996
- status: response.status,
45997
- retryAfterMs
45998
- };
45999
- if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
46000
- try {
46001
- return {
46002
- response: parseJSON(jsonText),
46003
- status: response.status,
46004
- retryAfterMs
46005
- };
46006
- } catch {
46007
- const rayId = extractWAFBlockRayId(response.headers);
46008
- throw new APIError({
46009
- text: "Received a malformed response from the API",
46010
- notes: [
46011
- { text: truncate(jsonText, 100) },
46012
- { text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
46013
- ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
46014
- ],
46015
- status: response.status,
46016
- retryAfterMs,
46017
- telemetryMessage: false
46018
- });
46019
- }
46020
- }
46021
- __name$5(fetchInternalBase, "fetchInternalBase");
46022
- async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
46023
- const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
46024
- if (json2.success) return json2.result;
46025
- else throwFetchError(resource, json2, status$1, retryAfterMs);
46026
- }
46027
- __name$5(fetchResultBase, "fetchResultBase");
46028
- async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, credentials) {
46029
- const results = [];
46030
- let getMoreResults = true;
46031
- let cursor$1;
46032
- while (getMoreResults) {
46033
- if (cursor$1) {
46034
- queryParams = new URLSearchParams$1(queryParams);
46035
- queryParams.set("cursor", cursor$1);
46036
- }
46037
- const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, void 0, credentials);
46038
- if (json2.success) {
46039
- results.push(...json2.result);
46040
- if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
46041
- else getMoreResults = false;
46042
- } else throwFetchError(resource, json2, status$1, retryAfterMs);
46043
- }
46044
- return results;
46045
- }
46046
- __name$5(fetchListResultBase, "fetchListResultBase");
46047
- function truncate(text, maxLength) {
46048
- const { length } = text;
46049
- if (length <= maxLength) return text;
46050
- return `${text.substring(0, maxLength)}... (length = ${length})`;
46051
- }
46052
- __name$5(truncate, "truncate");
46053
- function isWAFBlockResponse(headers) {
46054
- return headers.get("cf-mitigated") === "challenge";
46055
- }
46056
- __name$5(isWAFBlockResponse, "isWAFBlockResponse");
46057
- function parseRetryAfterValue(retryAfter) {
46058
- if (!retryAfter) return;
46059
- if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
46060
- const retryAfterDate = new Date(retryAfter);
46061
- if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
46062
- }
46063
- __name$5(parseRetryAfterValue, "parseRetryAfterValue");
46064
- function parseRetryAfterMs(headers) {
46065
- return parseRetryAfterValue(headers.get("Retry-After"));
46066
- }
46067
- __name$5(parseRetryAfterMs, "parseRetryAfterMs");
46068
- function extractWAFBlockRayId(headers) {
46069
- return headers.get("cf-ray") ?? void 0;
46070
- }
46071
- __name$5(extractWAFBlockRayId, "extractWAFBlockRayId");
46072
- function extractAccountTag(resource) {
46073
- return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
46074
- }
46075
- __name$5(extractAccountTag, "extractAccountTag");
46076
- function hasMorePages(result_info) {
46077
- const page = result_info?.page;
46078
- const per_page = result_info?.per_page;
46079
- const total = result_info?.total_count;
46080
- return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
46081
- }
46082
- __name$5(hasMorePages, "hasMorePages");
46083
- function renderError(err, level = 0) {
46084
- const indent = " ".repeat(level);
46085
- const message = err.message ?? "";
46086
- const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
46087
-
46088
- ${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
46089
- return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
46090
- ${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
46091
- }
46092
- __name$5(renderError, "renderError");
46093
- function addAuthorizationHeader(headers, auth, overrideExisting = false) {
46094
- if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
46095
- const authorizationHeader = `Bearer ${auth.apiToken}`;
46096
- validateAuthorizationHeaderValue(authorizationHeader);
46097
- headers.set("Authorization", authorizationHeader);
46098
- } else {
46099
- headers.set("X-Auth-Key", auth.authKey);
46100
- headers.set("X-Auth-Email", auth.authEmail);
46101
- }
46102
- }
46103
- __name$5(addAuthorizationHeader, "addAuthorizationHeader");
46104
- function validateAuthorizationHeaderValue(value) {
46105
- for (const character of value) {
46106
- const codePoint = character.codePointAt(0);
46107
- if (codePoint === void 0 || codePoint > 255) throw new UserError(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
46108
- }
46109
- }
46110
- __name$5(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
46111
- function formatAuthorizationHeaderCharacter(character, codePoint) {
46112
- if (codePoint === void 0) return "\"\\u{unknown}\"";
46113
- const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
46114
- return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
46115
- }
46116
- __name$5(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
46117
- function isPrintableCharacter(character) {
46118
- return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
46119
- }
46120
- __name$5(isPrintableCharacter, "isPrintableCharacter");
46121
- function escapeCharacter(character) {
46122
- return Array.from(character).map((c$1) => {
46123
- const codePoint = c$1.codePointAt(0);
46124
- if (codePoint === void 0) return "";
46125
- return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
46126
- }).join("");
46127
- }
46128
- __name$5(escapeCharacter, "escapeCharacter");
46129
- function throwFetchError(resource, response, status$1, retryAfterMs) {
46130
- const errors$1 = response.errors ?? [];
46131
- for (const error52 of errors$1) maybeThrowFriendlyError(error52);
46132
- const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
46133
- if (notes.length === 0) {
46134
- const raw = response;
46135
- const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
46136
- if (fallbackMessage) notes.push({ text: fallbackMessage });
46137
- }
46138
- if (retryAfterMs !== void 0) notes.push({ text: `The API responded with a "Retry-After" header indicating you should wait ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying.` });
46139
- const error51 = new APIError({
46140
- text: `A request to the Cloudflare API (${resource}) failed.`,
46141
- notes,
46142
- status: status$1,
46143
- retryAfterMs,
46144
- telemetryMessage: false
46145
- });
46146
- const code = errors$1[0]?.code;
46147
- if (code) error51.code = code;
46148
- const meta3 = errors$1[0]?.meta;
46149
- if (meta3) error51.meta = meta3;
46150
- error51.accountTag = extractAccountTag(resource);
46151
- throw error51;
46152
- }
46153
- __name$5(throwFetchError, "throwFetchError");
46154
- function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
46155
- const rayId = extractWAFBlockRayId(headers);
46156
- throw new APIError({
46157
- text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
46158
- notes: [
46159
- { text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
46160
- ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
46161
- { text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser." },
46162
- { text: `${method} ${resource} -> ${status$1} ${statusText}` }
46163
- ],
46164
- status: status$1,
46165
- retryAfterMs,
46166
- telemetryMessage: false
46167
- });
46168
- }
46169
- __name$5(throwWAFBlockError, "throwWAFBlockError");
46170
- async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
46171
- const headers = new import_undici$3.Headers();
46172
- addAuthorizationHeader(headers, credentials);
46173
- headers.set("User-Agent", userAgent);
46174
- maybeAddTraceHeader(headers);
46175
- const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
46176
- logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
46177
- logger$1.debug("-- END CF API REQUEST");
46178
- const response = await (0, import_undici$3.fetch)(resource, {
46179
- method: "GET",
46180
- headers
46181
- });
46182
- if (response.ok) return await response.arrayBuffer();
46183
- else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
46184
- }
46185
- __name$5(fetchKVGetValueBase, "fetchKVGetValueBase");
46186
- function hasCursor(result_info) {
46187
- const cursor$1 = result_info?.cursor;
46188
- return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
46189
- }
46190
- __name$5(hasCursor, "hasCursor");
46191
- function maybeAddTraceHeader(headers) {
46192
- const traceHeader = getTraceHeader();
46193
- if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
46194
- }
46195
- __name$5(maybeAddTraceHeader, "maybeAddTraceHeader");
46196
- function cloneHeaders(headers) {
46197
- return new import_undici$3.Headers(headers);
46198
- }
46199
- __name$5(cloneHeaders, "cloneHeaders");
46200
46446
  var import_update_check = __toESM(require_update_check());
46201
46447
  var UPDATE_CHECK_TIMEOUT_MS = 3e3;
46202
46448
  var TIMED_OUT = Symbol("timed_out");
@@ -46220,7 +46466,7 @@ async function fetchLatestNpmVersion(name, version2) {
46220
46466
  __name$5(fetchLatestNpmVersion, "fetchLatestNpmVersion");
46221
46467
  async function openInBrowser(url2, logger$1) {
46222
46468
  try {
46223
- const { default: open$1 } = await import("./open-PBXRGS4R-HMkvHv1N.mjs");
46469
+ const { default: open$1 } = await import("./open-PBXRGS4R-DFtj97wF.mjs");
46224
46470
  (await open$1(url2)).on("error", (err) => {
46225
46471
  handleBrowserOpenError(url2, err, logger$1);
46226
46472
  });
@@ -50462,35 +50708,6 @@ function assertIsPreview(ctx) {
50462
50708
  assert2(ctx.resolvedPluginConfig.type === "preview", `Expected "preview" plugin config`);
50463
50709
  }
50464
50710
 
50465
- //#endregion
50466
- //#region ../config/dist/public-BwQqexwo.mjs
50467
- const DEFINITION = Symbol.for("@cloudflare/config:definition");
50468
- /**
50469
- * Unwrap an authored config from its value / promise / function shape, awaiting
50470
- * the result. A function config is invoked with {@link ConfigContext}.
50471
- */
50472
- async function unwrap(config$2, ctx) {
50473
- return typeof config$2 === "function" ? await config$2(ctx) : await config$2;
50474
- }
50475
- /**
50476
- * Resolve any `cloudflare.config.ts` export to its plain config value.
50477
- *
50478
- * A `define*` helper stores its authored config plus `type` under the
50479
- * {@link DEFINITION} symbol; here we unwrap the config and stamp `type` back on.
50480
- * Every other export — a raw object/promise/function — is unwrapped as-is and
50481
- * already carries its own `type`. Discrimination happens afterwards via `type`.
50482
- */
50483
- async function resolveExportDefinition(def, ctx) {
50484
- if (typeof def === "object" && def !== null && DEFINITION in def) {
50485
- const { config: config$2, type } = def[DEFINITION];
50486
- return {
50487
- ...await unwrap(config$2, ctx),
50488
- type
50489
- };
50490
- }
50491
- return await unwrap(def, ctx);
50492
- }
50493
-
50494
50711
  //#endregion
50495
50712
  //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
50496
50713
  var _a$1;
@@ -50842,7 +51059,7 @@ function explicitlyAborted(x, startIndex = 0) {
50842
51059
  for (let i$1 = startIndex; i$1 < x.issues.length; i$1++) if (x.issues[i$1]?.continue === false) return true;
50843
51060
  return false;
50844
51061
  }
50845
- function prefixIssues(path$2, issues) {
51062
+ function prefixIssues$1(path$2, issues) {
50846
51063
  return issues.map((iss) => {
50847
51064
  var _a$3;
50848
51065
  (_a$3 = iss).path ?? (_a$3.path = []);
@@ -51975,7 +52192,7 @@ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
51975
52192
  };
51976
52193
  });
51977
52194
  function handleArrayResult(result, final, index) {
51978
- if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
52195
+ if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
51979
52196
  final.value[index] = result.value;
51980
52197
  }
51981
52198
  const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
@@ -52010,7 +52227,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
52010
52227
  const isPresent = key in input;
52011
52228
  if (result.issues.length) {
52012
52229
  if (isOptionalIn && isOptionalOut && !isPresent) return;
52013
- final.issues.push(...prefixIssues(key, result.issues));
52230
+ final.issues.push(...prefixIssues$1(key, result.issues));
52014
52231
  }
52015
52232
  if (!isPresent && !isOptionalIn) {
52016
52233
  if (!result.issues.length) final.issues.push({
@@ -52500,11 +52717,11 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
52500
52717
  issues: []
52501
52718
  }, ctx);
52502
52719
  if (result instanceof Promise) proms.push(result.then((result$1) => {
52503
- if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
52720
+ if (result$1.issues.length) payload.issues.push(...prefixIssues$1(key, result$1.issues));
52504
52721
  payload.value[outKey] = result$1.value;
52505
52722
  }));
52506
52723
  else {
52507
- if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
52724
+ if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
52508
52725
  payload.value[outKey] = result.value;
52509
52726
  }
52510
52727
  }
@@ -52554,11 +52771,11 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
52554
52771
  issues: []
52555
52772
  }, ctx);
52556
52773
  if (result instanceof Promise) proms.push(result.then((result$1) => {
52557
- if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
52774
+ if (result$1.issues.length) payload.issues.push(...prefixIssues$1(key, result$1.issues));
52558
52775
  payload.value[keyResult.value] = result$1.value;
52559
52776
  }));
52560
52777
  else {
52561
- if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
52778
+ if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
52562
52779
  payload.value[keyResult.value] = result.value;
52563
52780
  }
52564
52781
  }
@@ -54101,6 +54318,7 @@ const initializer = (inst, issues) => {
54101
54318
  } }
54102
54319
  });
54103
54320
  };
54321
+ const ZodError = /* @__PURE__ */ $constructor("ZodError", initializer);
54104
54322
  const ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, { Parent: Error });
54105
54323
 
54106
54324
  //#endregion
@@ -55456,15 +55674,6 @@ const ConfigExportsTypeSchema = record(string(), unknown()).check((ctx) => {
55456
55674
  });
55457
55675
  }
55458
55676
  });
55459
- const ConfigExportsObjectSchema = object({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
55460
- /**
55461
- * Schema for the resolved config exports, keyed by export
55462
- * name. Each value is discriminated on its `type` field. Reserves the
55463
- * `settings` export name exclusively for settings configs: a `settings`
55464
- * config must live on the `settings` export, and the `settings` export
55465
- * may only hold a `settings` config.
55466
- */
55467
- const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
55468
55677
  const ModuleTypeSchema = _enum([
55469
55678
  "esm",
55470
55679
  "cjs",
@@ -55500,9 +55709,9 @@ const ManifestSchema = strictObject({
55500
55709
  * base schema.
55501
55710
  */
55502
55711
  const OutputWorkerSchema = BaseWorkerSchema.extend({ manifest: ManifestSchema.optional() });
55503
- var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$2) => {
55504
- Object.defineProperty(exports$2, "__esModule", { value: true });
55505
- exports$2.dedent = void 0;
55712
+ var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$1) => {
55713
+ Object.defineProperty(exports$1, "__esModule", { value: true });
55714
+ exports$1.dedent = void 0;
55506
55715
  function dedent$1$1(templ) {
55507
55716
  var values = [];
55508
55717
  for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
@@ -55535,7 +55744,7 @@ var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-ded
55535
55744
  });
55536
55745
  return string$3;
55537
55746
  }
55538
- exports$2.dedent = dedent$1$1;
55747
+ exports$1.dedent = dedent$1$1;
55539
55748
  }) }))();
55540
55749
  /**
55541
55750
  * Generate the content for worker-configuration.d.ts
@@ -56308,15 +56517,100 @@ function cleanupImportAttributes(context) {
56308
56517
  context.importAttributes = attrs;
56309
56518
  Object.freeze(context.importAttributes);
56310
56519
  }
56520
+ const CROSS_WORKER_BINDING_TYPES = new Set([
56521
+ "durable-object",
56522
+ "worker",
56523
+ "workflow"
56524
+ ]);
56525
+ function isRecord(value) {
56526
+ return typeof value === "object" && value !== null;
56527
+ }
56528
+ function isConfigReference(value) {
56529
+ return typeof value === "function" || isRecord(value);
56530
+ }
56531
+ function createDefinitionResolver(ctx) {
56532
+ const resolvedDefinitions = /* @__PURE__ */ new Map();
56533
+ return (input) => {
56534
+ const cached$2 = resolvedDefinitions.get(input);
56535
+ if (cached$2) return cached$2;
56536
+ const resolved = (async () => {
56537
+ return await (typeof input === "function" ? input(ctx) : input);
56538
+ })();
56539
+ resolvedDefinitions.set(input, resolved);
56540
+ return resolved;
56541
+ };
56542
+ }
56543
+ async function normalizeWorkerReferences(resolved, resolveDefinition) {
56544
+ if (!isRecord(resolved) || !isRecord(resolved.env)) return resolved;
56545
+ const env$3 = { ...resolved.env };
56546
+ for (const [bindingName, binding] of Object.entries(env$3)) {
56547
+ if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || !isConfigReference(binding.worker)) continue;
56548
+ const target$1 = await resolveDefinition(binding.worker);
56549
+ env$3[bindingName] = {
56550
+ ...binding,
56551
+ worker: isRecord(target$1) ? target$1.name : void 0
56552
+ };
56553
+ }
56554
+ return {
56555
+ ...resolved,
56556
+ env: env$3
56557
+ };
56558
+ }
56559
+ function prefixIssues(issues, prefix) {
56560
+ return issues.map((issue$2) => ({
56561
+ ...issue$2,
56562
+ path: [prefix, ...issue$2.path]
56563
+ }));
56564
+ }
56311
56565
  /**
56312
- * Load a `cloudflare.config.ts`, resolve all exports, and validate against {@link ConfigExportsSchema}.
56566
+ * Resolve and validate loaded `cloudflare.config.ts` exports.
56567
+ *
56568
+ * Config inputs are resolved once by identity. Top-level Worker exports are
56569
+ * also parsed once by identity; unexported references are resolved only far
56570
+ * enough to replace the reference with the Worker's name.
56571
+ */
56572
+ async function resolveAndValidateConfigExports(exports$2, ctx) {
56573
+ const resolveDefinition = createDefinitionResolver(ctx);
56574
+ const parsedWorkers = /* @__PURE__ */ new Map();
56575
+ const resolvedExports = {};
56576
+ for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
56577
+ const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
56578
+ if (!typeResult.success) return typeResult;
56579
+ const issues = [];
56580
+ const data$1 = {};
56581
+ const resolvedSettings = resolvedExports.settings;
56582
+ const settingsResult = resolvedSettings ? InputSettingsSchema.safeParse(resolvedSettings) : void 0;
56583
+ if (settingsResult) if (settingsResult.success) data$1.settings = settingsResult.data;
56584
+ else issues.push(...prefixIssues(settingsResult.error.issues, "settings"));
56585
+ for (const [name, input] of Object.entries(exports$2)) {
56586
+ const resolved = resolvedExports[name];
56587
+ if (!isRecord(resolved)) continue;
56588
+ if (resolved.type === "worker") {
56589
+ let result = parsedWorkers.get(input);
56590
+ if (!result) {
56591
+ result = InputWorkerSchema.safeParse(await normalizeWorkerReferences(resolved, resolveDefinition));
56592
+ parsedWorkers.set(input, result);
56593
+ if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
56594
+ }
56595
+ if (result.success) data$1[name] = result.data;
56596
+ continue;
56597
+ }
56598
+ }
56599
+ return issues.length > 0 ? {
56600
+ success: false,
56601
+ error: new ZodError(issues)
56602
+ } : {
56603
+ success: true,
56604
+ data: data$1
56605
+ };
56606
+ }
56607
+ /**
56608
+ * Load a `cloudflare.config.ts`, resolve all exports, and validate them.
56313
56609
  */
56314
56610
  async function loadAndValidateConfig(configPath, ctx, options) {
56315
56611
  const { exports: exports$2, dependencies } = await loadConfig(configPath, options);
56316
- const resolved = {};
56317
- for (const [name, value] of Object.entries(exports$2)) resolved[name] = await resolveExportDefinition(value, ctx);
56318
56612
  return {
56319
- result: ConfigExportsSchema.safeParse(resolved),
56613
+ result: await resolveAndValidateConfigExports(exports$2, ctx),
56320
56614
  dependencies
56321
56615
  };
56322
56616
  }
@@ -58428,10 +58722,10 @@ pp$9.isSimpleAssignTarget = function(expr) {
58428
58722
  };
58429
58723
  var pp$8 = Parser.prototype;
58430
58724
  pp$8.parseTopLevel = function(node) {
58431
- var exports$2 = Object.create(null);
58725
+ var exports$1 = Object.create(null);
58432
58726
  if (!node.body) node.body = [];
58433
58727
  while (this.type !== types$1$1.eof) {
58434
- var stmt = this.parseStatement(null, true, exports$2);
58728
+ var stmt = this.parseStatement(null, true, exports$1);
58435
58729
  node.body.push(stmt);
58436
58730
  }
58437
58731
  if (this.inModule) for (var i$1 = 0, list$1 = Object.keys(this.undefinedExports); i$1 < list$1.length; i$1 += 1) {
@@ -58501,7 +58795,7 @@ pp$8.isAwaitUsing = function(isFor) {
58501
58795
  pp$8.isUsing = function(isFor) {
58502
58796
  return this.isUsingKeyword(false, isFor);
58503
58797
  };
58504
- pp$8.parseStatement = function(context, topLevel, exports$2) {
58798
+ pp$8.parseStatement = function(context, topLevel, exports$1) {
58505
58799
  var starttype = this.type, node = this.startNode(), kind;
58506
58800
  if (this.isLet(context)) {
58507
58801
  starttype = types$1$1._var;
@@ -58545,7 +58839,7 @@ pp$8.parseStatement = function(context, topLevel, exports$2) {
58545
58839
  if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
58546
58840
  if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
58547
58841
  }
58548
- return starttype === types$1$1._import ? this.parseImport(node) : this.parseExport(node, exports$2);
58842
+ return starttype === types$1$1._import ? this.parseImport(node) : this.parseExport(node, exports$1);
58549
58843
  default:
58550
58844
  if (this.isAsyncFunction()) {
58551
58845
  if (context) this.unexpected();
@@ -59060,10 +59354,10 @@ function checkKeyName(node, name) {
59060
59354
  var key = node.key;
59061
59355
  return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
59062
59356
  }
59063
- pp$8.parseExportAllDeclaration = function(node, exports$2) {
59357
+ pp$8.parseExportAllDeclaration = function(node, exports$1) {
59064
59358
  if (this.options.ecmaVersion >= 11) if (this.eatContextual("as")) {
59065
59359
  node.exported = this.parseModuleExportName();
59066
- this.checkExport(exports$2, node.exported, this.lastTokStart);
59360
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
59067
59361
  } else node.exported = null;
59068
59362
  this.expectContextual("from");
59069
59363
  if (this.type !== types$1$1.string) this.unexpected();
@@ -59072,24 +59366,24 @@ pp$8.parseExportAllDeclaration = function(node, exports$2) {
59072
59366
  this.semicolon();
59073
59367
  return this.finishNode(node, "ExportAllDeclaration");
59074
59368
  };
59075
- pp$8.parseExport = function(node, exports$2) {
59369
+ pp$8.parseExport = function(node, exports$1) {
59076
59370
  this.next();
59077
- if (this.eat(types$1$1.star)) return this.parseExportAllDeclaration(node, exports$2);
59371
+ if (this.eat(types$1$1.star)) return this.parseExportAllDeclaration(node, exports$1);
59078
59372
  if (this.eat(types$1$1._default)) {
59079
- this.checkExport(exports$2, "default", this.lastTokStart);
59373
+ this.checkExport(exports$1, "default", this.lastTokStart);
59080
59374
  node.declaration = this.parseExportDefaultDeclaration();
59081
59375
  return this.finishNode(node, "ExportDefaultDeclaration");
59082
59376
  }
59083
59377
  if (this.shouldParseExportStatement()) {
59084
59378
  node.declaration = this.parseExportDeclaration(node);
59085
- if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports$2, node.declaration.declarations);
59086
- else this.checkExport(exports$2, node.declaration.id, node.declaration.id.start);
59379
+ if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports$1, node.declaration.declarations);
59380
+ else this.checkExport(exports$1, node.declaration.id, node.declaration.id.start);
59087
59381
  node.specifiers = [];
59088
59382
  node.source = null;
59089
59383
  if (this.options.ecmaVersion >= 16) node.attributes = [];
59090
59384
  } else {
59091
59385
  node.declaration = null;
59092
- node.specifiers = this.parseExportSpecifiers(exports$2);
59386
+ node.specifiers = this.parseExportSpecifiers(exports$1);
59093
59387
  if (this.eatContextual("from")) {
59094
59388
  if (this.type !== types$1$1.string) this.unexpected();
59095
59389
  node.source = this.parseExprAtom();
@@ -59127,45 +59421,45 @@ pp$8.parseExportDefaultDeclaration = function() {
59127
59421
  return declaration;
59128
59422
  }
59129
59423
  };
59130
- pp$8.checkExport = function(exports$2, name, pos) {
59131
- if (!exports$2) return;
59424
+ pp$8.checkExport = function(exports$1, name, pos) {
59425
+ if (!exports$1) return;
59132
59426
  if (typeof name !== "string") name = name.type === "Identifier" ? name.name : name.value;
59133
- if (hasOwn(exports$2, name)) this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
59134
- exports$2[name] = true;
59427
+ if (hasOwn(exports$1, name)) this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
59428
+ exports$1[name] = true;
59135
59429
  };
59136
- pp$8.checkPatternExport = function(exports$2, pat) {
59430
+ pp$8.checkPatternExport = function(exports$1, pat) {
59137
59431
  var type = pat.type;
59138
- if (type === "Identifier") this.checkExport(exports$2, pat, pat.start);
59432
+ if (type === "Identifier") this.checkExport(exports$1, pat, pat.start);
59139
59433
  else if (type === "ObjectPattern") for (var i$1 = 0, list$1 = pat.properties; i$1 < list$1.length; i$1 += 1) {
59140
59434
  var prop = list$1[i$1];
59141
- this.checkPatternExport(exports$2, prop);
59435
+ this.checkPatternExport(exports$1, prop);
59142
59436
  }
59143
59437
  else if (type === "ArrayPattern") for (var i$1$1 = 0, list$1$1 = pat.elements; i$1$1 < list$1$1.length; i$1$1 += 1) {
59144
59438
  var elt = list$1$1[i$1$1];
59145
- if (elt) this.checkPatternExport(exports$2, elt);
59439
+ if (elt) this.checkPatternExport(exports$1, elt);
59146
59440
  }
59147
- else if (type === "Property") this.checkPatternExport(exports$2, pat.value);
59148
- else if (type === "AssignmentPattern") this.checkPatternExport(exports$2, pat.left);
59149
- else if (type === "RestElement") this.checkPatternExport(exports$2, pat.argument);
59441
+ else if (type === "Property") this.checkPatternExport(exports$1, pat.value);
59442
+ else if (type === "AssignmentPattern") this.checkPatternExport(exports$1, pat.left);
59443
+ else if (type === "RestElement") this.checkPatternExport(exports$1, pat.argument);
59150
59444
  };
59151
- pp$8.checkVariableExport = function(exports$2, decls) {
59152
- if (!exports$2) return;
59445
+ pp$8.checkVariableExport = function(exports$1, decls) {
59446
+ if (!exports$1) return;
59153
59447
  for (var i$1 = 0, list$1 = decls; i$1 < list$1.length; i$1 += 1) {
59154
59448
  var decl = list$1[i$1];
59155
- this.checkPatternExport(exports$2, decl.id);
59449
+ this.checkPatternExport(exports$1, decl.id);
59156
59450
  }
59157
59451
  };
59158
59452
  pp$8.shouldParseExportStatement = function() {
59159
59453
  return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
59160
59454
  };
59161
- pp$8.parseExportSpecifier = function(exports$2) {
59455
+ pp$8.parseExportSpecifier = function(exports$1) {
59162
59456
  var node = this.startNode();
59163
59457
  node.local = this.parseModuleExportName();
59164
59458
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
59165
- this.checkExport(exports$2, node.exported, node.exported.start);
59459
+ this.checkExport(exports$1, node.exported, node.exported.start);
59166
59460
  return this.finishNode(node, "ExportSpecifier");
59167
59461
  };
59168
- pp$8.parseExportSpecifiers = function(exports$2) {
59462
+ pp$8.parseExportSpecifiers = function(exports$1) {
59169
59463
  var nodes = [], first = true;
59170
59464
  this.expect(types$1$1.braceL);
59171
59465
  while (!this.eat(types$1$1.braceR)) {
@@ -59173,7 +59467,7 @@ pp$8.parseExportSpecifiers = function(exports$2) {
59173
59467
  this.expect(types$1$1.comma);
59174
59468
  if (this.afterTrailingComma(types$1$1.braceR)) break;
59175
59469
  } else first = false;
59176
- nodes.push(this.parseExportSpecifier(exports$2));
59470
+ nodes.push(this.parseExportSpecifier(exports$1));
59177
59471
  }
59178
59472
  return nodes;
59179
59473
  };
@@ -62895,10 +63189,10 @@ function resolvePackageTarget(packageJsonUrl, target$1, subpath, packageSubpath,
62895
63189
  * @param {URL} base
62896
63190
  * @returns {boolean}
62897
63191
  */
62898
- function isConditionalExportsMainSugar(exports$2, packageJsonUrl, base) {
62899
- if (typeof exports$2 === "string" || Array.isArray(exports$2)) return true;
62900
- if (typeof exports$2 !== "object" || exports$2 === null) return false;
62901
- const keys = Object.getOwnPropertyNames(exports$2);
63192
+ function isConditionalExportsMainSugar(exports$1, packageJsonUrl, base) {
63193
+ if (typeof exports$1 === "string" || Array.isArray(exports$1)) return true;
63194
+ if (typeof exports$1 !== "object" || exports$1 === null) return false;
63195
+ const keys = Object.getOwnPropertyNames(exports$1);
62902
63196
  let isConditionalSugar = false;
62903
63197
  let i$1 = 0;
62904
63198
  let keyIndex = -1;
@@ -62931,17 +63225,17 @@ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
62931
63225
  * @returns {URL}
62932
63226
  */
62933
63227
  function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
62934
- let exports$2 = packageConfig.exports;
62935
- if (isConditionalExportsMainSugar(exports$2, packageJsonUrl, base)) exports$2 = { ".": exports$2 };
62936
- if (own.call(exports$2, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
62937
- const target$1 = exports$2[packageSubpath];
63228
+ let exports$1 = packageConfig.exports;
63229
+ if (isConditionalExportsMainSugar(exports$1, packageJsonUrl, base)) exports$1 = { ".": exports$1 };
63230
+ if (own.call(exports$1, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
63231
+ const target$1 = exports$1[packageSubpath];
62938
63232
  const resolveResult = resolvePackageTarget(packageJsonUrl, target$1, "", packageSubpath, base, false, false, false, conditions);
62939
63233
  if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
62940
63234
  return resolveResult;
62941
63235
  }
62942
63236
  let bestMatch = "";
62943
63237
  let bestMatchSubpath = "";
62944
- const keys = Object.getOwnPropertyNames(exports$2);
63238
+ const keys = Object.getOwnPropertyNames(exports$1);
62945
63239
  let i$1 = -1;
62946
63240
  while (++i$1 < keys.length) {
62947
63241
  const key = keys[i$1];
@@ -62956,7 +63250,7 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba
62956
63250
  }
62957
63251
  }
62958
63252
  if (bestMatch) {
62959
- const target$1 = exports$2[bestMatch];
63253
+ const target$1 = exports$1[bestMatch];
62960
63254
  const resolveResult = resolvePackageTarget(packageJsonUrl, target$1, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith("/"), conditions);
62961
63255
  if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
62962
63256
  return resolveResult;
@@ -69623,16 +69917,6 @@ const MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
69623
69917
 
69624
69918
  //#endregion
69625
69919
  //#region ../containers-shared/src/knobs.ts
69626
- /**
69627
- * Returns the managed container registry for the configured API environment and compliance region.
69628
- *
69629
- * @param complianceConfig - Compliance configuration used to select the public or FedRAMP registry.
69630
- * @returns The managed registry hostname, respecting `CLOUDFLARE_CONTAINER_REGISTRY` and `WRANGLER_API_ENVIRONMENT`.
69631
- */
69632
- const getCloudflareContainerRegistry = (complianceConfig = COMPLIANCE_REGION_CONFIG_UNKNOWN) => {
69633
- if (process.env.CLOUDFLARE_CONTAINER_REGISTRY) return process.env.CLOUDFLARE_CONTAINER_REGISTRY;
69634
- return `${process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging." : ""}registry${getComplianceRegionSubdomain(complianceConfig)}.cloudflare.com`;
69635
- };
69636
69920
  /** Prefixes with the cloudflare-dev namespace. The name should be the container's DO classname, and the tag a build uuid. */
69637
69921
  const getDevContainerImageName = (name, tag) => {
69638
69922
  return `${MF_DEV_CONTAINER_PREFIX}/${name.toLowerCase()}:${tag}`;
@@ -69795,10 +70079,11 @@ function getDockerPath() {
69795
70079
  * or pull, and callers treat them alike.
69796
70080
  */
69797
70081
  function getContainerOptions(options) {
69798
- const { containersConfig, exports: exports$2, containerBuildId, configPath } = options;
70082
+ const { containersConfig, exports: exports$1, containerBuildId, configPath } = options;
69799
70083
  if (!containersConfig?.length) return;
69800
70084
  return containersConfig.map((container) => {
69801
- const className = resolveContainerClassName(container, exports$2);
70085
+ if (isDurableObjectContainerApp(container) || container.image === void 0) return;
70086
+ const className = resolveContainerClassName(container, exports$1);
69802
70087
  if (className === void 0) return;
69803
70088
  const image_tag = getDevContainerImageName(className, containerBuildId);
69804
70089
  if (isDockerfile(container.image, configPath)) return {
@@ -73635,7 +73920,7 @@ function createOAuthFlow(ctx) {
73635
73920
  __name$1(createOAuthFlow, "createOAuthFlow");
73636
73921
  var RESERVED_PROFILE_NAMES = ["default", "staging"];
73637
73922
  function createProfileStore(args) {
73638
- const bindings$1 = {
73923
+ const bindings = {
73639
73924
  read() {
73640
73925
  return args.bindings.read();
73641
73926
  },
@@ -73701,14 +73986,14 @@ function createProfileStore(args) {
73701
73986
  };
73702
73987
  return {
73703
73988
  configs: args.configs,
73704
- bindings: bindings$1,
73989
+ bindings,
73705
73990
  resolve(resolveArgs) {
73706
73991
  if (resolveArgs.profile) {
73707
73992
  if (resolveArgs.profile === "default") return "default";
73708
73993
  validateProfileName(resolveArgs.profile);
73709
73994
  return resolveArgs.profile;
73710
73995
  }
73711
- const dirProfile = bindings$1.getProfileForDirectory(resolveArgs.cwd);
73996
+ const dirProfile = bindings.getProfileForDirectory(resolveArgs.cwd);
73712
73997
  if (dirProfile) return dirProfile;
73713
73998
  return "default";
73714
73999
  }
@@ -73724,9 +74009,9 @@ function formatDirectoryForUserError(dir$1) {
73724
74009
  return path__default.relative(process.cwd(), dir$1) || ".";
73725
74010
  }
73726
74011
  __name$1(formatDirectoryForUserError, "formatDirectoryForUserError");
73727
- function getProfileForDirectoryFromBindings(startDir, bindings$1) {
74012
+ function getProfileForDirectoryFromBindings(startDir, bindings) {
73728
74013
  const normalizedDir = path__default.resolve(startDir);
73729
- const sortedEntries = Object.entries(bindings$1).sort(([a], [b]) => b.length - a.length);
74014
+ const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
73730
74015
  for (const [boundDir, profile] of sortedEntries) {
73731
74016
  if (normalizedDir === boundDir) return {
73732
74017
  profile,
@@ -76771,7 +77056,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$2({ "../../node_modules/
76771
77056
  }) });
76772
77057
 
76773
77058
  //#endregion
76774
- //#region ../deploy-helpers/dist/chunk-PXVCTRCA.mjs
77059
+ //#region ../deploy-helpers/dist/chunk-3G6JZQDH.mjs
76775
77060
  var import_undici$1 = require_undici();
76776
77061
  var import_command_exists = require_command_exists();
76777
77062
  function handleUnsafeCapnp(capnp) {
@@ -76811,7 +77096,7 @@ function fromMimeType(mimeType) {
76811
77096
  return moduleType;
76812
77097
  }
76813
77098
  __name(fromMimeType, "fromMimeType");
76814
- function createWorkerUploadForm(worker, bindings$1, options) {
77099
+ function createWorkerUploadForm(worker, bindings, options) {
76815
77100
  const formData = new import_undici$1.FormData();
76816
77101
  const { main, sourceMaps, migrations, exports: configuredExports, compatibility_date, compatibility_flags, keepVars, keepSecrets, keepBindings, logpush, placement, tail_consumers, streaming_tail_consumers, limits, annotations, keep_assets, assets, observability, cache: cache$2, package_dependencies } = worker;
76817
77102
  const assetConfig = {
@@ -76835,47 +77120,47 @@ function createWorkerUploadForm(worker, bindings$1, options) {
76835
77120
  }
76836
77121
  let { modules } = worker;
76837
77122
  const metadataBindings = [];
76838
- const plain_text = extractBindingsOfType("plain_text", bindings$1);
76839
- const json_bindings = extractBindingsOfType("json", bindings$1);
76840
- const secret_text = extractBindingsOfType("secret_text", bindings$1);
76841
- const kv_namespaces = extractBindingsOfType("kv_namespace", bindings$1);
76842
- const send_email = extractBindingsOfType("send_email", bindings$1);
76843
- const durable_objects = extractBindingsOfType("durable_object_namespace", bindings$1);
76844
- const workflows = extractBindingsOfType("workflow", bindings$1);
76845
- const queues = extractBindingsOfType("queue", bindings$1);
76846
- const r2_buckets = extractBindingsOfType("r2_bucket", bindings$1);
76847
- const d1_databases = extractBindingsOfType("d1", bindings$1);
76848
- const vectorize = extractBindingsOfType("vectorize", bindings$1);
76849
- const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings$1);
76850
- const ai_search = extractBindingsOfType("ai_search", bindings$1);
76851
- const websearch = extractBindingsOfType("websearch", bindings$1)[0];
76852
- const agent_memory = extractBindingsOfType("agent_memory", bindings$1);
76853
- const hyperdrive = extractBindingsOfType("hyperdrive", bindings$1);
76854
- const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings$1);
76855
- const artifacts = extractBindingsOfType("artifacts", bindings$1);
76856
- const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings$1);
76857
- const flagship = extractBindingsOfType("flagship", bindings$1);
76858
- const ratelimits = extractBindingsOfType("ratelimit", bindings$1);
76859
- const vpc_services = extractBindingsOfType("vpc_service", bindings$1);
76860
- const vpc_networks = extractBindingsOfType("vpc_network", bindings$1);
76861
- const services = extractBindingsOfType("service", bindings$1);
76862
- const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings$1);
76863
- const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings$1);
76864
- const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings$1);
76865
- const pipelines = extractBindingsOfType("pipeline", bindings$1);
76866
- const worker_loaders = extractBindingsOfType("worker_loader", bindings$1);
76867
- const logfwdr = extractBindingsOfType("logfwdr", bindings$1);
76868
- const wasm_modules = extractBindingsOfType("wasm_module", bindings$1);
76869
- const browser = extractBindingsOfType("browser", bindings$1)[0];
76870
- const ai = extractBindingsOfType("ai", bindings$1)[0];
76871
- const images = extractBindingsOfType("images", bindings$1)[0];
76872
- const stream$2 = extractBindingsOfType("stream", bindings$1)[0];
76873
- const media = extractBindingsOfType("media", bindings$1)[0];
76874
- const version_metadata = extractBindingsOfType("version_metadata", bindings$1)[0];
76875
- const assetsBinding = extractBindingsOfType("assets", bindings$1)[0];
76876
- const text_blobs = extractBindingsOfType("text_blob", bindings$1);
76877
- const data_blobs = extractBindingsOfType("data_blob", bindings$1);
76878
- extractBindingsOfType("inherit", bindings$1).forEach(({ binding }) => {
77123
+ const plain_text = extractBindingsOfType("plain_text", bindings);
77124
+ const json_bindings = extractBindingsOfType("json", bindings);
77125
+ const secret_text = extractBindingsOfType("secret_text", bindings);
77126
+ const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
77127
+ const send_email = extractBindingsOfType("send_email", bindings);
77128
+ const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
77129
+ const workflows = extractBindingsOfType("workflow", bindings);
77130
+ const queues = extractBindingsOfType("queue", bindings);
77131
+ const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
77132
+ const d1_databases = extractBindingsOfType("d1", bindings);
77133
+ const vectorize = extractBindingsOfType("vectorize", bindings);
77134
+ const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
77135
+ const ai_search = extractBindingsOfType("ai_search", bindings);
77136
+ const websearch = extractBindingsOfType("websearch", bindings)[0];
77137
+ const agent_memory = extractBindingsOfType("agent_memory", bindings);
77138
+ const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
77139
+ const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
77140
+ const artifacts = extractBindingsOfType("artifacts", bindings);
77141
+ const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
77142
+ const flagship = extractBindingsOfType("flagship", bindings);
77143
+ const ratelimits = extractBindingsOfType("ratelimit", bindings);
77144
+ const vpc_services = extractBindingsOfType("vpc_service", bindings);
77145
+ const vpc_networks = extractBindingsOfType("vpc_network", bindings);
77146
+ const services = extractBindingsOfType("service", bindings);
77147
+ const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
77148
+ const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
77149
+ const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
77150
+ const pipelines = extractBindingsOfType("pipeline", bindings);
77151
+ const worker_loaders = extractBindingsOfType("worker_loader", bindings);
77152
+ const logfwdr = extractBindingsOfType("logfwdr", bindings);
77153
+ const wasm_modules = extractBindingsOfType("wasm_module", bindings);
77154
+ const browser = extractBindingsOfType("browser", bindings)[0];
77155
+ const ai = extractBindingsOfType("ai", bindings)[0];
77156
+ const images = extractBindingsOfType("images", bindings)[0];
77157
+ const stream$2 = extractBindingsOfType("stream", bindings)[0];
77158
+ const media = extractBindingsOfType("media", bindings)[0];
77159
+ const version_metadata = extractBindingsOfType("version_metadata", bindings)[0];
77160
+ const assetsBinding = extractBindingsOfType("assets", bindings)[0];
77161
+ const text_blobs = extractBindingsOfType("text_blob", bindings);
77162
+ const data_blobs = extractBindingsOfType("data_blob", bindings);
77163
+ extractBindingsOfType("inherit", bindings).forEach(({ binding }) => {
76879
77164
  metadataBindings.push({
76880
77165
  name: binding,
76881
77166
  type: "inherit"
@@ -77232,7 +77517,7 @@ function createWorkerUploadForm(worker, bindings$1, options) {
77232
77517
  });
77233
77518
  formData.set(name, new File(["contents" in source ? source.contents : readFileSync(source.path)], "path" in source ? source.path ?? name : name, { type: "application/octet-stream" }));
77234
77519
  });
77235
- for (const [bindingName, config$2] of Object.entries(bindings$1 ?? {})) if (isUnsafeBindingType(config$2.type) && config$2.type !== "unsafe_hello_world") {
77520
+ for (const [bindingName, config$2] of Object.entries(bindings ?? {})) if (isUnsafeBindingType(config$2.type) && config$2.type !== "unsafe_hello_world") {
77236
77521
  const { type,...data$1 } = config$2;
77237
77522
  metadataBindings.push({
77238
77523
  name: bindingName,
@@ -77295,7 +77580,8 @@ function createWorkerUploadForm(worker, bindings$1, options) {
77295
77580
  bindings: metadataBindings,
77296
77581
  containers: worker.containers === void 0 ? void 0 : worker.containers.map((c$1) => ({
77297
77582
  ...c$1.name !== void 0 && { name: c$1.name },
77298
- ...c$1.class_name !== void 0 && { class_name: c$1.class_name }
77583
+ ...c$1.class_name !== void 0 && { class_name: c$1.class_name },
77584
+ ...c$1.images !== void 0 && { images: c$1.images }
77299
77585
  })),
77300
77586
  ...compatibility_date && { compatibility_date },
77301
77587
  ...compatibility_flags && { compatibility_flags },
@@ -77330,7 +77616,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
77330
77616
  //#endregion
77331
77617
  //#region ../remote-bindings/dist/index.mjs
77332
77618
  var import_undici = require_undici();
77333
- var version$2 = "0.0.20";
77619
+ var version$2 = "0.0.22";
77334
77620
  var NoDefaultValueProvided = class extends UserError {
77335
77621
  constructor() {
77336
77622
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -77771,7 +78057,7 @@ function handlePreviewSessionCreationError(err, accountId) {
77771
78057
  * (flat Record<string, Binding>).
77772
78058
  */
77773
78059
  function createRemoteWorkerInit(props) {
77774
- const bindings$1 = { ...props.bindings };
78060
+ const bindings = { ...props.bindings };
77775
78061
  return {
77776
78062
  name: props.name,
77777
78063
  main: {
@@ -77781,7 +78067,7 @@ function createRemoteWorkerInit(props) {
77781
78067
  content: props.bundle.entrypointSource
77782
78068
  },
77783
78069
  modules: props.bundle.modules,
77784
- bindings: bindings$1,
78070
+ bindings,
77785
78071
  migrations: void 0,
77786
78072
  exports: void 0,
77787
78073
  compatibility_date: props.compatibilityDate,
@@ -78104,11 +78390,11 @@ function findRemoteSessionAuthError(error$2) {
78104
78390
  if (isErrorEvent(error$2)) return findRemoteSessionAuthError(error$2.cause);
78105
78391
  if (error$2 instanceof Error) return findRemoteSessionAuthError(error$2.cause);
78106
78392
  }
78107
- async function startRemoteProxySession(bindings$1, options) {
78108
- for (const [name, binding] of Object.entries(bindings$1 ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError(`Flagship binding "${name}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
78393
+ async function startRemoteProxySession(bindings, options) {
78394
+ for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError(`Flagship binding "${name}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
78109
78395
  options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
78110
78396
  initLogger(getInternalLogger(options.logger));
78111
- const rawBindings = toRawBindings(bindings$1);
78397
+ const rawBindings = toRawBindings(bindings);
78112
78398
  const workerConfig = {
78113
78399
  name: options.workerName ?? randomUUID(),
78114
78400
  entrypointSource: ProxyServerWorker_default,
@@ -78175,8 +78461,8 @@ async function startRemoteProxySession(bindings$1, options) {
78175
78461
  dispose: () => devEnv.teardown()
78176
78462
  };
78177
78463
  }
78178
- function toRawBindings(bindings$1) {
78179
- return Object.fromEntries(Object.entries(bindings$1 ?? {}).map(([key, binding]) => [key, {
78464
+ function toRawBindings(bindings) {
78465
+ return Object.fromEntries(Object.entries(bindings ?? {}).map(([key, binding]) => [key, {
78180
78466
  ...binding,
78181
78467
  raw: true
78182
78468
  }]));
@@ -78195,8 +78481,8 @@ function getInternalLogger(logger$1) {
78195
78481
  console: disabled
78196
78482
  };
78197
78483
  }
78198
- function pickRemoteBindings(bindings$1) {
78199
- return Object.fromEntries(Object.entries(bindings$1 ?? {}).filter(([, binding]) => {
78484
+ function pickRemoteBindings(bindings) {
78485
+ return Object.fromEntries(Object.entries(bindings ?? {}).filter(([, binding]) => {
78200
78486
  if (getBindingLocalSupport(binding.type) === "DO-NOT-USE-this-resource-will-never-have-a-local-simulator") return true;
78201
78487
  return "remote" in binding && binding.remote;
78202
78488
  }));
@@ -81095,11 +81381,11 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
81095
81381
  const containerTagToOptionsMap = /* @__PURE__ */ new Map();
81096
81382
  let containerEngine;
81097
81383
  const workersFromConfig = resolvedPluginConfig.type === "workers" ? await Promise.all([...resolvedPluginConfig.environmentNameToWorkerMap].map(async ([environmentName, worker]) => {
81098
- const bindings$1 = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(worker.config);
81384
+ const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(worker.config);
81099
81385
  const preExistingRemoteProxySession = worker.config.configPath ? remoteProxySessionsDataMap.get(worker.config.configPath) : void 0;
81100
81386
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await maybeStartOrUpdateRemoteProxySession({
81101
81387
  name: worker.config.name,
81102
- bindings: bindings$1 ?? {},
81388
+ bindings: bindings ?? {},
81103
81389
  complianceRegion: worker.config.compliance_region,
81104
81390
  account_id: worker.config.account_id,
81105
81391
  profileDir: resolvedViteConfig.root
@@ -81314,11 +81600,11 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
81314
81600
  let containerEngine;
81315
81601
  const workers = (await Promise.all(resolvedPluginConfig.workers.map(async (previewWorker) => {
81316
81602
  const workerConfig = previewWorker.config;
81317
- const bindings$1 = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
81603
+ const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
81318
81604
  const preExistingRemoteProxySessionData = workerConfig.configPath ? remoteProxySessionsDataMap.get(workerConfig.configPath) : void 0;
81319
81605
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await maybeStartOrUpdateRemoteProxySession({
81320
81606
  name: workerConfig.name,
81321
- bindings: bindings$1 ?? {},
81607
+ bindings: bindings ?? {},
81322
81608
  complianceRegion: workerConfig.compliance_region,
81323
81609
  account_id: workerConfig.account_id,
81324
81610
  profileDir: resolvedViteConfig.root
@@ -82562,8 +82848,8 @@ function addShortcuts(server, ctx) {
82562
82848
  viteServer.config.logger.info("");
82563
82849
  const workerConfigs = ctx.allWorkerConfigs;
82564
82850
  for (const workerConfig of workerConfigs) {
82565
- const bindings$1 = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
82566
- wrangler.unstable_printBindings(bindings$1, {
82851
+ const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
82852
+ wrangler.unstable_printBindings(bindings, {
82567
82853
  tailConsumers: workerConfig.tail_consumers,
82568
82854
  streamingTailConsumers: workerConfig.streaming_tail_consumers,
82569
82855
  containers: workerConfig.containers,