varlock 0.4.2 → 0.6.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.
Files changed (93) hide show
  1. package/dist/auto-load.js +6 -6
  2. package/dist/{chunk-PCRIVT4T.js → chunk-2AGKN64R.js} +663 -258
  3. package/dist/chunk-2AGKN64R.js.map +1 -0
  4. package/dist/{chunk-BGPQX6XO.js → chunk-3J7BFRB4.js} +372 -446
  5. package/dist/chunk-3J7BFRB4.js.map +1 -0
  6. package/dist/{chunk-3U2C5ACW.js → chunk-4JMFWK65.js} +5 -5
  7. package/dist/{chunk-3U2C5ACW.js.map → chunk-4JMFWK65.js.map} +1 -1
  8. package/dist/{chunk-TYIS6T2T.js → chunk-BC7LU4LG.js} +3 -3
  9. package/dist/{chunk-TYIS6T2T.js.map → chunk-BC7LU4LG.js.map} +1 -1
  10. package/dist/chunk-EXG5VPNZ.js +17 -0
  11. package/dist/chunk-EXG5VPNZ.js.map +1 -0
  12. package/dist/{chunk-P7WVEZYA.js → chunk-FYZ7LKLX.js} +27 -7
  13. package/dist/chunk-FYZ7LKLX.js.map +1 -0
  14. package/dist/{chunk-CBWJHW3M.js → chunk-G7FDCTNA.js} +8 -8
  15. package/dist/{chunk-CBWJHW3M.js.map → chunk-G7FDCTNA.js.map} +1 -1
  16. package/dist/{chunk-WAMBVZL2.js → chunk-IMB5QAZS.js} +38 -16
  17. package/dist/chunk-IMB5QAZS.js.map +1 -0
  18. package/dist/{chunk-NWY5IIPW.js → chunk-J7PA7B2U.js} +6 -81
  19. package/dist/chunk-J7PA7B2U.js.map +1 -0
  20. package/dist/{chunk-HS2NN4VF.js → chunk-JCJISIY6.js} +6 -6
  21. package/dist/{chunk-HS2NN4VF.js.map → chunk-JCJISIY6.js.map} +1 -1
  22. package/dist/{chunk-I4RYFNPM.js → chunk-KKNNZWYD.js} +3 -3
  23. package/dist/{chunk-I4RYFNPM.js.map → chunk-KKNNZWYD.js.map} +1 -1
  24. package/dist/{chunk-QQDWRXNU.js → chunk-LVZSZAKN.js} +3 -3
  25. package/dist/{chunk-QQDWRXNU.js.map → chunk-LVZSZAKN.js.map} +1 -1
  26. package/dist/{chunk-ZXJ4CEDK.js → chunk-MYHVSJ3X.js} +3 -3
  27. package/dist/{chunk-ZXJ4CEDK.js.map → chunk-MYHVSJ3X.js.map} +1 -1
  28. package/dist/{chunk-PIOJV2A7.js → chunk-NPPZVF24.js} +4 -4
  29. package/dist/{chunk-PIOJV2A7.js.map → chunk-NPPZVF24.js.map} +1 -1
  30. package/dist/{chunk-RQDMJMKL.js → chunk-PMBDCWD5.js} +6 -5
  31. package/dist/chunk-PMBDCWD5.js.map +1 -0
  32. package/dist/{chunk-YWFNGAPT.js → chunk-SHONHP24.js} +6 -6
  33. package/dist/{chunk-YWFNGAPT.js.map → chunk-SHONHP24.js.map} +1 -1
  34. package/dist/chunk-TLEEAUD7.js +68 -0
  35. package/dist/chunk-TLEEAUD7.js.map +1 -0
  36. package/dist/{chunk-LJTQEZE2.js → chunk-UVWLW5KD.js} +6 -6
  37. package/dist/{chunk-LJTQEZE2.js.map → chunk-UVWLW5KD.js.map} +1 -1
  38. package/dist/{chunk-MIBOBKI4.js → chunk-XLYSNOR3.js} +15 -3
  39. package/dist/chunk-XLYSNOR3.js.map +1 -0
  40. package/dist/{chunk-LFBK6MZU.js → chunk-ZLAUDWOL.js} +6 -6
  41. package/dist/{chunk-LFBK6MZU.js.map → chunk-ZLAUDWOL.js.map} +1 -1
  42. package/dist/cli/cli-executable.js +24 -24
  43. package/dist/cli/cli-executable.js.map +1 -1
  44. package/dist/config-item-NO5PKZRH.js +5 -0
  45. package/dist/{config-item-K7KWEJD2.js.map → config-item-NO5PKZRH.js.map} +1 -1
  46. package/dist/dotenv-compat.js +6 -6
  47. package/dist/{env-graph-COORmJlH.d.ts → env-graph-Cz_c5P6Y.d.ts} +24 -1
  48. package/dist/index.d.ts +2 -2
  49. package/dist/index.js +11 -11
  50. package/dist/init.command-AV4EWYIT.js +12 -0
  51. package/dist/{init.command-SZPMB525.js.map → init.command-AV4EWYIT.js.map} +1 -1
  52. package/dist/load.command-5JQUW3H7.js +11 -0
  53. package/dist/{load.command-XSOTCSGA.js.map → load.command-5JQUW3H7.js.map} +1 -1
  54. package/dist/plugin-lib.d.ts +2 -2
  55. package/dist/printenv.command-SBB6GVC2.js +12 -0
  56. package/dist/{printenv.command-4HWCHHCY.js.map → printenv.command-SBB6GVC2.js.map} +1 -1
  57. package/dist/run.command-HTGTG6ER.js +12 -0
  58. package/dist/{run.command-2HLQ2AYT.js.map → run.command-HTGTG6ER.js.map} +1 -1
  59. package/dist/runtime/env.d.ts +7 -2
  60. package/dist/runtime/env.js +2 -2
  61. package/dist/runtime/init-edge.cjs +297 -0
  62. package/dist/runtime/init-edge.d.cts +1 -0
  63. package/dist/runtime/init-server.cjs +370 -0
  64. package/dist/runtime/init-server.d.cts +20 -0
  65. package/dist/runtime/patch-console.js +3 -3
  66. package/dist/runtime/patch-response.js +3 -3
  67. package/dist/runtime/patch-server-response.js +3 -3
  68. package/dist/scan.command-ADKVWN5T.js +13 -0
  69. package/dist/{scan.command-4J64EB4Z.js.map → scan.command-ADKVWN5T.js.map} +1 -1
  70. package/dist/telemetry.command-CQFTGXPF.js +11 -0
  71. package/dist/{telemetry.command-NLJFD63U.js.map → telemetry.command-CQFTGXPF.js.map} +1 -1
  72. package/dist/typegen.command-A544SFYM.js +12 -0
  73. package/dist/{typegen.command-7BE3K6PU.js.map → typegen.command-A544SFYM.js.map} +1 -1
  74. package/package.json +12 -2
  75. package/dist/chunk-6SS4YD2I.js +0 -156
  76. package/dist/chunk-6SS4YD2I.js.map +0 -1
  77. package/dist/chunk-BGPQX6XO.js.map +0 -1
  78. package/dist/chunk-MBYYRBL6.js +0 -17
  79. package/dist/chunk-MBYYRBL6.js.map +0 -1
  80. package/dist/chunk-MIBOBKI4.js.map +0 -1
  81. package/dist/chunk-NWY5IIPW.js.map +0 -1
  82. package/dist/chunk-P7WVEZYA.js.map +0 -1
  83. package/dist/chunk-PCRIVT4T.js.map +0 -1
  84. package/dist/chunk-RQDMJMKL.js.map +0 -1
  85. package/dist/chunk-WAMBVZL2.js.map +0 -1
  86. package/dist/config-item-K7KWEJD2.js +0 -5
  87. package/dist/init.command-SZPMB525.js +0 -12
  88. package/dist/load.command-XSOTCSGA.js +0 -11
  89. package/dist/printenv.command-4HWCHHCY.js +0 -12
  90. package/dist/run.command-2HLQ2AYT.js +0 -12
  91. package/dist/scan.command-4J64EB4Z.js +0 -13
  92. package/dist/telemetry.command-NLJFD63U.js +0 -11
  93. package/dist/typegen.command-7BE3K6PU.js +0 -12
@@ -1,16 +1,86 @@
1
1
  import { createDebug } from './chunk-QZ6HBRJC.js';
2
2
  import { __commonJS, __name, __toESM } from './chunk-6PEHRAEP.js';
3
- import path, { join } from 'path';
4
- import fs, { access } from 'fs/promises';
3
+ import path2, { join } from 'path';
4
+ import fs2, { access } from 'fs/promises';
5
5
  import os from 'os';
6
- import fs3, { accessSync, existsSync } from 'fs';
6
+ import fs4, { accessSync, existsSync } from 'fs';
7
7
  import { exec } from 'child_process';
8
8
  import { promisify } from 'util';
9
9
  import { createRequire } from 'module';
10
- import { pathToFileURL } from 'url';
11
10
  import crypto from 'crypto';
12
11
  import https from 'https';
