@cloudflare/workers-utils 0.24.0 → 0.25.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
@@ -1,728 +1,30 @@
1
- export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-J6D57QVQ.mjs';
2
- export { MetricsRegistry } from './chunk-O4YGOZSW.mjs';
3
- import { isDirectory, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, removeDirSync, ParseError, parseJSON, APIError, parsePackageJSON, readFileSync as readFileSync$1, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-ULVYGN52.mjs';
4
- export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, indexLocation, isDirectory, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation } from './chunk-ULVYGN52.mjs';
5
- import { __commonJS, __name, __require, __export, __toESM, __reExport } from './chunk-DCOBXSFB.mjs';
1
+ export { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings } from './chunk-ELQRF72O.mjs';
2
+ import { getGlobalConfigPath } from './chunk-OTBYAUQ6.mjs';
3
+ export { getGlobalConfigPath, getGlobalWranglerCachePath } from './chunk-OTBYAUQ6.mjs';
4
+ export { MetricsRegistry } from './chunk-TJ6ANXA2.mjs';
5
+ import { partitionExports, UserError, isRedirectedRawConfig, dedent, configFileName, formatConfigSnippet, FatalError, ParseError, parseJSON, APIError, parsePackageJSON, readFileSync as readFileSync$1, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-27EBTAT2.mjs';
6
+ export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, configFileName, configFormat, createFatalError, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, indexLocation, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation } from './chunk-27EBTAT2.mjs';
7
+ import { isDirectory, removeDirSync } from './chunk-OC543JY3.mjs';
8
+ export { isDirectory, removeDir, removeDirSync } from './chunk-OC543JY3.mjs';
9
+ import { __commonJS, __require, __name, __toESM } from './chunk-DDRU76YD.mjs';
6
10
  import fs2, { accessSync, constants, writeFileSync, renameSync, existsSync, unlinkSync, mkdirSync, chmodSync, readFileSync } from 'node:fs';
7
11
  import assert from 'node:assert';
8
- import path3, { join, dirname, basename, resolve } from 'node:path';
9
- import os, { arch } from 'node:os';
12
+ import path2, { join, dirname, basename, resolve } from 'node:path';
10
13
  import { execFileSync, spawn } from 'node:child_process';
11
14
  import { createHash } from 'node:crypto';
15
+ import { arch } from 'node:os';
12
16
  import { fetch, Headers, FormData, Response } from 'undici';
13
17
  import { URLSearchParams } from 'node:url';
14
18
  import * as timersPromises from 'node:timers/promises';
15
19
  import { setTimeout as setTimeout$1 } from 'node:timers/promises';
16
20
 
