@cloudflare/workers-utils 0.33.0 → 0.34.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,18 +1,18 @@
1
- export { NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, isNodejsCompatDefaultOn, mapWorkerMetadataBindings, resolveNodejsCompat, stripRedundantNodejsCompatFlags } from './chunk-NMPHTL5R.mjs';
1
+ export { DEFAULT_COMPAT_DATE, assertNever, constructWranglerConfig, mapWorkerMetadataBindings } from './chunk-QKX75RGI.mjs';
2
2
  import { getGlobalConfigPath } from './chunk-34VZWBGB.mjs';
3
3
  export { getGlobalConfigPath, getGlobalWranglerCachePath } from './chunk-34VZWBGB.mjs';
4
4
  export { MetricsRegistry } from './chunk-Z62CVNHJ.mjs';
5
- import { partitionExports, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, dir, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-3K53PSCY.mjs';
6
- 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, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation } from './chunk-3K53PSCY.mjs';
5
+ import { UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, getDurableObjectExports, getContainerNameToClassNameMap, FatalError, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, dir, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-QFKPUV4H.mjs';
6
+ 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, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, hasDurableObjectExports, indexLocation, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation } from './chunk-QFKPUV4H.mjs';
7
7
  import { isDirectory, removeDirSync } from './chunk-53IMCORZ.mjs';
8
8
  export { isDirectory, removeDir, removeDirSync } from './chunk-53IMCORZ.mjs';
9
9
  import { __commonJS, __name, __require, __export, __toESM } from './chunk-Q72B4Q5Z.mjs';
10
- import fs2, { statSync, accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync as readFileSync$1 } from 'node:fs';
10
+ import fs2, { statSync, accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync as readFileSync$1, appendFileSync } from 'node:fs';
11
11
  import assert2 from 'node:assert';
12
12
  import * as path2 from 'node:path';
13
- import path2__default, { join, dirname, basename, resolve } from 'node:path';
13
+ import path2__default, { join, dirname, resolve, basename } from 'node:path';
14
14
  import { execFileSync, spawn } from 'node:child_process';
15
- import { createHash } from 'node:crypto';
15
+ import { createHash, randomBytes } from 'node:crypto';
16
16
  import { arch } from 'node:os';
17
17
  import { fetch, Headers, FormData, Response } from 'undici';
18
18
  import { URLSearchParams } from 'node:url';
@@ -23,7 +23,7 @@ import { assert as assert$1 } from 'node:console';
23
23
 
24
24
  // ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json