13
- import vm from 'vm';
12
+ import { AsyncLocalStorage } from 'async_hooks';
13
+
14
+ // ../../node_modules/.bun/ansis@4.2.0/node_modules/ansis/index.cjs
15
+ var require_ansis = __commonJS({
16
+ "../../node_modules/.bun/ansis@4.2.0/node_modules/ansis/index.cjs"(exports$1, module) {
17
+ var e;
18
+ var t;
19
+ var r;
20
+ var { defineProperty: l, setPrototypeOf: n, create: o, keys: s } = Object;
21
+ var i = "";
22
+ var { round: c, max: a2 } = Math;
23
+ var p = /* @__PURE__ */ __name((e2) => {
24
+ let t2 = /([a-f\d]{3,6})/i.exec(e2)?.[1], r2 = t2?.length, l2 = parseInt(6 ^ r2 ? 3 ^ r2 ? "0" : t2[0] + t2[0] + t2[1] + t2[1] + t2[2] + t2[2] : t2, 16);
25
+ return [l2 >> 16 & 255, l2 >> 8 & 255, 255 & l2];
26
+ }, "p");
27
+ var u = /* @__PURE__ */ __name((e2, t2, r2) => e2 ^ t2 || t2 ^ r2 ? 16 + 36 * c(e2 / 51) + 6 * c(t2 / 51) + c(r2 / 51) : 8 > e2 ? 16 : e2 > 248 ? 231 : c(24 * (e2 - 8) / 247) + 232, "u");
28
+ var d = /* @__PURE__ */ __name((e2) => {
29
+ let t2, r2, l2, n2, o2;
30
+ return 8 > e2 ? 30 + e2 : 16 > e2 ? e2 - 8 + 90 : (232 > e2 ? (o2 = (e2 -= 16) % 36, t2 = (e2 / 36 | 0) / 5, r2 = (o2 / 6 | 0) / 5, l2 = o2 % 6 / 5) : t2 = r2 = l2 = (10 * (e2 - 232) + 8) / 255, n2 = 2 * a2(t2, r2, l2), n2 ? 30 + (c(l2) << 2 | c(r2) << 1 | c(t2)) + (2 ^ n2 ? 0 : 60) : 30);
31
+ }, "d");
32
+ var f = (() => {
33
+ let r2 = /* @__PURE__ */ __name((e2) => o2.some(((t2) => e2.test(t2))), "r"), l2 = globalThis, n2 = l2.process ?? {}, o2 = n2.argv ?? [], i2 = n2.env ?? {}, c2 = -1;
34
+ try {
35
+ e = "," + s(i2).join(",");
36
+ } catch (e2) {
37
+ i2 = {}, c2 = 0;
38
+ }
39
+ let a3 = "FORCE_COLOR", p2 = { false: 0, 0: 0, 1: 1, 2: 2, 3: 3 }[i2[a3]] ?? -1, u2 = a3 in i2 && p2 || r2(/^--color=?(true|always)?$/);
40
+ return u2 && (c2 = p2), ~c2 || (c2 = ((r3, l3, n3) => (t = r3.TERM, { "24bit": 3, truecolor: 3, ansi256: 2, ansi: 1 }[r3.COLORTERM] || (r3.CI ? /,GITHUB/.test(e) ? 3 : 1 : l3 && "dumb" !== t ? n3 ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i2, !!i2.PM2_HOME || i2.NEXT_RUNTIME?.includes("edge") || !!n2.stdout?.isTTY, "win32" === n2.platform)), !p2 || i2.NO_COLOR || r2(/^--(no-color|color=(false|never))$/) ? 0 : l2.window?.chrome || u2 && !c2 ? 3 : c2;
41
+ })();
42
+ var g = { open: i, close: i };
43
+ var h = 39;
44
+ var b = 49;
45
+ var O = {};
46
+ var m = /* @__PURE__ */ __name(({ p: e2 }, { open: t2, close: l2 }) => {
47
+ let o2 = /* @__PURE__ */ __name((e3, ...r2) => {
48
+ if (!e3) {
49
+ if (t2 && t2 === l2) return t2;
50
+ if ((e3 ?? i) === i) return i;
51
+ }
52
+ let n2, s3 = e3.raw ? String.raw({ raw: e3 }, ...r2) : i + e3, c3 = o2.p, a3 = c3.o, p2 = c3.c;
53
+ if (s3.includes("\x1B")) for (; c3; c3 = c3.p) {
54
+ let { open: e4, close: t3 } = c3, r3 = t3.length, l3 = i, o3 = 0;
55
+ if (r3) for (; ~(n2 = s3.indexOf(t3, o3)); o3 = n2 + r3) l3 += s3.slice(o3, n2) + e4;
56
+ s3 = l3 + s3.slice(o3);
57
+ }
58
+ return a3 + (s3.includes("\n") ? s3.replace(/(\r?\n)/g, p2 + "$1" + a3) : s3) + p2;
59
+ }, "o"), s2 = t2, c2 = l2;
60
+ return e2 && (s2 = e2.o + t2, c2 = l2 + e2.c), n(o2, r), o2.p = { open: t2, close: l2, o: s2, c: c2, p: e2 }, o2.open = s2, o2.close = c2, o2;
61
+ }, "m");
62
+ var w = new (/* @__PURE__ */ __name(function e2(t2 = f) {
63
+ let s2 = { Ansis: e2, level: t2, isSupported: /* @__PURE__ */ __name(() => a3, "isSupported"), strip: /* @__PURE__ */ __name((e3) => e3.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i), "strip"), extend(e3) {
64
+ for (let t3 in e3) {
65
+ let r2 = e3[t3], l2 = (typeof r2)[0];
66
+ "s" === l2 ? (c2(t3, T(...p(r2))), c2(_3(t3), v(...p(r2)))) : c2(t3, r2, "f" === l2);
67
+ }
68
+ return r = o({}, O), n(s2, r), s2;
69
+ } }, c2 = /* @__PURE__ */ __name((e3, t3, r2) => {
70
+ O[e3] = { get() {
71
+ let n2 = r2 ? (...e4) => m(this, t3(...e4)) : m(this, t3);
72
+ return l(this, e3, { value: n2 }), n2;
73
+ } };
74
+ }, "c"), a3 = t2 > 0, w2 = /* @__PURE__ */ __name((e3, t3) => a3 ? { open: `\x1B[${e3}m`, close: `\x1B[${t3}m` } : g, "w"), y = /* @__PURE__ */ __name((e3) => (t3) => e3(...p(t3)), "y"), R = /* @__PURE__ */ __name((e3, t3) => (r2, l2, n2) => w2(`${e3}8;2;${r2};${l2};${n2}`, t3), "R"), $ = /* @__PURE__ */ __name((e3, t3) => (r2, l2, n2) => w2(((e4, t4, r3) => d(u(e4, t4, r3)))(r2, l2, n2) + e3, t3), "$"), x = /* @__PURE__ */ __name((e3) => (t3, r2, l2) => e3(u(t3, r2, l2)), "x"), T = R(3, h), v = R(4, b), C = /* @__PURE__ */ __name((e3) => w2("38;5;" + e3, h), "C"), E = /* @__PURE__ */ __name((e3) => w2("48;5;" + e3, b), "E");
75
+ 2 === t2 ? (T = x(C), v = x(E)) : 1 === t2 && (T = $(0, h), v = $(10, b), C = /* @__PURE__ */ __name((e3) => w2(d(e3), h), "C"), E = /* @__PURE__ */ __name((e3) => w2(d(e3) + 10, b), "E"));
76
+ let M, I = { fg: C, bg: E, rgb: T, bgRgb: v, hex: y(T), bgHex: y(v), visible: g, reset: w2(0, 0), bold: w2(1, 22), dim: w2(2, 22), italic: w2(3, 23), underline: w2(4, 24), inverse: w2(7, 27), hidden: w2(8, 28), strikethrough: w2(9, 29) }, _3 = /* @__PURE__ */ __name((e3) => "bg" + e3[0].toUpperCase() + e3.slice(1), "_"), k = "Bright";
77
+ return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e3, t3) => {
78
+ M = _3(e3), 8 > t3 ? (I[e3 + k] = w2(90 + t3, h), I[M + k] = w2(100 + t3, b)) : t3 = 60, I[e3] = w2(30 + t3, h), I[M] = w2(40 + t3, b);
79
+ })), s2.extend(I);
80
+ }, "e"))();
81
+ module.exports = w, w.default = w;
82
+ }
83
+ });
14
84
 
15
85
  // ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/constants.js
