@cloudflare/vite-plugin 1.42.4 → 1.43.1

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
@@ -3,7 +3,7 @@ import assert from "node:assert";
3
3
  import { CoreHeaders, CorePaths, Log, LogLevel, Miniflare, Request as Request$1, Response as Response$1, buildPublicUrl, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
4
4
  import * as wrangler from "wrangler";
5
5
  import * as nodePath from "node:path";
6
- import path3, { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
6
+ import path2, { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
7
7
  import * as util$1 from "node:util";
8
8
  import { format, inspect, promisify } from "node:util";
9
9
  import * as vite from "vite";
@@ -1506,7 +1506,7 @@ async function assertWranglerVersion() {
1506
1506
  * The default compatibility date to use when the user omits one.
1507
1507
  * This value is injected at build time and remains fixed for each release.
1508
1508
  */
1509
- const DEFAULT_COMPAT_DATE = "2026-06-30";
1509
+ const DEFAULT_COMPAT_DATE = "2026-07-07";
1510
1510
 
1511
1511
  //#endregion
1512
1512
  //#region src/build-output-env.ts
@@ -1595,7 +1595,7 @@ const PROXY_SHARED_SECRET = randomUUID();
1595
1595
  const kRequestType = Symbol("kRequestType");
1596
1596
 
1597
1597
  //#endregion
1598
- //#region ../workers-utils/dist/chunk-DCOBXSFB.mjs
1598
+ //#region ../workers-utils/dist/chunk-DDRU76YD.mjs
1599
1599
  var __create = Object.create;
1600
1600
  var __defProp$1 = Object.defineProperty;
1601
1601
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1613,12 +1613,6 @@ var __require$1 = /* @__PURE__ */ ((x) => typeof __require$2 !== "undefined" ? _
1613
1613
  var __commonJS$1 = (cb, mod$1) => function __require2() {
1614
1614
  return mod$1 || (0, cb[__getOwnPropNames$1(cb)[0]])((mod$1 = { exports: {} }).exports, mod$1), mod$1.exports;
1615
1615
  };
1616
- var __export = (target$1, all$1) => {
1617
- for (var name in all$1) __defProp$1(target$1, name, {
1618
- get: all$1[name],
1619
- enumerable: true
1620
- });
1621
- };
1622
1616
  var __copyProps = (to, from, except, desc) => {
1623
1617
  if (from && typeof from === "object" || typeof from === "function") {
1624
1618
  for (let key of __getOwnPropNames$1(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp$1(to, key, {
@@ -1628,14 +1622,181 @@ var __copyProps = (to, from, except, desc) => {
1628
1622
  }
1629
1623
  return to;
1630
1624
  };
1631
- var __reExport = (target$1, mod$1, secondTarget) => (__copyProps(target$1, mod$1, "default"), secondTarget && __copyProps(secondTarget, mod$1, "default"));
1632
1625
  var __toESM = (mod$1, isNodeMode, target$1) => (target$1 = mod$1 != null ? __create(__getProtoOf(mod$1)) : {}, __copyProps(isNodeMode || !mod$1 || !mod$1.__esModule ? __defProp$1(target$1, "default", {
1633
1626
  value: mod$1,
1634
1627
  enumerable: true
1635
1628
  }) : target$1, mod$1));
1636
1629
 
1637
1630
  //#endregion
1638
- //#region ../workers-utils/dist/chunk-ULVYGN52.mjs
1631
+ //#region ../workers-utils/dist/chunk-OC543JY3.mjs
1632
+ function isDirectory$1(path) {
1633
+ return fs2.statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
1634
+ }
1635
+ __name$1(isDirectory$1, "isDirectory");
1636
+ function removeDir$1(dirPath, { fireAndForget = false } = {}) {
1637
+ const result = fs2.promises.rm(dirPath, {
1638
+ recursive: true,
1639
+ force: true,
1640
+ maxRetries: 5,
1641
+ retryDelay: 100
1642
+ });
1643
+ if (fireAndForget) result.catch(() => {});
1644
+ else return result;
1645
+ }
1646
+ __name$1(removeDir$1, "removeDir");
1647
+ function removeDirSync$1(dirPath) {
1648
+ fs2.rmSync(dirPath, {
1649
+ recursive: true,
1650
+ force: true,
1651
+ maxRetries: 5,
1652
+ retryDelay: 100
1653
+ });
1654
+ }
1655
+ __name$1(removeDirSync$1, "removeDirSync");
1656
+
1657
+ //#endregion
1658
+ //#region ../workers-utils/dist/chunk-OTBYAUQ6.mjs
1659
+ function isWindows() {
1660
+ return /^win/i.test(process.platform);
1661
+ }
1662
+ __name$1(isWindows, "isWindows");
1663
+ function isMacOS() {
1664
+ return /^darwin$/i.test(process.platform);
1665
+ }
1666
+ __name$1(isMacOS, "isMacOS");
1667
+ function isNonEmpty(value) {
1668
+ return !!value;
1669
+ }
1670
+ __name$1(isNonEmpty, "isNonEmpty");
1671
+ function getEnv(name) {
1672
+ return process.env[name];
1673
+ }
1674
+ __name$1(getEnv, "getEnv");
1675
+ function normalizePath$2(p$1) {
1676
+ return p$1 ? path2.normalize(path2.join(p$1, ".")) : void 0;
1677
+ }
1678
+ __name$1(normalizePath$2, "normalizePath");
1679
+ function homeDir() {
1680
+ if (isWindows()) return normalizePath$2([
1681
+ os.homedir(),
1682
+ getEnv("USERPROFILE"),
1683
+ getEnv("HOME"),
1684
+ getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ? path2.join(getEnv("HOMEDRIVE") ?? "", getEnv("HOMEPATH") ?? "") : void 0
1685
+ ].find(isNonEmpty));
1686
+ return normalizePath$2(os.homedir() || getEnv("HOME"));
1687
+ }
1688
+ __name$1(homeDir, "homeDir");
1689
+ function joinToBase(base, segments) {
1690
+ return base ? path2.join(base, ...segments) : void 0;
1691
+ }
1692
+ __name$1(joinToBase, "joinToBase");
1693
+ function tempDir() {
1694
+ if (isWindows()) {
1695
+ const fallback2 = "C:\\Temp";
1696
+ const found = [
1697
+ () => os.tmpdir(),
1698
+ () => getEnv("TEMP"),
1699
+ () => getEnv("TMP"),
1700
+ () => joinToBase(getEnv("LOCALAPPDATA"), ["Temp"]),
1701
+ () => joinToBase(homeDir(), [
1702
+ "AppData",
1703
+ "Local",
1704
+ "Temp"
1705
+ ]),
1706
+ () => joinToBase(getEnv("ALLUSERSPROFILE"), ["Temp"]),
1707
+ () => joinToBase(getEnv("SystemRoot"), ["Temp"]),
1708
+ () => joinToBase(getEnv("windir"), ["Temp"]),
1709
+ () => joinToBase(getEnv("SystemDrive"), ["\\", "Temp"])
1710
+ ].find((fn) => isNonEmpty(fn()));
1711
+ return found && normalizePath$2(found()) || fallback2;
1712
+ }
1713
+ return normalizePath$2([
1714
+ os.tmpdir(),
1715
+ getEnv("TMPDIR"),
1716
+ getEnv("TEMP"),
1717
+ getEnv("TMP")
1718
+ ].find(isNonEmpty)) || "/tmp";
1719
+ }
1720
+ __name$1(tempDir, "tempDir");
1721
+ function baseDir() {
1722
+ return homeDir() || tempDir();
1723
+ }
1724
+ __name$1(baseDir, "baseDir");
1725
+ function valOrPath(value, segments) {
1726
+ return value || path2.join(...segments);
1727
+ }
1728
+ __name$1(valOrPath, "valOrPath");
1729
+ function windowsAppData() {
1730
+ return valOrPath(getEnv("APPDATA"), [
1731
+ baseDir(),
1732
+ "AppData",
1733
+ "Roaming"
1734
+ ]);
1735
+ }
1736
+ __name$1(windowsAppData, "windowsAppData");
1737
+ function windowsLocalAppData() {
1738
+ return valOrPath(getEnv("LOCALAPPDATA"), [
1739
+ baseDir(),
1740
+ "AppData",
1741
+ "Local"
1742
+ ]);
1743
+ }
1744
+ __name$1(windowsLocalAppData, "windowsLocalAppData");
1745
+ function xdgConfig() {
1746
+ if (isMacOS()) return valOrPath(getEnv("XDG_CONFIG_HOME"), [
1747
+ baseDir(),
1748
+ "Library",
1749
+ "Preferences"
1750
+ ]);
1751
+ if (isWindows()) return valOrPath(getEnv("XDG_CONFIG_HOME"), [windowsAppData(), "xdg.config"]);
1752
+ return valOrPath(getEnv("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
1753
+ }
1754
+ __name$1(xdgConfig, "xdgConfig");
1755
+ function xdgCache() {
1756
+ if (isMacOS()) return valOrPath(getEnv("XDG_CACHE_HOME"), [
1757
+ baseDir(),
1758
+ "Library",
1759
+ "Caches"
1760
+ ]);
1761
+ if (isWindows()) return valOrPath(getEnv("XDG_CACHE_HOME"), [windowsLocalAppData(), "xdg.cache"]);
1762
+ return valOrPath(getEnv("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
1763
+ }
1764
+ __name$1(xdgCache, "xdgCache");
1765
+ function xdgAppPaths(name) {
1766
+ const segment = path2.parse(name).name;
1767
+ return {
1768
+ config: /* @__PURE__ */ __name$1(() => path2.join(xdgConfig(), segment), "config"),
1769
+ cache: /* @__PURE__ */ __name$1(() => path2.join(xdgCache(), segment), "cache")
1770
+ };
1771
+ }
1772
+ __name$1(xdgAppPaths, "xdgAppPaths");
1773
+ function getGlobalConfigPath({ appName = "wrangler", leadingDot = true, useLegacyHomeDir = true } = {}) {
1774
+ const dirName = `${leadingDot ? "." : ""}${appName}`;
1775
+ const configDir = xdgAppPaths(dirName).config();
1776
+ if (useLegacyHomeDir) {
1777
+ const legacyConfigDir = path2.join(os.homedir(), dirName);
1778
+ if (isDirectory$1(legacyConfigDir)) return legacyConfigDir;
1779
+ }
1780
+ return configDir;
1781
+ }
1782
+ __name$1(getGlobalConfigPath, "getGlobalConfigPath");
1783
+ function getGlobalWranglerCachePath() {
1784
+ return xdgAppPaths(".wrangler").cache();
1785
+ }
1786
+ __name$1(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
1787
+
1788
+ //#endregion
1789
+ //#region ../workers-utils/dist/chunk-27EBTAT2.mjs
1790
+ function partitionExports$1(exports$2) {
1791
+ const partitioned = {
1792
+ "durable-object": {},
1793
+ worker: {}
1794
+ };
1795
+ if (exports$2 === void 0) return partitioned;
1796
+ for (const [name, entry] of Object.entries(exports$2)) partitioned[entry.type][name] = entry;
1797
+ return partitioned;
1798
+ }
1799
+ __name$1(partitionExports$1, "partitionExports");
1639
1800
  var UserError = class extends Error {
1640
1801
  static {
1641
1802
  __name$1(this, "UserError");
@@ -2388,10 +2549,10 @@ function parseTree$1(text, errors$1 = [], options = ParseOptions$1.DEFAULT) {
2388
2549
  return result;
2389
2550
  }
2390
2551
  __name$1(parseTree$1, "parseTree");
2391
- function findNodeAtLocation$1(root, path2) {
2552
+ function findNodeAtLocation$1(root, path2$1) {
2392
2553
  if (!root) return;
2393
2554
  let node = root;
2394
- for (let segment of path2) if (typeof segment === "string") {
2555
+ for (let segment of path2$1) if (typeof segment === "string") {
2395
2556
  if (node.type !== "object" || !Array.isArray(node.children)) return;
2396
2557
  let found = false;
2397
2558
  for (const propertyNode of node.children) if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
@@ -2618,13 +2779,13 @@ function getNodeType$1(value) {
2618
2779
  }
2619
2780
  __name$1(getNodeType$1, "getNodeType");
2620
2781
  function setProperty$1(text, originalPath, value, options) {
2621
- const path2 = originalPath.slice();
2782
+ const path2$1 = originalPath.slice();
2622
2783
  const root = parseTree$1(text, []);
2623
2784
  let parent = void 0;
2624
2785
  let lastSegment = void 0;
2625
- while (path2.length > 0) {
2626
- lastSegment = path2.pop();
2627
- parent = findNodeAtLocation$1(root, path2);
2786
+ while (path2$1.length > 0) {
2787
+ lastSegment = path2$1.pop();
2788
+ parent = findNodeAtLocation$1(root, path2$1);
2628
2789
  if (parent === void 0 && value !== void 0) if (typeof lastSegment === "string") value = { [lastSegment]: value };
2629
2790
  else value = [value];
2630
2791
  else break;
@@ -2866,8 +3027,8 @@ function format2$1(documentText, range, options) {
2866
3027
  return format$2(documentText, range, options);
2867
3028
  }
2868
3029
  __name$1(format2$1, "format");
2869
- function modify$1(text, path2, value, options) {
2870
- return setProperty$1(text, path2, value, options);
3030
+ function modify$1(text, path2$1, value, options) {
3031
+ return setProperty$1(text, path2$1, value, options);
2871
3032
  }
2872
3033
  __name$1(modify$1, "modify");
2873
3034
  function applyEdits$1(text, edits) {
@@ -3629,6 +3790,12 @@ var APIError = class extends ParseError$1 {
3629
3790
  #status;
3630
3791
  code;
3631
3792
  accountTag;
3793
+ /**
3794
+ * Optional structured metadata hoisted from the first `FetchError.meta`
3795
+ * on the v4 response envelope. Consumers can inspect this to render
3796
+ * endpoint-specific structured error payloads.
3797
+ */
3798
+ meta;
3632
3799
  constructor({ status,...rest }) {
3633
3800
  super(rest);
3634
3801
  this.name = this.constructor.name;
@@ -3970,7 +4137,7 @@ function resolveWranglerConfigPath$1({ config: config$1, script }, options) {
3970
4137
  deployConfigPath: void 0,
3971
4138
  redirected: false
3972
4139
  };
3973
- return findWranglerConfig$2(script !== void 0 ? path3.dirname(script) : process.cwd(), options);
4140
+ return findWranglerConfig$2(script !== void 0 ? path2.dirname(script) : process.cwd(), options);
3974
4141
  }
3975
4142
  __name$1(resolveWranglerConfigPath$1, "resolveWranglerConfigPath");
3976
4143
  function findWranglerConfig$2(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -4001,15 +4168,15 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
4001
4168
  const deployConfigFile = readFileSync$2(deployConfigPath);
4002
4169
  try {
4003
4170
  const deployConfig = parseJSONC$1(deployConfigFile, deployConfigPath);
4004
- redirectedConfigPath = deployConfig.configPath && path3.resolve(path3.dirname(deployConfigPath), deployConfig.configPath);
4171
+ redirectedConfigPath = deployConfig.configPath && path2.resolve(path2.dirname(deployConfigPath), deployConfig.configPath);
4005
4172
  } catch (e) {
4006
- throw new UserError(`Failed to parse the deploy configuration file at ${path3.relative(".", deployConfigPath)}`, {
4173
+ throw new UserError(`Failed to parse the deploy configuration file at ${path2.relative(".", deployConfigPath)}`, {
4007
4174
  cause: e,
4008
4175
  telemetryMessage: false
4009
4176
  });
4010
4177
  }
4011
4178
  if (!redirectedConfigPath) throw new UserError(esm_default$1`
4012
- A deploy configuration file was found at "${path3.relative(".", deployConfigPath)}".
4179
+ A deploy configuration file was found at "${path2.relative(".", deployConfigPath)}".
4013
4180
  But this is not valid - the required "configPath" property was not found.
4014
4181
  Instead this file contains:
4015
4182
  \`\`\`
@@ -4017,13 +4184,13 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
4017
4184
  \`\`\`
4018
4185
  `, { telemetryMessage: false });
4019
4186
  if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default$1`
4020
- There is a deploy configuration at "${path3.relative(".", deployConfigPath)}".
4021
- But the redirected configuration path it points to, "${path3.relative(".", redirectedConfigPath)}", does not exist.
4187
+ There is a deploy configuration at "${path2.relative(".", deployConfigPath)}".
4188
+ But the redirected configuration path it points to, "${path2.relative(".", redirectedConfigPath)}", does not exist.
4022
4189
  `, { telemetryMessage: false });
4023
4190
  if (userConfigPath) {
4024
- if (path3.join(path3.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG$1) !== deployConfigPath) throw new UserError(esm_default$1`
4025
- Found both a user configuration file at "${path3.relative(".", userConfigPath)}"
4026
- and a deploy configuration file at "${path3.relative(".", deployConfigPath)}".
4191
+ if (path2.join(path2.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG$1) !== deployConfigPath) throw new UserError(esm_default$1`
4192
+ Found both a user configuration file at "${path2.relative(".", userConfigPath)}"
4193
+ and a deploy configuration file at "${path2.relative(".", deployConfigPath)}".
4027
4194
  But these do not share the same base path so it is not clear which should be used.
4028
4195
  `, { telemetryMessage: false });
4029
4196
  }
@@ -4066,30 +4233,6 @@ function formatConfigSnippet$1(snippet, configPath, formatted = true) {
4066
4233
  else return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
4067
4234
  }
4068
4235
  __name$1(formatConfigSnippet$1, "formatConfigSnippet");
4069
- function isDirectory$1(path2) {
4070
- return fs2.statSync(path2, { throwIfNoEntry: false })?.isDirectory() ?? false;
4071
- }
4072
- __name$1(isDirectory$1, "isDirectory");
4073
- function removeDir$1(dirPath, { fireAndForget = false } = {}) {
4074
- const result = fs2.promises.rm(dirPath, {
4075
- recursive: true,
4076
- force: true,
4077
- maxRetries: 5,
4078
- retryDelay: 100
4079
- });
4080
- if (fireAndForget) result.catch(() => {});
4081
- else return result;
4082
- }
4083
- __name$1(removeDir$1, "removeDir");
4084
- function removeDirSync$1(dirPath) {
4085
- fs2.rmSync(dirPath, {
4086
- recursive: true,
4087
- force: true,
4088
- maxRetries: 5,
4089
- retryDelay: 100
4090
- });
4091
- }
4092
- __name$1(removeDirSync$1, "removeDirSync");
4093
4236
 
4094
4237
  //#endregion
4095
4238
  //#region ../../node_modules/.pnpm/undici@7.28.0/node_modules/undici/lib/core/symbols.js
@@ -25937,649 +26080,11 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
25937
26080
  //#endregion
25938
26081
  //#region ../workers-utils/dist/index.mjs
25939
26082
  var import_undici = require_undici();
25940
- var require_XDGAppPaths = __commonJS$1({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js"(exports$2) {
25941
- exports$2.__esModule = true;
25942
- exports$2.Adapt = void 0;
25943
- function isBoolean2(t2) {
25944
- return typeOf(t2) === "boolean";
25945
- }
25946
- __name$1(isBoolean2, "isBoolean");
25947
- function isObject$3(t2) {
25948
- return typeOf(t2) === "object";
25949
- }
25950
- __name$1(isObject$3, "isObject");
25951
- function isString2(t2) {
25952
- return typeOf(t2) === "string";
25953
- }
25954
- __name$1(isString2, "isString");
25955
- function typeOf(t2) {
25956
- return typeof t2;
25957
- }
25958
- __name$1(typeOf, "typeOf");
25959
- function Adapt(adapter_) {
25960
- var meta$2 = adapter_.meta, path5 = adapter_.path, xdg = adapter_.xdg;
25961
- return { XDGAppPaths: new (/* @__PURE__ */ function() {
25962
- function XDGAppPaths_2(options_) {
25963
- if (options_ === void 0) options_ = {};
25964
- var _a$2, _b, _c;
25965
- function XDGAppPaths(options2) {
25966
- if (options2 === void 0) options2 = {};
25967
- return new XDGAppPaths_2(options2);
25968
- }
25969
- __name$1(XDGAppPaths, "XDGAppPaths");
25970
- var options = isObject$3(options_) ? options_ : { name: options_ };
25971
- var suffix = (_a$2 = options.suffix) !== null && _a$2 !== void 0 ? _a$2 : "";
25972
- var isolated_ = (_b = options.isolated) !== null && _b !== void 0 ? _b : true;
25973
- var namePriorityList = [
25974
- options.name,
25975
- meta$2.pkgMainFilename(),
25976
- meta$2.mainFilename()
25977
- ];
25978
- var name = path5.parse(((_c = namePriorityList.find(function(e2) {
25979
- return isString2(e2);
25980
- })) !== null && _c !== void 0 ? _c : "$eval") + suffix).name;
25981
- XDGAppPaths.$name = /* @__PURE__ */ __name$1(function $name() {
25982
- return name;
25983
- }, "$name");
25984
- XDGAppPaths.$isolated = /* @__PURE__ */ __name$1(function $isolated() {
25985
- return isolated_;
25986
- }, "$isolated");
25987
- function isIsolated(dirOptions) {
25988
- var _a2;
25989
- dirOptions = dirOptions !== null && dirOptions !== void 0 ? dirOptions : { isolated: isolated_ };
25990
- return isBoolean2(dirOptions) ? dirOptions : (_a2 = dirOptions.isolated) !== null && _a2 !== void 0 ? _a2 : isolated_;
25991
- }
25992
- __name$1(isIsolated, "isIsolated");
25993
- function finalPathSegment(dirOptions) {
25994
- return isIsolated(dirOptions) ? name : "";
25995
- }
25996
- __name$1(finalPathSegment, "finalPathSegment");
25997
- XDGAppPaths.cache = /* @__PURE__ */ __name$1(function cache$2(dirOptions) {
25998
- return path5.join(xdg.cache(), finalPathSegment(dirOptions));
25999
- }, "cache");
26000
- XDGAppPaths.config = /* @__PURE__ */ __name$1(function config$1(dirOptions) {
26001
- return path5.join(xdg.config(), finalPathSegment(dirOptions));
26002
- }, "config");
26003
- XDGAppPaths.data = /* @__PURE__ */ __name$1(function data$1(dirOptions) {
26004
- return path5.join(xdg.data(), finalPathSegment(dirOptions));
26005
- }, "data");
26006
- XDGAppPaths.runtime = /* @__PURE__ */ __name$1(function runtime(dirOptions) {
26007
- return xdg.runtime() ? path5.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
26008
- }, "runtime");
26009
- XDGAppPaths.state = /* @__PURE__ */ __name$1(function state(dirOptions) {
26010
- return path5.join(xdg.state(), finalPathSegment(dirOptions));
26011
- }, "state");
26012
- XDGAppPaths.configDirs = /* @__PURE__ */ __name$1(function configDirs(dirOptions) {
26013
- return xdg.configDirs().map(function(s) {
26014
- return path5.join(s, finalPathSegment(dirOptions));
26015
- });
26016
- }, "configDirs");
26017
- XDGAppPaths.dataDirs = /* @__PURE__ */ __name$1(function dataDirs(dirOptions) {
26018
- return xdg.dataDirs().map(function(s) {
26019
- return path5.join(s, finalPathSegment(dirOptions));
26020
- });
26021
- }, "dataDirs");
26022
- return XDGAppPaths;
26023
- }
26024
- __name$1(XDGAppPaths_2, "XDGAppPaths_");
26025
- return XDGAppPaths_2;
26026
- }())() };
26027
- }
26028
- __name$1(Adapt, "Adapt");
26029
- exports$2.Adapt = Adapt;
26030
- } });
26031
- var require_XDG = __commonJS$1({ "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/lib/XDG.js"(exports$2) {
26032
- var __spreadArray = exports$2 && exports$2.__spreadArray || function(to, from) {
26033
- for (var i$1 = 0, il = from.length, j = to.length; i$1 < il; i$1++, j++) to[j] = from[i$1];
26034
- return to;
26035
- };
26036
- exports$2.__esModule = true;
26037
- exports$2.Adapt = void 0;
26038
- function Adapt(adapter_) {
26039
- var env$1 = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
26040
- var isMacOS = /^darwin$/i.test(adapter_.process.platform);
26041
- var isWinOS = /^win/i.test(adapter_.process.platform);
26042
- function baseDir() {
26043
- return osPaths.home() || osPaths.temp();
26044
- }
26045
- __name$1(baseDir, "baseDir");
26046
- function valOrPath(val, pathSegments) {
26047
- return val || path5.join.apply(path5, pathSegments);
26048
- }
26049
- __name$1(valOrPath, "valOrPath");
26050
- var linux = /* @__PURE__ */ __name$1(function() {
26051
- return {
26052
- cache: /* @__PURE__ */ __name$1(function() {
26053
- return valOrPath(env$1.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
26054
- }, "cache"),
26055
- config: /* @__PURE__ */ __name$1(function() {
26056
- return valOrPath(env$1.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
26057
- }, "config"),
26058
- data: /* @__PURE__ */ __name$1(function() {
26059
- return valOrPath(env$1.get("XDG_DATA_HOME"), [
26060
- baseDir(),
26061
- ".local",
26062
- "share"
26063
- ]);
26064
- }, "data"),
26065
- runtime: /* @__PURE__ */ __name$1(function() {
26066
- return env$1.get("XDG_RUNTIME_DIR") || void 0;
26067
- }, "runtime"),
26068
- state: /* @__PURE__ */ __name$1(function() {
26069
- return valOrPath(env$1.get("XDG_STATE_HOME"), [
26070
- baseDir(),
26071
- ".local",
26072
- "state"
26073
- ]);
26074
- }, "state")
26075
- };
26076
- }, "linux");
26077
- var macos = /* @__PURE__ */ __name$1(function() {
26078
- return {
26079
- cache: /* @__PURE__ */ __name$1(function() {
26080
- return valOrPath(env$1.get("XDG_CACHE_HOME"), [
26081
- baseDir(),
26082
- "Library",
26083
- "Caches"
26084
- ]);
26085
- }, "cache"),
26086
- config: /* @__PURE__ */ __name$1(function() {
26087
- return valOrPath(env$1.get("XDG_CONFIG_HOME"), [
26088
- baseDir(),
26089
- "Library",
26090
- "Preferences"
26091
- ]);
26092
- }, "config"),
26093
- data: /* @__PURE__ */ __name$1(function() {
26094
- return valOrPath(env$1.get("XDG_DATA_HOME"), [
26095
- baseDir(),
26096
- "Library",
26097
- "Application Support"
26098
- ]);
26099
- }, "data"),
26100
- runtime: /* @__PURE__ */ __name$1(function() {
26101
- return env$1.get("XDG_RUNTIME_DIR") || void 0;
26102
- }, "runtime"),
26103
- state: /* @__PURE__ */ __name$1(function() {
26104
- return valOrPath(env$1.get("XDG_STATE_HOME"), [
26105
- baseDir(),
26106
- "Library",
26107
- "State"
26108
- ]);
26109
- }, "state")
26110
- };
26111
- }, "macos");
26112
- var windows = /* @__PURE__ */ __name$1(function() {
26113
- function appData() {
26114
- return valOrPath(env$1.get("APPDATA"), [
26115
- baseDir(),
26116
- "AppData",
26117
- "Roaming"
26118
- ]);
26119
- }
26120
- __name$1(appData, "appData");
26121
- function localAppData() {
26122
- return valOrPath(env$1.get("LOCALAPPDATA"), [
26123
- baseDir(),
26124
- "AppData",
26125
- "Local"
26126
- ]);
26127
- }
26128
- __name$1(localAppData, "localAppData");
26129
- return {
26130
- cache: /* @__PURE__ */ __name$1(function() {
26131
- return valOrPath(env$1.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
26132
- }, "cache"),
26133
- config: /* @__PURE__ */ __name$1(function() {
26134
- return valOrPath(env$1.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
26135
- }, "config"),
26136
- data: /* @__PURE__ */ __name$1(function() {
26137
- return valOrPath(env$1.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
26138
- }, "data"),
26139
- runtime: /* @__PURE__ */ __name$1(function() {
26140
- return env$1.get("XDG_RUNTIME_DIR") || void 0;
26141
- }, "runtime"),
26142
- state: /* @__PURE__ */ __name$1(function() {
26143
- return valOrPath(env$1.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
26144
- }, "state")
26145
- };
26146
- }, "windows");
26147
- return { XDG: new (/* @__PURE__ */ function() {
26148
- function XDG_2() {
26149
- function XDG() {
26150
- return new XDG_2();
26151
- }
26152
- __name$1(XDG, "XDG");
26153
- var extension = isMacOS ? macos() : isWinOS ? windows() : linux();
26154
- XDG.cache = extension.cache;
26155
- XDG.config = extension.config;
26156
- XDG.data = extension.data;
26157
- XDG.runtime = extension.runtime;
26158
- XDG.state = extension.state;
26159
- XDG.configDirs = /* @__PURE__ */ __name$1(function configDirs() {
26160
- var pathList = env$1.get("XDG_CONFIG_DIRS");
26161
- return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
26162
- }, "configDirs");
26163
- XDG.dataDirs = /* @__PURE__ */ __name$1(function dataDirs() {
26164
- var pathList = env$1.get("XDG_DATA_DIRS");
26165
- return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
26166
- }, "dataDirs");
26167
- return XDG;
26168
- }
26169
- __name$1(XDG_2, "XDG_");
26170
- return XDG_2;
26171
- }())() };
26172
- }
26173
- __name$1(Adapt, "Adapt");
26174
- exports$2.Adapt = Adapt;
26175
- } });
26176
- var require_OSPaths = __commonJS$1({ "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/lib/OSPaths.js"(exports$2) {
26177
- var __spreadArray = exports$2 && exports$2.__spreadArray || function(to, from) {
26178
- for (var i$1 = 0, il = from.length, j = to.length; i$1 < il; i$1++, j++) to[j] = from[i$1];
26179
- return to;
26180
- };
26181
- exports$2.__esModule = true;
26182
- exports$2.Adapt = void 0;
26183
- function isEmpty(s) {
26184
- return !s;
26185
- }
26186
- __name$1(isEmpty, "isEmpty");
26187
- function Adapt(adapter_) {
26188
- var env$1 = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
26189
- var isWinOS = /^win/i.test(adapter_.process.platform);
26190
- function normalizePath$2(path_) {
26191
- return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
26192
- }
26193
- __name$1(normalizePath$2, "normalizePath");
26194
- function home() {
26195
- return isWinOS ? (/* @__PURE__ */ __name$1(function() {
26196
- return normalizePath$2([
26197
- typeof os2.homedir === "function" ? os2.homedir() : void 0,
26198
- env$1.get("USERPROFILE"),
26199
- env$1.get("HOME"),
26200
- env$1.get("HOMEDRIVE") || env$1.get("HOMEPATH") ? path5.join(env$1.get("HOMEDRIVE") || "", env$1.get("HOMEPATH") || "") : void 0
26201
- ].find(function(v) {
26202
- return !isEmpty(v);
26203
- }));
26204
- }, "windows"))() : (/* @__PURE__ */ __name$1(function() {
26205
- return normalizePath$2((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env$1.get("HOME"));
26206
- }, "posix"))();
26207
- }
26208
- __name$1(home, "home");
26209
- function temp() {
26210
- function joinPathToBase(base, segments) {
26211
- return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
26212
- }
26213
- __name$1(joinPathToBase, "joinPathToBase");
26214
- function posix$1() {
26215
- return normalizePath$2([
26216
- typeof os2.tmpdir === "function" ? os2.tmpdir() : void 0,
26217
- env$1.get("TMPDIR"),
26218
- env$1.get("TEMP"),
26219
- env$1.get("TMP")
26220
- ].find(function(v) {
26221
- return !isEmpty(v);
26222
- })) || "/tmp";
26223
- }
26224
- __name$1(posix$1, "posix");
26225
- function windows() {
26226
- var fallback = "C:\\Temp";
26227
- var v = [
26228
- typeof os2.tmpdir === "function" ? os2.tmpdir : function() {},
26229
- function() {
26230
- return env$1.get("TEMP");
26231
- },
26232
- function() {
26233
- return env$1.get("TMP");
26234
- },
26235
- function() {
26236
- return joinPathToBase(env$1.get("LOCALAPPDATA"), ["Temp"]);
26237
- },
26238
- function() {
26239
- return joinPathToBase(home(), [
26240
- "AppData",
26241
- "Local",
26242
- "Temp"
26243
- ]);
26244
- },
26245
- function() {
26246
- return joinPathToBase(env$1.get("ALLUSERSPROFILE"), ["Temp"]);
26247
- },
26248
- function() {
26249
- return joinPathToBase(env$1.get("SystemRoot"), ["Temp"]);
26250
- },
26251
- function() {
26252
- return joinPathToBase(env$1.get("windir"), ["Temp"]);
26253
- },
26254
- function() {
26255
- return joinPathToBase(env$1.get("SystemDrive"), ["\\", "Temp"]);
26256
- }
26257
- ].find(function(v2) {
26258
- return v2 && !isEmpty(v2());
26259
- });
26260
- return v && normalizePath$2(v()) || fallback;
26261
- }
26262
- __name$1(windows, "windows");
26263
- return isWinOS ? windows() : posix$1();
26264
- }
26265
- __name$1(temp, "temp");
26266
- return { OSPaths: new (/* @__PURE__ */ function() {
26267
- function OSPaths_2() {
26268
- function OSPaths() {
26269
- return new OSPaths_2();
26270
- }
26271
- __name$1(OSPaths, "OSPaths");
26272
- OSPaths.home = home;
26273
- OSPaths.temp = temp;
26274
- return OSPaths;
26275
- }
26276
- __name$1(OSPaths_2, "OSPaths_");
26277
- return OSPaths_2;
26278
- }())() };
26279
- }
26280
- __name$1(Adapt, "Adapt");
26281
- exports$2.Adapt = Adapt;
26282
- } });
26283
- var require_node = __commonJS$1({ "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/platform-adapters/node.js"(exports$2) {
26284
- var __createBinding = exports$2 && exports$2.__createBinding || (Object.create ? function(o, m, k, k2) {
26285
- if (k2 === void 0) k2 = k;
26286
- Object.defineProperty(o, k2, {
26287
- enumerable: true,
26288
- get: /* @__PURE__ */ __name$1(function() {
26289
- return m[k];
26290
- }, "get")
26291
- });
26292
- } : function(o, m, k, k2) {
26293
- if (k2 === void 0) k2 = k;
26294
- o[k2] = m[k];
26295
- });
26296
- var __setModuleDefault = exports$2 && exports$2.__setModuleDefault || (Object.create ? function(o, v) {
26297
- Object.defineProperty(o, "default", {
26298
- enumerable: true,
26299
- value: v
26300
- });
26301
- } : function(o, v) {
26302
- o["default"] = v;
26303
- });
26304
- var __importStar = exports$2 && exports$2.__importStar || function(mod$1) {
26305
- if (mod$1 && mod$1.__esModule) return mod$1;
26306
- var result = {};
26307
- if (mod$1 != null) {
26308
- for (var k in mod$1) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod$1, k)) __createBinding(result, mod$1, k);
26309
- }
26310
- __setModuleDefault(result, mod$1);
26311
- return result;
26312
- };
26313
- exports$2.__esModule = true;
26314
- exports$2.adapter = void 0;
26315
- var os2 = __importStar(__require$1("os"));
26316
- var path5 = __importStar(__require$1("path"));
26317
- exports$2.adapter = {
26318
- atImportPermissions: { env: true },
26319
- env: { get: /* @__PURE__ */ __name$1(function(s) {
26320
- return process.env[s];
26321
- }, "get") },
26322
- os: os2,
26323
- path: path5,
26324
- process
26325
- };
26326
- } });
26327
- var require_mod_cjs = __commonJS$1({ "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/mod.cjs.js"(exports$2, module$1) {
26328
- var OSPaths_js_1 = require_OSPaths();
26329
- var node_js_1 = require_node();
26330
- module$1.exports = OSPaths_js_1.Adapt(node_js_1.adapter).OSPaths;
26331
- } });
26332
- var require_node2 = __commonJS$1({ "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/platform-adapters/node.js"(exports$2) {
26333
- var __createBinding = exports$2 && exports$2.__createBinding || (Object.create ? function(o, m, k, k2) {
26334
- if (k2 === void 0) k2 = k;
26335
- Object.defineProperty(o, k2, {
26336
- enumerable: true,
26337
- get: /* @__PURE__ */ __name$1(function() {
26338
- return m[k];
26339
- }, "get")
26340
- });
26341
- } : function(o, m, k, k2) {
26342
- if (k2 === void 0) k2 = k;
26343
- o[k2] = m[k];
26344
- });
26345
- var __setModuleDefault = exports$2 && exports$2.__setModuleDefault || (Object.create ? function(o, v) {
26346
- Object.defineProperty(o, "default", {
26347
- enumerable: true,
26348
- value: v
26349
- });
26350
- } : function(o, v) {
26351
- o["default"] = v;
26352
- });
26353
- var __importStar = exports$2 && exports$2.__importStar || function(mod$1) {
26354
- if (mod$1 && mod$1.__esModule) return mod$1;
26355
- var result = {};
26356
- if (mod$1 != null) {
26357
- for (var k in mod$1) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod$1, k)) __createBinding(result, mod$1, k);
26358
- }
26359
- __setModuleDefault(result, mod$1);
26360
- return result;
26361
- };
26362
- var __importDefault = exports$2 && exports$2.__importDefault || function(mod$1) {
26363
- return mod$1 && mod$1.__esModule ? mod$1 : { "default": mod$1 };
26364
- };
26365
- exports$2.__esModule = true;
26366
- exports$2.adapter = void 0;
26367
- var path5 = __importStar(__require$1("path"));
26368
- var os_paths_1 = __importDefault(require_mod_cjs());
26369
- exports$2.adapter = {
26370
- atImportPermissions: { env: true },
26371
- env: { get: /* @__PURE__ */ __name$1(function(s) {
26372
- return process.env[s];
26373
- }, "get") },
26374
- osPaths: os_paths_1["default"],
26375
- path: path5,
26376
- process
26377
- };
26378
- } });
26379
- var require_mod_cjs2 = __commonJS$1({ "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/mod.cjs.js"(exports$2, module$1) {
26380
- var XDG_js_1 = require_XDG();
26381
- var node_js_1 = require_node2();
26382
- module$1.exports = XDG_js_1.Adapt(node_js_1.adapter).XDG;
26383
- } });
26384
- var require_node3 = __commonJS$1({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/platform-adapters/node.js"(exports$2) {
26385
- var __createBinding = exports$2 && exports$2.__createBinding || (Object.create ? function(o, m, k, k2) {
26386
- if (k2 === void 0) k2 = k;
26387
- Object.defineProperty(o, k2, {
26388
- enumerable: true,
26389
- get: /* @__PURE__ */ __name$1(function() {
26390
- return m[k];
26391
- }, "get")
26392
- });
26393
- } : function(o, m, k, k2) {
26394
- if (k2 === void 0) k2 = k;
26395
- o[k2] = m[k];
26396
- });
26397
- var __setModuleDefault = exports$2 && exports$2.__setModuleDefault || (Object.create ? function(o, v) {
26398
- Object.defineProperty(o, "default", {
26399
- enumerable: true,
26400
- value: v
26401
- });
26402
- } : function(o, v) {
26403
- o["default"] = v;
26404
- });
26405
- var __importStar = exports$2 && exports$2.__importStar || function(mod$1) {
26406
- if (mod$1 && mod$1.__esModule) return mod$1;
26407
- var result = {};
26408
- if (mod$1 != null) {
26409
- for (var k in mod$1) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod$1, k)) __createBinding(result, mod$1, k);
26410
- }
26411
- __setModuleDefault(result, mod$1);
26412
- return result;
26413
- };
26414
- var __importDefault = exports$2 && exports$2.__importDefault || function(mod$1) {
26415
- return mod$1 && mod$1.__esModule ? mod$1 : { "default": mod$1 };
26416
- };
26417
- exports$2.__esModule = true;
26418
- exports$2.adapter = void 0;
26419
- var path5 = __importStar(__require$1("path"));
26420
- var xdg_portable_1 = __importDefault(require_mod_cjs2());
26421
- exports$2.adapter = {
26422
- atImportPermissions: {
26423
- env: true,
26424
- read: true
26425
- },
26426
- meta: {
26427
- mainFilename: /* @__PURE__ */ __name$1(function() {
26428
- var requireMainFilename = (typeof __require$1 !== "undefined" && __require$1 !== null && __require$1.main ? __require$1.main : { filename: void 0 }).filename;
26429
- return (requireMainFilename !== process.execArgv[0] ? requireMainFilename : void 0) || (typeof process._eval === "undefined" ? process.argv[1] : void 0);
26430
- }, "mainFilename"),
26431
- pkgMainFilename: /* @__PURE__ */ __name$1(function() {
26432
- return process.pkg ? process.execPath : void 0;
26433
- }, "pkgMainFilename")
26434
- },
26435
- path: path5,
26436
- process,
26437
- xdg: xdg_portable_1["default"]
26438
- };
26439
- } });
26440
- var require_mod_cjs3 = __commonJS$1({ "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/mod.cjs.js"(exports$2, module$1) {
26441
- var XDGAppPaths_js_1 = require_XDGAppPaths();
26442
- var node_js_1 = require_node3();
26443
- module$1.exports = XDGAppPaths_js_1.Adapt(node_js_1.adapter).XDGAppPaths;
26444
- } });
26445
- var require_signals = __commonJS$1({ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports$2, module$1) {
26446
- module$1.exports = [
26447
- "SIGABRT",
26448
- "SIGALRM",
26449
- "SIGHUP",
26450
- "SIGINT",
26451
- "SIGTERM"
26452
- ];
26453
- if (process.platform !== "win32") module$1.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
26454
- if (process.platform === "linux") module$1.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
26455
- } });
26456
- var require_signal_exit = __commonJS$1({ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports$2, module$1) {
26457
- var process2 = global.process;
26458
- var processOk = /* @__PURE__ */ __name$1(function(process3) {
26459
- return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
26460
- }, "processOk");
26461
- if (!processOk(process2)) module$1.exports = function() {
26462
- return function() {};
26463
- };
26464
- else {
26465
- assert3 = __require$1("assert");
26466
- signals = require_signals();
26467
- isWin$1 = /^win/i.test(process2.platform);
26468
- EE$3 = __require$1("events");
26469
- if (typeof EE$3 !== "function") EE$3 = EE$3.EventEmitter;
26470
- if (process2.__signal_exit_emitter__) emitter = process2.__signal_exit_emitter__;
26471
- else {
26472
- emitter = process2.__signal_exit_emitter__ = new EE$3();
26473
- emitter.count = 0;
26474
- emitter.emitted = {};
26475
- }
26476
- if (!emitter.infinite) {
26477
- emitter.setMaxListeners(Infinity);
26478
- emitter.infinite = true;
26479
- }
26480
- module$1.exports = function(cb, opts) {
26481
- if (!processOk(global.process)) return function() {};
26482
- assert3.equal(typeof cb, "function", "a callback must be provided for exit handler");
26483
- if (loaded === false) load();
26484
- var ev = "exit";
26485
- if (opts && opts.alwaysLast) ev = "afterexit";
26486
- var remove = /* @__PURE__ */ __name$1(function() {
26487
- emitter.removeListener(ev, cb);
26488
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) unload();
26489
- }, "remove");
26490
- emitter.on(ev, cb);
26491
- return remove;
26492
- };
26493
- unload = /* @__PURE__ */ __name$1(function unload2() {
26494
- if (!loaded || !processOk(global.process)) return;
26495
- loaded = false;
26496
- signals.forEach(function(sig) {
26497
- try {
26498
- process2.removeListener(sig, sigListeners[sig]);
26499
- } catch (er) {}
26500
- });
26501
- process2.emit = originalProcessEmit;
26502
- process2.reallyExit = originalProcessReallyExit;
26503
- emitter.count -= 1;
26504
- }, "unload");
26505
- module$1.exports.unload = unload;
26506
- emit = /* @__PURE__ */ __name$1(function emit2(event, code, signal) {
26507
- if (emitter.emitted[event]) return;
26508
- emitter.emitted[event] = true;
26509
- emitter.emit(event, code, signal);
26510
- }, "emit");
26511
- sigListeners = {};
26512
- signals.forEach(function(sig) {
26513
- sigListeners[sig] = /* @__PURE__ */ __name$1(function listener() {
26514
- if (!processOk(global.process)) return;
26515
- if (process2.listeners(sig).length === emitter.count) {
26516
- unload();
26517
- emit("exit", null, sig);
26518
- emit("afterexit", null, sig);
26519
- if (isWin$1 && sig === "SIGHUP") sig = "SIGINT";
26520
- process2.kill(process2.pid, sig);
26521
- }
26522
- }, "listener");
26523
- });
26524
- module$1.exports.signals = function() {
26525
- return signals;
26526
- };
26527
- loaded = false;
26528
- load = /* @__PURE__ */ __name$1(function load2() {
26529
- if (loaded || !processOk(global.process)) return;
26530
- loaded = true;
26531
- emitter.count += 1;
26532
- signals = signals.filter(function(sig) {
26533
- try {
26534
- process2.on(sig, sigListeners[sig]);
26535
- return true;
26536
- } catch (er) {
26537
- return false;
26538
- }
26539
- });
26540
- process2.emit = processEmit;
26541
- process2.reallyExit = processReallyExit;
26542
- }, "load");
26543
- module$1.exports.load = load;
26544
- originalProcessReallyExit = process2.reallyExit;
26545
- processReallyExit = /* @__PURE__ */ __name$1(function processReallyExit2(code) {
26546
- if (!processOk(global.process)) return;
26547
- process2.exitCode = code || 0;
26548
- emit("exit", process2.exitCode, null);
26549
- emit("afterexit", process2.exitCode, null);
26550
- originalProcessReallyExit.call(process2, process2.exitCode);
26551
- }, "processReallyExit");
26552
- originalProcessEmit = process2.emit;
26553
- processEmit = /* @__PURE__ */ __name$1(function processEmit2(ev, arg) {
26554
- if (ev === "exit" && processOk(global.process)) {
26555
- if (arg !== void 0) process2.exitCode = arg;
26556
- var ret = originalProcessEmit.apply(this, arguments);
26557
- emit("exit", process2.exitCode, null);
26558
- emit("afterexit", process2.exitCode, null);
26559
- return ret;
26560
- } else return originalProcessEmit.apply(this, arguments);
26561
- }, "processEmit");
26562
- }
26563
- var assert3;
26564
- var signals;
26565
- var isWin$1;
26566
- var EE$3;
26567
- var emitter;
26568
- var unload;
26569
- var emit;
26570
- var sigListeners;
26571
- var loaded;
26572
- var load;
26573
- var originalProcessReallyExit;
26574
- var processReallyExit;
26575
- var originalProcessEmit;
26576
- var processEmit;
26577
- } });
26578
26083
  var require_command_exists = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$2, module$1) {
26579
26084
  var exec = __require$1("child_process").exec;
26580
26085
  var execSync = __require$1("child_process").execSync;
26581
26086
  var fs3 = __require$1("fs");
26582
- var path5 = __require$1("path");
26087
+ var path4 = __require$1("path");
26583
26088
  var access = fs3.access;
26584
26089
  var accessSync2 = fs3.accessSync;
26585
26090
  var constants2 = fs3.constants || fs3;
@@ -26656,8 +26161,8 @@ var require_command_exists = __commonJS$1({ "../../node_modules/.pnpm/command-ex
26656
26161
  }, "cleanInput");
26657
26162
  if (isUsingWindows) cleanInput = /* @__PURE__ */ __name$1(function(s) {
26658
26163
  if (/[\\]/.test(s)) {
26659
- var dirname2 = "\"" + path5.dirname(s) + "\"";
26660
- var basename2 = "\"" + path5.basename(s) + "\"";
26164
+ var dirname2 = "\"" + path4.dirname(s) + "\"";
26165
+ var basename2 = "\"" + path4.basename(s) + "\"";
26661
26166
  return dirname2 + ":" + basename2;
26662
26167
  }
26663
26168
  return "\"" + s + "\"";
@@ -26700,7 +26205,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26700
26205
  opt.whitespace = opt.whitespace === true;
26701
26206
  }
26702
26207
  var separator = opt.whitespace ? " = " : "=";
26703
- Object.keys(obj).forEach(function(k, _2, __) {
26208
+ Object.keys(obj).forEach(function(k, _, __) {
26704
26209
  var val = obj[k];
26705
26210
  if (val && Array.isArray(val)) val.forEach(function(item) {
26706
26211
  out += safe(k + "[]") + separator + safe(item) + "\n";
@@ -26709,7 +26214,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26709
26214
  else out += safe(k) + separator + safe(val) + eol;
26710
26215
  });
26711
26216
  if (opt.section && out.length) out = "[" + safe(opt.section) + "]" + eol + out;
26712
- children.forEach(function(k, _2, __) {
26217
+ children.forEach(function(k, _, __) {
26713
26218
  var nk = dotSplit(k).join("\\.");
26714
26219
  var section = (opt.section ? opt.section + "." : "") + nk;
26715
26220
  var child = encode$4(obj[k], {
@@ -26733,7 +26238,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26733
26238
  var p$1 = out;
26734
26239
  var section = null;
26735
26240
  var re$5 = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
26736
- str.split(/[\r\n]+/g).forEach(function(line, _2, __) {
26241
+ str.split(/[\r\n]+/g).forEach(function(line, _, __) {
26737
26242
  if (!line || line.match(/^\s*[;#]/)) return;
26738
26243
  var match = line.match(re$5);
26739
26244
  if (!match) return;
@@ -26763,13 +26268,13 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26763
26268
  if (Array.isArray(p$1[key])) p$1[key].push(value);
26764
26269
  else p$1[key] = value;
26765
26270
  });
26766
- Object.keys(out).filter(function(k, _2, __) {
26271
+ Object.keys(out).filter(function(k, _, __) {
26767
26272
  if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k])) return false;
26768
26273
  var parts = dotSplit(k);
26769
26274
  var p2 = out;
26770
26275
  var l = parts.pop();
26771
26276
  var nl = l.replace(/\\\./g, ".");
26772
- parts.forEach(function(part, _3, __2) {
26277
+ parts.forEach(function(part, _2, __2) {
26773
26278
  if (part === "__proto__") return;
26774
26279
  if (!p2[part] || typeof p2[part] !== "object") p2[part] = {};
26775
26280
  p2 = p2[part];
@@ -26777,7 +26282,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26777
26282
  if (p2 === out && nl === l) return false;
26778
26283
  p2[nl] = out[k];
26779
26284
  return true;
26780
- }).forEach(function(del, _2, __) {
26285
+ }).forEach(function(del, _, __) {
26781
26286
  delete out[del];
26782
26287
  });
26783
26288
  return out;
@@ -26797,7 +26302,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
26797
26302
  if (val.charAt(0) === "'") val = val.substr(1, val.length - 2);
26798
26303
  try {
26799
26304
  val = JSON.parse(val);
26800
- } catch (_2) {}
26305
+ } catch (_) {}
26801
26306
  } else {
26802
26307
  var esc$1 = false;
26803
26308
  var unesc = "";
@@ -26880,7 +26385,7 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
26880
26385
  var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$2) {
26881
26386
  var fs3 = __require$1("fs");
26882
26387
  var ini = require_ini();
26883
- var path5 = __require$1("path");
26388
+ var path4 = __require$1("path");
26884
26389
  var stripJsonComments = require_strip_json_comments();
26885
26390
  var parse$13 = exports$2.parse = function(content) {
26886
26391
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
@@ -26891,7 +26396,7 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26891
26396
  return arg != null;
26892
26397
  });
26893
26398
  for (var i$1 in args) if ("string" !== typeof args[i$1]) return;
26894
- var file2 = path5.join.apply(null, args);
26399
+ var file2 = path4.join.apply(null, args);
26895
26400
  try {
26896
26401
  return fs3.readFileSync(file2, "utf-8");
26897
26402
  } catch (err) {
@@ -26921,14 +26426,14 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26921
26426
  return obj;
26922
26427
  };
26923
26428
  exports$2.find = function() {
26924
- var rel = path5.join.apply(null, [].slice.call(arguments));
26429
+ var rel = path4.join.apply(null, [].slice.call(arguments));
26925
26430
  function find2(start, rel2) {
26926
- var file2 = path5.join(start, rel2);
26431
+ var file2 = path4.join(start, rel2);
26927
26432
  try {
26928
26433
  fs3.statSync(file2);
26929
26434
  return file2;
26930
26435
  } catch (err) {
26931
- if (path5.dirname(start) !== start) return find2(path5.dirname(start), rel2);
26436
+ if (path4.dirname(start) !== start) return find2(path4.dirname(start), rel2);
26932
26437
  }
26933
26438
  }
26934
26439
  __name$1(find2, "find");
@@ -27307,7 +26812,7 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
27307
26812
  var authInfo = getAuthInfoForUrl("//" + parsed.host + pathname.replace(/\/$/, ""), options.npmrc);
27308
26813
  if (authInfo) return authInfo;
27309
26814
  if (!options.recursive) return /\/$/.test(checkUrl) ? void 0 : getRegistryAuthInfo(url.resolve(checkUrl, "."), options);
27310
- parsed.pathname = url.resolve(normalizePath$2(pathname), "..") || "/";
26815
+ parsed.pathname = url.resolve(normalizePath$3(pathname), "..") || "/";
27311
26816
  }
27312
26817
  }
27313
26818
  __name$1(getRegistryAuthInfo, "getRegistryAuthInfo");
@@ -27318,10 +26823,10 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
27318
26823
  };
27319
26824
  }
27320
26825
  __name$1(getLegacyAuthInfo, "getLegacyAuthInfo");
27321
- function normalizePath$2(path5) {
27322
- return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
26826
+ function normalizePath$3(path4) {
26827
+ return path4[path4.length - 1] === "/" ? path4 : path4 + "/";
27323
26828
  }
27324
- __name$1(normalizePath$2, "normalizePath");
26829
+ __name$1(normalizePath$3, "normalizePath");
27325
26830
  function getAuthInfoForUrl(regUrl, npmrc) {
27326
26831
  var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
27327
26832
  if (bearerAuth) return bearerAuth;
@@ -27475,6 +26980,14 @@ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check
27475
26980
  return null;
27476
26981
  };
27477
26982
  } });
26983
+ function getDurableObjectExports(exports$2) {
26984
+ return partitionExports$1(exports$2)["durable-object"];
26985
+ }
26986
+ __name$1(getDurableObjectExports, "getDurableObjectExports");
26987
+ function hasDurableObjectExports(exports$2) {
26988
+ return Object.keys(getDurableObjectExports(exports$2)).length > 0;
26989
+ }
26990
+ __name$1(hasDurableObjectExports, "hasDurableObjectExports");
27478
26991
  var defaultWranglerConfig = {
27479
26992
  configPath: void 0,
27480
26993
  userConfigPath: void 0,
@@ -27549,6 +27062,7 @@ var defaultWranglerConfig = {
27549
27062
  jsx_factory: "React.createElement",
27550
27063
  jsx_fragment: "React.Fragment",
27551
27064
  migrations: [],
27065
+ exports: {},
27552
27066
  triggers: { crons: void 0 },
27553
27067
  rules: [],
27554
27068
  build: {
@@ -27629,7 +27143,7 @@ var util$2;
27629
27143
  }
27630
27144
  __name$1(joinValues, "joinValues");
27631
27145
  util2.joinValues = joinValues;
27632
- util2.jsonStringifyReplacer = (_2, value) => {
27146
+ util2.jsonStringifyReplacer = (_, value) => {
27633
27147
  if (typeof value === "bigint") return value.toString();
27634
27148
  return value;
27635
27149
  };
@@ -27868,8 +27382,8 @@ function getErrorMap$1() {
27868
27382
  }
27869
27383
  __name$1(getErrorMap$1, "getErrorMap");
27870
27384
  var makeIssue$1 = /* @__PURE__ */ __name$1((params) => {
27871
- const { data: data$1, path: path5, errorMaps, issueData } = params;
27872
- const fullPath = [...path5, ...issueData.path || []];
27385
+ const { data: data$1, path: path4, errorMaps, issueData } = params;
27386
+ const fullPath = [...path4, ...issueData.path || []];
27873
27387
  const fullIssue = {
27874
27388
  ...issueData,
27875
27389
  path: fullPath
@@ -27973,11 +27487,11 @@ var ParseInputLazyPath$1 = class {
27973
27487
  static {
27974
27488
  __name$1(this, "ParseInputLazyPath");
27975
27489
  }
27976
- constructor(parent, value, path5, key) {
27490
+ constructor(parent, value, path4, key) {
27977
27491
  this._cachedPath = [];
27978
27492
  this.parent = parent;
27979
27493
  this.data = value;
27980
- this._path = path5;
27494
+ this._path = path4;
27981
27495
  this._key = key;
27982
27496
  }
27983
27497
  get path() {
@@ -31137,25 +30651,6 @@ z.object({
31137
30651
  }).strict().optional(),
31138
30652
  timeout: z.number().gte(0).or(z.string()).optional()
31139
30653
  }).strict();
31140
- var mod_esm_exports = {};
31141
- __export(mod_esm_exports, { default: () => mod_esm_default });
31142
- var import_mod_cjs = __toESM(require_mod_cjs3(), 1);
31143
- __reExport(mod_esm_exports, __toESM(require_mod_cjs3(), 1));
31144
- var mod_esm_default = import_mod_cjs.default;
31145
- function getGlobalConfigPath({ appName = "wrangler", leadingDot = true, useLegacyHomeDir = true } = {}) {
31146
- const dirName = `${leadingDot ? "." : ""}${appName}`;
31147
- const configDir = mod_esm_default(dirName).config();
31148
- if (useLegacyHomeDir) {
31149
- const legacyConfigDir = path3.join(os.homedir(), dirName);
31150
- if (isDirectory$1(legacyConfigDir)) return legacyConfigDir;
31151
- }
31152
- return configDir;
31153
- }
31154
- __name$1(getGlobalConfigPath, "getGlobalConfigPath");
31155
- function getGlobalWranglerConfigPath() {
31156
- return getGlobalConfigPath();
31157
- }
31158
- __name$1(getGlobalWranglerConfigPath, "getGlobalWranglerConfigPath");
31159
30654
  function getBooleanEnvironmentVariableFactory(options) {
31160
30655
  return () => {
31161
30656
  if (!(options.variableName in process.env) || process.env[options.variableName] === void 0) return typeof options.defaultValue === "function" ? options.defaultValue() : options.defaultValue;
@@ -31251,7 +30746,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
31251
30746
  var getRegistryPath = getEnvironmentVariableFactory({
31252
30747
  variableName: "WRANGLER_REGISTRY_PATH",
31253
30748
  defaultValue() {
31254
- return path3.join(getGlobalWranglerConfigPath(), "registry");
30749
+ return path2.join(getGlobalConfigPath(), "registry");
31255
30750
  }
31256
30751
  });
31257
30752
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
@@ -31393,9 +30888,9 @@ Please add "${field}" to "env.${envName}".`);
31393
30888
  return rawEnv[field] ?? defaultValue;
31394
30889
  }
31395
30890
  __name$1(notInheritable, "notInheritable");
31396
- function unwindPropertyPath(root, path5) {
30891
+ function unwindPropertyPath(root, path4) {
31397
30892
  let container = root;
31398
- const parts = path5.split(".");
30893
+ const parts = path4.split(".");
31399
30894
  for (let i$1 = 0; i$1 < parts.length - 1; i$1++) {
31400
30895
  if (!hasProperty(container, parts[i$1])) return;
31401
30896
  container = container[parts[i$1]];
@@ -31543,10 +31038,10 @@ var isRecord = /* @__PURE__ */ __name$1((value) => typeof value === "object" &&
31543
31038
  var validateUniqueNameProperty = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
31544
31039
  if (Array.isArray(value)) {
31545
31040
  const nameCount = /* @__PURE__ */ new Map();
31546
- Object.entries(value).forEach(([_2, entry]) => {
31041
+ Object.entries(value).forEach(([_, entry]) => {
31547
31042
  nameCount.set(entry.name, (nameCount.get(entry.name) ?? 0) + 1);
31548
31043
  });
31549
- const duplicates = Array.from(nameCount.entries()).filter(([_2, count]) => count > 1).map(([name]) => name);
31044
+ const duplicates = Array.from(nameCount.entries()).filter(([_, count]) => count > 1).map(([name]) => name);
31550
31045
  if (duplicates.length > 0) {
31551
31046
  const list$1 = duplicates.join("\", \"");
31552
31047
  diagnostics.errors.push(`"${field}" bindings must have unique "name" values; duplicate(s) found: "${list$1}"`);
@@ -31667,7 +31162,7 @@ function isPagesConfig(rawConfig) {
31667
31162
  }
31668
31163
  __name$1(isPagesConfig, "isPagesConfig");
31669
31164
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
31670
- const diagnostics = new Diagnostics(`Processing ${configPath ? path3.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31165
+ const diagnostics = new Diagnostics(`Processing ${configPath ? path2.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31671
31166
  validateOptionalProperty(diagnostics, "", "legacy_env", rawConfig.legacy_env, "boolean");
31672
31167
  validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
31673
31168
  validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
@@ -31771,34 +31266,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
31771
31266
  else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
31772
31267
  return {
31773
31268
  command,
31774
- watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) => path3.relative(process.cwd(), path3.join(path3.dirname(configPath), `${dir}`))) : path3.relative(process.cwd(), path3.join(path3.dirname(configPath), `${watch_dir}`)) : watch_dir,
31269
+ watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir) => path2.relative(process.cwd(), path2.join(path2.dirname(configPath), `${dir}`))) : path2.relative(process.cwd(), path2.join(path2.dirname(configPath), `${watch_dir}`)) : watch_dir,
31775
31270
  cwd
31776
31271
  };
31777
31272
  }
31778
31273
  __name$1(normalizeAndValidateBuild, "normalizeAndValidateBuild");
31779
31274
  function normalizeAndValidateMainField(configPath, rawMain) {
31780
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
31275
+ const configDir = path2.dirname(configPath ?? "wrangler.toml");
31781
31276
  if (rawMain !== void 0) if (typeof rawMain === "string") {
31782
- const directory = path3.resolve(configDir);
31783
- return path3.resolve(directory, rawMain);
31277
+ const directory = path2.resolve(configDir);
31278
+ return path2.resolve(directory, rawMain);
31784
31279
  } else return rawMain;
31785
31280
  else return;
31786
31281
  }
31787
31282
  __name$1(normalizeAndValidateMainField, "normalizeAndValidateMainField");
31788
31283
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
31789
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
31284
+ const configDir = path2.dirname(configPath ?? "wrangler.toml");
31790
31285
  if (rawDir !== void 0) if (typeof rawDir === "string") {
31791
- const directory = path3.resolve(configDir);
31792
- return path3.resolve(directory, rawDir);
31286
+ const directory = path2.resolve(configDir);
31287
+ return path2.resolve(directory, rawDir);
31793
31288
  } else return rawDir;
31794
31289
  else return;
31795
31290
  }
31796
31291
  __name$1(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
31797
31292
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
31798
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
31293
+ const configDir = path2.dirname(configPath ?? "wrangler.toml");
31799
31294
  if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
31800
- const directory = path3.resolve(configDir);
31801
- return path3.resolve(directory, rawPagesDir);
31295
+ const directory = path2.resolve(configDir);
31296
+ return path2.resolve(directory, rawPagesDir);
31802
31297
  } else return rawPagesDir;
31803
31298
  else return;
31804
31299
  }
@@ -31848,12 +31343,13 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
31848
31343
  validateRequiredProperty(diagnostics, "site", "bucket", bucket, "string");
31849
31344
  validateTypedArray(diagnostics, "sites.include", include, "string");
31850
31345
  validateTypedArray(diagnostics, "sites.exclude", exclude, "string");
31851
- validateOptionalProperty(diagnostics, "site", "entry-point", rawConfig.site["entry-point"], "string");
31346
+ const legacySiteEntryPoint = rawConfig.site["entry-point"];
31347
+ validateOptionalProperty(diagnostics, "site", "entry-point", legacySiteEntryPoint, "string");
31852
31348
  deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
31853
31349
  \`\`\`
31854
- main = "${path3.join(String(rawConfig.site["entry-point"]) || "workers-site", path3.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js")}"
31350
+ main = "${path2.join(String(legacySiteEntryPoint) || "workers-site", path2.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js")}"
31855
31351
  \`\`\``, false, void 0, "warning");
31856
- let siteEntryPoint = rawConfig.site["entry-point"];
31352
+ let siteEntryPoint = legacySiteEntryPoint;
31857
31353
  if (!mainEntryPoint && !siteEntryPoint) {
31858
31354
  diagnostics.warnings.push(`Because you've defined a [site] configuration, we're defaulting to "workers-site" for the deprecated \`site.entry-point\`field.
31859
31355
  Add the top level \`main\` field to your configuration file:
@@ -31864,7 +31360,7 @@ main = "workers-site/index.js"
31864
31360
  } else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
31865
31361
  They serve the same purpose: to point to the entry-point of your worker.
31866
31362
  Delete the deprecated \`site.entry-point\` field from your config.`);
31867
- if (configPath && siteEntryPoint) siteEntryPoint = path3.relative(process.cwd(), path3.join(path3.dirname(configPath), siteEntryPoint));
31363
+ if (configPath && siteEntryPoint) siteEntryPoint = path2.relative(process.cwd(), path2.join(path2.dirname(configPath), siteEntryPoint));
31868
31364
  return {
31869
31365
  bucket,
31870
31366
  "entry-point": siteEntryPoint,
@@ -31896,7 +31392,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
31896
31392
  if (rawMapping === void 0) return;
31897
31393
  const mapping = {};
31898
31394
  for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
31899
- if (configPath) mapping[name] = configPath ? path3.relative(process.cwd(), path3.join(path3.dirname(configPath), filePath)) : filePath;
31395
+ if (configPath) mapping[name] = configPath ? path2.relative(process.cwd(), path2.join(path2.dirname(configPath), filePath)) : filePath;
31900
31396
  }
31901
31397
  return mapping;
31902
31398
  }
@@ -32096,6 +31592,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
32096
31592
  durable_objects: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "durable_objects", validateBindingsProperty(envName, validateDurableObjectBinding), { bindings: [] }),
32097
31593
  workflows: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "workflows", all(validateBindingArray(envName, validateWorkflowBinding), validateUniqueNameProperty), []),
32098
31594
  migrations: inheritable(diagnostics, topLevelEnv, rawEnv, "migrations", validateMigrations, []),
31595
+ exports: inheritable(diagnostics, topLevelEnv, rawEnv, "exports", validateExports, {}),
32099
31596
  kv_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "kv_namespaces", validateBindingArray(envName, validateKVBinding), []),
32100
31597
  cloudchamber: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "cloudchamber", validateCloudchamberConfig, {}),
32101
31598
  containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name, configPath), void 0),
@@ -32147,14 +31644,15 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
32147
31644
  python_modules: inheritable(diagnostics, topLevelEnv, rawEnv, "python_modules", validatePythonModules, { exclude: ["**/*.pyc"] }),
32148
31645
  previews: inheritable(diagnostics, topLevelEnv, rawEnv, "previews", validatePreviewsConfig(envName), void 0)
32149
31646
  };
32150
- warnIfDurableObjectsHaveNoMigrations(diagnostics, environment.durable_objects, environment.migrations, configPath);
31647
+ warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
31648
+ errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
32151
31649
  if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
32152
31650
  return environment;
32153
31651
  }
32154
31652
  __name$1(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
32155
31653
  function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
32156
31654
  const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
32157
- return configPath && tsconfig ? path3.relative(process.cwd(), path3.join(path3.dirname(configPath), tsconfig)) : tsconfig;
31655
+ return configPath && tsconfig ? path2.relative(process.cwd(), path2.join(path2.dirname(configPath), tsconfig)) : tsconfig;
32158
31656
  }
32159
31657
  __name$1(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
32160
31658
  var validateAndNormalizeRules = /* @__PURE__ */ __name$1((diagnostics, topLevelEnv, rawEnv, envName) => {
@@ -32654,9 +32152,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
32654
32152
  let resolvedBuildContextPath = void 0;
32655
32153
  try {
32656
32154
  if (isDockerfile(resolvedImage, configPath)) {
32657
- const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
32658
- resolvedImage = path3.resolve(baseDir, resolvedImage);
32659
- resolvedBuildContextPath = containerAppOptional.image_build_context ? path3.resolve(baseDir, containerAppOptional.image_build_context) : path3.dirname(resolvedImage);
32155
+ const baseDir$1 = configPath ? path2.dirname(configPath) : process.cwd();
32156
+ resolvedImage = path2.resolve(baseDir$1, resolvedImage);
32157
+ resolvedBuildContextPath = containerAppOptional.image_build_context ? path2.resolve(baseDir$1, containerAppOptional.image_build_context) : path2.dirname(resolvedImage);
32660
32158
  }
32661
32159
  } catch (err) {
32662
32160
  if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
@@ -33014,6 +32512,22 @@ var validateD1Binding = /* @__PURE__ */ __name$1((diagnostics, field, value) =>
33014
32512
  diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "migrations_pattern" field but got ${JSON.stringify(value)}.`);
33015
32513
  isValid2 = false;
33016
32514
  }
32515
+ if (!isOptionalProperty(value, "database_name", "string")) {
32516
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "database_name" field but got ${JSON.stringify(value)}.`);
32517
+ isValid2 = false;
32518
+ }
32519
+ if (!isOptionalProperty(value, "migrations_dir", "string")) {
32520
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "migrations_dir" field but got ${JSON.stringify(value)}.`);
32521
+ isValid2 = false;
32522
+ }
32523
+ if (!isOptionalProperty(value, "migrations_table", "string")) {
32524
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "migrations_table" field but got ${JSON.stringify(value)}.`);
32525
+ isValid2 = false;
32526
+ }
32527
+ if (!isOptionalProperty(value, "database_internal_env", "string")) {
32528
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "database_internal_env" field but got ${JSON.stringify(value)}.`);
32529
+ isValid2 = false;
32530
+ }
33017
32531
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
33018
32532
  "binding",
33019
32533
  "database_id",
@@ -33735,6 +33249,138 @@ var validateMigrations = /* @__PURE__ */ __name$1((diagnostics, field, value) =>
33735
33249
  }
33736
33250
  return valid$2;
33737
33251
  }, "validateMigrations");
33252
+ var VALID_EXPORT_STORAGES = /* @__PURE__ */ new Set(["sqlite", "legacy-kv"]);
33253
+ var JS_IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
33254
+ function validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, allowedProperties) {
33255
+ let valid$2 = true;
33256
+ for (const key of Object.keys(durableObjectExport)) if (!allowedProperties.includes(key)) {
33257
+ diagnostics.errors.push(`"exports.${className}.${key}" is forbidden on state "${durableObjectExport.state ?? "created"}".`);
33258
+ valid$2 = false;
33259
+ }
33260
+ if (!valid$2) diagnostics.errors.push(`Allowed properties are: ${ENGLISH.format(allowedProperties)}.`);
33261
+ return valid$2;
33262
+ }
33263
+ __name$1(validateDurableObjectExportProperties, "validateDurableObjectExportProperties");
33264
+ function validateDurableObjectExport(diagnostics, className, durableObjectExport) {
33265
+ let valid$2 = true;
33266
+ if (className === "") {
33267
+ diagnostics.errors.push(`"export" keys cannot be the empty string.`);
33268
+ valid$2 = false;
33269
+ }
33270
+ switch (durableObjectExport.state) {
33271
+ case void 0:
33272
+ case "created":
33273
+ if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
33274
+ diagnostics.errors.push(`"exports.${className}.storage" is required for state "created" and must be one of ${ENGLISH.format(VALID_EXPORT_STORAGES)}, but got ${JSON.stringify(durableObjectExport.storage)}`);
33275
+ valid$2 = false;
33276
+ }
33277
+ valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
33278
+ "type",
33279
+ "state",
33280
+ "storage"
33281
+ ]) && valid$2;
33282
+ break;
33283
+ case "deleted":
33284
+ valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, ["type", "state"]) && valid$2;
33285
+ break;
33286
+ case "renamed":
33287
+ if (typeof durableObjectExport.renamed_to !== "string" || durableObjectExport.renamed_to === "") {
33288
+ diagnostics.errors.push(`"exports.${className}.renamed_to" is required for state "renamed" and must be a non-empty string.`);
33289
+ valid$2 = false;
33290
+ } else {
33291
+ if (!JS_IDENTIFIER_RE.test(durableObjectExport.renamed_to)) {
33292
+ diagnostics.errors.push(`"exports.${className}.renamed_to" must be a valid JavaScript identifier (got "${durableObjectExport.renamed_to}").`);
33293
+ valid$2 = false;
33294
+ }
33295
+ if (durableObjectExport.renamed_to === className) {
33296
+ diagnostics.errors.push(`"exports.${className}.renamed_to" cannot equal the source class name "${className}".`);
33297
+ valid$2 = false;
33298
+ }
33299
+ }
33300
+ valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
33301
+ "type",
33302
+ "state",
33303
+ "renamed_to"
33304
+ ]) && valid$2;
33305
+ break;
33306
+ case "transferred":
33307
+ if (typeof durableObjectExport.transferred_to !== "string" || durableObjectExport.transferred_to === "") {
33308
+ diagnostics.errors.push(`"exports.${className}.transferred_to" is required for state "transferred" and must be a non-empty string.`);
33309
+ valid$2 = false;
33310
+ }
33311
+ valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
33312
+ "type",
33313
+ "state",
33314
+ "transferred_to"
33315
+ ]) && valid$2;
33316
+ break;
33317
+ case "expecting-transfer":
33318
+ if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
33319
+ diagnostics.errors.push(`"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)}`);
33320
+ valid$2 = false;
33321
+ }
33322
+ if (typeof durableObjectExport.transfer_from !== "string" || durableObjectExport.transfer_from === "") {
33323
+ diagnostics.errors.push(`"exports.${className}.transfer_from" is required for state "expecting-transfer" and must be a non-empty string.`);
33324
+ valid$2 = false;
33325
+ }
33326
+ valid$2 = validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, [
33327
+ "type",
33328
+ "state",
33329
+ "storage",
33330
+ "transfer_from"
33331
+ ]) && valid$2;
33332
+ break;
33333
+ default: {
33334
+ const state = durableObjectExport.state;
33335
+ diagnostics.errors.push(`"exports.${className}.state" must be one of "created", "deleted", "renamed", "transferred", or "expecting-transfer" but got ${JSON.stringify(state)}.`);
33336
+ valid$2 = false;
33337
+ }
33338
+ }
33339
+ return valid$2;
33340
+ }
33341
+ __name$1(validateDurableObjectExport, "validateDurableObjectExport");
33342
+ function validateWorkerExport(diagnostics, exportName, workerExport) {
33343
+ let valid$2 = true;
33344
+ valid$2 = validateAdditionalProperties(diagnostics, `exports.${exportName}`, Object.keys(workerExport), ["type", "cache"]) && valid$2;
33345
+ valid$2 = validateWorkerExportCache(diagnostics, `exports.${exportName}.cache`, workerExport.cache) && valid$2;
33346
+ return valid$2;
33347
+ }
33348
+ __name$1(validateWorkerExport, "validateWorkerExport");
33349
+ function validateWorkerExportCache(diagnostics, field, value) {
33350
+ if (value === void 0) return true;
33351
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
33352
+ diagnostics.errors.push(`"${field}" should be an object but got ${JSON.stringify(value)}.`);
33353
+ return false;
33354
+ }
33355
+ const cache$2 = value;
33356
+ let valid$2 = true;
33357
+ valid$2 = validateRequiredProperty(diagnostics, field, "enabled", cache$2.enabled, "boolean") && valid$2;
33358
+ valid$2 = validateAdditionalProperties(diagnostics, field, Object.keys(cache$2), ["enabled"]) && valid$2;
33359
+ return valid$2;
33360
+ }
33361
+ __name$1(validateWorkerExportCache, "validateWorkerExportCache");
33362
+ var validateExports = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
33363
+ if (value === void 0 || value === null) return true;
33364
+ if (typeof value !== "object" || Array.isArray(value)) {
33365
+ diagnostics.errors.push(`The optional "${field}" field should be an object keyed by class name, but got ${JSON.stringify(value)}`);
33366
+ return false;
33367
+ }
33368
+ let valid$2 = true;
33369
+ for (const [exportName, exportConfig] of Object.entries(value)) {
33370
+ if (typeof exportConfig !== "object" || exportConfig === null) {
33371
+ diagnostics.errors.push(`"exports.${exportName}" should be an object but got ${JSON.stringify(exportConfig)}.`);
33372
+ valid$2 = false;
33373
+ continue;
33374
+ }
33375
+ if (exportConfig.type === "durable-object") valid$2 = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid$2;
33376
+ else if (exportConfig.type === "worker") valid$2 = validateWorkerExport(diagnostics, exportName, exportConfig) && valid$2;
33377
+ else {
33378
+ valid$2 = false;
33379
+ diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`);
33380
+ }
33381
+ }
33382
+ return valid$2;
33383
+ }, "validateExports");
33738
33384
  var validateObservability = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
33739
33385
  if (value === void 0) return true;
33740
33386
  if (typeof value !== "object") {
@@ -33808,31 +33454,40 @@ var validateCache = /* @__PURE__ */ __name$1((diagnostics, field, value) => {
33808
33454
  const val = value;
33809
33455
  let isValid2 = true;
33810
33456
  isValid2 = validateRequiredProperty(diagnostics, field, "enabled", val.enabled, "boolean") && isValid2;
33811
- isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled"]) && isValid2;
33457
+ isValid2 = validateOptionalProperty(diagnostics, field, "cross_version_cache", val.cross_version_cache, "boolean") && isValid2;
33458
+ isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled", "cross_version_cache"]) && isValid2;
33812
33459
  return isValid2;
33813
33460
  }, "validateCache");
33814
- function warnIfDurableObjectsHaveNoMigrations(diagnostics, durableObjects, migrations, configPath) {
33815
- if (Array.isArray(durableObjects.bindings) && durableObjects.bindings.length > 0) {
33816
- const exportedDurableObjects = (durableObjects.bindings || []).filter((binding) => !binding.script_name);
33817
- if (exportedDurableObjects.length > 0 && migrations.length === 0) {
33818
- if (!exportedDurableObjects.some((exportedDurableObject) => typeof exportedDurableObject.class_name !== "string")) {
33819
- const durableObjectClassnames = exportedDurableObjects.map((durable) => durable.class_name);
33820
- diagnostics.warnings.push(dedent`
33821
- In your ${configFileName$1(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$1(configPath)} file. Add the following configuration:
33822
-
33823
- \`\`\`
33824
- ${formatConfigSnippet$1({ migrations: [{
33825
- tag: "v1",
33826
- new_sqlite_classes: durableObjectClassnames
33827
- }] }, configPath)}
33828
- \`\`\`
33461
+ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$2, configPath) {
33462
+ if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) return;
33463
+ const exportedDurableObjects = durableObjects.bindings.filter((binding) => !binding.script_name);
33464
+ const exportsCovers = /* @__PURE__ */ __name$1((className) => {
33465
+ const entry = exports$2?.[className];
33466
+ if (entry === void 0 || entry.type !== "durable-object") return false;
33467
+ const state = entry.state ?? "created";
33468
+ return state === "created" || state === "expecting-transfer";
33469
+ }, "exportsCovers");
33470
+ const uncoveredByExports = exportedDurableObjects.filter((binding) => typeof binding.class_name !== "string" || !exportsCovers(binding.class_name));
33471
+ if (uncoveredByExports.length === 0 || migrations.length > 0) return;
33472
+ if (uncoveredByExports.some((exportedDurableObject) => typeof exportedDurableObject.class_name !== "string")) return;
33473
+ const durableObjectClassnames = uncoveredByExports.map((durable) => durable.class_name);
33474
+ const suggestedExports = {};
33475
+ for (const className of durableObjectClassnames) suggestedExports[className] = {
33476
+ type: "durable-object",
33477
+ storage: "sqlite"
33478
+ };
33479
+ diagnostics.warnings.push(dedent`
33480
+ In your ${configFileName$1(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:
33829
33481
 
33830
- Refer to https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/ for more details.`);
33831
- }
33832
- }
33833
- }
33482
+ \`\`\`
33483
+ ${formatConfigSnippet$1({ exports: suggestedExports }, configPath)}
33484
+ \`\`\``);
33834
33485
  }
33835
- __name$1(warnIfDurableObjectsHaveNoMigrations, "warnIfDurableObjectsHaveNoMigrations");
33486
+ __name$1(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
33487
+ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$2) {
33488
+ if (migrations.length > 0 && exports$2 !== void 0 && Object.values(exports$2).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.`);
33489
+ }
33490
+ __name$1(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
33836
33491
  var validatePythonModules = /* @__PURE__ */ __name$1((diagnostics, field, value, topLevelEnv) => {
33837
33492
  if (value === void 0) return true;
33838
33493
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -33853,8 +33508,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
33853
33508
  }
33854
33509
  __name$1(isRemoteValid, "isRemoteValid");
33855
33510
  function isDockerfile(imagePath, configPath) {
33856
- const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
33857
- const maybeDockerfile = path3.resolve(baseDir, imagePath);
33511
+ const baseDir$1 = configPath ? path2.dirname(configPath) : process.cwd();
33512
+ const maybeDockerfile = path2.resolve(baseDir$1, imagePath);
33858
33513
  if (fs2.existsSync(maybeDockerfile)) {
33859
33514
  if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
33860
33515
  return true;
@@ -34003,10 +33658,176 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
34003
33658
  }
34004
33659
  }
34005
33660
  __name$1(validateDurableObjectBinding2, "validateDurableObjectBinding");
34006
- var import_signal_exit = __toESM(require_signal_exit());
33661
+ var signals = [];
33662
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
33663
+ if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
33664
+ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
33665
+ var processOk = /* @__PURE__ */ __name$1((process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function", "processOk");
33666
+ var kExitEmitter = Symbol.for("signal-exit emitter");
33667
+ var global = globalThis;
33668
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
33669
+ var Emitter = class {
33670
+ static {
33671
+ __name$1(this, "Emitter");
33672
+ }
33673
+ emitted = {
33674
+ afterExit: false,
33675
+ exit: false
33676
+ };
33677
+ listeners = {
33678
+ afterExit: [],
33679
+ exit: []
33680
+ };
33681
+ count = 0;
33682
+ id = Math.random();
33683
+ constructor() {
33684
+ if (global[kExitEmitter]) return global[kExitEmitter];
33685
+ ObjectDefineProperty(global, kExitEmitter, {
33686
+ value: this,
33687
+ writable: false,
33688
+ enumerable: false,
33689
+ configurable: false
33690
+ });
33691
+ }
33692
+ on(ev, fn) {
33693
+ this.listeners[ev].push(fn);
33694
+ }
33695
+ removeListener(ev, fn) {
33696
+ const list$1 = this.listeners[ev];
33697
+ const i$1 = list$1.indexOf(fn);
33698
+ if (i$1 === -1) return;
33699
+ if (i$1 === 0 && list$1.length === 1) list$1.length = 0;
33700
+ else list$1.splice(i$1, 1);
33701
+ }
33702
+ emit(ev, code, signal) {
33703
+ if (this.emitted[ev]) return false;
33704
+ this.emitted[ev] = true;
33705
+ let ret = false;
33706
+ for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
33707
+ if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
33708
+ return ret;
33709
+ }
33710
+ };
33711
+ var SignalExitBase = class {
33712
+ static {
33713
+ __name$1(this, "SignalExitBase");
33714
+ }
33715
+ };
33716
+ var signalExitWrap = /* @__PURE__ */ __name$1((handler) => {
33717
+ return {
33718
+ onExit(cb, opts) {
33719
+ return handler.onExit(cb, opts);
33720
+ },
33721
+ load() {
33722
+ return handler.load();
33723
+ },
33724
+ unload() {
33725
+ return handler.unload();
33726
+ }
33727
+ };
33728
+ }, "signalExitWrap");
33729
+ var SignalExitFallback = class extends SignalExitBase {
33730
+ static {
33731
+ __name$1(this, "SignalExitFallback");
33732
+ }
33733
+ onExit() {
33734
+ return () => {};
33735
+ }
33736
+ load() {}
33737
+ unload() {}
33738
+ };
33739
+ var SignalExit = class extends SignalExitBase {
33740
+ static {
33741
+ __name$1(this, "SignalExit");
33742
+ }
33743
+ /* c8 ignore start */
33744
+ #hupSig = process2.platform === "win32" ? "SIGINT" : "SIGHUP";
33745
+ /* c8 ignore stop */
33746
+ #emitter = new Emitter();
33747
+ #process;
33748
+ #originalProcessEmit;
33749
+ #originalProcessReallyExit;
33750
+ #sigListeners = {};
33751
+ #loaded = false;
33752
+ constructor(process3) {
33753
+ super();
33754
+ this.#process = process3;
33755
+ this.#sigListeners = {};
33756
+ for (const sig of signals) this.#sigListeners[sig] = () => {
33757
+ const listeners = this.#process.listeners(sig);
33758
+ let { count } = this.#emitter;
33759
+ const p$1 = process3;
33760
+ if (typeof p$1.__signal_exit_emitter__ === "object" && typeof p$1.__signal_exit_emitter__.count === "number") count += p$1.__signal_exit_emitter__.count;
33761
+ if (listeners.length === count) {
33762
+ this.unload();
33763
+ const ret = this.#emitter.emit("exit", null, sig);
33764
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
33765
+ if (!ret) process3.kill(process3.pid, s);
33766
+ }
33767
+ };
33768
+ this.#originalProcessReallyExit = process3.reallyExit;
33769
+ this.#originalProcessEmit = process3.emit;
33770
+ }
33771
+ onExit(cb, opts) {
33772
+ if (!processOk(this.#process)) return () => {};
33773
+ if (this.#loaded === false) this.load();
33774
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
33775
+ this.#emitter.on(ev, cb);
33776
+ return () => {
33777
+ this.#emitter.removeListener(ev, cb);
33778
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
33779
+ };
33780
+ }
33781
+ load() {
33782
+ if (this.#loaded) return;
33783
+ this.#loaded = true;
33784
+ this.#emitter.count += 1;
33785
+ for (const sig of signals) try {
33786
+ const fn = this.#sigListeners[sig];
33787
+ if (fn) this.#process.on(sig, fn);
33788
+ } catch (_) {}
33789
+ this.#process.emit = (ev, ...a) => {
33790
+ return this.#processEmit(ev, ...a);
33791
+ };
33792
+ this.#process.reallyExit = (code) => {
33793
+ return this.#processReallyExit(code);
33794
+ };
33795
+ }
33796
+ unload() {
33797
+ if (!this.#loaded) return;
33798
+ this.#loaded = false;
33799
+ signals.forEach((sig) => {
33800
+ const listener = this.#sigListeners[sig];
33801
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
33802
+ try {
33803
+ this.#process.removeListener(sig, listener);
33804
+ } catch (_) {}
33805
+ });
33806
+ this.#process.emit = this.#originalProcessEmit;
33807
+ this.#process.reallyExit = this.#originalProcessReallyExit;
33808
+ this.#emitter.count -= 1;
33809
+ }
33810
+ #processReallyExit(code) {
33811
+ if (!processOk(this.#process)) return 0;
33812
+ this.#process.exitCode = code || 0;
33813
+ this.#emitter.emit("exit", this.#process.exitCode, null);
33814
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
33815
+ }
33816
+ #processEmit(ev, ...args) {
33817
+ const og = this.#originalProcessEmit;
33818
+ if (ev === "exit" && processOk(this.#process)) {
33819
+ if (typeof args[0] === "number") this.#process.exitCode = args[0];
33820
+ const ret = og.call(this.#process, ev, ...args);
33821
+ this.#emitter.emit("exit", this.#process.exitCode, null);
33822
+ return ret;
33823
+ } else return og.call(this.#process, ev, ...args);
33824
+ }
33825
+ };
33826
+ var process2 = globalThis.process;
33827
+ var { onExit, load, unload } = signalExitWrap(processOk(process2) ? new SignalExit(process2) : new SignalExitFallback());
34007
33828
  function getWranglerHiddenDirPath(projectRoot) {
34008
33829
  projectRoot ??= process.cwd();
34009
- return path3.join(projectRoot, ".wrangler");
33830
+ return path2.join(projectRoot, ".wrangler");
34010
33831
  }
34011
33832
  __name$1(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
34012
33833
  var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
@@ -34023,7 +33844,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
34023
33844
  const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
34024
33845
  for (const entry of entries) {
34025
33846
  if (!entry.isDirectory()) continue;
34026
- const entryPath = path3.join(tmpRoot, entry.name);
33847
+ const entryPath = path2.join(tmpRoot, entry.name);
34027
33848
  try {
34028
33849
  if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync$1(entryPath);
34029
33850
  } catch {}
@@ -34031,17 +33852,17 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
34031
33852
  }
34032
33853
  __name$1(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
34033
33854
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
34034
- const tmpRoot = path3.join(getWranglerHiddenDirPath(projectRoot), "tmp");
33855
+ const tmpRoot = path2.join(getWranglerHiddenDirPath(projectRoot), "tmp");
34035
33856
  fs2.mkdirSync(tmpRoot, { recursive: true });
34036
33857
  sweepStaleWranglerTmpDirs(tmpRoot);
34037
- const tmpPrefix = path3.join(tmpRoot, `${prefix}-`);
33858
+ const tmpPrefix = path2.join(tmpRoot, `${prefix}-`);
34038
33859
  const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
34039
33860
  const cleanupDir = /* @__PURE__ */ __name$1(() => {
34040
33861
  if (cleanup) try {
34041
33862
  removeDirSync$1(tmpDir);
34042
33863
  } catch {}
34043
33864
  }, "cleanupDir");
34044
- const removeExitListener = (0, import_signal_exit.default)(cleanupDir);
33865
+ const removeExitListener = onExit(cleanupDir);
34045
33866
  return {
34046
33867
  path: tmpDir,
34047
33868
  remove() {
@@ -34152,7 +33973,7 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
34152
33973
  }
34153
33974
  __name$1(getLatestVersionInfo, "getLatestVersionInfo");
34154
33975
  function getCacheDir(version$3) {
34155
- return join(getGlobalWranglerConfigPath(), "cloudflared", version$3);
33976
+ return join(getGlobalConfigPath(), "cloudflared", version$3);
34156
33977
  }
34157
33978
  __name$1(getCacheDir, "getCacheDir");
34158
33979
  function getCloudflaredBinPath(version$3) {
@@ -34201,7 +34022,7 @@ On Linux, make sure you have the required dependencies:
34201
34022
  errorMessage += ` - For Debian/Ubuntu: sudo apt-get install libc6
34202
34023
  `;
34203
34024
  }
34204
- const cacheDir = join(getGlobalWranglerConfigPath(), "cloudflared");
34025
+ const cacheDir = join(getGlobalConfigPath(), "cloudflared");
34205
34026
  errorMessage += `
34206
34027
  You can try:
34207
34028
  `;
@@ -34431,7 +34252,7 @@ async function spawnCloudflared(args, options) {
34431
34252
  }
34432
34253
  __name$1(spawnCloudflared, "spawnCloudflared");
34433
34254
  function removeCloudflaredCache(version$3) {
34434
- const cacheDir = version$3 ? getCacheDir(version$3) : join(getGlobalWranglerConfigPath(), "cloudflared");
34255
+ const cacheDir = version$3 ? getCacheDir(version$3) : join(getGlobalConfigPath(), "cloudflared");
34435
34256
  if (existsSync(cacheDir)) {
34436
34257
  removeDirSync$1(cacheDir);
34437
34258
  return cacheDir;
@@ -34472,13 +34293,13 @@ function startTunnel(options) {
34472
34293
  env: options.token ? { TUNNEL_TOKEN: options.token } : void 0,
34473
34294
  skipVersionCheck: true,
34474
34295
  logger
34475
- }).then((process2) => {
34476
- cloudflaredProcess = process2;
34477
- if (disposed) terminateCloudflared(process2);
34478
- return process2;
34479
- }).then((process2) => {
34296
+ }).then((process3) => {
34297
+ cloudflaredProcess = process3;
34298
+ if (disposed) terminateCloudflared(process3);
34299
+ return process3;
34300
+ }).then((process3) => {
34480
34301
  if (isNamedTunnel) return { mode: "named" };
34481
- return waitForQuickTunnelReady(process2, timeoutMs, {
34302
+ return waitForQuickTunnelReady(process3, timeoutMs, {
34482
34303
  logger,
34483
34304
  origin: options.origin
34484
34305
  });
@@ -34818,6 +34639,8 @@ function throwFetchError(resource, response, status) {
34818
34639
  });
34819
34640
  const code = errors$1[0]?.code;
34820
34641
  if (code) error.code = code;
34642
+ const meta$2 = errors$1[0]?.meta;
34643
+ if (meta$2) error.meta = meta$2;
34821
34644
  error.accountTag = extractAccountTag(resource);
34822
34645
  throw error;
34823
34646
  }
@@ -37272,7 +37095,7 @@ function getWorkerNameToWorkerEntrypointExportsMap(workers) {
37272
37095
  return workerNameToWorkerEntrypointExportsMap;
37273
37096
  }
37274
37097
  function getWorkerNameToDurableObjectExportsMap(workers) {
37275
- const workerNameToDurableObjectExportsMap = new Map(workers.map((worker) => [worker.config.name, new Set(wrangler.unstable_getDurableObjectClassNameToUseSQLiteMap(worker.config.migrations).keys())]));
37098
+ const workerNameToDurableObjectExportsMap = new Map(workers.map((worker) => [worker.config.name, new Set(wrangler.unstable_getDurableObjectClassNameToUseSQLiteMap(worker.config.migrations, worker.config.exports).keys())]));
37276
37099
  for (const worker of workers) for (const value of worker.config.durable_objects.bindings) if (value.script_name) workerNameToDurableObjectExportsMap.get(value.script_name)?.add(value.class_name);
37277
37100
  else workerNameToDurableObjectExportsMap.get(worker.config.name)?.add(value.class_name);
37278
37101
  return workerNameToDurableObjectExportsMap;
@@ -37468,7 +37291,7 @@ function assertIsPreview(ctx) {
37468
37291
  }
37469
37292
 
37470
37293
  //#endregion
37471
- //#region ../config/dist/public-CqcmI_Th.mjs
37294
+ //#region ../config/dist/public-CFHebTo4.mjs
37472
37295
  const CONFIG = Symbol.for("@cloudflare/config:worker-config");
37473
37296
  async function resolveWorkerDefinition(def, ctx) {
37474
37297
  const raw = typeof def === "object" && def !== null && CONFIG in def ? def[CONFIG] : def;
@@ -41975,6 +41798,40 @@ var __name = (target$1, value) => __defProp(target$1, "name", {
41975
41798
  value,
41976
41799
  configurable: true
41977
41800
  });
41801
+ function isDirectory(path$1) {
41802
+ return fs2.statSync(path$1, { throwIfNoEntry: false })?.isDirectory() ?? false;
41803
+ }
41804
+ __name(isDirectory, "isDirectory");
41805
+ function removeDir(dirPath, { fireAndForget = false } = {}) {
41806
+ const result = fs2.promises.rm(dirPath, {
41807
+ recursive: true,
41808
+ force: true,
41809
+ maxRetries: 5,
41810
+ retryDelay: 100
41811
+ });
41812
+ if (fireAndForget) result.catch(() => {});
41813
+ else return result;
41814
+ }
41815
+ __name(removeDir, "removeDir");
41816
+ function removeDirSync(dirPath) {
41817
+ fs2.rmSync(dirPath, {
41818
+ recursive: true,
41819
+ force: true,
41820
+ maxRetries: 5,
41821
+ retryDelay: 100
41822
+ });
41823
+ }
41824
+ __name(removeDirSync, "removeDirSync");
41825
+ function partitionExports(exports$2) {
41826
+ const partitioned = {
41827
+ "durable-object": {},
41828
+ worker: {}
41829
+ };
41830
+ if (exports$2 === void 0) return partitioned;
41831
+ for (const [name, entry] of Object.entries(exports$2)) partitioned[entry.type][name] = entry;
41832
+ return partitioned;
41833
+ }
41834
+ __name(partitionExports, "partitionExports");
41978
41835
  var UserError$1 = class extends Error {
41979
41836
  static {
41980
41837
  __name(this, "UserError");
@@ -42727,10 +42584,10 @@ function parseTree(text, errors$1 = [], options = ParseOptions.DEFAULT) {
42727
42584
  return result;
42728
42585
  }
42729
42586
  __name(parseTree, "parseTree");
42730
- function findNodeAtLocation(root, path2) {
42587
+ function findNodeAtLocation(root, path2$1) {
42731
42588
  if (!root) return;
42732
42589
  let node = root;
42733
- for (let segment of path2) if (typeof segment === "string") {
42590
+ for (let segment of path2$1) if (typeof segment === "string") {
42734
42591
  if (node.type !== "object" || !Array.isArray(node.children)) return;
42735
42592
  let found = false;
42736
42593
  for (const propertyNode of node.children) if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
@@ -42957,13 +42814,13 @@ function getNodeType(value) {
42957
42814
  }
42958
42815
  __name(getNodeType, "getNodeType");
42959
42816
  function setProperty(text, originalPath, value, options) {
42960
- const path2 = originalPath.slice();
42817
+ const path2$1 = originalPath.slice();
42961
42818
  const root = parseTree(text, []);
42962
42819
  let parent = void 0;
42963
42820
  let lastSegment = void 0;
42964
- while (path2.length > 0) {
42965
- lastSegment = path2.pop();
42966
- parent = findNodeAtLocation(root, path2);
42821
+ while (path2$1.length > 0) {
42822
+ lastSegment = path2$1.pop();
42823
+ parent = findNodeAtLocation(root, path2$1);
42967
42824
  if (parent === void 0 && value !== void 0) if (typeof lastSegment === "string") value = { [lastSegment]: value };
42968
42825
  else value = [value];
42969
42826
  else break;
@@ -43205,8 +43062,8 @@ function format2(documentText, range, options) {
43205
43062
  return format$1(documentText, range, options);
43206
43063
  }
43207
43064
  __name(format2, "format");
43208
- function modify(text, path2, value, options) {
43209
- return setProperty(text, path2, value, options);
43065
+ function modify(text, path2$1, value, options) {
43066
+ return setProperty(text, path2$1, value, options);
43210
43067
  }
43211
43068
  __name(modify, "modify");
43212
43069
  function applyEdits(text, edits) {
@@ -43968,6 +43825,12 @@ var ParseError = class extends UserError$1 {
43968
43825
  #status;
43969
43826
  code;
43970
43827
  accountTag;
43828
+ /**
43829
+ * Optional structured metadata hoisted from the first `FetchError.meta`
43830
+ * on the v4 response envelope. Consumers can inspect this to render
43831
+ * endpoint-specific structured error payloads.
43832
+ */
43833
+ meta;
43971
43834
  constructor({ status,...rest }) {
43972
43835
  super(rest);
43973
43836
  this.name = this.constructor.name;
@@ -44308,7 +44171,7 @@ function resolveWranglerConfigPath({ config: config$1, script }, options) {
44308
44171
  deployConfigPath: void 0,
44309
44172
  redirected: false
44310
44173
  };
44311
- return findWranglerConfig$1(script !== void 0 ? path3.dirname(script) : process.cwd(), options);
44174
+ return findWranglerConfig$1(script !== void 0 ? path2.dirname(script) : process.cwd(), options);
44312
44175
  }
44313
44176
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
44314
44177
  function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -44339,15 +44202,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
44339
44202
  const deployConfigFile = readFileSync$1(deployConfigPath);
44340
44203
  try {
44341
44204
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
44342
- redirectedConfigPath = deployConfig.configPath && path3.resolve(path3.dirname(deployConfigPath), deployConfig.configPath);
44205
+ redirectedConfigPath = deployConfig.configPath && path2.resolve(path2.dirname(deployConfigPath), deployConfig.configPath);
44343
44206
  } catch (e) {
44344
- throw new UserError$1(`Failed to parse the deploy configuration file at ${path3.relative(".", deployConfigPath)}`, {
44207
+ throw new UserError$1(`Failed to parse the deploy configuration file at ${path2.relative(".", deployConfigPath)}`, {
44345
44208
  cause: e,
44346
44209
  telemetryMessage: false
44347
44210
  });
44348
44211
  }
44349
44212
  if (!redirectedConfigPath) throw new UserError$1(esm_default`
44350
- A deploy configuration file was found at "${path3.relative(".", deployConfigPath)}".
44213
+ A deploy configuration file was found at "${path2.relative(".", deployConfigPath)}".
44351
44214
  But this is not valid - the required "configPath" property was not found.
44352
44215
  Instead this file contains:
44353
44216
  \`\`\`
@@ -44355,13 +44218,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
44355
44218
  \`\`\`
44356
44219
  `, { telemetryMessage: false });
44357
44220
  if (!existsSync(redirectedConfigPath)) throw new UserError$1(esm_default`
44358
- There is a deploy configuration at "${path3.relative(".", deployConfigPath)}".
44359
- But the redirected configuration path it points to, "${path3.relative(".", redirectedConfigPath)}", does not exist.
44221
+ There is a deploy configuration at "${path2.relative(".", deployConfigPath)}".
44222
+ But the redirected configuration path it points to, "${path2.relative(".", redirectedConfigPath)}", does not exist.
44360
44223
  `, { telemetryMessage: false });
44361
44224
  if (userConfigPath) {
44362
- if (path3.join(path3.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError$1(esm_default`
44363
- Found both a user configuration file at "${path3.relative(".", userConfigPath)}"
44364
- and a deploy configuration file at "${path3.relative(".", deployConfigPath)}".
44225
+ if (path2.join(path2.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError$1(esm_default`
44226
+ Found both a user configuration file at "${path2.relative(".", userConfigPath)}"
44227
+ and a deploy configuration file at "${path2.relative(".", deployConfigPath)}".
44365
44228
  But these do not share the same base path so it is not clear which should be used.
44366
44229
  `, { telemetryMessage: false });
44367
44230
  }
@@ -44404,30 +44267,6 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
44404
44267
  else return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
44405
44268
  }
44406
44269
  __name(formatConfigSnippet, "formatConfigSnippet");
44407
- function isDirectory(path2) {
44408
- return fs2.statSync(path2, { throwIfNoEntry: false })?.isDirectory() ?? false;
44409
- }
44410
- __name(isDirectory, "isDirectory");
44411
- function removeDir(dirPath, { fireAndForget = false } = {}) {
44412
- const result = fs2.promises.rm(dirPath, {
44413
- recursive: true,
44414
- force: true,
44415
- maxRetries: 5,
44416
- retryDelay: 100
44417
- });
44418
- if (fireAndForget) result.catch(() => {});
44419
- else return result;
44420
- }
44421
- __name(removeDir, "removeDir");
44422
- function removeDirSync(dirPath) {
44423
- fs2.rmSync(dirPath, {
44424
- recursive: true,
44425
- force: true,
44426
- maxRetries: 5,
44427
- retryDelay: 100
44428
- });
44429
- }
44430
- __name(removeDirSync, "removeDirSync");
44431
44270
  /**
44432
44271
  * Initial draft version of the Build Output API.
44433
44272
  *
@@ -44703,7 +44542,10 @@ const BindingSchema = unknown().transform((value, ctx) => {
44703
44542
  function isParsedUnsafeBinding(binding) {
44704
44543
  return binding.type.startsWith("unsafe:");
44705
44544
  }
44706
- const CacheSchema = strictObject({ enabled: boolean() });
44545
+ const CacheSchema = strictObject({
44546
+ enabled: boolean(),
44547
+ crossVersionCache: boolean().optional()
44548
+ });
44707
44549
  /**
44708
44550
  * Binding types that can only be defined once per worker.
44709
44551
  */
@@ -44733,10 +44575,37 @@ const EnvSchema = record(string(), BindingSchema).superRefine((env$1, ctx) => {
44733
44575
  message: `${listFormatter.format([...duplicates].sort())} bindings can only be defined once`
44734
44576
  });
44735
44577
  }).optional();
44736
- const ExportSchema = discriminatedUnion("type", [strictObject({
44737
- type: literal$1("durable-object"),
44738
- storage: _enum(["sqlite", "legacy-kv"])
44739
- })]);
44578
+ const ExportSchema = union([
44579
+ strictObject({
44580
+ type: literal$1("durable-object"),
44581
+ state: literal$1("created").optional(),
44582
+ storage: _enum(["sqlite", "legacy-kv"])
44583
+ }),
44584
+ strictObject({
44585
+ type: literal$1("durable-object"),
44586
+ state: literal$1("deleted")
44587
+ }),
44588
+ strictObject({
44589
+ type: literal$1("durable-object"),
44590
+ state: literal$1("renamed"),
44591
+ renamedTo: string()
44592
+ }),
44593
+ strictObject({
44594
+ type: literal$1("durable-object"),
44595
+ state: literal$1("transferred"),
44596
+ transferredTo: string()
44597
+ }),
44598
+ strictObject({
44599
+ type: literal$1("durable-object"),
44600
+ state: literal$1("expecting-transfer"),
44601
+ storage: _enum(["sqlite", "legacy-kv"]),
44602
+ transferFrom: string()
44603
+ }),
44604
+ strictObject({
44605
+ type: literal$1("worker"),
44606
+ cache: strictObject({ enabled: boolean() }).optional()
44607
+ })
44608
+ ]);
44740
44609
  const LimitsSchema = strictObject({
44741
44610
  cpuMs: number().optional(),
44742
44611
  subrequests: number().optional()
@@ -44979,7 +44848,11 @@ function convertTopLevel(config$1, result) {
44979
44848
  result.limits = limits;
44980
44849
  }
44981
44850
  if (config$1.observability !== void 0) result.observability = convertObservability(config$1.observability);
44982
- if (config$1.cache !== void 0) result.cache = { enabled: config$1.cache.enabled };
44851
+ if (config$1.cache !== void 0) {
44852
+ const cache$2 = { enabled: config$1.cache.enabled };
44853
+ if (config$1.cache.crossVersionCache !== void 0) cache$2.cross_version_cache = config$1.cache.crossVersionCache;
44854
+ result.cache = cache$2;
44855
+ }
44983
44856
  if (config$1.unsafe !== void 0) result.unsafe = convertUnsafeTopLevel(config$1.unsafe);
44984
44857
  }
44985
44858
  function convertObservability(observability) {
@@ -45336,10 +45209,60 @@ function convertBindingsAndAssets(config$1, result) {
45336
45209
  result.assets = assets;
45337
45210
  }
45338
45211
  }
45339
- function convertExports(config$1, _result) {
45212
+ function convertExports(config$1, result) {
45340
45213
  const exports$2 = config$1.exports;
45341
45214
  if (!exports$2) return;
45342
- for (const value of Object.values(exports$2)) if (value.type === "durable-object") throw new Error("Durable Object exports are not currently supported.");
45215
+ const converted = {};
45216
+ const unknownExports = {};
45217
+ for (const [exportName, value] of Object.entries(exports$2)) {
45218
+ if (value.type === "worker") {
45219
+ converted[exportName] = value;
45220
+ continue;
45221
+ }
45222
+ if (value.type !== "durable-object") {
45223
+ unknownExports[exportName] = value;
45224
+ continue;
45225
+ }
45226
+ switch (value.state) {
45227
+ case void 0:
45228
+ case "created":
45229
+ converted[exportName] = {
45230
+ type: "durable-object",
45231
+ storage: value.storage
45232
+ };
45233
+ break;
45234
+ case "deleted":
45235
+ converted[exportName] = {
45236
+ type: "durable-object",
45237
+ state: "deleted"
45238
+ };
45239
+ break;
45240
+ case "renamed":
45241
+ converted[exportName] = {
45242
+ type: "durable-object",
45243
+ state: "renamed",
45244
+ renamed_to: value.renamedTo
45245
+ };
45246
+ break;
45247
+ case "transferred":
45248
+ converted[exportName] = {
45249
+ type: "durable-object",
45250
+ state: "transferred",
45251
+ transferred_to: value.transferredTo
45252
+ };
45253
+ break;
45254
+ case "expecting-transfer":
45255
+ converted[exportName] = {
45256
+ type: "durable-object",
45257
+ state: "expecting-transfer",
45258
+ storage: value.storage,
45259
+ transfer_from: value.transferFrom
45260
+ };
45261
+ break;
45262
+ }
45263
+ }
45264
+ if (Object.keys(unknownExports).length > 0) throw new UserError$1("Unknown export types found: " + Object.entries(unknownExports).map(([exportName, { type }]) => `- ${exportName} : ${type}`).join("\n"), { telemetryMessage: "Unknown export types found" });
45265
+ if (Object.keys(converted).length > 0) result.exports = converted;
45343
45266
  }
45344
45267
  function convertTriggers(config$1, result) {
45345
45268
  const triggers$1 = config$1.triggers;
@@ -51196,7 +51119,7 @@ function read(jsonPath, { base, specifier }) {
51196
51119
  /** @type {string | undefined} */
51197
51120
  let string$2;
51198
51121
  try {
51199
- string$2 = fs2.readFileSync(path3.toNamespacedPath(jsonPath), "utf8");
51122
+ string$2 = fs2.readFileSync(path2.toNamespacedPath(jsonPath), "utf8");
51200
51123
  } catch (error) {
51201
51124
  const exception = error;
51202
51125
  if (exception.code !== "ENOENT") throw exception;
@@ -51402,7 +51325,7 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
51402
51325
  const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
51403
51326
  const basePath = fileURLToPath(base);
51404
51327
  if (!main) process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
51405
- else if (path3.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
51328
+ else if (path2.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
51406
51329
  }
51407
51330
  /**
51408
51331
  * @param {string} path
@@ -51509,7 +51432,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
51509
51432
  {
51510
51433
  const real = realpathSync(filePath);
51511
51434
  const { search, hash } = resolved;
51512
- resolved = pathToFileURL(real + (filePath.endsWith(path3.sep) ? "/" : ""));
51435
+ resolved = pathToFileURL(real + (filePath.endsWith(path2.sep) ? "/" : ""));
51513
51436
  resolved.search = search;
51514
51437
  resolved.hash = hash;
51515
51438
  }
@@ -52519,9 +52442,9 @@ const ENTRY_MODULE_EXTENSIONS = [
52519
52442
  */
52520
52443
  function maybeResolveMain(main, configPath, root) {
52521
52444
  if (!ENTRY_MODULE_EXTENSIONS.some((extension) => main.endsWith(extension))) return main;
52522
- const baseDir = configPath ? nodePath.dirname(configPath) : root;
52523
- if (!baseDir) return main;
52524
- const resolvedMain = nodePath.resolve(baseDir, main);
52445
+ const baseDir$1 = configPath ? nodePath.dirname(configPath) : root;
52446
+ if (!baseDir$1) return main;
52447
+ const resolvedMain = nodePath.resolve(baseDir$1, main);
52525
52448
  if (!fs$1.existsSync(resolvedMain)) throw new Error(`The provided Wrangler config main field (${resolvedMain}) doesn't point to an existing file`);
52526
52449
  return resolvedMain;
52527
52450
  }
@@ -61568,7 +61491,7 @@ function getContainerOptions(options) {
61568
61491
  return containersConfig.map((container) => {
61569
61492
  if (isDockerfile(container.image, configPath)) return {
61570
61493
  dockerfile: container.image,
61571
- image_build_context: container.image_build_context ?? path3.dirname(container.image),
61494
+ image_build_context: container.image_build_context ?? path2.dirname(container.image),
61572
61495
  image_vars: container.image_vars,
61573
61496
  class_name: container.class_name,
61574
61497
  image_tag: getDevContainerImageName(container.class_name, containerBuildId)
@@ -65515,8 +65438,8 @@ var is_in_ssh_default = isInSsh;
65515
65438
  //#endregion
65516
65439
  //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
65517
65440
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
65518
- const __dirname = import.meta.url ? path3.dirname(fileURLToPath(import.meta.url)) : "";
65519
- const localXdgOpenPath = path3.join(__dirname, "xdg-open");
65441
+ const __dirname = import.meta.url ? path2.dirname(fileURLToPath(import.meta.url)) : "";
65442
+ const localXdgOpenPath = path2.join(__dirname, "xdg-open");
65520
65443
  const { platform, arch: arch$1 } = process$1;
65521
65444
  const tryEachApp = async (apps$1, opener) => {
65522
65445
  if (apps$1.length === 0) return;