25
25
  var require_vendors = __commonJS({
26
- "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports, module) {
26
+ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module) {
27
27
  module.exports = [
28
28
  {
29
29
  name: "Agola CI",
@@ -392,33 +392,33 @@ var require_vendors = __commonJS({
392
392
 
393
393
  // ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js
394
394
  var require_ci_info = __commonJS({
395
- "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports) {
395
+ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1) {
396
396
  var vendors = require_vendors();
397
397
  var env = process.env;
398
- Object.defineProperty(exports, "_vendors", {
398
+ Object.defineProperty(exports$1, "_vendors", {
399
399
  value: vendors.map(function(v) {
400
400
  return v.constant;
401
401
  })
402
402
  });
403
- exports.name = null;
404
- exports.isPR = null;
405
- exports.id = null;
403
+ exports$1.name = null;
404
+ exports$1.isPR = null;
405
+ exports$1.id = null;
406
406
  if (env.CI !== "false") {
407
407
  vendors.forEach(function(vendor) {
408
408
  const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
409
409
  const isCI2 = envs.every(function(obj) {
410
410
  return checkEnv(obj);
411
411
  });
412
- exports[vendor.constant] = isCI2;
412
+ exports$1[vendor.constant] = isCI2;
413
413
  if (!isCI2) {
414
414
  return;
415
415
  }
416
- exports.name = vendor.name;
417
- exports.isPR = checkPR(vendor);
418
- exports.id = vendor.constant;
416
+ exports$1.name = vendor.name;
417
+ exports$1.isPR = checkPR(vendor);
418
+ exports$1.id = vendor.constant;
419
419
  });
420
420
  }
421
- exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
421
+ exports$1.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
422
422
  (env.BUILD_ID || // Jenkins, Cloudbees
423
423
  env.BUILD_NUMBER || // Jenkins, TeamCity
424
424
  env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
@@ -428,7 +428,7 @@ var require_ci_info = __commonJS({
428
428
  env.CI_NAME || // Codeship and others
429
429
  env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
430
430
  env.RUN_ID || // TaskCluster, dsari
431
- exports.name || false));
431
+ exports$1.name || false));
432
432
  function checkEnv(obj) {
433
433
  if (typeof obj === "string") return !!env[obj];
434
434
  if ("env" in obj) {
@@ -474,7 +474,7 @@ var require_ci_info = __commonJS({
474
474
 
475
475
  // ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
476
476
  var require_command_exists = __commonJS({
477
- "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports, module) {
477
+ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module) {
478
478
  var exec = __require("child_process").exec;
479
479
  var execSync = __require("child_process").execSync;
480
480
  var fs3 = __require("fs");
@@ -582,9 +582,9 @@ var require_command_exists = __commonJS({
582
582
  cleanInput = /* @__PURE__ */ __name(function(s) {
583
583
  var isPathName = /[\\]/.test(s);
584
584
  if (isPathName) {
585
- var dirname3 = '"' + path6.dirname(s) + '"';
585
+ var dirname4 = '"' + path6.dirname(s) + '"';
586
586
  var basename2 = '"' + path6.basename(s) + '"';
587
- return dirname3 + ":" + basename2;
587
+ return dirname4 + ":" + basename2;
588
588
  }
589
589
  return '"' + s + '"';
590
590
  }, "cleanInput");
@@ -592,10 +592,10 @@ var require_command_exists = __commonJS({
592
592
  module.exports = /* @__PURE__ */ __name(function commandExists(commandName, callback) {
593
593
  var cleanedCommandName = cleanInput(commandName);
594
594
  if (!callback && typeof Promise !== "undefined") {
595
- return new Promise(function(resolve2, reject) {
595
+ return new Promise(function(resolve3, reject) {
596
596
  commandExists(commandName, function(error51, output) {
597
597
  if (output) {
598
- resolve2(commandName);
598
+ resolve3(commandName);
599
599
  } else {
600
600
  reject(error51);
601
601
  }
@@ -621,18 +621,18 @@ var require_command_exists = __commonJS({
621
621
 
622
622
  // ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js
623
623
  var require_command_exists2 = __commonJS({
624
- "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports, module) {
624
+ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module) {
625
625
  module.exports = require_command_exists();
626
626
  }
627
627
  });
628
628
 
629
629
  // ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
630
630
  var require_ini = __commonJS({
631
- "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports) {
632
- exports.parse = exports.decode = decode3;
633
- exports.stringify = exports.encode = encode3;
634
- exports.safe = safe;
635
- exports.unsafe = unsafe;
631
+ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
632
+ exports$1.parse = exports$1.decode = decode3;
633
+ exports$1.stringify = exports$1.encode = encode3;
634
+ exports$1.safe = safe;
635
+ exports$1.unsafe = unsafe;
636
636
  var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
637
637
  function encode3(obj, opt) {
638
638
  var children = [];
@@ -796,7 +796,7 @@ var require_ini = __commonJS({
796
796
 
797
797
  // ../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js
798
798
  var require_strip_json_comments = __commonJS({
799
- "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports, module) {
799
+ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1, module) {
800
800
  var singleComment = 1;
801
801
  var multiComment = 2;
802
802
  function stripWithoutWhitespace() {
@@ -864,17 +864,17 @@ var require_strip_json_comments = __commonJS({
864
864
 
865
865
  // ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
866
866
  var require_utils = __commonJS({
867
- "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
867
+ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
868
868
  var fs3 = __require("fs");
869
869
  var ini = require_ini();
870
870
  var path6 = __require("path");
871
871
  var stripJsonComments = require_strip_json_comments();
872
- var parse3 = exports.parse = function(content) {
872
+ var parse3 = exports$1.parse = function(content) {
873
873
  if (/^\s*{/.test(content))
874
874
  return JSON.parse(stripJsonComments(content));
875
875
  return ini.parse(content);
876
876
  };
877
- var file2 = exports.file = function() {
877
+ var file2 = exports$1.file = function() {
878
878
  var args = [].slice.call(arguments).filter(function(arg) {
879
879
  return arg != null;
880
880
  });
@@ -888,11 +888,11 @@ var require_utils = __commonJS({
888
888
  return;
889
889
  }
890
890
  };
891
- exports.json = function() {
891
+ exports$1.json = function() {
892
892
  var content = file2.apply(null, arguments);
893
893
  return content ? parse3(content) : null;
894
894
  };
895
- exports.env = function(prefix, env2) {
895
+ exports$1.env = function(prefix, env2) {
896
896
  env2 = env2 || process.env;
897
897
  var obj = {};
898
898
  var l = prefix.length;
@@ -917,7 +917,7 @@ var require_utils = __commonJS({
917
917
  }
918
918
  return obj;
919
919
  };
920
- exports.find = function() {
920
+ exports$1.find = function() {
921
921
  var rel = path6.join.apply(null, [].slice.call(arguments));
922
922
  function find2(start, rel2) {
923
923
  var file3 = path6.join(start, rel2);
@@ -937,7 +937,7 @@ var require_utils = __commonJS({
937
937
 
938
938
  // ../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js
939
939
  var require_deep_extend = __commonJS({
940
- "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports, module) {
940
+ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1, module) {
941
941
  function isSpecificValue(val) {
942
942
  return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
943
943
  }
@@ -1022,7 +1022,7 @@ var require_deep_extend = __commonJS({
1022
1022
 
1023
1023
  // ../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
1024
1024
  var require_minimist = __commonJS({
1025
- "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports, module) {
1025
+ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1, module) {
1026
1026
  module.exports = function(args, opts) {
1027
1027
  if (!opts) opts = {};
1028
1028
  var flags = { bools: {}, strings: {}, unknownFn: null };
@@ -1225,7 +1225,7 @@ var require_minimist = __commonJS({
1225
1225
 
1226
1226
  // ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js
1227
1227
  var require_rc = __commonJS({
1228
- "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports, module) {
1228
+ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1, module) {
1229
1229
  var cc = require_utils();
1230
1230
  var join3 = __require("path").join;
1231
1231
  var deepExtend = require_deep_extend();
@@ -1277,7 +1277,7 @@ var require_rc = __commonJS({
1277
1277
 
1278
1278
  // ../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js
1279
1279
  var require_registry_url = __commonJS({
1280
- "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports, module) {
1280
+ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1, module) {
1281
1281
  module.exports = function(scope) {
1282
1282
  var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
1283
1283
  var url2 = rc[scope + ":registry"] || rc.registry;
@@ -1288,7 +1288,7 @@ var require_registry_url = __commonJS({
1288
1288
 
1289
1289
  // ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
1290
1290
  var require_safe_buffer = __commonJS({
1291
- "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports, module) {
1291
+ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1, module) {
1292
1292
  var buffer = __require("buffer");
1293
1293
  var Buffer2 = buffer.Buffer;
1294
1294
  function copyProps(src, dst) {
@@ -1300,8 +1300,8 @@ var require_safe_buffer = __commonJS({
1300
1300
  if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
1301
1301
  module.exports = buffer;
1302
1302
  } else {
1303
- copyProps(buffer, exports);
1304
- exports.Buffer = SafeBuffer;
1303
+ copyProps(buffer, exports$1);
1304
+ exports$1.Buffer = SafeBuffer;
1305
1305
  }
1306
1306
  function SafeBuffer(arg, encodingOrOffset, length) {
1307
1307
  return Buffer2(arg, encodingOrOffset, length);
@@ -1348,7 +1348,7 @@ var require_safe_buffer = __commonJS({
1348
1348
 
1349
1349
  // ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js
1350
1350
  var require_base64 = __commonJS({
1351
- "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports, module) {
1351
+ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1, module) {
1352
1352
  var safeBuffer = require_safe_buffer().Buffer;
1353
1353
  function decodeBase64(base643) {
1354
1354
  return safeBuffer.from(base643, "base64").toString("utf8");
@@ -1367,7 +1367,7 @@ var require_base64 = __commonJS({
1367
1367
 
1368
1368
  // ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js
1369
1369
  var require_registry_auth_token = __commonJS({
1370
- "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports, module) {
1370
+ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1, module) {
1371
1371
  var url2 = __require("url");
1372
1372
  var base643 = require_base64();
1373
1373
  var decodeBase64 = base643.decodeBase64;
@@ -1465,7 +1465,7 @@ var require_registry_auth_token = __commonJS({
1465
1465
 
1466
1466
  // ../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js
1467
1467
  var require_update_check = __commonJS({
1468
- "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports, module) {
1468
+ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module) {
1469
1469
  var { URL: URL2 } = __require("url");
1470
1470
  var { join: join3 } = __require("path");
1471
1471
  var fs3 = __require("fs");
@@ -1513,7 +1513,7 @@ var require_update_check = __commonJS({
1513
1513
  });
1514
1514
  await writeFile(file2, content, "utf8");
1515
1515
  }, "updateCache");
1516
- var loadPackage = /* @__PURE__ */ __name((url2, authInfo) => new Promise((resolve2, reject) => {
1516
+ var loadPackage = /* @__PURE__ */ __name((url2, authInfo) => new Promise((resolve3, reject) => {
1517
1517
  const options = {
1518
1518
  host: url2.hostname,
1519
1519
  path: url2.pathname,
@@ -1544,7 +1544,7 @@ var require_update_check = __commonJS({
1544
1544
  response.on("end", () => {
1545
1545
  try {
1546
1546
  const parsedData = JSON.parse(rawData);
1547
- resolve2(parsedData);
1547
+ resolve3(parsedData);
1548
1548
  } catch (e2) {
1549
1549
  reject(e2);
1550
1550
  }
@@ -1630,16 +1630,6 @@ var ARTIFACTS_EVENT_TYPES = [
1630
1630
  "cf.artifacts.repo.token.revoked"
1631
1631
  ];
1632
1632
 
1633
- // src/config/durable-object-exports.ts
1634
- function getDurableObjectExports(exports) {
1635
- return partitionExports(exports)["durable-object"];
1636
- }
1637
- __name(getDurableObjectExports, "getDurableObjectExports");
1638
- function hasDurableObjectExports(exports) {
1639
- return Object.keys(getDurableObjectExports(exports)).length > 0;
1640
- }
1641
- __name(hasDurableObjectExports, "hasDurableObjectExports");
1642
-
1643
1633
  // src/config/config.ts
1644
1634
  var defaultWranglerConfig = {
1645
1635
  /* COMPUTED_FIELDS */
@@ -1686,6 +1676,7 @@ var defaultWranglerConfig = {
1686
1676
  consumers: []
1687
1677
  // WORKERS SUPPORT ONLY!!
1688
1678
  },
1679
+ connect: [],
1689
1680
  r2_buckets: [],
1690
1681
  d1_databases: [],
1691
1682
  vectorize: [],
@@ -1749,6 +1740,7 @@ var defaultWranglerConfig = {
1749
1740
  upload_source_maps: void 0,
1750
1741
  assets: void 0,
1751
1742
  observability: { enabled: true },
1743
+ access: void 0,
1752
1744
  cache: void 0,
1753
1745
  /** The default here is undefined so that we can delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable. */
1754
1746
  compliance_region: void 0,
@@ -16893,6 +16885,9 @@ function getWranglerSendMetricsFromEnv() {
16893
16885
  return getWranglerSendMetricsVariableFromEnv();
16894
16886
  }
16895
16887
  __name(getWranglerSendMetricsFromEnv, "getWranglerSendMetricsFromEnv");
16888
+ var getNoSkillsUpdatePromptsFromEnv = getBooleanEnvironmentVariableFactory({
16889
+ variableName: "WRANGLER_NO_SKILLS_UPDATE_PROMPTS"
16890
+ });
16896
16891
  var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
16897
16892
  variableName: "WRANGLER_SEND_ERROR_REPORTS",
16898
16893
  defaultValue: false
@@ -18707,6 +18702,16 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
18707
18702
  validateQueues(envName),
18708
18703
  { producers: [], consumers: [] }
18709
18704
  ),
18705
+ connect: notInheritable(
18706
+ diagnostics,
18707
+ topLevelEnv,
18708
+ rawConfig,
18709
+ rawEnv,
18710
+ envName,
18711
+ "connect",
18712
+ validateConnectHandlers(envName),
18713
+ []
18714
+ ),
18710
18715
  r2_buckets: notInheritable(
18711
18716
  diagnostics,
18712
18717
  topLevelEnv,
@@ -19073,6 +19078,14 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
19073
19078
  validateObservability,
19074
19079
  void 0
19075
19080
  ),
19081
+ access: inheritable(
19082
+ diagnostics,
19083
+ topLevelEnv,
19084
+ rawEnv,
19085
+ "access",
19086
+ validateAccess,
19087
+ void 0
19088
+ ),
19076
19089
  cache: inheritable(
19077
19090
  diagnostics,
19078
19091
  topLevelEnv,
@@ -19102,7 +19115,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
19102
19115
  topLevelEnv,
19103
19116
  rawEnv,
19104
19117
  "previews",
19105
- validatePreviewsConfig(envName),
19118
+ validatePreviewsConfig(envName, configPath),
19106
19119
  void 0
19107
19120
  )
19108
19121
  };
@@ -19118,6 +19131,15 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
19118
19131
  environment.migrations,
19119
19132
  environment.exports
19120
19133
  );
19134
+ const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some(
19135
+ (rawNamedEnv) => rawNamedEnv?.containers !== void 0
19136
+ );
19137
+ validateContainerExportLinks(
19138
+ diagnostics,
19139
+ environment.containers,
19140
+ environment.exports,
19141
+ containersDeclaredElsewhere
19142
+ );
19121
19143
  if (envName !== "top level") {
19122
19144
  validateAdditionalProperties(
19123
19145
  diagnostics,
@@ -19646,14 +19668,6 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
19646
19668
  );
19647
19669
  isValid = false;
19648
19670
  }
19649
- if (!isOptionalProperty(value, "remote", "boolean")) {
19650
- diagnostics.errors.push(
19651
- `"${field}" bindings should, optionally, have a boolean "remote" field but got ${JSON.stringify(
19652
- value
19653
- )}.`
19654
- );
19655
- isValid = false;
19656
- }
19657
19671
  if (hasProperty(value, "schedules") && value.schedules !== void 0) {
19658
19672
  if (typeof value.schedules === "string") {
19659
19673
  if (value.schedules.length === 0) {
@@ -19727,7 +19741,6 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
19727
19741
  "name",
19728
19742
  "class_name",
19729
19743
  "script_name",
19730
- "remote",
19731
19744
  "limits",
19732
19745
  "schedules"
19733
19746
  ]);
@@ -20017,7 +20030,73 @@ Please add a binding for "${configBindingName}" to "env.${envName}.${field}.bind
20017
20030
  }
20018
20031
  return isValid;
20019
20032
  }, "validateBindingArray");
20020
- function validateContainerApp(envName, topLevelName, configPath) {
20033
+ function validateSshPublicKeys(diagnostics, field, value, nameRequired) {
20034
+ if (!Array.isArray(value)) {
20035
+ diagnostics.errors.push(`${field} must be an array`);
20036
+ return;
20037
+ }
20038
+ for (const [index, key] of value.entries()) {
20039
+ const fieldPath = `${field}[${index}]`;
20040
+ if (typeof key !== "object" || key === null || Array.isArray(key)) {
20041
+ diagnostics.errors.push(`${fieldPath} must be an object`);
20042
+ continue;
20043
+ }
20044
+ const hasValidName = nameRequired ? isRequiredProperty(key, "name", "string") : isOptionalProperty(key, "name", "string");
20045
+ if (!hasValidName) {
20046
+ diagnostics.errors.push(`${fieldPath}.name must be a string`);
20047
+ }
20048
+ if (!isRequiredProperty(key, "public_key", "string")) {
20049
+ diagnostics.errors.push(`${fieldPath}.public_key must be a string`);
20050
+ } else if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
20051
+ diagnostics.errors.push(
20052
+ `${fieldPath}.public_key is an unsupported key type. Please provide an ED25519 public key.`
20053
+ );
20054
+ }
20055
+ }
20056
+ }
20057
+ __name(validateSshPublicKeys, "validateSshPublicKeys");
20058
+ function validatePreviewsContainers(envName, configPath) {
20059
+ const innerValidator = validateContainerApp(envName, void 0, configPath, {
20060
+ generateDefaultName: false
20061
+ });
20062
+ return (diagnostics, field, value, config2) => {
20063
+ if (Array.isArray(value)) {
20064
+ const nameFields = [...value.entries()].filter(
20065
+ ([, entry]) => entry && typeof entry === "object" && "name" in entry
20066
+ ).map(([index]) => `"${field}[${index}].name"`);
20067
+ if (nameFields.length > 0) {
20068
+ diagnostics.errors.push(
20069
+ `${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".`
20070
+ );
20071
+ return false;
20072
+ }
20073
+ const seenClasses = /* @__PURE__ */ new Set();
20074
+ const duplicateClasses = /* @__PURE__ */ new Set();
20075
+ for (const entry of value) {
20076
+ if (!entry || typeof entry !== "object") {
20077
+ continue;
20078
+ }
20079
+ if (typeof entry.class_name === "string") {
20080
+ if (seenClasses.has(entry.class_name)) {
20081
+ duplicateClasses.add(entry.class_name);
20082
+ }
20083
+ seenClasses.add(entry.class_name);
20084
+ }
20085
+ }
20086
+ if (duplicateClasses.size > 0) {
20087
+ const classList = [...duplicateClasses].map((className) => `"${className}"`).join(", ");
20088
+ diagnostics.errors.push(
20089
+ `"${field}" declares more than one container for the Durable Object class ${classList}; each Durable Object class may appear at most once.`
20090
+ );
20091
+ return false;
20092
+ }
20093
+ }
20094
+ return innerValidator(diagnostics, field, value, config2);
20095
+ };
20096
+ }
20097
+ __name(validatePreviewsContainers, "validatePreviewsContainers");
20098
+ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
20099
+ const { generateDefaultName = true } = options;
20021
20100
  return (diagnostics, field, value, config2) => {
20022
20101
  if (!value) {
20023
20102
  return true;
@@ -20029,12 +20108,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
20029
20108
  return false;
20030
20109
  }
20031
20110
  for (const containerAppOptional of value) {
20032
- if (!isOptionalProperty(value, "name", "string")) {
20033
- diagnostics.errors.push(
20034
- `Field "name", when present, should be a string, but got ${JSON.stringify(value)}`
20035
- );
20036
- }
20037
- validateRequiredProperty(
20111
+ validateOptionalProperty(
20038
20112
  diagnostics,
20039
20113
  field,
20040
20114
  "class_name",
@@ -20048,15 +20122,20 @@ function validateContainerApp(envName, topLevelName, configPath) {
20048
20122
  containerAppOptional.name,
20049
20123
  "string"
20050
20124
  );
20051
- if (!containerAppOptional.name) {
20052
- if (!topLevelName || !isOptionalProperty(containerAppOptional, "class_name", "string")) {
20125
+ if (generateDefaultName && !containerAppOptional.name) {
20126
+ if (containerAppOptional.class_name === void 0) {
20127
+ diagnostics.errors.push(
20128
+ `"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".`
20129
+ );
20130
+ } else if (!topLevelName) {
20053
20131
  diagnostics.errors.push(
20054
20132
  `Must have either a top level "name" and "containers.class_name" field defined, or have field "containers.name" defined.`
20055
20133
  );
20134
+ } else {
20135
+ let name = `${topLevelName}-${containerAppOptional.class_name}`;
20136
+ name += config2 === void 0 ? "" : `-${envName}`;
20137
+ containerAppOptional.name = name.toLowerCase().replace(/ /g, "-");
20056
20138
  }
20057
- let name = `${topLevelName}-${containerAppOptional.class_name}`;
20058
- name += config2 === void 0 ? "" : `-${envName}`;
20059
- containerAppOptional.name = name.toLowerCase().replace(/ /g, "-");
20060
20139
  }
20061
20140
  if (!containerAppOptional.configuration?.image && !containerAppOptional.image) {
20062
20141
  diagnostics.errors.push(
@@ -20067,12 +20146,11 @@ function validateContainerApp(envName, topLevelName, configPath) {
20067
20146
  diagnostics.warnings.push(
20068
20147
  `"containers.configuration" is deprecated. Use top level "containers" fields instead. "configuration.image" should be "image", limits should be set via "instance_type".`
20069
20148
  );
20070
- if (typeof containerAppOptional.configuration !== "object" || Array.isArray(containerAppOptional.configuration)) {
20149
+ if (typeof containerAppOptional.configuration !== "object" || containerAppOptional.configuration === null || Array.isArray(containerAppOptional.configuration)) {
20071
20150
  diagnostics.errors.push(
20072
20151
  `"containers.configuration" should be an object`
20073
20152
  );
20074
- }
20075
- if (containerAppOptional.instance_type && (containerAppOptional.configuration.disk !== void 0 || containerAppOptional.configuration.vcpu !== void 0 || containerAppOptional.configuration.memory_mib !== void 0)) {
20153
+ } else if (containerAppOptional.instance_type && (containerAppOptional.configuration.disk !== void 0 || containerAppOptional.configuration.vcpu !== void 0 || containerAppOptional.configuration.memory_mib !== void 0)) {
20076
20154
  diagnostics.errors.push(
20077
20155
  `Cannot set custom limits via "containers.configuration" and use preset "instance_type" limits at the same time.`
20078
20156
  );
@@ -20257,7 +20335,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
20257
20335
  "unsafe"
20258
20336
  ]
20259
20337
  );
20260
- if ("configuration" in containerAppOptional) {
20338
+ if (typeof containerAppOptional.configuration === "object" && containerAppOptional.configuration !== null && !Array.isArray(containerAppOptional.configuration)) {
20261
20339
  validateAdditionalProperties(
20262
20340
  diagnostics,
20263
20341
  `${field}.configuration`,
@@ -20291,52 +20369,20 @@ function validateContainerApp(envName, topLevelName, configPath) {
20291
20369
  }
20292
20370
  }
20293
20371
  if ("authorized_keys" in containerAppOptional) {
20294
- if (!Array.isArray(containerAppOptional.authorized_keys)) {
20295
- diagnostics.errors.push(`${field}.authorized_keys must be an array`);
20296
- } else {
20297
- for (const index in containerAppOptional.authorized_keys) {
20298
- const fieldPath = `${field}.authorized_keys[${index}]`;
20299
- const key = containerAppOptional.authorized_keys[index];
20300
- if (!isRequiredProperty(key, "name", "string")) {
20301
- diagnostics.errors.push(`${fieldPath}.name must be a string`);
20302
- }
20303
- if (!isRequiredProperty(key, "public_key", "string")) {
20304
- diagnostics.errors.push(
20305
- `${fieldPath}.public_key must be a string`
20306
- );
20307
- }
20308
- if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
20309
- diagnostics.errors.push(
20310
- `${fieldPath}.public_key is a unsupported key type. Please provide a ED25519 public key.`
20311
- );
20312
- }
20313
- }
20314
- }
20372
+ validateSshPublicKeys(
20373
+ diagnostics,
20374
+ `${field}.authorized_keys`,
20375
+ containerAppOptional.authorized_keys,
20376
+ true
20377
+ );
20315
20378
  }
20316
20379
  if ("trusted_user_ca_keys" in containerAppOptional) {
20317
- if (!Array.isArray(containerAppOptional.trusted_user_ca_keys)) {
20318
- diagnostics.errors.push(
20319
- `${field}.trusted_user_ca_keys must be an array`
20320
- );
20321
- } else {
20322
- for (const index in containerAppOptional.trusted_user_ca_keys) {
20323
- const fieldPath = `${field}.trusted_user_ca_keys[${index}]`;
20324
- const key = containerAppOptional.trusted_user_ca_keys[index];
20325
- if (!isOptionalProperty(key, "name", "string")) {
20326
- diagnostics.errors.push(`${fieldPath}.name must be a string`);
20327
- }
20328
- if (!isRequiredProperty(key, "public_key", "string")) {
20329
- diagnostics.errors.push(
20330
- `${fieldPath}.public_key must be a string`
20331
- );
20332
- }
20333
- if (!key.public_key.toLowerCase().startsWith("ssh-ed25519")) {
20334
- diagnostics.errors.push(
20335
- `${fieldPath}.public_key is a unsupported key type. Please provide a ED25519 public key.`
20336
- );
20337
- }
20338
- }
20339
- }
20380
+ validateSshPublicKeys(
20381
+ diagnostics,
20382
+ `${field}.trusted_user_ca_keys`,
20383
+ containerAppOptional.trusted_user_ca_keys,
20384
+ false
20385
+ );
20340
20386
  }
20341
20387
  if (validateOptionalProperty(
20342
20388
  diagnostics,
@@ -21407,12 +21453,13 @@ function validateQueues(envName) {
21407
21453
  )}.`
21408
21454
  );
21409
21455
  isValid = false;
21410
- }
21411
- for (let i = 0; i < consumers.length; i++) {
21412
- const consumer = consumers[i];
21413
- const consumerPath = `${fieldPath}.consumers[${i}]`;
21414
- if (!validateConsumer(diagnostics, consumerPath, consumer, config2)) {
21415
- isValid = false;
21456
+ } else {
21457
+ for (let i = 0; i < consumers.length; i++) {
21458
+ const consumer = consumers[i];
21459
+ const consumerPath = `${fieldPath}.consumers[${i}]`;
21460
+ if (!validateConsumer(diagnostics, consumerPath, consumer, config2)) {
21461
+ isValid = false;
21462
+ }
21416
21463
  }
21417
21464
  }
21418
21465
  }
@@ -21484,6 +21531,108 @@ var validateConsumer = /* @__PURE__ */ __name((diagnostics, field, value, _confi
21484
21531
  }
21485
21532
  return isValid;
21486
21533
  }, "validateConsumer");
21534
+ function validateConnectHandlers(envName) {
21535
+ return (diagnostics, field, value, config2) => {
21536
+ if (value === void 0) {
21537
+ return true;
21538
+ }
21539
+ const fieldPath = config2 === void 0 ? `${field}` : `env.${envName}.${field}`;
21540
+ if (!Array.isArray(value)) {
21541
+ diagnostics.errors.push(
21542
+ `The field "${fieldPath}" should be an array but got ${JSON.stringify(
21543
+ value
21544
+ )}.`
21545
+ );
21546
+ return false;
21547
+ }
21548
+ let isValid = true;
21549
+ for (let i = 0; i < value.length; i++) {
21550
+ if (!validateConnectHandler(
21551
+ diagnostics,
21552
+ `${fieldPath}[${i}]`,
21553
+ value[i],
21554
+ config2
21555
+ )) {
21556
+ isValid = false;
21557
+ }
21558
+ }
21559
+ const firstIndexByKey = /* @__PURE__ */ new Map();
21560
+ for (let i = 0; i < value.length; i++) {
21561
+ const handler = value[i];
21562
+ if (typeof handler !== "object" || handler === null || typeof handler.port !== "number" || typeof handler.protocol !== "string") {
21563
+ continue;
21564
+ }
21565
+ const { protocol, port } = handler;
21566
+ const key = `${protocol}:${port}`;
21567
+ const firstIndex = firstIndexByKey.get(key);
21568
+ if (firstIndex !== void 0) {
21569
+ diagnostics.errors.push(
21570
+ `"${fieldPath}[${i}]" has the same "protocol" (${protocol}) and "port" (${port}) as "${fieldPath}[${firstIndex}]". Each entry in "connect" must use a unique protocol/port combination.`
21571
+ );
21572
+ isValid = false;
21573
+ } else {
21574
+ firstIndexByKey.set(key, i);
21575
+ }
21576
+ }
21577
+ return isValid;
21578
+ };
21579
+ }
21580
+ __name(validateConnectHandlers, "validateConnectHandlers");
21581
+ var validateConnectHandler = /* @__PURE__ */ __name((diagnostics, field, value) => {
21582
+ if (typeof value !== "object" || value === null) {
21583
+ diagnostics.errors.push(
21584
+ `"${field}" should be an object, but got ${JSON.stringify(value)}`
21585
+ );
21586
+ return false;
21587
+ }
21588
+ let isValid = true;
21589
+ if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), [
21590
+ "protocol",
21591
+ "port",
21592
+ "address"
21593
+ ])) {
21594
+ isValid = false;
21595
+ }
21596
+ if ("protocol" in value && value.protocol !== "tcp") {
21597
+ diagnostics.errors.push(
21598
+ `"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(
21599
+ value.protocol
21600
+ )}.`
21601
+ );
21602
+ isValid = false;
21603
+ } else if (!("protocol" in value)) {
21604
+ diagnostics.errors.push(
21605
+ `"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(
21606
+ value
21607
+ )}.`
21608
+ );
21609
+ isValid = false;
21610
+ }
21611
+ if (!isRequiredProperty(value, "port", "number")) {
21612
+ diagnostics.errors.push(
21613
+ `"${field}" should have a number "port" field but got ${JSON.stringify(
21614
+ value
21615
+ )}.`
21616
+ );
21617
+ isValid = false;
21618
+ } else if (!Number.isInteger(value.port) || value.port < 1 || value.port > 65535) {
21619
+ diagnostics.errors.push(
21620
+ `"${field}" should have an integer "port" field between 1 and 65535 but got ${JSON.stringify(
21621
+ value
21622
+ )}.`
21623
+ );
21624
+ isValid = false;
21625
+ }
21626
+ if (!isOptionalProperty(value, "address", "string")) {
21627
+ diagnostics.errors.push(
21628
+ `"${field}" should, optionally, have a string "address" field but got ${JSON.stringify(
21629
+ value
21630
+ )}.`
21631
+ );
21632
+ isValid = false;
21633
+ }
21634
+ return isValid;
21635
+ }, "validateConnectHandler");
21487
21636
  var validateCompatibilityDate = /* @__PURE__ */ __name((diagnostics, field, value) => {
21488
21637
  if (value === void 0) {
21489
21638
  return true;
@@ -21792,7 +21941,7 @@ function normalizeAndValidateLimits(diagnostics, topLevelEnv, rawEnv) {
21792
21941
  );
21793
21942
  }
21794
21943
  __name(normalizeAndValidateLimits, "normalizeAndValidateLimits");
21795
- var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, field, value) => {
21944
+ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (diagnostics, field, value) => {
21796
21945
  if (value === void 0) {
21797
21946
  return true;
21798
21947
  }
@@ -21839,6 +21988,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
21839
21988
  "ratelimits",
21840
21989
  "vpc_services",
21841
21990
  "version_metadata",
21991
+ "containers",
21842
21992
  "logpush",
21843
21993
  "observability",
21844
21994
  "limits",
@@ -22048,6 +22198,14 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
22048
22198
  void 0
22049
22199
  ) && isValid;
22050
22200
  }
22201
+ if (previews.containers !== void 0) {
22202
+ isValid = validatePreviewsContainers(envName, configPath)(
22203
+ diagnostics,
22204
+ `${field}.containers`,
22205
+ previews.containers,
22206
+ void 0
22207
+ ) && isValid;
22208
+ }
22051
22209
  isValid = isBoolean(diagnostics, `${field}.logpush`, previews.logpush, void 0) && isValid;
22052
22210
  isValid = validateObservability(
22053
22211
  diagnostics,
@@ -22187,6 +22345,25 @@ function validateDurableObjectExportProperties(diagnostics, className, durableOb
22187
22345
  return valid;
22188
22346
  }
22189
22347
  __name(validateDurableObjectExportProperties, "validateDurableObjectExportProperties");
22348
+ function validateDurableObjectExportContainer(diagnostics, className, durableObjectExport) {
22349
+ if (durableObjectExport.container === void 0) {
22350
+ return true;
22351
+ }
22352
+ if (typeof durableObjectExport.container !== "string" || durableObjectExport.container === "") {
22353
+ diagnostics.errors.push(
22354
+ `"exports.${className}.container" must be a non-empty string naming a container in the "containers" array, but got ${JSON.stringify(durableObjectExport.container)}.`
22355
+ );
22356
+ return false;
22357
+ }
22358
+ if (durableObjectExport.storage === "legacy-kv") {
22359
+ diagnostics.errors.push(
22360
+ `"exports.${className}.container" requires "storage" to be "sqlite". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`
22361
+ );
22362
+ return false;
22363
+ }
22364
+ return true;
22365
+ }
22366
+ __name(validateDurableObjectExportContainer, "validateDurableObjectExportContainer");
22190
22367
  function validateDurableObjectExport(diagnostics, className, durableObjectExport) {
22191
22368
  let valid = true;
22192
22369
  if (className === "") {
@@ -22202,11 +22379,16 @@ function validateDurableObjectExport(diagnostics, className, durableObjectExport
22202
22379
  );
22203
22380
  valid = false;
22204
22381
  }
22382
+ valid = validateDurableObjectExportContainer(
22383
+ diagnostics,
22384
+ className,
22385
+ durableObjectExport
22386
+ ) && valid;
22205
22387
  valid = validateDurableObjectExportProperties(
22206
22388
  diagnostics,
22207
22389
  className,
22208
22390
  durableObjectExport,
22209
- ["type", "state", "storage"]
22391
+ ["type", "state", "storage", "container"]
22210
22392
  ) && valid;
22211
22393
  break;
22212
22394
  }
@@ -22275,11 +22457,16 @@ function validateDurableObjectExport(diagnostics, className, durableObjectExport
22275
22457
  );
22276
22458
  valid = false;
22277
22459
  }
22460
+ valid = validateDurableObjectExportContainer(
22461
+ diagnostics,
22462
+ className,
22463
+ durableObjectExport
22464
+ ) && valid;
22278
22465
  valid = validateDurableObjectExportProperties(
22279
22466
  diagnostics,
22280
22467
  className,
22281
22468
  durableObjectExport,
22282
- ["type", "state", "storage", "transfer_from"]
22469
+ ["type", "state", "storage", "transfer_from", "container"]
22283
22470
  ) && valid;
22284
22471
  break;
22285
22472
  }
@@ -22527,6 +22714,46 @@ function validateHeadSamplingRate(diagnostics, container, key, samplingRate) {
22527
22714
  }
22528
22715
  }
22529
22716
  __name(validateHeadSamplingRate, "validateHeadSamplingRate");
22717
+ var validateAccess = /* @__PURE__ */ __name((diagnostics, field, value) => {
22718
+ if (value === void 0) {
22719
+ return true;
22720
+ }
22721
+ if (typeof value !== "object" || value === null) {
22722
+ diagnostics.errors.push(
22723
+ `"${field}" should be an object but got ${JSON.stringify(value)}.`
22724
+ );
22725
+ return false;
22726
+ }
22727
+ const val = value;
22728
+ let isValid = true;
22729
+ isValid = validateOptionalProperty(diagnostics, field, "dev", val.dev, "object") && isValid;
22730
+ isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
22731
+ "dev"
22732
+ ]) && isValid;
22733
+ if (typeof val.dev === "object" && val.dev !== null) {
22734
+ isValid = validateRequiredProperty(
22735
+ diagnostics,
22736
+ `${field}.dev`,
22737
+ "aud",
22738
+ val.dev.aud,
22739
+ "string"
22740
+ ) && isValid;
22741
+ isValid = validateOptionalProperty(
22742
+ diagnostics,
22743
+ `${field}.dev`,
22744
+ "identity",
22745
+ val.dev.identity,
22746
+ "object"
22747
+ ) && isValid;
22748
+ isValid = validateAdditionalProperties(
22749
+ diagnostics,
22750
+ `${field}.dev`,
22751
+ Object.keys(val.dev),
22752
+ ["aud", "identity"]
22753
+ ) && isValid;
22754
+ }
22755
+ return isValid;
22756
+ }, "validateAccess");
22530
22757
  var validateCache = /* @__PURE__ */ __name((diagnostics, field, value) => {
22531
22758
  if (value === void 0) {
22532
22759
  return true;
@@ -22559,7 +22786,7 @@ var validateCache = /* @__PURE__ */ __name((diagnostics, field, value) => {
22559
22786
  ]) && isValid;
22560
22787
  return isValid;
22561
22788
  }, "validateCache");
22562
- function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports, configPath) {
22789
+ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1, configPath) {
22563
22790
  if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) {
22564
22791
  return;
22565
22792
  }
@@ -22567,7 +22794,7 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
22567
22794
  (binding) => !binding.script_name
22568
22795
  );
22569
22796
  const exportsCovers = /* @__PURE__ */ __name((className) => {
22570
- const entry = exports?.[className];
22797
+ const entry = exports$1?.[className];
22571
22798
  if (entry === void 0 || entry.type !== "durable-object") {
22572
22799
  return false;
22573
22800
  }
@@ -22603,14 +22830,132 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
22603
22830
  \`\`\``);
22604
22831
  }
22605
22832
  __name(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
22606
- function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports) {
22607
- if (migrations.length > 0 && exports !== void 0 && Object.values(exports).some((entry) => entry.type === "durable-object")) {
22833
+ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1) {
22834
+ if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) {
22608
22835
  diagnostics.errors.push(
22609
22836
  `\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`
22610
22837
  );
22611
22838
  }
22612
22839
  }
22613
22840
  __name(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
22841
+ function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
22842
+ if (containers !== void 0 && !Array.isArray(containers)) {
22843
+ return;
22844
+ }
22845
+ if (containers === void 0 && containersDeclaredElsewhere) {
22846
+ return;
22847
+ }
22848
+ const containersByName = /* @__PURE__ */ new Map();
22849
+ const duplicateNames = /* @__PURE__ */ new Set();
22850
+ for (const container of containers ?? []) {
22851
+ if (typeof container.name !== "string") {
22852
+ continue;
22853
+ }
22854
+ if (containersByName.has(container.name)) {
22855
+ duplicateNames.add(container.name);
22856
+ } else {
22857
+ containersByName.set(container.name, container);
22858
+ }
22859
+ }
22860
+ for (const name of [...duplicateNames].sort()) {
22861
+ diagnostics.errors.push(
22862
+ `"containers" contains more than one container named "${name}". Container names must be unique.`
22863
+ );
22864
+ }
22865
+ const containerCountByClassName = /* @__PURE__ */ new Map();
22866
+ for (const container of containers ?? []) {
22867
+ if (typeof container.class_name !== "string") {
22868
+ continue;
22869
+ }
22870
+ containerCountByClassName.set(
22871
+ container.class_name,
22872
+ (containerCountByClassName.get(container.class_name) ?? 0) + 1
22873
+ );
22874
+ }
22875
+ const overSubscribedClassNames = new Set(
22876
+ [...containerCountByClassName].filter(([, count]) => count > 1).map(([className]) => className)
22877
+ );
22878
+ for (const className of [...overSubscribedClassNames].sort()) {
22879
+ diagnostics.errors.push(
22880
+ `More than one container is attached to the Durable Object "${className}". A Durable Object can only have one container attached to it.`
22881
+ );
22882
+ }
22883
+ const durableObjectExports = getDurableObjectExports(exports$1);
22884
+ const liveExportClassNames = /* @__PURE__ */ new Set();
22885
+ const classNamesByContainerName = /* @__PURE__ */ new Map();
22886
+ for (const [className, entry] of Object.entries(durableObjectExports)) {
22887
+ if (entry.state !== void 0 && entry.state !== "created" && entry.state !== "expecting-transfer") {
22888
+ continue;
22889
+ }
22890
+ liveExportClassNames.add(className);
22891
+ if (typeof entry.container !== "string" || entry.container === "") {
22892
+ continue;
22893
+ }
22894
+ if (!containersByName.has(entry.container)) {
22895
+ diagnostics.errors.push(
22896
+ `"exports.${className}.container" references a container named "${entry.container}", but no container with that name is defined in "containers".`
22897
+ );
22898
+ continue;
22899
+ }
22900
+ classNamesByContainerName.set(entry.container, [
22901
+ ...classNamesByContainerName.get(entry.container) ?? [],
22902
+ className
22903
+ ]);
22904
+ }
22905
+ for (const [containerName, classNames] of classNamesByContainerName) {
22906
+ if (classNames.length > 1) {
22907
+ diagnostics.errors.push(
22908
+ `The container "${containerName}" is referenced by more than one Durable Object export (${classNames.join(", ")}). A container can only back a single Durable Object.`
22909
+ );
22910
+ }
22911
+ }
22912
+ const containerNameToClassName = getContainerNameToClassNameMap(exports$1);
22913
+ const usesDurableObjectExports = Object.keys(durableObjectExports).length > 0;
22914
+ for (const container of containers ?? []) {
22915
+ if (typeof container.name !== "string") {
22916
+ continue;
22917
+ }
22918
+ if (container.class_name === void 0) {
22919
+ if (!containerNameToClassName.has(container.name)) {
22920
+ diagnostics.errors.push(
22921
+ `The container "${container.name}" is not linked to a Durable Object. Either set "containers.class_name", or reference this container from a Durable Object's \`exports\` entry via its "container" field.`
22922
+ );
22923
+ }
22924
+ continue;
22925
+ }
22926
+ if (overSubscribedClassNames.has(container.class_name)) {
22927
+ continue;
22928
+ }
22929
+ const exportEntry = durableObjectExports[container.class_name];
22930
+ const referencedContainerName = exportEntry !== void 0 && "container" in exportEntry ? exportEntry.container : void 0;
22931
+ if (typeof referencedContainerName === "string" && referencedContainerName !== container.name) {
22932
+ diagnostics.errors.push(
22933
+ `The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.container" is "${referencedContainerName}". A Durable Object and its container must reference each other consistently.`
22934
+ );
22935
+ continue;
22936
+ }
22937
+ const claimingClassNames = classNamesByContainerName.get(container.name);
22938
+ const claimingClassName = claimingClassNames?.length === 1 ? claimingClassNames[0] : void 0;
22939
+ if (claimingClassName !== void 0 && claimingClassName !== container.class_name) {
22940
+ diagnostics.errors.push(
22941
+ `The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${claimingClassName}.container" references it. A Durable Object and its container must reference each other consistently.`
22942
+ );
22943
+ continue;
22944
+ }
22945
+ if (usesDurableObjectExports && !liveExportClassNames.has(container.class_name)) {
22946
+ diagnostics.errors.push(
22947
+ `The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports" has no live "durable-object" entry for "${container.class_name}".`
22948
+ );
22949
+ continue;
22950
+ }
22951
+ if (referencedContainerName === void 0 && exportEntry !== void 0 && "storage" in exportEntry && exportEntry.storage === "legacy-kv") {
22952
+ diagnostics.errors.push(
22953
+ `The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.storage" is "legacy-kv". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`
22954
+ );
22955
+ }
22956
+ }
22957
+ }
22958
+ __name(validateContainerExportLinks, "validateContainerExportLinks");
22614
22959
  var validatePythonModules = /* @__PURE__ */ __name((diagnostics, field, value, topLevelEnv) => {
22615
22960
  if (value === void 0) {
22616
22961
  return true;
@@ -22706,7 +23051,7 @@ var BINDING_LOCAL_SUPPORT = {
22706
23051
  kv_namespace: "local-and-remote",
22707
23052
  r2_bucket: "local-and-remote",
22708
23053
  d1: "local-and-remote",
22709
- workflow: "local-and-remote",
23054
+ workflow: "local-only",
22710
23055
  browser: "local-and-remote",
22711
23056
  images: "local-and-remote",
22712
23057
  stream: "local-and-remote",
@@ -22885,6 +23230,18 @@ function getPackagePath(packageName, projectPath) {
22885
23230
  );
22886
23231
  } catch {
22887
23232
  }
23233
+ try {
23234
+ const candidate = path2__default.join(
23235
+ projectPath,
23236
+ "node_modules",
23237
+ packageName,
23238
+ "package.json"
23239
+ );
23240
+ if (statSync(candidate).isFile()) {
23241
+ return path2__default.dirname(candidate);
23242
+ }
23243
+ } catch {
23244
+ }
22888
23245
  return void 0;
22889
23246
  }
22890
23247
  __name(getPackagePath, "getPackagePath");
@@ -22941,6 +23298,43 @@ function findFileUp(name, startDir, lastDir) {
22941
23298
  return void 0;
22942
23299
  }
22943
23300
  __name(findFileUp, "findFileUp");
23301
+ function isCompatDate(str) {
23302
+ return /^\d{4}-\d{2}-\d{2}$/.test(str);
23303
+ }
23304
+ __name(isCompatDate, "isCompatDate");
23305
+ function formatCompatibilityDate(date5) {
23306
+ const compatDate = date5.toISOString().slice(0, 10);
23307
+ assert2(isCompatDate(compatDate));
23308
+ return compatDate;
23309
+ }
23310
+ __name(formatCompatibilityDate, "formatCompatibilityDate");
23311
+ function getTodaysCompatDate() {
23312
+ return formatCompatibilityDate(/* @__PURE__ */ new Date());
23313
+ }
23314
+ __name(getTodaysCompatDate, "getTodaysCompatDate");
23315
+ var NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
23316
+ function isNodejsCompatDefaultOn(compatibilityDate) {
23317
+ return compatibilityDate !== void 0 && compatibilityDate >= NODEJS_COMPAT_DEFAULT_ON_DATE;
23318
+ }
23319
+ __name(isNodejsCompatDefaultOn, "isNodejsCompatDefaultOn");
23320
+ var NODEJS_COMPAT_V2_SWITCH_OVER_DATE = "2024-09-23";
23321
+ function resolveNodejsCompat(compatibilityDate, compatibilityFlags) {
23322
+ const isDefaultOn = isNodejsCompatDefaultOn(compatibilityDate);
23323
+ const isNodejsCompatEnabled = compatibilityFlags.includes("nodejs_compat") || isDefaultOn && !compatibilityFlags.includes("no_nodejs_compat");
23324
+ const isNodejsCompatV2Enabled = compatibilityFlags.includes("nodejs_compat_v2") || !compatibilityFlags.includes("no_nodejs_compat_v2") && (isDefaultOn || isNodejsCompatEnabled && compatibilityDate >= NODEJS_COMPAT_V2_SWITCH_OVER_DATE);
23325
+ return { isNodejsCompatEnabled, isNodejsCompatV2Enabled };
23326
+ }
23327
+ __name(resolveNodejsCompat, "resolveNodejsCompat");
23328
+ function stripRedundantNodejsCompatFlags(compatibilityDate, compatibilityFlags) {
23329
+ if (!isNodejsCompatDefaultOn(compatibilityDate)) {
23330
+ return compatibilityFlags;
23331
+ }
23332
+ const redundantFlags = ["nodejs_compat", "nodejs_compat_v2"].filter(
23333
+ (flag) => !compatibilityFlags.includes(`no_${flag}`)
23334
+ );
23335
+ return compatibilityFlags.filter((flag) => !redundantFlags.includes(flag));
23336
+ }
23337
+ __name(stripRedundantNodejsCompatFlags, "stripRedundantNodejsCompatFlags");
22944
23338
 
22945
23339
  // src/is-interactive.ts
22946
23340
  var import_ci_info = __toESM(require_ci_info());
@@ -24060,7 +24454,7 @@ function terminateCloudflared(cloudflared) {
24060
24454
  }
24061
24455
  __name(terminateCloudflared, "terminateCloudflared");
24062
24456
  function waitForQuickTunnelReady(cloudflared, timeoutMs, options) {
24063
- return new Promise((resolve2, reject) => {
24457
+ return new Promise((resolve3, reject) => {
24064
24458
  let resolved = false;
24065
24459
  let stderrOutput = "";
24066
24460
  const logger = options?.logger;
@@ -24088,7 +24482,7 @@ function waitForQuickTunnelReady(cloudflared, timeoutMs, options) {
24088
24482
  if (match && !resolved) {
24089
24483
  resolved = true;
24090
24484
  clearTimeout(timeoutId);
24091
- resolve2({ mode: "quick", publicUrl: new URL(match[0]) });
24485
+ resolve3({ mode: "quick", publicUrl: new URL(match[0]) });
24092
24486
  }
24093
24487
  });
24094
24488
  }
@@ -24609,6 +25003,41 @@ ${url2}`
24609
25003
  logger.debug(err instanceof Error ? err.stack ?? String(err) : String(err));
24610
25004
  }
24611
25005
  __name(handleBrowserOpenError, "handleBrowserOpenError");
25006
+ function writeOutput(entry) {
25007
+ if (outputFilePath === void 0) {
25008
+ outputFilePath = getOutputFilePath();
25009
+ }
25010
+ if (outputFilePath !== null) {
25011
+ mkdirSync(dirname(outputFilePath), { recursive: true });
25012
+ const entryJSON = JSON.stringify({
25013
+ ...entry,
25014
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
25015
+ });
25016
+ appendFileSync(outputFilePath, entryJSON + "\n");
25017
+ }
25018
+ }
25019
+ __name(writeOutput, "writeOutput");
25020
+ function clearOutputFilePath() {
25021
+ outputFilePath = void 0;
25022
+ }
25023
+ __name(clearOutputFilePath, "clearOutputFilePath");
25024
+ var outputFilePath = void 0;
25025
+ function getOutputFilePath() {
25026
+ const outputFilePathFromEnv = getOutputFilePathFromEnv();
25027
+ if (outputFilePathFromEnv) {
25028
+ return outputFilePathFromEnv;
25029
+ }
25030
+ const outputFileDirectoryFromEnv = getOutputFileDirectoryFromEnv();
25031
+ if (outputFileDirectoryFromEnv) {
25032
+ const date5 = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").replace(".", "_").replace("T", "_").replace("Z", "");
25033
+ return resolve(
25034
+ outputFileDirectoryFromEnv,
25035
+ `wrangler-output-${date5}-${randomBytes(3).toString("hex")}.json`
25036
+ );
25037
+ }
25038
+ return null;
25039
+ }
25040
+ __name(getOutputFilePath, "getOutputFilePath");
24612
25041
  var MAX_ATTEMPTS = 3;
24613
25042
  var MAX_RETRY_AFTER_MS = 6e4;
24614
25043
  async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
@@ -25096,4 +25525,4 @@ safe-buffer/index.js:
25096
25525
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
25097
25526
  */
25098
25527
 
25099
- export { ARTIFACTS_EVENT_TYPES, BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, NubPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, _forceColour, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, createConfigCache, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, formatZodError, 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, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getPackagePath, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isCI, isDoNotTrackEnabled, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, openInBrowser, parseRetryAfterMs, parseRetryAfterValue, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toUrlPath, toValidWorkerName, truncate, validatePagesConfig };
25528
+ export { ARTIFACTS_EVENT_TYPES, BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, NpmPackageManager, NubPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, _forceColour, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, clearOutputFilePath, createConfigCache, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, formatZodError, 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, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getNoSkillsUpdatePromptsFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getPackagePath, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTodaysCompatDate, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasMorePages, hasProperty, isCI, isCompatDate, isDoNotTrackEnabled, isDockerfile, isInteractive, isNodejsCompatDefaultOn, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, openInBrowser, parseRetryAfterMs, parseRetryAfterValue, performApiFetchBase, renderError, resolveNodejsCompat, retryOnAPIFailure, spawnCloudflared, startTunnel, stripRedundantNodejsCompatFlags, sweepStaleWranglerTmpDirs, throwFetchError, toUrlPath, toValidWorkerName, truncate, validatePagesConfig, writeOutput };