@cloudflare/vite-plugin 1.44.0 → 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 path5 = __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 = "\"" + path5.dirname(s) + "\"";
26165
- var basename2 = "\"" + path5.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 path5 = __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 = path5.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 = path5.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 = path5.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 (path5.dirname(start) !== start) return find2(path5.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(path5) {
26827
- return path5[path5.length - 1] === "/" ? path5 : path5 + "/";
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,
@@ -27043,7 +27367,6 @@ var defaultWranglerConfig = {
27043
27367
  flagship: [],
27044
27368
  ratelimits: [],
27045
27369
  worker_loaders: [],
27046
- legacy_env: true,
27047
27370
  site: void 0,
27048
27371
  wasm_modules: void 0,
27049
27372
  text_blobs: void 0,
@@ -27383,8 +27706,8 @@ function getErrorMap$1() {
27383
27706
  }
27384
27707
  __name$1(getErrorMap$1, "getErrorMap");
27385
27708
  var makeIssue$1 = /* @__PURE__ */ __name$1((params) => {
27386
- const { data: data$1, path: path5, errorMaps, issueData } = params;
27387
- const fullPath = [...path5, ...issueData.path || []];
27709
+ const { data: data$1, path: path6, errorMaps, issueData } = params;
27710
+ const fullPath = [...path6, ...issueData.path || []];
27388
27711
  const fullIssue = {
27389
27712
  ...issueData,
27390
27713
  path: fullPath
@@ -27488,11 +27811,11 @@ var ParseInputLazyPath$1 = class {
27488
27811
  static {
27489
27812
  __name$1(this, "ParseInputLazyPath");
27490
27813
  }
27491
- constructor(parent, value, path5, key) {
27814
+ constructor(parent, value, path6, key) {
27492
27815
  this._cachedPath = [];
27493
27816
  this.parent = parent;
27494
27817
  this.data = value;
27495
- this._path = path5;
27818
+ this._path = path6;
27496
27819
  this._key = key;
27497
27820
  }
27498
27821
  get path() {
@@ -27794,9 +28117,9 @@ var datetimeRegex$1 = /* @__PURE__ */ __name$1((args) => {
27794
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)$`);
27795
28118
  else return /* @__PURE__ */ new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
27796
28119
  }, "datetimeRegex");
27797
- function isValidIP$1(ip, version$3) {
27798
- if ((version$3 === "v4" || !version$3) && ipv4Regex$1.test(ip)) return true;
27799
- 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;
27800
28123
  return false;
27801
28124
  }
27802
28125
  __name$1(isValidIP$1, "isValidIP");
@@ -30747,7 +31070,7 @@ var getBuildPlatformFromEnv = getEnvironmentVariableFactory({ variableName: "WRA
30747
31070
  var getRegistryPath = getEnvironmentVariableFactory({
30748
31071
  variableName: "WRANGLER_REGISTRY_PATH",
30749
31072
  defaultValue() {
30750
- return path2.join(getGlobalConfigPath(), "registry");
31073
+ return path2__default.join(getGlobalConfigPath(), "registry");
30751
31074
  }
30752
31075
  });
30753
31076
  var getD1ExtraLocationChoices = getEnvironmentVariableFactory({ variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES" });
@@ -30870,17 +31193,7 @@ function inheritable(diagnostics, topLevelEnv, rawEnv, field, validate, defaultV
30870
31193
  return (rawEnv !== topLevelEnv ? rawEnv[field] : void 0) ?? transformFn(topLevelEnv?.[field]) ?? defaultValue;
30871
31194
  }
30872
31195
  __name$1(inheritable, "inheritable");
30873
- function inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, rawEnv, field, validate, transformFn = (v) => v, defaultValue) {
30874
- return useServiceEnvironments && topLevelEnv !== void 0 ? notAllowedInNamedServiceEnvironment(diagnostics, topLevelEnv, rawEnv, field) : inheritable(diagnostics, topLevelEnv, rawEnv, field, validate, defaultValue, transformFn);
30875
- }
30876
- __name$1(inheritableInWranglerEnvironments, "inheritableInWranglerEnvironments");
30877
31196
  var appendEnvName = /* @__PURE__ */ __name$1((envName) => (fieldValue) => fieldValue ? `${fieldValue}-${envName}` : void 0, "appendEnvName");
30878
- function notAllowedInNamedServiceEnvironment(diagnostics, topLevelEnv, rawEnv, field) {
30879
- if (field in rawEnv) diagnostics.errors.push(`The "${field}" field is not allowed in named service environments.
30880
- Please remove the field from this environment.`);
30881
- return topLevelEnv[field];
30882
- }
30883
- __name$1(notAllowedInNamedServiceEnvironment, "notAllowedInNamedServiceEnvironment");
30884
31197
  function notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, field, validate, defaultValue) {
30885
31198
  if (rawEnv[field] !== void 0) validate(diagnostics, field, rawEnv[field], topLevelEnv);
30886
31199
  else if (rawConfig?.[field] !== void 0) diagnostics.warnings.push(`"${field}" exists at the top level, but not on "env.${envName}".
@@ -30889,9 +31202,9 @@ Please add "${field}" to "env.${envName}".`);
30889
31202
  return rawEnv[field] ?? defaultValue;
30890
31203
  }
30891
31204
  __name$1(notInheritable, "notInheritable");
30892
- function unwindPropertyPath(root, path5) {
31205
+ function unwindPropertyPath(root, path6) {
30893
31206
  let container = root;
30894
- const parts = path5.split(".");
31207
+ const parts = path6.split(".");
30895
31208
  for (let i$1 = 0; i$1 < parts.length - 1; i$1++) {
30896
31209
  if (!hasProperty(container, parts[i$1])) return;
30897
31210
  container = container[parts[i$1]];
@@ -31163,8 +31476,15 @@ function isPagesConfig(rawConfig) {
31163
31476
  }
31164
31477
  __name$1(isPagesConfig, "isPagesConfig");
31165
31478
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
31166
- const diagnostics = new Diagnostics(`Processing ${configPath ? path2.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
31167
- 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
+ }
31168
31488
  validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
31169
31489
  if (validateOptionalProperty(diagnostics, "", "dependencies_instrumentation", rawConfig.dependencies_instrumentation, "object")) {
31170
31490
  if (typeof rawConfig.dependencies_instrumentation === "object") {
@@ -31175,8 +31495,6 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
31175
31495
  validateOptionalProperty(diagnostics, "", "keep_vars", rawConfig.keep_vars, "boolean");
31176
31496
  validateOptionalProperty(diagnostics, "", "pages_build_output_dir", rawConfig.pages_build_output_dir, "string");
31177
31497
  validateOptionalProperty(diagnostics, "", "$schema", rawConfig.$schema, "string");
31178
- const useServiceEnvironments = !(args["legacy-env"] ?? rawConfig.legacy_env ?? true);
31179
- if (useServiceEnvironments) diagnostics.warnings.push("Service environments are deprecated, and will be removed in the future. DO NOT USE IN PRODUCTION.");
31180
31498
  const isDispatchNamespace = typeof args["dispatch-namespace"] === "string" && args["dispatch-namespace"].trim() !== "";
31181
31499
  const topLevelEnv = normalizeAndValidateEnvironment(diagnostics, configPath, rawConfig, isDispatchNamespace, preserveOriginalMain);
31182
31500
  const isRedirectedConfig2 = isRedirectedRawConfig$1(rawConfig, configPath, userConfigPath);
@@ -31205,10 +31523,10 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
31205
31523
  const envDiagnostics = new Diagnostics(`"env.${envName}" environment configuration`);
31206
31524
  const rawEnv = rawConfig.env?.[envName];
31207
31525
  if (rawEnv !== void 0) {
31208
- activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, useServiceEnvironments, rawConfig);
31526
+ activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, rawConfig);
31209
31527
  diagnostics.addChild(envDiagnostics);
31210
31528
  } else if (!isPagesConfig(rawConfig)) {
31211
- activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, topLevelEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, useServiceEnvironments, rawConfig);
31529
+ activeEnv = normalizeAndValidateEnvironment(envDiagnostics, configPath, topLevelEnv, isDispatchNamespace, preserveOriginalMain, envName, topLevelEnv, rawConfig);
31212
31530
  const envNames = rawConfig.env ? `The available configured environment names are: ${JSON.stringify(Object.keys(rawConfig.env))}
31213
31531
  ` : "";
31214
31532
  const message = `No environment found in configuration with name "${envName}".
@@ -31228,7 +31546,6 @@ Consider adding an environment configuration section to the ${configFileName$1(c
31228
31546
  definedEnvironments: isRedirectedConfig2 ? rawConfig.definedEnvironments : definedEnvironments,
31229
31547
  targetEnvironment: isRedirectedConfig2 ? rawConfig.targetEnvironment : envName,
31230
31548
  pages_build_output_dir: normalizeAndValidatePagesBuildOutputDir(configPath, rawConfig.pages_build_output_dir),
31231
- legacy_env: !useServiceEnvironments,
31232
31549
  send_metrics: rawConfig.send_metrics,
31233
31550
  dependencies_instrumentation: rawConfig.dependencies_instrumentation,
31234
31551
  keep_vars: rawConfig.keep_vars,
@@ -31274,34 +31591,34 @@ function normalizeAndValidateBuild(diagnostics, rawEnv, rawBuild, configPath) {
31274
31591
  else validateOptionalProperty(diagnostics, "build", "watch_dir", watch_dir, "string");
31275
31592
  return {
31276
31593
  command,
31277
- 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,
31278
31595
  cwd
31279
31596
  };
31280
31597
  }
31281
31598
  __name$1(normalizeAndValidateBuild, "normalizeAndValidateBuild");
31282
31599
  function normalizeAndValidateMainField(configPath, rawMain) {
31283
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
31600
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
31284
31601
  if (rawMain !== void 0) if (typeof rawMain === "string") {
31285
- const directory = path2.resolve(configDir);
31286
- return path2.resolve(directory, rawMain);
31602
+ const directory = path2__default.resolve(configDir);
31603
+ return path2__default.resolve(directory, rawMain);
31287
31604
  } else return rawMain;
31288
31605
  else return;
31289
31606
  }
31290
31607
  __name$1(normalizeAndValidateMainField, "normalizeAndValidateMainField");
31291
31608
  function normalizeAndValidateBaseDirField(configPath, rawDir) {
31292
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
31609
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
31293
31610
  if (rawDir !== void 0) if (typeof rawDir === "string") {
31294
- const directory = path2.resolve(configDir);
31295
- return path2.resolve(directory, rawDir);
31611
+ const directory = path2__default.resolve(configDir);
31612
+ return path2__default.resolve(directory, rawDir);
31296
31613
  } else return rawDir;
31297
31614
  else return;
31298
31615
  }
31299
31616
  __name$1(normalizeAndValidateBaseDirField, "normalizeAndValidateBaseDirField");
31300
31617
  function normalizeAndValidatePagesBuildOutputDir(configPath, rawPagesDir) {
31301
- const configDir = path2.dirname(configPath ?? "wrangler.toml");
31618
+ const configDir = path2__default.dirname(configPath ?? "wrangler.toml");
31302
31619
  if (rawPagesDir !== void 0) if (typeof rawPagesDir === "string") {
31303
- const directory = path2.resolve(configDir);
31304
- return path2.resolve(directory, rawPagesDir);
31620
+ const directory = path2__default.resolve(configDir);
31621
+ return path2__default.resolve(directory, rawPagesDir);
31305
31622
  } else return rawPagesDir;
31306
31623
  else return;
31307
31624
  }
@@ -31355,7 +31672,7 @@ function normalizeAndValidateSite(diagnostics, configPath, rawConfig, mainEntryP
31355
31672
  validateOptionalProperty(diagnostics, "site", "entry-point", legacySiteEntryPoint, "string");
31356
31673
  deprecated(diagnostics, rawConfig, `site.entry-point`, `Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration file:
31357
31674
  \`\`\`
31358
- 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")}"
31359
31676
  \`\`\``, false, void 0, "warning");
31360
31677
  let siteEntryPoint = legacySiteEntryPoint;
31361
31678
  if (!mainEntryPoint && !siteEntryPoint) {
@@ -31368,7 +31685,7 @@ main = "workers-site/index.js"
31368
31685
  } else if (mainEntryPoint && siteEntryPoint) diagnostics.errors.push(`Don't define both the \`main\` and \`site.entry-point\` fields in your configuration.
31369
31686
  They serve the same purpose: to point to the entry-point of your worker.
31370
31687
  Delete the deprecated \`site.entry-point\` field from your config.`);
31371
- 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));
31372
31689
  return {
31373
31690
  bucket,
31374
31691
  "entry-point": siteEntryPoint,
@@ -31400,7 +31717,7 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
31400
31717
  if (rawMapping === void 0) return;
31401
31718
  const mapping = {};
31402
31719
  for (const [name, filePath] of Object.entries(rawMapping)) if (isString$2(diagnostics, `${field}['${name}']`, filePath, void 0)) {
31403
- 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;
31404
31721
  }
31405
31722
  return mapping;
31406
31723
  }
@@ -31563,11 +31880,11 @@ var validateStreamingTailConsumers = /* @__PURE__ */ __name$1((diagnostics, fiel
31563
31880
  for (let i$1 = 0; i$1 < value.length; i$1++) isValid2 = validateStreamingTailConsumer(diagnostics, `${field}[${i$1}]`, value[i$1]) && isValid2;
31564
31881
  return isValid2;
31565
31882
  }, "validateStreamingTailConsumers");
31566
- 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) {
31567
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");
31568
31885
  if (topLevelEnv === void 0 || rawConfig?.unsafe === void 0) experimental(diagnostics, rawEnv, "unsafe");
31569
31886
  const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
31570
- 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);
31571
31888
  const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv, topLevelEnv === void 0 ? void 0 : envName);
31572
31889
  const workers_dev = inheritable(diagnostics, topLevelEnv, rawEnv, "workers_dev", isBoolean, void 0);
31573
31890
  const preview_urls = inheritable(diagnostics, topLevelEnv, rawEnv, "preview_urls", isBoolean, void 0);
@@ -31580,7 +31897,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31580
31897
  jsx_fragment: inheritable(diagnostics, topLevelEnv, rawEnv, "jsx_fragment", isString$2, "React.Fragment"),
31581
31898
  tsconfig: validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath),
31582
31899
  rules: validateAndNormalizeRules(diagnostics, topLevelEnv, rawEnv, envName),
31583
- 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)),
31584
31901
  main: preserveOriginalMain ? inheritable(diagnostics, topLevelEnv, rawEnv, "main", isString$2, void 0) : normalizeAndValidateMainField(configPath, inheritable(diagnostics, topLevelEnv, rawEnv, "main", isString$2, void 0)),
31585
31902
  find_additional_modules: inheritable(diagnostics, topLevelEnv, rawEnv, "find_additional_modules", isBoolean, void 0),
31586
31903
  preserve_file_names: inheritable(diagnostics, topLevelEnv, rawEnv, "preserve_file_names", isBoolean, void 0),
@@ -31660,7 +31977,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
31660
31977
  __name$1(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
31661
31978
  function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPath) {
31662
31979
  const tsconfig = inheritable(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString$2, void 0);
31663
- 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;
31664
31981
  }
31665
31982
  __name$1(validateAndNormalizeTsconfig, "validateAndNormalizeTsconfig");
31666
31983
  var validateAndNormalizeRules = /* @__PURE__ */ __name$1((diagnostics, topLevelEnv, rawEnv, envName) => {
@@ -32160,9 +32477,9 @@ function validateContainerApp(envName, topLevelName, configPath) {
32160
32477
  let resolvedBuildContextPath = void 0;
32161
32478
  try {
32162
32479
  if (isDockerfile(resolvedImage, configPath)) {
32163
- const baseDir$1 = configPath ? path2.dirname(configPath) : process.cwd();
32164
- resolvedImage = path2.resolve(baseDir$1, resolvedImage);
32165
- 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);
32166
32483
  }
32167
32484
  } catch (err) {
32168
32485
  if (err instanceof Error && err.message) diagnostics.errors.push(err.message);
@@ -33516,8 +33833,8 @@ function isRemoteValid(targetObject, fieldPath, diagnostics) {
33516
33833
  }
33517
33834
  __name$1(isRemoteValid, "isRemoteValid");
33518
33835
  function isDockerfile(imagePath, configPath) {
33519
- const baseDir$1 = configPath ? path2.dirname(configPath) : process.cwd();
33520
- 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);
33521
33838
  if (fs2.existsSync(maybeDockerfile)) {
33522
33839
  if (isDirectory$1(maybeDockerfile)) throw new UserError(`${imagePath} is a directory, you should specify a path to the Dockerfile`, { telemetryMessage: false });
33523
33840
  return true;
@@ -33668,10 +33985,10 @@ Pages requires Durable Object bindings to specify the name of the Worker where t
33668
33985
  __name$1(validateDurableObjectBinding2, "validateDurableObjectBinding");
33669
33986
  function getPackagePath(packageName, projectPath) {
33670
33987
  try {
33671
- return path2.dirname(__require$1.resolve(`${packageName}/package.json`, { paths: [projectPath] }));
33988
+ return path2__default.dirname(__require$1.resolve(`${packageName}/package.json`, { paths: [projectPath] }));
33672
33989
  } catch {}
33673
33990
  try {
33674
- return path2.dirname(__require$1.resolve(packageName, { paths: [projectPath] }));
33991
+ return path2__default.dirname(__require$1.resolve(packageName, { paths: [projectPath] }));
33675
33992
  } catch {}
33676
33993
  }
33677
33994
  __name$1(getPackagePath, "getPackagePath");
@@ -33695,20 +34012,111 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
33695
34012
  }
33696
34013
  __name$1(getInstalledPackageVersion, "getInstalledPackageVersion");
33697
34014
  function findFileUp(name, startDir, lastDir) {
33698
- let dir = startDir;
33699
- const root = path2.parse(dir).root;
34015
+ let dir2 = startDir;
34016
+ const root = path2__default.parse(dir2).root;
33700
34017
  while (true) {
33701
- const candidate = path2.join(dir, name);
34018
+ const candidate = path2__default.join(dir2, name);
33702
34019
  try {
33703
34020
  if (statSync(candidate).isFile()) return candidate;
33704
34021
  } catch {}
33705
- if (lastDir !== void 0 && dir === lastDir) break;
33706
- const parent = path2.dirname(dir);
33707
- if (parent === dir || dir === root) break;
33708
- dir = parent;
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;
33709
34026
  }
33710
34027
  }
33711
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");
33712
34120
  var signals = [];
33713
34121
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
33714
34122
  if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
@@ -33878,7 +34286,7 @@ var process2 = globalThis.process;
33878
34286
  var { onExit, load, unload } = signalExitWrap(processOk(process2) ? new SignalExit(process2) : new SignalExitFallback());
33879
34287
  function getWranglerHiddenDirPath(projectRoot) {
33880
34288
  projectRoot ??= process.cwd();
33881
- return path2.join(projectRoot, ".wrangler");
34289
+ return path2__default.join(projectRoot, ".wrangler");
33882
34290
  }
33883
34291
  __name$1(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
33884
34292
  var STALE_WRANGLER_TMP_DIR_MS = 1440 * 60 * 1e3;
@@ -33895,7 +34303,7 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
33895
34303
  const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
33896
34304
  for (const entry of entries) {
33897
34305
  if (!entry.isDirectory()) continue;
33898
- const entryPath = path2.join(tmpRoot, entry.name);
34306
+ const entryPath = path2__default.join(tmpRoot, entry.name);
33899
34307
  try {
33900
34308
  if (fs2.statSync(entryPath).mtimeMs < cutoff) removeDirSync$1(entryPath);
33901
34309
  } catch {}
@@ -33903,10 +34311,10 @@ function sweepStaleWranglerTmpDirs(tmpRoot) {
33903
34311
  }
33904
34312
  __name$1(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
33905
34313
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
33906
- const tmpRoot = path2.join(getWranglerHiddenDirPath(projectRoot), "tmp");
34314
+ const tmpRoot = path2__default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
33907
34315
  fs2.mkdirSync(tmpRoot, { recursive: true });
33908
34316
  sweepStaleWranglerTmpDirs(tmpRoot);
33909
- const tmpPrefix = path2.join(tmpRoot, `${prefix}-`);
34317
+ const tmpPrefix = path2__default.join(tmpRoot, `${prefix}-`);
33910
34318
  const tmpDir = fs2.realpathSync(fs2.mkdtempSync(tmpPrefix));
33911
34319
  const cleanupDir = /* @__PURE__ */ __name$1(() => {
33912
34320
  if (cleanup) try {
@@ -34010,11 +34418,11 @@ and the fallback query also failed.
34010
34418
 
34011
34419
  You can manually install cloudflared from:
34012
34420
  https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/`, { telemetryMessage: "tunnel cloudflared version lookup failed" });
34013
- const version$3 = fallback.version;
34421
+ const version$4 = fallback.version;
34014
34422
  const filename = getAssetFilename(goOS, goArch);
34015
34423
  return {
34016
- url: `${GITHUB_RELEASE_BASE}/${version$3}/${filename}`,
34017
- version: version$3,
34424
+ url: `${GITHUB_RELEASE_BASE}/${version$4}/${filename}`,
34425
+ version: version$4,
34018
34426
  checksum: "",
34019
34427
  compressed: filename.endsWith(".tgz"),
34020
34428
  shouldUpdate: true,
@@ -34023,13 +34431,13 @@ https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-
34023
34431
  };
34024
34432
  }
34025
34433
  __name$1(getLatestVersionInfo, "getLatestVersionInfo");
34026
- function getCacheDir(version$3) {
34027
- return join(getGlobalConfigPath(), "cloudflared", version$3);
34434
+ function getCacheDir(version$4) {
34435
+ return join(getGlobalConfigPath(), "cloudflared", version$4);
34028
34436
  }
34029
34437
  __name$1(getCacheDir, "getCacheDir");
34030
- function getCloudflaredBinPath(version$3) {
34438
+ function getCloudflaredBinPath(version$4) {
34031
34439
  const binName = process.platform === "win32" ? "cloudflared.exe" : "cloudflared";
34032
- return join(getCacheDir(version$3), binName);
34440
+ return join(getCacheDir(version$4), binName);
34033
34441
  }
34034
34442
  __name$1(getCloudflaredBinPath, "getCloudflaredBinPath");
34035
34443
  function isBinaryExecutable(binPath) {
@@ -34164,8 +34572,8 @@ function writeFileAtomic(filePath, contents) {
34164
34572
  __name$1(writeFileAtomic, "writeFileAtomic");
34165
34573
  async function downloadCloudflared(versionInfo, binPath, options) {
34166
34574
  const { logger } = options ?? {};
34167
- const { url, version: version$3, checksum, compressed } = versionInfo;
34168
- logger?.log(`Downloading cloudflared ${version$3}...`);
34575
+ const { url, version: version$4, checksum, compressed } = versionInfo;
34576
+ logger?.log(`Downloading cloudflared ${version$4}...`);
34169
34577
  logger?.debug(`Download URL: ${url}`);
34170
34578
  const cacheDir = dirname(binPath);
34171
34579
  mkdirSync(cacheDir, { recursive: true });
@@ -34201,7 +34609,7 @@ Error: ${e2 instanceof Error ? e2.message : String(e2)}
34201
34609
  Please ensure you have write permissions to: ${cacheDir}`, { telemetryMessage: "tunnel cloudflared save failed" });
34202
34610
  }
34203
34611
  if (process.platform !== "win32") chmodSync(binPath, 493);
34204
- logger?.log(`cloudflared ${version$3} installed`);
34612
+ logger?.log(`cloudflared ${version$4} installed`);
34205
34613
  logger?.debug(`Binary location: ${binPath}`);
34206
34614
  }
34207
34615
  __name$1(downloadCloudflared, "downloadCloudflared");
@@ -34302,8 +34710,8 @@ async function spawnCloudflared(args, options) {
34302
34710
  });
34303
34711
  }
34304
34712
  __name$1(spawnCloudflared, "spawnCloudflared");
34305
- function removeCloudflaredCache(version$3) {
34306
- 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");
34307
34715
  if (existsSync(cacheDir)) {
34308
34716
  removeDirSync$1(cacheDir);
34309
34717
  return cacheDir;
@@ -34744,13 +35152,13 @@ __name$1(cloneHeaders, "cloneHeaders");
34744
35152
  var import_update_check = __toESM(require_update_check());
34745
35153
  var UPDATE_CHECK_TIMEOUT_MS = 3e3;
34746
35154
  var TIMED_OUT = Symbol("timed_out");
34747
- async function fetchLatestNpmVersion(name, version$3) {
35155
+ async function fetchLatestNpmVersion(name, version$4) {
34748
35156
  let result = null;
34749
35157
  try {
34750
35158
  result = await Promise.race([(0, import_update_check.default)({
34751
35159
  name,
34752
- version: version$3
34753
- }, { 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 })]);
34754
35162
  } catch {
34755
35163
  return { status: "failed" };
34756
35164
  }
@@ -34762,6 +35170,27 @@ async function fetchLatestNpmVersion(name, version$3) {
34762
35170
  };
34763
35171
  }
34764
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");
34765
35194
  var MAX_ATTEMPTS = 3;
34766
35195
  async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
34767
35196
  try {
@@ -36486,19 +36915,19 @@ function zigzag(tpl, maskIdx, fn) {
36486
36915
  const bm = tpl;
36487
36916
  const size = bm.height;
36488
36917
  const pattern = PATTERNS[maskIdx];
36489
- let dir = -1;
36918
+ let dir$2 = -1;
36490
36919
  let y = size - 1;
36491
36920
  for (let xOffset = size - 1; xOffset > 0; xOffset -= 2) {
36492
36921
  if (xOffset == 6) xOffset = 5;
36493
- for (;; y += dir) {
36922
+ for (;; y += dir$2) {
36494
36923
  for (let j = 0; j < 2; j += 1) {
36495
36924
  const x = xOffset - j;
36496
36925
  if (bm.isDefined(x, y)) continue;
36497
36926
  fn(x, y, pattern(x, y));
36498
36927
  }
36499
- if (y + dir < 0 || y + dir >= size) break;
36928
+ if (y + dir$2 < 0 || y + dir$2 >= size) break;
36500
36929
  }
36501
- dir = -dir;
36930
+ dir$2 = -dir$2;
36502
36931
  }
36503
36932
  }
36504
36933
  function detectType(str) {
@@ -37075,7 +37504,7 @@ function createPlugin(name, pluginFactory) {
37075
37504
  }
37076
37505
  function getOutputDirectory(userConfig, environmentName) {
37077
37506
  const rootOutputDirectory = userConfig.build?.outDir ?? "dist";
37078
- return userConfig.environments?.[environmentName]?.build?.outDir ?? nodePath.join(rootOutputDirectory, environmentName);
37507
+ return userConfig.environments?.[environmentName]?.build?.outDir ?? path2.join(rootOutputDirectory, environmentName);
37079
37508
  }
37080
37509
  const postfixRE = /[?#].*$/;
37081
37510
  function cleanUrl(url) {
@@ -37941,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
37941
38370
  /** Returns a regex for validating an RFC 9562/4122 UUID.
37942
38371
  *
37943
38372
  * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
37944
- const uuid = (version$3) => {
37945
- 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)$/;
37946
- 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})$`);
37947
38376
  };
37948
38377
  /** Practical email validation */
37949
38378
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
@@ -38380,7 +38809,7 @@ var Doc = class {
38380
38809
 
38381
38810
  //#endregion
38382
38811
  //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
38383
- const version$2 = {
38812
+ const version$3 = {
38384
38813
  major: 4,
38385
38814
  minor: 4,
38386
38815
  patch: 3
@@ -38393,7 +38822,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
38393
38822
  inst ?? (inst = {});
38394
38823
  inst._zod.def = def;
38395
38824
  inst._zod.bag = inst._zod.bag || {};
38396
- inst._zod.version = version$2;
38825
+ inst._zod.version = version$3;
38397
38826
  const checks = [...inst._zod.def.checks ?? []];
38398
38827
  if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
38399
38828
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
@@ -44174,13 +44603,21 @@ function up(base, options) {
44174
44603
  }
44175
44604
  __name(up, "up");
44176
44605
  function file(name, options) {
44177
- let dir, tmp;
44178
- for (dir of up(options && options.cwd || "", options)) try {
44179
- tmp = join(dir, name);
44606
+ let dir2, tmp;
44607
+ for (dir2 of up(options && options.cwd || "", options)) try {
44608
+ tmp = join(dir2, name);
44180
44609
  if (statSync(tmp).isFile()) return tmp;
44181
44610
  } catch {}
44182
44611
  }
44183
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");
44184
44621
  function dedent$2(templ) {
44185
44622
  var values = [];
44186
44623
  for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
@@ -44222,7 +44659,7 @@ function resolveWranglerConfigPath({ config: config$1, script }, options) {
44222
44659
  deployConfigPath: void 0,
44223
44660
  redirected: false
44224
44661
  };
44225
- 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);
44226
44663
  }
44227
44664
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
44228
44665
  function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
@@ -44253,15 +44690,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
44253
44690
  const deployConfigFile = readFileSync$1(deployConfigPath);
44254
44691
  try {
44255
44692
  const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
44256
- redirectedConfigPath = deployConfig.configPath && path2.resolve(path2.dirname(deployConfigPath), deployConfig.configPath);
44693
+ redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
44257
44694
  } catch (e) {
44258
- 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)}`, {
44259
44696
  cause: e,
44260
44697
  telemetryMessage: false
44261
44698
  });
44262
44699
  }
44263
44700
  if (!redirectedConfigPath) throw new UserError$1(esm_default`
44264
- A deploy configuration file was found at "${path2.relative(".", deployConfigPath)}".
44701
+ A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
44265
44702
  But this is not valid - the required "configPath" property was not found.
44266
44703
  Instead this file contains:
44267
44704
  \`\`\`
@@ -44269,13 +44706,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
44269
44706
  \`\`\`
44270
44707
  `, { telemetryMessage: false });
44271
44708
  if (!existsSync(redirectedConfigPath)) throw new UserError$1(esm_default`
44272
- There is a deploy configuration at "${path2.relative(".", deployConfigPath)}".
44273
- 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.
44274
44711
  `, { telemetryMessage: false });
44275
44712
  if (userConfigPath) {
44276
- if (path2.join(path2.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError$1(esm_default`
44277
- Found both a user configuration file at "${path2.relative(".", userConfigPath)}"
44278
- 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)}".
44279
44716
  But these do not share the same base path so it is not clear which should be used.
44280
44717
  `, { telemetryMessage: false });
44281
44718
  }
@@ -44336,7 +44773,7 @@ const WORKER_CONFIG_FILENAME = "worker.config.json";
44336
44773
  * Absolute path to the Build Output API root for the current project.
44337
44774
  */
44338
44775
  function getBuildOutputDir(root) {
44339
- return nodePath.resolve(root, BUILD_OUTPUT_ROOT);
44776
+ return path2.resolve(root, BUILD_OUTPUT_ROOT);
44340
44777
  }
44341
44778
  /**
44342
44779
  * Clean the build output directory.
@@ -44348,25 +44785,25 @@ async function cleanBuildOutputDir(root) {
44348
44785
  * Absolute path to the Workers output directory.
44349
44786
  */
44350
44787
  function getWorkersDir(root) {
44351
- return nodePath.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
44788
+ return path2.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
44352
44789
  }
44353
44790
  /**
44354
44791
  * Absolute path to the config file for a given Worker.
44355
44792
  */
44356
44793
  function getWorkerConfigPath(root, workerName) {
44357
- return nodePath.join(getWorkersDir(root), workerName, WORKER_CONFIG_FILENAME);
44794
+ return path2.join(getWorkersDir(root), workerName, WORKER_CONFIG_FILENAME);
44358
44795
  }
44359
44796
  /**
44360
44797
  * Absolute path to the bundle directory for a given Worker.
44361
44798
  */
44362
44799
  function getWorkerBundleDir(root, workerName) {
44363
- return nodePath.join(getWorkersDir(root), workerName, "bundle");
44800
+ return path2.join(getWorkersDir(root), workerName, "bundle");
44364
44801
  }
44365
44802
  /**
44366
44803
  * Absolute path to the assets directory for a given Worker.
44367
44804
  */
44368
44805
  function getWorkerAssetsDir(root, workerName) {
44369
- return nodePath.join(getWorkersDir(root), workerName, "assets");
44806
+ return path2.join(getWorkersDir(root), workerName, "assets");
44370
44807
  }
44371
44808
  /**
44372
44809
  * Write the output `worker.config.json` for a given Worker to the Build
@@ -44381,7 +44818,7 @@ async function writeOutputWorkerConfig(root, parsedConfig, manifest) {
44381
44818
  ...rest,
44382
44819
  manifest
44383
44820
  };
44384
- const workerOutputDir = nodePath.join(getWorkersDir(root), outputConfig.name);
44821
+ const workerOutputDir = path2.join(getWorkersDir(root), outputConfig.name);
44385
44822
  await fsp.mkdir(workerOutputDir, { recursive: true });
44386
44823
  const configPath = getWorkerConfigPath(root, outputConfig.name);
44387
44824
  await fsp.writeFile(configPath, JSON.stringify(outputConfig));
@@ -44843,21 +45280,17 @@ function generateTypes({ configPath, packageName = "@cloudflare/config" }) {
44843
45280
  return import_dist.dedent`
44844
45281
  /* eslint-disable */
44845
45282
  // Generated by @cloudflare/config
44846
- import type { InferEnv, InferDurableNamespaces, InferMainModule, UnwrapConfig } from "${packageName}";
44847
- import type Config from "${configPath.replace(/\.(ts|js|mts|mjs)$/, "")}";
44848
-
44849
- 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>;
44850
45285
 
44851
- declare global {
44852
- namespace Cloudflare {
44853
- interface GlobalProps {
44854
- mainModule: InferMainModule<WorkerConfig>;
44855
- durableNamespaces: InferDurableNamespaces<WorkerConfig>;
44856
- }
44857
- interface Env extends InferEnv<WorkerConfig> {}
45286
+ declare namespace Cloudflare {
45287
+ interface GlobalProps {
45288
+ mainModule: import("${packageName}").InferMainModule<__WorkerConfig>;
45289
+ durableNamespaces: import("${packageName}").InferDurableNamespaces<__WorkerConfig>;
44858
45290
  }
44859
- interface Env extends Cloudflare.Env {}
45291
+ interface Env extends __Env {}
44860
45292
  }
45293
+ interface Env extends Cloudflare.Env {}
44861
45294
 
44862
45295
  `;
44863
45296
  }
@@ -45442,6 +45875,7 @@ let deregister;
45442
45875
  function registerConfigHooks() {
45443
45876
  if (deregister) return deregister;
45444
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;
45445
45879
  if (typeof registerHooks !== "function") throw new Error("cloudflare.config.ts loading requires Node.js v22.18.0 or higher.");
45446
45880
  const hooks = registerHooks({
45447
45881
  resolve(specifier, context, nextResolve) {
@@ -45500,6 +45934,95 @@ function cleanupImportAttributes(context) {
45500
45934
  Object.freeze(context.importAttributes);
45501
45935
  }
45502
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
+
45503
46026
  //#endregion
45504
46027
  //#region ../workers-shared/utils/configuration/constants.ts
45505
46028
  const REDIRECTS_VERSION = 1;
@@ -45657,24 +46180,24 @@ async function readBuildOutputWorkers(root) {
45657
46180
  //#endregion
45658
46181
  //#region src/deploy-config.ts
45659
46182
  function getDeployConfigPath(root) {
45660
- return nodePath.resolve(root, ".wrangler", "deploy", "config.json");
46183
+ return path2.resolve(root, ".wrangler", "deploy", "config.json");
45661
46184
  }
45662
46185
  function getWorkerConfigs(root, isPrerender) {
45663
46186
  const deployConfigPath = getDeployConfigPath(root);
45664
46187
  const deployConfig = JSON.parse(fs$1.readFileSync(deployConfigPath, "utf-8"));
45665
46188
  return [...isPrerender && deployConfig.prerenderWorkerConfigPath ? [{ configPath: deployConfig.prerenderWorkerConfigPath }] : [{ configPath: deployConfig.configPath }], ...deployConfig.auxiliaryWorkers].map(({ configPath }) => {
45666
- const resolvedConfigPath = nodePath.resolve(nodePath.dirname(deployConfigPath), configPath);
46189
+ const resolvedConfigPath = path2.resolve(path2.dirname(deployConfigPath), configPath);
45667
46190
  return wrangler.unstable_readConfig({ config: resolvedConfigPath });
45668
46191
  });
45669
46192
  }
45670
46193
  function writeDeployConfig(resolvedPluginConfig, resolvedViteConfig, isAssetsOnly) {
45671
46194
  const deployConfigPath = getDeployConfigPath(resolvedViteConfig.root);
45672
- const deployConfigDirectory = nodePath.dirname(deployConfigPath);
46195
+ const deployConfigDirectory = path2.dirname(deployConfigPath);
45673
46196
  fs$1.mkdirSync(deployConfigDirectory, { recursive: true });
45674
46197
  const resolveConfigPath = (environmentName) => {
45675
46198
  const outputDirectory = resolvedViteConfig.environments[environmentName]?.build.outDir;
45676
46199
  assert(outputDirectory, `Unexpected error: ${environmentName} environment output directory is undefined`);
45677
- return nodePath.relative(deployConfigDirectory, nodePath.resolve(resolvedViteConfig.root, outputDirectory, "wrangler.json"));
46200
+ return path2.relative(deployConfigDirectory, path2.resolve(resolvedViteConfig.root, outputDirectory, "wrangler.json"));
45678
46201
  };
45679
46202
  const auxiliaryWorkerEnvironmentNames = resolvedPluginConfig.type === "workers" ? [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([name, worker]) => name !== resolvedPluginConfig.entryWorkerEnvironmentName && name !== resolvedPluginConfig.prerenderWorkerEnvironmentName && !resolveDevOnly(worker.devOnly)).map(([name]) => name) : [];
45680
46203
  let entryEnvironmentName;
@@ -50752,10 +51275,10 @@ pp.readWord = function() {
50752
51275
  if (this.keywords.test(word)) type = keywords[word];
50753
51276
  return this.finishToken(type, word);
50754
51277
  };
50755
- var version$1 = "8.16.0";
51278
+ var version$2 = "8.16.0";
50756
51279
  Parser.acorn = {
50757
51280
  Parser,
50758
- version: version$1,
51281
+ version: version$2,
50759
51282
  defaultOptions: defaultOptions$1,
50760
51283
  Position,
50761
51284
  SourceLocation,
@@ -51170,7 +51693,7 @@ function read(jsonPath, { base, specifier }) {
51170
51693
  /** @type {string | undefined} */
51171
51694
  let string$2;
51172
51695
  try {
51173
- string$2 = fs2.readFileSync(path2.toNamespacedPath(jsonPath), "utf8");
51696
+ string$2 = fs2.readFileSync(path2__default.toNamespacedPath(jsonPath), "utf8");
51174
51697
  } catch (error) {
51175
51698
  const exception = error;
51176
51699
  if (exception.code !== "ENOENT") throw exception;
@@ -51376,7 +51899,7 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
51376
51899
  const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
51377
51900
  const basePath = fileURLToPath(base);
51378
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");
51379
- 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");
51380
51903
  }
51381
51904
  /**
51382
51905
  * @param {string} path
@@ -51483,7 +52006,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
51483
52006
  {
51484
52007
  const real = realpathSync(filePath);
51485
52008
  const { search, hash } = resolved;
51486
- resolved = pathToFileURL(real + (filePath.endsWith(path2.sep) ? "/" : ""));
52009
+ resolved = pathToFileURL(real + (filePath.endsWith(path2__default.sep) ? "/" : ""));
51487
52010
  resolved.search = search;
51488
52011
  resolved.hash = hash;
51489
52012
  }
@@ -52284,7 +52807,7 @@ var NodeJsCompatWarnings = class {
52284
52807
  `;
52285
52808
  this.sources.forEach((importers, source) => {
52286
52809
  importers.forEach((importer) => {
52287
- message += ` - "${source}" imported from "${nodePath.relative(this.resolvedViteConfig.root, importer)}"\n`;
52810
+ message += ` - "${source}" imported from "${path2.relative(this.resolvedViteConfig.root, importer)}"\n`;
52288
52811
  });
52289
52812
  });
52290
52813
  this.resolvedViteConfig.logger.warn(message, { timestamp: true });
@@ -52390,7 +52913,7 @@ function getWarningForWorkersConfigs(configs) {
52390
52913
  if (!("auxiliaryWorkers" in configs) || configs.auxiliaryWorkers.length === 0) {
52391
52914
  const nonApplicableLines = getWorkerNonApplicableWarnLines(configs.entryWorker, ` - `);
52392
52915
  if (nonApplicableLines.length === 0) return;
52393
- 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:`];
52394
52917
  nonApplicableLines.forEach((line) => lines$1.push(line));
52395
52918
  lines$1.push("");
52396
52919
  return lines$1.join("\n");
@@ -52399,7 +52922,7 @@ function getWarningForWorkersConfigs(configs) {
52399
52922
  const processWorkerConfig = (workerConfig, isEntryWorker = false) => {
52400
52923
  const nonApplicableLines = getWorkerNonApplicableWarnLines(workerConfig, ` - `, { isAuxiliary: !isEntryWorker });
52401
52924
  if (nonApplicableLines.length > 0) {
52402
- 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)}\`)` : ""}`);
52403
52926
  nonApplicableLines.forEach((line) => lines.push(line));
52404
52927
  }
52405
52928
  };
@@ -52493,9 +53016,9 @@ const ENTRY_MODULE_EXTENSIONS = [
52493
53016
  */
52494
53017
  function maybeResolveMain(main, configPath, root) {
52495
53018
  if (!ENTRY_MODULE_EXTENSIONS.some((extension) => main.endsWith(extension))) return main;
52496
- const baseDir$1 = configPath ? nodePath.dirname(configPath) : root;
53019
+ const baseDir$1 = configPath ? path2.dirname(configPath) : root;
52497
53020
  if (!baseDir$1) return main;
52498
- const resolvedMain = nodePath.resolve(baseDir$1, main);
53021
+ const resolvedMain = path2.resolve(baseDir$1, main);
52499
53022
  if (!fs$1.existsSync(resolvedMain)) throw new Error(`The provided Wrangler config main field (${resolvedMain}) doesn't point to an existing file`);
52500
53023
  return resolvedMain;
52501
53024
  }
@@ -52510,9 +53033,9 @@ function maybeResolveMain(main, configPath, root) {
52510
53033
  */
52511
53034
  function getValidatedWranglerConfigPath(root, requestedConfigPath, isForAuxiliaryWorker = false) {
52512
53035
  if (requestedConfigPath) {
52513
- const configPath = nodePath.resolve(root, requestedConfigPath);
53036
+ const configPath = path2.resolve(root, requestedConfigPath);
52514
53037
  const errorMessagePrefix = `The provided configPath (${configPath})${isForAuxiliaryWorker ? " requested for one of your auxiliary workers" : ""}`;
52515
- const fileExtension = nodePath.extname(configPath).slice(1);
53038
+ const fileExtension = path2.extname(configPath).slice(1);
52516
53039
  if (!allowedWranglerConfigExtensions.includes(fileExtension)) {
52517
53040
  const foundExtensionMessage = !fileExtension ? "no extension found" : `"${fileExtension}" found`;
52518
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)`);
@@ -52527,7 +53050,7 @@ function getValidatedWranglerConfigPath(root, requestedConfigPath, isForAuxiliar
52527
53050
  }
52528
53051
  function findWranglerConfig(root) {
52529
53052
  for (const extension of allowedWranglerConfigExtensions) {
52530
- const configPath = nodePath.join(root, `wrangler.${extension}`);
53053
+ const configPath = path2.join(root, `wrangler.${extension}`);
52531
53054
  if (fs$1.existsSync(configPath)) return configPath;
52532
53055
  }
52533
53056
  }
@@ -52541,16 +53064,25 @@ const allowedWranglerConfigExtensions = [
52541
53064
  //#region src/plugin-config.ts
52542
53065
  function normalizeNewConfig(option) {
52543
53066
  if (isForcedBuildOutput()) return {
52544
- 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
+ },
52545
53071
  cfBuildOutput: true
52546
53072
  };
52547
53073
  if (option === void 0 || option === false) return;
52548
53074
  if (option === true) return {
52549
- types: { generate: true },
53075
+ types: {
53076
+ generate: true,
53077
+ includeRuntime: true
53078
+ },
52550
53079
  cfBuildOutput: false
52551
53080
  };
52552
53081
  return {
52553
- types: { generate: option.types?.generate ?? true },
53082
+ types: {
53083
+ generate: option.types?.generate ?? true,
53084
+ includeRuntime: option.types?.includeRuntime ?? true
53085
+ },
52554
53086
  cfBuildOutput: option.cfBuildOutput ?? false
52555
53087
  };
52556
53088
  }
@@ -52614,7 +53146,7 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
52614
53146
  newConfig: resolvedNewConfig
52615
53147
  }
52616
53148
  };
52617
- const root = userConfig.root ? nodePath.resolve(userConfig.root) : process.cwd();
53149
+ const root = userConfig.root ? path2.resolve(userConfig.root) : process.cwd();
52618
53150
  const prefixedEnv = vite.loadEnv(viteEnv.mode, root, ["CLOUDFLARE_", "WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_"]);
52619
53151
  Object.assign(process.env, prefixedEnv);
52620
53152
  const remoteBindings = prefixedEnv.CLOUDFLARE_VITE_FORCE_LOCAL === "true" ? false : pluginConfig.remoteBindings ?? true;
@@ -52645,7 +53177,8 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
52645
53177
  const result = await loadNewConfig({
52646
53178
  root,
52647
53179
  mode: viteEnv.mode,
52648
- generateTypes: resolvedNewConfig.types.generate
53180
+ command: viteEnv.command,
53181
+ types: resolvedNewConfig.types
52649
53182
  });
52650
53183
  configPath = result.configPath;
52651
53184
  rawConfigOverride = result.rawConfig;
@@ -52781,20 +53314,24 @@ const EXPERIMENTAL_CONFIG_PKG = "@cloudflare/vite-plugin/experimental-config";
52781
53314
  * file, and the set of files imported while resolving the config (for
52782
53315
  * watch-mode).
52783
53316
  *
52784
- * If `generateTypes` is true, also writes `worker-configuration.d.ts` next to
52785
- * 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.
52786
53320
  */
52787
53321
  async function loadNewConfig(options) {
52788
- const configPath = nodePath.resolve(options.root, NEW_CONFIG_FILENAME);
53322
+ const configPath = path2.resolve(options.root, NEW_CONFIG_FILENAME);
52789
53323
  if (!fs$1.existsSync(configPath)) throw new Error(`\`experimental.newConfig\` is enabled but no \`${NEW_CONFIG_FILENAME}\` was found at ${configPath}.`);
52790
53324
  const { config: rawExport, dependencies } = await loadConfig(configPath);
52791
53325
  const resolved = await resolveWorkerDefinition(rawExport, { mode: options.mode });
52792
53326
  const parsed = InputWorkerSchema.safeParse(resolved);
52793
53327
  if (!parsed.success) throw new Error(`Invalid \`${NEW_CONFIG_FILENAME}\`:\n${parsed.error.message}`);
52794
53328
  const rawConfig = convertToWranglerConfig(parsed.data);
52795
- if (options.generateTypes) writeWorkerConfigurationDts({
53329
+ if (options.command === "serve" && options.types.generate) await writeWorkerConfigurationDts({
52796
53330
  root: options.root,
52797
- configPath
53331
+ configPath,
53332
+ includeRuntime: options.types.includeRuntime,
53333
+ compatibilityDate: parsed.data.compatibilityDate,
53334
+ compatibilityFlags: parsed.data.compatibilityFlags ?? []
52798
53335
  });
52799
53336
  return {
52800
53337
  rawConfig,
@@ -52809,20 +53346,35 @@ async function loadNewConfig(options) {
52809
53346
  * `experimental-config` subpath (so users don't need a direct dependency on
52810
53347
  * `@cloudflare/config`).
52811
53348
  *
52812
- * Reads the existing file first and only writes if the content differs, to
52813
- * 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).
52814
53357
  */
52815
- function writeWorkerConfigurationDts(options) {
52816
- const outputPath = nodePath.resolve(options.root, TYPES_OUTPUT_FILENAME);
52817
- const content = generateTypes({
52818
- configPath: "./" + nodePath.relative(options.root, options.configPath),
52819
- packageName: EXPERIMENTAL_CONFIG_PKG
52820
- });
52821
- 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;
52822
53362
  try {
52823
- existing = fs$1.readFileSync(outputPath, "utf8");
53363
+ existingContent = await fsp.readFile(outputPath, "utf8");
52824
53364
  } catch {}
52825
- 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);
52826
53378
  }
52827
53379
 
52828
53380
  //#endregion
@@ -53875,12 +54427,12 @@ const additionalModulesPlugin = createPlugin("additional-modules", (ctx) => {
53875
54427
  }
53876
54428
  const referenceId = this.emitFile({
53877
54429
  type: "asset",
53878
- name: nodePath.basename(modulePath),
54430
+ name: path2.basename(modulePath),
53879
54431
  originalFileName: modulePath,
53880
54432
  source
53881
54433
  });
53882
54434
  const emittedFileName = this.getFileName(referenceId);
53883
- const relativePath = vite.normalizePath(nodePath.relative(nodePath.dirname(chunk.fileName), emittedFileName));
54435
+ const relativePath = vite.normalizePath(path2.relative(path2.dirname(chunk.fileName), emittedFileName));
53884
54436
  const importPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
53885
54437
  magicString.update(match.index, match.index + full.length, importPath);
53886
54438
  }
@@ -54188,7 +54740,7 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
54188
54740
  * Map a bundle filename to its declared module type.
54189
54741
  */
54190
54742
  function detectModuleType(filename) {
54191
- switch (nodePath.extname(filename).toLowerCase()) {
54743
+ switch (path2.extname(filename).toLowerCase()) {
54192
54744
  case ".js":
54193
54745
  case ".mjs": return "esm";
54194
54746
  case ".wasm": return "wasm";
@@ -56923,9 +57475,9 @@ function datetimeRegex(args) {
56923
57475
  regex = `${regex}(${opts.join("|")})`;
56924
57476
  return /* @__PURE__ */ new RegExp(`^${regex}$`);
56925
57477
  }
56926
- function isValidIP(ip, version$3) {
56927
- if ((version$3 === "v4" || !version$3) && ipv4Regex.test(ip)) return true;
56928
- 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;
56929
57481
  return false;
56930
57482
  }
56931
57483
  function isValidJWT(jwt, alg) {
@@ -56944,9 +57496,9 @@ function isValidJWT(jwt, alg) {
56944
57496
  return false;
56945
57497
  }
56946
57498
  }
56947
- function isValidCidr(ip, version$3) {
56948
- if ((version$3 === "v4" || !version$3) && ipv4CidrRegex.test(ip)) return true;
56949
- 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;
56950
57502
  return false;
56951
57503
  }
56952
57504
  var ZodString = class ZodString extends ZodType {
@@ -59836,10 +60388,10 @@ function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig
59836
60388
  };
59837
60389
  }
59838
60390
  function getRedirectsConfigPath(config$1) {
59839
- return nodePath.join(config$1.publicDir, REDIRECTS_FILENAME);
60391
+ return path2.join(config$1.publicDir, REDIRECTS_FILENAME);
59840
60392
  }
59841
60393
  function getHeadersConfigPath(config$1) {
59842
- return nodePath.join(config$1.publicDir, HEADERS_FILENAME);
60394
+ return path2.join(config$1.publicDir, HEADERS_FILENAME);
59843
60395
  }
59844
60396
 
59845
60397
  //#endregion
@@ -59850,7 +60402,7 @@ function createBuildApp(resolvedPluginConfig) {
59850
60402
  return async (builder) => {
59851
60403
  const clientEnvironment = builder.environments.client;
59852
60404
  assert(clientEnvironment, `No "client" environment`);
59853
- const defaultHtmlPath = nodePath.resolve(builder.config.root, "index.html");
60405
+ const defaultHtmlPath = path2.resolve(builder.config.root, "index.html");
59854
60406
  const hasClientEntry = clientEnvironment.config.build.rollupOptions.input || fs$1.existsSync(defaultHtmlPath);
59855
60407
  const workerEnvironments = [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
59856
60408
  const environment = builder.environments[environmentName];
@@ -59866,7 +60418,7 @@ function createBuildApp(resolvedPluginConfig) {
59866
60418
  const { entryWorkerEnvironmentName } = resolvedPluginConfig;
59867
60419
  const entryWorkerEnvironment = builder.environments[entryWorkerEnvironmentName];
59868
60420
  assert(entryWorkerEnvironment, `No "${entryWorkerEnvironmentName}" environment`);
59869
- const entryWorkerBuildDirectory = nodePath.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir);
60421
+ const entryWorkerBuildDirectory = path2.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir);
59870
60422
  const importedAssetPaths = getImportedAssetPaths(loadViteManifest(entryWorkerBuildDirectory));
59871
60423
  if (hasClientEntry) await builder.build(clientEnvironment);
59872
60424
  else if (importedAssetPaths.size || getHasPublicAssets(builder.config) || resolvedPluginConfig.prerenderWorkerEnvironmentName) await fallbackBuild(builder, clientEnvironment);
@@ -59875,21 +60427,21 @@ function createBuildApp(resolvedPluginConfig) {
59875
60427
  if (!satisfiesMinimumViteVersion("7.0.0") && !cfBuildOutput) removeAssetsField(entryWorkerBuildDirectory);
59876
60428
  return;
59877
60429
  }
59878
- const clientBuildDirectory = nodePath.resolve(builder.config.root, clientEnvironment.config.build.outDir);
60430
+ const clientBuildDirectory = path2.resolve(builder.config.root, clientEnvironment.config.build.outDir);
59879
60431
  const movedAssetPaths = [];
59880
60432
  for (const assetPath of importedAssetPaths) {
59881
- const src$1 = nodePath.join(entryWorkerBuildDirectory, assetPath);
59882
- const dest = nodePath.join(clientBuildDirectory, assetPath);
60433
+ const src$1 = path2.join(entryWorkerBuildDirectory, assetPath);
60434
+ const dest = path2.join(clientBuildDirectory, assetPath);
59883
60435
  if (!fs$1.existsSync(src$1)) continue;
59884
60436
  if (fs$1.existsSync(dest)) fs$1.unlinkSync(src$1);
59885
60437
  else {
59886
- const destDir = nodePath.dirname(dest);
60438
+ const destDir = path2.dirname(dest);
59887
60439
  fs$1.mkdirSync(destDir, { recursive: true });
59888
60440
  fs$1.renameSync(src$1, dest);
59889
60441
  movedAssetPaths.push(dest);
59890
60442
  }
59891
60443
  }
59892
- 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"));
59893
60445
  };
59894
60446
  }
59895
60447
  function getHasPublicAssets({ publicDir }) {
@@ -59906,11 +60458,11 @@ async function fallbackBuild(builder, environment) {
59906
60458
  output: { entryFileNames: CLIENT_FALLBACK_ENTRY_NAME }
59907
60459
  };
59908
60460
  await builder.build(environment);
59909
- 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);
59910
60462
  fs$1.unlinkSync(fallbackEntryPath);
59911
60463
  }
59912
60464
  function loadViteManifest(directory) {
59913
- 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");
59914
60466
  return JSON.parse(contents);
59915
60467
  }
59916
60468
  function getImportedAssetPaths(viteManifest) {
@@ -59921,7 +60473,7 @@ function getImportedAssetPaths(viteManifest) {
59921
60473
  * Used to remove the `assets` field from the entry Worker config if there are no assets
59922
60474
  */
59923
60475
  function removeAssetsField(entryWorkerBuildDirectory) {
59924
- const entryWorkerConfigPath = nodePath.join(entryWorkerBuildDirectory, "wrangler.json");
60476
+ const entryWorkerConfigPath = path2.join(entryWorkerBuildDirectory, "wrangler.json");
59925
60477
  const workerConfig = JSON.parse(fs$1.readFileSync(entryWorkerConfigPath, "utf-8"));
59926
60478
  workerConfig.assets = void 0;
59927
60479
  fs$1.writeFileSync(entryWorkerConfigPath, JSON.stringify(workerConfig));
@@ -59963,12 +60515,12 @@ function quoteForDotenv(value) {
59963
60515
  */
59964
60516
  function hasLocalDevVarsFileChanged({ configPaths, cloudflareEnv }, changedFilePath) {
59965
60517
  return [...configPaths].some((configPath) => {
59966
- const configDir = nodePath.dirname(configPath);
60518
+ const configDir = path2.dirname(configPath);
59967
60519
  return [
59968
60520
  ".dev.vars",
59969
60521
  ".env",
59970
60522
  ...cloudflareEnv ? [`.dev.vars.${cloudflareEnv}`, `.env.${cloudflareEnv}`] : []
59971
- ].some((localDevFile) => changedFilePath === nodePath.join(configDir, localDevFile));
60523
+ ].some((localDevFile) => changedFilePath === path2.join(configDir, localDevFile));
59972
60524
  });
59973
60525
  }
59974
60526
 
@@ -60072,7 +60624,7 @@ const configPlugin = createPlugin("config", (ctx) => {
60072
60624
  assert(entryWorkerEnvironment, `No "${entryWorkerEnvironmentName}" environment`);
60073
60625
  const cfBuildOutput = ctx.resolvedPluginConfig.experimental.newConfig?.cfBuildOutput === true;
60074
60626
  if (entryWorkerEnvironment.isBuilt) {
60075
- 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));
60076
60628
  } else {
60077
60629
  const clientEnvironment = builder.environments.client;
60078
60630
  assert(clientEnvironment, "No \"client\" environment");
@@ -60094,7 +60646,7 @@ const configPlugin = createPlugin("config", (ctx) => {
60094
60646
  }
60095
60647
  };
60096
60648
  if (outputConfig.unsafe && Object.keys(outputConfig.unsafe).length === 0) outputConfig.unsafe = void 0;
60097
- 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));
60098
60650
  writeDeployConfig(ctx.resolvedPluginConfig, ctx.resolvedViteConfig, true);
60099
60651
  }
60100
60652
  }
@@ -61542,7 +62094,7 @@ function getContainerOptions(options) {
61542
62094
  return containersConfig.map((container) => {
61543
62095
  if (isDockerfile(container.image, configPath)) return {
61544
62096
  dockerfile: container.image,
61545
- image_build_context: container.image_build_context ?? path2.dirname(container.image),
62097
+ image_build_context: container.image_build_context ?? path2__default.dirname(container.image),
61546
62098
  image_vars: container.image_vars,
61547
62099
  class_name: container.class_name,
61548
62100
  image_tag: getDevContainerImageName(container.class_name, containerBuildId)
@@ -64250,7 +64802,7 @@ const INTERNAL_WORKERS_COMPATIBILITY_DATE = "2024-10-04";
64250
64802
  const PUBLIC_DIR_PREFIX = "/__vite_public_dir__";
64251
64803
  function getPersistenceRoot(root, persistState) {
64252
64804
  if (persistState === false) return;
64253
- 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");
64254
64806
  }
64255
64807
  const miniflareModulesRoot = process.platform === "win32" ? "Z:\\" : "/";
64256
64808
  const ROUTER_WORKER_PATH = "./workers/router-worker/index.js";
@@ -64274,7 +64826,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64274
64826
  modulesRoot: miniflareModulesRoot,
64275
64827
  modules: [{
64276
64828
  type: "ESModule",
64277
- path: nodePath.join(miniflareModulesRoot, ROUTER_WORKER_PATH),
64829
+ path: path2.join(miniflareModulesRoot, ROUTER_WORKER_PATH),
64278
64830
  contents: fs$1.readFileSync(fileURLToPath(new URL(ROUTER_WORKER_PATH, import.meta.url)))
64279
64831
  }],
64280
64832
  bindings: { CONFIG: { has_user_worker: resolvedPluginConfig.type === "workers" } },
@@ -64289,7 +64841,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64289
64841
  modulesRoot: miniflareModulesRoot,
64290
64842
  modules: [{
64291
64843
  type: "ESModule",
64292
- path: nodePath.join(miniflareModulesRoot, ASSET_WORKER_PATH),
64844
+ path: path2.join(miniflareModulesRoot, ASSET_WORKER_PATH),
64293
64845
  contents: fs$1.readFileSync(fileURLToPath(new URL(ASSET_WORKER_PATH, import.meta.url)))
64294
64846
  }],
64295
64847
  bindings: {
@@ -64304,8 +64856,8 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64304
64856
  const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
64305
64857
  const publicPath = withTrailingSlash(publicDir.slice(root.length));
64306
64858
  if (publicDirInRoot && pathname.startsWith(publicPath)) return Response$1.json(null);
64307
- const publicDirFilePath = nodePath.join(publicDir, pathname);
64308
- const rootDirFilePath = nodePath.join(root, pathname);
64859
+ const publicDirFilePath = path2.join(publicDir, pathname);
64860
+ const rootDirFilePath = path2.join(root, pathname);
64309
64861
  for (const resolvedPath of [publicDirFilePath, rootDirFilePath]) try {
64310
64862
  if ((await fsp.stat(resolvedPath)).isFile()) return Response$1.json(resolvedPath === publicDirFilePath ? `${PUBLIC_DIR_PREFIX}${pathname}` : pathname);
64311
64863
  } catch {}
@@ -64316,7 +64868,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64316
64868
  const { pathname } = new URL(request$2.url);
64317
64869
  const { root, publicDir } = resolvedViteConfig;
64318
64870
  const isInPublicDir = pathname.startsWith(PUBLIC_DIR_PREFIX);
64319
- 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);
64320
64872
  try {
64321
64873
  let html = await fsp.readFile(resolvedPath, "utf-8");
64322
64874
  if (!isInPublicDir) html = await viteDevServer.transformIndexHtml(resolvedPath, html);
@@ -64333,7 +64885,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64333
64885
  modulesRoot: miniflareModulesRoot,
64334
64886
  modules: [{
64335
64887
  type: "ESModule",
64336
- path: nodePath.join(miniflareModulesRoot, VITE_PROXY_WORKER_PATH),
64888
+ path: path2.join(miniflareModulesRoot, VITE_PROXY_WORKER_PATH),
64337
64889
  contents: fs$1.readFileSync(fileURLToPath(new URL(VITE_PROXY_WORKER_PATH, import.meta.url)))
64338
64890
  }],
64339
64891
  serviceBindings: {
@@ -64349,7 +64901,8 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64349
64901
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await wrangler.maybeStartOrUpdateRemoteProxySession({
64350
64902
  name: worker.config.name,
64351
64903
  bindings: bindings$1 ?? {},
64352
- account_id: worker.config.account_id
64904
+ account_id: worker.config.account_id,
64905
+ profileDir: resolvedViteConfig.root
64353
64906
  }, preExistingRemoteProxySession ?? null);
64354
64907
  if (worker.config.configPath && remoteProxySessionData) remoteProxySessionsDataMap.set(worker.config.configPath, remoteProxySessionData);
64355
64908
  let containerBuildId;
@@ -64389,17 +64942,17 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64389
64942
  modules: [
64390
64943
  {
64391
64944
  type: "ESModule",
64392
- path: nodePath.join(miniflareModulesRoot, WRAPPER_PATH),
64945
+ path: path2.join(miniflareModulesRoot, WRAPPER_PATH),
64393
64946
  contents: wrappers.join("\n")
64394
64947
  },
64395
64948
  {
64396
64949
  type: "ESModule",
64397
- path: nodePath.join(miniflareModulesRoot, RUNNER_PATH),
64950
+ path: path2.join(miniflareModulesRoot, RUNNER_PATH),
64398
64951
  contents: fs$1.readFileSync(fileURLToPath(new URL(RUNNER_PATH, import.meta.url)))
64399
64952
  },
64400
64953
  {
64401
64954
  type: "ESModule",
64402
- path: nodePath.join(miniflareModulesRoot, "workers/runner-worker/vite/module-runner"),
64955
+ path: path2.join(miniflareModulesRoot, "workers/runner-worker/vite/module-runner"),
64403
64956
  contents: fs$1.readFileSync(fileURLToPath(new URL(satisfiesMinimumViteVersion("7.2.0") ? MODULE_RUNNER_PATH : MODULE_RUNNER_LEGACY_PATH, import.meta.url)))
64404
64957
  }
64405
64958
  ],
@@ -64453,6 +65006,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64453
65006
  telemetry: { enabled: false },
64454
65007
  handleStructuredLogs: getStructuredLogsLogger(logger),
64455
65008
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
65009
+ defaultProjectTmpPath: path2.resolve(resolvedViteConfig.root, ".wrangler/tmp"),
64456
65010
  workers: [
64457
65011
  ...assetWorkers,
64458
65012
  ...externalWorkers,
@@ -64487,8 +65041,8 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
64487
65041
  }
64488
65042
  function getPreviewModules(main, modulesRules) {
64489
65043
  assert(modulesRules, `Unexpected error: 'modulesRules' is undefined`);
64490
- const rootPath = nodePath.dirname(main);
64491
- const entryPath = nodePath.basename(main);
65044
+ const rootPath = path2.dirname(main);
65045
+ const entryPath = path2.basename(main);
64492
65046
  return {
64493
65047
  rootPath,
64494
65048
  modules: [{
@@ -64556,7 +65110,8 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
64556
65110
  const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await wrangler.maybeStartOrUpdateRemoteProxySession({
64557
65111
  name: workerConfig.name,
64558
65112
  bindings: bindings$1 ?? {},
64559
- account_id: workerConfig.account_id
65113
+ account_id: workerConfig.account_id,
65114
+ profileDir: resolvedViteConfig.root
64560
65115
  }, preExistingRemoteProxySessionData ?? null);
64561
65116
  if (workerConfig.configPath && remoteProxySessionData) remoteProxySessionsDataMap.set(workerConfig.configPath, remoteProxySessionData);
64562
65117
  let containerBuildId;
@@ -64605,6 +65160,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
64605
65160
  telemetry: { enabled: false },
64606
65161
  handleStructuredLogs: getStructuredLogsLogger(logger),
64607
65162
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
65163
+ defaultProjectTmpPath: path2.resolve(resolvedViteConfig.root, ".wrangler/tmp"),
64608
65164
  workers
64609
65165
  },
64610
65166
  containerTagToOptionsMap
@@ -65016,7 +65572,7 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
65016
65572
  }
65017
65573
  } else if (this.environment.name === "client") {
65018
65574
  const filesToAssetsIgnore = ["wrangler.json", ".dev.vars"];
65019
- 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")) : "";
65020
65576
  this.emitFile({
65021
65577
  type: "asset",
65022
65578
  fileName: ".assetsignore",
@@ -65048,8 +65604,8 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
65048
65604
  };
65049
65605
  });
65050
65606
  function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedViteConfig, entryFileName, includeAssets }) {
65051
- const sourceConfigDirectory = inputWorkerConfig.configPath ? nodePath.dirname(inputWorkerConfig.configPath) : resolvedViteConfig.root;
65052
- 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);
65053
65609
  return {
65054
65610
  ...inputWorkerConfig,
65055
65611
  main: entryFileName,
@@ -65064,8 +65620,8 @@ function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedVit
65064
65620
  } : void 0,
65065
65621
  d1_databases: inputWorkerConfig.d1_databases.map((database) => {
65066
65622
  const sourceMigrationsDir = database.migrations_dir ?? "migrations";
65067
- const sourceMigrationsPath = nodePath.resolve(sourceConfigDirectory, sourceMigrationsDir);
65068
- const outputMigrationsDir = vite.normalizePath(nodePath.relative(outputDirectory, sourceMigrationsPath) || ".");
65623
+ const sourceMigrationsPath = path2.resolve(sourceConfigDirectory, sourceMigrationsDir);
65624
+ const outputMigrationsDir = vite.normalizePath(path2.relative(outputDirectory, sourceMigrationsPath) || ".");
65069
65625
  return {
65070
65626
  ...database,
65071
65627
  migrations_dir: outputMigrationsDir,
@@ -65076,10 +65632,10 @@ function getOutputConfig({ inputWorkerConfig, workerOutputDirectory, resolvedVit
65076
65632
  }
65077
65633
  function rewriteMigrationsPattern(migrationsPattern, fromMigrationsDir, toMigrationsDir) {
65078
65634
  if (migrationsPattern === void 0) return;
65079
- const normalizedDir = nodePath.posix.normalize(vite.normalizePath(fromMigrationsDir));
65080
- const normalizedPattern = nodePath.posix.normalize(vite.normalizePath(migrationsPattern));
65081
- const suffix = normalizedDir === "." ? normalizedPattern : nodePath.posix.relative(normalizedDir, normalizedPattern);
65082
- 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}`));
65083
65639
  }
65084
65640
  function readAssetsIgnoreFile(assetsIgnorePath) {
65085
65641
  const content = fs$1.existsSync(assetsIgnorePath) ? fs$1.readFileSync(assetsIgnorePath, "utf-8") : "";
@@ -65089,7 +65645,7 @@ function readAssetsIgnoreFile(assetsIgnorePath) {
65089
65645
  function getAssetsDirectory(workerOutputDirectory, resolvedViteConfig) {
65090
65646
  const clientOutputDirectory = resolvedViteConfig.environments.client?.build.outDir;
65091
65647
  assert(clientOutputDirectory, "Unexpected error: client output directory is undefined");
65092
- 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)));
65093
65649
  }
65094
65650
 
65095
65651
  //#endregion
@@ -65489,8 +66045,8 @@ var is_in_ssh_default = isInSsh;
65489
66045
  //#endregion
65490
66046
  //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
65491
66047
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
65492
- const __dirname = import.meta.url ? path2.dirname(fileURLToPath(import.meta.url)) : "";
65493
- 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");
65494
66050
  const { platform, arch: arch$1 } = process$1;
65495
66051
  const tryEachApp = async (apps$1, opener) => {
65496
66052
  if (apps$1.length === 0) return;