16
86
  var require_constants = __commonJS({
@@ -46,9 +116,9 @@ var require_constants = __commonJS({
46
116
  // ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/debug.js
47
117
  var require_debug = __commonJS({
48
118
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/debug.js"(exports$1, module) {
49
- var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
119
+ var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
50
120
  };
51
- module.exports = debug;
121
+ module.exports = debug2;
52
122
  }
53
123
  });
54
124
 
@@ -60,7 +130,7 @@ var require_re = __commonJS({
60
130
  MAX_SAFE_BUILD_LENGTH,
61
131
  MAX_LENGTH
62
132
  } = require_constants();
63
- var debug = require_debug();
133
+ var debug2 = require_debug();
64
134
  exports$1 = module.exports = {};
65
135
  var re = exports$1.re = [];
66
136
  var safeRe = exports$1.safeRe = [];
@@ -83,7 +153,7 @@ var require_re = __commonJS({
83
153
  var createToken = /* @__PURE__ */ __name((name, value, isGlobal) => {
84
154
  const safe = makeSafeRegex(value);
85
155
  const index = R++;
86
- debug(name, index, value);
156
+ debug2(name, index, value);
87
157
  t[name] = index;
88
158
  src[index] = value;
89
159
  safeSrc[index] = safe;
@@ -161,19 +231,19 @@ var require_parse_options = __commonJS({
161
231
  var require_identifiers = __commonJS({
162
232
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/identifiers.js"(exports$1, module) {
163
233
  var numeric = /^[0-9]+$/;
164
- var compareIdentifiers = /* @__PURE__ */ __name((a, b) => {
165
- if (typeof a === "number" && typeof b === "number") {
166
- return a === b ? 0 : a < b ? -1 : 1;
234
+ var compareIdentifiers = /* @__PURE__ */ __name((a2, b) => {
235
+ if (typeof a2 === "number" && typeof b === "number") {
236
+ return a2 === b ? 0 : a2 < b ? -1 : 1;
167
237
  }
168
- const anum = numeric.test(a);
238
+ const anum = numeric.test(a2);
169
239
  const bnum = numeric.test(b);
170
240
  if (anum && bnum) {
171
- a = +a;
241
+ a2 = +a2;
172
242
  b = +b;
173
243
  }
174
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
244
+ return a2 === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a2 < b ? -1 : 1;
175
245
  }, "compareIdentifiers");
176
- var rcompareIdentifiers = /* @__PURE__ */ __name((a, b) => compareIdentifiers(b, a), "rcompareIdentifiers");
246
+ var rcompareIdentifiers = /* @__PURE__ */ __name((a2, b) => compareIdentifiers(b, a2), "rcompareIdentifiers");
177
247
  module.exports = {
178
248
  compareIdentifiers,
179
249
  rcompareIdentifiers
@@ -184,7 +254,7 @@ var require_identifiers = __commonJS({
184
254
  // ../../node_modules/.bun/semver@7.7.4/node_modules/semver/classes/semver.js
185
255
  var require_semver = __commonJS({
186
256
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/classes/semver.js"(exports$1, module) {
187
- var debug = require_debug();
257
+ var debug2 = require_debug();
188
258
  var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
189
259
  var { safeRe: re, t } = require_re();
190
260
  var parseOptions = require_parse_options();
@@ -209,7 +279,7 @@ var require_semver = __commonJS({
209
279
  `version is longer than ${MAX_LENGTH} characters`
210
280
  );
211
281
  }
212
- debug("SemVer", version, options);
282
+ debug2("SemVer", version, options);
213
283
  this.options = options;
214
284
  this.loose = !!options.loose;
215
285
  this.includePrerelease = !!options.includePrerelease;
@@ -257,7 +327,7 @@ var require_semver = __commonJS({
257
327
  return this.version;
258
328
  }
259
329
  compare(other) {
260
- debug("SemVer.compare", this.version, this.options, other);
330
+ debug2("SemVer.compare", this.version, this.options, other);
261
331
  if (!(other instanceof _SemVer)) {
262
332
  if (typeof other === "string" && other === this.version) {
263
333
  return 0;
@@ -306,19 +376,19 @@ var require_semver = __commonJS({
306
376
  }
307
377
  let i = 0;
308
378
  do {
309
- const a = this.prerelease[i];
379
+ const a2 = this.prerelease[i];
310
380
  const b = other.prerelease[i];
311
- debug("prerelease compare", i, a, b);
312
- if (a === void 0 && b === void 0) {
381
+ debug2("prerelease compare", i, a2, b);
382
+ if (a2 === void 0 && b === void 0) {
313
383
  return 0;
314
384
  } else if (b === void 0) {
315
385
  return 1;
316
- } else if (a === void 0) {
386
+ } else if (a2 === void 0) {
317
387
  return -1;
318
- } else if (a === b) {
388
+ } else if (a2 === b) {
319
389
  continue;
320
390
  } else {
321
- return compareIdentifiers(a, b);
391
+ return compareIdentifiers(a2, b);
322
392
  }
323
393
  } while (++i);
324
394
  }
@@ -328,19 +398,19 @@ var require_semver = __commonJS({
328
398
  }
329
399
  let i = 0;
330
400
  do {
331
- const a = this.build[i];
401
+ const a2 = this.build[i];
332
402
  const b = other.build[i];
333
- debug("build compare", i, a, b);
334
- if (a === void 0 && b === void 0) {
403
+ debug2("build compare", i, a2, b);
404
+ if (a2 === void 0 && b === void 0) {
335
405
  return 0;
336
406
  } else if (b === void 0) {
337
407
  return 1;
338
- } else if (a === void 0) {
408
+ } else if (a2 === void 0) {
339
409
  return -1;
340
- } else if (a === b) {
410
+ } else if (a2 === b) {
341
411
  continue;
342
412
  } else {
343
- return compareIdentifiers(a, b);
413
+ return compareIdentifiers(a2, b);
344
414
  }
345
415
  } while (++i);
346
416
  }
@@ -577,7 +647,7 @@ var require_diff = __commonJS({
577
647
  var require_major = __commonJS({
578
648
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/major.js"(exports$1, module) {
579
649
  var SemVer = require_semver();
580
- var major = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).major, "major");
650
+ var major = /* @__PURE__ */ __name((a2, loose) => new SemVer(a2, loose).major, "major");
581
651
  module.exports = major;
582
652
  }
583
653
  });
@@ -586,7 +656,7 @@ var require_major = __commonJS({
586
656
  var require_minor = __commonJS({
587
657
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/minor.js"(exports$1, module) {
588
658
  var SemVer = require_semver();
589
- var minor = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).minor, "minor");
659
+ var minor = /* @__PURE__ */ __name((a2, loose) => new SemVer(a2, loose).minor, "minor");
590
660
  module.exports = minor;
591
661
  }
592
662
  });
@@ -595,7 +665,7 @@ var require_minor = __commonJS({
595
665
  var require_patch = __commonJS({
596
666
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/patch.js"(exports$1, module) {
597
667
  var SemVer = require_semver();
598
- var patch = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).patch, "patch");
668
+ var patch = /* @__PURE__ */ __name((a2, loose) => new SemVer(a2, loose).patch, "patch");
599
669
  module.exports = patch;
600
670
  }
601
671
  });
@@ -616,7 +686,7 @@ var require_prerelease = __commonJS({
616
686
  var require_compare = __commonJS({
617
687
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/compare.js"(exports$1, module) {
618
688
  var SemVer = require_semver();
619
- var compare = /* @__PURE__ */ __name((a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)), "compare");
689
+ var compare = /* @__PURE__ */ __name((a2, b, loose) => new SemVer(a2, loose).compare(new SemVer(b, loose)), "compare");
620
690
  module.exports = compare;
621
691
  }
622
692
  });
@@ -625,7 +695,7 @@ var require_compare = __commonJS({
625
695
  var require_rcompare = __commonJS({
626
696
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/rcompare.js"(exports$1, module) {
627
697
  var compare = require_compare();
628
- var rcompare = /* @__PURE__ */ __name((a, b, loose) => compare(b, a, loose), "rcompare");
698
+ var rcompare = /* @__PURE__ */ __name((a2, b, loose) => compare(b, a2, loose), "rcompare");
629
699
  module.exports = rcompare;
630
700
  }
631
701
  });
@@ -634,7 +704,7 @@ var require_rcompare = __commonJS({
634
704
  var require_compare_loose = __commonJS({
635
705
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/compare-loose.js"(exports$1, module) {
636
706
  var compare = require_compare();
637
- var compareLoose = /* @__PURE__ */ __name((a, b) => compare(a, b, true), "compareLoose");
707
+ var compareLoose = /* @__PURE__ */ __name((a2, b) => compare(a2, b, true), "compareLoose");
638
708
  module.exports = compareLoose;
639
709
  }
640
710
  });
@@ -643,8 +713,8 @@ var require_compare_loose = __commonJS({
643
713
  var require_compare_build = __commonJS({
644
714
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/compare-build.js"(exports$1, module) {
645
715
  var SemVer = require_semver();
646
- var compareBuild = /* @__PURE__ */ __name((a, b, loose) => {
647
- const versionA = new SemVer(a, loose);
716
+ var compareBuild = /* @__PURE__ */ __name((a2, b, loose) => {
717
+ const versionA = new SemVer(a2, loose);
648
718
  const versionB = new SemVer(b, loose);
649
719
  return versionA.compare(versionB) || versionA.compareBuild(versionB);
650
720
  }, "compareBuild");
@@ -656,7 +726,7 @@ var require_compare_build = __commonJS({
656
726
  var require_sort = __commonJS({
657
727
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/sort.js"(exports$1, module) {
658
728
  var compareBuild = require_compare_build();
659
- var sort = /* @__PURE__ */ __name((list, loose) => list.sort((a, b) => compareBuild(a, b, loose)), "sort");
729
+ var sort = /* @__PURE__ */ __name((list, loose) => list.sort((a2, b) => compareBuild(a2, b, loose)), "sort");
660
730
  module.exports = sort;
661
731
  }
662
732
  });
@@ -665,7 +735,7 @@ var require_sort = __commonJS({
665
735
  var require_rsort = __commonJS({
666
736
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/rsort.js"(exports$1, module) {
667
737
  var compareBuild = require_compare_build();
668
- var rsort = /* @__PURE__ */ __name((list, loose) => list.sort((a, b) => compareBuild(b, a, loose)), "rsort");
738
+ var rsort = /* @__PURE__ */ __name((list, loose) => list.sort((a2, b) => compareBuild(b, a2, loose)), "rsort");
669
739
  module.exports = rsort;
670
740
  }
671
741
  });
@@ -674,7 +744,7 @@ var require_rsort = __commonJS({
674
744
  var require_gt = __commonJS({
675
745
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/gt.js"(exports$1, module) {
676
746
  var compare = require_compare();
677
- var gt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) > 0, "gt");
747
+ var gt = /* @__PURE__ */ __name((a2, b, loose) => compare(a2, b, loose) > 0, "gt");
678
748
  module.exports = gt;
679
749
  }
680
750
  });
@@ -683,7 +753,7 @@ var require_gt = __commonJS({
683
753
  var require_lt = __commonJS({
684
754
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/lt.js"(exports$1, module) {
685
755
  var compare = require_compare();
686
- var lt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) < 0, "lt");
756
+ var lt = /* @__PURE__ */ __name((a2, b, loose) => compare(a2, b, loose) < 0, "lt");
687
757
  module.exports = lt;
688
758
  }
689
759
  });
@@ -692,7 +762,7 @@ var require_lt = __commonJS({
692
762
  var require_eq = __commonJS({
693
763
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/eq.js"(exports$1, module) {
694
764
  var compare = require_compare();
695
- var eq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) === 0, "eq");
765
+ var eq = /* @__PURE__ */ __name((a2, b, loose) => compare(a2, b, loose) === 0, "eq");
696
766
  module.exports = eq;
697
767
  }
698
768
  });
@@ -701,7 +771,7 @@ var require_eq = __commonJS({
701
771
  var require_neq = __commonJS({
702
772
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/neq.js"(exports$1, module) {
703
773
  var compare = require_compare();
704
- var neq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) !== 0, "neq");
774
+ var neq = /* @__PURE__ */ __name((a2, b, loose) => compare(a2, b, loose) !== 0, "neq");
705
775
  module.exports = neq;
706
776
  }
707
777
  });
@@ -710,7 +780,7 @@ var require_neq = __commonJS({
710
780
  var require_gte = __commonJS({
711
781
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/gte.js"(exports$1, module) {
712
782
  var compare = require_compare();
713
- var gte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) >= 0, "gte");
783
+ var gte = /* @__PURE__ */ __name((a2, b, loose) => compare(a2, b, loose) >= 0, "gte");
714
784
  module.exports = gte;
715
785
  }
716
786
  });
@@ -719,7 +789,7 @@ var require_gte = __commonJS({
719
789
  var require_lte = __commonJS({
720
790
  "../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/lte.js"(exports$1, module) {
721
791
  var compare = require_compare();
722
- var lte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) <= 0, "lte");
792
+ var lte = /* @__PURE__ */ __name((a2, b, loose) => compare(a2, b, loose) <= 0, "lte");
723
793
  module.exports = lte;
724
794
  }
725
795
  });
@@ -733,38 +803,38 @@ var require_cmp = __commonJS({
733
803
  var gte = require_gte();
734
804
  var lt = require_lt();
735
805
  var lte = require_lte();
736
- var cmp = /* @__PURE__ */ __name((a, op, b, loose) => {
806
+ var cmp = /* @__PURE__ */ __name((a2, op, b, loose) => {
737
807
  switch (op) {
738
808
  case "===":
739
- if (typeof a === "object") {
740
- a = a.version;
809
+ if (typeof a2 === "object") {
810
+ a2 = a2.version;
741
811
  }
742
812
  if (typeof b === "object") {
743
813
  b = b.version;
744
814
  }
745
- return a === b;
815
+ return a2 === b;
746
816
  case "!==":
747
- if (typeof a === "object") {
748
- a = a.version;
817
+ if (typeof a2 === "object") {
818
+ a2 = a2.version;
749
819
  }
750
820
  if (typeof b === "object") {
751
821
  b = b.version;
752
822
  }
753
- return a !== b;
823
+ return a2 !== b;
754
824
  case "":
755
825
  case "=":
756
826
  case "==":
757
- return eq(a, b, loose);
827
+ return eq(a2, b, loose);
758
828
  case "!=":
759
- return neq(a, b, loose);
829
+ return neq(a2, b, loose);
760
830
  case ">":
761
- return gt(a, b, loose);
831
+ return gt(a2, b, loose);
762
832
  case ">=":
763
- return gte(a, b, loose);
833
+ return gte(a2, b, loose);
764
834
  case "<":
765
- return lt(a, b, loose);
835
+ return lt(a2, b, loose);
766
836
  case "<=":
767
- return lte(a, b, loose);
837
+ return lte(a2, b, loose);
768
838
  default:
769
839
  throw new TypeError(`Invalid operator: ${op}`);
770
840
  }
@@ -939,21 +1009,21 @@ var require_range = __commonJS({
939
1009
  const loose = this.options.loose;
940
1010
  const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
941
1011
  range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
942
- debug("hyphen replace", range);
1012
+ debug2("hyphen replace", range);
943
1013
  range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
944
- debug("comparator trim", range);
1014
+ debug2("comparator trim", range);
945
1015
  range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
946
- debug("tilde trim", range);
1016
+ debug2("tilde trim", range);
947
1017
  range = range.replace(re[t.CARETTRIM], caretTrimReplace);
948
- debug("caret trim", range);
1018
+ debug2("caret trim", range);
949
1019
  let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
950
1020
  if (loose) {
951
1021
  rangeList = rangeList.filter((comp) => {
952
- debug("loose invalid filter", comp, this.options);
1022
+ debug2("loose invalid filter", comp, this.options);
953
1023
  return !!comp.match(re[t.COMPARATORLOOSE]);
954
1024
  });
955
1025
  }
956
- debug("range list", rangeList);
1026
+ debug2("range list", rangeList);
957
1027
  const rangeMap = /* @__PURE__ */ new Map();
958
1028
  const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
959
1029
  for (const comp of comparators) {
@@ -1008,7 +1078,7 @@ var require_range = __commonJS({
1008
1078
  var cache = new LRU();
1009
1079
  var parseOptions = require_parse_options();
1010
1080
  var Comparator = require_comparator();
1011
- var debug = require_debug();
1081
+ var debug2 = require_debug();
1012
1082
  var SemVer = require_semver();
1013
1083
  var {
1014
1084
  safeRe: re,
@@ -1034,15 +1104,15 @@ var require_range = __commonJS({
1034
1104
  }, "isSatisfiable");
1035
1105
  var parseComparator = /* @__PURE__ */ __name((comp, options) => {
1036
1106
  comp = comp.replace(re[t.BUILD], "");
1037
- debug("comp", comp, options);
1107
+ debug2("comp", comp, options);
1038
1108
  comp = replaceCarets(comp, options);
1039
- debug("caret", comp);
1109
+ debug2("caret", comp);
1040
1110
  comp = replaceTildes(comp, options);
1041
- debug("tildes", comp);
1111
+ debug2("tildes", comp);
1042
1112
  comp = replaceXRanges(comp, options);
1043
- debug("xrange", comp);
1113
+ debug2("xrange", comp);
1044
1114
  comp = replaceStars(comp, options);
1045
- debug("stars", comp);
1115
+ debug2("stars", comp);
1046
1116
  return comp;
1047
1117
  }, "parseComparator");
1048
1118
  var isX = /* @__PURE__ */ __name((id) => !id || id.toLowerCase() === "x" || id === "*", "isX");
@@ -1052,7 +1122,7 @@ var require_range = __commonJS({
1052
1122
  var replaceTilde = /* @__PURE__ */ __name((comp, options) => {
1053
1123
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1054
1124
  return comp.replace(r, (_3, M, m, p, pr) => {
1055
- debug("tilde", comp, _3, M, m, p, pr);
1125
+ debug2("tilde", comp, _3, M, m, p, pr);
1056
1126
  let ret;
1057
1127
  if (isX(M)) {
1058
1128
  ret = "";
@@ -1061,12 +1131,12 @@ var require_range = __commonJS({
1061
1131
  } else if (isX(p)) {
1062
1132
  ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1063
1133
  } else if (pr) {
1064
- debug("replaceTilde pr", pr);
1134
+ debug2("replaceTilde pr", pr);
1065
1135
  ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1066
1136
  } else {
1067
1137
  ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1068
1138
  }
1069
- debug("tilde return", ret);
1139
+ debug2("tilde return", ret);
1070
1140
  return ret;
1071
1141
  });
1072
1142
  }, "replaceTilde");
@@ -1074,11 +1144,11 @@ var require_range = __commonJS({
1074
1144
  return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1075
1145
  }, "replaceCarets");
1076
1146
  var replaceCaret = /* @__PURE__ */ __name((comp, options) => {
1077
- debug("caret", comp, options);
1147
+ debug2("caret", comp, options);
1078
1148
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1079
1149
  const z = options.includePrerelease ? "-0" : "";
1080
1150
  return comp.replace(r, (_3, M, m, p, pr) => {
1081
- debug("caret", comp, _3, M, m, p, pr);
1151
+ debug2("caret", comp, _3, M, m, p, pr);
1082
1152
  let ret;
1083
1153
  if (isX(M)) {
1084
1154
  ret = "";
@@ -1091,7 +1161,7 @@ var require_range = __commonJS({
1091
1161
  ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1092
1162
  }
1093
1163
  } else if (pr) {
1094
- debug("replaceCaret pr", pr);
1164
+ debug2("replaceCaret pr", pr);
1095
1165
  if (M === "0") {
1096
1166
  if (m === "0") {
1097
1167
  ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
@@ -1102,7 +1172,7 @@ var require_range = __commonJS({
1102
1172
  ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1103
1173
  }
1104
1174
  } else {
1105
- debug("no pr");
1175
+ debug2("no pr");
1106
1176
  if (M === "0") {
1107
1177
  if (m === "0") {
1108
1178
  ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
@@ -1113,19 +1183,19 @@ var require_range = __commonJS({
1113
1183
  ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1114
1184
  }
1115
1185
  }
1116
- debug("caret return", ret);
1186
+ debug2("caret return", ret);
1117
1187
  return ret;
1118
1188
  });
1119
1189
  }, "replaceCaret");
1120
1190
  var replaceXRanges = /* @__PURE__ */ __name((comp, options) => {
1121
- debug("replaceXRanges", comp, options);
1191
+ debug2("replaceXRanges", comp, options);
1122
1192
  return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1123
1193
  }, "replaceXRanges");
1124
1194
  var replaceXRange = /* @__PURE__ */ __name((comp, options) => {
1125
1195
  comp = comp.trim();
1126
1196
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1127
1197
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1128
- debug("xRange", comp, ret, gtlt, M, m, p, pr);
1198
+ debug2("xRange", comp, ret, gtlt, M, m, p, pr);
1129
1199
  const xM = isX(M);
1130
1200
  const xm = xM || isX(m);
1131
1201
  const xp = xm || isX(p);
@@ -1172,16 +1242,16 @@ var require_range = __commonJS({
1172
1242
  } else if (xp) {
1173
1243
  ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1174
1244
  }
1175
- debug("xRange return", ret);
1245
+ debug2("xRange return", ret);
1176
1246
  return ret;
1177
1247
  });
1178
1248
  }, "replaceXRange");
1179
1249
  var replaceStars = /* @__PURE__ */ __name((comp, options) => {
1180
- debug("replaceStars", comp, options);
1250
+ debug2("replaceStars", comp, options);
1181
1251
  return comp.trim().replace(re[t.STAR], "");
1182
1252
  }, "replaceStars");
1183
1253
  var replaceGTE0 = /* @__PURE__ */ __name((comp, options) => {
1184
- debug("replaceGTE0", comp, options);
1254
+ debug2("replaceGTE0", comp, options);
1185
1255
  return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1186
1256
  }, "replaceGTE0");
1187
1257
  var hyphenReplace = /* @__PURE__ */ __name((incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
@@ -1219,7 +1289,7 @@ var require_range = __commonJS({
1219
1289
  }
1220
1290
  if (version.prerelease.length && !options.includePrerelease) {
1221
1291
  for (let i = 0; i < set.length; i++) {
1222
- debug(set[i].semver);
1292
+ debug2(set[i].semver);
1223
1293
  if (set[i].semver === Comparator.ANY) {
1224
1294
  continue;
1225
1295
  }
@@ -1258,7 +1328,7 @@ var require_comparator = __commonJS({
1258
1328
  }
1259
1329
  }
1260
1330
  comp = comp.trim().split(/\s+/).join(" ");
1261
- debug("comparator", comp, options);
1331
+ debug2("comparator", comp, options);
1262
1332
  this.options = options;
1263
1333
  this.loose = !!options.loose;
1264
1334
  this.parse(comp);
@@ -1267,7 +1337,7 @@ var require_comparator = __commonJS({
1267
1337
  } else {
1268
1338
  this.value = this.operator + this.semver.version;
1269
1339
  }
1270
- debug("comp", this);
1340
+ debug2("comp", this);
1271
1341
  }
1272
1342
  parse(comp) {
1273
1343
  const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
@@ -1289,7 +1359,7 @@ var require_comparator = __commonJS({
1289
1359
  return this.value;
1290
1360
  }
1291
1361
  test(version) {
1292
- debug("Comparator.test", version, this.options.loose);
1362
+ debug2("Comparator.test", version, this.options.loose);
1293
1363
  if (this.semver === ANY || version === ANY) {
1294
1364
  return true;
1295
1365
  }
@@ -1346,7 +1416,7 @@ var require_comparator = __commonJS({
1346
1416
  var parseOptions = require_parse_options();
1347
1417
  var { safeRe: re, t } = require_re();
1348
1418
  var cmp = require_cmp();
1349
- var debug = require_debug();
1419
+ var debug2 = require_debug();
1350
1420
  var SemVer = require_semver();
1351
1421
  var Range = require_range();
1352
1422
  }
@@ -1614,7 +1684,7 @@ var require_simplify = __commonJS({
1614
1684
  const set = [];
1615
1685
  let first = null;
1616
1686
  let prev = null;
1617
- const v = versions.sort((a, b) => compare(a, b, options));
1687
+ const v = versions.sort((a2, b) => compare(a2, b, options));
1618
1688
  for (const version of v) {
1619
1689
  const included = satisfies(version, range, options);
1620
1690
  if (included) {
@@ -1797,19 +1867,19 @@ var require_subset = __commonJS({
1797
1867
  }
1798
1868
  return true;
1799
1869
  }, "simpleSubset");
1800
- var higherGT = /* @__PURE__ */ __name((a, b, options) => {
1801
- if (!a) {
1870
+ var higherGT = /* @__PURE__ */ __name((a2, b, options) => {
1871
+ if (!a2) {
1802
1872
  return b;
1803
1873
  }
1804
- const comp = compare(a.semver, b.semver, options);
1805
- return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
1874
+ const comp = compare(a2.semver, b.semver, options);
1875
+ return comp > 0 ? a2 : comp < 0 ? b : b.operator === ">" && a2.operator === ">=" ? b : a2;
1806
1876
  }, "higherGT");
1807
- var lowerLT = /* @__PURE__ */ __name((a, b, options) => {
1808
- if (!a) {
1877
+ var lowerLT = /* @__PURE__ */ __name((a2, b, options) => {
1878
+ if (!a2) {
1809
1879
  return b;
1810
1880
  }
1811
- const comp = compare(a.semver, b.semver, options);
1812
- return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
1881
+ const comp = compare(a2.semver, b.semver, options);
1882
+ return comp < 0 ? a2 : comp > 0 ? b : b.operator === "<" && a2.operator === "<=" ? b : a2;
1813
1883
  }, "lowerLT");
1814
1884
  module.exports = subset;
1815
1885
  }
@@ -2608,13 +2678,13 @@ function sortBy(array, compareBy) {
2608
2678
  compareMap.set(item, compareBy(item));
2609
2679
  });
2610
2680
  return array.concat().sort(
2611
- (a, b) => compareMap.get(a) - compareMap.get(b)
2681
+ (a2, b) => compareMap.get(a2) - compareMap.get(b)
2612
2682
  );
2613
2683
  } else {
2614
2684
  return array.concat().sort(
2615
- (a, b) => {
2616
- if (a[compareBy] > b[compareBy]) return 1;
2617
- return b[compareBy] > a[compareBy] ? -1 : 0;
2685
+ (a2, b) => {
2686
+ if (a2[compareBy] > b[compareBy]) return 1;
2687
+ return b[compareBy] > a2[compareBy] ? -1 : 0;
2618
2688
  }
2619
2689
  );
2620
2690
  }
@@ -2657,7 +2727,7 @@ function flatMap(array, fn) {
2657
2727
  }
2658
2728
  __name(flatMap, "flatMap");
2659
2729
  function intersection(...arrays) {
2660
- return arrays.reduce((a, b) => a.filter((value) => b.includes(value)));
2730
+ return arrays.reduce((a2, b) => a2.filter((value) => b.includes(value)));
2661
2731
  }
2662
2732
  __name(intersection, "intersection");
2663
2733
  function pick(obj, keys) {
@@ -2678,7 +2748,7 @@ var _ = {
2678
2748
  compact,
2679
2749
  keys: Object.keys,
2680
2750
  values: Object.values,
2681
- some: /* @__PURE__ */ __name((a, fn) => a.some(fn), "some"),
2751
+ some: /* @__PURE__ */ __name((a2, fn) => a2.some(fn), "some"),
2682
2752
  filter,
2683
2753
  each,
2684
2754
  castArray,
@@ -2704,7 +2774,7 @@ var _ = {
2704
2774
  };
2705
2775
  var my_dash_default = _;
2706
2776
 
2707
- // ../env-spec-parser/dist/chunk-CO7WMO6T.mjs
2777
+ // ../env-spec-parser/dist/chunk-XRNR4FE7.mjs
2708
2778
  var __defProp = Object.defineProperty;
2709
2779
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp(target, "name", { value, configurable: true }), "__name");
2710
2780
  var VALID_NUMBER_REGEX = /^-?(0|([1-9][0-9]*))?(\.[0-9]+)?$/;
@@ -3066,20 +3136,48 @@ var ParsedEnvSpecFile = class {
3066
3136
  get configItems() {
3067
3137
  return this.contents.filter((item) => item instanceof ParsedEnvSpecConfigItem);
3068
3138
  }
3069
- get header() {
3139
+ /** all comment blocks before the first config item (the "header" area) */
3140
+ get headerBlocks() {
3141
+ const blocks = [];
3070
3142
  for (const item of this.contents) {
3071
- if (item instanceof ParsedEnvSpecCommentBlock && item.divider) {
3072
- return item;
3073
- } else if (!(item instanceof ParsedEnvSpecBlankLine)) {
3074
- return;
3143
+ if (item instanceof ParsedEnvSpecCommentBlock) {
3144
+ blocks.push(item);
3145
+ } else if (item instanceof ParsedEnvSpecBlankLine || item instanceof ParsedEnvSpecDivider) {
3146
+ continue;
3147
+ } else {
3148
+ break;
3075
3149
  }
3076
3150
  }
3151
+ return blocks;
3152
+ }
3153
+ /** primary header block - the last comment block before the first config item */
3154
+ get header() {
3155
+ const blocks = this.headerBlocks;
3156
+ return blocks.length > 0 ? blocks[blocks.length - 1] : void 0;
3077
3157
  }
3078
3158
  get decoratorsObject() {
3079
- return this.header?.decoratorsObject ?? {};
3159
+ const decObj = {};
3160
+ for (const block of this.headerBlocks) {
3161
+ Object.assign(decObj, block.decoratorsObject);
3162
+ }
3163
+ return decObj;
3080
3164
  }
3081
3165
  get decoratorsArray() {
3082
- return this.header?.decoratorsArray ?? [];
3166
+ const decArr = [];
3167
+ for (const block of this.headerBlocks) {
3168
+ decArr.push(...block.decoratorsArray);
3169
+ }
3170
+ return decArr;
3171
+ }
3172
+ /**
3173
+ * Comment blocks that are NOT part of the header and NOT attached to a config item.
3174
+ * Any decorators in these blocks are misplaced.
3175
+ */
3176
+ get orphanCommentBlocks() {
3177
+ const headerBlockSet = new Set(this.headerBlocks);
3178
+ return this.contents.filter(
3179
+ (item) => item instanceof ParsedEnvSpecCommentBlock && !headerBlockSet.has(item)
3180
+ );
3083
3181
  }
3084
3182
  toString() {
3085
3183
  return this.contents.map((item) => item.toString()).join("\n");
@@ -3249,7 +3347,7 @@ function ensureHeader(file, newHeaderContents) {
3249
3347
  if (!file.header) {
3250
3348
  newHeaderContents ||= "This env file uses @env-spec - see https://varlock.dev/env-spec for more info\n";
3251
3349
  file.contents.unshift(
3252
- // header is a comment block at the beginning of the file and must end with a divider
3350
+ // header is any comment block(s) before the first config item; we add a divider for clarity
3253
3351
  new ParsedEnvSpecCommentBlock({
3254
3352
  // we'll break up the passed in content and add a comment line for each
3255
3353
  comments: newHeaderContents.split("\n").map((line) => new ParsedEnvSpecComment({ contents: line, leadingSpace: " " })),
@@ -3409,27 +3507,27 @@ var peg$SyntaxError = class extends SyntaxError {
3409
3507
  return str;
3410
3508
  }
3411
3509
  static buildMessage(expected, found) {
3412
- function hex(ch) {
3510
+ function hex2(ch) {
3413
3511
  return ch.codePointAt(0).toString(16).toUpperCase();
3414
3512
  }
3415
- __name(hex, "hex");
3416
- __name2(hex, "hex");
3513
+ __name(hex2, "hex");
3514
+ __name2(hex2, "hex");
3417
3515
  const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode") ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu") : null;
3418
3516
  function unicodeEscape(s) {
3419
3517
  if (nonPrintable) {
3420
- return s.replace(nonPrintable, (ch) => "\\u{" + hex(ch) + "}");
3518
+ return s.replace(nonPrintable, (ch) => "\\u{" + hex2(ch) + "}");
3421
3519
  }
3422
3520
  return s;
3423
3521
  }
3424
3522
  __name(unicodeEscape, "unicodeEscape");
3425
3523
  __name2(unicodeEscape, "unicodeEscape");
3426
3524
  function literalEscape(s) {
3427
- return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
3525
+ return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex2(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex2(ch)));
3428
3526
  }
3429
3527
  __name(literalEscape, "literalEscape");
3430
3528
  __name2(literalEscape, "literalEscape");
3431
3529
  function classEscape(s) {
3432
- return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
3530
+ return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex2(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex2(ch)));
3433
3531
  }
3434
3532
  __name(classEscape, "classEscape");
3435
3533
  __name2(classEscape, "classEscape");
@@ -8022,6 +8120,11 @@ function pathExistsSync(p) {
8022
8120
  }
8023
8121
  __name(pathExistsSync, "pathExistsSync");
8024
8122
 
8123
+ // ../../node_modules/.bun/ansis@4.2.0/node_modules/ansis/index.mjs
8124
+ var import_index = __toESM(require_ansis(), 1);
8125
+ var ansis_default = import_index.default;
8126
+ var { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_index.default;
8127
+
8025
8128
  // src/env-graph/lib/plugins.ts
8026
8129
  var import_semver = __toESM(require_semver2(), 1);
8027
8130
  function getUserVarlockDir() {
@@ -8129,8 +8232,26 @@ var DecoratorInstance = class {
8129
8232
  const decRegistry = this.isRootDecorator ? this.graph.rootDecoratorsRegistry : this.graph.itemDecoratorsRegistry;
8130
8233
  this.decoratorDef = decRegistry[this.name];
8131
8234
  if (!this.decoratorDef) {
8235
+ const otherRegistry = this.isRootDecorator ? this.graph.itemDecoratorsRegistry : this.graph.rootDecoratorsRegistry;
8236
+ if (otherRegistry[this.name]) {
8237
+ if (this.isRootDecorator) {
8238
+ throw new SchemaError(`@${this.name} is an item decorator and cannot be used in the file header - it must be attached to a config item`);
8239
+ } else {
8240
+ throw new SchemaError(`@${this.name} is a root decorator and cannot be attached to a config item - it must be in the file header (before the first config item)`);
8241
+ }
8242
+ }
8132
8243
  throw new Error(`Unknown decorator: @${this.name}`);
8133
8244
  }
8245
+ if (this.decoratorDef.isFunction && !this.isFunctionCall) {
8246
+ throw new SchemaError(
8247
+ `@${this.name} must be used as a function call - use @${this.name}(...) instead of @${this.name}=value`
8248
+ );
8249
+ }
8250
+ if (!this.decoratorDef.isFunction && this.isFunctionCall) {
8251
+ throw new SchemaError(
8252
+ `@${this.name} cannot be used as a function call - use @${this.name}=value instead of @${this.name}(...)`
8253
+ );
8254
+ }
8134
8255
  if (this.decoratorDef.useFnArgsResolver && this.parsedDecorator.value instanceof ParsedEnvSpecFunctionCall) {
8135
8256
  this._decValueResolver = convertParsedValueToResolvers(
8136
8257
  this.parsedDecorator.value.data.args,
@@ -8160,7 +8281,10 @@ var DecoratorInstance = class {
8160
8281
  async resolve() {
8161
8282
  if (this.isResolved) return this.resolvedValue;
8162
8283
  await this.process();
8163
- if (!this.decValueResolver) throw new Error("expected decorator to have a value resolver");
8284
+ if (!this.decValueResolver) {
8285
+ if (this._schemaErrors.length > 0) return;
8286
+ throw new Error("expected decorator to have a value resolver");
8287
+ }
8164
8288
  try {
8165
8289
  this.resolvedValue = await this.decValueResolver.resolve();
8166
8290
  } catch (err) {
@@ -8290,7 +8414,7 @@ var builtInRootDecorators = [
8290
8414
  if (!decVal.arrArgs || decVal.arrArgs.length === 0) {
8291
8415
  throw new Error("@import decorator must have at least one argument - the path to import");
8292
8416
  }
8293
- if (decVal.arrArgs.some((a) => !a.isStatic)) {
8417
+ if (decVal.arrArgs.some((a2) => !a2.isStatic)) {
8294
8418
  throw new Error("@import decorator cannot use any dynamic values - all args must be static");
8295
8419
  }
8296
8420
  }, "process")
@@ -8377,7 +8501,7 @@ var builtInRootDecorators = [
8377
8501
  dataSource._loadingError = err instanceof SchemaError ? err : new SchemaError(err);
8378
8502
  return;
8379
8503
  }
8380
- const { ConfigItem: ConfigItem2 } = await import('./config-item-K7KWEJD2.js');
8504
+ const { ConfigItem: ConfigItem2 } = await import('./config-item-NO5PKZRH.js');
8381
8505
  for (const [key, entry] of Object.entries(entries)) {
8382
8506
  const existsInSchema = key in graph.configSchema;
8383
8507
  if (!existsInSchema && !createMissing) {
@@ -8453,8 +8577,8 @@ function parseRepoSlug(s) {
8453
8577
  try {
8454
8578
  if (trimmed.includes("://") || trimmed.startsWith("git@")) {
8455
8579
  const url = new URL(trimmed.replace(/^git@([^:]+):/, "https://$1/"));
8456
- const path4 = url.pathname.replace(/^\/+/, "").replace(/\.git$/, "");
8457
- const parts = path4.split("/");
8580
+ const path5 = url.pathname.replace(/^\/+/, "").replace(/\.git$/, "");
8581
+ const parts = path5.split("/");
8458
8582
  if (parts.length >= 2) {
8459
8583
  slug = `${parts[0]}/${parts[1]}`;
8460
8584
  }
@@ -8556,9 +8680,9 @@ var PLATFORMS = [
8556
8680
  isPR: "CI_MERGE_REQUEST_ID",
8557
8681
  prNumber: "CI_MERGE_REQUEST_ID",
8558
8682
  repo: /* @__PURE__ */ __name((env) => {
8559
- const path4 = env.CI_PROJECT_PATH;
8560
- if (!path4) return void 0;
8561
- const parts = path4.split("/").filter(Boolean);
8683
+ const path5 = env.CI_PROJECT_PATH;
8684
+ if (!path5) return void 0;
8685
+ const parts = path5.split("/").filter(Boolean);
8562
8686
  if (parts.length >= 2) {
8563
8687
  return { owner: parts.slice(0, -1).join("/"), name: parts[parts.length - 1] };
8564
8688
  }
@@ -9183,11 +9307,17 @@ var Resolver = class {
9183
9307
  const resolvedValue = await this.def.resolve.call(this, this.meta);
9184
9308
  return resolvedValue;
9185
9309
  } catch (err) {
9186
- if (err instanceof VarlockError && !err.more?.location && this._parsedNode && this.dataSource) {
9187
- const location = getErrorLocation(this.dataSource, this._parsedNode);
9188
- if (location) {
9189
- err.more ??= {};
9190
- err.more.location = location;
9310
+ if (err instanceof VarlockError) {
9311
+ if (!this.def.name.startsWith("\0") && !err._resolverPrefixed) {
9312
+ err.message = `${this.def.name}(): ${err.message}`;
9313
+ err._resolverPrefixed = true;
9314
+ }
9315
+ if (!err.more?.location && this._parsedNode && this.dataSource) {
9316
+ const location = getErrorLocation(this.dataSource, this._parsedNode);
9317
+ if (location) {
9318
+ err.more ??= {};
9319
+ err.more.location = location;
9320
+ }
9191
9321
  }
9192
9322
  }
9193
9323
  throw err;
@@ -9405,23 +9535,56 @@ var RemapResolver = createResolver({
9405
9535
  name: "remap",
9406
9536
  icon: "codicon:replace",
9407
9537
  argsSchema: {
9408
- type: "mixed",
9409
- arrayExactLength: 1,
9410
- objKeyMinLength: 1
9538
+ // supports both old key=value syntax and new positional syntax
9539
+ // old: remap($VAR, result1=match1, result2=match2) -- arrArgs has 1 item, objArgs has the mappings
9540
+ // new: remap($VAR, match1, result1, match2, result2, default?) -- arrArgs has 3+ items
9541
+ type: "mixed"
9411
9542
  },
9412
9543
  process() {
9413
- return this.objArgs;
9544
+ const isLegacyKeyValMode = this.objArgs !== void 0 && Object.keys(this.objArgs).length > 0;
9545
+ if (isLegacyKeyValMode) {
9546
+ if ((this.arrArgs?.length ?? 0) !== 1) {
9547
+ throw new SchemaError("expects exactly 1 positional argument followed by key=value remapping pairs");
9548
+ }
9549
+ if (Object.keys(this.objArgs).length === 0) {
9550
+ throw new SchemaError("expects at least 1 key=value remapping pair");
9551
+ }
9552
+ this._schemaErrors.push(new SchemaError("key=value syntax is deprecated", {
9553
+ isWarning: true,
9554
+ tip: "Use positional pairs instead: remap($VAR, match1, result1, match2, result2, ...)"
9555
+ }));
9556
+ } else {
9557
+ if ((this.arrArgs?.length ?? 0) < 3) {
9558
+ throw new SchemaError("expects at least 3 arguments: (value, match1, result1, ...)");
9559
+ }
9560
+ }
9561
+ return { isLegacyKeyValMode };
9414
9562
  },
9415
- async resolve(remappings) {
9563
+ async resolve({ isLegacyKeyValMode }) {
9416
9564
  const originalValue = await this.arrArgs[0].resolve();
9417
- for (const [remappedVal, matchValResolver] of Object.entries(remappings)) {
9418
- const matchVal = await matchValResolver.resolve();
9565
+ if (isLegacyKeyValMode) {
9566
+ for (const [remappedVal, matchValResolver] of Object.entries(this.objArgs)) {
9567
+ const matchVal = await matchValResolver.resolve();
9568
+ if (matchVal instanceof RegExp && originalValue !== void 0) {
9569
+ if (matchVal.test(String(originalValue))) return remappedVal;
9570
+ } else {
9571
+ if (matchVal === originalValue) return remappedVal;
9572
+ }
9573
+ }
9574
+ return originalValue;
9575
+ }
9576
+ const remainingArgs = this.arrArgs.slice(1);
9577
+ for (let i = 0; i + 1 < remainingArgs.length; i += 2) {
9578
+ const matchVal = await remainingArgs[i].resolve();
9419
9579
  if (matchVal instanceof RegExp && originalValue !== void 0) {
9420
- if (matchVal.test(String(originalValue))) return remappedVal;
9580
+ if (matchVal.test(String(originalValue))) return remainingArgs[i + 1].resolve();
9421
9581
  } else {
9422
- if (matchVal === originalValue) return remappedVal;
9582
+ if (matchVal === originalValue) return remainingArgs[i + 1].resolve();
9423
9583
  }
9424
9584
  }
9585
+ if (remainingArgs.length % 2 === 1) {
9586
+ return remainingArgs[remainingArgs.length - 1].resolve();
9587
+ }
9425
9588
  return originalValue;
9426
9589
  }
9427
9590
  });
@@ -9490,6 +9653,27 @@ var IfResolver = createResolver({
9490
9653
  }
9491
9654
  }
9492
9655
  });
9656
+ var IfsResolver = createResolver({
9657
+ name: "ifs",
9658
+ icon: "material-symbols:rule",
9659
+ argsSchema: {
9660
+ type: "array",
9661
+ arrayMinLength: 1
9662
+ },
9663
+ async resolve() {
9664
+ const args = this.arrArgs;
9665
+ for (let i = 0; i + 1 < args.length; i += 2) {
9666
+ const condition = await args[i].resolve();
9667
+ if (condition) {
9668
+ return args[i + 1].resolve();
9669
+ }
9670
+ }
9671
+ if (args.length % 2 === 1) {
9672
+ return args[args.length - 1].resolve();
9673
+ }
9674
+ return void 0;
9675
+ }
9676
+ });
9493
9677
  var NotResolver = createResolver({
9494
9678
  name: "not",
9495
9679
  icon: "material-symbols:not-equal",
@@ -9537,6 +9721,7 @@ var BaseResolvers = [
9537
9721
  RefResolver,
9538
9722
  ExecResolver,
9539
9723
  RemapResolver,
9724
+ IfsResolver,
9540
9725
  ForEnvResolver,
9541
9726
  EqResolver,
9542
9727
  IfResolver,
@@ -9589,56 +9774,181 @@ function convertParsedValueToResolvers(value, dataSource, registeredResolvers) {
9589
9774
  }
9590
9775
  }
9591
9776
  __name(convertParsedValueToResolvers, "convertParsedValueToResolvers");
9777
+ var debug = createDebug("varlock:workspace-utils");
9778
+ var JS_PACKAGE_MANAGERS = Object.freeze({
9779
+ npm: {
9780
+ name: "npm",
9781
+ lockfiles: ["package-lock.json"],
9782
+ add: "npm install",
9783
+ // add also works
9784
+ exec: "npm exec --",
9785
+ dlx: "npx"
9786
+ },
9787
+ pnpm: {
9788
+ name: "pnpm",
9789
+ lockfiles: ["pnpm-lock.yaml"],
9790
+ add: "pnpm add",
9791
+ exec: "pnpm exec",
9792
+ dlx: "pnpm dlx"
9793
+ },
9794
+ yarn: {
9795
+ name: "yarn",
9796
+ lockfiles: ["yarn.lock"],
9797
+ add: "yarn add",
9798
+ exec: "yarn exec --",
9799
+ dlx: "yarn dlx"
9800
+ },
9801
+ bun: {
9802
+ name: "bun",
9803
+ lockfiles: ["bun.lock", "bun.lockb"],
9804
+ add: "bun add",
9805
+ exec: "bun run",
9806
+ dlx: "bunx"
9807
+ },
9808
+ deno: {
9809
+ //! deno not fully supported yet
9810
+ name: "deno",
9811
+ lockfiles: ["deno.lock"],
9812
+ add: "deno add",
9813
+ // TODO: don't think these are quite right...
9814
+ exec: "deno run",
9815
+ dlx: "deno run"
9816
+ }
9817
+ });
9818
+ function detectWorkspaceInfo(opts) {
9819
+ debug("Detecting workspace info");
9820
+ let cwd = opts?.cwd || process.cwd();
9821
+ let multipleLockfilesDetected;
9822
+ let foundRootPath;
9823
+ let foundPm;
9824
+ do {
9825
+ debug(`> scanning ${cwd}`);
9826
+ const scanDir = cwd;
9827
+ let detectedPm;
9828
+ let pm;
9829
+ for (pm in JS_PACKAGE_MANAGERS) {
9830
+ const foundLockfile = JS_PACKAGE_MANAGERS[pm].lockfiles.find(
9831
+ (lockfile) => pathExistsSync(path2.join(scanDir, lockfile))
9832
+ );
9833
+ if (foundLockfile) {
9834
+ if (detectedPm) {
9835
+ debug(`> found multiple lockfiles: ${foundLockfile} and ${JS_PACKAGE_MANAGERS[detectedPm].lockfiles[0]}`);
9836
+ multipleLockfilesDetected = [detectedPm, pm];
9837
+ break;
9838
+ }
9839
+ debug(`> found ${foundLockfile}`);
9840
+ detectedPm = pm;
9841
+ }
9842
+ }
9843
+ if (detectedPm && !multipleLockfilesDetected) {
9844
+ foundRootPath = scanDir;
9845
+ foundPm = detectedPm;
9846
+ break;
9847
+ }
9848
+ if (multipleLockfilesDetected) break;
9849
+ const parentDir = path2.dirname(cwd);
9850
+ if (parentDir === cwd) break;
9851
+ cwd = parentDir;
9852
+ if (pathExistsSync(path2.join(cwd, ".git"))) break;
9853
+ } while (cwd);
9854
+ if (!foundPm) {
9855
+ if (process.env.npm_config_user_agent) {
9856
+ const pmFromAgent = process.env.npm_config_user_agent.split("/")[0];
9857
+ if (Object.keys(JS_PACKAGE_MANAGERS).includes(pmFromAgent)) {
9858
+ debug(`> found ${pmFromAgent} using npm_config_user_agent`);
9859
+ foundPm = pmFromAgent;
9860
+ foundRootPath = opts?.cwd || process.cwd();
9861
+ }
9862
+ }
9863
+ if (!foundPm && multipleLockfilesDetected) {
9864
+ debug(`> using ${multipleLockfilesDetected[0]} from multiple detected lockfiles`);
9865
+ foundPm = multipleLockfilesDetected[0];
9866
+ foundRootPath = cwd;
9867
+ }
9868
+ }
9869
+ if (!foundPm || !foundRootPath) {
9870
+ return void 0;
9871
+ }
9872
+ const packageManager = JS_PACKAGE_MANAGERS[foundPm];
9873
+ let isMonorepo = false;
9874
+ let monorepoTool;
9875
+ const rootPackageJsonPath = path2.join(foundRootPath, "package.json");
9876
+ if (pathExistsSync(rootPackageJsonPath)) {
9877
+ try {
9878
+ const packageJson = JSON.parse(fs4.readFileSync(rootPackageJsonPath, "utf-8"));
9879
+ if (packageJson.workspaces) isMonorepo = true;
9880
+ } catch {
9881
+ }
9882
+ }
9883
+ if (!isMonorepo && pathExistsSync(path2.join(foundRootPath, "pnpm-workspace.yaml"))) {
9884
+ isMonorepo = true;
9885
+ }
9886
+ if (pathExistsSync(path2.join(foundRootPath, "turbo.json"))) {
9887
+ monorepoTool = "turborepo";
9888
+ } else if (pathExistsSync(path2.join(foundRootPath, "nx.json"))) {
9889
+ monorepoTool = "nx";
9890
+ } else if (pathExistsSync(path2.join(foundRootPath, "lerna.json"))) {
9891
+ monorepoTool = "lerna";
9892
+ }
9893
+ if (monorepoTool) isMonorepo = true;
9894
+ return {
9895
+ packageManager,
9896
+ rootPath: foundRootPath,
9897
+ isMonorepo,
9898
+ monorepoTool
9899
+ };
9900
+ }
9901
+ __name(detectWorkspaceInfo, "detectWorkspaceInfo");
9902
+ var workspaceInfoStorage = new AsyncLocalStorage();
9903
+ function runWithWorkspaceInfo(fn, explicitInfo) {
9904
+ let cached;
9905
+ let detected = false;
9906
+ const getter = /* @__PURE__ */ __name(() => {
9907
+ if (!detected) {
9908
+ cached = explicitInfo ?? detectWorkspaceInfo();
9909
+ detected = true;
9910
+ }
9911
+ return cached;
9912
+ }, "getter");
9913
+ return workspaceInfoStorage.run(getter, fn);
9914
+ }
9915
+ __name(runWithWorkspaceInfo, "runWithWorkspaceInfo");
9916
+ function getWorkspaceInfo() {
9917
+ return workspaceInfoStorage.getStore()?.() ?? detectWorkspaceInfo();
9918
+ }
9919
+ __name(getWorkspaceInfo, "getWorkspaceInfo");
9592
9920
 
9593
9921
  // src/env-graph/lib/plugins.ts
9594
9922
  var importedPluginModulePaths = /* @__PURE__ */ new Set();
9595
- function isSEABuild() {
9596
- try {
9597
- return false;
9598
- } catch {
9599
- return false;
9923
+ var _cryptoShimApplied = false;
9924
+ function applyBunCryptoShim() {
9925
+ if (_cryptoShimApplied) return;
9926
+ _cryptoShimApplied = true;
9927
+ const globalCrypto = globalThis.crypto;
9928
+ if (globalCrypto && !globalCrypto.webcrypto) {
9929
+ try {
9930
+ Object.defineProperty(globalCrypto, "webcrypto", {
9931
+ get() {
9932
+ return globalCrypto;
9933
+ },
9934
+ configurable: true,
9935
+ enumerable: false
9936
+ });
9937
+ } catch {
9938
+ }
9600
9939
  }
9601
9940
  }
9602
- __name(isSEABuild, "isSEABuild");
9603
- async function loadPluginModuleInSEA(filePath) {
9604
- const code = fs3.readFileSync(filePath, "utf-8");
9605
- const fileUrl = pathToFileURL(filePath).href;
9606
- const pluginDir = path.dirname(filePath);
9607
- const pluginRequire = createRequire(filePath);
9608
- let transformed = code.replace(
9609
- /^import\s+(\w+)\s*,\s*(\{[^}]+\})\s+from\s+['"]([^'"]+)['"]\s*;?/gm,
9610
- 'const $1 = __plugin_require__("$3"); const $2 = $1;'
9611
- ).replace(
9612
- /^import\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm,
9613
- 'const $1 = __plugin_require__("$2");'
9614
- ).replace(
9615
- /^import\s+(\{[^}]+\})\s+from\s+['"]([^'"]+)['"]\s*;?/gm,
9616
- 'const $1 = __plugin_require__("$2");'
9617
- ).replace(
9618
- /^import\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm,
9619
- 'const $1 = __plugin_require__("$2");'
9620
- ).replace(
9621
- /^import\s+['"]([^'"]+)['"]\s*;?/gm,
9622
- '__plugin_require__("$1");'
9623
- );
9624
- transformed = transformed.replace(/import\.meta/g, "__plugin_import_meta__");
9625
- const wrapped = `(async () => {
9626
- ${transformed}
9627
- })()`;
9628
- const context = vm.createContext(globalThis, {
9629
- codeGeneration: { strings: true, wasm: true }
9630
- });
9631
- context.__plugin_require__ = pluginRequire;
9632
- context.__plugin_import_meta__ = Object.freeze({
9633
- url: fileUrl,
9634
- dirname: pluginDir,
9635
- filename: filePath
9636
- });
9637
- const script = new vm.Script(wrapped, { filename: filePath });
9638
- const result = script.runInContext(context);
9639
- await result;
9941
+ __name(applyBunCryptoShim, "applyBunCryptoShim");
9942
+ function loadPluginModule(filePath) {
9943
+ applyBunCryptoShim();
9944
+ const code = fs4.readFileSync(filePath, "utf-8");
9945
+ const pluginDir = path2.dirname(filePath);
9946
+ const moduleObj = { exports: {} };
9947
+ const requireFn = createRequire(filePath);
9948
+ const moduleFn = new Function("exports", "require", "module", "__filename", "__dirname", code);
9949
+ moduleFn(moduleObj.exports, requireFn, moduleObj, filePath, pluginDir);
9640
9950
  }
9641
- __name(loadPluginModuleInSEA, "loadPluginModuleInSEA");
9951
+ __name(loadPluginModule, "loadPluginModule");
9642
9952
  var VarlockPlugin = class {
9643
9953
  static {
9644
9954
  __name(this, "VarlockPlugin");
@@ -9673,6 +9983,7 @@ var VarlockPlugin = class {
9673
9983
  this._icon = val;
9674
9984
  }
9675
9985
  loadingError;
9986
+ warnings = [];
9676
9987
  localPath;
9677
9988
  /** reference to the `@plugin()` decorator instance(s) that installed the plugin */
9678
9989
  installDecoratorInstances = [];
@@ -9714,22 +10025,70 @@ var VarlockPlugin = class {
9714
10025
  this.debug("registerResolverFunction", resolverDef.name);
9715
10026
  this.resolverFunctions.push(resolverDef);
9716
10027
  }
10028
+ /**
10029
+ * Declare standard env vars this plugin uses.
10030
+ * Set during plugin init — the loading infrastructure will automatically
10031
+ * check for these vars and generate warnings if they are detected but not wired up.
10032
+ *
10033
+ * `key` accepts a single env var name or an array of alternatives — the first match is used.
10034
+ * `dataType` is used to generate `# @type=...` schema lines for vars not in the schema.
10035
+ */
10036
+ standardVars;
10037
+ /** called by the loading infrastructure — checks declared standardVars against the graph */
10038
+ _checkStandardVars(graph) {
10039
+ if (!this.standardVars) return;
10040
+ const { initDecorator, params } = this.standardVars;
10041
+ const resolved = Object.entries(params).map(([paramName, { key, dataType }]) => {
10042
+ const keys = Array.isArray(key) ? key : [key];
10043
+ const matchedKey = keys.find((k) => graph.overrideValues[k]);
10044
+ return {
10045
+ paramName,
10046
+ matchedKey,
10047
+ resolvedKey: matchedKey || keys[0],
10048
+ dataType
10049
+ };
10050
+ });
10051
+ const detected = resolved.filter((v) => v.matchedKey);
10052
+ if (detected.length === 0) return;
10053
+ const detectedKeys = detected.map((v) => v.matchedKey);
10054
+ const needsSchemaSet = new Set(
10055
+ detected.filter((v) => !(v.resolvedKey in graph.configSchema)).map((v) => v.resolvedKey)
10056
+ );
10057
+ const wiringParams = detected.map((v) => ansis_default.green(`${v.paramName}=$${v.resolvedKey}`)).join(", ");
10058
+ const tip = [
10059
+ "",
10060
+ "Include in your schema and use in plugin initialization:",
10061
+ "",
10062
+ ` # ${initDecorator}(..., ${wiringParams})`,
10063
+ " # ---"
10064
+ ];
10065
+ for (const v of detected) {
10066
+ const inSchema = !needsSchemaSet.has(v.resolvedKey);
10067
+ if (v.dataType) {
10068
+ const typeLine = ` # @type=${v.dataType}`;
10069
+ tip.push(inSchema ? typeLine : ansis_default.green(typeLine));
10070
+ }
10071
+ const itemLine = ` ${v.resolvedKey}=`;
10072
+ tip.push(inSchema ? itemLine : ansis_default.green(itemLine));
10073
+ }
10074
+ tip.push("");
10075
+ this.warnings.push(new SchemaError(
10076
+ `${detectedKeys.join(", ")} found in environment but not connected to plugin`,
10077
+ { isWarning: true, tip }
10078
+ ));
10079
+ }
9717
10080
  get pluginFilePath() {
9718
10081
  if (this.type === "single-file") return this.localPath;
9719
10082
  const pluginExport = this._packageJson?.exports?.["./plugin"] || "";
9720
10083
  if (!pluginExport) throw new Error("Plugin package.json is missing ./plugin export");
9721
- return path.join(this.localPath, pluginExport);
10084
+ return path2.join(this.localPath, pluginExport);
9722
10085
  }
9723
10086
  async executePluginModule() {
9724
10087
  globalThis.plugin = this;
9725
10088
  try {
9726
10089
  if (!await pathExists(this.pluginFilePath)) throw new Error(`Plugin file not found: ${this.pluginFilePath}`);
9727
10090
  importedPluginModulePaths.add(this.pluginFilePath);
9728
- if (isSEABuild()) {
9729
- await loadPluginModuleInSEA(this.pluginFilePath);
9730
- } else {
9731
- await import(this.pluginFilePath);
9732
- }
10091
+ loadPluginModule(this.pluginFilePath);
9733
10092
  } catch (err) {
9734
10093
  this.loadingError = err;
9735
10094
  }
@@ -9737,9 +10096,9 @@ var VarlockPlugin = class {
9737
10096
  }
9738
10097
  };
9739
10098
  async function initPluginFromLocalPath(localPath) {
9740
- const stats = await fs.stat(localPath);
10099
+ const stats = await fs2.stat(localPath);
9741
10100
  if (stats.isFile()) {
9742
- const ext = path.extname(localPath).toLowerCase();
10101
+ const ext = path2.extname(localPath).toLowerCase();
9743
10102
  if ([".js", ".cjs", ".mjs"].includes(ext) === false) {
9744
10103
  throw new SchemaError(`Single-file plugin must be a .js, .cjs, or .mjs file: ${localPath}`);
9745
10104
  }
@@ -9748,11 +10107,11 @@ async function initPluginFromLocalPath(localPath) {
9748
10107
  localPath
9749
10108
  });
9750
10109
  } else if (stats.isDirectory()) {
9751
- const pkgJsonPath = path.join(localPath, "package.json");
10110
+ const pkgJsonPath = path2.join(localPath, "package.json");
9752
10111
  if (!await pathExists(pkgJsonPath)) {
9753
10112
  throw new SchemaError("Plugin is missing package.json file");
9754
10113
  }
9755
- const packageJsonContents = JSON.parse(await fs.readFile(pkgJsonPath, "utf-8"));
10114
+ const packageJsonContents = JSON.parse(await fs2.readFile(pkgJsonPath, "utf-8"));
9756
10115
  if (!packageJsonContents.exports?.["./plugin"]) {
9757
10116
  throw new SchemaError('Plugin is missing "./plugin" export in package.json');
9758
10117
  }
@@ -9815,24 +10174,24 @@ async function registerPluginInGraph(graph, plugin, pluginDecorator) {
9815
10174
  __name(registerPluginInGraph, "registerPluginInGraph");
9816
10175
  async function downloadPlugin(url) {
9817
10176
  const exec2 = promisify(exec);
9818
- const cacheDir = path.join(getUserVarlockDir(), "plugins-cache");
9819
- const indexPath = path.join(cacheDir, "index.json");
9820
- await fs.mkdir(cacheDir, { recursive: true });
10177
+ const cacheDir = path2.join(getUserVarlockDir(), "plugins-cache");
10178
+ const indexPath = path2.join(cacheDir, "index.json");
10179
+ await fs2.mkdir(cacheDir, { recursive: true });
9821
10180
  let index = {};
9822
10181
  try {
9823
- const indexRaw = await fs.readFile(indexPath, "utf-8");
10182
+ const indexRaw = await fs2.readFile(indexPath, "utf-8");
9824
10183
  index = JSON.parse(indexRaw);
9825
10184
  } catch {
9826
10185
  }
9827
10186
  if (index[url]) {
9828
- const pluginDir = path.join(cacheDir, index[url]);
9829
- if (await fs.stat(pluginDir).then(() => true, () => false)) {
10187
+ const pluginDir = path2.join(cacheDir, index[url]);
10188
+ if (await fs2.stat(pluginDir).then(() => true, () => false)) {
9830
10189
  return pluginDir;
9831
10190
  }
9832
10191
  }
9833
- const tmpTgz = path.join(cacheDir, `tmp-${crypto.randomBytes(8).toString("hex")}.tgz`);
10192
+ const tmpTgz = path2.join(cacheDir, `tmp-${crypto.randomBytes(8).toString("hex")}.tgz`);
9834
10193
  await new Promise((resolve, reject) => {
9835
- const file = fs3.createWriteStream(tmpTgz);
10194
+ const file = fs4.createWriteStream(tmpTgz);
9836
10195
  https.get(url, (res) => {
9837
10196
  if (res.statusCode !== 200) {
9838
10197
  reject(new Error(`Failed to download plugin: ${res.statusCode}`));
@@ -9843,28 +10202,28 @@ async function downloadPlugin(url) {
9843
10202
  file.on("error", reject);
9844
10203
  }).on("error", reject);
9845
10204
  });
9846
- const tmpExtractDir = path.join(cacheDir, `tmp-extract-${crypto.randomBytes(8).toString("hex")}`);
9847
- await fs.mkdir(tmpExtractDir);
10205
+ const tmpExtractDir = path2.join(cacheDir, `tmp-extract-${crypto.randomBytes(8).toString("hex")}`);
10206
+ await fs2.mkdir(tmpExtractDir);
9848
10207
  await exec2(`tar -xzf ${tmpTgz} -C ${tmpExtractDir}`);
9849
- let pkgJsonPath = path.join(tmpExtractDir, "package", "package.json");
9850
- let pluginRoot = path.join(tmpExtractDir, "package");
9851
- if (!await fs.stat(pkgJsonPath).then(() => true, () => false)) {
9852
- pkgJsonPath = path.join(tmpExtractDir, "package.json");
10208
+ let pkgJsonPath = path2.join(tmpExtractDir, "package", "package.json");
10209
+ let pluginRoot = path2.join(tmpExtractDir, "package");
10210
+ if (!await fs2.stat(pkgJsonPath).then(() => true, () => false)) {
10211
+ pkgJsonPath = path2.join(tmpExtractDir, "package.json");
9853
10212
  pluginRoot = tmpExtractDir;
9854
- if (!await fs.stat(pkgJsonPath).then(() => true, () => false)) {
10213
+ if (!await fs2.stat(pkgJsonPath).then(() => true, () => false)) {
9855
10214
  throw new Error("package.json not found in plugin tgz");
9856
10215
  }
9857
10216
  }
9858
- const pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, "utf-8"));
10217
+ const pkgJson = JSON.parse(await fs2.readFile(pkgJsonPath, "utf-8"));
9859
10218
  const safePackageName = (pkgJson.name || "").replaceAll("/", "-").replaceAll("@", "");
9860
10219
  const dirName = `${safePackageName}_${pkgJson.version || ""}_${crypto.randomBytes(4).toString("hex")}`;
9861
- const finalDir = path.join(cacheDir, dirName);
9862
- await fs.rm(finalDir, { recursive: true, force: true });
9863
- await fs.rename(pluginRoot, finalDir);
9864
- await fs.rm(tmpTgz, { force: true });
9865
- await fs.rm(tmpExtractDir, { recursive: true, force: true });
10220
+ const finalDir = path2.join(cacheDir, dirName);
10221
+ await fs2.rm(finalDir, { recursive: true, force: true });
10222
+ await fs2.rename(pluginRoot, finalDir);
10223
+ await fs2.rm(tmpTgz, { force: true });
10224
+ await fs2.rm(tmpExtractDir, { recursive: true, force: true });
9866
10225
  index[url] = dirName;
9867
- await fs.writeFile(indexPath, JSON.stringify(index, null, 2));
10226
+ await fs2.writeFile(indexPath, JSON.stringify(index, null, 2));
9868
10227
  return finalDir;
9869
10228
  }
9870
10229
  __name(downloadPlugin, "downloadPlugin");
@@ -9877,7 +10236,7 @@ async function processPluginInstallDecorators(dataSource) {
9877
10236
  dataSource._loadingError = new Error("@plugin can only be used from a file-based data source");
9878
10237
  return;
9879
10238
  }
9880
- const dataSourceDir = path.dirname(dataSource.fullPath);
10239
+ const dataSourceDir = path2.dirname(dataSource.fullPath);
9881
10240
  for (const pluginDecorator of installPluginDecorators) {
9882
10241
  let pluginSrcPath;
9883
10242
  try {
@@ -9887,7 +10246,7 @@ async function processPluginInstallDecorators(dataSource) {
9887
10246
  throw new SchemaError("Bad @plugin - must provide a string source location");
9888
10247
  }
9889
10248
  if (pluginSourceDescriptor.startsWith("./") || pluginSourceDescriptor.startsWith("../") || pluginSourceDescriptor.startsWith("/")) {
9890
- pluginSrcPath = pluginSourceDescriptor.startsWith("/") ? pluginSourceDescriptor : path.resolve(dataSourceDir, pluginSourceDescriptor);
10249
+ pluginSrcPath = pluginSourceDescriptor.startsWith("/") ? pluginSourceDescriptor : path2.resolve(dataSourceDir, pluginSourceDescriptor);
9891
10250
  if (!await pathExists(pluginSrcPath)) {
9892
10251
  throw new SchemaError(`Bad @plugin path: ${pluginSourceDescriptor}`);
9893
10252
  }
@@ -9919,22 +10278,17 @@ async function processPluginInstallDecorators(dataSource) {
9919
10278
  } else if (versionDescriptor === "") {
9920
10279
  throw new SchemaError('Bad @plugin version descriptor - remove "@" or specify a valid version');
9921
10280
  }
10281
+ const workspaceRootPath = getWorkspaceInfo()?.rootPath;
9922
10282
  let currentDir = dataSourceDir;
9923
10283
  let nodeModulesPath;
9924
10284
  while (currentDir) {
9925
- if (await pathExists(path.join(currentDir, "package.json"))) {
9926
- nodeModulesPath = path.join(currentDir, "node_modules");
9927
- break;
10285
+ if (!nodeModulesPath && await pathExists(path2.join(currentDir, "package.json"))) {
10286
+ nodeModulesPath = path2.join(currentDir, "node_modules");
9928
10287
  }
9929
- const parentDir = path.dirname(currentDir);
9930
- if (parentDir === currentDir) break;
9931
- currentDir = parentDir;
9932
- }
9933
- if (nodeModulesPath) {
9934
- const pluginPackagePath = path.join(nodeModulesPath, moduleName);
9935
- if (await pathExists(pluginPackagePath)) {
9936
- const pluginPackageJsonPath = path.join(pluginPackagePath, "package.json");
9937
- const packageJsonString = await fs.readFile(pluginPackageJsonPath, "utf-8");
10288
+ const candidatePluginPath = path2.join(currentDir, "node_modules", moduleName);
10289
+ if (await pathExists(candidatePluginPath)) {
10290
+ const pluginPackageJsonPath = path2.join(candidatePluginPath, "package.json");
10291
+ const packageJsonString = await fs2.readFile(pluginPackageJsonPath, "utf-8");
9938
10292
  const packageJson = JSON.parse(packageJsonString);
9939
10293
  const packageVersion = packageJson.version;
9940
10294
  if (versionDescriptor && !import_semver.default.satisfies(packageVersion, versionDescriptor)) {
@@ -9942,8 +10296,13 @@ async function processPluginInstallDecorators(dataSource) {
9942
10296
  location: getErrorLocation(dataSource, pluginDecorator)
9943
10297
  });
9944
10298
  }
9945
- pluginSrcPath = pluginPackagePath;
10299
+ pluginSrcPath = candidatePluginPath;
10300
+ break;
9946
10301
  }
10302
+ if (workspaceRootPath && currentDir === workspaceRootPath) break;
10303
+ const parentDir = path2.dirname(currentDir);
10304
+ if (parentDir === currentDir) break;
10305
+ currentDir = parentDir;
9947
10306
  }
9948
10307
  if (!pluginSrcPath) {
9949
10308
  if (!versionDescriptor) {
@@ -10060,6 +10419,7 @@ var EnvGraphDataSource2 = class {
10060
10419
  */
10061
10420
  get isEnvSpecific() {
10062
10421
  if (this.applyForEnv && !this.isImport) return true;
10422
+ if (this.type === "overrides") return true;
10063
10423
  if (this._hasConditionalDisable) return true;
10064
10424
  if (this.importMeta?.isConditionallyEnabled) return true;
10065
10425
  if (this.parent?.isEnvSpecific) return true;
@@ -10204,9 +10564,9 @@ var EnvGraphDataSource2 = class {
10204
10564
  if (!(this instanceof FileBasedDataSource)) {
10205
10565
  throw new Error("@import of files can only be used from a file-based data source");
10206
10566
  }
10207
- fullImportPath = path.resolve(this.fullPath, "..", importPath);
10567
+ fullImportPath = path2.resolve(this.fullPath, "..", importPath);
10208
10568
  } else if (importPath.startsWith("~/") || importPath === "~") {
10209
- fullImportPath = path.join(os.homedir(), importPath.slice(1));
10569
+ fullImportPath = path2.join(os.homedir(), importPath.slice(1));
10210
10570
  } else if (importPath.startsWith("/")) {
10211
10571
  fullImportPath = importPath;
10212
10572
  }
@@ -10222,7 +10582,7 @@ var EnvGraphDataSource2 = class {
10222
10582
  throw new Error("expected @import allowMissing parameter to be a boolean");
10223
10583
  }
10224
10584
  if (fullImportPath) {
10225
- const fileName = path.basename(fullImportPath);
10585
+ const fileName = path2.basename(fullImportPath);
10226
10586
  if (this.graph.virtualImports) {
10227
10587
  if (importPath.endsWith("/")) {
10228
10588
  const dirExists = Object.keys(this.graph.virtualImports).some((p) => p.startsWith(fullImportPath));
@@ -10249,7 +10609,7 @@ var EnvGraphDataSource2 = class {
10249
10609
  await this.addChild(source, { isImport: true, importKeys, isConditionallyEnabled });
10250
10610
  }
10251
10611
  } else {
10252
- const fsStat = await tryCatch(async () => fs.stat(fullImportPath), (_err) => {
10612
+ const fsStat = await tryCatch(async () => fs2.stat(fullImportPath), (_err) => {
10253
10613
  });
10254
10614
  if (!fsStat && allowMissing) continue;
10255
10615
  if (!fsStat) {
@@ -10384,8 +10744,8 @@ var FileBasedDataSource = class extends EnvGraphDataSource2 {
10384
10744
  constructor(fullPath, opts) {
10385
10745
  super();
10386
10746
  this.fullPath = fullPath;
10387
- this.fileName = path.basename(fullPath);
10388
- this.relativePath = path.relative(process.cwd(), fullPath);
10747
+ this.fileName = path2.basename(fullPath);
10748
+ this.relativePath = path2.relative(process.cwd(), fullPath);
10389
10749
  if (opts?.overrideContents) {
10390
10750
  this.rawContents = opts.overrideContents;
10391
10751
  }
@@ -10418,7 +10778,7 @@ var FileBasedDataSource = class extends EnvGraphDataSource2 {
10418
10778
  this._loadingError = new Error(`File does not exist: ${this.fullPath}`);
10419
10779
  return;
10420
10780
  }
10421
- this.rawContents = await fs.readFile(this.fullPath, "utf8");
10781
+ this.rawContents = await fs2.readFile(this.fullPath, "utf8");
10422
10782
  }
10423
10783
  if (this.rawContents) await this._parseContents();
10424
10784
  }
@@ -10451,6 +10811,7 @@ var DotEnvFileDataSource = class extends FileBasedDataSource {
10451
10811
  if (!this.parsedFile) throw new Error("Failed to parse .env file");
10452
10812
  if (!this.graph) throw new Error("expected graph to be set");
10453
10813
  this.rootDecorators = this.parsedFile.decoratorsArray.map((d) => new RootDecoratorInstance(this, d));
10814
+ this._validateDecoratorPlacement(this.parsedFile);
10454
10815
  for (const item of this.parsedFile.configItems) {
10455
10816
  this.configItemDefs[item.key] = {
10456
10817
  description: item.description,
@@ -10459,6 +10820,47 @@ var DotEnvFileDataSource = class extends FileBasedDataSource {
10459
10820
  };
10460
10821
  }
10461
10822
  }
10823
+ _validateDecoratorPlacement(parsedFile) {
10824
+ const seenRootDecs = /* @__PURE__ */ new Set();
10825
+ for (const dec of parsedFile.decoratorsArray) {
10826
+ if (dec.name in this.graph.itemDecoratorsRegistry) {
10827
+ this._schemaErrors.push(new SchemaError(
10828
+ `Item decorator @${dec.name} cannot be used in the file header - it must be attached to a config item`,
10829
+ { location: this._locationFromParsed(dec) }
10830
+ ));
10831
+ } else if (!dec.isBareFnCall) {
10832
+ if (seenRootDecs.has(dec.name)) {
10833
+ this._schemaErrors.push(new SchemaError(
10834
+ `Root decorator @${dec.name} cannot be used more than once in the same file`,
10835
+ { location: this._locationFromParsed(dec) }
10836
+ ));
10837
+ }
10838
+ seenRootDecs.add(dec.name);
10839
+ }
10840
+ }
10841
+ for (const block of parsedFile.orphanCommentBlocks) {
10842
+ for (const comment of block.comments) {
10843
+ if (comment instanceof ParsedEnvSpecDecoratorComment) {
10844
+ for (const dec of comment.decorators) {
10845
+ this._schemaErrors.push(new SchemaError(
10846
+ `Decorator @${dec.name} is in a detached comment block - decorators must be in the file header or attached directly to a config item (no blank lines between the decorator and the item)`,
10847
+ { location: this._locationFromParsed(dec) }
10848
+ ));
10849
+ }
10850
+ }
10851
+ }
10852
+ }
10853
+ }
10854
+ _locationFromParsed(dec) {
10855
+ const loc = dec.data._location;
10856
+ if (!loc || !this.rawContents) return void 0;
10857
+ return {
10858
+ id: this.fullPath,
10859
+ lineNumber: loc.start.line,
10860
+ colNumber: loc.start.column,
10861
+ lineStr: this.rawContents.split("\n")[loc.start.line - 1] || ""
10862
+ };
10863
+ }
10462
10864
  };
10463
10865
  var DirectoryDataSource = class extends EnvGraphDataSource2 {
10464
10866
  constructor(basePath) {
@@ -10476,7 +10878,7 @@ var DirectoryDataSource = class extends EnvGraphDataSource2 {
10476
10878
  schemaDataSource;
10477
10879
  async addAutoLoadedFile(fileName) {
10478
10880
  if (!this.graph) throw new Error("expected graph to be set");
10479
- const filePath = path.join(this.basePath, fileName);
10881
+ const filePath = path2.join(this.basePath, fileName);
10480
10882
  if (this.graph.virtualImports) {
10481
10883
  if (this.graph.virtualImports[filePath]) {
10482
10884
  const source2 = new DotEnvFileDataSource(filePath, { overrideContents: this.graph.virtualImports[filePath] });
@@ -10580,15 +10982,15 @@ var iconCacheFolderInit = false;
10580
10982
  var iconInMemoryCache = {};
10581
10983
  async function fetchIconSvg(iconifyName, color = "808080", iconCacheFolder = "/tmp/varlock-icon-cache") {
10582
10984
  if (!iconCacheFolderInit) {
10583
- fs3.mkdirSync(iconCacheFolder, { recursive: true });
10985
+ fs4.mkdirSync(iconCacheFolder, { recursive: true });
10584
10986
  iconCacheFolderInit = true;
10585
10987
  }
10586
10988
  const iconPath = `${iconCacheFolder}/${iconifyName}-${ICON_SIZE}.svg`;
10587
10989
  let svgSrc;
10588
10990
  if (iconInMemoryCache[iconPath]) {
10589
10991
  svgSrc = iconInMemoryCache[iconPath];
10590
- } else if (fs3.existsSync(iconPath)) {
10591
- const svgFileBuffer = await fs3.promises.readFile(iconPath, "utf-8");
10992
+ } else if (fs4.existsSync(iconPath)) {
10993
+ const svgFileBuffer = await fs4.promises.readFile(iconPath, "utf-8");
10592
10994
  svgSrc = svgFileBuffer.toString();
10593
10995
  iconInMemoryCache[iconPath] = svgSrc;
10594
10996
  } else {
@@ -10600,7 +11002,7 @@ async function fetchIconSvg(iconifyName, color = "808080", iconCacheFolder = "/t
10600
11002
  }
10601
11003
  if (!svgSrc) return;
10602
11004
  if (svgSrc) {
10603
- await fs3.promises.writeFile(iconPath, svgSrc, "utf-8");
11005
+ await fs4.promises.writeFile(iconPath, svgSrc, "utf-8");
10604
11006
  iconInMemoryCache[iconPath] = svgSrc;
10605
11007
  }
10606
11008
  }
@@ -10722,7 +11124,7 @@ async function generateTypes(graph, lang, typesPath) {
10722
11124
  items.push(await configItem.getTypeGenInfo());
10723
11125
  }
10724
11126
  const tsSrc = await generateTsTypesSrc(items);
10725
- await fs3.promises.writeFile(typesPath, tsSrc, "utf-8");
11127
+ await fs4.promises.writeFile(typesPath, tsSrc, "utf-8");
10726
11128
  }
10727
11129
  __name(generateTypes, "generateTypes");
10728
11130
 
@@ -10751,7 +11153,7 @@ var EnvGraph2 = class {
10751
11153
  setVirtualImports(basePath, files) {
10752
11154
  this.virtualImports = {};
10753
11155
  for (const [fileName, fileContents] of Object.entries(files)) {
10754
- this.virtualImports[path.join(basePath, fileName)] = fileContents;
11156
+ this.virtualImports[path2.join(basePath, fileName)] = fileContents;
10755
11157
  }
10756
11158
  }
10757
11159
  get sortedDataSources() {
@@ -10872,6 +11274,9 @@ var EnvGraph2 = class {
10872
11274
  for (const plugin of this.plugins) {
10873
11275
  if (plugin.loadingError) return;
10874
11276
  }
11277
+ for (const plugin of this.plugins) {
11278
+ plugin._checkStandardVars(this);
11279
+ }
10875
11280
  for (const key in this.configSchema) {
10876
11281
  if (isBuiltinVar(key)) this.registerBuiltinVar(key);
10877
11282
  }
@@ -10880,7 +11285,7 @@ var EnvGraph2 = class {
10880
11285
  if (source.disabled) continue;
10881
11286
  for (const decInstance of source.rootDecorators) {
10882
11287
  await decInstance.process();
10883
- if (decInstance.schemaErrors.length) processingError = true;
11288
+ if (decInstance.schemaErrors.some((e) => !e.isWarning)) processingError = true;
10884
11289
  }
10885
11290
  }
10886
11291
  for (const itemKey in this.configSchema) {
@@ -10954,7 +11359,7 @@ var EnvGraph2 = class {
10954
11359
  const resolveItem = /* @__PURE__ */ __name(async (itemKey) => {
10955
11360
  if (itemsToResolveStatus[itemKey] !== false) return;
10956
11361
  const item = this.configSchema[itemKey];
10957
- if (item.errors.length) {
11362
+ if (item.errors.some((e) => !e.isWarning)) {
10958
11363
  markItemCompleted(itemKey);
10959
11364
  return;
10960
11365
  }
@@ -11011,7 +11416,7 @@ var EnvGraph2 = class {
11011
11416
  serializedGraph.sources.push({
11012
11417
  label: source.label,
11013
11418
  enabled: !source.disabled,
11014
- path: source instanceof FileBasedDataSource ? path.relative(this.basePath ?? "", source.fullPath) : void 0
11419
+ path: source instanceof FileBasedDataSource ? path2.relative(this.basePath ?? "", source.fullPath) : void 0
11015
11420
  });
11016
11421
  }
11017
11422
  for (const itemKey of this.sortedConfigKeys) {
@@ -11052,7 +11457,7 @@ var EnvGraph2 = class {
11052
11457
  if (typeGenSettings.obj.lang !== "ts") throw new Error(`@generateTypes - unsupported language: ${typeGenSettings.obj.lang}`);
11053
11458
  if (!typeGenSettings.obj.path) throw new Error("@generateTypes - must set `path` arg");
11054
11459
  if (!my_dash_default.isString(typeGenSettings.obj.path)) throw new Error("@generateTypes - `path` arg must be a string");
11055
- const outputPath = generateTypesDec.dataSource instanceof FileBasedDataSource ? path.resolve(generateTypesDec.dataSource.fullPath, "..", typeGenSettings.obj.path) : typeGenSettings.obj.path;
11460
+ const outputPath = generateTypesDec.dataSource instanceof FileBasedDataSource ? path2.resolve(generateTypesDec.dataSource.fullPath, "..", typeGenSettings.obj.path) : typeGenSettings.obj.path;
11056
11461
  await this.generateTypes(typeGenSettings.obj.lang, outputPath);
11057
11462
  generatedCount++;
11058
11463
  }
@@ -11424,10 +11829,10 @@ var ConfigItem = class {
11424
11829
  get isCoerced() {
11425
11830
  return this.resolvedRawValue !== this.resolvedValue;
11426
11831
  }
11427
- async resolve(reset = false) {
11428
- if (this._schemaErrors.length) return;
11429
- if (this.resolverSchemaErrors.length) return;
11430
- if (reset) {
11832
+ async resolve(reset2 = false) {
11833
+ if (this._schemaErrors.some((e) => !e.isWarning)) return;
11834
+ if (this.resolverSchemaErrors.some((e) => !e.isWarning)) return;
11835
+ if (reset2) {
11431
11836
  this.isResolved = false;
11432
11837
  this.isValidated = false;
11433
11838
  this.resolutionError = void 0;
@@ -11676,6 +12081,6 @@ var ConfigItem = class {
11676
12081
  };
11677
12082
  //! these are probably not relevant anymore, or needs to move to a plugin layer?
11678
12083
 
11679
- export { CoercionError, ConfigItem, ConfigLoadError, DirectoryDataSource, DotEnvFileDataSource, EnvGraph2 as EnvGraph, ParsedEnvSpecStaticValue, ResolutionError, SchemaError, ValidationError, VarlockError, envSpecUpdater, getUserVarlockDir, my_dash_default, parseEnvSpecDotEnvFile, pathExists, pathExistsSync, require_semver2 as require_semver, tryCatch };
11680
- //# sourceMappingURL=chunk-PCRIVT4T.js.map
11681
- //# sourceMappingURL=chunk-PCRIVT4T.js.map
12084
+ export { CoercionError, ConfigItem, ConfigLoadError, DirectoryDataSource, DotEnvFileDataSource, EnvGraph2 as EnvGraph, ParsedEnvSpecStaticValue, ResolutionError, SchemaError, ValidationError, VarlockError, ansis_default, detectWorkspaceInfo, envSpecUpdater, getUserVarlockDir, my_dash_default, parseEnvSpecDotEnvFile, pathExists, require_semver2 as require_semver, runWithWorkspaceInfo, tryCatch };
12085
+ //# sourceMappingURL=chunk-2AGKN64R.js.map
12086
+ //# sourceMappingURL=chunk-2AGKN64R.js.map