@cloudflare/vite-plugin 1.43.3 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,11 @@
1
- import { builtinModules, createRequire, registerHooks } from "node:module";
1
+ import { a as __commonJS$2, i as __toESM, n as __name$1, o as __require$2, r as __require$1, s as __toESM$1, t as __commonJS$1 } from "./chunk-DDRU76YD-DhDoQvwV.mjs";
2
+ import * as nodeModule from "node:module";
3
+ import { builtinModules, createRequire } from "node:module";
2
4
  import assert from "node:assert";
3
5
  import { CoreHeaders, CorePaths, Log, LogLevel, Miniflare, Request as Request$1, Response as Response$1, buildPublicUrl, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
4
6
  import * as wrangler from "wrangler";
5
- import * as nodePath from "node:path";
6
- import path2, { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
7
+ import * as path2 from "node:path";
8
+ import path2__default, { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
7
9
  import * as util$1 from "node:util";
8
10
  import { format, inspect, promisify } from "node:util";
9
11
  import * as vite from "vite";
@@ -21,6 +23,7 @@ import * as fsp from "node:fs/promises";
21
23
  import fs, { constants as constants$1 } from "node:fs/promises";
22
24
  import * as timersPromises from "node:timers/promises";
23
25
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
26
+ import { version as version$1 } from "workerd";
24
27
  import { getCloudflarePreset, nonPrefixedNodeModules } from "@cloudflare/unenv-preset";
25
28
  import process$1 from "node:process";
26
29
  import v8 from "node:v8";
@@ -32,33 +35,6 @@ import { fileURLToPath as fileURLToPath$1 } from "url";
32
35
  import { createRequire as createRequire$1 } from "module";
33
36
  import { WebSocketServer } from "ws";
34
37
 
35
- //#region rolldown:runtime
36
- var __create$1 = Object.create;
37
- var __defProp$2 = Object.defineProperty;
38
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames$2 = Object.getOwnPropertyNames;
40
- var __getProtoOf$1 = Object.getPrototypeOf;
41
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
42
- var __commonJS$2 = (cb, mod$1) => function() {
43
- return mod$1 || (0, cb[__getOwnPropNames$2(cb)[0]])((mod$1 = { exports: {} }).exports, mod$1), mod$1.exports;
44
- };
45
- var __copyProps$1 = (to, from, except, desc) => {
46
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$2(from), i$1 = 0, n$1 = keys.length, key; i$1 < n$1; i$1++) {
47
- key = keys[i$1];
48
- if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$2(to, key, {
49
- get: ((k) => from[k]).bind(null, key),
50
- enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
51
- });
52
- }
53
- return to;
54
- };
55
- var __toESM$1 = (mod$1, isNodeMode, target$1) => (target$1 = mod$1 != null ? __create$1(__getProtoOf$1(mod$1)) : {}, __copyProps$1(isNodeMode || !mod$1 || !mod$1.__esModule ? __defProp$2(target$1, "default", {
56
- value: mod$1,
57
- enumerable: true
58
- }) : target$1, mod$1));
59
- var __require$2 = /* @__PURE__ */ createRequire(import.meta.url);
60
-
61
- //#endregion
62
38
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
63
39
  var require_constants$6 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js": ((exports, module) => {
64
40
  const SEMVER_SPEC_VERSION = "2.0.0";
@@ -217,19 +193,19 @@ var require_semver$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
217
193
  const parseOptions$2 = require_parse_options();
218
194
  const { compareIdentifiers } = require_identifiers();
219
195
  var SemVer$15 = class SemVer$15 {
220
- constructor(version$3, options) {
196
+ constructor(version$4, options) {
221
197
  options = parseOptions$2(options);
222
- if (version$3 instanceof SemVer$15) if (version$3.loose === !!options.loose && version$3.includePrerelease === !!options.includePrerelease) return version$3;
223
- else version$3 = version$3.version;
224
- else if (typeof version$3 !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version$3}".`);
225
- if (version$3.length > MAX_LENGTH$1) throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`);
226
- debug$4("SemVer", version$3, options);
198
+ if (version$4 instanceof SemVer$15) if (version$4.loose === !!options.loose && version$4.includePrerelease === !!options.includePrerelease) return version$4;
199
+ else version$4 = version$4.version;
200
+ else if (typeof version$4 !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version$4}".`);
201
+ if (version$4.length > MAX_LENGTH$1) throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`);
202
+ debug$4("SemVer", version$4, options);
227
203
  this.options = options;
228
204
  this.loose = !!options.loose;
229
205
  this.includePrerelease = !!options.includePrerelease;
230
- const m = version$3.trim().match(options.loose ? re$3[t$3.LOOSE] : re$3[t$3.FULL]);
231
- if (!m) throw new TypeError(`Invalid Version: ${version$3}`);
232
- this.raw = version$3;
206
+ const m = version$4.trim().match(options.loose ? re$3[t$3.LOOSE] : re$3[t$3.FULL]);
207
+ if (!m) throw new TypeError(`Invalid Version: ${version$4}`);
208
+ this.raw = version$4;
233
209
  this.major = +m[1];
234
210
  this.minor = +m[2];
235
211
  this.patch = +m[3];
@@ -392,10 +368,10 @@ var require_semver$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
392
368
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js
393
369
  var require_parse$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js": ((exports, module) => {
394
370
  const SemVer$14 = require_semver$1();
395
- const parse$12 = (version$3, options, throwErrors = false) => {
396
- if (version$3 instanceof SemVer$14) return version$3;
371
+ const parse$12 = (version$4, options, throwErrors = false) => {
372
+ if (version$4 instanceof SemVer$14) return version$4;
397
373
  try {
398
- return new SemVer$14(version$3, options);
374
+ return new SemVer$14(version$4, options);
399
375
  } catch (er) {
400
376
  if (!throwErrors) return null;
401
377
  throw er;
@@ -408,8 +384,8 @@ var require_parse$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/s
408
384
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
409
385
  var require_valid$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js": ((exports, module) => {
410
386
  const parse$11 = require_parse$2();
411
- const valid$1 = (version$3, options) => {
412
- const v = parse$11(version$3, options);
387
+ const valid$1 = (version$4, options) => {
388
+ const v = parse$11(version$4, options);
413
389
  return v ? v.version : null;
414
390
  };
415
391
  module.exports = valid$1;
@@ -419,8 +395,8 @@ var require_valid$1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/s
419
395
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
420
396
  var require_clean = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js": ((exports, module) => {
421
397
  const parse$10 = require_parse$2();
422
- const clean$1 = (version$3, options) => {
423
- const s = parse$10(version$3.trim().replace(/^[=v]+/, ""), options);
398
+ const clean$1 = (version$4, options) => {
399
+ const s = parse$10(version$4.trim().replace(/^[=v]+/, ""), options);
424
400
  return s ? s.version : null;
425
401
  };
426
402
  module.exports = clean$1;
@@ -430,14 +406,14 @@ var require_clean = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/sem
430
406
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js
431
407
  var require_inc = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js": ((exports, module) => {
432
408
  const SemVer$13 = require_semver$1();
433
- const inc$1 = (version$3, release, options, identifier, identifierBase) => {
409
+ const inc$1 = (version$4, release, options, identifier, identifierBase) => {
434
410
  if (typeof options === "string") {
435
411
  identifierBase = identifier;
436
412
  identifier = options;
437
413
  options = void 0;
438
414
  }
439
415
  try {
440
- return new SemVer$13(version$3 instanceof SemVer$13 ? version$3.version : version$3, options).inc(release, identifier, identifierBase).version;
416
+ return new SemVer$13(version$4 instanceof SemVer$13 ? version$4.version : version$4, options).inc(release, identifier, identifierBase).version;
441
417
  } catch (er) {
442
418
  return null;
443
419
  }
@@ -502,8 +478,8 @@ var require_patch = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/sem
502
478
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
503
479
  var require_prerelease = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js": ((exports, module) => {
504
480
  const parse$8 = require_parse$2();
505
- const prerelease$1 = (version$3, options) => {
506
- const parsed = parse$8(version$3, options);
481
+ const prerelease$1 = (version$4, options) => {
482
+ const parsed = parse$8(version$4, options);
507
483
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
508
484
  };
509
485
  module.exports = prerelease$1;
@@ -648,17 +624,17 @@ var require_coerce = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/se
648
624
  const SemVer$7 = require_semver$1();
649
625
  const parse$7 = require_parse$2();
650
626
  const { safeRe: re$2, t: t$2 } = require_re();
651
- const coerce$2 = (version$3, options) => {
652
- if (version$3 instanceof SemVer$7) return version$3;
653
- if (typeof version$3 === "number") version$3 = String(version$3);
654
- if (typeof version$3 !== "string") return null;
627
+ const coerce$2 = (version$4, options) => {
628
+ if (version$4 instanceof SemVer$7) return version$4;
629
+ if (typeof version$4 === "number") version$4 = String(version$4);
630
+ if (typeof version$4 !== "string") return null;
655
631
  options = options || {};
656
632
  let match = null;
657
- if (!options.rtl) match = version$3.match(options.includePrerelease ? re$2[t$2.COERCEFULL] : re$2[t$2.COERCE]);
633
+ if (!options.rtl) match = version$4.match(options.includePrerelease ? re$2[t$2.COERCEFULL] : re$2[t$2.COERCE]);
658
634
  else {
659
635
  const coerceRtlRegex = options.includePrerelease ? re$2[t$2.COERCERTLFULL] : re$2[t$2.COERCERTL];
660
636
  let next;
661
- while ((next = coerceRtlRegex.exec(version$3)) && (!match || match.index + match[0].length !== version$3.length)) {
637
+ while ((next = coerceRtlRegex.exec(version$4)) && (!match || match.index + match[0].length !== version$4.length)) {
662
638
  if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
663
639
  coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
664
640
  }
@@ -802,14 +778,14 @@ var require_range = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/sem
802
778
  });
803
779
  });
804
780
  }
805
- test(version$3) {
806
- if (!version$3) return false;
807
- if (typeof version$3 === "string") try {
808
- version$3 = new SemVer$6(version$3, this.options);
781
+ test(version$4) {
782
+ if (!version$4) return false;
783
+ if (typeof version$4 === "string") try {
784
+ version$4 = new SemVer$6(version$4, this.options);
809
785
  } catch (er) {
810
786
  return false;
811
787
  }
812
- for (let i$1 = 0; i$1 < this.set.length; i$1++) if (testSet(this.set[i$1], version$3, this.options)) return true;
788
+ for (let i$1 = 0; i$1 < this.set.length; i$1++) if (testSet(this.set[i$1], version$4, this.options)) return true;
813
789
  return false;
814
790
  }
815
791
  };
@@ -962,15 +938,15 @@ var require_range = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/sem
962
938
  else to = `<=${to}`;
963
939
  return `${from} ${to}`.trim();
964
940
  };
965
- const testSet = (set, version$3, options) => {
966
- for (let i$1 = 0; i$1 < set.length; i$1++) if (!set[i$1].test(version$3)) return false;
967
- if (version$3.prerelease.length && !options.includePrerelease) {
941
+ const testSet = (set, version$4, options) => {
942
+ for (let i$1 = 0; i$1 < set.length; i$1++) if (!set[i$1].test(version$4)) return false;
943
+ if (version$4.prerelease.length && !options.includePrerelease) {
968
944
  for (let i$1 = 0; i$1 < set.length; i$1++) {
969
945
  debug$3(set[i$1].semver);
970
946
  if (set[i$1].semver === Comparator$4.ANY) continue;
971
947
  if (set[i$1].semver.prerelease.length > 0) {
972
948
  const allowed = set[i$1].semver;
973
- if (allowed.major === version$3.major && allowed.minor === version$3.minor && allowed.patch === version$3.patch) return true;
949
+ if (allowed.major === version$4.major && allowed.minor === version$4.minor && allowed.patch === version$4.patch) return true;
974
950
  }
975
951
  }
976
952
  return false;
@@ -1012,15 +988,15 @@ var require_comparator = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
1012
988
  toString() {
1013
989
  return this.value;
1014
990
  }
1015
- test(version$3) {
1016
- debug$2("Comparator.test", version$3, this.options.loose);
1017
- if (this.semver === ANY$2 || version$3 === ANY$2) return true;
1018
- if (typeof version$3 === "string") try {
1019
- version$3 = new SemVer$5(version$3, this.options);
991
+ test(version$4) {
992
+ debug$2("Comparator.test", version$4, this.options.loose);
993
+ if (this.semver === ANY$2 || version$4 === ANY$2) return true;
994
+ if (typeof version$4 === "string") try {
995
+ version$4 = new SemVer$5(version$4, this.options);
1020
996
  } catch (er) {
1021
997
  return false;
1022
998
  }
1023
- return cmp$1(version$3, this.operator, this.semver, this.options);
999
+ return cmp$1(version$4, this.operator, this.semver, this.options);
1024
1000
  }
1025
1001
  intersects(comp, options) {
1026
1002
  if (!(comp instanceof Comparator$3)) throw new TypeError("a Comparator is required");
@@ -1055,13 +1031,13 @@ var require_comparator = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnp
1055
1031
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js
1056
1032
  var require_satisfies = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js": ((exports, module) => {
1057
1033
  const Range$9 = require_range();
1058
- const satisfies$5 = (version$3, range, options) => {
1034
+ const satisfies$5 = (version$4, range, options) => {
1059
1035
  try {
1060
1036
  range = new Range$9(range, options);
1061
1037
  } catch (er) {
1062
1038
  return false;
1063
1039
  }
1064
- return range.test(version$3);
1040
+ return range.test(version$4);
1065
1041
  };
1066
1042
  module.exports = satisfies$5;
1067
1043
  }) });
@@ -1194,8 +1170,8 @@ var require_outside = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/s
1194
1170
  const lt$1 = require_lt();
1195
1171
  const lte$1 = require_lte();
1196
1172
  const gte$1 = require_gte();
1197
- const outside$3 = (version$3, range, hilo, options) => {
1198
- version$3 = new SemVer$1(version$3, options);
1173
+ const outside$3 = (version$4, range, hilo, options) => {
1174
+ version$4 = new SemVer$1(version$4, options);
1199
1175
  range = new Range$3(range, options);
1200
1176
  let gtfn, ltefn, ltfn, comp, ecomp;
1201
1177
  switch (hilo) {
@@ -1215,7 +1191,7 @@ var require_outside = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/s
1215
1191
  break;
1216
1192
  default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
1217
1193
  }
1218
- if (satisfies$4(version$3, range, options)) return false;
1194
+ if (satisfies$4(version$4, range, options)) return false;
1219
1195
  for (let i$1 = 0; i$1 < range.set.length; ++i$1) {
1220
1196
  const comparators = range.set[i$1];
1221
1197
  let high = null;
@@ -1228,8 +1204,8 @@ var require_outside = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/s
1228
1204
  else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
1229
1205
  });
1230
1206
  if (high.operator === comp || high.operator === ecomp) return false;
1231
- if ((!low.operator || low.operator === comp) && ltefn(version$3, low.semver)) return false;
1232
- else if (low.operator === ecomp && ltfn(version$3, low.semver)) return false;
1207
+ if ((!low.operator || low.operator === comp) && ltefn(version$4, low.semver)) return false;
1208
+ else if (low.operator === ecomp && ltfn(version$4, low.semver)) return false;
1233
1209
  }
1234
1210
  return true;
1235
1211
  };
@@ -1240,7 +1216,7 @@ var require_outside = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/s
1240
1216
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js
1241
1217
  var require_gtr = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js": ((exports, module) => {
1242
1218
  const outside$2 = require_outside();
1243
- const gtr$1 = (version$3, range, options) => outside$2(version$3, range, ">", options);
1219
+ const gtr$1 = (version$4, range, options) => outside$2(version$4, range, ">", options);
1244
1220
  module.exports = gtr$1;
1245
1221
  }) });
1246
1222
 
@@ -1248,7 +1224,7 @@ var require_gtr = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semve
1248
1224
  //#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js
1249
1225
  var require_ltr = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js": ((exports, module) => {
1250
1226
  const outside$1 = require_outside();
1251
- const ltr$1 = (version$3, range, options) => outside$1(version$3, range, "<", options);
1227
+ const ltr$1 = (version$4, range, options) => outside$1(version$4, range, "<", options);
1252
1228
  module.exports = ltr$1;
1253
1229
  }) });
1254
1230
 
@@ -1274,9 +1250,9 @@ var require_simplify = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
1274
1250
  let first = null;
1275
1251
  let prev = null;
1276
1252
  const v = versions.sort((a, b) => compare$2(a, b, options));
1277
- for (const version$3 of v) if (satisfies$3(version$3, range, options)) {
1278
- prev = version$3;
1279
- if (!first) first = version$3;
1253
+ for (const version$4 of v) if (satisfies$3(version$4, range, options)) {
1254
+ prev = version$4;
1255
+ if (!first) first = version$4;
1280
1256
  } else {
1281
1257
  if (prev) set.push([first, prev]);
1282
1258
  prev = null;
@@ -1506,7 +1482,7 @@ async function assertWranglerVersion() {
1506
1482
  * The default compatibility date to use when the user omits one.
1507
1483
  * This value is injected at build time and remains fixed for each release.
1508
1484
  */
1509
- const DEFAULT_COMPAT_DATE = "2026-07-09";
1485
+ const DEFAULT_COMPAT_DATE = "2026-07-15";
1510
1486
 
1511
1487
  //#endregion
1512
1488
  //#region src/build-output-env.ts
@@ -1594,39 +1570,6 @@ const VITE_PROXY_WORKER_NAME = "__vite_proxy_worker__";
1594
1570
  const PROXY_SHARED_SECRET = randomUUID();
1595
1571
  const kRequestType = Symbol("kRequestType");
1596
1572
 
1597
- //#endregion
1598
- //#region ../workers-utils/dist/chunk-DDRU76YD.mjs
1599
- var __create = Object.create;
1600
- var __defProp$1 = Object.defineProperty;
1601
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1602
- var __getOwnPropNames$1 = Object.getOwnPropertyNames;
1603
- var __getProtoOf = Object.getPrototypeOf;
1604
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1605
- var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
1606
- value,
1607
- configurable: true
1608
- });
1609
- var __require$1 = /* @__PURE__ */ ((x) => typeof __require$2 !== "undefined" ? __require$2 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$2 !== "undefined" ? __require$2 : a)[b] }) : x)(function(x) {
1610
- if (typeof __require$2 !== "undefined") return __require$2.apply(this, arguments);
1611
- throw Error("Dynamic require of \"" + x + "\" is not supported");
1612
- });
1613
- var __commonJS$1 = (cb, mod$1) => function __require2() {
1614
- return mod$1 || (0, cb[__getOwnPropNames$1(cb)[0]])((mod$1 = { exports: {} }).exports, mod$1), mod$1.exports;
1615
- };
1616
- var __copyProps = (to, from, except, desc) => {
1617
- if (from && typeof from === "object" || typeof from === "function") {
1618
- for (let key of __getOwnPropNames$1(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp$1(to, key, {
1619
- get: () => from[key],
1620
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
1621
- });
1622
- }
1623
- return to;
1624
- };
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", {
1626
- value: mod$1,
1627
- enumerable: true
1628
- }) : target$1, mod$1));
1629
-
1630
1573
  //#endregion
1631
1574
  //#region ../workers-utils/dist/chunk-OC543JY3.mjs
1632
1575
  function isDirectory$1(path) {
@@ -1673,7 +1616,7 @@ function getEnv(name) {
1673
1616
  }
1674
1617
  __name$1(getEnv, "getEnv");
1675
1618
  function normalizePath$2(p$1) {
1676
- return p$1 ? path2.normalize(path2.join(p$1, ".")) : void 0;
1619
+ return p$1 ? path2__default.normalize(path2__default.join(p$1, ".")) : void 0;
1677
1620
  }
1678
1621
  __name$1(normalizePath$2, "normalizePath");
1679
1622
  function homeDir() {
@@ -1681,13 +1624,13 @@ function homeDir() {
1681
1624
  os.homedir(),
1682
1625
  getEnv("USERPROFILE"),
1683
1626
  getEnv("HOME"),
1684
- getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ? path2.join(getEnv("HOMEDRIVE") ?? "", getEnv("HOMEPATH") ?? "") : void 0
1627
+ getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ? path2__default.join(getEnv("HOMEDRIVE") ?? "", getEnv("HOMEPATH") ?? "") : void 0
1685
1628
  ].find(isNonEmpty));
1686
1629
  return normalizePath$2(os.homedir() || getEnv("HOME"));
1687
1630
  }
1688
1631
  __name$1(homeDir, "homeDir");
1689
1632
  function joinToBase(base, segments) {
1690
- return base ? path2.join(base, ...segments) : void 0;
1633
+ return base ? path2__default.join(base, ...segments) : void 0;
1691
1634
  }
1692
1635
  __name$1(joinToBase, "joinToBase");
1693
1636
  function tempDir() {
@@ -1723,7 +1666,7 @@ function baseDir() {
1723
1666
  }
1724
1667
  __name$1(baseDir, "baseDir");
1725
1668
  function valOrPath(value, segments) {
1726
- return value || path2.join(...segments);
1669
+ return value || path2__default.join(...segments);
1727
1670
  }
1728
1671
  __name$1(valOrPath, "valOrPath");
1729
1672
  function windowsAppData() {
@@ -1763,10 +1706,10 @@ function xdgCache() {
1763
1706
  }
1764
1707
  __name$1(xdgCache, "xdgCache");
1765
1708
  function xdgAppPaths(name) {
1766
- const segment = path2.parse(name).name;
1709
+ const segment = path2__default.parse(name).name;
1767
1710
  return {
1768
- config: /* @__PURE__ */ __name$1(() => path2.join(xdgConfig(), segment), "config"),
1769
- cache: /* @__PURE__ */ __name$1(() => path2.join(xdgCache(), segment), "cache")
1711
+ config: /* @__PURE__ */ __name$1(() => path2__default.join(xdgConfig(), segment), "config"),
1712
+ cache: /* @__PURE__ */ __name$1(() => path2__default.join(xdgCache(), segment), "cache")
1770
1713
  };
1771
1714
  }
1772
1715
  __name$1(xdgAppPaths, "xdgAppPaths");
@@ -1774,7 +1717,7 @@ function getGlobalConfigPath({ appName = "wrangler", leadingDot = true, useLegac
1774
1717
  const dirName = `${leadingDot ? "." : ""}${appName}`;
1775
1718
  const configDir = xdgAppPaths(dirName).config();
1776
1719
  if (useLegacyHomeDir) {
1777
- const legacyConfigDir = path2.join(os.homedir(), dirName);
1720
+ const legacyConfigDir = path2__default.join(os.homedir(), dirName);
1778
1721
  if (isDirectory$1(legacyConfigDir)) return legacyConfigDir;
1779
1722
  }
1780
1723
  return configDir;
@@ -1786,7 +1729,7 @@ function getGlobalWranglerCachePath() {
1786
1729
  __name$1(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
1787
1730
 
1788
1731
  //#endregion
1789
- //#region ../workers-utils/dist/chunk-27EBTAT2.mjs
1732
+ //#region ../workers-utils/dist/chunk-XPMIK7N6.mjs
1790
1733
  function partitionExports$1(exports$2) {
1791
1734
  const partitioned = {
1792
1735
  "durable-object": {},
@@ -4089,13 +4032,21 @@ function up$1(base, options) {
4089
4032
  }
4090
4033
  __name$1(up$1, "up");
4091
4034
  function file$1(name, options) {
4092
- let dir, tmp;
4093
- for (dir of up$1(options && options.cwd || "", options)) try {
4094
- tmp = join(dir, name);
4035
+ let dir2, tmp;
4036
+ for (dir2 of up$1(options && options.cwd || "", options)) try {
4037
+ tmp = join(dir2, name);
4095
4038
  if (statSync(tmp).isFile()) return tmp;
4096
4039
  } catch {}
4097
4040
  }
4098
4041
  __name$1(file$1, "file");
4042
+ function dir$1(name, options) {
4043
+ let dir2, tmp;
4044
+ for (dir2 of up$1(options && options.cwd || "", options)) try {
4045
+ tmp = join(dir2, name);
4046
+ if (statSync(tmp).isDirectory()) return tmp;
4047
+ } catch {}
4048
+ }
4049
+ __name$1(dir$1, "dir");
4099
4050
  function dedent(templ) {
4100
4051
  var values = [];
4101
4052
  for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
@@ -4137,7 +4088,7 @@ function resolveWranglerConfigPath$1({ config: config$1, script }, options) {
4137
4088
  deployConfigPath: void 0,
4138
4089
  redirected: false
4139
4090
  };
4140
- return findWranglerConfig$2(script !== void 0 ? path2.dirname(script) : process.cwd(), options);
4091
+ return findWranglerConfig$2(script !== void 0 ? path2__default.dirname(script) : process.cwd(), options);
4141
4092
  }
4142
4093
  __name$1(resolveWranglerConfigPath$1, "resolveWranglerConfigPath");
4143
4094
  function findWranglerConfig$2(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -4168,15 +4119,15 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
4168
4119
  const deployConfigFile = readFileSync$2(deployConfigPath);
4169
4120
  try {
4170
4121
  const deployConfig = parseJSONC$1(deployConfigFile, deployConfigPath);
4171
- redirectedConfigPath = deployConfig.configPath && path2.resolve(path2.dirname(deployConfigPath), deployConfig.configPath);
4122
+ redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
4172
4123
  } catch (e) {
4173
- throw new UserError(`Failed to parse the deploy configuration file at ${path2.relative(".", deployConfigPath)}`, {
4124
+ throw new UserError(`Failed to parse the deploy configuration file at ${path2__default.relative(".", deployConfigPath)}`, {
4174
4125
  cause: e,
4175
4126
  telemetryMessage: false
4176
4127
  });
4177
4128
  }
4178
4129
  if (!redirectedConfigPath) throw new UserError(esm_default$1`
4179
- A deploy configuration file was found at "${path2.relative(".", deployConfigPath)}".
4130
+ A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
4180
4131
  But this is not valid - the required "configPath" property was not found.
4181
4132
  Instead this file contains:
4182
4133
  \`\`\`
@@ -4184,13 +4135,13 @@ function findRedirectedWranglerConfig$1(cwd, userConfigPath) {
4184
4135
  \`\`\`
4185
4136
  `, { telemetryMessage: false });
4186
4137
  if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default$1`
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.
4138
+ There is a deploy configuration at "${path2__default.relative(".", deployConfigPath)}".
4139
+ But the redirected configuration path it points to, "${path2__default.relative(".", redirectedConfigPath)}", does not exist.
4189
4140
  `, { telemetryMessage: false });
4190
4141
  if (userConfigPath) {
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)}".
4142
+ if (path2__default.join(path2__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG$1) !== deployConfigPath) throw new UserError(esm_default$1`
4143
+ Found both a user configuration file at "${path2__default.relative(".", userConfigPath)}"
4144
+ and a deploy configuration file at "${path2__default.relative(".", deployConfigPath)}".
4194
4145
  But these do not share the same base path so it is not clear which should be used.
4195
4146
  `, { telemetryMessage: false });
4196
4147
  }