17
- // ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js
18
- var require_XDGAppPaths = __commonJS({
19
- "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/lib/XDGAppPaths.js"(exports) {
20
- exports.__esModule = true;
21
- exports.Adapt = void 0;
22
- function isBoolean2(t2) {
23
- return typeOf(t2) === "boolean";
24
- }
25
- __name(isBoolean2, "isBoolean");
26
- function isObject(t2) {
27
- return typeOf(t2) === "object";
28
- }
29
- __name(isObject, "isObject");
30
- function isString2(t2) {
31
- return typeOf(t2) === "string";
32
- }
33
- __name(isString2, "isString");
34
- function typeOf(t2) {
35
- return typeof t2;
36
- }
37
- __name(typeOf, "typeOf");
38
- function Adapt(adapter_) {
39
- var meta = adapter_.meta, path5 = adapter_.path, xdg = adapter_.xdg;
40
- var XDGAppPaths_ = /* @__PURE__ */ function() {
41
- function XDGAppPaths_2(options_) {
42
- if (options_ === void 0) {
43
- options_ = {};
44
- }
45
- var _a, _b, _c;
46
- function XDGAppPaths(options2) {
47
- if (options2 === void 0) {
48
- options2 = {};
49
- }
50
- return new XDGAppPaths_2(options2);
51
- }
52
- __name(XDGAppPaths, "XDGAppPaths");
53
- var options = isObject(options_) ? options_ : { name: options_ };
54
- var suffix = (_a = options.suffix) !== null && _a !== void 0 ? _a : "";
55
- var isolated_ = (_b = options.isolated) !== null && _b !== void 0 ? _b : true;
56
- var namePriorityList = [
57
- options.name,
58
- meta.pkgMainFilename(),
59
- meta.mainFilename()
60
- ];
61
- var nameFallback = "$eval";
62
- var name = path5.parse(((_c = namePriorityList.find(function(e2) {
63
- return isString2(e2);
64
- })) !== null && _c !== void 0 ? _c : nameFallback) + suffix).name;
65
- XDGAppPaths.$name = /* @__PURE__ */ __name(function $name() {
66
- return name;
67
- }, "$name");
68
- XDGAppPaths.$isolated = /* @__PURE__ */ __name(function $isolated() {
69
- return isolated_;
70
- }, "$isolated");
71
- function isIsolated(dirOptions) {
72
- var _a2;
73
- dirOptions = dirOptions !== null && dirOptions !== void 0 ? dirOptions : { isolated: isolated_ };
74
- var isolated = isBoolean2(dirOptions) ? dirOptions : (_a2 = dirOptions.isolated) !== null && _a2 !== void 0 ? _a2 : isolated_;
75
- return isolated;
76
- }
77
- __name(isIsolated, "isIsolated");
78
- function finalPathSegment(dirOptions) {
79
- return isIsolated(dirOptions) ? name : "";
80
- }
81
- __name(finalPathSegment, "finalPathSegment");
82
- XDGAppPaths.cache = /* @__PURE__ */ __name(function cache(dirOptions) {
83
- return path5.join(xdg.cache(), finalPathSegment(dirOptions));
84
- }, "cache");
85
- XDGAppPaths.config = /* @__PURE__ */ __name(function config(dirOptions) {
86
- return path5.join(xdg.config(), finalPathSegment(dirOptions));
87
- }, "config");
88
- XDGAppPaths.data = /* @__PURE__ */ __name(function data(dirOptions) {
89
- return path5.join(xdg.data(), finalPathSegment(dirOptions));
90
- }, "data");
91
- XDGAppPaths.runtime = /* @__PURE__ */ __name(function runtime(dirOptions) {
92
- return xdg.runtime() ? path5.join(xdg.runtime(), finalPathSegment(dirOptions)) : void 0;
93
- }, "runtime");
94
- XDGAppPaths.state = /* @__PURE__ */ __name(function state(dirOptions) {
95
- return path5.join(xdg.state(), finalPathSegment(dirOptions));
96
- }, "state");
97
- XDGAppPaths.configDirs = /* @__PURE__ */ __name(function configDirs(dirOptions) {
98
- return xdg.configDirs().map(function(s) {
99
- return path5.join(s, finalPathSegment(dirOptions));
100
- });
101
- }, "configDirs");
102
- XDGAppPaths.dataDirs = /* @__PURE__ */ __name(function dataDirs(dirOptions) {
103
- return xdg.dataDirs().map(function(s) {
104
- return path5.join(s, finalPathSegment(dirOptions));
105
- });
106
- }, "dataDirs");
107
- return XDGAppPaths;
108
- }
109
- __name(XDGAppPaths_2, "XDGAppPaths_");
110
- return XDGAppPaths_2;
111
- }();
112
- return { XDGAppPaths: new XDGAppPaths_() };
113
- }
114
- __name(Adapt, "Adapt");
115
- exports.Adapt = Adapt;
116
- }
117
- });
118
-
119
- // ../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/lib/XDG.js
120
- var require_XDG = __commonJS({
121
- "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/lib/XDG.js"(exports) {
122
- var __spreadArray = exports && exports.__spreadArray || function(to, from) {
123
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
124
- to[j] = from[i];
125
- return to;
126
- };
127
- exports.__esModule = true;
128
- exports.Adapt = void 0;
129
- function Adapt(adapter_) {
130
- var env = adapter_.env, osPaths = adapter_.osPaths, path5 = adapter_.path;
131
- var isMacOS = /^darwin$/i.test(adapter_.process.platform);
132
- var isWinOS = /^win/i.test(adapter_.process.platform);
133
- function baseDir() {
134
- return osPaths.home() || osPaths.temp();
135
- }
136
- __name(baseDir, "baseDir");
137
- function valOrPath(val, pathSegments) {
138
- return val || path5.join.apply(path5, pathSegments);
139
- }
140
- __name(valOrPath, "valOrPath");
141
- var linux = /* @__PURE__ */ __name(function() {
142
- var cache = /* @__PURE__ */ __name(function() {
143
- return valOrPath(env.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
144
- }, "cache");
145
- var config = /* @__PURE__ */ __name(function() {
146
- return valOrPath(env.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
147
- }, "config");
148
- var data = /* @__PURE__ */ __name(function() {
149
- return valOrPath(env.get("XDG_DATA_HOME"), [baseDir(), ".local", "share"]);
150
- }, "data");
151
- var runtime = /* @__PURE__ */ __name(function() {
152
- return env.get("XDG_RUNTIME_DIR") || void 0;
153
- }, "runtime");
154
- var state = /* @__PURE__ */ __name(function() {
155
- return valOrPath(env.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
156
- }, "state");
157
- return { cache, config, data, runtime, state };
158
- }, "linux");
159
- var macos = /* @__PURE__ */ __name(function() {
160
- var cache = /* @__PURE__ */ __name(function() {
161
- return valOrPath(env.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
162
- }, "cache");
163
- var config = /* @__PURE__ */ __name(function() {
164
- return valOrPath(env.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
165
- }, "config");
166
- var data = /* @__PURE__ */ __name(function() {
167
- return valOrPath(env.get("XDG_DATA_HOME"), [baseDir(), "Library", "Application Support"]);
168
- }, "data");
169
- var runtime = /* @__PURE__ */ __name(function() {
170
- return env.get("XDG_RUNTIME_DIR") || void 0;
171
- }, "runtime");
172
- var state = /* @__PURE__ */ __name(function() {
173
- return valOrPath(env.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
174
- }, "state");
175
- return { cache, config, data, runtime, state };
176
- }, "macos");
177
- var windows = /* @__PURE__ */ __name(function() {
178
- function appData() {
179
- return valOrPath(env.get("APPDATA"), [baseDir(), "AppData", "Roaming"]);
180
- }
181
- __name(appData, "appData");
182
- function localAppData() {
183
- return valOrPath(env.get("LOCALAPPDATA"), [baseDir(), "AppData", "Local"]);
184
- }
185
- __name(localAppData, "localAppData");
186
- var cache = /* @__PURE__ */ __name(function() {
187
- return valOrPath(env.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
188
- }, "cache");
189
- var config = /* @__PURE__ */ __name(function() {
190
- return valOrPath(env.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
191
- }, "config");
192
- var data = /* @__PURE__ */ __name(function() {
193
- return valOrPath(env.get("XDG_DATA_HOME"), [appData(), "xdg.data"]);
194
- }, "data");
195
- var runtime = /* @__PURE__ */ __name(function() {
196
- return env.get("XDG_RUNTIME_DIR") || void 0;
197
- }, "runtime");
198
- var state = /* @__PURE__ */ __name(function() {
199
- return valOrPath(env.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
200
- }, "state");
201
- return { cache, config, data, runtime, state };
202
- }, "windows");
203
- var XDG_ = /* @__PURE__ */ function() {
204
- function XDG_2() {
205
- function XDG() {
206
- return new XDG_2();
207
- }
208
- __name(XDG, "XDG");
209
- var extension = isMacOS ? macos() : isWinOS ? windows() : linux();
210
- XDG.cache = extension.cache;
211
- XDG.config = extension.config;
212
- XDG.data = extension.data;
213
- XDG.runtime = extension.runtime;
214
- XDG.state = extension.state;
215
- XDG.configDirs = /* @__PURE__ */ __name(function configDirs() {
216
- var pathList = env.get("XDG_CONFIG_DIRS");
217
- return __spreadArray([extension.config()], pathList ? pathList.split(path5.delimiter) : []);
218
- }, "configDirs");
219
- XDG.dataDirs = /* @__PURE__ */ __name(function dataDirs() {
220
- var pathList = env.get("XDG_DATA_DIRS");
221
- return __spreadArray([extension.data()], pathList ? pathList.split(path5.delimiter) : []);
222
- }, "dataDirs");
223
- return XDG;
224
- }
225
- __name(XDG_2, "XDG_");
226
- return XDG_2;
227
- }();
228
- return { XDG: new XDG_() };
229
- }
230
- __name(Adapt, "Adapt");
231
- exports.Adapt = Adapt;
232
- }
233
- });
234
-
235
- // ../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/lib/OSPaths.js
236
- var require_OSPaths = __commonJS({
237
- "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/lib/OSPaths.js"(exports) {
238
- var __spreadArray = exports && exports.__spreadArray || function(to, from) {
239
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
240
- to[j] = from[i];
241
- return to;
242
- };
243
- exports.__esModule = true;
244
- exports.Adapt = void 0;
245
- function isEmpty(s) {
246
- return !s;
247
- }
248
- __name(isEmpty, "isEmpty");
249
- function Adapt(adapter_) {
250
- var env = adapter_.env, os2 = adapter_.os, path5 = adapter_.path;
251
- var isWinOS = /^win/i.test(adapter_.process.platform);
252
- function normalizePath(path_) {
253
- return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
254
- }
255
- __name(normalizePath, "normalizePath");
256
- function home() {
257
- var posix = /* @__PURE__ */ __name(function() {
258
- return normalizePath((typeof os2.homedir === "function" ? os2.homedir() : void 0) || env.get("HOME"));
259
- }, "posix");
260
- var windows = /* @__PURE__ */ __name(function() {
261
- var priorityList = [
262
- typeof os2.homedir === "function" ? os2.homedir() : void 0,
263
- env.get("USERPROFILE"),
264
- env.get("HOME"),
265
- env.get("HOMEDRIVE") || env.get("HOMEPATH") ? path5.join(env.get("HOMEDRIVE") || "", env.get("HOMEPATH") || "") : void 0
266
- ];
267
- return normalizePath(priorityList.find(function(v) {
268
- return !isEmpty(v);
269
- }));
270
- }, "windows");
271
- return isWinOS ? windows() : posix();
272
- }
273
- __name(home, "home");
274
- function temp() {
275
- function joinPathToBase(base, segments) {
276
- return base ? path5.join.apply(path5, __spreadArray([base], segments)) : void 0;
277
- }
278
- __name(joinPathToBase, "joinPathToBase");
279
- function posix() {
280
- var fallback = "/tmp";
281
- var priorityList = [
282
- typeof os2.tmpdir === "function" ? os2.tmpdir() : void 0,
283
- env.get("TMPDIR"),
284
- env.get("TEMP"),
285
- env.get("TMP")
286
- ];
287
- return normalizePath(priorityList.find(function(v) {
288
- return !isEmpty(v);
289
- })) || fallback;
290
- }
291
- __name(posix, "posix");
292
- function windows() {
293
- var fallback = "C:\\Temp";
294
- var priorityListLazy = [
295
- typeof os2.tmpdir === "function" ? os2.tmpdir : function() {
296
- return void 0;
297
- },
298
- function() {
299
- return env.get("TEMP");
300
- },
301
- function() {
302
- return env.get("TMP");
303
- },
304
- function() {
305
- return joinPathToBase(env.get("LOCALAPPDATA"), ["Temp"]);
306
- },
307
- function() {
308
- return joinPathToBase(home(), ["AppData", "Local", "Temp"]);
309
- },
310
- function() {
311
- return joinPathToBase(env.get("ALLUSERSPROFILE"), ["Temp"]);
312
- },
313
- function() {
314
- return joinPathToBase(env.get("SystemRoot"), ["Temp"]);
315
- },
316
- function() {
317
- return joinPathToBase(env.get("windir"), ["Temp"]);
318
- },
319
- function() {
320
- return joinPathToBase(env.get("SystemDrive"), ["\\", "Temp"]);
321
- }
322
- ];
323
- var v = priorityListLazy.find(function(v2) {
324
- return v2 && !isEmpty(v2());
325
- });
326
- return v && normalizePath(v()) || fallback;
327
- }
328
- __name(windows, "windows");
329
- return isWinOS ? windows() : posix();
330
- }
331
- __name(temp, "temp");
332
- var OSPaths_ = /* @__PURE__ */ function() {
333
- function OSPaths_2() {
334
- function OSPaths() {
335
- return new OSPaths_2();
336
- }
337
- __name(OSPaths, "OSPaths");
338
- OSPaths.home = home;
339
- OSPaths.temp = temp;
340
- return OSPaths;
341
- }
342
- __name(OSPaths_2, "OSPaths_");
343
- return OSPaths_2;
344
- }();
345
- return { OSPaths: new OSPaths_() };
346
- }
347
- __name(Adapt, "Adapt");
348
- exports.Adapt = Adapt;
349
- }
350
- });
351
-
352
- // ../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/platform-adapters/node.js
353
- var require_node = __commonJS({
354
- "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/platform-adapters/node.js"(exports) {
355
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
356
- if (k2 === void 0) k2 = k;
357
- Object.defineProperty(o, k2, { enumerable: true, get: /* @__PURE__ */ __name(function() {
358
- return m[k];
359
- }, "get") });
360
- } : function(o, m, k, k2) {
361
- if (k2 === void 0) k2 = k;
362
- o[k2] = m[k];
363
- });
364
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
365
- Object.defineProperty(o, "default", { enumerable: true, value: v });
366
- } : function(o, v) {
367
- o["default"] = v;
368
- });
369
- var __importStar = exports && exports.__importStar || function(mod) {
370
- if (mod && mod.__esModule) return mod;
371
- var result = {};
372
- if (mod != null) {
373
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
374
- }
375
- __setModuleDefault(result, mod);
376
- return result;
377
- };
378
- exports.__esModule = true;
379
- exports.adapter = void 0;
380
- var os2 = __importStar(__require("os"));
381
- var path5 = __importStar(__require("path"));
382
- exports.adapter = {
383
- atImportPermissions: { env: true },
384
- env: {
385
- get: /* @__PURE__ */ __name(function(s) {
386
- return process.env[s];
387
- }, "get")
388
- },
389
- os: os2,
390
- path: path5,
391
- process
392
- };
393
- }
394
- });
395
-
396
- // ../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/mod.cjs.js
397
- var require_mod_cjs = __commonJS({
398
- "../../node_modules/.pnpm/os-paths@7.4.0/node_modules/os-paths/dist/cjs/mod.cjs.js"(exports, module) {
399
- var OSPaths_js_1 = require_OSPaths();
400
- var node_js_1 = require_node();
401
- module.exports = OSPaths_js_1.Adapt(node_js_1.adapter).OSPaths;
402
- }
403
- });
404
-
405
- // ../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/platform-adapters/node.js
406
- var require_node2 = __commonJS({
407
- "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/platform-adapters/node.js"(exports) {
408
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
409
- if (k2 === void 0) k2 = k;
410
- Object.defineProperty(o, k2, { enumerable: true, get: /* @__PURE__ */ __name(function() {
411
- return m[k];
412
- }, "get") });
413
- } : function(o, m, k, k2) {
414
- if (k2 === void 0) k2 = k;
415
- o[k2] = m[k];
416
- });
417
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
418
- Object.defineProperty(o, "default", { enumerable: true, value: v });
419
- } : function(o, v) {
420
- o["default"] = v;
421
- });
422
- var __importStar = exports && exports.__importStar || function(mod) {
423
- if (mod && mod.__esModule) return mod;
424
- var result = {};
425
- if (mod != null) {
426
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
427
- }
428
- __setModuleDefault(result, mod);
429
- return result;
430
- };
431
- var __importDefault = exports && exports.__importDefault || function(mod) {
432
- return mod && mod.__esModule ? mod : { "default": mod };
433
- };
434
- exports.__esModule = true;
435
- exports.adapter = void 0;
436
- var path5 = __importStar(__require("path"));
437
- var os_paths_1 = __importDefault(require_mod_cjs());
438
- exports.adapter = {
439
- atImportPermissions: { env: true },
440
- env: {
441
- get: /* @__PURE__ */ __name(function(s) {
442
- return process.env[s];
443
- }, "get")
444
- },
445
- osPaths: os_paths_1["default"],
446
- path: path5,
447
- process
448
- };
449
- }
450
- });
451
-
452
- // ../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/mod.cjs.js
453
- var require_mod_cjs2 = __commonJS({
454
- "../../node_modules/.pnpm/xdg-portable@10.6.0/node_modules/xdg-portable/dist/cjs/mod.cjs.js"(exports, module) {
455
- var XDG_js_1 = require_XDG();
456
- var node_js_1 = require_node2();
457
- module.exports = XDG_js_1.Adapt(node_js_1.adapter).XDG;
458
- }
459
- });
460
-
461
- // ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/platform-adapters/node.js
462
- var require_node3 = __commonJS({
463
- "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/platform-adapters/node.js"(exports) {
464
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
465
- if (k2 === void 0) k2 = k;
466
- Object.defineProperty(o, k2, { enumerable: true, get: /* @__PURE__ */ __name(function() {
467
- return m[k];
468
- }, "get") });
469
- } : function(o, m, k, k2) {
470
- if (k2 === void 0) k2 = k;
471
- o[k2] = m[k];
472
- });
473
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
474
- Object.defineProperty(o, "default", { enumerable: true, value: v });
475
- } : function(o, v) {
476
- o["default"] = v;
477
- });
478
- var __importStar = exports && exports.__importStar || function(mod) {
479
- if (mod && mod.__esModule) return mod;
480
- var result = {};
481
- if (mod != null) {
482
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
483
- }
484
- __setModuleDefault(result, mod);
485
- return result;
486
- };
487
- var __importDefault = exports && exports.__importDefault || function(mod) {
488
- return mod && mod.__esModule ? mod : { "default": mod };
489
- };
490
- exports.__esModule = true;
491
- exports.adapter = void 0;
492
- var path5 = __importStar(__require("path"));
493
- var xdg_portable_1 = __importDefault(require_mod_cjs2());
494
- exports.adapter = {
495
- atImportPermissions: { env: true, read: true },
496
- meta: {
497
- mainFilename: /* @__PURE__ */ __name(function() {
498
- var requireMain = typeof __require !== "undefined" && __require !== null && __require.main ? __require.main : { filename: void 0 };
499
- var requireMainFilename = requireMain.filename;
500
- var filename = (requireMainFilename !== process.execArgv[0] ? requireMainFilename : void 0) || (typeof process._eval === "undefined" ? process.argv[1] : void 0);
501
- return filename;
502
- }, "mainFilename"),
503
- pkgMainFilename: /* @__PURE__ */ __name(function() {
504
- return process.pkg ? process.execPath : void 0;
505
- }, "pkgMainFilename")
506
- },
507
- path: path5,
508
- process,
509
- xdg: xdg_portable_1["default"]
510
- };
511
- }
512
- });
513
-
514
- // ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/mod.cjs.js
515
- var require_mod_cjs3 = __commonJS({
516
- "../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/mod.cjs.js"(exports, module) {
517
- var XDGAppPaths_js_1 = require_XDGAppPaths();
518
- var node_js_1 = require_node3();
519
- module.exports = XDGAppPaths_js_1.Adapt(node_js_1.adapter).XDGAppPaths;
520
- }
521
- });
522
-
523
- // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
524
- var require_signals = __commonJS({
525
- "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports, module) {
526
- module.exports = [
527
- "SIGABRT",
528
- "SIGALRM",
529
- "SIGHUP",
530
- "SIGINT",
531
- "SIGTERM"
532
- ];
533
- if (process.platform !== "win32") {
534
- module.exports.push(
535
- "SIGVTALRM",
536
- "SIGXCPU",
537
- "SIGXFSZ",
538
- "SIGUSR2",
539
- "SIGTRAP",
540
- "SIGSYS",
541
- "SIGQUIT",
542
- "SIGIOT"
543
- // should detect profiler and enable/disable accordingly.
544
- // see #21
545
- // 'SIGPROF'
546
- );
547
- }
548
- if (process.platform === "linux") {
549
- module.exports.push(
550
- "SIGIO",
551
- "SIGPOLL",
552
- "SIGPWR",
553
- "SIGSTKFLT",
554
- "SIGUNUSED"
555
- );
556
- }
557
- }
558
- });
559
-
560
- // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
561
- var require_signal_exit = __commonJS({
562
- "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
563
- var process2 = global.process;
564
- var processOk = /* @__PURE__ */ __name(function(process3) {
565
- 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";
566
- }, "processOk");
567
- if (!processOk(process2)) {
568
- module.exports = function() {
569
- return function() {
570
- };
571
- };
572
- } else {
573
- assert3 = __require("assert");
574
- signals = require_signals();
575
- isWin = /^win/i.test(process2.platform);
576
- EE = __require("events");
577
- if (typeof EE !== "function") {
578
- EE = EE.EventEmitter;
579
- }
580
- if (process2.__signal_exit_emitter__) {
581
- emitter = process2.__signal_exit_emitter__;
582
- } else {
583
- emitter = process2.__signal_exit_emitter__ = new EE();
584
- emitter.count = 0;
585
- emitter.emitted = {};
586
- }
587
- if (!emitter.infinite) {
588
- emitter.setMaxListeners(Infinity);
589
- emitter.infinite = true;
590
- }
591
- module.exports = function(cb, opts) {
592
- if (!processOk(global.process)) {
593
- return function() {
594
- };
595
- }
596
- assert3.equal(typeof cb, "function", "a callback must be provided for exit handler");
597
- if (loaded === false) {
598
- load();
599
- }
600
- var ev = "exit";
601
- if (opts && opts.alwaysLast) {
602
- ev = "afterexit";
603
- }
604
- var remove = /* @__PURE__ */ __name(function() {
605
- emitter.removeListener(ev, cb);
606
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
607
- unload();
608
- }
609
- }, "remove");
610
- emitter.on(ev, cb);
611
- return remove;
612
- };
613
- unload = /* @__PURE__ */ __name(function unload2() {
614
- if (!loaded || !processOk(global.process)) {
615
- return;
616
- }
617
- loaded = false;
618
- signals.forEach(function(sig) {
619
- try {
620
- process2.removeListener(sig, sigListeners[sig]);
621
- } catch (er) {
622
- }
623
- });
624
- process2.emit = originalProcessEmit;
625
- process2.reallyExit = originalProcessReallyExit;
626
- emitter.count -= 1;
627
- }, "unload");
628
- module.exports.unload = unload;
629
- emit = /* @__PURE__ */ __name(function emit2(event, code, signal) {
630
- if (emitter.emitted[event]) {
631
- return;
632
- }
633
- emitter.emitted[event] = true;
634
- emitter.emit(event, code, signal);
635
- }, "emit");
636
- sigListeners = {};
637
- signals.forEach(function(sig) {
638
- sigListeners[sig] = /* @__PURE__ */ __name(function listener() {
639
- if (!processOk(global.process)) {
640
- return;
641
- }
642
- var listeners = process2.listeners(sig);
643
- if (listeners.length === emitter.count) {
644
- unload();
645
- emit("exit", null, sig);
646
- emit("afterexit", null, sig);
647
- if (isWin && sig === "SIGHUP") {
648
- sig = "SIGINT";
649
- }
650
- process2.kill(process2.pid, sig);
651
- }
652
- }, "listener");
653
- });
654
- module.exports.signals = function() {
655
- return signals;
656
- };
657
- loaded = false;
658
- load = /* @__PURE__ */ __name(function load2() {
659
- if (loaded || !processOk(global.process)) {
660
- return;
661
- }
662
- loaded = true;
663
- emitter.count += 1;
664
- signals = signals.filter(function(sig) {
665
- try {
666
- process2.on(sig, sigListeners[sig]);
667
- return true;
668
- } catch (er) {
669
- return false;
670
- }
671
- });
672
- process2.emit = processEmit;
673
- process2.reallyExit = processReallyExit;
674
- }, "load");
675
- module.exports.load = load;
676
- originalProcessReallyExit = process2.reallyExit;
677
- processReallyExit = /* @__PURE__ */ __name(function processReallyExit2(code) {
678
- if (!processOk(global.process)) {
679
- return;
680
- }
681
- process2.exitCode = code || /* istanbul ignore next */
682
- 0;
683
- emit("exit", process2.exitCode, null);
684
- emit("afterexit", process2.exitCode, null);
685
- originalProcessReallyExit.call(process2, process2.exitCode);
686
- }, "processReallyExit");
687
- originalProcessEmit = process2.emit;
688
- processEmit = /* @__PURE__ */ __name(function processEmit2(ev, arg) {
689
- if (ev === "exit" && processOk(global.process)) {
690
- if (arg !== void 0) {
691
- process2.exitCode = arg;
692
- }
693
- var ret = originalProcessEmit.apply(this, arguments);
694
- emit("exit", process2.exitCode, null);
695
- emit("afterexit", process2.exitCode, null);
696
- return ret;
697
- } else {
698
- return originalProcessEmit.apply(this, arguments);
699
- }
700
- }, "processEmit");
701
- }
702
- var assert3;
703
- var signals;
704
- var isWin;
705
- var EE;
706
- var emitter;
707
- var unload;
708
- var emit;
709
- var sigListeners;
710
- var loaded;
711
- var load;
712
- var originalProcessReallyExit;
713
- var processReallyExit;
714
- var originalProcessEmit;
715
- var processEmit;
716
- }
717
- });
718
-
719
21
  // ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
720
22
  var require_command_exists = __commonJS({
721
23
  "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports, module) {
722
24
  var exec = __require("child_process").exec;
723
25
  var execSync = __require("child_process").execSync;
724
26
  var fs3 = __require("fs");
725
- var path5 = __require("path");
27
+ var path4 = __require("path");
726
28
  var access = fs3.access;
727
29
  var accessSync2 = fs3.accessSync;
728
30
  var constants2 = fs3.constants || fs3;
@@ -826,8 +128,8 @@ var require_command_exists = __commonJS({
826
128
  cleanInput = /* @__PURE__ */ __name(function(s) {
827
129
  var isPathName = /[\\]/.test(s);
828
130
  if (isPathName) {
829
- var dirname2 = '"' + path5.dirname(s) + '"';
830
- var basename2 = '"' + path5.basename(s) + '"';
131
+ var dirname2 = '"' + path4.dirname(s) + '"';
132
+ var basename2 = '"' + path4.basename(s) + '"';
831
133
  return dirname2 + ":" + basename2;
832
134
  }
833
135
  return '"' + s + '"';
@@ -891,7 +193,7 @@ var require_ini = __commonJS({
891
193
  opt.whitespace = opt.whitespace === true;
892
194
  }
893
195
  var separator = opt.whitespace ? " = " : "=";
894
- Object.keys(obj).forEach(function(k, _2, __) {
196
+ Object.keys(obj).forEach(function(k, _, __) {
895
197
  var val = obj[k];
896
198
  if (val && Array.isArray(val)) {
897
199
  val.forEach(function(item) {
@@ -904,7 +206,7 @@ var require_ini = __commonJS({
904
206
  });
905
207
  if (opt.section && out.length)
906
208
  out = "[" + safe(opt.section) + "]" + eol + out;
907
- children.forEach(function(k, _2, __) {
209
+ children.forEach(function(k, _, __) {
908
210
  var nk = dotSplit(k).join("\\.");
909
211
  var section = (opt.section ? opt.section + "." : "") + nk;
910
212
  var child = encode(obj[k], {
@@ -930,7 +232,7 @@ var require_ini = __commonJS({
930
232
  var section = null;
931
233
  var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
932
234
  var lines = str.split(/[\r\n]+/g);
933
- lines.forEach(function(line, _2, __) {
235
+ lines.forEach(function(line, _, __) {
934
236
  if (!line || line.match(/^\s*[;#]/))
935
237
  return;
936
238
  var match = line.match(re);
@@ -969,14 +271,14 @@ var require_ini = __commonJS({
969
271
  else
970
272
  p[key] = value;
971
273
  });
972
- Object.keys(out).filter(function(k, _2, __) {
274
+ Object.keys(out).filter(function(k, _, __) {
973
275
  if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k]))
974
276
  return false;
975
277
  var parts = dotSplit(k);
976
278
  var p2 = out;
977
279
  var l = parts.pop();
978
280
  var nl = l.replace(/\\\./g, ".");
979
- parts.forEach(function(part, _3, __2) {
281
+ parts.forEach(function(part, _2, __2) {
980
282
  if (part === "__proto__")
981
283
  return;
982
284
  if (!p2[part] || typeof p2[part] !== "object")
@@ -987,7 +289,7 @@ var require_ini = __commonJS({
987
289
  return false;
988
290
  p2[nl] = out[k];
989
291
  return true;
990
- }).forEach(function(del, _2, __) {
292
+ }).forEach(function(del, _, __) {
991
293
  delete out[del];
992
294
  });
993
295
  return out;
@@ -1008,7 +310,7 @@ var require_ini = __commonJS({
1008
310
  val = val.substr(1, val.length - 2);
1009
311
  try {
1010
312
  val = JSON.parse(val);
1011
- } catch (_2) {
313
+ } catch (_) {
1012
314
  }
1013
315
  } else {
1014
316
  var esc = false;
@@ -1111,7 +413,7 @@ var require_utils = __commonJS({
1111
413
  "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
1112
414
  var fs3 = __require("fs");
1113
415
  var ini = require_ini();
1114
- var path5 = __require("path");
416
+ var path4 = __require("path");
1115
417
  var stripJsonComments = require_strip_json_comments();
1116
418
  var parse = exports.parse = function(content) {
1117
419
  if (/^\s*{/.test(content))
@@ -1125,7 +427,7 @@ var require_utils = __commonJS({
1125
427
  for (var i in args)
1126
428
  if ("string" !== typeof args[i])
1127
429
  return;
1128
- var file2 = path5.join.apply(null, args);
430
+ var file2 = path4.join.apply(null, args);
1129
431
  try {
1130
432
  return fs3.readFileSync(file2, "utf-8");
1131
433
  } catch (err) {
@@ -1162,15 +464,15 @@ var require_utils = __commonJS({
1162
464
  return obj;
1163
465
  };
1164
466
  exports.find = function() {
1165
- var rel = path5.join.apply(null, [].slice.call(arguments));
467
+ var rel = path4.join.apply(null, [].slice.call(arguments));
1166
468
  function find2(start, rel2) {
1167
- var file2 = path5.join(start, rel2);
469
+ var file2 = path4.join(start, rel2);
1168
470
  try {
1169
471
  fs3.statSync(file2);
1170
472
  return file2;
1171
473
  } catch (err) {
1172
- if (path5.dirname(start) !== start)
1173
- return find2(path5.dirname(start), rel2);
474
+ if (path4.dirname(start) !== start)
475
+ return find2(path4.dirname(start), rel2);
1174
476
  }
1175
477
  }
1176
478
  __name(find2, "find");
@@ -1660,8 +962,8 @@ var require_registry_auth_token = __commonJS({
1660
962
  return void 0;
1661
963
  }
1662
964
  __name(getLegacyAuthInfo, "getLegacyAuthInfo");
1663
- function normalizePath(path5) {
1664
- return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
965
+ function normalizePath(path4) {
966
+ return path4[path4.length - 1] === "/" ? path4 : path4 + "/";
1665
967
  }
1666
968
  __name(normalizePath, "normalizePath");
1667
969
  function getAuthInfoForUrl(regUrl, npmrc) {
@@ -1861,6 +1163,16 @@ var require_update_check = __commonJS({
1861
1163
  }
1862
1164
  });
1863
1165
 
1166
+ // src/config/durable-object-exports.ts
1167
+ function getDurableObjectExports(exports) {
1168
+ return partitionExports(exports)["durable-object"];
1169
+ }
1170
+ __name(getDurableObjectExports, "getDurableObjectExports");
1171
+ function hasDurableObjectExports(exports) {
1172
+ return Object.keys(getDurableObjectExports(exports)).length > 0;
1173
+ }
1174
+ __name(hasDurableObjectExports, "hasDurableObjectExports");
1175
+
1864
1176
  // src/config/config.ts
1865
1177
  var defaultWranglerConfig = {
1866
1178
  /* COMPUTED_FIELDS */
@@ -1953,6 +1265,7 @@ var defaultWranglerConfig = {
1953
1265
  jsx_factory: "React.createElement",
1954
1266
  jsx_fragment: "React.Fragment",
1955
1267
  migrations: [],
1268
+ exports: {},
1956
1269
  triggers: {
1957
1270
  crons: void 0
1958
1271
  },
@@ -2096,7 +1409,7 @@ var util;
2096
1409
  }
2097
1410
  __name(joinValues, "joinValues");
2098
1411
  util2.joinValues = joinValues;
2099
- util2.jsonStringifyReplacer = (_2, value) => {
1412
+ util2.jsonStringifyReplacer = (_, value) => {
2100
1413
  if (typeof value === "bigint") {
2101
1414
  return value.toString();
2102
1415
  }
@@ -2397,8 +1710,8 @@ function getErrorMap() {
2397
1710
  }
2398
1711
  __name(getErrorMap, "getErrorMap");
2399
1712
  var makeIssue = /* @__PURE__ */ __name((params) => {
2400
- const { data, path: path5, errorMaps, issueData } = params;
2401
- const fullPath = [...path5, ...issueData.path || []];
1713
+ const { data, path: path4, errorMaps, issueData } = params;
1714
+ const fullPath = [...path4, ...issueData.path || []];
2402
1715
  const fullIssue = {
2403
1716
  ...issueData,
2404
1717
  path: fullPath
@@ -2504,11 +1817,11 @@ var ParseInputLazyPath = class {
2504
1817
  static {
2505
1818
  __name(this, "ParseInputLazyPath");
2506
1819
  }
2507
- constructor(parent, value, path5, key) {
1820
+ constructor(parent, value, path4, key) {
2508
1821
  this._cachedPath = [];
2509
1822
  this.parent = parent;
2510
1823
  this.data = value;
2511
- this._path = path5;
1824
+ this._path = path4;
2512
1825
  this._key = key;
2513
1826
  }
2514
1827
  get path() {
@@ -5920,37 +5233,6 @@ z.object({
5920
5233
  timeout: z.number().gte(0).or(z.string()).optional()
5921
5234
  }).strict();
5922
5235
 
5923
- // ../../node_modules/.pnpm/xdg-app-paths@8.3.0/node_modules/xdg-app-paths/dist/cjs/esm-wrapper/mod.esm.js
5924
- var mod_esm_exports = {};
5925
- __export(mod_esm_exports, {
5926
- default: () => mod_esm_default
5927
- });
5928
- var import_mod_cjs = __toESM(require_mod_cjs3(), 1);
5929
- __reExport(mod_esm_exports, __toESM(require_mod_cjs3(), 1));
5930
- var mod_esm_default = import_mod_cjs.default;
5931
-
5932
- // src/global-wrangler-config-path.ts
5933
- function getGlobalConfigPath({
5934
- appName = "wrangler",
5935
- leadingDot = true,
5936
- useLegacyHomeDir = true
5937
- } = {}) {
5938
- const dirName = `${leadingDot ? "." : ""}${appName}`;
5939
- const configDir = mod_esm_default(dirName).config();
5940
- if (useLegacyHomeDir) {
5941
- const legacyConfigDir = path3.join(os.homedir(), dirName);
5942
- if (isDirectory(legacyConfigDir)) {
5943
- return legacyConfigDir;
5944
- }
5945
- }
5946
- return configDir;
5947
- }
5948
- __name(getGlobalConfigPath, "getGlobalConfigPath");
5949
- function getGlobalWranglerConfigPath() {
5950
- return getGlobalConfigPath();
5951
- }
5952
- __name(getGlobalWranglerConfigPath, "getGlobalWranglerConfigPath");
5953
-
5954
5236
  // src/environment-variables/factory.ts
5955
5237
  function getBooleanEnvironmentVariableFactory(options) {
5956
5238
  return () => {
@@ -6104,7 +5386,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
6104
5386
  var getRegistryPath = getEnvironmentVariableFactory({
6105
5387
  variableName: "WRANGLER_REGISTRY_PATH",
6106
5388
  defaultValue() {
6107
- return path3.join(getGlobalWranglerConfigPath(), "registry");
5389
+ return path2.join(getGlobalConfigPath(), "registry");
6108
5390
  }
6109
5391
  });
6110
5392
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({
@@ -6322,9 +5604,9 @@ Please add "${field}" to "env.${envName}".`
6322
5604
  return rawEnv[field] ?? defaultValue;
6323
5605
  }
6324
5606
  __name(notInheritable, "notInheritable");
6325
- function unwindPropertyPath(root, path5) {
5607
+ function unwindPropertyPath(root, path4) {
6326
5608
  let container = root;
6327
- const parts = path5.split(".");
5609
+ const parts = path4.split(".");
6328
5610
  for (let i = 0; i < parts.length - 1; i++) {
6329
5611
  if (!hasProperty(container, parts[i])) {
6330
5612
  return;
@@ -6567,10 +5849,10 @@ var isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && va
6567
5849
  var validateUniqueNameProperty = /* @__PURE__ */ __name((diagnostics, field, value) => {
6568
5850
  if (Array.isArray(value)) {
6569
5851
  const nameCount = /* @__PURE__ */ new Map();
6570
- Object.entries(value).forEach(([_2, entry]) => {
5852
+ Object.entries(value).forEach(([_, entry]) => {
6571
5853
  nameCount.set(entry.name, (nameCount.get(entry.name) ?? 0) + 1);
6572
5854
  });
6573
- const duplicates = Array.from(nameCount.entries()).filter(([_2, count]) => count > 1).map(([name]) => name);
5855
+ const duplicates = Array.from(nameCount.entries()).filter(([_, count]) => count > 1).map(([name]) => name);
6574
5856
  if (duplicates.length > 0) {
6575
5857
  const list = duplicates.join('", "');
6576
5858
  diagnostics.errors.push(
@@ -6703,7 +5985,7 @@ function isPagesConfig(rawConfig) {
6703
5985
  __name(isPagesConfig, "isPagesConfig");
6704
5986
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
6705
5987
  const diagnostics = new Diagnostics(
6706
- `Processing ${configPath ? path3.relative(process.cwd(), configPath) : "wrangler"} configuration:`
5988
+ `Processing ${configPath ? path2.relative(process.cwd(), configPath) : "wrangler"} configuration:`
6707
5989
  );
6708
5990
  validateOptionalProperty(
6709
5991
  diagnostics,
@@ -6928,13 +6210,13 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
6928
6210
  // be configured in the Wrangler configuration file, but who knows, that may
6929
6211
  // change in the future, so we do a check anyway
6930
6212
  command && configPath ? Array.isArray(watch_dir) ? watch_dir.map(
6931
- (dir) => path3.relative(
6213
+ (dir) => path2.relative(
6932
6214
  process.cwd(),
6933
- path3.join(path3.dirname(configPath), `${dir}`)
6215
+ path2.join(path2.dirname(configPath), `${dir}`)
6934
6216
  )
6935
- ) : path3.relative(
6217
+ ) : path2.relative(
6936
6218
  process.cwd(),
6937
- path3.join(path3.dirname(configPath), `${watch_dir}`)
6219
+ path2.join(path2.dirname(configPath), `${watch_dir}`)
6938
6220
  ) : watch_dir
6939
6221
  ),
6940
6222
  cwd
@@ -6942,11 +6224,11 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
6942
6224
  }
6943
6225
  __name(normalizeAndValidateBuild, "normalizeAndValidateBuild");
6944
6226
  function normalizeAndValidateMainField(configPath, rawMain) {
6945
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
6227
+ const configDir = path2.dirname(configPath ?? "wrangler.toml");
6946
6228
  if (rawMain !== void 0) {
6947
6229
  if (typeof rawMain === "string") {
6948
- const directory = path3.resolve(configDir);
6949
- return path3.resolve(directory, rawMain);
6230
+ const directory = path2.resolve(configDir);
6231
+ return path2.resolve(directory, rawMain);
6950
6232
  } else {
6951
6233
  return rawMain;
6952
6234
  }
@@ -6956,11 +6238,11 @@ function normalizeAndValidateMainField(configPath, rawMain) {
6956
6238
  }
6957
6239
  __name(normalizeAndValidateMainField, "normalizeAndValidateMainField");
6958
6240
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
6959
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
6241
+ const configDir = path2.dirname(configPath ?? "wrangler.toml");
6960
6242
  if (rawDir !== void 0) {
6961
6243
  if (typeof rawDir === "string") {
6962
- const directory = path3.resolve(configDir);
6963
- return path3.resolve(directory, rawDir);
6244
+ const directory = path2.resolve(configDir);
6245
+ return path2.resolve(directory, rawDir);
6964
6246
  } else {
6965
6247
  return rawDir;
6966
6248
  }
@@ -6970,11 +6252,11 @@ function normalizeAndValidateBaseDirField(configPath, rawDir) {
6970
6252
  }
6971
6253
  __name(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
6972
6254
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
6973
- const configDir = path3.dirname(configPath ?? "wrangler.toml");
6255
+ const configDir = path2.dirname(configPath ?? "wrangler.toml");
6974
6256
  if (rawPagesDir !== void 0) {
6975
6257
  if (typeof rawPagesDir === "string") {
6976
- const directory = path3.resolve(configDir);
6977
- return path3.resolve(directory, rawPagesDir);
6258
+ const directory = path2.resolve(configDir);
6259
+ return path2.resolve(directory, rawPagesDir);
6978
6260
  } else {
6979
6261
  return rawPagesDir;
6980
6262
  }
@@ -7115,11 +6397,12 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
7115
6397
  validateRequiredProperty(diagnostics, "site", "bucket", bucket, "string");
7116
6398
  validateTypedArray(diagnostics, "sites.include", include, "string");
7117
6399
  validateTypedArray(diagnostics, "sites.exclude", exclude, "string");
6400
+ const legacySiteEntryPoint = rawConfig.site["entry-point"];
7118
6401
  validateOptionalProperty(
7119
6402
  diagnostics,
7120
6403
  "site",
7121
6404
  "entry-point",
7122
- rawConfig.site["entry-point"],
6405
+ legacySiteEntryPoint,
7123
6406
  "string"
7124
6407
  );
7125
6408
  deprecated(
@@ -7128,16 +6411,16 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
7128
6411
  `site.entry-point`,
7129
6412
  `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
7130
6413
  \`\`\`
7131
- main = "${path3.join(
7132
- String(rawConfig.site["entry-point"]) || "workers-site",
7133
- path3.extname(String(rawConfig.site["entry-point"]) || "workers-site") ? "" : "index.js"
6414
+ main = "${path2.join(
6415
+ String(legacySiteEntryPoint) || "workers-site",
6416
+ path2.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js"
7134
6417
  )}"
7135
6418
  \`\`\``,
7136
6419
  false,
7137
6420
  void 0,
7138
6421
  "warning"
7139
6422
  );
7140
- let siteEntryPoint = rawConfig.site["entry-point"];
6423
+ let siteEntryPoint = legacySiteEntryPoint;
7141
6424
  if (!mainEntryPoint && !siteEntryPoint) {
7142
6425
  diagnostics.warnings.push(
7143
6426
  `Because you've defined a [site] configuration, we're defaulting to "workers-site" for the deprecated \`site.entry-point\`field.
@@ -7155,9 +6438,9 @@ Delete the deprecated \`site.entry-point\` field from your config.`
7155
6438
  );
7156
6439
  }
7157
6440
  if (configPath && siteEntryPoint) {
7158
- siteEntryPoint = path3.relative(
6441
+ siteEntryPoint = path2.relative(
7159
6442
  process.cwd(),
7160
- path3.join(path3.dirname(configPath), siteEntryPoint)
6443
+ path2.join(path2.dirname(configPath), siteEntryPoint)
7161
6444
  );
7162
6445
  }
7163
6446
  return {
@@ -7203,9 +6486,9 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
7203
6486
  for (const [name, filePath] of Object.entries(rawMapping)) {
7204
6487
  if (isString(diagnostics, `${field}['${name}']`, filePath, void 0)) {
7205
6488
  if (configPath) {
7206
- mapping[name] = configPath ? path3.relative(
6489
+ mapping[name] = configPath ? path2.relative(
7207
6490
  process.cwd(),
7208
- path3.join(path3.dirname(configPath), filePath)
6491
+ path2.join(path2.dirname(configPath), filePath)
7209
6492
  ) : filePath;
7210
6493
  }
7211
6494
  }
@@ -7765,6 +7048,14 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
7765
7048
  validateMigrations,
7766
7049
  []
7767
7050
  ),
7051
+ exports: inheritable(
7052
+ diagnostics,
7053
+ topLevelEnv,
7054
+ rawEnv,
7055
+ "exports",
7056
+ validateExports,
7057
+ {}
7058
+ ),
7768
7059
  kv_namespaces: notInheritable(
7769
7060
  diagnostics,
7770
7061
  topLevelEnv,
@@ -8214,12 +7505,18 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
8214
7505
  void 0
8215
7506
  )
8216
7507
  };
8217
- warnIfDurableObjectsHaveNoMigrations(
7508
+ warnIfDurableObjectsHaveNoLifecycleConfig(
8218
7509
  diagnostics,
8219
7510
  environment.durable_objects,
8220
7511
  environment.migrations,
7512
+ environment.exports,
8221
7513
  configPath
8222
7514
  );
7515
+ errorIfMigrationsAndExportsBothSet(
7516
+ diagnostics,
7517
+ environment.migrations,
7518
+ environment.exports
7519
+ );
8223
7520
  if (envName !== "top level") {
8224
7521
  validateAdditionalProperties(
8225
7522
  diagnostics,
@@ -8240,9 +7537,9 @@ function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPa
8240
7537
  isString,
8241
7538
  void 0
8242
7539
  );
8243
- return configPath && tsconfig ? path3.relative(
7540
+ return configPath && tsconfig ? path2.relative(
8244
7541
  process.cwd(),
8245
- path3.join(path3.dirname(configPath), tsconfig)
7542
+ path2.join(path2.dirname(configPath), tsconfig)
8246
7543
  ) : tsconfig;
8247
7544
  }
8248
7545
  __name(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
@@ -9116,9 +8413,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
9116
8413
  let resolvedBuildContextPath = void 0;
9117
8414
  try {
9118
8415
  if (isDockerfile(resolvedImage, configPath)) {
9119
- const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
9120
- resolvedImage = path3.resolve(baseDir, resolvedImage);
9121
- resolvedBuildContextPath = containerAppOptional.image_build_context ? path3.resolve(baseDir, containerAppOptional.image_build_context) : path3.dirname(resolvedImage);
8416
+ const baseDir = configPath ? path2.dirname(configPath) : process.cwd();
8417
+ resolvedImage = path2.resolve(baseDir, resolvedImage);
8418
+ resolvedBuildContextPath = containerAppOptional.image_build_context ? path2.resolve(baseDir, containerAppOptional.image_build_context) : path2.dirname(resolvedImage);
9122
8419
  }
9123
8420
  } catch (err) {
9124
8421
  if (err instanceof Error && err.message) {
@@ -9787,6 +9084,38 @@ var validateD1Binding = /* @__PURE__ */ __name((diagnostics, field, value) => {
9787
9084
  );
9788
9085
  isValid2 = false;
9789
9086
  }
9087
+ if (!isOptionalProperty(value, "database_name", "string")) {
9088
+ diagnostics.errors.push(
9089
+ `"${field}" bindings should, optionally, have a string "database_name" field but got ${JSON.stringify(
9090
+ value
9091
+ )}.`
9092
+ );
9093
+ isValid2 = false;
9094
+ }
9095
+ if (!isOptionalProperty(value, "migrations_dir", "string")) {
9096
+ diagnostics.errors.push(
9097
+ `"${field}" bindings should, optionally, have a string "migrations_dir" field but got ${JSON.stringify(
9098
+ value
9099
+ )}.`
9100
+ );
9101
+ isValid2 = false;
9102
+ }
9103
+ if (!isOptionalProperty(value, "migrations_table", "string")) {
9104
+ diagnostics.errors.push(
9105
+ `"${field}" bindings should, optionally, have a string "migrations_table" field but got ${JSON.stringify(
9106
+ value
9107
+ )}.`
9108
+ );
9109
+ isValid2 = false;
9110
+ }
9111
+ if (!isOptionalProperty(value, "database_internal_env", "string")) {
9112
+ diagnostics.errors.push(
9113
+ `"${field}" bindings should, optionally, have a string "database_internal_env" field but got ${JSON.stringify(
9114
+ value
9115
+ )}.`
9116
+ );
9117
+ isValid2 = false;
9118
+ }
9790
9119
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
9791
9120
  "binding",
9792
9121
  "database_id",
@@ -11127,6 +10456,210 @@ var validateMigrations = /* @__PURE__ */ __name((diagnostics, field, value) => {
11127
10456
  }
11128
10457
  return valid;
11129
10458
  }, "validateMigrations");
10459
+ var VALID_EXPORT_STORAGES = /* @__PURE__ */ new Set(["sqlite", "legacy-kv"]);
10460
+ var JS_IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
10461
+ function validateDurableObjectExportProperties(diagnostics, className, durableObjectExport, allowedProperties) {
10462
+ let valid = true;
10463
+ for (const key of Object.keys(durableObjectExport)) {
10464
+ if (!allowedProperties.includes(key)) {
10465
+ diagnostics.errors.push(
10466
+ `"exports.${className}.${key}" is forbidden on state "${durableObjectExport.state ?? "created"}".`
10467
+ );
10468
+ valid = false;
10469
+ }
10470
+ }
10471
+ if (!valid) {
10472
+ diagnostics.errors.push(
10473
+ `Allowed properties are: ${ENGLISH.format(allowedProperties)}.`
10474
+ );
10475
+ }
10476
+ return valid;
10477
+ }
10478
+ __name(validateDurableObjectExportProperties, "validateDurableObjectExportProperties");
10479
+ function validateDurableObjectExport(diagnostics, className, durableObjectExport) {
10480
+ let valid = true;
10481
+ if (className === "") {
10482
+ diagnostics.errors.push(`"export" keys cannot be the empty string.`);
10483
+ valid = false;
10484
+ }
10485
+ switch (durableObjectExport.state) {
10486
+ case void 0:
10487
+ case "created": {
10488
+ if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
10489
+ diagnostics.errors.push(
10490
+ `"exports.${className}.storage" is required for state "created" and must be one of ${ENGLISH.format(VALID_EXPORT_STORAGES)}, but got ${JSON.stringify(durableObjectExport.storage)}`
10491
+ );
10492
+ valid = false;
10493
+ }
10494
+ valid = validateDurableObjectExportProperties(
10495
+ diagnostics,
10496
+ className,
10497
+ durableObjectExport,
10498
+ ["type", "state", "storage"]
10499
+ ) && valid;
10500
+ break;
10501
+ }
10502
+ case "deleted": {
10503
+ valid = validateDurableObjectExportProperties(
10504
+ diagnostics,
10505
+ className,
10506
+ durableObjectExport,
10507
+ ["type", "state"]
10508
+ ) && valid;
10509
+ break;
10510
+ }
10511
+ case "renamed": {
10512
+ if (typeof durableObjectExport.renamed_to !== "string" || durableObjectExport.renamed_to === "") {
10513
+ diagnostics.errors.push(
10514
+ `"exports.${className}.renamed_to" is required for state "renamed" and must be a non-empty string.`
10515
+ );
10516
+ valid = false;
10517
+ } else {
10518
+ if (!JS_IDENTIFIER_RE.test(durableObjectExport.renamed_to)) {
10519
+ diagnostics.errors.push(
10520
+ `"exports.${className}.renamed_to" must be a valid JavaScript identifier (got "${durableObjectExport.renamed_to}").`
10521
+ );
10522
+ valid = false;
10523
+ }
10524
+ if (durableObjectExport.renamed_to === className) {
10525
+ diagnostics.errors.push(
10526
+ `"exports.${className}.renamed_to" cannot equal the source class name "${className}".`
10527
+ );
10528
+ valid = false;
10529
+ }
10530
+ }
10531
+ valid = validateDurableObjectExportProperties(
10532
+ diagnostics,
10533
+ className,
10534
+ durableObjectExport,
10535
+ ["type", "state", "renamed_to"]
10536
+ ) && valid;
10537
+ break;
10538
+ }
10539
+ case "transferred": {
10540
+ if (typeof durableObjectExport.transferred_to !== "string" || durableObjectExport.transferred_to === "") {
10541
+ diagnostics.errors.push(
10542
+ `"exports.${className}.transferred_to" is required for state "transferred" and must be a non-empty string.`
10543
+ );
10544
+ valid = false;
10545
+ }
10546
+ valid = validateDurableObjectExportProperties(
10547
+ diagnostics,
10548
+ className,
10549
+ durableObjectExport,
10550
+ ["type", "state", "transferred_to"]
10551
+ ) && valid;
10552
+ break;
10553
+ }
10554
+ case "expecting-transfer": {
10555
+ if (typeof durableObjectExport.storage !== "string" || !VALID_EXPORT_STORAGES.has(durableObjectExport.storage)) {
10556
+ diagnostics.errors.push(
10557
+ `"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)}`
10558
+ );
10559
+ valid = false;
10560
+ }
10561
+ if (typeof durableObjectExport.transfer_from !== "string" || durableObjectExport.transfer_from === "") {
10562
+ diagnostics.errors.push(
10563
+ `"exports.${className}.transfer_from" is required for state "expecting-transfer" and must be a non-empty string.`
10564
+ );
10565
+ valid = false;
10566
+ }
10567
+ valid = validateDurableObjectExportProperties(
10568
+ diagnostics,
10569
+ className,
10570
+ durableObjectExport,
10571
+ ["type", "state", "storage", "transfer_from"]
10572
+ ) && valid;
10573
+ break;
10574
+ }
10575
+ default: {
10576
+ const state = durableObjectExport.state;
10577
+ diagnostics.errors.push(
10578
+ `"exports.${className}.state" must be one of "created", "deleted", "renamed", "transferred", or "expecting-transfer" but got ${JSON.stringify(state)}.`
10579
+ );
10580
+ valid = false;
10581
+ }
10582
+ }
10583
+ return valid;
10584
+ }
10585
+ __name(validateDurableObjectExport, "validateDurableObjectExport");
10586
+ function validateWorkerExport(diagnostics, exportName, workerExport) {
10587
+ let valid = true;
10588
+ valid = validateAdditionalProperties(
10589
+ diagnostics,
10590
+ `exports.${exportName}`,
10591
+ Object.keys(workerExport),
10592
+ ["type", "cache"]
10593
+ ) && valid;
10594
+ valid = validateWorkerExportCache(
10595
+ diagnostics,
10596
+ `exports.${exportName}.cache`,
10597
+ workerExport.cache
10598
+ ) && valid;
10599
+ return valid;
10600
+ }
10601
+ __name(validateWorkerExport, "validateWorkerExport");
10602
+ function validateWorkerExportCache(diagnostics, field, value) {
10603
+ if (value === void 0) {
10604
+ return true;
10605
+ }
10606
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
10607
+ diagnostics.errors.push(
10608
+ `"${field}" should be an object but got ${JSON.stringify(value)}.`
10609
+ );
10610
+ return false;
10611
+ }
10612
+ const cache = value;
10613
+ let valid = true;
10614
+ valid = validateRequiredProperty(
10615
+ diagnostics,
10616
+ field,
10617
+ "enabled",
10618
+ cache.enabled,
10619
+ "boolean"
10620
+ ) && valid;
10621
+ valid = validateAdditionalProperties(diagnostics, field, Object.keys(cache), [
10622
+ "enabled"
10623
+ ]) && valid;
10624
+ return valid;
10625
+ }
10626
+ __name(validateWorkerExportCache, "validateWorkerExportCache");
10627
+ var validateExports = /* @__PURE__ */ __name((diagnostics, field, value) => {
10628
+ if (value === void 0 || value === null) {
10629
+ return true;
10630
+ }
10631
+ if (typeof value !== "object" || Array.isArray(value)) {
10632
+ diagnostics.errors.push(
10633
+ `The optional "${field}" field should be an object keyed by class name, but got ${JSON.stringify(
10634
+ value
10635
+ )}`
10636
+ );
10637
+ return false;
10638
+ }
10639
+ let valid = true;
10640
+ for (const [exportName, exportConfig] of Object.entries(value)) {
10641
+ if (typeof exportConfig !== "object" || exportConfig === null) {
10642
+ diagnostics.errors.push(
10643
+ `"exports.${exportName}" should be an object but got ${JSON.stringify(
10644
+ exportConfig
10645
+ )}.`
10646
+ );
10647
+ valid = false;
10648
+ continue;
10649
+ }
10650
+ if (exportConfig.type === "durable-object") {
10651
+ valid = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid;
10652
+ } else if (exportConfig.type === "worker") {
10653
+ valid = validateWorkerExport(diagnostics, exportName, exportConfig) && valid;
10654
+ } else {
10655
+ valid = false;
10656
+ diagnostics.errors.push(
10657
+ `"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`
10658
+ );
10659
+ }
10660
+ }
10661
+ return valid;
10662
+ }, "validateExports");
11130
10663
  var validateObservability = /* @__PURE__ */ __name((diagnostics, field, value) => {
11131
10664
  if (value === void 0) {
11132
10665
  return true;
@@ -11282,43 +10815,71 @@ var validateCache = /* @__PURE__ */ __name((diagnostics, field, value) => {
11282
10815
  val.enabled,
11283
10816
  "boolean"
11284
10817
  ) && isValid2;
10818
+ isValid2 = validateOptionalProperty(
10819
+ diagnostics,
10820
+ field,
10821
+ "cross_version_cache",
10822
+ val.cross_version_cache,
10823
+ "boolean"
10824
+ ) && isValid2;
11285
10825
  isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
11286
- "enabled"
10826
+ "enabled",
10827
+ "cross_version_cache"
11287
10828
  ]) && isValid2;
11288
10829
  return isValid2;
11289
10830
  }, "validateCache");
11290
- function warnIfDurableObjectsHaveNoMigrations(diagnostics, durableObjects, migrations, configPath) {
11291
- if (Array.isArray(durableObjects.bindings) && durableObjects.bindings.length > 0) {
11292
- const exportedDurableObjects = (durableObjects.bindings || []).filter(
11293
- (binding) => !binding.script_name
11294
- );
11295
- if (exportedDurableObjects.length > 0 && migrations.length === 0) {
11296
- if (!exportedDurableObjects.some(
11297
- (exportedDurableObject) => typeof exportedDurableObject.class_name !== "string"
11298
- )) {
11299
- const durableObjectClassnames = exportedDurableObjects.map(
11300
- (durable) => durable.class_name
11301
- );
11302
- diagnostics.warnings.push(dedent`
11303
- In your ${configFileName(configPath)} file, you have configured \`durable_objects\` exported by this Worker (${durableObjectClassnames.join(", ")}), but no \`migrations\` for them. This may not work as expected until you add a \`migrations\` section to your ${configFileName(configPath)} file. Add the following configuration:
11304
-
11305
- \`\`\`
11306
- ${formatConfigSnippet(
11307
- {
11308
- migrations: [
11309
- { tag: "v1", new_sqlite_classes: durableObjectClassnames }
11310
- ]
11311
- },
11312
- configPath
11313
- )}
11314
- \`\`\`
11315
-
11316
- Refer to https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/ for more details.`);
11317
- }
10831
+ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports, configPath) {
10832
+ if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) {
10833
+ return;
10834
+ }
10835
+ const exportedDurableObjects = durableObjects.bindings.filter(
10836
+ (binding) => !binding.script_name
10837
+ );
10838
+ const exportsCovers = /* @__PURE__ */ __name((className) => {
10839
+ const entry = exports?.[className];
10840
+ if (entry === void 0 || entry.type !== "durable-object") {
10841
+ return false;
11318
10842
  }
10843
+ const state = entry.state ?? "created";
10844
+ return state === "created" || state === "expecting-transfer";
10845
+ }, "exportsCovers");
10846
+ const uncoveredByExports = exportedDurableObjects.filter(
10847
+ (binding) => typeof binding.class_name !== "string" || !exportsCovers(binding.class_name)
10848
+ );
10849
+ if (uncoveredByExports.length === 0 || migrations.length > 0) {
10850
+ return;
10851
+ }
10852
+ if (uncoveredByExports.some(
10853
+ (exportedDurableObject) => typeof exportedDurableObject.class_name !== "string"
10854
+ )) {
10855
+ return;
10856
+ }
10857
+ const durableObjectClassnames = uncoveredByExports.map(
10858
+ (durable) => durable.class_name
10859
+ );
10860
+ const suggestedExports = {};
10861
+ for (const className of durableObjectClassnames) {
10862
+ suggestedExports[className] = {
10863
+ type: "durable-object",
10864
+ storage: "sqlite"
10865
+ };
10866
+ }
10867
+ diagnostics.warnings.push(dedent`
10868
+ In your ${configFileName(configPath)} file, you have configured \`durable_objects\` exported by this Worker (${durableObjectClassnames.join(", ")}), but no live \`exports\` entry for them. This may not work as expected until you add a live \`durable-object\` entry to \`exports\` for each. Add the following configuration:
10869
+
10870
+ \`\`\`
10871
+ ${formatConfigSnippet({ exports: suggestedExports }, configPath)}
10872
+ \`\`\``);
10873
+ }
10874
+ __name(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
10875
+ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports) {
10876
+ if (migrations.length > 0 && exports !== void 0 && Object.values(exports).some((entry) => entry.type === "durable-object")) {
10877
+ diagnostics.errors.push(
10878
+ `\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`
10879
+ );
11319
10880
  }
11320
10881
  }
11321
- __name(warnIfDurableObjectsHaveNoMigrations, "warnIfDurableObjectsHaveNoMigrations");
10882
+ __name(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
11322
10883
  var validatePythonModules = /* @__PURE__ */ __name((diagnostics, field, value, topLevelEnv) => {
11323
10884
  if (value === void 0) {
11324
10885
  return true;
@@ -11351,8 +10912,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
11351
10912
  }
11352
10913
  __name(isRemoteValid, "isRemoteValid");
11353
10914
  function isDockerfile(imagePath, configPath) {
11354
- const baseDir = configPath ? path3.dirname(configPath) : process.cwd();
11355
- const maybeDockerfile = path3.resolve(baseDir, imagePath);
10915
+ const baseDir = configPath ? path2.dirname(configPath) : process.cwd();
10916
+ const maybeDockerfile = path2.resolve(baseDir, imagePath);
11356
10917
  if (fs2.existsSync(maybeDockerfile)) {
11357
10918
  if (isDirectory(maybeDockerfile)) {
11358
10919
  throw new UserError(
@@ -11577,11 +11138,273 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
11577
11138
  }
11578
11139
  __name(validateDurableObjectBinding2, "validateDurableObjectBinding");
11579
11140
 
11141
+ // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
11142
+ var signals = [];
11143
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
11144
+ if (process.platform !== "win32") {
11145
+ signals.push(
11146
+ "SIGALRM",
11147
+ "SIGABRT",
11148
+ "SIGVTALRM",
11149
+ "SIGXCPU",
11150
+ "SIGXFSZ",
11151
+ "SIGUSR2",
11152
+ "SIGTRAP",
11153
+ "SIGSYS",
11154
+ "SIGQUIT",
11155
+ "SIGIOT"
11156
+ // should detect profiler and enable/disable accordingly.
11157
+ // see #21
11158
+ // 'SIGPROF'
11159
+ );
11160
+ }
11161
+ if (process.platform === "linux") {
11162
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
11163
+ }
11164
+
11165
+ // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
11166
+ var processOk = /* @__PURE__ */ __name((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");
11167
+ var kExitEmitter = Symbol.for("signal-exit emitter");
11168
+ var global = globalThis;
11169
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
11170
+ var Emitter = class {
11171
+ static {
11172
+ __name(this, "Emitter");
11173
+ }
11174
+ emitted = {
11175
+ afterExit: false,
11176
+ exit: false
11177
+ };
11178
+ listeners = {
11179
+ afterExit: [],
11180
+ exit: []
11181
+ };
11182
+ count = 0;
11183
+ id = Math.random();
11184
+ constructor() {
11185
+ if (global[kExitEmitter]) {
11186
+ return global[kExitEmitter];
11187
+ }
11188
+ ObjectDefineProperty(global, kExitEmitter, {
11189
+ value: this,
11190
+ writable: false,
11191
+ enumerable: false,
11192
+ configurable: false
11193
+ });
11194
+ }
11195
+ on(ev, fn) {
11196
+ this.listeners[ev].push(fn);
11197
+ }
11198
+ removeListener(ev, fn) {
11199
+ const list = this.listeners[ev];
11200
+ const i = list.indexOf(fn);
11201
+ if (i === -1) {
11202
+ return;
11203
+ }
11204
+ if (i === 0 && list.length === 1) {
11205
+ list.length = 0;
11206
+ } else {
11207
+ list.splice(i, 1);
11208
+ }
11209
+ }
11210
+ emit(ev, code, signal) {
11211
+ if (this.emitted[ev]) {
11212
+ return false;
11213
+ }
11214
+ this.emitted[ev] = true;
11215
+ let ret = false;
11216
+ for (const fn of this.listeners[ev]) {
11217
+ ret = fn(code, signal) === true || ret;
11218
+ }
11219
+ if (ev === "exit") {
11220
+ ret = this.emit("afterExit", code, signal) || ret;
11221
+ }
11222
+ return ret;
11223
+ }
11224
+ };
11225
+ var SignalExitBase = class {
11226
+ static {
11227
+ __name(this, "SignalExitBase");
11228
+ }
11229
+ };
11230
+ var signalExitWrap = /* @__PURE__ */ __name((handler) => {
11231
+ return {
11232
+ onExit(cb, opts) {
11233
+ return handler.onExit(cb, opts);
11234
+ },
11235
+ load() {
11236
+ return handler.load();
11237
+ },
11238
+ unload() {
11239
+ return handler.unload();
11240
+ }
11241
+ };
11242
+ }, "signalExitWrap");
11243
+ var SignalExitFallback = class extends SignalExitBase {
11244
+ static {
11245
+ __name(this, "SignalExitFallback");
11246
+ }
11247
+ onExit() {
11248
+ return () => {
11249
+ };
11250
+ }
11251
+ load() {
11252
+ }
11253
+ unload() {
11254
+ }
11255
+ };
11256
+ var SignalExit = class extends SignalExitBase {
11257
+ static {
11258
+ __name(this, "SignalExit");
11259
+ }
11260
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
11261
+ // so use a supported signal instead
11262
+ /* c8 ignore start */
11263
+ #hupSig = process2.platform === "win32" ? "SIGINT" : "SIGHUP";
11264
+ /* c8 ignore stop */
11265
+ #emitter = new Emitter();
11266
+ #process;
11267
+ #originalProcessEmit;
11268
+ #originalProcessReallyExit;
11269
+ #sigListeners = {};
11270
+ #loaded = false;
11271
+ constructor(process3) {
11272
+ super();
11273
+ this.#process = process3;
11274
+ this.#sigListeners = {};
11275
+ for (const sig of signals) {
11276
+ this.#sigListeners[sig] = () => {
11277
+ const listeners = this.#process.listeners(sig);
11278
+ let { count } = this.#emitter;
11279
+ const p = process3;
11280
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
11281
+ count += p.__signal_exit_emitter__.count;
11282
+ }
11283
+ if (listeners.length === count) {
11284
+ this.unload();
11285
+ const ret = this.#emitter.emit("exit", null, sig);
11286
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
11287
+ if (!ret)
11288
+ process3.kill(process3.pid, s);
11289
+ }
11290
+ };
11291
+ }
11292
+ this.#originalProcessReallyExit = process3.reallyExit;
11293
+ this.#originalProcessEmit = process3.emit;
11294
+ }
11295
+ onExit(cb, opts) {
11296
+ if (!processOk(this.#process)) {
11297
+ return () => {
11298
+ };
11299
+ }
11300
+ if (this.#loaded === false) {
11301
+ this.load();
11302
+ }
11303
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
11304
+ this.#emitter.on(ev, cb);
11305
+ return () => {
11306
+ this.#emitter.removeListener(ev, cb);
11307
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
11308
+ this.unload();
11309
+ }
11310
+ };
11311
+ }
11312
+ load() {
11313
+ if (this.#loaded) {
11314
+ return;
11315
+ }
11316
+ this.#loaded = true;
11317
+ this.#emitter.count += 1;
11318
+ for (const sig of signals) {
11319
+ try {
11320
+ const fn = this.#sigListeners[sig];
11321
+ if (fn)
11322
+ this.#process.on(sig, fn);
11323
+ } catch (_) {
11324
+ }
11325
+ }
11326
+ this.#process.emit = (ev, ...a) => {
11327
+ return this.#processEmit(ev, ...a);
11328
+ };
11329
+ this.#process.reallyExit = (code) => {
11330
+ return this.#processReallyExit(code);
11331
+ };
11332
+ }
11333
+ unload() {
11334
+ if (!this.#loaded) {
11335
+ return;
11336
+ }
11337
+ this.#loaded = false;
11338
+ signals.forEach((sig) => {
11339
+ const listener = this.#sigListeners[sig];
11340
+ if (!listener) {
11341
+ throw new Error("Listener not defined for signal: " + sig);
11342
+ }
11343
+ try {
11344
+ this.#process.removeListener(sig, listener);
11345
+ } catch (_) {
11346
+ }
11347
+ });
11348
+ this.#process.emit = this.#originalProcessEmit;
11349
+ this.#process.reallyExit = this.#originalProcessReallyExit;
11350
+ this.#emitter.count -= 1;
11351
+ }
11352
+ #processReallyExit(code) {
11353
+ if (!processOk(this.#process)) {
11354
+ return 0;
11355
+ }
11356
+ this.#process.exitCode = code || 0;
11357
+ this.#emitter.emit("exit", this.#process.exitCode, null);
11358
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
11359
+ }
11360
+ #processEmit(ev, ...args) {
11361
+ const og = this.#originalProcessEmit;
11362
+ if (ev === "exit" && processOk(this.#process)) {
11363
+ if (typeof args[0] === "number") {
11364
+ this.#process.exitCode = args[0];
11365
+ }
11366
+ const ret = og.call(this.#process, ev, ...args);
11367
+ this.#emitter.emit("exit", this.#process.exitCode, null);
11368
+ return ret;
11369
+ } else {
11370
+ return og.call(this.#process, ev, ...args);
11371
+ }
11372
+ }
11373
+ };
11374
+ var process2 = globalThis.process;
11375
+ var {
11376
+ /**
11377
+ * Called when the process is exiting, whether via signal, explicit
11378
+ * exit, or running out of stuff to do.
11379
+ *
11380
+ * If the global process object is not suitable for instrumentation,
11381
+ * then this will be a no-op.
11382
+ *
11383
+ * Returns a function that may be used to unload signal-exit.
11384
+ */
11385
+ onExit,
11386
+ /**
11387
+ * Load the listeners. Likely you never need to call this, unless
11388
+ * doing a rather deep integration with signal-exit functionality.
11389
+ * Mostly exposed for the benefit of testing.
11390
+ *
11391
+ * @internal
11392
+ */
11393
+ load,
11394
+ /**
11395
+ * Unload the listeners. Likely you never need to call this, unless
11396
+ * doing a rather deep integration with signal-exit functionality.
11397
+ * Mostly exposed for the benefit of testing.
11398
+ *
11399
+ * @internal
11400
+ */
11401
+ unload
11402
+ } = signalExitWrap(processOk(process2) ? new SignalExit(process2) : new SignalExitFallback());
11403
+
11580
11404
  // src/wrangler-tmp-dir.ts
11581
- var import_signal_exit = __toESM(require_signal_exit());
11582
11405
  function getWranglerHiddenDirPath(projectRoot) {
11583
11406
  projectRoot ??= process.cwd();
11584
- return path3.join(projectRoot, ".wrangler");
11407
+ return path2.join(projectRoot, ".wrangler");
11585
11408
  }
11586
11409
  __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
11587
11410
  var STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
@@ -11602,7 +11425,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
11602
11425
  if (!entry.isDirectory()) {
11603
11426
  continue;
11604
11427
  }
11605
- const entryPath = path3.join(tmpRoot, entry.name);
11428
+ const entryPath = path2.join(tmpRoot, entry.name);
11606
11429
  try {
11607
11430
  if (fs2.statSync(entryPath).mtimeMs < cutoff) {
11608
11431
  removeDirSync(entryPath);
@@ -11613,10 +11436,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
11613
11436
  }
11614
11437
  __name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
11615
11438
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
11616
- const tmpRoot = path3.join(getWranglerHiddenDirPath(projectRoot), "tmp");
11439
+ const tmpRoot = path2.join(getWranglerHiddenDirPath(projectRoot), "tmp");
11617
11440
  fs2.mkdirSync(tmpRoot, { recursive: true });
11618
11441
  sweepStaleWranglerTmpDirs(tmpRoot);
11619
- const tmpPrefix = path3.join(tmpRoot, `${prefix}-`);
11442
+ const tmpPrefix = path2.join(tmpRoot, `${prefix}-`);
11620
11443
  const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
11621
11444
  const cleanupDir = /* @__PURE__ */ __name(() => {
11622
11445
  if (cleanup) {
@@ -11626,7 +11449,7 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
11626
11449
  }
11627
11450
  }
11628
11451
  }, "cleanupDir");
11629
- const removeExitListener = (0, import_signal_exit.default)(cleanupDir);
11452
+ const removeExitListener = onExit(cleanupDir);
11630
11453
  return {
11631
11454
  path: tmpDir,
11632
11455
  remove() {
@@ -11783,7 +11606,7 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
11783
11606
  }
11784
11607
  __name(getLatestVersionInfo, "getLatestVersionInfo");
11785
11608
  function getCacheDir(version) {
11786
- return join(getGlobalWranglerConfigPath(), "cloudflared", version);
11609
+ return join(getGlobalConfigPath(), "cloudflared", version);
11787
11610
  }
11788
11611
  __name(getCacheDir, "getCacheDir");
11789
11612
  function getCloudflaredBinPath(version) {
@@ -11828,7 +11651,7 @@ On Linux, make sure you have the required dependencies:
11828
11651
  errorMessage += ` - For Debian/Ubuntu: sudo apt-get install libc6
11829
11652
  `;
11830
11653
  }
11831
- const cacheDir = join(getGlobalWranglerConfigPath(), "cloudflared");
11654
+ const cacheDir = join(getGlobalConfigPath(), "cloudflared");
11832
11655
  errorMessage += `
11833
11656
  You can try:
11834
11657
  `;
@@ -12143,7 +11966,7 @@ async function spawnCloudflared(args, options) {
12143
11966
  }
12144
11967
  __name(spawnCloudflared, "spawnCloudflared");
12145
11968
  function removeCloudflaredCache(version) {
12146
- const cacheDir = version ? getCacheDir(version) : join(getGlobalWranglerConfigPath(), "cloudflared");
11969
+ const cacheDir = version ? getCacheDir(version) : join(getGlobalConfigPath(), "cloudflared");
12147
11970
  if (existsSync(cacheDir)) {
12148
11971
  removeDirSync(cacheDir);
12149
11972
  return cacheDir;
@@ -12180,18 +12003,18 @@ function startTunnel(options) {
12180
12003
  env: options.token ? { TUNNEL_TOKEN: options.token } : void 0,
12181
12004
  skipVersionCheck: true,
12182
12005
  logger
12183
- }).then((process2) => {
12184
- cloudflaredProcess = process2;
12006
+ }).then((process3) => {
12007
+ cloudflaredProcess = process3;
12185
12008
  if (disposed) {
12186
- terminateCloudflared(process2);
12009
+ terminateCloudflared(process3);
12187
12010
  }
12188
- return process2;
12011
+ return process3;
12189
12012
  });
12190
- const readyPromise = cloudflaredPromise.then((process2) => {
12013
+ const readyPromise = cloudflaredPromise.then((process3) => {
12191
12014
  if (isNamedTunnel) {
12192
12015
  return { mode: "named" };
12193
12016
  }
12194
- return waitForQuickTunnelReady(process2, timeoutMs, {
12017
+ return waitForQuickTunnelReady(process3, timeoutMs, {
12195
12018
  logger,
12196
12019
  origin: options.origin
12197
12020
  });
@@ -12693,6 +12516,10 @@ function throwFetchError(resource, response, status) {
12693
12516
  if (code) {
12694
12517
  error.code = code;
12695
12518
  }
12519
+ const meta = errors[0]?.meta;
12520
+ if (meta) {
12521
+ error.meta = meta;
12522
+ }
12696
12523
  error.accountTag = extractAccountTag(resource);
12697
12524
  throw error;
12698
12525
  }
@@ -12954,6 +12781,9 @@ function getWorkerNameFromProject(projectPath) {
12954
12781
  return getWorkerName(packageJsonName, projectPath);
12955
12782
  }
12956
12783
  __name(getWorkerNameFromProject, "getWorkerNameFromProject");
12784
+
12785
+ // src/index.ts
12786
+ var friendlyBindingNames2 = friendlyBindingNames;
12957
12787
  /*! Bundled license information:
12958
12788
 
12959
12789
  deep-extend/lib/deep-extend.js:
@@ -12988,4 +12818,4 @@ safe-buffer/index.js:
12988
12818
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
12989
12819
  */
12990
12820
 
12991
- export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalConfigPath, getGlobalWranglerConfigPath, getHostFromRoute, getHostFromUrl, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasMorePages, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };
12821
+ export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isDockerfile, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };