@cloudflare/workers-utils 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-J6D57QVQ.mjs';
2
2
  export { MetricsRegistry } from './chunk-O4YGOZSW.mjs';
3
- import { isDirectory, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, removeDirSync, ParseError, parseJSON, APIError, parsePackageJSON, readFileSync as readFileSync$1, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-ULVYGN52.mjs';
4
- export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, indexLocation, isDirectory, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation } from './chunk-ULVYGN52.mjs';
3
+ import { partitionExports, isDirectory, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, removeDirSync, ParseError, parseJSON, APIError, parsePackageJSON, readFileSync as readFileSync$1, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-66IS76LR.mjs';
4
+ export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, indexLocation, isDirectory, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation } from './chunk-66IS76LR.mjs';
5
5
  import { __commonJS, __name, __require, __export, __toESM, __reExport } from './chunk-DCOBXSFB.mjs';
6
6
  import fs2, { accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync } from 'node:fs';
7
7
  import assert from 'node:assert';
@@ -1861,6 +1861,16 @@ var require_update_check = __commonJS({
1861
1861
  }
1862
1862
  });
1863
1863
 
1864
+ // src/config/durable-object-exports.ts
1865
+ function getDurableObjectExports(exports) {
1866
+ return partitionExports(exports)["durable-object"];
1867
+ }
1868
+ __name(getDurableObjectExports, "getDurableObjectExports");
1869
+ function hasDurableObjectExports(exports) {
1870
+ return Object.keys(getDurableObjectExports(exports)).length > 0;
1871
+ }
1872
+ __name(hasDurableObjectExports, "hasDurableObjectExports");
1873
+
1864
1874
  // src/config/config.ts