@@ -6248,16 +6199,16 @@ var require_diagnostics = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pn
6248
6199
  }
6249
6200
  isTrackingClientEvents = true;
6250
6201
  diagnosticsChannel$1.subscribe("undici:client:beforeConnect", (evt) => {
6251
- const { connectParams: { version: version$3, protocol, port, host } } = evt;
6252
- debugLog("connecting to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version$3);
6202
+ const { connectParams: { version: version$4, protocol, port, host } } = evt;
6203
+ debugLog("connecting to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version$4);
6253
6204
  });
6254
6205
  diagnosticsChannel$1.subscribe("undici:client:connected", (evt) => {
6255
- const { connectParams: { version: version$3, protocol, port, host } } = evt;
6256
- debugLog("connected to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version$3);
6206
+ const { connectParams: { version: version$4, protocol, port, host } } = evt;
6207
+ debugLog("connected to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version$4);
6257
6208
  });
6258
6209
  diagnosticsChannel$1.subscribe("undici:client:connectError", (evt) => {
6259
- const { connectParams: { version: version$3, protocol, port, host }, error } = evt;
6260
- debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$3, error.message);
6210
+ const { connectParams: { version: version$4, protocol, port, host }, error } = evt;
6211
+ debugLog("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version$4, error.message);
6261
6212
  });
6262
6213
  diagnosticsChannel$1.subscribe("undici:client:sendHeaders", (evt) => {
6263
6214
  const { request: { method, path, origin } } = evt;
@@ -13150,9 +13101,9 @@ var require_socks5_client = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.
13150
13101
  */
13151
13102
  handleHandshakeResponse() {
13152
13103
  if (this.buffer.length < 2) return;
13153
- const version$3 = this.buffer[0];
13104
+ const version$4 = this.buffer[0];
13154
13105
  const method = this.buffer[1];
13155
- if (version$3 !== SOCKS_VERSION) throw new Socks5ProxyError(`Invalid SOCKS version: ${version$3}`, "UND_ERR_SOCKS5_VERSION");
13106
+ if (version$4 !== SOCKS_VERSION) throw new Socks5ProxyError(`Invalid SOCKS version: ${version$4}`, "UND_ERR_SOCKS5_VERSION");
13156
13107
  if (method === AUTH_METHODS.NO_ACCEPTABLE) throw new Socks5ProxyError("No acceptable authentication method", "UND_ERR_SOCKS5_AUTH_REJECTED");
13157
13108
  this.buffer = this.buffer.subarray(2);
13158
13109
  debug$1("server selected auth method", method);
@@ -13185,9 +13136,9 @@ var require_socks5_client = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.
13185
13136
  */
13186
13137
  handleAuthResponse() {
13187
13138
  if (this.buffer.length < 2) return;
13188
- const version$3 = this.buffer[0];
13139
+ const version$4 = this.buffer[0];
13189
13140
  const status = this.buffer[1];
13190
- if (version$3 !== 1) throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${version$3}`, "UND_ERR_SOCKS5_AUTH_VERSION");
13141
+ if (version$4 !== 1) throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${version$4}`, "UND_ERR_SOCKS5_AUTH_VERSION");
13191
13142
  if (status !== 0) throw new Socks5ProxyError("Authentication failed", "UND_ERR_SOCKS5_AUTH_FAILED");
13192
13143
  this.buffer = this.buffer.subarray(2);
13193
13144
  debug$1("authentication successful");
@@ -13225,10 +13176,10 @@ var require_socks5_client = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.
13225
13176
  */
13226
13177
  handleConnectResponse() {
13227
13178
  if (this.buffer.length < 4) return;
13228
- const version$3 = this.buffer[0];
13179
+ const version$4 = this.buffer[0];
13229
13180
  const reply = this.buffer[1];
13230
13181
  const addressType = this.buffer[3];
13231
- if (version$3 !== SOCKS_VERSION) throw new Socks5ProxyError(`Invalid SOCKS version in reply: ${version$3}`, "UND_ERR_SOCKS5_REPLY_VERSION");
13182
+ if (version$4 !== SOCKS_VERSION) throw new Socks5ProxyError(`Invalid SOCKS version in reply: ${version$4}`, "UND_ERR_SOCKS5_REPLY_VERSION");
13232
13183
  let responseLength = 4;
13233
13184
  if (addressType === ADDRESS_TYPES.IPV4) responseLength += 6;
13234
13185
  else if (addressType === ADDRESS_TYPES.DOMAIN) {
@@ -26080,11 +26031,384 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
26080
26031
  //#endregion
26081
26032
  //#region ../workers-utils/dist/index.mjs
26082
26033
  var import_undici = require_undici();
26034
+ var require_vendors = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$2, module$1) {
26035
+ module$1.exports = [
26036
+ {
26037
+ name: "Agola CI",
26038
+ constant: "AGOLA",
26039
+ env: "AGOLA_GIT_REF",
26040
+ pr: "AGOLA_PULL_REQUEST_ID"
26041
+ },
26042
+ {
26043
+ name: "Alpic",
26044
+ constant: "ALPIC",
26045
+ env: "ALPIC_HOST"
26046
+ },
26047
+ {
26048
+ name: "Appcircle",
26049
+ constant: "APPCIRCLE",
26050
+ env: "AC_APPCIRCLE",
26051
+ pr: {
26052
+ env: "AC_GIT_PR",
26053
+ ne: "false"
26054
+ }
26055
+ },
26056
+ {
26057
+ name: "AppVeyor",
26058
+ constant: "APPVEYOR",
26059
+ env: "APPVEYOR",
26060
+ pr: "APPVEYOR_PULL_REQUEST_NUMBER"
26061
+ },
26062
+ {
26063
+ name: "AWS CodeBuild",
26064
+ constant: "CODEBUILD",
26065
+ env: "CODEBUILD_BUILD_ARN",
26066
+ pr: {
26067
+ env: "CODEBUILD_WEBHOOK_EVENT",
26068
+ any: [
26069
+ "PULL_REQUEST_CREATED",
26070
+ "PULL_REQUEST_UPDATED",
26071
+ "PULL_REQUEST_REOPENED"
26072
+ ]
26073
+ }
26074
+ },
26075
+ {
26076
+ name: "Azure Pipelines",
26077
+ constant: "AZURE_PIPELINES",
26078
+ env: "TF_BUILD",
26079
+ pr: { BUILD_REASON: "PullRequest" }
26080
+ },
26081
+ {
26082
+ name: "Bamboo",
26083
+ constant: "BAMBOO",
26084
+ env: "bamboo_planKey"
26085
+ },
26086
+ {
26087
+ name: "Bitbucket Pipelines",
26088
+ constant: "BITBUCKET",
26089
+ env: "BITBUCKET_COMMIT",
26090
+ pr: "BITBUCKET_PR_ID"
26091
+ },
26092
+ {
26093
+ name: "Bitrise",
26094
+ constant: "BITRISE",
26095
+ env: "BITRISE_IO",
26096
+ pr: "BITRISE_PULL_REQUEST"
26097
+ },
26098
+ {
26099
+ name: "Buddy",
26100
+ constant: "BUDDY",
26101
+ env: "BUDDY_WORKSPACE_ID",
26102
+ pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
26103
+ },
26104
+ {
26105
+ name: "Buildkite",
26106
+ constant: "BUILDKITE",
26107
+ env: "BUILDKITE",
26108
+ pr: {
26109
+ env: "BUILDKITE_PULL_REQUEST",
26110
+ ne: "false"
26111
+ }
26112
+ },
26113
+ {
26114
+ name: "CircleCI",
26115
+ constant: "CIRCLE",
26116
+ env: "CIRCLECI",
26117
+ pr: "CIRCLE_PULL_REQUEST"
26118
+ },
26119
+ {
26120
+ name: "Cirrus CI",
26121
+ constant: "CIRRUS",
26122
+ env: "CIRRUS_CI",
26123
+ pr: "CIRRUS_PR"
26124
+ },
26125
+ {
26126
+ name: "Cloudflare Pages",
26127
+ constant: "CLOUDFLARE_PAGES",
26128
+ env: "CF_PAGES"
26129
+ },
26130
+ {
26131
+ name: "Cloudflare Workers",
26132
+ constant: "CLOUDFLARE_WORKERS",
26133
+ env: "WORKERS_CI"
26134
+ },
26135
+ {
26136
+ name: "Codefresh",
26137
+ constant: "CODEFRESH",
26138
+ env: "CF_BUILD_ID",
26139
+ pr: { any: ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] }
26140
+ },
26141
+ {
26142
+ name: "Codemagic",
26143
+ constant: "CODEMAGIC",
26144
+ env: "CM_BUILD_ID",
26145
+ pr: "CM_PULL_REQUEST"
26146
+ },
26147
+ {
26148
+ name: "Codeship",
26149
+ constant: "CODESHIP",
26150
+ env: { CI_NAME: "codeship" }
26151
+ },
26152
+ {
26153
+ name: "Drone",
26154
+ constant: "DRONE",
26155
+ env: "DRONE",
26156
+ pr: { DRONE_BUILD_EVENT: "pull_request" }
26157
+ },
26158
+ {
26159
+ name: "dsari",
26160
+ constant: "DSARI",
26161
+ env: "DSARI"
26162
+ },
26163
+ {
26164
+ name: "Earthly",
26165
+ constant: "EARTHLY",
26166
+ env: "EARTHLY_CI"
26167
+ },
26168
+ {
26169
+ name: "Expo Application Services",
26170
+ constant: "EAS",
26171
+ env: "EAS_BUILD"
26172
+ },
26173
+ {
26174
+ name: "Gerrit",
26175
+ constant: "GERRIT",
26176
+ env: "GERRIT_PROJECT"
26177
+ },
26178
+ {
26179
+ name: "Gitea Actions",
26180
+ constant: "GITEA_ACTIONS",
26181
+ env: "GITEA_ACTIONS"
26182
+ },
26183
+ {
26184
+ name: "GitHub Actions",
26185
+ constant: "GITHUB_ACTIONS",
26186
+ env: "GITHUB_ACTIONS",
26187
+ pr: { GITHUB_EVENT_NAME: "pull_request" }
26188
+ },
26189
+ {
26190
+ name: "GitLab CI",
26191
+ constant: "GITLAB",
26192
+ env: "GITLAB_CI",
26193
+ pr: "CI_MERGE_REQUEST_ID"
26194
+ },
26195
+ {
26196
+ name: "GoCD",
26197
+ constant: "GOCD",
26198
+ env: "GO_PIPELINE_LABEL"
26199
+ },
26200
+ {
26201
+ name: "Google Cloud Build",
26202
+ constant: "GOOGLE_CLOUD_BUILD",
26203
+ env: "BUILDER_OUTPUT"
26204
+ },
26205
+ {
26206
+ name: "Harness CI",
26207
+ constant: "HARNESS",
26208
+ env: "HARNESS_BUILD_ID"
26209
+ },
26210
+ {
26211
+ name: "Heroku",
26212
+ constant: "HEROKU",
26213
+ env: {
26214
+ env: "NODE",
26215
+ includes: "/app/.heroku/node/bin/node"
26216
+ }
26217
+ },
26218
+ {
26219
+ name: "Hudson",
26220
+ constant: "HUDSON",
26221
+ env: "HUDSON_URL"
26222
+ },
26223
+ {
26224
+ name: "Jenkins",
26225
+ constant: "JENKINS",
26226
+ env: ["JENKINS_URL", "BUILD_ID"],
26227
+ pr: { any: ["ghprbPullId", "CHANGE_ID"] }
26228
+ },
26229
+ {
26230
+ name: "LayerCI",
26231
+ constant: "LAYERCI",
26232
+ env: "LAYERCI",
26233
+ pr: "LAYERCI_PULL_REQUEST"
26234
+ },
26235
+ {
26236
+ name: "Magnum CI",
26237
+ constant: "MAGNUM",
26238
+ env: "MAGNUM"
26239
+ },
26240
+ {
26241
+ name: "Netlify CI",
26242
+ constant: "NETLIFY",
26243
+ env: "NETLIFY",
26244
+ pr: {
26245
+ env: "PULL_REQUEST",
26246
+ ne: "false"
26247
+ }
26248
+ },
26249
+ {
26250
+ name: "Nevercode",
26251
+ constant: "NEVERCODE",
26252
+ env: "NEVERCODE",
26253
+ pr: {
26254
+ env: "NEVERCODE_PULL_REQUEST",
26255
+ ne: "false"
26256
+ }
26257
+ },
26258
+ {
26259
+ name: "Prow",
26260
+ constant: "PROW",
26261
+ env: "PROW_JOB_ID"
26262
+ },
26263
+ {
26264
+ name: "ReleaseHub",
26265
+ constant: "RELEASEHUB",
26266
+ env: "RELEASE_BUILD_ID"
26267
+ },
26268
+ {
26269
+ name: "Render",
26270
+ constant: "RENDER",
26271
+ env: "RENDER",
26272
+ pr: { IS_PULL_REQUEST: "true" }
26273
+ },
26274
+ {
26275
+ name: "Sail CI",
26276
+ constant: "SAIL",
26277
+ env: "SAILCI",
26278
+ pr: "SAIL_PULL_REQUEST_NUMBER"
26279
+ },
26280
+ {
26281
+ name: "Screwdriver",
26282
+ constant: "SCREWDRIVER",
26283
+ env: "SCREWDRIVER",
26284
+ pr: {
26285
+ env: "SD_PULL_REQUEST",
26286
+ ne: "false"
26287
+ }
26288
+ },
26289
+ {
26290
+ name: "Semaphore",
26291
+ constant: "SEMAPHORE",
26292
+ env: "SEMAPHORE",
26293
+ pr: "PULL_REQUEST_NUMBER"
26294
+ },
26295
+ {
26296
+ name: "Sourcehut",
26297
+ constant: "SOURCEHUT",
26298
+ env: { CI_NAME: "sourcehut" }
26299
+ },
26300
+ {
26301
+ name: "Strider CD",
26302
+ constant: "STRIDER",
26303
+ env: "STRIDER"
26304
+ },
26305
+ {
26306
+ name: "TaskCluster",
26307
+ constant: "TASKCLUSTER",
26308
+ env: ["TASK_ID", "RUN_ID"]
26309
+ },
26310
+ {
26311
+ name: "TeamCity",
26312
+ constant: "TEAMCITY",
26313
+ env: "TEAMCITY_VERSION"
26314
+ },
26315
+ {
26316
+ name: "Travis CI",
26317
+ constant: "TRAVIS",
26318
+ env: "TRAVIS",
26319
+ pr: {
26320
+ env: "TRAVIS_PULL_REQUEST",
26321
+ ne: "false"
26322
+ }
26323
+ },
26324
+ {
26325
+ name: "Vela",
26326
+ constant: "VELA",
26327
+ env: "VELA",
26328
+ pr: { VELA_PULL_REQUEST: "1" }
26329
+ },
26330
+ {
26331
+ name: "Vercel",
26332
+ constant: "VERCEL",
26333
+ env: { any: ["NOW_BUILDER", "VERCEL"] },
26334
+ pr: "VERCEL_GIT_PULL_REQUEST_ID"
26335
+ },
26336
+ {
26337
+ name: "Visual Studio App Center",
26338
+ constant: "APPCENTER",
26339
+ env: "APPCENTER_BUILD_ID"
26340
+ },
26341
+ {
26342
+ name: "Woodpecker",
26343
+ constant: "WOODPECKER",
26344
+ env: { CI: "woodpecker" },
26345
+ pr: { CI_BUILD_EVENT: "pull_request" }
26346
+ },
26347
+ {
26348
+ name: "Xcode Cloud",
26349
+ constant: "XCODE_CLOUD",
26350
+ env: "CI_XCODE_PROJECT",
26351
+ pr: "CI_PULL_REQUEST_NUMBER"
26352
+ },
26353
+ {
26354
+ name: "Xcode Server",
26355
+ constant: "XCODE_SERVER",
26356
+ env: "XCS"
26357
+ }
26358
+ ];
26359
+ } });
26360
+ var require_ci_info = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$2) {
26361
+ var vendors = require_vendors();
26362
+ var env$1 = process.env;
26363
+ Object.defineProperty(exports$2, "_vendors", { value: vendors.map(function(v) {
26364
+ return v.constant;
26365
+ }) });
26366
+ exports$2.name = null;
26367
+ exports$2.isPR = null;
26368
+ exports$2.id = null;
26369
+ if (env$1.CI !== "false") vendors.forEach(function(vendor) {
26370
+ const isCI2 = (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every(function(obj) {
26371
+ return checkEnv(obj);
26372
+ });
26373
+ exports$2[vendor.constant] = isCI2;
26374
+ if (!isCI2) return;
26375
+ exports$2.name = vendor.name;
26376
+ exports$2.isPR = checkPR(vendor);
26377
+ exports$2.id = vendor.constant;
26378
+ });
26379
+ exports$2.isCI = !!(env$1.CI !== "false" && (env$1.BUILD_ID || env$1.BUILD_NUMBER || env$1.CI || env$1.CI_APP_ID || env$1.CI_BUILD_ID || env$1.CI_BUILD_NUMBER || env$1.CI_NAME || env$1.CONTINUOUS_INTEGRATION || env$1.RUN_ID || exports$2.name || false));
26380
+ function checkEnv(obj) {
26381
+ if (typeof obj === "string") return !!env$1[obj];
26382
+ if ("env" in obj) return env$1[obj.env] && env$1[obj.env].includes(obj.includes);
26383
+ if ("any" in obj) return obj.any.some(function(k) {
26384
+ return !!env$1[k];
26385
+ });
26386
+ return Object.keys(obj).every(function(k) {
26387
+ return env$1[k] === obj[k];
26388
+ });
26389
+ }
26390
+ __name$1(checkEnv, "checkEnv");
26391
+ function checkPR(vendor) {
26392
+ switch (typeof vendor.pr) {
26393
+ case "string": return !!env$1[vendor.pr];
26394
+ case "object": if ("env" in vendor.pr) if ("any" in vendor.pr) return vendor.pr.any.some(function(key) {
26395
+ return env$1[vendor.pr.env] === key;
26396
+ });
26397
+ else return vendor.pr.env in env$1 && env$1[vendor.pr.env] !== vendor.pr.ne;
26398
+ else if ("any" in vendor.pr) return vendor.pr.any.some(function(key) {
26399
+ return !!env$1[key];
26400
+ });
26401
+ else return checkEnv(vendor.pr);
26402
+ default: return null;
26403
+ }
26404
+ }
26405
+ __name$1(checkPR, "checkPR");
26406
+ } });
26083
26407
  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) {
26084
26408
  var exec = __require$1("child_process").exec;
26085
26409
  var execSync = __require$1("child_process").execSync;
26086
26410
  var fs3 = __require$1("fs");
26087
- var path4 = __require$1("path");
26411
+ var path6 = __require$1("path");
26088
26412
  var access = fs3.access;
26089
26413
  var accessSync2 = fs3.accessSync;
26090
26414
  var constants2 = fs3.constants || fs3;
@@ -26161,9 +26485,9 @@ var require_command_exists = __commonJS$1({ "../../node_modules/.pnpm/command-ex
26161
26485
  }, "cleanInput");
26162
26486
  if (isUsingWindows) cleanInput = /* @__PURE__ */ __name$1(function(s) {
26163
26487
  if (/[\\]/.test(s)) {
26164
- var dirname2 = "\"" + path4.dirname(s) + "\"";
26165
- var basename2 = "\"" + path4.basename(s) + "\"";
26166
- return dirname2 + ":" + basename2;
26488
+ var dirname3 = "\"" + path6.dirname(s) + "\"";
26489
+ var basename2 = "\"" + path6.basename(s) + "\"";
26490
+ return dirname3 + ":" + basename2;
26167
26491
  }
26168
26492
  return "\"" + s + "\"";
26169
26493
  }, "cleanInput");
@@ -26385,7 +26709,7 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
26385
26709
  var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$2) {
26386
26710
  var fs3 = __require$1("fs");
26387
26711
  var ini = require_ini();
26388
- var path4 = __require$1("path");
26712
+ var path6 = __require$1("path");
26389
26713
  var stripJsonComments = require_strip_json_comments();
26390
26714
  var parse$13 = exports$2.parse = function(content) {
26391
26715
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
@@ -26396,7 +26720,7 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26396
26720
  return arg != null;
26397
26721
  });
26398
26722
  for (var i$1 in args) if ("string" !== typeof args[i$1]) return;
26399
- var file2 = path4.join.apply(null, args);
26723
+ var file2 = path6.join.apply(null, args);
26400
26724
  try {
26401
26725
  return fs3.readFileSync(file2, "utf-8");
26402
26726
  } catch (err) {
@@ -26426,14 +26750,14 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
26426
26750
  return obj;
26427
26751
  };
26428
26752
  exports$2.find = function() {
26429
- var rel = path4.join.apply(null, [].slice.call(arguments));
26753
+ var rel = path6.join.apply(null, [].slice.call(arguments));
26430
26754
  function find2(start, rel2) {
26431
- var file2 = path4.join(start, rel2);
26755
+ var file2 = path6.join(start, rel2);
26432
26756
  try {
26433
26757
  fs3.statSync(file2);
26434
26758
  return file2;
26435
26759
  } catch (err) {
26436
- if (path4.dirname(start) !== start) return find2(path4.dirname(start), rel2);
26760
+ if (path6.dirname(start) !== start) return find2(path6.dirname(start), rel2);
26437
26761
  }
26438
26762
  }
26439
26763
  __name$1(find2, "find");
@@ -26680,7 +27004,7 @@ var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/n
26680
27004
  } });
26681
27005
  var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$2, module$1) {
26682
27006
  var cc = require_utils$1();
26683
- var join2 = __require$1("path").join;
27007
+ var join3 = __require$1("path").join;
26684
27008
  var deepExtend = require_deep_extend();
26685
27009
  var etc = "/etc";
26686
27010
  var win = process.platform === "win32";
@@ -26702,12 +27026,12 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
26702
27026
  }
26703
27027
  }
26704
27028
  __name$1(addConfigFile, "addConfigFile");
26705
- if (!win) [join2(etc, name, "config"), join2(etc, name + "rc")].forEach(addConfigFile);
27029
+ if (!win) [join3(etc, name, "config"), join3(etc, name + "rc")].forEach(addConfigFile);
26706
27030
  if (home) [
26707
- join2(home, ".config", name, "config"),
26708
- join2(home, ".config", name),
26709
- join2(home, "." + name, "config"),
26710
- join2(home, "." + name + "rc")
27031
+ join3(home, ".config", name, "config"),
27032
+ join3(home, ".config", name),
27033
+ join3(home, "." + name, "config"),
27034
+ join3(home, "." + name + "rc")
26711
27035
  ].forEach(addConfigFile);
26712
27036
  addConfigFile(cc.find("." + name + "rc"));
26713
27037
  if (env$1.config) addConfigFile(env$1.config);
@@ -26823,8 +27147,8 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
26823
27147
  };
26824
27148
  }
26825
27149
  __name$1(getLegacyAuthInfo, "getLegacyAuthInfo");
26826
- function normalizePath$3(path4) {
26827
- return path4[path4.length - 1] === "/" ? path4 : path4 + "/";
27150
+ function normalizePath$3(path6) {
27151
+ return path6[path6.length - 1] === "/" ? path6 : path6 + "/";
26828
27152
  }
26829
27153
  __name$1(normalizePath$3, "normalizePath");
26830
27154
  function getAuthInfoForUrl(regUrl, npmrc) {
@@ -26860,7 +27184,7 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
26860
27184
  } });
26861
27185
  var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$2, module$1) {
26862
27186
  var { URL: URL2 } = __require$1("url");
26863
- var { join: join2 } = __require$1("path");
27187
+ var { join: join3 } = __require$1("path");
26864
27188
  var fs3 = __require$1("fs");
26865
27189
  var { promisify: promisify$3 } = __require$1("util");
26866
27190
  var { tmpdir } = __require$1("os");
@@ -26871,11 +27195,11 @@ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check
26871
27195
  var compareVersions = /* @__PURE__ */ __name$1((a, b) => a.localeCompare(b, "en-US", { numeric: true }), "compareVersions");
26872
27196
  var encode$4 = /* @__PURE__ */ __name$1((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
26873
27197
  var getFile = /* @__PURE__ */ __name$1(async (details, distTag) => {
26874
- const subDir = join2(tmpdir(), "update-check");
27198
+ const subDir = join3(tmpdir(), "update-check");
26875
27199
  if (!fs3.existsSync(subDir)) await mkdir$1(subDir);
26876
27200
  let name = `${details.name}-${distTag}.json`;
26877
27201
  if (details.scope) name = `${details.scope}-${name}`;
26878
- return join2(subDir, name);
27202
+ return join3(subDir, name);
26879
27203
  }, "getFile");
26880
27204
  var evaluateCache = /* @__PURE__ */ __name$1(async (file$2, time$2, interval) => {
26881
27205
  if (fs3.existsSync(file$2)) {
@@ -26940,9 +27264,9 @@ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check
26940
27264
  if (err.code && String(err.code).startsWith(4)) spec = await loadPackage(url, require_registry_auth_token()(regURL, { recursive: true }));
26941
27265
  else throw err;
26942
27266
  }
26943
- const version$3 = spec["dist-tags"][distTag];
26944
- if (!version$3) throw new Error(`Distribution tag ${distTag} is not available`);
26945
- return version$3;
27267
+ const version$4 = spec["dist-tags"][distTag];
27268
+ if (!version$4) throw new Error(`Distribution tag ${distTag} is not available`);
27269
+ return version$4;
26946
27270
  }, "getMostRecent");
26947
27271
  var defaultConfig = {
26948
27272
  interval: 36e5,
@@ -26996,6 +27320,7 @@ var defaultWranglerConfig = {
26996
27320
  targetEnvironment: void 0,
26997
27321
  pages_build_output_dir: void 0,
26998
27322
  send_metrics: void 0,
27323
+ dependencies_instrumentation: void 0,
26999
27324
  dev: {
27000
27325
  ip: process.platform === "win32" ? "127.0.0.1" : "localhost",
27001
27326
  port: void 0,
@@ -27042,7 +27367,6 @@ var defaultWranglerConfig = {
27042
27367
  flagship: [],
27043
27368
  ratelimits: [],
27044
27369
  worker_loaders: [],
27045
- legacy_env: true,
27046
27370
  site: void 0,
27047
27371
  wasm_modules: void 0,
27048
27372
  text_blobs: void 0,
@@ -27382,8 +27706,8 @@ function getErrorMap$1() {
27382
27706
  }
27383
27707
  __name$1(getErrorMap$1, "getErrorMap");
27384
27708
  var makeIssue$1 = /* @__PURE__ */ __name$1((params) => {
27385
- const { data: data$1, path: path4, errorMaps, issueData } = params;
27386
- const fullPath = [...path4, ...issueData.path || []];
27709
+ const { data: data$1, path: path6, errorMaps, issueData } = params;
27710
+ const fullPath = [...path6, ...issueData.path || []];
27387
27711
  const fullIssue = {
27388
27712
  ...issueData,
27389
27713
  path: fullPath
@@ -27487,11 +27811,11 @@ var ParseInputLazyPath$1 = class {
27487
27811
  static {
27488
27812
  __name$1(this, "ParseInputLazyPath");
27489
27813
  }
27490
- constructor(parent, value, path4, key) {
27814
+ constructor(parent, value, path6, key) {
27491
27815
  this._cachedPath = [];
27492
27816
  this.parent = parent;
27493
27817
  this.data = value;
27494
- this._path = path4;
27818
+ this._path = path6;
27495
27819
  this._key = key;
27496
27820
  }
27497
27821
  get path() {
@@ -27793,9 +28117,9 @@ var datetimeRegex$1 = /* @__PURE__ */ __name$1((args) => {
27793
28117
  else if (args.offset) return /* @__PURE__ */ new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
27794
28118
  else return /* @__PURE__ */ new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
27795
28119
  }, "datetimeRegex");
27796
- function isValidIP$1(ip, version$3) {
27797
- if ((version$3 === "v4" || !version$3) && ipv4Regex$1.test(ip)) return true;
27798
- if ((version$3 === "v6" || !version$3) && ipv6Regex$1.test(ip)) return true;
28120
+ function isValidIP$1(ip, version$4) {
28121
+ if ((version$4 === "v4" || !version$4) && ipv4Regex$1.test(ip)) return true;
28122
+ if ((version$4 === "v6" || !version$4) && ipv6Regex$1.test(ip)) return true;
27799
28123
  return false;
27800
28124
  }
27801
28125
  __name$1(isValidIP$1, "isValidIP");
@@ -30641,7 +30965,7 @@ function isValidWorkflowName(name) {
30641
30965
  __name$1(isValidWorkflowName, "isValidWorkflowName");
30642
30966
  z.object({
30643
30967
  retries: z.object({
30644
- delay: z.number().gte(0).or(z.string()),
30968
+ delay: z.number().gte(0).or(z.string()).or(z.function()),
30645
30969
  limit: z.number().gte(0),
30646
30970
  backoff: z.enum([
30647
30971
  "constant",
@@ -30746,7 +31070,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
30746
31070
  var getRegistryPath = getEnvironmentVariableFactory({
30747
31071
  variableName: "WRANGLER_REGISTRY_PATH",
30748
31072
  defaultValue() {
30749
- return path2.join(getGlobalConfigPath(), "registry");
31073
+ return path2__default.join(getGlobalConfigPath(), "registry");
30750
31074
  }
30751
31075
  });
30752
31076
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
@@ -30869,17 +31193,7 @@ function inheritable(diagnostics, topLevelEnv, rawEnv, field, validate, defaultV
30869
31193
  return (rawEnv !== topLevelEnv ? rawEnv[field] : void 0) ?? transformFn(topLevelEnv?.[field]) ?? defaultValue;
30870
31194
  }
30871
31195
  __name$1(inheritable, "inheritable");
30872
- function inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, rawEnv, field, validate, transformFn = (v) => v, defaultValue) {
30873
- return useServiceEnvironments && topLevelEnv !== void 0 ? notAllowedInNamedServiceEnvironment(diagnostics, topLevelEnv, rawEnv, field) : inheritable(diagnostics, topLevelEnv, rawEnv, field, validate, defaultValue, transformFn);
30874
- }
30875
- __name$1(inheritableInWranglerEnvironments, "inheritableInWranglerEnvironments");
30876
31196
  var appendEnvName = /* @__PURE__ */ __name$1((envName) => (fieldValue) => fieldValue ? `${fieldValue}-${envName}` : void 0, "appendEnvName");
30877
- function notAllowedInNamedServiceEnvironment(diagnostics, topLevelEnv, rawEnv, field) {
30878
- if (field in rawEnv) diagnostics.errors.push(`The "${field}" field is not allowed in named service environments.
30879
- Please remove the field from this environment.`);
30880
- return topLevelEnv[field];
30881
- }
30882
- __name$1(notAllowedInNamedServiceEnvironment, "notAllowedInNamedServiceEnvironment");
30883
31197
  function notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, field, validate, defaultValue) {
30884
31198
  if (rawEnv[field] !== void 0) validate(diagnostics, field, rawEnv[field], topLevelEnv);
30885
31199
  else if (rawConfig?.[field] !== void 0) diagnostics.warnings.push(`"${field}" exists at the top level, but not on "env.${envName}".
@@ -30888,9 +31202,9 @@ Please add "${field}" to "env.${envName}".`);
30888
31202
  return rawEnv[field] ?? defaultValue;
30889
31203
  }
30890
31204
  __name$1(notInheritable, "notInheritable");
30891
- function unwindPropertyPath(root, path4) {
31205
+ function unwindPropertyPath(root, path6) {
30892
31206
  let container = root;
30893
- const parts = path4.split(".");
31207
+ const parts = path6.split(".");
30894
31208
  for (let i$1 = 0; i$1 < parts.length - 1; i$1++) {
30895
31209
  if (!hasProperty(container, parts[i$1])) return;
30896
31210
  container = container[parts[i$1]];
@@ -31162,14 +31476,25 @@ function isPagesConfig(rawConfig) {
31162
31476
  }
31163
31477
  __name$1(isPagesConfig, "isPagesConfig");
31164
31478
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
31165
- const diagnostics = new Diagnostics(`Processing ${configPath ? path2.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31166
- validateOptionalProperty(diagnostics, "", "legacy_env", rawConfig.legacy_env, "boolean");
31479
+ const diagnostics = new Diagnostics(`Processing ${configPath ? path2__default.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31480
+ if ("legacy_env" in rawConfig) {
31481
+ diagnostics.errors.push(dedent`
31482
+ The "legacy_env" field is no longer supported, so please remove it from your configuration file.
31483
+ Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
31484
+ Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
31485
+ `);
31486
+ delete rawConfig.legacy_env;
31487
+ }
31167
31488
  validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
31489
+ if (validateOptionalProperty(diagnostics, "", "dependencies_instrumentation", rawConfig.dependencies_instrumentation, "object")) {
31490
+ if (typeof rawConfig.dependencies_instrumentation === "object") {
31491
+ validateOptionalProperty(diagnostics, "dependencies_instrumentation", "enabled", rawConfig.dependencies_instrumentation.enabled, "boolean");
31492
+ validateAdditionalProperties(diagnostics, "dependencies_instrumentation", Object.keys(rawConfig.dependencies_instrumentation), ["enabled"]);
31493
+ }
31494
+ }
31168
31495
  validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
31169
31496
  validateOptionalProperty(diagnostics, "", "pages_build_output_dir", rawConfig.pages_build_output_dir, "string");
31170
31497
  validateOptionalProperty(diagnostics, "", "$schema", rawConfig.$schema, "string");
31171
- const useServiceEnvironments = !(args["legacy-env"] ?? rawConfig.legacy_env ?? true);
31172
- if (useServiceEnvironments) diagnostics.warnings.push("Service environments are deprecated, and will be removed in the future. DO NOT USE IN PRODUCTION.");
31173
31498
  const isDispatchNamespace = typeof args["dispatch-namespace"] === "string" && args["dispatch-namespace"].trim() !== "";
31174
31499
  const topLevelEnv = normalizeAndValidateEnvironment(diagnostics, configPath, rawConfig, isDispatchNamespace, preserveOriginalMain);
31175
31500
  const isRedirectedConfig2 = isRedirectedRawConfig$1(rawConfig, configPath, userConfigPath);
@@ -31198,10 +31523,10 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
31198
31523
  const envDiagnostics = new Diagnostics(`"env.${envName}" environment configuration`);
31199
31524
  const rawEnv = rawConfig.env?.[envName];
31200
31525
  if (rawEnv !== void 0) {
31201
- activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, useServiceEnvironments, rawConfig);
31526
+ activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, rawConfig);
31202
31527
  diagnostics.addChild(envDiagnostics);
31203
31528
  } else if (!isPagesConfig(rawConfig)) {
31204
- activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, topLevelEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, useServiceEnvironments, rawConfig);
31529
+ activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, topLevelEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, rawConfig);
31205
31530
  const envNames = rawConfig.env ? `The available configured environment names are: ${JSON.stringify(Object.keys(rawConfig.env))}
31206
31531
  ` : "";
31207
31532
  const message = `No environment found in configuration with name "${envName}".
@@ -31221,8 +31546,8 @@ Consider adding an environment configuration section to the ${configFileName$1(c
31221
31546
  definedEnvironments: isRedirectedConfig2 ? rawConfig.definedEnvironments : definedEnvironments,
31222
31547
  targetEnvironment: isRedirectedConfig2 ? rawConfig.targetEnvironment : envName,
31223
31548
  pages_build_output_dir: normalizeAndValidatePagesBuildOutputDir(configPath, rawConfig.pages_build_output_dir),
31224
- legacy_env: !useServiceEnvironments,
31225
31549
  send_metrics: rawConfig.send_metrics,
31550
+ dependencies_instrumentation: rawConfig.dependencies_instrumentation,
31226
31551
  keep_vars: rawConfig.keep_vars,
31227
31552
  ...activeEnv,
31228
31553
  dev: normalizeAndValidateDev(diagnostics, rawConfig.dev ?? {}, args),
@@ -31266,34 +31591,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
31266
31591
  else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
31267
31592
  return {
31268
31593
  command,
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,
31594
+ watch_dir: command && configPath ? Array.isArray(watch_dir) ? watch_dir.map((dir2) => path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), `${dir2}`))) : path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), `${watch_dir}`)) : watch_dir,
31270
31595
  cwd
31271
31596
  };
31272
31597
  }
31273
31598
  __name$1(normalizeAndValidateBuild, "normalizeAndValidateBuild");
31274
31599
  function normalizeAndValidateMainField(configPath, rawMain) {
31275
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
31600
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
31276
31601
  if (rawMain !== void 0) if (typeof rawMain === "string") {
31277
- const directory = path2.resolve(configDir);
31278
- return path2.resolve(directory, rawMain);
31602
+ const directory = path2__default.resolve(configDir);
31603
+ return path2__default.resolve(directory, rawMain);
31279
31604
  } else return rawMain;
31280
31605
  else return;
31281
31606
  }
31282
31607
  __name$1(normalizeAndValidateMainField, "normalizeAndValidateMainField");
31283
31608
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
31284
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
31609
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
31285
31610
  if (rawDir !== void 0) if (typeof rawDir === "string") {
31286
- const directory = path2.resolve(configDir);
31287
- return path2.resolve(directory, rawDir);
31611
+ const directory = path2__default.resolve(configDir);
31612
+ return path2__default.resolve(directory, rawDir);
31288
31613
  } else return rawDir;
31289
31614
  else return;
31290
31615
  }
31291
31616
  __name$1(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
31292
31617
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
31293
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
31618
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
31294
31619
  if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
31295
- const directory = path2.resolve(configDir);
31296
- return path2.resolve(directory, rawPagesDir);
31620
+ const directory = path2__default.resolve(configDir);
31621
+ return path2__default.resolve(directory, rawPagesDir);
31297
31622
  } else return rawPagesDir;
31298
31623
  else return;
31299
31624
  }
@@ -31347,7 +31672,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
31347
31672
  validateOptionalProperty(diagnostics, "site", "entry-point", legacySiteEntryPoint, "string");
31348
31673
  deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
31349
31674
  \`\`\`
31350
- main = "${path2.join(String(legacySiteEntryPoint) || "workers-site", path2.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js")}"
31675
+ main = "${path2__default.join(String(legacySiteEntryPoint) || "workers-site", path2__default.extname(String(legacySiteEntryPoint) || "workers-site") ? "" : "index.js")}"
31351
31676
  \`\`\``, false, void 0, "warning");
31352
31677
  let siteEntryPoint = legacySiteEntryPoint;
31353
31678
  if (!mainEntryPoint && !siteEntryPoint) {
@@ -31360,7 +31685,7 @@ main = "workers-site/index.js"
31360
31685
  } else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
31361
31686
  They serve the same purpose: to point to the entry-point of your worker.
31362
31687
  Delete the deprecated \`site.entry-point\` field from your config.`);
31363
- if (configPath && siteEntryPoint) siteEntryPoint = path2.relative(process.cwd(), path2.join(path2.dirname(configPath), siteEntryPoint));
31688
+ if (configPath && siteEntryPoint) siteEntryPoint = path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), siteEntryPoint));
31364
31689
  return {
31365
31690
  bucket,
31366
31691
  "entry-point": siteEntryPoint,
@@ -31392,7 +31717,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
31392
31717
  if (rawMapping === void 0) return;
31393
31718
  const mapping = {};
31394
31719
  for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
31395
- if (configPath) mapping[name] = configPath ? path2.relative(process.cwd(), path2.join(path2.dirname(configPath), filePath)) : filePath;
31720
+ if (configPath) mapping[name] = configPath ? path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), filePath)) : filePath;
31396
31721
  }
31397
31722
  return mapping;
31398
31723
  }
@@ -31555,11 +31880,11 @@ var validateStreamingTailConsumers = /* @__PURE__ */ __name$1((diagnostics, fiel
31555
31880
  for (let i$1 = 0; i$1 < value.length; i$1++) isValid2 = validateStreamingTailConsumer(diagnostics, `${field}[${i$1}]`, value[i$1]) && isValid2;
31556
31881
  return isValid2;
31557
31882
  }, "validateStreamingTailConsumers");
31558
- function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, useServiceEnvironments, rawConfig) {
31883
+ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, rawConfig) {
31559
31884
  deprecated(diagnostics, rawEnv, "node_compat", `The "node_compat" field is no longer supported as of Wrangler v4. Instead, use the \`nodejs_compat\` compatibility flag. This includes the functionality from legacy \`node_compat\` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.`, true, "Removed", "error");
31560
31885
  if (topLevelEnv === void 0 || rawConfig?.unsafe === void 0) experimental(diagnostics, rawEnv, "unsafe");
31561
31886
  const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
31562
- const account_id = inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, mutateEmptyStringAccountIDValue(diagnostics, rawEnv), "account_id", isString$2, void 0, void 0);
31887
+ const account_id = inheritable(diagnostics, topLevelEnv, mutateEmptyStringAccountIDValue(diagnostics, rawEnv), "account_id", isString$2, void 0);
31563
31888
  const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv, topLevelEnv === void 0 ? void 0 : envName);
31564
31889
  const workers_dev = inheritable(diagnostics, topLevelEnv, rawEnv, "workers_dev", isBoolean, void 0);
31565
31890
  const preview_urls = inheritable(diagnostics, topLevelEnv, rawEnv, "preview_urls", isBoolean, void 0);
@@ -31572,7 +31897,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31572
31897
  jsx_fragment: inheritable(diagnostics, topLevelEnv, rawEnv, "jsx_fragment", isString$2, "React.Fragment"),
31573
31898
  tsconfig: validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath),
31574
31899
  rules: validateAndNormalizeRules(diagnostics, topLevelEnv, rawEnv, envName),
31575
- name: inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, rawEnv, "name", isDispatchNamespace ? isString$2 : isValidName, appendEnvName(envName), void 0),
31900
+ name: inheritable(diagnostics, topLevelEnv, rawEnv, "name", isDispatchNamespace ? isString$2 : isValidName, void 0, appendEnvName(envName)),
31576
31901
  main: preserveOriginalMain ? inheritable(diagnostics, topLevelEnv, rawEnv, "main", isString$2, void 0) : normalizeAndValidateMainField(configPath, inheritable(diagnostics, topLevelEnv, rawEnv, "main", isString$2, void 0)),
31577
31902
  find_additional_modules: inheritable(diagnostics, topLevelEnv, rawEnv, "find_additional_modules", isBoolean, void 0),
31578
31903
  preserve_file_names: inheritable(diagnostics, topLevelEnv, rawEnv, "preserve_file_names", isBoolean, void 0),
@@ -31652,7 +31977,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31652
31977
  __name$1(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
31653
31978
  function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
31654
31979
  const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
31655
- return configPath && tsconfig ? path2.relative(process.cwd(), path2.join(path2.dirname(configPath), tsconfig)) : tsconfig;
31980
+ return configPath && tsconfig ? path2__default.relative(process.cwd(), path2__default.join(path2__default.dirname(configPath), tsconfig)) : tsconfig;
31656
31981
  }
31657
31982
  __name$1(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
31658
31983
  var validateAndNormalizeRules = /* @__PURE__ */ __name$1((diagnostics, topLevelEnv, rawEnv, envName) => {
@@ -32152,9 +32477,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
32152
32477
  let resolvedBuildContextPath = void 0;
32153
32478
  try {
32154
32479
  if (isDockerfile(resolvedImage, configPath)) {
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);
32480
+ const baseDir$1 = configPath ? path2__default.dirname(configPath) : process.cwd();
32481
+ resolvedImage = path2__default.resolve(baseDir$1, resolvedImage);
32482
+ resolvedBuildContextPath = containerAppOptional.image_build_context ? path2__default.resolve(baseDir$1, containerAppOptional.image_build_context) : path2__default.dirname(resolvedImage);
32158
32483
  }
32159
32484
  } catch (err) {
32160
32485
  if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
@@ -33508,8 +33833,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
33508
33833
  }
33509
33834
  __name$1(isRemoteValid, "isRemoteValid");
33510
33835
  function isDockerfile(imagePath, configPath) {
33511
- const baseDir$1 = configPath ? path2.dirname(configPath) : process.cwd();
33512
- const maybeDockerfile = path2.resolve(baseDir$1, imagePath);
33836
+ const baseDir$1 = configPath ? path2__default.dirname(configPath) : process.cwd();
33837
+ const maybeDockerfile = path2__default.resolve(baseDir$1, imagePath);
33513
33838
  if (fs2.existsSync(maybeDockerfile)) {
33514
33839
  if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
33515
33840
  return true;
@@ -33658,6 +33983,140 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
33658
33983
  }
33659
33984
  }
33660
33985
  __name$1(validateDurableObjectBinding2, "validateDurableObjectBinding");
33986
+ function getPackagePath(packageName, projectPath) {
33987
+ try {
33988
+ return path2__default.dirname(__require$1.resolve(`${packageName}/package.json`, { paths: [projectPath] }));
33989
+ } catch {}
33990
+ try {
33991
+ return path2__default.dirname(__require$1.resolve(packageName, { paths: [projectPath] }));
33992
+ } catch {}
33993
+ }
33994
+ __name$1(getPackagePath, "getPackagePath");
33995
+ function isPackageInstalled(packageName, projectPath) {
33996
+ return !!getPackagePath(packageName, projectPath);
33997
+ }
33998
+ __name$1(isPackageInstalled, "isPackageInstalled");
33999
+ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
34000
+ try {
34001
+ const packagePath = getPackagePath(packageName, projectPath);
34002
+ if (!packagePath) return;
34003
+ const packageJsonPath = findFileUp("package.json", packagePath, opts.stopAtProjectPath === true ? projectPath : void 0);
34004
+ if (!packageJsonPath) return;
34005
+ const packageJson = parsePackageJSON$1(readFileSync$2(packageJsonPath), packageJsonPath);
34006
+ if (packageJson.name !== packageName) {
34007
+ const bundledVersion = packageJson.bundledVersions?.[packageName];
34008
+ if (bundledVersion !== void 0) return bundledVersion;
34009
+ }
34010
+ return packageJson.version;
34011
+ } catch {}
34012
+ }
34013
+ __name$1(getInstalledPackageVersion, "getInstalledPackageVersion");
34014
+ function findFileUp(name, startDir, lastDir) {
34015
+ let dir2 = startDir;
34016
+ const root = path2__default.parse(dir2).root;
34017
+ while (true) {
34018
+ const candidate = path2__default.join(dir2, name);
34019
+ try {
34020
+ if (statSync(candidate).isFile()) return candidate;
34021
+ } catch {}
34022
+ if (lastDir !== void 0 && dir2 === lastDir) break;
34023
+ const parent = path2__default.dirname(dir2);
34024
+ if (parent === dir2 || dir2 === root) break;
34025
+ dir2 = parent;
34026
+ }
34027
+ }
34028
+ __name$1(findFileUp, "findFileUp");
34029
+ var import_ci_info = __toESM(require_ci_info());
34030
+ function isTtyInteractive() {
34031
+ try {
34032
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
34033
+ } catch {
34034
+ return false;
34035
+ }
34036
+ }
34037
+ __name$1(isTtyInteractive, "isTtyInteractive");
34038
+ function isInteractive() {
34039
+ if (import_ci_info.default.CLOUDFLARE_PAGES || import_ci_info.default.CLOUDFLARE_WORKERS) return false;
34040
+ return isTtyInteractive();
34041
+ }
34042
+ __name$1(isInteractive, "isInteractive");
34043
+ function isNonInteractiveOrCI() {
34044
+ return !isInteractive() || import_ci_info.default.isCI;
34045
+ }
34046
+ __name$1(isNonInteractiveOrCI, "isNonInteractiveOrCI");
34047
+ function isCI() {
34048
+ return import_ci_info.default.isCI;
34049
+ }
34050
+ __name$1(isCI, "isCI");
34051
+ var arrayFormatter = new Intl.ListFormat("en-US", {
34052
+ style: "long",
34053
+ type: "conjunction"
34054
+ });
34055
+ function createConfigCache(logger, options) {
34056
+ let cacheMessageShown = false;
34057
+ const namespace = options?.namespace ?? "wrangler";
34058
+ function getCacheFolder() {
34059
+ if (namespace === "wrangler") {
34060
+ const envCacheDir = getWranglerCacheDirFromEnv();
34061
+ if (envCacheDir) return envCacheDir;
34062
+ }
34063
+ const closestNodeModulesDirectory = dir$1("node_modules");
34064
+ const nodeModulesCache = closestNodeModulesDirectory ? path2.join(closestNodeModulesDirectory, ".cache", namespace) : null;
34065
+ const localCache = path2.join(process.cwd(), `.${namespace}`, "cache");
34066
+ if (nodeModulesCache && existsSync(nodeModulesCache)) return nodeModulesCache;
34067
+ if (existsSync(localCache)) return localCache;
34068
+ if (nodeModulesCache) return nodeModulesCache;
34069
+ return localCache;
34070
+ }
34071
+ __name$1(getCacheFolder, "getCacheFolder");
34072
+ function showCacheMessage(fields, folder) {
34073
+ if (!cacheMessageShown && !isNonInteractiveOrCI()) {
34074
+ if (fields.length > 0) {
34075
+ logger.debug(`Retrieving cached values for ${arrayFormatter.format(fields)} from ${path2.relative(process.cwd(), folder)}`);
34076
+ cacheMessageShown = true;
34077
+ }
34078
+ }
34079
+ }
34080
+ __name$1(showCacheMessage, "showCacheMessage");
34081
+ function getConfigCache(fileName) {
34082
+ try {
34083
+ const cacheFolder = getCacheFolder();
34084
+ const configCacheLocation = path2.join(cacheFolder, fileName);
34085
+ const configCache = JSON.parse(readFileSync(configCacheLocation, "utf-8"));
34086
+ showCacheMessage(Object.keys(configCache), cacheFolder);
34087
+ return configCache;
34088
+ } catch {
34089
+ return {};
34090
+ }
34091
+ }
34092
+ __name$1(getConfigCache, "getConfigCache");
34093
+ function saveToConfigCache(fileName, newValues) {
34094
+ const cacheFolder = getCacheFolder();
34095
+ if (cacheFolder) {
34096
+ logger.debug(`Saving to cache: ${JSON.stringify(newValues)}`);
34097
+ const configCacheLocation = path2.join(cacheFolder, fileName);
34098
+ const existingValues = getConfigCache(fileName);
34099
+ mkdirSync(path2.dirname(configCacheLocation), { recursive: true });
34100
+ writeFileSync(configCacheLocation, JSON.stringify({
34101
+ ...existingValues,
34102
+ ...newValues
34103
+ }, null, 2));
34104
+ }
34105
+ }
34106
+ __name$1(saveToConfigCache, "saveToConfigCache");
34107
+ function purgeConfigCaches() {
34108
+ const cacheFolder = getCacheFolder();
34109
+ if (cacheFolder) removeDirSync$1(cacheFolder);
34110
+ }
34111
+ __name$1(purgeConfigCaches, "purgeConfigCaches");
34112
+ return {
34113
+ getCacheFolder,
34114
+ getConfigCache,
34115
+ saveToConfigCache,
34116
+ purgeConfigCaches
34117
+ };
34118
+ }
34119
+ __name$1(createConfigCache, "createConfigCache");
33661
34120
  var signals = [];
33662
34121
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
33663
34122
  if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
@@ -33827,7 +34286,7 @@ var process2 = globalThis.process;
33827
34286
  var { onExit, load, unload } = signalExitWrap(processOk(process2) ? new SignalExit(process2) : new SignalExitFallback());
33828
34287
  function getWranglerHiddenDirPath(projectRoot) {
33829
34288
  projectRoot ??= process.cwd();
33830
- return path2.join(projectRoot, ".wrangler");
34289
+ return path2__default.join(projectRoot, ".wrangler");
33831
34290
  }
33832
34291
  __name$1(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
33833
34292
  var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
@@ -33844,7 +34303,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
33844
34303
  const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
33845
34304
  for (const entry of entries) {
33846
34305
  if (!entry.isDirectory()) continue;
33847
- const entryPath = path2.join(tmpRoot, entry.name);
34306
+ const entryPath = path2__default.join(tmpRoot, entry.name);
33848
34307
  try {
33849
34308
  if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync$1(entryPath);
33850
34309
  } catch {}
@@ -33852,10 +34311,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
33852
34311
  }
33853
34312
  __name$1(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
33854
34313
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
33855
- const tmpRoot = path2.join(getWranglerHiddenDirPath(projectRoot), "tmp");
34314
+ const tmpRoot = path2__default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
33856
34315
  fs2.mkdirSync(tmpRoot, { recursive: true });
33857
34316
  sweepStaleWranglerTmpDirs(tmpRoot);
33858
- const tmpPrefix = path2.join(tmpRoot, `${prefix}-`);
34317
+ const tmpPrefix = path2__default.join(tmpRoot, `${prefix}-`);
33859
34318
  const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
33860
34319
  const cleanupDir = /* @__PURE__ */ __name$1(() => {
33861
34320
  if (cleanup) try {
@@ -33959,11 +34418,11 @@ and the fallback query also failed.
33959
34418
 
33960
34419
  You can manually install cloudflared from:
33961
34420
  https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared version lookup failed" });
33962
- const version$3 = fallback.version;
34421
+ const version$4 = fallback.version;
33963
34422
  const filename = getAssetFilename(goOS, goArch);
33964
34423
  return {
33965
- url: `${GITHUB_RELEASE_BASE}/${version$3}/${filename}`,
33966
- version: version$3,
34424
+ url: `${GITHUB_RELEASE_BASE}/${version$4}/${filename}`,
34425
+ version: version$4,
33967
34426
  checksum: "",
33968
34427
  compressed: filename.endsWith(".tgz"),
33969
34428
  shouldUpdate: true,
@@ -33972,13 +34431,13 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
33972
34431
  };
33973
34432
  }
33974
34433
  __name$1(getLatestVersionInfo, "getLatestVersionInfo");
33975
- function getCacheDir(version$3) {
33976
- return join(getGlobalConfigPath(), "cloudflared", version$3);
34434
+ function getCacheDir(version$4) {
34435
+ return join(getGlobalConfigPath(), "cloudflared", version$4);
33977
34436
  }
33978
34437
  __name$1(getCacheDir, "getCacheDir");
33979
- function getCloudflaredBinPath(version$3) {
34438
+ function getCloudflaredBinPath(version$4) {
33980
34439
  const binName = process.platform === "win32" ? "cloudflared.exe" : "cloudflared";
33981
- return join(getCacheDir(version$3), binName);
34440
+ return join(getCacheDir(version$4), binName);
33982
34441
  }
33983
34442
  __name$1(getCloudflaredBinPath, "getCloudflaredBinPath");
33984
34443
  function isBinaryExecutable(binPath) {
@@ -34113,8 +34572,8 @@ function writeFileAtomic(filePath, contents) {
34113
34572
  __name$1(writeFileAtomic, "writeFileAtomic");
34114
34573
  async function downloadCloudflared(versionInfo, binPath, options) {
34115
34574
  const { logger } = options ?? {};
34116
- const { url, version: version$3, checksum, compressed } = versionInfo;
34117
- logger?.log(`Downloading cloudflared ${version$3}...`);
34575
+ const { url, version: version$4, checksum, compressed } = versionInfo;
34576
+ logger?.log(`Downloading cloudflared ${version$4}...`);
34118
34577
  logger?.debug(`Download URL: ${url}`);
34119
34578
  const cacheDir = dirname(binPath);
34120
34579
  mkdirSync(cacheDir, { recursive: true });
@@ -34150,7 +34609,7 @@ Error: ${e2 instanceof Error ? e2.message : String(e2)}
34150
34609
  Please ensure you have write permissions to: ${cacheDir}`, { telemetryMessage: "tunnel cloudflared save failed" });
34151
34610
  }
34152
34611
  if (process.platform !== "win32") chmodSync(binPath, 493);
34153
- logger?.log(`cloudflared ${version$3} installed`);
34612
+ logger?.log(`cloudflared ${version$4} installed`);
34154
34613
  logger?.debug(`Binary location: ${binPath}`);
34155
34614
  }
34156
34615
  __name$1(downloadCloudflared, "downloadCloudflared");
@@ -34251,8 +34710,8 @@ async function spawnCloudflared(args, options) {
34251
34710
  });
34252
34711
  }
34253
34712
  __name$1(spawnCloudflared, "spawnCloudflared");
34254
- function removeCloudflaredCache(version$3) {
34255
- const cacheDir = version$3 ? getCacheDir(version$3) : join(getGlobalConfigPath(), "cloudflared");
34713
+ function removeCloudflaredCache(version$4) {
34714
+ const cacheDir = version$4 ? getCacheDir(version$4) : join(getGlobalConfigPath(), "cloudflared");
34256
34715
  if (existsSync(cacheDir)) {
34257
34716
  removeDirSync$1(cacheDir);
34258
34717
  return cacheDir;
@@ -34693,13 +35152,13 @@ __name$1(cloneHeaders, "cloneHeaders");
34693
35152
  var import_update_check = __toESM(require_update_check());
34694
35153
  var UPDATE_CHECK_TIMEOUT_MS = 3e3;
34695
35154
  var TIMED_OUT = Symbol("timed_out");
34696
- async function fetchLatestNpmVersion(name, version$3) {
35155
+ async function fetchLatestNpmVersion(name, version$4) {
34697
35156
  let result = null;
34698
35157
  try {
34699
35158
  result = await Promise.race([(0, import_update_check.default)({
34700
35159
  name,
34701
- version: version$3
34702
- }, { distTag: version$3.startsWith("0.0.0") ? "beta" : "latest" }), timersPromises.setTimeout(UPDATE_CHECK_TIMEOUT_MS, TIMED_OUT, { ref: false })]);
35160
+ version: version$4
35161
+ }, { distTag: version$4.startsWith("0.0.0") ? "beta" : "latest" }), timersPromises.setTimeout(UPDATE_CHECK_TIMEOUT_MS, TIMED_OUT, { ref: false })]);
34703
35162
  } catch {
34704
35163
  return { status: "failed" };
34705
35164
  }
@@ -34711,6 +35170,27 @@ async function fetchLatestNpmVersion(name, version$3) {
34711
35170
  };
34712
35171
  }
34713
35172
  __name$1(fetchLatestNpmVersion, "fetchLatestNpmVersion");
35173
+ async function openInBrowser(url, logger) {
35174
+ try {
35175
+ const { default: open$1 } = await import("./open-BCHIM4MY-d5tZGA6D.mjs");
35176
+ (await open$1(url)).on("error", (err) => {
35177
+ handleBrowserOpenError(url, err, logger);
35178
+ });
35179
+ } catch (err) {
35180
+ if (err.code === "ENOENT") handleBrowserOpenError(url, err, logger);
35181
+ else throw err;
35182
+ }
35183
+ }
35184
+ __name$1(openInBrowser, "openInBrowser");
35185
+ function handleBrowserOpenError(url, err, logger) {
35186
+ const isEnoent = err.code === "ENOENT";
35187
+ const hint = process.platform === "linux" && isEnoent ? " You may need to install `xdg-utils` (e.g. `apt install xdg-utils`) or set a default browser." : "";
35188
+ logger.warn(`Failed to open a browser automatically.${hint}
35189
+ Please visit the following URL in your browser:
35190
+ ${url}`);
35191
+ logger.debug(err instanceof Error ? err.stack ?? String(err) : String(err));
35192
+ }
35193
+ __name$1(handleBrowserOpenError, "handleBrowserOpenError");
34714
35194
  var MAX_ATTEMPTS = 3;
34715
35195
  async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
34716
35196
  try {
@@ -36435,19 +36915,19 @@ function zigzag(tpl, maskIdx, fn) {
36435
36915
  const bm = tpl;
36436
36916
  const size = bm.height;
36437
36917
  const pattern = PATTERNS[maskIdx];
36438
- let dir = -1;
36918
+ let dir$2 = -1;
36439
36919
  let y = size - 1;
36440
36920
  for (let xOffset = size - 1; xOffset > 0; xOffset -= 2) {
36441
36921
  if (xOffset == 6) xOffset = 5;
36442
- for (;; y += dir) {
36922
+ for (;; y += dir$2) {
36443
36923
  for (let j = 0; j < 2; j += 1) {
36444
36924
  const x = xOffset - j;
36445
36925
  if (bm.isDefined(x, y)) continue;
36446
36926
  fn(x, y, pattern(x, y));
36447
36927
  }
36448
- if (y + dir < 0 || y + dir >= size) break;
36928
+ if (y + dir$2 < 0 || y + dir$2 >= size) break;
36449
36929
  }
36450
- dir = -dir;
36930
+ dir$2 = -dir$2;
36451
36931
  }
36452
36932
  }
36453
36933
  function detectType(str) {
@@ -37024,7 +37504,7 @@ function createPlugin(name, pluginFactory) {
37024
37504
  }
37025
37505
  function getOutputDirectory(userConfig, environmentName) {
37026
37506
  const rootOutputDirectory = userConfig.build?.outDir ?? "dist";
37027
- return userConfig.environments?.[environmentName]?.build?.outDir ?? nodePath.join(rootOutputDirectory, environmentName);
37507
+ return userConfig.environments?.[environmentName]?.build?.outDir ?? path2.join(rootOutputDirectory, environmentName);
37028
37508
  }
37029
37509
  const postfixRE = /[?#].*$/;
37030
37510
  function cleanUrl(url) {
@@ -37890,9 +38370,9 @@ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9
37890
38370
  /** Returns a regex for validating an RFC 9562/4122 UUID.
37891
38371
  *
37892
38372
  * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
37893
- const uuid = (version$3) => {
37894
- if (!version$3) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
37895
- return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$3}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
38373
+ const uuid = (version$4) => {
38374
+ if (!version$4) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
38375
+ return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version$4}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
37896
38376
  };
37897
38377
  /** Practical email validation */
37898
38378
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
@@ -38329,7 +38809,7 @@ var Doc = class {
38329
38809
 
38330
38810
  //#endregion
38331
38811
  //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
38332
- const version$2 = {
38812
+ const version$3 = {
38333
38813
  major: 4,
38334
38814
  minor: 4,
38335
38815
  patch: 3
@@ -38342,7 +38822,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
38342
38822
  inst ?? (inst = {});
38343
38823
  inst._zod.def = def;
38344
38824
  inst._zod.bag = inst._zod.bag || {};
38345
- inst._zod.version = version$2;
38825
+ inst._zod.version = version$3;
38346
38826
  const checks = [...inst._zod.def.checks ?? []];
38347
38827
  if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
38348
38828
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
@@ -44123,13 +44603,21 @@ function up(base, options) {
44123
44603
  }
44124
44604
  __name(up, "up");
44125
44605
  function file(name, options) {
44126
- let dir, tmp;
44127
- for (dir of up(options && options.cwd || "", options)) try {
44128
- tmp = join(dir, name);
44606
+ let dir2, tmp;
44607
+ for (dir2 of up(options && options.cwd || "", options)) try {
44608
+ tmp = join(dir2, name);
44129
44609
  if (statSync(tmp).isFile()) return tmp;
44130
44610
  } catch {}
44131
44611
  }
44132
44612
  __name(file, "file");
44613
+ function dir(name, options) {
44614
+ let dir2, tmp;
44615
+ for (dir2 of up(options && options.cwd || "", options)) try {
44616
+ tmp = join(dir2, name);
44617
+ if (statSync(tmp).isDirectory()) return tmp;
44618
+ } catch {}
44619
+ }
44620
+ __name(dir, "dir");
44133
44621
  function dedent$2(templ) {
44134
44622
  var values = [];
44135
44623
  for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
@@ -44171,7 +44659,7 @@ function resolveWranglerConfigPath({ config: config$1, script }, options) {
44171
44659
  deployConfigPath: void 0,
44172
44660
  redirected: false
44173
44661
  };
44174
- return findWranglerConfig$1(script !== void 0 ? path2.dirname(script) : process.cwd(), options);
44662
+ return findWranglerConfig$1(script !== void 0 ? path2__default.dirname(script) : process.cwd(), options);
44175
44663
  }
44176
44664
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
44177
44665
  function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -44202,15 +44690,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
44202
44690
  const deployConfigFile = readFileSync$1(deployConfigPath);
44203
44691
  try {
44204
44692
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
44205
- redirectedConfigPath = deployConfig.configPath && path2.resolve(path2.dirname(deployConfigPath), deployConfig.configPath);
44693
+ redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
44206
44694
  } catch (e) {
44207
- throw new UserError$1(`Failed to parse the deploy configuration file at ${path2.relative(".", deployConfigPath)}`, {
44695
+ throw new UserError$1(`Failed to parse the deploy configuration file at ${path2__default.relative(".", deployConfigPath)}`, {
44208
44696
  cause: e,
44209
44697
  telemetryMessage: false
44210
44698
  });
44211
44699
  }
44212
44700
  if (!redirectedConfigPath) throw new UserError$1(esm_default`
44213
- A deploy configuration file was found at "${path2.relative(".", deployConfigPath)}".
44701
+ A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
44214
44702
  But this is not valid - the required "configPath" property was not found.
44215
44703
  Instead this file contains:
44216
44704
  \`\`\`
@@ -44218,13 +44706,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
44218
44706
  \`\`\`
44219
44707
  `, { telemetryMessage: false });
44220
44708
  if (!existsSync(redirectedConfigPath)) throw new UserError$1(esm_default`
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.
44709
+ There is a deploy configuration at "${path2__default.relative(".", deployConfigPath)}".
44710
+ But the redirected configuration path it points to, "${path2__default.relative(".", redirectedConfigPath)}", does not exist.
44223
44711
  `, { telemetryMessage: false });
44224
44712
  if (userConfigPath) {
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)}".
44713
+ if (path2__default.join(path2__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError$1(esm_default`
44714
+ Found both a user configuration file at "${path2__default.relative(".", userConfigPath)}"
44715
+ and a deploy configuration file at "${path2__default.relative(".", deployConfigPath)}".
44228
44716
  But these do not share the same base path so it is not clear which should be used.
44229
44717
  `, { telemetryMessage: false });
44230
44718
  }
@@ -44285,7 +44773,7 @@ const WORKER_CONFIG_FILENAME = "worker.config.json";
44285
44773
  * Absolute path to the Build Output API root for the current project.
44286
44774
  */
44287
44775
  function getBuildOutputDir(root) {
44288
- return nodePath.resolve(root, BUILD_OUTPUT_ROOT);
44776
+ return path2.resolve(root, BUILD_OUTPUT_ROOT);
44289
44777
  }
44290
44778
  /**
44291
44779
  * Clean the build output directory.
@@ -44297,25 +44785,25 @@ async function cleanBuildOutputDir(root) {
44297
44785
  * Absolute path to the Workers output directory.
44298
44786
  */
44299
44787
  function getWorkersDir(root) {
44300
- return nodePath.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
44788
+ return path2.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
44301
44789
  }
44302
44790
  /**
44303
44791
  * Absolute path to the config file for a given Worker.
44304
44792
  */
44305
44793
  function getWorkerConfigPath(root, workerName) {
44306
- return nodePath.join(getWorkersDir(root), workerName, WORKER_CONFIG_FILENAME);
44794
+ return path2.join(getWorkersDir(root), workerName, WORKER_CONFIG_FILENAME);
44307
44795
  }
44308
44796
  /**
44309
44797
  * Absolute path to the bundle directory for a given Worker.
44310
44798
  */
44311
44799
  function getWorkerBundleDir(root, workerName) {
44312
- return nodePath.join(getWorkersDir(root), workerName, "bundle");
44800
+ return path2.join(getWorkersDir(root), workerName, "bundle");
44313
44801
  }
44314
44802
  /**
44315
44803
  * Absolute path to the assets directory for a given Worker.
44316
44804
  */
44317
44805
  function getWorkerAssetsDir(root, workerName) {
44318
- return nodePath.join(getWorkersDir(root), workerName, "assets");
44806
+ return path2.join(getWorkersDir(root), workerName, "assets");
44319
44807
  }
44320
44808
  /**
44321
44809
  * Write the output `worker.config.json` for a given Worker to the Build
@@ -44330,7 +44818,7 @@ async function writeOutputWorkerConfig(root, parsedConfig, manifest) {
44330
44818
  ...rest,
44331
44819
  manifest
44332
44820
  };
44333
- const workerOutputDir = nodePath.join(getWorkersDir(root), outputConfig.name);
44821
+ const workerOutputDir = path2.join(getWorkersDir(root), outputConfig.name);
44334
44822
  await fsp.mkdir(workerOutputDir, { recursive: true });
44335
44823
  const configPath = getWorkerConfigPath(root, outputConfig.name);
44336
44824
  await fsp.writeFile(configPath, JSON.stringify(outputConfig));
@@ -44792,21 +45280,17 @@ function generateTypes({ configPath, packageName = "@cloudflare/config" }) {
44792
45280
  return import_dist.dedent`
44793
45281
  /* eslint-disable */
44794
45282
  // Generated by @cloudflare/config
44795
- import type { InferEnv, InferDurableNamespaces, InferMainModule, UnwrapConfig } from "${packageName}";
44796
- import type Config from "${configPath.replace(/\.(ts|js|mts|mjs)$/, "")}";
44797
-
44798
- type WorkerConfig = UnwrapConfig<typeof Config>;
45283
+ type __WorkerConfig = import("${packageName}").UnwrapConfig<typeof import("${configPath.replace(/\.(ts|js|mts|mjs)$/, "")}").default>;
45284
+ type __Env = import("${packageName}").InferEnv<__WorkerConfig>;
44799
45285
 
44800
- declare global {
44801
- namespace Cloudflare {
44802
- interface GlobalProps {
44803
- mainModule: InferMainModule<WorkerConfig>;
44804
- durableNamespaces: InferDurableNamespaces<WorkerConfig>;
44805
- }
44806
- interface Env extends InferEnv<WorkerConfig> {}
45286
+ declare namespace Cloudflare {
45287
+ interface GlobalProps {
45288
+ mainModule: import("${packageName}").InferMainModule<__WorkerConfig>;
45289
+ durableNamespaces: import("${packageName}").InferDurableNamespaces<__WorkerConfig>;
44807
45290
  }
44808
- interface Env extends Cloudflare.Env {}
45291
+ interface Env extends __Env {}
44809
45292
  }
45293
+ interface Env extends Cloudflare.Env {}
44810
45294
 
44811
45295
  `;
44812
45296
  }
@@ -45391,6 +45875,7 @@ let deregister;
45391
45875
  function registerConfigHooks() {
45392
45876
  if (deregister) return deregister;
45393
45877
  if (typeof process !== "undefined" && process.versions.bun) throw new Error("cloudflare.config.ts loading is not supported on Bun. Please use Node.js v22.18.0 or higher.");
45878
+ const registerHooks = nodeModule.registerHooks;
45394
45879
  if (typeof registerHooks !== "function") throw new Error("cloudflare.config.ts loading requires Node.js v22.18.0 or higher.");
45395
45880
  const hooks = registerHooks({
45396
45881
  resolve(specifier, context, nextResolve) {
@@ -45449,6 +45934,95 @@ function cleanupImportAttributes(context) {
45449
45934
  Object.freeze(context.importAttributes);
45450
45935
  }
45451
45936
 
45937
+ //#endregion
45938
+ //#region ../runtime-types/dist/index.mjs
45939
+ /**
45940
+ * Prefix of the comment written above the generated runtime types. Used to
45941
+ * detect when runtime types need to be regenerated (the full header encodes the
45942
+ * workerd version, compatibility date and flags).
45943
+ */
45944
+ const RUNTIME_HEADER_COMMENT_PREFIX = "// Runtime types generated with workerd@";
45945
+ /**
45946
+ * Marker line written immediately before the generated runtime types. Used to
45947
+ * locate the start of the runtime section within a combined `.d.ts` file.
45948
+ */
45949
+ const RUNTIME_TYPES_MARKER = "// Begin runtime types";
45950
+ /**
45951
+ * Generates the runtime header string used in the generated types file.
45952
+ * This header is used to detect when runtime types need to be regenerated.
45953
+ */
45954
+ function getRuntimeHeader(workerdVersion, compatibilityDate, compatibilityFlags = []) {
45955
+ return `${RUNTIME_HEADER_COMMENT_PREFIX}${workerdVersion} ${compatibilityDate} ${[...compatibilityFlags].sort().join(",")}`;
45956
+ }
45957
+ const require$1 = createRequire(import.meta.url);
45958
+ /**
45959
+ * Generates runtime types for a Workers project based on the provided compatibility settings.
45960
+ *
45961
+ * This function is designed to be isolated and portable, making it easy to integrate into various
45962
+ * build processes or development workflows. It handles the whole process of generating runtime
45963
+ * types, from spawning the workerd process (via Miniflare) to returning the generated types.
45964
+ *
45965
+ * If `existingContent` already contains runtime types generated for the same workerd version,
45966
+ * compatibility date and flags, the cached types are returned instead of regenerating them.
45967
+ * The caller is responsible for reading the existing `.d.ts` file (if any) and passing its
45968
+ * contents, so the file is read at most once per generation.
45969
+ *
45970
+ * @example
45971
+ * import { generateRuntimeTypes } from "@cloudflare/runtime-types";
45972
+ *
45973
+ * const { runtimeHeader, runtimeTypes, isCached } = await generateRuntimeTypes({
45974
+ * compatibilityDate: "2024-11-06",
45975
+ * compatibilityFlags: ["nodejs_compat"],
45976
+ * existingContent: await readFile("worker-configuration.d.ts", "utf8"),
45977
+ * });
45978
+ *
45979
+ * @remarks
45980
+ * `nodejs_compat` flags are ignored as there is currently no mechanism to generate these
45981
+ * dynamically; consumers should instead prompt users to install `@types/node`.
45982
+ */
45983
+ async function generateRuntimeTypes({ compatibilityDate, compatibilityFlags = [], existingContent }) {
45984
+ const header = getRuntimeHeader(version$1, compatibilityDate, compatibilityFlags);
45985
+ if (existingContent !== void 0) {
45986
+ const lines = existingContent.split("\n");
45987
+ const existingHeader = lines.find((line) => line.startsWith(RUNTIME_HEADER_COMMENT_PREFIX));
45988
+ const existingTypesStart = lines.findIndex((line) => line === RUNTIME_TYPES_MARKER);
45989
+ if (existingHeader === header && existingTypesStart !== -1) return {
45990
+ runtimeHeader: header,
45991
+ runtimeTypes: lines.slice(existingTypesStart + 1).join("\n"),
45992
+ isCached: true
45993
+ };
45994
+ }
45995
+ return {
45996
+ runtimeHeader: header,
45997
+ runtimeTypes: await generate({
45998
+ compatibilityDate,
45999
+ compatibilityFlags: compatibilityFlags.filter((flag) => !flag.includes("nodejs_compat"))
46000
+ }),
46001
+ isCached: false
46002
+ };
46003
+ }
46004
+ /**
46005
+ * Generates runtime types for Cloudflare Workers by spawning a workerd process with the type-generation
46006
+ * worker, and then making a request to that worker to fetch types.
46007
+ */
46008
+ async function generate({ compatibilityDate, compatibilityFlags = [] }) {
46009
+ const mf = new Miniflare({
46010
+ compatibilityDate: "2024-01-01",
46011
+ compatibilityFlags: ["nodejs_compat", "rtti_api"],
46012
+ modules: true,
46013
+ script: (await fsp.readFile(require$1.resolve("workerd/worker.mjs"))).toString()
46014
+ });
46015
+ const path = `http://dummy.com/${compatibilityDate}${compatibilityFlags.length ? `+${compatibilityFlags.join("+")}` : ""}`;
46016
+ try {
46017
+ const res = await mf.dispatchFetch(path);
46018
+ const text = await res.text();
46019
+ if (!res.ok) throw new Error(text);
46020
+ return text;
46021
+ } finally {
46022
+ await mf.dispose();
46023
+ }
46024
+ }
46025
+
45452
46026
  //#endregion
45453
46027
  //#region ../workers-shared/utils/configuration/constants.ts
45454
46028
  const REDIRECTS_VERSION = 1;
@@ -45606,24 +46180,24 @@ async function readBuildOutputWorkers(root) {
45606
46180
  //#endregion
45607
46181
  //#region src/deploy-config.ts
45608
46182
  function getDeployConfigPath(root) {
45609
- return nodePath.resolve(root, ".wrangler", "deploy", "config.json");
46183
+ return path2.resolve(root, ".wrangler", "deploy", "config.json");
45610
46184
  }
45611
46185
  function getWorkerConfigs(root, isPrerender) {
45612
46186
  const deployConfigPath = getDeployConfigPath(root);
45613
46187
  const deployConfig = JSON.parse(fs$1.readFileSync(deployConfigPath, "utf-8"));
45614
46188
  return [...isPrerender && deployConfig.prerenderWorkerConfigPath ? [{ configPath: deployConfig.prerenderWorkerConfigPath }] : [{ configPath: deployConfig.configPath }], ...deployConfig.auxiliaryWorkers].map(({ configPath }) => {
45615
- const resolvedConfigPath = nodePath.resolve(nodePath.dirname(deployConfigPath), configPath);
46189
+ const resolvedConfigPath = path2.resolve(path2.dirname(deployConfigPath), configPath);
45616
46190
  return wrangler.unstable_readConfig({ config: resolvedConfigPath });
45617
46191
  });
45618
46192
  }
45619
46193
  function writeDeployConfig(resolvedPluginConfig, resolvedViteConfig, isAssetsOnly) {
45620
46194
  const deployConfigPath = getDeployConfigPath(resolvedViteConfig.root);
45621
- const deployConfigDirectory = nodePath.dirname(deployConfigPath);
46195
+ const deployConfigDirectory = path2.dirname(deployConfigPath);
45622
46196
  fs$1.mkdirSync(deployConfigDirectory, { recursive: true });
45623
46197
  const resolveConfigPath = (environmentName) => {
45624
46198
  const outputDirectory = resolvedViteConfig.environments[environmentName]?.build.outDir;
45625
46199
  assert(outputDirectory, `Unexpected error: ${environmentName} environment output directory is undefined`);
45626
- return nodePath.relative(deployConfigDirectory, nodePath.resolve(resolvedViteConfig.root, outputDirectory, "wrangler.json"));
46200
+ return path2.relative(deployConfigDirectory, path2.resolve(resolvedViteConfig.root, outputDirectory, "wrangler.json"));
45627
46201
  };
45628
46202
  const auxiliaryWorkerEnvironmentNames = resolvedPluginConfig.type === "workers" ? [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([name, worker]) => name !== resolvedPluginConfig.entryWorkerEnvironmentName && name !== resolvedPluginConfig.prerenderWorkerEnvironmentName && !resolveDevOnly(worker.devOnly)).map(([name]) => name) : [];
45629
46203
  let entryEnvironmentName;
@@ -50701,10 +51275,10 @@ pp.readWord = function() {
50701
51275
  if (this.keywords.test(word)) type = keywords[word];
50702
51276
  return this.finishToken(type, word);
50703
51277
  };
50704
- var version$1 = "8.16.0";
51278
+ var version$2 = "8.16.0";
50705
51279
  Parser.acorn = {
50706
51280
  Parser,
50707
- version: version$1,
51281
+ version: version$2,
50708
51282
  defaultOptions: defaultOptions$1,
50709
51283
  Position,
50710
51284
  SourceLocation,
@@ -51119,7 +51693,7 @@ function read(jsonPath, { base, specifier }) {
51119
51693
  /** @type {string | undefined} */
51120
51694
  let string$2;
51121
51695
  try {
51122
- string$2 = fs2.readFileSync(path2.toNamespacedPath(jsonPath), "utf8");
51696
+ string$2 = fs2.readFileSync(path2__default.toNamespacedPath(jsonPath), "utf8");
51123
51697
  } catch (error) {
51124
51698
  const exception = error;
51125
51699
  if (exception.code !== "ENOENT") throw exception;
@@ -51325,7 +51899,7 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
51325
51899
  const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
51326
51900
  const basePath = fileURLToPath(base);
51327
51901
  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");
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");
51902
+ else if (path2__default.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");
51329
51903
  }
51330
51904
  /**
51331
51905
  * @param {string} path
@@ -51432,7 +52006,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
51432
52006
  {
51433
52007
  const real = realpathSync(filePath);
51434
52008
  const { search, hash } = resolved;
51435
- resolved = pathToFileURL(real + (filePath.endsWith(path2.sep) ? "/" : ""));
52009
+ resolved = pathToFileURL(real + (filePath.endsWith(path2__default.sep) ? "/" : ""));
51436
52010
  resolved.search = search;
51437
52011
  resolved.hash = hash;
51438
52012
  }
@@ -52233,7 +52807,7 @@ var NodeJsCompatWarnings = class {
52233
52807
  `;
52234
52808
  this.sources.forEach((importers, source) => {
52235
52809
  importers.forEach((importer) => {
52236
- message += ` - "${source}" imported from "${nodePath.relative(this.resolvedViteConfig.root, importer)}"\n`;
52810
+ message += ` - "${source}" imported from "${path2.relative(this.resolvedViteConfig.root, importer)}"\n`;
52237
52811
  });
52238
52812
  });
52239
52813
  this.resolvedViteConfig.logger.warn(message, { timestamp: true });
@@ -52339,7 +52913,7 @@ function getWarningForWorkersConfigs(configs) {
52339
52913
  if (!("auxiliaryWorkers" in configs) || configs.auxiliaryWorkers.length === 0) {
52340
52914
  const nonApplicableLines = getWorkerNonApplicableWarnLines(configs.entryWorker, ` - `);
52341
52915
  if (nonApplicableLines.length === 0) return;
52342
- const lines$1 = [`\n\n\x1b[43mWARNING\x1b[0m: your worker config${configs.entryWorker.config.configPath ? ` (at \`${nodePath.relative("", configs.entryWorker.config.configPath)}\`)` : ""} contains the following configuration options which are ignored since they are not applicable when using Vite:`];
52916
+ const lines$1 = [`\n\n\x1b[43mWARNING\x1b[0m: your worker config${configs.entryWorker.config.configPath ? ` (at \`${path2.relative("", configs.entryWorker.config.configPath)}\`)` : ""} contains the following configuration options which are ignored since they are not applicable when using Vite:`];
52343
52917
  nonApplicableLines.forEach((line) => lines$1.push(line));
52344
52918
  lines$1.push("");
52345
52919
  return lines$1.join("\n");
@@ -52348,7 +52922,7 @@ function getWarningForWorkersConfigs(configs) {
52348
52922
  const processWorkerConfig = (workerConfig, isEntryWorker = false) => {
52349
52923
  const nonApplicableLines = getWorkerNonApplicableWarnLines(workerConfig, ` - `, { isAuxiliary: !isEntryWorker });
52350
52924
  if (nonApplicableLines.length > 0) {
52351
- lines.push(` - (${isEntryWorker ? "entry" : "auxiliary"}) worker${workerConfig.config.name ? ` "${workerConfig.config.name}"` : ""}${workerConfig.config.configPath ? ` (config at \`${nodePath.relative("", workerConfig.config.configPath)}\`)` : ""}`);
52925
+ lines.push(` - (${isEntryWorker ? "entry" : "auxiliary"}) worker${workerConfig.config.name ? ` "${workerConfig.config.name}"` : ""}${workerConfig.config.configPath ? ` (config at \`${path2.relative("", workerConfig.config.configPath)}\`)` : ""}`);
52352
52926
  nonApplicableLines.forEach((line) => lines.push(line));
52353
52927
  }
52354
52928
  };
@@ -52442,9 +53016,9 @@ const ENTRY_MODULE_EXTENSIONS = [
52442
53016
  */
52443
53017
  function maybeResolveMain(main, configPath, root) {
52444
53018
  if (!ENTRY_MODULE_EXTENSIONS.some((extension) => main.endsWith(extension))) return main;
52445
- const baseDir$1 = configPath ? nodePath.dirname(configPath) : root;
53019
+ const baseDir$1 = configPath ? path2.dirname(configPath) : root;
52446
53020
  if (!baseDir$1) return main;
52447
- const resolvedMain = nodePath.resolve(baseDir$1, main);
53021
+ const resolvedMain = path2.resolve(baseDir$1, main);
52448
53022
  if (!fs$1.existsSync(resolvedMain)) throw new Error(`The provided Wrangler config main field (${resolvedMain}) doesn't point to an existing file`);
52449
53023
  return resolvedMain;
52450
53024
  }
@@ -52459,9 +53033,9 @@ function maybeResolveMain(main, configPath, root) {
52459
53033
  */
52460
53034
  function getValidatedWranglerConfigPath(root, requestedConfigPath, isForAuxiliaryWorker = false) {
52461
53035
  if (requestedConfigPath) {
52462
- const configPath = nodePath.resolve(root, requestedConfigPath);
53036
+ const configPath = path2.resolve(root, requestedConfigPath);
52463
53037
  const errorMessagePrefix = `The provided configPath (${configPath})${isForAuxiliaryWorker ? " requested for one of your auxiliary workers" : ""}`;
52464
- const fileExtension = nodePath.extname(configPath).slice(1);
53038
+ const fileExtension = path2.extname(configPath).slice(1);
52465
53039
  if (!allowedWranglerConfigExtensions.includes(fileExtension)) {
52466
53040
  const foundExtensionMessage = !fileExtension ? "no extension found" : `"${fileExtension}" found`;
52467
53041
  throw new Error(`${errorMessagePrefix} doesn't point to a file with the correct file extension. It should point to a jsonc, json or toml file (${foundExtensionMessage} instead)`);
@@ -52476,7 +53050,7 @@ function getValidatedWranglerConfigPath(root, requestedConfigPath, isForAuxiliar
52476
53050
  }
52477
53051
  function findWranglerConfig(root) {
52478
53052
  for (const extension of allowedWranglerConfigExtensions) {
52479
- const configPath = nodePath.join(root, `wrangler.${extension}`);
53053
+ const configPath = path2.join(root, `wrangler.${extension}`);
52480
53054
  if (fs$1.existsSync(configPath)) return configPath;
52481
53055
  }
52482
53056
  }
@@ -52490,16 +53064,25 @@ const allowedWranglerConfigExtensions = [
52490
53064
  //#region src/plugin-config.ts
52491
53065
  function normalizeNewConfig(option) {
52492
53066
  if (isForcedBuildOutput()) return {
52493
- types: { generate: typeof option === "object" ? option.types?.generate ?? true : true },
53067
+ types: {
53068
+ generate: typeof option === "object" ? option.types?.generate ?? true : true,
53069
+ includeRuntime: typeof option === "object" ? option.types?.includeRuntime ?? true : true
53070
+ },
52494
53071
  cfBuildOutput: true
52495
53072
  };
52496
53073
  if (option === void 0 || option === false) return;
52497
53074
  if (option === true) return {
52498
- types: { generate: true },
53075
+ types: {
53076
+ generate: true,
53077
+ includeRuntime: true
53078
+ },
52499
53079
  cfBuildOutput: false
52500
53080
  };
52501
53081
  return {
52502
- types: { generate: option.types?.generate ?? true },
53082
+ types: {
53083
+ generate: option.types?.generate ?? true,
53084
+ includeRuntime: option.types?.includeRuntime ?? true
53085
+ },
52503
53086
  cfBuildOutput: option.cfBuildOutput ?? false
52504
53087
  };
52505
53088
  }
@@ -52563,7 +53146,7 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
52563
53146
  newConfig: resolvedNewConfig
52564
53147
  }
52565
53148
  };
52566
- const root = userConfig.root ? nodePath.resolve(userConfig.root) : process.cwd();
53149
+ const root = userConfig.root ? path2.resolve(userConfig.root) : process.cwd();
52567
53150
  const prefixedEnv = vite.loadEnv(viteEnv.mode, root, ["CLOUDFLARE_", "WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_"]);
52568
53151
  Object.assign(process.env, prefixedEnv);
52569
53152
  const remoteBindings = prefixedEnv.CLOUDFLARE_VITE_FORCE_LOCAL === "true" ? false : pluginConfig.remoteBindings ?? true;
@@ -52594,7 +53177,8 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
52594
53177
  const result = await loadNewConfig({
52595
53178
  root,
52596
53179
  mode: viteEnv.mode,
52597
- generateTypes: resolvedNewConfig.types.generate
53180
+ command: viteEnv.command,
53181
+ types: resolvedNewConfig.types
52598
53182
  });
52599
53183
  configPath = result.configPath;
52600
53184
  rawConfigOverride = result.rawConfig;
@@ -52730,20 +53314,24 @@ const EXPERIMENTAL_CONFIG_PKG = "@cloudflare/vite-plugin/experimental-config";
52730
53314
  * file, and the set of files imported while resolving the config (for
52731
53315
  * watch-mode).
52732
53316
  *
52733
- * If `generateTypes` is true, also writes `worker-configuration.d.ts` next to
52734
- * the config when the generated content differs from what's already on disk.
53317
+ * When `types.generate` is true, also writes `worker-configuration.d.ts` next
53318
+ * to the config when the generated content differs from what's already on disk.
53319
+ * Type generation only runs in dev.
52735
53320
  */
52736
53321
  async function loadNewConfig(options) {
52737
- const configPath = nodePath.resolve(options.root, NEW_CONFIG_FILENAME);
53322
+ const configPath = path2.resolve(options.root, NEW_CONFIG_FILENAME);
52738
53323
  if (!fs$1.existsSync(configPath)) throw new Error(`\`experimental.newConfig\` is enabled but no \`${NEW_CONFIG_FILENAME}\` was found at ${configPath}.`);
52739
53324
  const { config: rawExport, dependencies } = await loadConfig(configPath);
52740
53325
  const resolved = await resolveWorkerDefinition(rawExport, { mode: options.mode });
52741
53326
  const parsed = InputWorkerSchema.safeParse(resolved);
52742
53327
  if (!parsed.success) throw new Error(`Invalid \`${NEW_CONFIG_FILENAME}\`:\n${parsed.error.message}`);
52743
53328
  const rawConfig = convertToWranglerConfig(parsed.data);
52744
- if (options.generateTypes) writeWorkerConfigurationDts({
53329
+ if (options.command === "serve" && options.types.generate) await writeWorkerConfigurationDts({
52745
53330
  root: options.root,
52746
- configPath
53331
+ configPath,
53332
+ includeRuntime: options.types.includeRuntime,
53333
+ compatibilityDate: parsed.data.compatibilityDate,
53334
+ compatibilityFlags: parsed.data.compatibilityFlags ?? []
52747
53335
  });
52748
53336
  return {
52749
53337
  rawConfig,
@@ -52758,20 +53346,35 @@ async function loadNewConfig(options) {
52758
53346
  * `experimental-config` subpath (so users don't need a direct dependency on
52759
53347
  * `@cloudflare/config`).
52760
53348
  *
52761
- * Reads the existing file first and only writes if the content differs, to
52762
- * avoid touching mtimes unnecessarily.
53349
+ * When `includeRuntime` is true, appends the Workers runtime types (generated
53350
+ * from the project's compatibility date/flags) after the inference block. The
53351
+ * runtime-types generator caches against the existing file content, so it only
53352
+ * spawns workerd when the compat date/flags/workerd version change.
53353
+ *
53354
+ * The existing file is read once and reused for both the runtime-types cache
53355
+ * check and the diff-before-write (only writes if content differs, to avoid
53356
+ * touching mtimes unnecessarily).
52763
53357
  */
52764
- function writeWorkerConfigurationDts(options) {
52765
- const outputPath = nodePath.resolve(options.root, TYPES_OUTPUT_FILENAME);
52766
- const content = generateTypes({
52767
- configPath: "./" + nodePath.relative(options.root, options.configPath),
52768
- packageName: EXPERIMENTAL_CONFIG_PKG
52769
- });
52770
- let existing;
53358
+ async function writeWorkerConfigurationDts(options) {
53359
+ const outputPath = path2.resolve(options.root, TYPES_OUTPUT_FILENAME);
53360
+ const relativeConfigPath = "./" + path2.relative(options.root, options.configPath);
53361
+ let existingContent;
52771
53362
  try {
52772
- existing = fs$1.readFileSync(outputPath, "utf8");
53363
+ existingContent = await fsp.readFile(outputPath, "utf8");
52773
53364
  } catch {}
52774
- if (existing !== content) fs$1.writeFileSync(outputPath, content);
53365
+ let content = generateTypes({
53366
+ configPath: relativeConfigPath,
53367
+ packageName: EXPERIMENTAL_CONFIG_PKG
53368
+ });
53369
+ if (options.includeRuntime) {
53370
+ const { runtimeHeader, runtimeTypes } = await generateRuntimeTypes({
53371
+ compatibilityDate: options.compatibilityDate,
53372
+ compatibilityFlags: options.compatibilityFlags,
53373
+ existingContent
53374
+ });
53375
+ content += `\n${runtimeHeader}\n${RUNTIME_TYPES_MARKER}\n${runtimeTypes}`;
53376
+ }
53377
+ if (existingContent !== content) await fsp.writeFile(outputPath, content);
52775
53378
  }
52776
53379
 
52777
53380
  //#endregion
@@ -53824,12 +54427,12 @@ const additionalModulesPlugin = createPlugin("additional-modules", (ctx) => {
53824
54427
  }
53825
54428
  const referenceId = this.emitFile({
53826
54429
  type: "asset",
53827
- name: nodePath.basename(modulePath),
54430
+ name: path2.basename(modulePath),
53828
54431
  originalFileName: modulePath,
53829
54432
  source
53830
54433
  });
53831
54434
  const emittedFileName = this.getFileName(referenceId);
53832
- const relativePath = vite.normalizePath(nodePath.relative(nodePath.dirname(chunk.fileName), emittedFileName));
54435
+ const relativePath = vite.normalizePath(path2.relative(path2.dirname(chunk.fileName), emittedFileName));
53833
54436
  const importPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
53834
54437
  magicString.update(match.index, match.index + full.length, importPath);
53835
54438
  }
@@ -54137,7 +54740,7 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
54137
54740
  * Map a bundle filename to its declared module type.
54138
54741
  */
54139
54742
  function detectModuleType(filename) {
54140
- switch (nodePath.extname(filename).toLowerCase()) {
54743
+ switch (path2.extname(filename).toLowerCase()) {
54141
54744
  case ".js":
54142
54745
  case ".mjs": return "esm";
54143
54746
  case ".wasm": return "wasm";
@@ -56872,9 +57475,9 @@ function datetimeRegex(args) {
56872
57475
  regex = `${regex}(${opts.join("|")})`;
56873
57476
  return /* @__PURE__ */ new RegExp(`^${regex}$`);
56874
57477
  }
56875
- function isValidIP(ip, version$3) {
56876
- if ((version$3 === "v4" || !version$3) && ipv4Regex.test(ip)) return true;
56877
- if ((version$3 === "v6" || !version$3) && ipv6Regex.test(ip)) return true;
57478
+ function isValidIP(ip, version$4) {
57479
+ if ((version$4 === "v4" || !version$4) && ipv4Regex.test(ip)) return true;
57480
+ if ((version$4 === "v6" || !version$4) && ipv6Regex.test(ip)) return true;
56878
57481
  return false;
56879
57482
  }
56880
57483
  function isValidJWT(jwt, alg) {
@@ -56893,9 +57496,9 @@ function isValidJWT(jwt, alg) {
56893
57496
  return false;
56894
57497
  }
56895
57498
  }
56896
- function isValidCidr(ip, version$3) {
56897
- if ((version$3 === "v4" || !version$3) && ipv4CidrRegex.test(ip)) return true;
56898
- if ((version$3 === "v6" || !version$3) && ipv6CidrRegex.test(ip)) return true;
57499
+ function isValidCidr(ip, version$4) {
57500
+ if ((version$4 === "v4" || !version$4) && ipv4CidrRegex.test(ip)) return true;
57501
+ if ((version$4 === "v6" || !version$4) && ipv6CidrRegex.test(ip)) return true;
56899
57502
  return false;
56900
57503
  }
56901
57504
  var ZodString = class ZodString extends ZodType {
@@ -59785,10 +60388,10 @@ function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig
59785
60388
  };
59786
60389
  }
59787
60390
  function getRedirectsConfigPath(config$1) {
59788
- return nodePath.join(config$1.publicDir, REDIRECTS_FILENAME);
60391
+ return path2.join(config$1.publicDir, REDIRECTS_FILENAME);
59789
60392
  }
59790
60393
  function getHeadersConfigPath(config$1) {
59791
- return nodePath.join(config$1.publicDir, HEADERS_FILENAME);
60394
+ return path2.join(config$1.publicDir, HEADERS_FILENAME);
59792
60395
  }
59793
60396
 
59794
60397
  //#endregion
@@ -59799,7 +60402,7 @@ function createBuildApp(resolvedPluginConfig) {
59799
60402
  return async (builder) => {
59800
60403
  const clientEnvironment = builder.environments.client;
59801
60404
  assert(clientEnvironment, `No "client" environment`);
59802
- const defaultHtmlPath = nodePath.resolve(builder.config.root, "index.html");
60405
+ const defaultHtmlPath = path2.resolve(builder.config.root, "index.html");
59803
60406
  const hasClientEntry = clientEnvironment.config.build.rollupOptions.input || fs$1.existsSync(defaultHtmlPath);
59804
60407
  const workerEnvironments = [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
59805
60408
  const environment = builder.environments[environmentName];
@@ -59815,7 +60418,7 @@ function createBuildApp(resolvedPluginConfig) {
59815
60418
  const { entryWorkerEnvironmentName } = resolvedPluginConfig;
59816
60419
  const entryWorkerEnvironment = builder.environments[entryWorkerEnvironmentName];
59817
60420
  assert(entryWorkerEnvironment, `No "${entryWorkerEnvironmentName}" environment`);
59818
- const entryWorkerBuildDirectory = nodePath.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir);
60421
+ const entryWorkerBuildDirectory = path2.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir);
59819
60422
  const importedAssetPaths = getImportedAssetPaths(loadViteManifest(entryWorkerBuildDirectory));
59820
60423
  if (hasClientEntry) await builder.build(clientEnvironment);
59821
60424
  else if (importedAssetPaths.size || getHasPublicAssets(builder.config) || resolvedPluginConfig.prerenderWorkerEnvironmentName) await fallbackBuild(builder, clientEnvironment);
@@ -59824,21 +60427,21 @@ function createBuildApp(resolvedPluginConfig) {
59824
60427
  if (!satisfiesMinimumViteVersion("7.0.0") && !cfBuildOutput) removeAssetsField(entryWorkerBuildDirectory);
59825
60428
  return;
59826
60429
  }
59827
- const clientBuildDirectory = nodePath.resolve(builder.config.root, clientEnvironment.config.build.outDir);
60430
+ const clientBuildDirectory = path2.resolve(builder.config.root, clientEnvironment.config.build.outDir);
59828
60431
  const movedAssetPaths = [];
59829
60432
  for (const assetPath of importedAssetPaths) {
59830
- const src$1 = nodePath.join(entryWorkerBuildDirectory, assetPath);
59831
- const dest = nodePath.join(clientBuildDirectory, assetPath);
60433
+ const src$1 = path2.join(entryWorkerBuildDirectory, assetPath);
60434
+ const dest = path2.join(clientBuildDirectory, assetPath);
59832
60435
  if (!fs$1.existsSync(src$1)) continue;
59833
60436
  if (fs$1.existsSync(dest)) fs$1.unlinkSync(src$1);
59834
60437
  else {
59835
- const destDir = nodePath.dirname(dest);
60438
+ const destDir = path2.dirname(dest);
59836
60439
  fs$1.mkdirSync(destDir, { recursive: true });
59837
60440
  fs$1.renameSync(src$1, dest);
59838
60441
  movedAssetPaths.push(dest);
59839
60442
  }
59840
60443
  }
59841
- if (movedAssetPaths.length) builder.config.logger.info([`${import_picocolors$4.default.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => import_picocolors$4.default.dim(nodePath.relative(builder.config.root, assetPath)))].join("\n"));
60444
+ if (movedAssetPaths.length) builder.config.logger.info([`${import_picocolors$4.default.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => import_picocolors$4.default.dim(path2.relative(builder.config.root, assetPath)))].join("\n"));
59842
60445
  };
59843
60446
  }
59844
60447
  function getHasPublicAssets({ publicDir }) {
@@ -59855,11 +60458,11 @@ async function fallbackBuild(builder, environment) {
59855
60458
  output: { entryFileNames: CLIENT_FALLBACK_ENTRY_NAME }
59856
60459
  };
59857
60460
  await builder.build(environment);
59858
- const fallbackEntryPath = nodePath.resolve(builder.config.root, environment.config.build.outDir, CLIENT_FALLBACK_ENTRY_NAME);
60461
+ const fallbackEntryPath = path2.resolve(builder.config.root, environment.config.build.outDir, CLIENT_FALLBACK_ENTRY_NAME);
59859
60462
  fs$1.unlinkSync(fallbackEntryPath);
59860
60463
  }
59861
60464
  function loadViteManifest(directory) {
59862
- const contents = fs$1.readFileSync(nodePath.resolve(directory, ".vite", "manifest.json"), "utf-8");
60465
+ const contents = fs$1.readFileSync(path2.resolve(directory, ".vite", "manifest.json"), "utf-8");
59863
60466
  return JSON.parse(contents);
59864
60467
  }
59865
60468
  function getImportedAssetPaths(viteManifest) {
@@ -59870,7 +60473,7 @@ function getImportedAssetPaths(viteManifest) {
59870
60473
  * Used to remove the `assets` field from the entry Worker config if there are no assets
59871
60474
  */
59872
60475
  function removeAssetsField(entryWorkerBuildDirectory) {
59873
- const entryWorkerConfigPath = nodePath.join(entryWorkerBuildDirectory, "wrangler.json");
60476
+ const entryWorkerConfigPath = path2.join(entryWorkerBuildDirectory, "wrangler.json");
59874
60477
  const workerConfig = JSON.parse(fs$1.readFileSync(entryWorkerConfigPath, "utf-8"));
59875
60478
  workerConfig.assets = void 0;
59876
60479
  fs$1.writeFileSync(entryWorkerConfigPath, JSON.stringify(workerConfig));
@@ -59912,12 +60515,12 @@ function quoteForDotenv(value) {
59912
60515
  */
59913
60516
  function hasLocalDevVarsFileChanged({ configPaths, cloudflareEnv }, changedFilePath) {
59914
60517
  return [...configPaths].some((configPath) => {
59915
- const configDir = nodePath.dirname(configPath);
60518
+ const configDir = path2.dirname(configPath);
59916
60519
  return [
59917
60520
  ".dev.vars",
59918
60521
  ".env",
59919
60522
  ...cloudflareEnv ? [`.dev.vars.${cloudflareEnv}`, `.env.${cloudflareEnv}`] : []
59920
- ].some((localDevFile) => changedFilePath === nodePath.join(configDir, localDevFile));
60523
+ ].some((localDevFile) => changedFilePath === path2.join(configDir, localDevFile));
59921
60524
  });
59922
60525
  }
59923
60526
 
@@ -60021,7 +60624,7 @@ const configPlugin = createPlugin("config", (ctx) => {
60021
60624
  assert(entryWorkerEnvironment, `No "${entryWorkerEnvironmentName}" environment`);
60022
60625
  const cfBuildOutput = ctx.resolvedPluginConfig.experimental.newConfig?.cfBuildOutput === true;
60023
60626
  if (entryWorkerEnvironment.isBuilt) {
60024
- if (!builder.environments.client?.isBuilt && !cfBuildOutput) removeAssetsField(nodePath.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir));
60627
+ if (!builder.environments.client?.isBuilt && !cfBuildOutput) removeAssetsField(path2.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir));
60025
60628
  } else {
60026
60629
  const clientEnvironment = builder.environments.client;
60027
60630
  assert(clientEnvironment, "No \"client\" environment");
@@ -60043,7 +60646,7 @@ const configPlugin = createPlugin("config", (ctx) => {
60043
60646
  }
60044
60647
  };
60045
60648
  if (outputConfig.unsafe && Object.keys(outputConfig.unsafe).length === 0) outputConfig.unsafe = void 0;
60046
- fs$1.writeFileSync(nodePath.resolve(builder.config.root, clientEnvironment.config.build.outDir, "wrangler.json"), JSON.stringify(outputConfig));
60649
+ fs$1.writeFileSync(path2.resolve(builder.config.root, clientEnvironment.config.build.outDir, "wrangler.json"), JSON.stringify(outputConfig));
60047
60650
  writeDeployConfig(ctx.resolvedPluginConfig, ctx.resolvedViteConfig, true);
60048
60651
  }
60049
60652
  }
@@ -61491,7 +62094,7 @@ function getContainerOptions(options) {
61491
62094
  return containersConfig.map((container) => {
61492
62095
  if (isDockerfile(container.image, configPath)) return {
61493
62096
  dockerfile: container.image,
61494
- image_build_context: container.image_build_context ?? path2.dirname(container.image),
62097
+ image_build_context: container.image_build_context ?? path2__default.dirname(container.image),
61495
62098
  image_vars: container.image_vars,
61496
62099
  class_name: container.class_name,
61497
62100
  image_tag: getDevContainerImageName(container.class_name, containerBuildId)
@@ -64199,7 +64802,7 @@ const INTERNAL_WORKERS_COMPATIBILITY_DATE = "2024-10-04";
64199
64802
  const PUBLIC_DIR_PREFIX = "/__vite_public_dir__";
64200
64803
  function getPersistenceRoot(root, persistState) {
64201
64804
  if (persistState === false) return;
64202
- return nodePath.resolve(root, typeof persistState === "object" ? persistState.path : ".wrangler/state", "v3");
64805
+ return path2.resolve(root, typeof persistState === "object" ? persistState.path : ".wrangler/state", "v3");
64203
64806
  }
64204
64807
  const miniflareModulesRoot = process.platform === "win32" ? "Z:\\" : "/";
64205
64808
  const ROUTER_WORKER_PATH = "./workers/router-worker/index.js";
@@ -64223,7 +64826,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64223
64826
  modulesRoot: miniflareModulesRoot,
64224
64827
  modules: [{
64225
64828
  type: "ESModule",
64226
- path: nodePath.join(miniflareModulesRoot, ROUTER_WORKER_PATH),
64829
+ path: path2.join(miniflareModulesRoot, ROUTER_WORKER_PATH),
64227
64830
  contents: fs$1.readFileSync(fileURLToPath(new URL(ROUTER_WORKER_PATH, import.meta.url)))
64228
64831
  }],
64229
64832
  bindings: { CONFIG: { has_user_worker: resolvedPluginConfig.type === "workers" } },
@@ -64238,7 +64841,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64238
64841
  modulesRoot: miniflareModulesRoot,
64239
64842
  modules: [{
64240
64843
  type: "ESModule",
64241
- path: nodePath.join(miniflareModulesRoot, ASSET_WORKER_PATH),
64844
+ path: path2.join(miniflareModulesRoot, ASSET_WORKER_PATH),
64242
64845
  contents: fs$1.readFileSync(fileURLToPath(new URL(ASSET_WORKER_PATH, import.meta.url)))
64243
64846
  }],
64244
64847
  bindings: {
@@ -64253,8 +64856,8 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64253
64856
  const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
64254
64857
  const publicPath = withTrailingSlash(publicDir.slice(root.length));
64255
64858
  if (publicDirInRoot && pathname.startsWith(publicPath)) return Response$1.json(null);
64256
- const publicDirFilePath = nodePath.join(publicDir, pathname);
64257
- const rootDirFilePath = nodePath.join(root, pathname);
64859
+ const publicDirFilePath = path2.join(publicDir, pathname);
64860
+ const rootDirFilePath = path2.join(root, pathname);
64258
64861
  for (const resolvedPath of [publicDirFilePath, rootDirFilePath]) try {
64259
64862
  if ((await fsp.stat(resolvedPath)).isFile()) return Response$1.json(resolvedPath === publicDirFilePath ? `${PUBLIC_DIR_PREFIX}${pathname}` : pathname);
64260
64863
  } catch {}
@@ -64265,7 +64868,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64265
64868
  const { pathname } = new URL(request$2.url);
64266
64869
  const { root, publicDir } = resolvedViteConfig;
64267
64870
  const isInPublicDir = pathname.startsWith(PUBLIC_DIR_PREFIX);
64268
- const resolvedPath = isInPublicDir ? nodePath.join(publicDir, pathname.slice(20)) : nodePath.join(root, pathname);
64871
+ const resolvedPath = isInPublicDir ? path2.join(publicDir, pathname.slice(20)) : path2.join(root, pathname);
64269
64872
  try {
64270
64873
  let html = await fsp.readFile(resolvedPath, "utf-8");
64271
64874
  if (!isInPublicDir) html = await viteDevServer.transformIndexHtml(resolvedPath, html);
@@ -64282,7 +64885,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64282
64885
  modulesRoot: miniflareModulesRoot,
64283
64886
  modules: [{
64284
64887
  type: "ESModule",
64285
- path: nodePath.join(miniflareModulesRoot, VITE_PROXY_WORKER_PATH),
64888
+ path: path2.join(miniflareModulesRoot, VITE_PROXY_WORKER_PATH),
64286
64889
  contents: fs$1.readFileSync(fileURLToPath(new URL(VITE_PROXY_WORKER_PATH, import.meta.url)))
64287
64890
  }],
64288
64891
  serviceBindings: {
@@ -64298,7 +64901,8 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64298
64901
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await wrangler.maybeStartOrUpdateRemoteProxySession({
64299
64902
  name: worker.config.name,
64300
64903
  bindings: bindings$1 ?? {},
64301
- account_id: worker.config.account_id
64904
+ account_id: worker.config.account_id,
64905
+ profileDir: resolvedViteConfig.root
64302
64906
  }, preExistingRemoteProxySession ?? null);
64303
64907
  if (worker.config.configPath && remoteProxySessionData) remoteProxySessionsDataMap.set(worker.config.configPath, remoteProxySessionData);
64304
64908
  let containerBuildId;
@@ -64338,17 +64942,17 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64338
64942
  modules: [
64339
64943
  {
64340
64944
  type: "ESModule",
64341
- path: nodePath.join(miniflareModulesRoot, WRAPPER_PATH),
64945
+ path: path2.join(miniflareModulesRoot, WRAPPER_PATH),
64342
64946
  contents: wrappers.join("\n")
64343
64947
  },
64344
64948
  {
64345
64949
  type: "ESModule",
64346
- path: nodePath.join(miniflareModulesRoot, RUNNER_PATH),
64950
+ path: path2.join(miniflareModulesRoot, RUNNER_PATH),
64347
64951
  contents: fs$1.readFileSync(fileURLToPath(new URL(RUNNER_PATH, import.meta.url)))
64348
64952
  },
64349
64953
  {
64350
64954
  type: "ESModule",
64351
- path: nodePath.join(miniflareModulesRoot, "workers/runner-worker/vite/module-runner"),
64955
+ path: path2.join(miniflareModulesRoot, "workers/runner-worker/vite/module-runner"),
64352
64956
  contents: fs$1.readFileSync(fileURLToPath(new URL(satisfiesMinimumViteVersion("7.2.0") ? MODULE_RUNNER_PATH : MODULE_RUNNER_LEGACY_PATH, import.meta.url)))
64353
64957
  }
64354
64958
  ],
@@ -64402,6 +65006,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64402
65006
  telemetry: { enabled: false },
64403
65007
  handleStructuredLogs: getStructuredLogsLogger(logger),
64404
65008
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
65009
+ defaultProjectTmpPath: path2.resolve(resolvedViteConfig.root, ".wrangler/tmp"),
64405
65010
  workers: [
64406
65011
  ...assetWorkers,
64407
65012
  ...externalWorkers,
@@ -64436,8 +65041,8 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64436
65041
  }
64437
65042
  function getPreviewModules(main, modulesRules) {
64438
65043
  assert(modulesRules, `Unexpected error: 'modulesRules' is undefined`);
64439
- const rootPath = nodePath.dirname(main);
64440
- const entryPath = nodePath.basename(main);
65044
+ const rootPath = path2.dirname(main);
65045
+ const entryPath = path2.basename(main);
64441
65046
  return {
64442
65047
  rootPath,
64443
65048
  modules: [{
@@ -64505,7 +65110,8 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
64505
65110
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await wrangler.maybeStartOrUpdateRemoteProxySession({
64506
65111
  name: workerConfig.name,
64507
65112
  bindings: bindings$1 ?? {},
64508
- account_id: workerConfig.account_id
65113
+ account_id: workerConfig.account_id,
65114
+ profileDir: resolvedViteConfig.root
64509
65115
  }, preExistingRemoteProxySessionData ?? null);
64510
65116
  if (workerConfig.configPath && remoteProxySessionData) remoteProxySessionsDataMap.set(workerConfig.configPath, remoteProxySessionData);
64511
65117
  let containerBuildId;
@@ -64554,6 +65160,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
64554
65160
  telemetry: { enabled: false },
64555
65161
  handleStructuredLogs: getStructuredLogsLogger(logger),
64556
65162
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
65163
+ defaultProjectTmpPath: path2.resolve(resolvedViteConfig.root, ".wrangler/tmp"),
64557
65164
  workers
64558
65165
  },
64559
65166
  containerTagToOptionsMap
@@ -64965,7 +65572,7 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
64965
65572
  }
64966
65573
  } else if (this.environment.name === "client") {
64967
65574
  const filesToAssetsIgnore = ["wrangler.json", ".dev.vars"];
64968
- const existingAssetsIgnoreContent = ctx.resolvedViteConfig.publicDir.length > 0 ? readAssetsIgnoreFile(nodePath.join(ctx.resolvedViteConfig.publicDir, ".assetsignore")) : "";
65575
+ const existingAssetsIgnoreContent = ctx.resolvedViteConfig.publicDir.length > 0 ? readAssetsIgnoreFile(path2.join(ctx.resolvedViteConfig.publicDir, ".assetsignore")) : "";
64969
65576
  this.emitFile({
64970
65577
  type: "asset",
64971
65578
  fileName: ".assetsignore",
@@ -64997,8 +65604,8 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
64997
65604
  };
64998
65605
  });
64999
65606
  function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedViteConfig, entryFileName, includeAssets }) {
65000
- const sourceConfigDirectory = inputWorkerConfig.configPath ? nodePath.dirname(inputWorkerConfig.configPath) : resolvedViteConfig.root;
65001
- const outputDirectory = nodePath.resolve(resolvedViteConfig.root, workerOutputDirectory);
65607
+ const sourceConfigDirectory = inputWorkerConfig.configPath ? path2.dirname(inputWorkerConfig.configPath) : resolvedViteConfig.root;
65608
+ const outputDirectory = path2.resolve(resolvedViteConfig.root, workerOutputDirectory);
65002
65609
  return {
65003
65610
  ...inputWorkerConfig,
65004
65611
  main: entryFileName,
@@ -65013,8 +65620,8 @@ function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedVit
65013
65620
  } : void 0,
65014
65621
  d1_databases: inputWorkerConfig.d1_databases.map((database) => {
65015
65622
  const sourceMigrationsDir = database.migrations_dir ?? "migrations";
65016
- const sourceMigrationsPath = nodePath.resolve(sourceConfigDirectory, sourceMigrationsDir);
65017
- const outputMigrationsDir = vite.normalizePath(nodePath.relative(outputDirectory, sourceMigrationsPath) || ".");
65623
+ const sourceMigrationsPath = path2.resolve(sourceConfigDirectory, sourceMigrationsDir);
65624
+ const outputMigrationsDir = vite.normalizePath(path2.relative(outputDirectory, sourceMigrationsPath) || ".");
65018
65625
  return {
65019
65626
  ...database,
65020
65627
  migrations_dir: outputMigrationsDir,
@@ -65025,10 +65632,10 @@ function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedVit
65025
65632
  }
65026
65633
  function rewriteMigrationsPattern(migrationsPattern, fromMigrationsDir, toMigrationsDir) {
65027
65634
  if (migrationsPattern === void 0) return;
65028
- const normalizedDir = nodePath.posix.normalize(vite.normalizePath(fromMigrationsDir));
65029
- const normalizedPattern = nodePath.posix.normalize(vite.normalizePath(migrationsPattern));
65030
- const suffix = normalizedDir === "." ? normalizedPattern : nodePath.posix.relative(normalizedDir, normalizedPattern);
65031
- return vite.normalizePath(nodePath.posix.normalize(toMigrationsDir === "." ? suffix : `${toMigrationsDir}/${suffix}`));
65635
+ const normalizedDir = path2.posix.normalize(vite.normalizePath(fromMigrationsDir));
65636
+ const normalizedPattern = path2.posix.normalize(vite.normalizePath(migrationsPattern));
65637
+ const suffix = normalizedDir === "." ? normalizedPattern : path2.posix.relative(normalizedDir, normalizedPattern);
65638
+ return vite.normalizePath(path2.posix.normalize(toMigrationsDir === "." ? suffix : `${toMigrationsDir}/${suffix}`));
65032
65639
  }
65033
65640
  function readAssetsIgnoreFile(assetsIgnorePath) {
65034
65641
  const content = fs$1.existsSync(assetsIgnorePath) ? fs$1.readFileSync(assetsIgnorePath, "utf-8") : "";
@@ -65038,7 +65645,7 @@ function readAssetsIgnoreFile(assetsIgnorePath) {
65038
65645
  function getAssetsDirectory(workerOutputDirectory, resolvedViteConfig) {
65039
65646
  const clientOutputDirectory = resolvedViteConfig.environments.client?.build.outDir;
65040
65647
  assert(clientOutputDirectory, "Unexpected error: client output directory is undefined");
65041
- return vite.normalizePath(nodePath.relative(nodePath.resolve(resolvedViteConfig.root, workerOutputDirectory), nodePath.resolve(resolvedViteConfig.root, clientOutputDirectory)));
65648
+ return vite.normalizePath(path2.relative(path2.resolve(resolvedViteConfig.root, workerOutputDirectory), path2.resolve(resolvedViteConfig.root, clientOutputDirectory)));
65042
65649
  }
65043
65650
 
65044
65651
  //#endregion
@@ -65438,8 +66045,8 @@ var is_in_ssh_default = isInSsh;
65438
66045
  //#endregion
65439
66046
  //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
65440
66047
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
65441
- const __dirname = import.meta.url ? path2.dirname(fileURLToPath(import.meta.url)) : "";
65442
- const localXdgOpenPath = path2.join(__dirname, "xdg-open");
66048
+ const __dirname = import.meta.url ? path2__default.dirname(fileURLToPath(import.meta.url)) : "";
66049
+ const localXdgOpenPath = path2__default.join(__dirname, "xdg-open");
65443
66050
  const { platform, arch: arch$1 } = process$1;
65444
66051
  const tryEachApp = async (apps$1, opener) => {
65445
66052
  if (apps$1.length === 0) return;