1865
1875
  var defaultWranglerConfig = {
1866
1876
  /* COMPUTED_FIELDS */
@@ -1953,6 +1963,7 @@ var defaultWranglerConfig = {
1953
1963
  jsx_factory: "React.createElement",
1954
1964
  jsx_fragment: "React.Fragment",
1955
1965
  migrations: [],
1966
+ exports: {},
1956
1967
  triggers: {
1957
1968
  crons: void 0
1958
1969
  },
@@ -6104,7 +6115,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
6104
6115
  var getRegistryPath = getEnvironmentVariableFactory({
6105
6116
  variableName: "WRANGLER_REGISTRY_PATH",
6106
6117
  defaultValue() {
6107
- return path3.join(getGlobalWranglerConfigPath(), "registry");
6118
+ return path3.join(getGlobalConfigPath(), "registry");
6108
6119
  }
6109
6120
  });
6110
6121
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({
@@ -7115,11 +7126,12 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
7115
7126
  validateRequiredProperty(diagnostics, "site", "bucket", bucket, "string");
7116
7127
  validateTypedArray(diagnostics, "sites.include", include, "string");
7117
7128
  validateTypedArray(diagnostics, "sites.exclude", exclude, "string");
7129
+ const legacySiteEntryPoint = rawConfig.site["entry-point"];
7118
7130
  validateOptionalProperty(
7119
7131
  diagnostics,
7120
7132
  "site",
7121
7133
  "entry-point",
7122
- rawConfig.site["entry-point"],
7134
+ legacySiteEntryPoint,
7123
7135
  "string"
7124
7136
  );
7125
7137
  deprecated(
@@ -7129,15 +7141,15 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
7129
7141
  `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
7130
7142
  \`\`\`
7131
7143
  main = "${path3.join(
7132
- String(rawConfig.site["entry-point"]) || "workers-site",
7133
- path3.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js"
7144
+ String(legacySiteEntryPoint) || "workers-site",
7145
+ path3.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js"
7134
7146
  )}"
7135
7147
  \`\`\``,
7136
7148
  false,
7137
7149
  void 0,
7138
7150
  "warning"
7139
7151
  );
7140
- let siteEntryPoint = rawConfig.site["entry-point"];
7152
+ let siteEntryPoint = legacySiteEntryPoint;
7141
7153
  if (!mainEntryPoint && !siteEntryPoint) {
7142
7154
  diagnostics.warnings.push(
7143
7155
  `Because you've defined a [site] configuration, we're defaulting to "workers-site" for the deprecated \`site.entry-point\`field.
@@ -7765,6 +7777,14 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
7765
7777
  validateMigrations,
7766
7778
  []
7767
7779
  ),
7780
+ exports: inheritable(
7781
+ diagnostics,
7782
+ topLevelEnv,
7783
+ rawEnv,
7784
+ "exports",
7785
+ validateExports,
7786
+ {}
7787
+ ),
7768
7788
  kv_namespaces: notInheritable(
7769
7789
  diagnostics,
7770
7790
  topLevelEnv,
@@ -8214,12 +8234,18 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
8214
8234
  void 0
8215
8235
  )
8216
8236
  };
8217
- warnIfDurableObjectsHaveNoMigrations(
8237
+ warnIfDurableObjectsHaveNoLifecycleConfig(
8218
8238
  diagnostics,
8219
8239
  environment.durable_objects,
8220
8240
  environment.migrations,
8241
+ environment.exports,
8221
8242
  configPath
8222
8243
  );
8244
+ errorIfMigrationsAndExportsBothSet(
8245
+ diagnostics,
8246
+ environment.migrations,
8247
+ environment.exports
8248
+ );
8223
8249
  if (envName !== "top level") {
8224
8250
  validateAdditionalProperties(
8225
8251
  diagnostics,
@@ -11127,6 +11153,210 @@ var validateMigrations = /* @__PURE__ */ __name((diagnostics, field, value) => {
11127
11153
  }
11128
11154
  return valid;
11129
11155
  }, "validateMigrations");
11156
+ var VALID_EXPORT_STORAGES = /* @__PURE__ */ new Set(["sqlite", "legacy-kv"]);
11157
+ var JS_IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
11158
+ function validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, allowedProperties) {
11159
+ let valid = true;
11160
+ for (const key of Object.keys(durableObjectExport)) {
11161
+ if (!allowedProperties.includes(key)) {
11162
+ diagnostics.errors.push(
11163
+ `"exports.${className}.${key}" is forbidden on state "${durableObjectExport.state ?? "created"}".`
11164
+ );
11165
+ valid = false;
11166
+ }
11167
+ }
11168
+ if (!valid) {
11169
+ diagnostics.errors.push(
11170
+ `Allowed properties are: ${ENGLISH.format(allowedProperties)}.`
11171
+ );
11172
+ }
11173
+ return valid;
11174
+ }
11175
+ __name(validateDurableObjectExportProperties, "validateDurableObjectExportProperties");
11176
+ function validateDurableObjectExport(diagnostics, className, durableObjectExport) {
11177
+ let valid = true;
11178
+ if (className === "") {
11179
+ diagnostics.errors.push(`"export" keys cannot be the empty string.`);
11180
+ valid = false;
11181
+ }
11182
+ switch (durableObjectExport.state) {
11183
+ case void 0:
11184
+ case "created": {
11185
+ if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
11186
+ diagnostics.errors.push(
11187
+ `"exports.${className}.storage" is required for state "created" and must be one of ${ENGLISH.format(VALID_EXPORT_STORAGES)}, but got ${JSON.stringify(durableObjectExport.storage)}`
11188
+ );
11189
+ valid = false;
11190
+ }
11191
+ valid = validateDurableObjectExportProperties(
11192
+ diagnostics,
11193
+ className,
11194
+ durableObjectExport,
11195
+ ["type", "state", "storage"]
11196
+ ) && valid;
11197
+ break;
11198
+ }
11199
+ case "deleted": {
11200
+ valid = validateDurableObjectExportProperties(
11201
+ diagnostics,
11202
+ className,
11203
+ durableObjectExport,
11204
+ ["type", "state"]
11205
+ ) && valid;
11206
+ break;
11207
+ }
11208
+ case "renamed": {
11209
+ if (typeof durableObjectExport.renamed_to !== "string" || durableObjectExport.renamed_to === "") {
11210
+ diagnostics.errors.push(
11211
+ `"exports.${className}.renamed_to" is required for state "renamed" and must be a non-empty string.`
11212
+ );
11213
+ valid = false;
11214
+ } else {
11215
+ if (!JS_IDENTIFIER_RE.test(durableObjectExport.renamed_to)) {
11216
+ diagnostics.errors.push(
11217
+ `"exports.${className}.renamed_to" must be a valid JavaScript identifier (got "${durableObjectExport.renamed_to}").`
11218
+ );
11219
+ valid = false;
11220
+ }
11221
+ if (durableObjectExport.renamed_to === className) {
11222
+ diagnostics.errors.push(
11223
+ `"exports.${className}.renamed_to" cannot equal the source class name "${className}".`
11224
+ );
11225
+ valid = false;
11226
+ }
11227
+ }
11228
+ valid = validateDurableObjectExportProperties(
11229
+ diagnostics,
11230
+ className,
11231
+ durableObjectExport,
11232
+ ["type", "state", "renamed_to"]
11233
+ ) && valid;
11234
+ break;
11235
+ }
11236
+ case "transferred": {
11237
+ if (typeof durableObjectExport.transferred_to !== "string" || durableObjectExport.transferred_to === "") {
11238
+ diagnostics.errors.push(
11239
+ `"exports.${className}.transferred_to" is required for state "transferred" and must be a non-empty string.`
11240
+ );
11241
+ valid = false;
11242
+ }
11243
+ valid = validateDurableObjectExportProperties(
11244
+ diagnostics,
11245
+ className,
11246
+ durableObjectExport,
11247
+ ["type", "state", "transferred_to"]
11248
+ ) && valid;
11249
+ break;
11250
+ }
11251
+ case "expecting-transfer": {
11252
+ if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
11253
+ diagnostics.errors.push(
11254
+ `"exports.${className}.storage" is required for state "expecting-transfer" and must be one of ${ENGLISH.format(VALID_EXPORT_STORAGES)}, but got ${JSON.stringify(durableObjectExport.storage)}`
11255
+ );
11256
+ valid = false;
11257
+ }
11258
+ if (typeof durableObjectExport.transfer_from !== "string" || durableObjectExport.transfer_from === "") {
11259
+ diagnostics.errors.push(
11260
+ `"exports.${className}.transfer_from" is required for state "expecting-transfer" and must be a non-empty string.`
11261
+ );
11262
+ valid = false;
11263
+ }
11264
+ valid = validateDurableObjectExportProperties(
11265
+ diagnostics,
11266
+ className,
11267
+ durableObjectExport,
11268
+ ["type", "state", "storage", "transfer_from"]
11269
+ ) && valid;
11270
+ break;
11271
+ }
11272
+ default: {
11273
+ const state = durableObjectExport.state;
11274
+ diagnostics.errors.push(
11275
+ `"exports.${className}.state" must be one of "created", "deleted", "renamed", "transferred", or "expecting-transfer" but got ${JSON.stringify(state)}.`
11276
+ );
11277
+ valid = false;
11278
+ }
11279
+ }
11280
+ return valid;
11281
+ }
11282
+ __name(validateDurableObjectExport, "validateDurableObjectExport");
11283
+ function validateWorkerExport(diagnostics, exportName, workerExport) {
11284
+ let valid = true;
11285
+ valid = validateAdditionalProperties(
11286
+ diagnostics,
11287
+ `exports.${exportName}`,
11288
+ Object.keys(workerExport),
11289
+ ["type", "cache"]
11290
+ ) && valid;
11291
+ valid = validateWorkerExportCache(
11292
+ diagnostics,
11293
+ `exports.${exportName}.cache`,
11294
+ workerExport.cache
11295
+ ) && valid;
11296
+ return valid;
11297
+ }
11298
+ __name(validateWorkerExport, "validateWorkerExport");
11299
+ function validateWorkerExportCache(diagnostics, field, value) {
11300
+ if (value === void 0) {
11301
+ return true;
11302
+ }
11303
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
11304
+ diagnostics.errors.push(
11305
+ `"${field}" should be an object but got ${JSON.stringify(value)}.`
11306
+ );
11307
+ return false;
11308
+ }
11309
+ const cache = value;
11310
+ let valid = true;
11311
+ valid = validateRequiredProperty(
11312
+ diagnostics,
11313
+ field,
11314
+ "enabled",
11315
+ cache.enabled,
11316
+ "boolean"
11317
+ ) && valid;
11318
+ valid = validateAdditionalProperties(diagnostics, field, Object.keys(cache), [
11319
+ "enabled"
11320
+ ]) && valid;
11321
+ return valid;
11322
+ }
11323
+ __name(validateWorkerExportCache, "validateWorkerExportCache");
11324
+ var validateExports = /* @__PURE__ */ __name((diagnostics, field, value) => {
11325
+ if (value === void 0 || value === null) {
11326
+ return true;
11327
+ }
11328
+ if (typeof value !== "object" || Array.isArray(value)) {
11329
+ diagnostics.errors.push(
11330
+ `The optional "${field}" field should be an object keyed by class name, but got ${JSON.stringify(
11331
+ value
11332
+ )}`
11333
+ );
11334
+ return false;
11335
+ }
11336
+ let valid = true;
11337
+ for (const [exportName, exportConfig] of Object.entries(value)) {
11338
+ if (typeof exportConfig !== "object" || exportConfig === null) {
11339
+ diagnostics.errors.push(
11340
+ `"exports.${exportName}" should be an object but got ${JSON.stringify(
11341
+ exportConfig
11342
+ )}.`
11343
+ );
11344
+ valid = false;
11345
+ continue;
11346
+ }
11347
+ if (exportConfig.type === "durable-object") {
11348
+ valid = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid;
11349
+ } else if (exportConfig.type === "worker") {
11350
+ valid = validateWorkerExport(diagnostics, exportName, exportConfig) && valid;
11351
+ } else {
11352
+ valid = false;
11353
+ diagnostics.errors.push(
11354
+ `"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`
11355
+ );
11356
+ }
11357
+ }
11358
+ return valid;
11359
+ }, "validateExports");
11130
11360
  var validateObservability = /* @__PURE__ */ __name((diagnostics, field, value) => {
11131
11361
  if (value === void 0) {
11132
11362
  return true;
@@ -11282,43 +11512,71 @@ var validateCache = /* @__PURE__ */ __name((diagnostics, field, value) => {
11282
11512
  val.enabled,
11283
11513
  "boolean"
11284
11514
  ) && isValid2;
11515
+ isValid2 = validateOptionalProperty(
11516
+ diagnostics,
11517
+ field,
11518
+ "cross_version_cache",
11519
+ val.cross_version_cache,
11520
+ "boolean"
11521
+ ) && isValid2;
11285
11522
  isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
11286
- "enabled"
11523
+ "enabled",
11524
+ "cross_version_cache"
11287
11525
  ]) && isValid2;
11288
11526
  return isValid2;
11289
11527
  }, "validateCache");
11290
- function warnIfDurableObjectsHaveNoMigrations(diagnostics, durableObjects, migrations, configPath) {
11291
- if (Array.isArray(durableObjects.bindings) && durableObjects.bindings.length > 0) {
11292
- const exportedDurableObjects = (durableObjects.bindings || []).filter(
11293
- (binding) => !binding.script_name
11294
- );
11295
- if (exportedDurableObjects.length > 0 && migrations.length === 0) {
11296
- if (!exportedDurableObjects.some(
11297
- (exportedDurableObject) => typeof exportedDurableObject.class_name !== "string"
11298
- )) {
11299
- const durableObjectClassnames = exportedDurableObjects.map(
11300
- (durable) => durable.class_name
11301
- );
11302
- diagnostics.warnings.push(dedent`
11303
- In your ${configFileName(configPath)} file, you have configured \`durable_objects\` exported by this Worker (${durableObjectClassnames.join(", ")}), but no \`migrations\` for them. This may not work as expected until you add a \`migrations\` section to your ${configFileName(configPath)} file. Add the following configuration:
11304
-
11305
- \`\`\`
11306
- ${formatConfigSnippet(
11307
- {
11308
- migrations: [
11309
- { tag: "v1", new_sqlite_classes: durableObjectClassnames }
11310
- ]
11311
- },
11312
- configPath
11313
- )}
11314
- \`\`\`
11315
-
11316
- Refer to https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/ for more details.`);
11317
- }
11528
+ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports, configPath) {
11529
+ if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) {
11530
+ return;
11531
+ }
11532
+ const exportedDurableObjects = durableObjects.bindings.filter(
11533
+ (binding) => !binding.script_name
11534
+ );
11535
+ const exportsCovers = /* @__PURE__ */ __name((className) => {
11536
+ const entry = exports?.[className];
11537
+ if (entry === void 0 || entry.type !== "durable-object") {
11538
+ return false;
11318
11539
  }
11540
+ const state = entry.state ?? "created";
11541
+ return state === "created" || state === "expecting-transfer";
11542
+ }, "exportsCovers");
11543
+ const uncoveredByExports = exportedDurableObjects.filter(
11544
+ (binding) => typeof binding.class_name !== "string" || !exportsCovers(binding.class_name)
11545
+ );
11546
+ if (uncoveredByExports.length === 0 || migrations.length > 0) {
11547
+ return;
11548
+ }
11549
+ if (uncoveredByExports.some(
11550
+ (exportedDurableObject) => typeof exportedDurableObject.class_name !== "string"
11551
+ )) {
11552
+ return;
11553
+ }
11554
+ const durableObjectClassnames = uncoveredByExports.map(
11555
+ (durable) => durable.class_name
11556
+ );
11557
+ const suggestedExports = {};
11558
+ for (const className of durableObjectClassnames) {
11559
+ suggestedExports[className] = {
11560
+ type: "durable-object",
11561
+ storage: "sqlite"
11562
+ };
11319
11563
  }
11564
+ diagnostics.warnings.push(dedent`
11565
+ In your ${configFileName(configPath)} file, you have configured \`durable_objects\` exported by this Worker (${durableObjectClassnames.join(", ")}), but no live \`exports\` entry for them. This may not work as expected until you add a live \`durable-object\` entry to \`exports\` for each. Add the following configuration:
11566
+
11567
+ \`\`\`
11568
+ ${formatConfigSnippet({ exports: suggestedExports }, configPath)}
11569
+ \`\`\``);
11320
11570
  }
11321
- __name(warnIfDurableObjectsHaveNoMigrations, "warnIfDurableObjectsHaveNoMigrations");
11571
+ __name(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
11572
+ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports) {
11573
+ if (migrations.length > 0 && exports !== void 0 && Object.values(exports).some((entry) => entry.type === "durable-object")) {
11574
+ diagnostics.errors.push(
11575
+ `\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`
11576
+ );
11577
+ }
11578
+ }
11579
+ __name(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
11322
11580
  var validatePythonModules = /* @__PURE__ */ __name((diagnostics, field, value, topLevelEnv) => {
11323
11581
  if (value === void 0) {
11324
11582
  return true;
@@ -11783,7 +12041,7 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
11783
12041
  }
11784
12042
  __name(getLatestVersionInfo, "getLatestVersionInfo");
11785
12043
  function getCacheDir(version) {
11786
- return join(getGlobalWranglerConfigPath(), "cloudflared", version);
12044
+ return join(getGlobalConfigPath(), "cloudflared", version);
11787
12045
  }
11788
12046
  __name(getCacheDir, "getCacheDir");
11789
12047
  function getCloudflaredBinPath(version) {
@@ -11828,7 +12086,7 @@ On Linux, make sure you have the required dependencies:
11828
12086
  errorMessage += ` - For Debian/Ubuntu: sudo apt-get install libc6
11829
12087
  `;
11830
12088
  }
11831
- const cacheDir = join(getGlobalWranglerConfigPath(), "cloudflared");
12089
+ const cacheDir = join(getGlobalConfigPath(), "cloudflared");
11832
12090
  errorMessage += `
11833
12091
  You can try:
11834
12092
  `;
@@ -12143,7 +12401,7 @@ async function spawnCloudflared(args, options) {
12143
12401
  }
12144
12402
  __name(spawnCloudflared, "spawnCloudflared");
12145
12403
  function removeCloudflaredCache(version) {
12146
- const cacheDir = version ? getCacheDir(version) : join(getGlobalWranglerConfigPath(), "cloudflared");
12404
+ const cacheDir = version ? getCacheDir(version) : join(getGlobalConfigPath(), "cloudflared");
12147
12405
  if (existsSync(cacheDir)) {
12148
12406
  removeDirSync(cacheDir);
12149
12407
  return cacheDir;
@@ -12693,6 +12951,10 @@ function throwFetchError(resource, response, status) {
12693
12951
  if (code) {
12694
12952
  error.code = code;
12695
12953
  }
12954
+ const meta = errors[0]?.meta;
12955
+ if (meta) {
12956
+ error.meta = meta;
12957
+ }
12696
12958
  error.accountTag = extractAccountTag(resource);
12697
12959
  throw error;
12698
12960
  }
@@ -12954,6 +13216,9 @@ function getWorkerNameFromProject(projectPath) {
12954
13216
  return getWorkerName(packageJsonName, projectPath);
12955
13217
  }
12956
13218
  __name(getWorkerNameFromProject, "getWorkerNameFromProject");
13219
+
13220
+ // src/index.ts
13221
+ var friendlyBindingNames2 = friendlyBindingNames;
12957
13222
  /*! Bundled license information:
12958
13223
 
12959
13224
  deep-extend/lib/deep-extend.js:
@@ -12988,4 +13253,4 @@ safe-buffer/index.js:
12988
13253
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
12989
13254
  */
12990
13255
 
12991
- export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalConfigPath, getGlobalWranglerConfigPath, getHostFromRoute, getHostFromUrl, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasMorePages, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };
13256
+ export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getDurableObjectExports, getEnvironmentVariableFactory, getGlobalConfigPath, getGlobalWranglerConfigPath, getHostFromRoute, getHostFromUrl, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };