varlock 0.6.4 → 0.7.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 (72) hide show
  1. package/dist/chunk-6CCHLM3U.js +1051 -0
  2. package/dist/chunk-6CCHLM3U.js.map +1 -0
  3. package/dist/{chunk-PGDFZB7I.js → chunk-B3FGXIYM.js} +6 -6
  4. package/dist/{chunk-PGDFZB7I.js.map → chunk-B3FGXIYM.js.map} +1 -1
  5. package/dist/{chunk-VV7IRAYL.js → chunk-BXU4SN4C.js} +5 -5
  6. package/dist/{chunk-VV7IRAYL.js.map → chunk-BXU4SN4C.js.map} +1 -1
  7. package/dist/{chunk-MXPBXRWY.js → chunk-CU6IMJWG.js} +163 -977
  8. package/dist/chunk-CU6IMJWG.js.map +1 -0
  9. package/dist/{chunk-343AECT3.js → chunk-DIHMO4NV.js} +4 -4
  10. package/dist/{chunk-343AECT3.js.map → chunk-DIHMO4NV.js.map} +1 -1
  11. package/dist/{chunk-Y3ITSQA4.js → chunk-GGBNUVWR.js} +8 -3
  12. package/dist/chunk-GGBNUVWR.js.map +1 -0
  13. package/dist/{chunk-J3H553VE.js → chunk-GMRNV7YA.js} +5 -5
  14. package/dist/{chunk-J3H553VE.js.map → chunk-GMRNV7YA.js.map} +1 -1
  15. package/dist/{chunk-ETMUQ3YH.js → chunk-IVCAFVHJ.js} +4 -3
  16. package/dist/chunk-IVCAFVHJ.js.map +1 -0
  17. package/dist/{chunk-6KLPP3K7.js → chunk-LNWUVR6Y.js} +5 -5
  18. package/dist/{chunk-6KLPP3K7.js.map → chunk-LNWUVR6Y.js.map} +1 -1
  19. package/dist/{chunk-QCECXSMG.js → chunk-NBA3OXMK.js} +5 -5
  20. package/dist/{chunk-QCECXSMG.js.map → chunk-NBA3OXMK.js.map} +1 -1
  21. package/dist/{chunk-COH4YYZ3.js → chunk-OER3RWXM.js} +19 -18
  22. package/dist/chunk-OER3RWXM.js.map +1 -0
  23. package/dist/{chunk-X4Y5PWYI.js → chunk-OILFXJ3P.js} +5 -5
  24. package/dist/{chunk-X4Y5PWYI.js.map → chunk-OILFXJ3P.js.map} +1 -1
  25. package/dist/{chunk-BLY5NBV7.js → chunk-QUZ6CTCN.js} +3 -3
  26. package/dist/{chunk-BLY5NBV7.js.map → chunk-QUZ6CTCN.js.map} +1 -1
  27. package/dist/{chunk-7B55HOP6.js → chunk-YO2BMQWY.js} +5 -5
  28. package/dist/{chunk-7B55HOP6.js.map → chunk-YO2BMQWY.js.map} +1 -1
  29. package/dist/{chunk-AWPEMNMA.js → chunk-ZLEBXP2N.js} +8 -7
  30. package/dist/chunk-ZLEBXP2N.js.map +1 -0
  31. package/dist/cli/cli-executable.js +23 -23
  32. package/dist/cli/cli-executable.js.map +1 -1
  33. package/dist/config-item-L25YE5DP.js +5 -0
  34. package/dist/{config-item-QQUA44LP.js.map → config-item-L25YE5DP.js.map} +1 -1
  35. package/dist/{env-graph-Cz_c5P6Y.d.ts → env-graph-Bat7yIkB.d.ts} +11 -2
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +7 -6
  38. package/dist/index.js.map +1 -1
  39. package/dist/init.command-F4CPELAW.js +11 -0
  40. package/dist/{init.command-IS5TWLU4.js.map → init.command-F4CPELAW.js.map} +1 -1
  41. package/dist/load.command-GUYNXNTO.js +11 -0
  42. package/dist/{load.command-OXPEKYKF.js.map → load.command-GUYNXNTO.js.map} +1 -1
  43. package/dist/plugin-lib.d.ts +14 -5
  44. package/dist/plugin-lib.js +7 -1
  45. package/dist/plugin-lib.js.map +1 -1
  46. package/dist/printenv.command-75MAGJZM.js +11 -0
  47. package/dist/{printenv.command-DBEAAYGI.js.map → printenv.command-75MAGJZM.js.map} +1 -1
  48. package/dist/run.command-QRQ5IIXL.js +12 -0
  49. package/dist/{run.command-INBQRQIZ.js.map → run.command-QRQ5IIXL.js.map} +1 -1
  50. package/dist/runtime/env.d.ts +1 -1
  51. package/dist/scan.command-SMJLZV4G.js +12 -0
  52. package/dist/{scan.command-AE6OUPX2.js.map → scan.command-SMJLZV4G.js.map} +1 -1
  53. package/dist/telemetry.command-XPKAL5MV.js +10 -0
  54. package/dist/{telemetry.command-EYJSX3J7.js.map → telemetry.command-XPKAL5MV.js.map} +1 -1
  55. package/dist/typegen.command-ZWYOYJC4.js +11 -0
  56. package/dist/{typegen.command-H7PTAPGH.js.map → typegen.command-ZWYOYJC4.js.map} +1 -1
  57. package/package.json +6 -1
  58. package/dist/chunk-AWPEMNMA.js.map +0 -1
  59. package/dist/chunk-COH4YYZ3.js.map +0 -1
  60. package/dist/chunk-ETMUQ3YH.js.map +0 -1
  61. package/dist/chunk-MXPBXRWY.js.map +0 -1
  62. package/dist/chunk-QZ6HBRJC.js +0 -97
  63. package/dist/chunk-QZ6HBRJC.js.map +0 -1
  64. package/dist/chunk-Y3ITSQA4.js.map +0 -1
  65. package/dist/config-item-QQUA44LP.js +0 -5
  66. package/dist/init.command-IS5TWLU4.js +0 -11
  67. package/dist/load.command-OXPEKYKF.js +0 -11
  68. package/dist/printenv.command-DBEAAYGI.js +0 -11
  69. package/dist/run.command-INBQRQIZ.js +0 -12
  70. package/dist/scan.command-AE6OUPX2.js +0 -12
  71. package/dist/telemetry.command-EYJSX3J7.js +0 -10
  72. package/dist/typegen.command-H7PTAPGH.js +0 -11
@@ -1,4 +1,4 @@
1
- import { createDebug } from './chunk-QZ6HBRJC.js';
1
+ import { SchemaError, VarlockError, createDebug, ResolutionError, CoercionError, ValidationError, activatePlugin, deactivatePlugin, my_dash_default, EmptyRequiredValueError, ParseError, pluginProxy } from './chunk-6CCHLM3U.js';
2
2
  import { __commonJS, __name, __toESM } from './chunk-6PEHRAEP.js';
3
3
  import path2, { join } from 'path';
4
4
  import fs2, { access } from 'fs/promises';
@@ -7,6 +7,7 @@ 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';
10
11
  import crypto from 'crypto';
11
12
  import https from 'https';
12
13
  import { AsyncLocalStorage } from 'async_hooks';
@@ -63,7 +64,7 @@ var require_ansis = __commonJS({
63
64
  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
65
  for (let t3 in e3) {
65
66
  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
+ "s" === l2 ? (c2(t3, T(...p(r2))), c2(_2(t3), v(...p(r2)))) : c2(t3, r2, "f" === l2);
67
68
  }
68
69
  return r = o({}, O), n(s2, r), s2;
69
70
  } }, c2 = /* @__PURE__ */ __name((e3, t3, r2) => {
@@ -73,9 +74,9 @@ var require_ansis = __commonJS({
73
74
  } };
74
75
  }, "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
76
  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
+ 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) }, _2 = /* @__PURE__ */ __name((e3) => "bg" + e3[0].toUpperCase() + e3.slice(1), "_"), k = "Bright";
77
78
  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
+ M = _2(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
80
  })), s2.extend(I);
80
81
  }, "e"))();
81
82
  module.exports = w, w.default = w;
@@ -966,7 +967,7 @@ var require_range = __commonJS({
966
967
  this.set = [first];
967
968
  } else if (this.set.length > 1) {
968
969
  for (const c of this.set) {
969
- if (c.length === 1 && isAny2(c[0])) {
970
+ if (c.length === 1 && isAny(c[0])) {
970
971
  this.set = [c];
971
972
  break;
972
973
  }
@@ -1089,7 +1090,7 @@ var require_range = __commonJS({
1089
1090
  } = require_re();
1090
1091
  var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1091
1092
  var isNullSet = /* @__PURE__ */ __name((c) => c.value === "<0.0.0-0", "isNullSet");
1092
- var isAny2 = /* @__PURE__ */ __name((c) => c.value === "", "isAny");
1093
+ var isAny = /* @__PURE__ */ __name((c) => c.value === "", "isAny");
1093
1094
  var isSatisfiable = /* @__PURE__ */ __name((comparators, options) => {
1094
1095
  let result = true;
1095
1096
  const remainingComparators = comparators.slice();
@@ -1121,8 +1122,8 @@ var require_range = __commonJS({
1121
1122
  }, "replaceTildes");
1122
1123
  var replaceTilde = /* @__PURE__ */ __name((comp, options) => {
1123
1124
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1124
- return comp.replace(r, (_3, M, m, p, pr) => {
1125
- debug2("tilde", comp, _3, M, m, p, pr);
1125
+ return comp.replace(r, (_2, M, m, p, pr) => {
1126
+ debug2("tilde", comp, _2, M, m, p, pr);
1126
1127
  let ret;
1127
1128
  if (isX(M)) {
1128
1129
  ret = "";
@@ -1147,8 +1148,8 @@ var require_range = __commonJS({
1147
1148
  debug2("caret", comp, options);
1148
1149
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1149
1150
  const z = options.includePrerelease ? "-0" : "";
1150
- return comp.replace(r, (_3, M, m, p, pr) => {
1151
- debug2("caret", comp, _3, M, m, p, pr);
1151
+ return comp.replace(r, (_2, M, m, p, pr) => {
1152
+ debug2("caret", comp, _2, M, m, p, pr);
1152
1153
  let ret;
1153
1154
  if (isX(M)) {
1154
1155
  ret = "";
@@ -1979,801 +1980,6 @@ var require_semver2 = __commonJS({
1979
1980
  }
1980
1981
  });
1981
1982
 
1982
- // ../../node_modules/.bun/@sindresorhus+is@7.2.0/node_modules/@sindresorhus/is/distribution/utilities.js
1983
- function keysOf(value) {
1984
- return Object.keys(value);
1985
- }
1986
- __name(keysOf, "keysOf");
1987
-
1988
- // ../../node_modules/.bun/@sindresorhus+is@7.2.0/node_modules/@sindresorhus/is/distribution/index.js
1989
- var typedArrayTypeNames = [
1990
- "Int8Array",
1991
- "Uint8Array",
1992
- "Uint8ClampedArray",
1993
- "Int16Array",
1994
- "Uint16Array",
1995
- "Int32Array",
1996
- "Uint32Array",
1997
- "Float32Array",
1998
- "Float64Array",
1999
- "BigInt64Array",
2000
- "BigUint64Array"
2001
- ];
2002
- function isTypedArrayName(name) {
2003
- return typedArrayTypeNames.includes(name);
2004
- }
2005
- __name(isTypedArrayName, "isTypedArrayName");
2006
- var objectTypeNames = [
2007
- "Function",
2008
- "Generator",
2009
- "AsyncGenerator",
2010
- "GeneratorFunction",
2011
- "AsyncGeneratorFunction",
2012
- "AsyncFunction",
2013
- "Observable",
2014
- "Array",
2015
- "Buffer",
2016
- "Blob",
2017
- "Object",
2018
- "RegExp",
2019
- "Date",
2020
- "Error",
2021
- "Map",
2022
- "Set",
2023
- "WeakMap",
2024
- "WeakSet",
2025
- "WeakRef",
2026
- "ArrayBuffer",
2027
- "SharedArrayBuffer",
2028
- "DataView",
2029
- "Promise",
2030
- "URL",
2031
- "FormData",
2032
- "URLSearchParams",
2033
- "HTMLElement",
2034
- "NaN",
2035
- ...typedArrayTypeNames
2036
- ];
2037
- function isObjectTypeName(name) {
2038
- return objectTypeNames.includes(name);
2039
- }
2040
- __name(isObjectTypeName, "isObjectTypeName");
2041
- var primitiveTypeNames = [
2042
- "null",
2043
- "undefined",
2044
- "string",
2045
- "number",
2046
- "bigint",
2047
- "boolean",
2048
- "symbol"
2049
- ];
2050
- function isPrimitiveTypeName(name) {
2051
- return primitiveTypeNames.includes(name);
2052
- }
2053
- __name(isPrimitiveTypeName, "isPrimitiveTypeName");
2054
- var getObjectType = /* @__PURE__ */ __name((value) => {
2055
- const objectTypeName = Object.prototype.toString.call(value).slice(8, -1);
2056
- if (/HTML\w+Element/.test(objectTypeName) && isHtmlElement(value)) {
2057
- return "HTMLElement";
2058
- }
2059
- if (isObjectTypeName(objectTypeName)) {
2060
- return objectTypeName;
2061
- }
2062
- return void 0;
2063
- }, "getObjectType");
2064
- function detect(value) {
2065
- if (value === null) {
2066
- return "null";
2067
- }
2068
- switch (typeof value) {
2069
- case "undefined": {
2070
- return "undefined";
2071
- }
2072
- case "string": {
2073
- return "string";
2074
- }
2075
- case "number": {
2076
- return Number.isNaN(value) ? "NaN" : "number";
2077
- }
2078
- case "boolean": {
2079
- return "boolean";
2080
- }
2081
- case "function": {
2082
- return "Function";
2083
- }
2084
- case "bigint": {
2085
- return "bigint";
2086
- }
2087
- case "symbol": {
2088
- return "symbol";
2089
- }
2090
- }
2091
- if (isObservable(value)) {
2092
- return "Observable";
2093
- }
2094
- if (isArray(value)) {
2095
- return "Array";
2096
- }
2097
- if (isBuffer(value)) {
2098
- return "Buffer";
2099
- }
2100
- const tagType = getObjectType(value);
2101
- if (tagType && tagType !== "Object") {
2102
- return tagType;
2103
- }
2104
- if (hasPromiseApi(value)) {
2105
- return "Promise";
2106
- }
2107
- if (value instanceof String || value instanceof Boolean || value instanceof Number) {
2108
- throw new TypeError("Please don't use object wrappers for primitive types");
2109
- }
2110
- return "Object";
2111
- }
2112
- __name(detect, "detect");
2113
- function hasPromiseApi(value) {
2114
- return isFunction(value?.then) && isFunction(value?.catch);
2115
- }
2116
- __name(hasPromiseApi, "hasPromiseApi");
2117
- Object.assign(detect, {
2118
- all: isAll,
2119
- any: isAny,
2120
- array: isArray,
2121
- arrayBuffer: isArrayBuffer,
2122
- arrayLike: isArrayLike,
2123
- asyncFunction: isAsyncFunction,
2124
- asyncGenerator: isAsyncGenerator,
2125
- asyncGeneratorFunction: isAsyncGeneratorFunction,
2126
- asyncIterable: isAsyncIterable,
2127
- bigint: isBigint,
2128
- bigInt64Array: isBigInt64Array,
2129
- bigUint64Array: isBigUint64Array,
2130
- blob: isBlob,
2131
- boolean: isBoolean,
2132
- boundFunction: isBoundFunction,
2133
- buffer: isBuffer,
2134
- class: isClass,
2135
- dataView: isDataView,
2136
- date: isDate,
2137
- detect,
2138
- directInstanceOf: isDirectInstanceOf,
2139
- emptyArray: isEmptyArray,
2140
- emptyMap: isEmptyMap,
2141
- emptyObject: isEmptyObject,
2142
- emptySet: isEmptySet,
2143
- emptyString: isEmptyString,
2144
- emptyStringOrWhitespace: isEmptyStringOrWhitespace,
2145
- enumCase: isEnumCase,
2146
- error: isError,
2147
- evenInteger: isEvenInteger,
2148
- falsy: isFalsy,
2149
- float32Array: isFloat32Array,
2150
- float64Array: isFloat64Array,
2151
- formData: isFormData,
2152
- function: isFunction,
2153
- generator: isGenerator,
2154
- generatorFunction: isGeneratorFunction,
2155
- htmlElement: isHtmlElement,
2156
- infinite: isInfinite,
2157
- inRange: isInRange,
2158
- int16Array: isInt16Array,
2159
- int32Array: isInt32Array,
2160
- int8Array: isInt8Array,
2161
- integer: isInteger,
2162
- iterable: isIterable,
2163
- map: isMap,
2164
- nan: isNan,
2165
- nativePromise: isNativePromise,
2166
- negativeNumber: isNegativeNumber,
2167
- nodeStream: isNodeStream,
2168
- nonEmptyArray: isNonEmptyArray,
2169
- nonEmptyMap: isNonEmptyMap,
2170
- nonEmptyObject: isNonEmptyObject,
2171
- nonEmptySet: isNonEmptySet,
2172
- nonEmptyString: isNonEmptyString,
2173
- nonEmptyStringAndNotWhitespace: isNonEmptyStringAndNotWhitespace,
2174
- null: isNull,
2175
- nullOrUndefined: isNullOrUndefined,
2176
- number: isNumber,
2177
- numericString: isNumericString,
2178
- object: isObject,
2179
- observable: isObservable,
2180
- oddInteger: isOddInteger,
2181
- plainObject: isPlainObject,
2182
- positiveNumber: isPositiveNumber,
2183
- primitive: isPrimitive,
2184
- promise: isPromise,
2185
- propertyKey: isPropertyKey,
2186
- regExp: isRegExp,
2187
- safeInteger: isSafeInteger,
2188
- set: isSet,
2189
- sharedArrayBuffer: isSharedArrayBuffer,
2190
- string: isString,
2191
- symbol: isSymbol,
2192
- truthy: isTruthy,
2193
- tupleLike: isTupleLike,
2194
- typedArray: isTypedArray,
2195
- uint16Array: isUint16Array,
2196
- uint32Array: isUint32Array,
2197
- uint8Array: isUint8Array,
2198
- uint8ClampedArray: isUint8ClampedArray,
2199
- undefined: isUndefined,
2200
- urlInstance: isUrlInstance,
2201
- urlSearchParams: isUrlSearchParams,
2202
- urlString: isUrlString,
2203
- optional: isOptional,
2204
- validDate: isValidDate,
2205
- validLength: isValidLength,
2206
- weakMap: isWeakMap,
2207
- weakRef: isWeakRef,
2208
- weakSet: isWeakSet,
2209
- whitespaceString: isWhitespaceString
2210
- });
2211
- function isAbsoluteModule2(remainder) {
2212
- return (value) => isInteger(value) && Math.abs(value % 2) === remainder;
2213
- }
2214
- __name(isAbsoluteModule2, "isAbsoluteModule2");
2215
- function validatePredicateArray(predicateArray, allowEmpty) {
2216
- if (predicateArray.length === 0) {
2217
- if (allowEmpty) ; else {
2218
- throw new TypeError("Invalid predicate array");
2219
- }
2220
- return;
2221
- }
2222
- for (const predicate of predicateArray) {
2223
- if (!isFunction(predicate)) {
2224
- throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
2225
- }
2226
- }
2227
- }
2228
- __name(validatePredicateArray, "validatePredicateArray");
2229
- function isAll(predicate, ...values) {
2230
- if (Array.isArray(predicate)) {
2231
- const predicateArray = predicate;
2232
- validatePredicateArray(predicateArray, values.length === 0);
2233
- const combinedPredicate = /* @__PURE__ */ __name((value) => predicateArray.every((singlePredicate) => singlePredicate(value)), "combinedPredicate");
2234
- if (values.length === 0) {
2235
- return combinedPredicate;
2236
- }
2237
- return predicateOnArray(Array.prototype.every, combinedPredicate, values);
2238
- }
2239
- return predicateOnArray(Array.prototype.every, predicate, values);
2240
- }
2241
- __name(isAll, "isAll");
2242
- function isAny(predicate, ...values) {
2243
- if (Array.isArray(predicate)) {
2244
- const predicateArray = predicate;
2245
- validatePredicateArray(predicateArray, values.length === 0);
2246
- const combinedPredicate = /* @__PURE__ */ __name((value) => predicateArray.some((singlePredicate) => singlePredicate(value)), "combinedPredicate");
2247
- if (values.length === 0) {
2248
- return combinedPredicate;
2249
- }
2250
- return predicateOnArray(Array.prototype.some, combinedPredicate, values);
2251
- }
2252
- return predicateOnArray(Array.prototype.some, predicate, values);
2253
- }
2254
- __name(isAny, "isAny");
2255
- function isOptional(value, predicate) {
2256
- return isUndefined(value) || predicate(value);
2257
- }
2258
- __name(isOptional, "isOptional");
2259
- function isArray(value, assertion) {
2260
- if (!Array.isArray(value)) {
2261
- return false;
2262
- }
2263
- if (!isFunction(assertion)) {
2264
- return true;
2265
- }
2266
- return value.every((element) => assertion(element));
2267
- }
2268
- __name(isArray, "isArray");
2269
- function isArrayBuffer(value) {
2270
- return getObjectType(value) === "ArrayBuffer";
2271
- }
2272
- __name(isArrayBuffer, "isArrayBuffer");
2273
- function isArrayLike(value) {
2274
- return !isNullOrUndefined(value) && !isFunction(value) && isValidLength(value.length);
2275
- }
2276
- __name(isArrayLike, "isArrayLike");
2277
- function isAsyncFunction(value) {
2278
- return getObjectType(value) === "AsyncFunction";
2279
- }
2280
- __name(isAsyncFunction, "isAsyncFunction");
2281
- function isAsyncGenerator(value) {
2282
- return isAsyncIterable(value) && isFunction(value.next) && isFunction(value.throw);
2283
- }
2284
- __name(isAsyncGenerator, "isAsyncGenerator");
2285
- function isAsyncGeneratorFunction(value) {
2286
- return getObjectType(value) === "AsyncGeneratorFunction";
2287
- }
2288
- __name(isAsyncGeneratorFunction, "isAsyncGeneratorFunction");
2289
- function isAsyncIterable(value) {
2290
- return isFunction(value?.[Symbol.asyncIterator]);
2291
- }
2292
- __name(isAsyncIterable, "isAsyncIterable");
2293
- function isBigint(value) {
2294
- return typeof value === "bigint";
2295
- }
2296
- __name(isBigint, "isBigint");
2297
- function isBigInt64Array(value) {
2298
- return getObjectType(value) === "BigInt64Array";
2299
- }
2300
- __name(isBigInt64Array, "isBigInt64Array");
2301
- function isBigUint64Array(value) {
2302
- return getObjectType(value) === "BigUint64Array";
2303
- }
2304
- __name(isBigUint64Array, "isBigUint64Array");
2305
- function isBlob(value) {
2306
- return getObjectType(value) === "Blob";
2307
- }
2308
- __name(isBlob, "isBlob");
2309
- function isBoolean(value) {
2310
- return value === true || value === false;
2311
- }
2312
- __name(isBoolean, "isBoolean");
2313
- function isBoundFunction(value) {
2314
- return isFunction(value) && !Object.hasOwn(value, "prototype");
2315
- }
2316
- __name(isBoundFunction, "isBoundFunction");
2317
- function isBuffer(value) {
2318
- return value?.constructor?.isBuffer?.(value) ?? false;
2319
- }
2320
- __name(isBuffer, "isBuffer");
2321
- function isClass(value) {
2322
- return isFunction(value) && /^class(\s+|{)/.test(value.toString());
2323
- }
2324
- __name(isClass, "isClass");
2325
- function isDataView(value) {
2326
- return getObjectType(value) === "DataView";
2327
- }
2328
- __name(isDataView, "isDataView");
2329
- function isDate(value) {
2330
- return getObjectType(value) === "Date";
2331
- }
2332
- __name(isDate, "isDate");
2333
- function isDirectInstanceOf(instance, class_) {
2334
- if (instance === void 0 || instance === null) {
2335
- return false;
2336
- }
2337
- return Object.getPrototypeOf(instance) === class_.prototype;
2338
- }
2339
- __name(isDirectInstanceOf, "isDirectInstanceOf");
2340
- function isEmptyArray(value) {
2341
- return isArray(value) && value.length === 0;
2342
- }
2343
- __name(isEmptyArray, "isEmptyArray");
2344
- function isEmptyMap(value) {
2345
- return isMap(value) && value.size === 0;
2346
- }
2347
- __name(isEmptyMap, "isEmptyMap");
2348
- function isEmptyObject(value) {
2349
- return isObject(value) && !isMap(value) && !isSet(value) && Object.keys(value).length === 0;
2350
- }
2351
- __name(isEmptyObject, "isEmptyObject");
2352
- function isEmptySet(value) {
2353
- return isSet(value) && value.size === 0;
2354
- }
2355
- __name(isEmptySet, "isEmptySet");
2356
- function isEmptyString(value) {
2357
- return isString(value) && value.length === 0;
2358
- }
2359
- __name(isEmptyString, "isEmptyString");
2360
- function isEmptyStringOrWhitespace(value) {
2361
- return isEmptyString(value) || isWhitespaceString(value);
2362
- }
2363
- __name(isEmptyStringOrWhitespace, "isEmptyStringOrWhitespace");
2364
- function isEnumCase(value, targetEnum) {
2365
- return Object.values(targetEnum).includes(value);
2366
- }
2367
- __name(isEnumCase, "isEnumCase");
2368
- function isError(value) {
2369
- return getObjectType(value) === "Error";
2370
- }
2371
- __name(isError, "isError");
2372
- function isEvenInteger(value) {
2373
- return isAbsoluteModule2(0)(value);
2374
- }
2375
- __name(isEvenInteger, "isEvenInteger");
2376
- function isFalsy(value) {
2377
- return !value;
2378
- }
2379
- __name(isFalsy, "isFalsy");
2380
- function isFloat32Array(value) {
2381
- return getObjectType(value) === "Float32Array";
2382
- }
2383
- __name(isFloat32Array, "isFloat32Array");
2384
- function isFloat64Array(value) {
2385
- return getObjectType(value) === "Float64Array";
2386
- }
2387
- __name(isFloat64Array, "isFloat64Array");
2388
- function isFormData(value) {
2389
- return getObjectType(value) === "FormData";
2390
- }
2391
- __name(isFormData, "isFormData");
2392
- function isFunction(value) {
2393
- return typeof value === "function";
2394
- }
2395
- __name(isFunction, "isFunction");
2396
- function isGenerator(value) {
2397
- return isIterable(value) && isFunction(value?.next) && isFunction(value?.throw);
2398
- }
2399
- __name(isGenerator, "isGenerator");
2400
- function isGeneratorFunction(value) {
2401
- return getObjectType(value) === "GeneratorFunction";
2402
- }
2403
- __name(isGeneratorFunction, "isGeneratorFunction");
2404
- var NODE_TYPE_ELEMENT = 1;
2405
- var DOM_PROPERTIES_TO_CHECK = [
2406
- "innerHTML",
2407
- "ownerDocument",
2408
- "style",
2409
- "attributes",
2410
- "nodeValue"
2411
- ];
2412
- function isHtmlElement(value) {
2413
- return isObject(value) && value.nodeType === NODE_TYPE_ELEMENT && isString(value.nodeName) && !isPlainObject(value) && DOM_PROPERTIES_TO_CHECK.every((property) => property in value);
2414
- }
2415
- __name(isHtmlElement, "isHtmlElement");
2416
- function isInfinite(value) {
2417
- return value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY;
2418
- }
2419
- __name(isInfinite, "isInfinite");
2420
- function isInRange(value, range) {
2421
- if (isNumber(range)) {
2422
- return value >= Math.min(0, range) && value <= Math.max(range, 0);
2423
- }
2424
- if (isArray(range) && range.length === 2) {
2425
- return value >= Math.min(...range) && value <= Math.max(...range);
2426
- }
2427
- throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
2428
- }
2429
- __name(isInRange, "isInRange");
2430
- function isInt16Array(value) {
2431
- return getObjectType(value) === "Int16Array";
2432
- }
2433
- __name(isInt16Array, "isInt16Array");
2434
- function isInt32Array(value) {
2435
- return getObjectType(value) === "Int32Array";
2436
- }
2437
- __name(isInt32Array, "isInt32Array");
2438
- function isInt8Array(value) {
2439
- return getObjectType(value) === "Int8Array";
2440
- }
2441
- __name(isInt8Array, "isInt8Array");
2442
- function isInteger(value) {
2443
- return Number.isInteger(value);
2444
- }
2445
- __name(isInteger, "isInteger");
2446
- function isIterable(value) {
2447
- return isFunction(value?.[Symbol.iterator]);
2448
- }
2449
- __name(isIterable, "isIterable");
2450
- function isMap(value) {
2451
- return getObjectType(value) === "Map";
2452
- }
2453
- __name(isMap, "isMap");
2454
- function isNan(value) {
2455
- return Number.isNaN(value);
2456
- }
2457
- __name(isNan, "isNan");
2458
- function isNativePromise(value) {
2459
- return getObjectType(value) === "Promise";
2460
- }
2461
- __name(isNativePromise, "isNativePromise");
2462
- function isNegativeNumber(value) {
2463
- return isNumber(value) && value < 0;
2464
- }
2465
- __name(isNegativeNumber, "isNegativeNumber");
2466
- function isNodeStream(value) {
2467
- return isObject(value) && isFunction(value.pipe) && !isObservable(value);
2468
- }
2469
- __name(isNodeStream, "isNodeStream");
2470
- function isNonEmptyArray(value) {
2471
- return isArray(value) && value.length > 0;
2472
- }
2473
- __name(isNonEmptyArray, "isNonEmptyArray");
2474
- function isNonEmptyMap(value) {
2475
- return isMap(value) && value.size > 0;
2476
- }
2477
- __name(isNonEmptyMap, "isNonEmptyMap");
2478
- function isNonEmptyObject(value) {
2479
- return isObject(value) && !isMap(value) && !isSet(value) && Object.keys(value).length > 0;
2480
- }
2481
- __name(isNonEmptyObject, "isNonEmptyObject");
2482
- function isNonEmptySet(value) {
2483
- return isSet(value) && value.size > 0;
2484
- }
2485
- __name(isNonEmptySet, "isNonEmptySet");
2486
- function isNonEmptyString(value) {
2487
- return isString(value) && value.length > 0;
2488
- }
2489
- __name(isNonEmptyString, "isNonEmptyString");
2490
- function isNonEmptyStringAndNotWhitespace(value) {
2491
- return isString(value) && !isEmptyStringOrWhitespace(value);
2492
- }
2493
- __name(isNonEmptyStringAndNotWhitespace, "isNonEmptyStringAndNotWhitespace");
2494
- function isNull(value) {
2495
- return value === null;
2496
- }
2497
- __name(isNull, "isNull");
2498
- function isNullOrUndefined(value) {
2499
- return isNull(value) || isUndefined(value);
2500
- }
2501
- __name(isNullOrUndefined, "isNullOrUndefined");
2502
- function isNumber(value) {
2503
- return typeof value === "number" && !Number.isNaN(value);
2504
- }
2505
- __name(isNumber, "isNumber");
2506
- function isNumericString(value) {
2507
- return isString(value) && !isEmptyStringOrWhitespace(value) && !Number.isNaN(Number(value));
2508
- }
2509
- __name(isNumericString, "isNumericString");
2510
- function isObject(value) {
2511
- return !isNull(value) && (typeof value === "object" || isFunction(value));
2512
- }
2513
- __name(isObject, "isObject");
2514
- function isObservable(value) {
2515
- if (!value) {
2516
- return false;
2517
- }
2518
- if (Symbol.observable !== void 0 && value === value[Symbol.observable]?.()) {
2519
- return true;
2520
- }
2521
- if (value === value["@@observable"]?.()) {
2522
- return true;
2523
- }
2524
- return false;
2525
- }
2526
- __name(isObservable, "isObservable");
2527
- function isOddInteger(value) {
2528
- return isAbsoluteModule2(1)(value);
2529
- }
2530
- __name(isOddInteger, "isOddInteger");
2531
- function isPlainObject(value) {
2532
- if (typeof value !== "object" || value === null) {
2533
- return false;
2534
- }
2535
- const prototype = Object.getPrototypeOf(value);
2536
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
2537
- }
2538
- __name(isPlainObject, "isPlainObject");
2539
- function isPositiveNumber(value) {
2540
- return isNumber(value) && value > 0;
2541
- }
2542
- __name(isPositiveNumber, "isPositiveNumber");
2543
- function isPrimitive(value) {
2544
- return isNull(value) || isPrimitiveTypeName(typeof value);
2545
- }
2546
- __name(isPrimitive, "isPrimitive");
2547
- function isPromise(value) {
2548
- return isNativePromise(value) || hasPromiseApi(value);
2549
- }
2550
- __name(isPromise, "isPromise");
2551
- function isPropertyKey(value) {
2552
- return isAny([isString, isNumber, isSymbol], value);
2553
- }
2554
- __name(isPropertyKey, "isPropertyKey");
2555
- function isRegExp(value) {
2556
- return getObjectType(value) === "RegExp";
2557
- }
2558
- __name(isRegExp, "isRegExp");
2559
- function isSafeInteger(value) {
2560
- return Number.isSafeInteger(value);
2561
- }
2562
- __name(isSafeInteger, "isSafeInteger");
2563
- function isSet(value) {
2564
- return getObjectType(value) === "Set";
2565
- }
2566
- __name(isSet, "isSet");
2567
- function isSharedArrayBuffer(value) {
2568
- return getObjectType(value) === "SharedArrayBuffer";
2569
- }
2570
- __name(isSharedArrayBuffer, "isSharedArrayBuffer");
2571
- function isString(value) {
2572
- return typeof value === "string";
2573
- }
2574
- __name(isString, "isString");
2575
- function isSymbol(value) {
2576
- return typeof value === "symbol";
2577
- }
2578
- __name(isSymbol, "isSymbol");
2579
- function isTruthy(value) {
2580
- return Boolean(value);
2581
- }
2582
- __name(isTruthy, "isTruthy");
2583
- function isTupleLike(value, guards) {
2584
- if (isArray(guards) && isArray(value) && guards.length === value.length) {
2585
- return guards.every((guard, index) => guard(value[index]));
2586
- }
2587
- return false;
2588
- }
2589
- __name(isTupleLike, "isTupleLike");
2590
- function isTypedArray(value) {
2591
- return isTypedArrayName(getObjectType(value));
2592
- }
2593
- __name(isTypedArray, "isTypedArray");
2594
- function isUint16Array(value) {
2595
- return getObjectType(value) === "Uint16Array";
2596
- }
2597
- __name(isUint16Array, "isUint16Array");
2598
- function isUint32Array(value) {
2599
- return getObjectType(value) === "Uint32Array";
2600
- }
2601
- __name(isUint32Array, "isUint32Array");
2602
- function isUint8Array(value) {
2603
- return getObjectType(value) === "Uint8Array";
2604
- }
2605
- __name(isUint8Array, "isUint8Array");
2606
- function isUint8ClampedArray(value) {
2607
- return getObjectType(value) === "Uint8ClampedArray";
2608
- }
2609
- __name(isUint8ClampedArray, "isUint8ClampedArray");
2610
- function isUndefined(value) {
2611
- return value === void 0;
2612
- }
2613
- __name(isUndefined, "isUndefined");
2614
- function isUrlInstance(value) {
2615
- return getObjectType(value) === "URL";
2616
- }
2617
- __name(isUrlInstance, "isUrlInstance");
2618
- function isUrlSearchParams(value) {
2619
- return getObjectType(value) === "URLSearchParams";
2620
- }
2621
- __name(isUrlSearchParams, "isUrlSearchParams");
2622
- function isUrlString(value) {
2623
- if (!isString(value)) {
2624
- return false;
2625
- }
2626
- try {
2627
- new URL(value);
2628
- return true;
2629
- } catch {
2630
- return false;
2631
- }
2632
- }
2633
- __name(isUrlString, "isUrlString");
2634
- function isValidDate(value) {
2635
- return isDate(value) && !isNan(Number(value));
2636
- }
2637
- __name(isValidDate, "isValidDate");
2638
- function isValidLength(value) {
2639
- return isSafeInteger(value) && value >= 0;
2640
- }
2641
- __name(isValidLength, "isValidLength");
2642
- function isWeakMap(value) {
2643
- return getObjectType(value) === "WeakMap";
2644
- }
2645
- __name(isWeakMap, "isWeakMap");
2646
- function isWeakRef(value) {
2647
- return getObjectType(value) === "WeakRef";
2648
- }
2649
- __name(isWeakRef, "isWeakRef");
2650
- function isWeakSet(value) {
2651
- return getObjectType(value) === "WeakSet";
2652
- }
2653
- __name(isWeakSet, "isWeakSet");
2654
- function isWhitespaceString(value) {
2655
- return isString(value) && /^\s+$/.test(value);
2656
- }
2657
- __name(isWhitespaceString, "isWhitespaceString");
2658
- function predicateOnArray(method, predicate, values) {
2659
- if (!isFunction(predicate)) {
2660
- throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
2661
- }
2662
- if (values.length === 0) {
2663
- throw new TypeError("Invalid number of values");
2664
- }
2665
- return method.call(values, predicate);
2666
- }
2667
- __name(predicateOnArray, "predicateOnArray");
2668
-
2669
- // ../utils/src/my-dash.ts
2670
- function keyBy(array, key) {
2671
- return (array || []).reduce((r, x) => ({ ...r, [String(x[key])]: x }), {});
2672
- }
2673
- __name(keyBy, "keyBy");
2674
- function sortBy(array, compareBy) {
2675
- if (typeof compareBy === "function") {
2676
- const compareMap = /* @__PURE__ */ new Map();
2677
- array.forEach((item) => {
2678
- compareMap.set(item, compareBy(item));
2679
- });
2680
- return array.concat().sort(
2681
- (a2, b) => compareMap.get(a2) - compareMap.get(b)
2682
- );
2683
- } else {
2684
- return array.concat().sort(
2685
- (a2, b) => {
2686
- if (a2[compareBy] > b[compareBy]) return 1;
2687
- return b[compareBy] > a2[compareBy] ? -1 : 0;
2688
- }
2689
- );
2690
- }
2691
- }
2692
- __name(sortBy, "sortBy");
2693
- function compact(array) {
2694
- return array.filter((item) => item !== void 0 && item !== false && item !== null);
2695
- }
2696
- __name(compact, "compact");
2697
- function filter(array, fn) {
2698
- return array.filter(fn);
2699
- }
2700
- __name(filter, "filter");
2701
- function each(array, fn) {
2702
- if (Array.isArray(array)) {
2703
- array.forEach((item, index) => fn(item, String(index)));
2704
- } else {
2705
- Object.entries(array).forEach(([key, value]) => fn(value, key));
2706
- }
2707
- }
2708
- __name(each, "each");
2709
- function castArray(value) {
2710
- return Array.isArray(value) ? value : [value];
2711
- }
2712
- __name(castArray, "castArray");
2713
- function mapValues(obj, fn) {
2714
- return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value)]));
2715
- }
2716
- __name(mapValues, "mapValues");
2717
- function times(count, fn) {
2718
- return Array.from({ length: count }, (_3, i) => fn(i));
2719
- }
2720
- __name(times, "times");
2721
- function map(array, fn) {
2722
- return array.map(fn);
2723
- }
2724
- __name(map, "map");
2725
- function flatMap(array, fn) {
2726
- return array.flatMap(fn);
2727
- }
2728
- __name(flatMap, "flatMap");
2729
- function intersection(...arrays) {
2730
- return arrays.reduce((a2, b) => a2.filter((value) => b.includes(value)));
2731
- }
2732
- __name(intersection, "intersection");
2733
- function pick(obj, keys) {
2734
- return Object.fromEntries(Object.entries(obj).filter(([key]) => keys.includes(key)));
2735
- }
2736
- __name(pick, "pick");
2737
- function uniq(array) {
2738
- return Array.from(new Set(array));
2739
- }
2740
- __name(uniq, "uniq");
2741
- function fromPairs(pairs) {
2742
- return Object.fromEntries(pairs);
2743
- }
2744
- __name(fromPairs, "fromPairs");
2745
- var _ = {
2746
- keyBy,
2747
- sortBy,
2748
- compact,
2749
- keys: Object.keys,
2750
- values: Object.values,
2751
- some: /* @__PURE__ */ __name((a2, fn) => a2.some(fn), "some"),
2752
- filter,
2753
- each,
2754
- castArray,
2755
- mapValues,
2756
- times,
2757
- map,
2758
- flatMap,
2759
- intersection,
2760
- pick,
2761
- uniq,
2762
- fromPairs,
2763
- // type checks
2764
- isString,
2765
- isBoolean,
2766
- isError,
2767
- isPromise,
2768
- isFunction,
2769
- isNan,
2770
- isNumber,
2771
- isPlainObject,
2772
- isArray,
2773
- isInteger
2774
- };
2775
- var my_dash_default = _;
2776
-
2777
1983
  // ../env-spec-parser/dist/chunk-XRNR4FE7.mjs
2778
1984
  var __defProp = Object.defineProperty;
2779
1985
  var __name2 = /* @__PURE__ */ __name((target, value) => __defProp(target, "name", { value, configurable: true }), "__name");
@@ -7588,142 +6794,6 @@ function parseEnvSpecDotEnvFile(source) {
7588
6794
  __name(parseEnvSpecDotEnvFile, "parseEnvSpecDotEnvFile");
7589
6795
  __name2(parseEnvSpecDotEnvFile, "parseEnvSpecDotEnvFile");
7590
6796
 
7591
- // src/env-graph/lib/errors.ts
7592
- var VarlockError = class extends Error {
7593
- constructor(errOrMessage, more) {
7594
- super(my_dash_default.isError(errOrMessage) ? errOrMessage.message : errOrMessage);
7595
- this.more = more;
7596
- if (my_dash_default.isError(errOrMessage)) {
7597
- this.originalError = errOrMessage;
7598
- this.icon = "\u{1F4A5}";
7599
- } else {
7600
- this.originalError = more?.err;
7601
- }
7602
- if (my_dash_default.isArray(more?.tip)) more.tip = more.tip.join("\n");
7603
- this.name = this.constructor.name;
7604
- if (more?.isWarning) this.isWarning = true;
7605
- this.icon ||= this.constructor.defaultIcon;
7606
- }
7607
- static {
7608
- __name(this, "VarlockError");
7609
- }
7610
- originalError;
7611
- get isUnexpected() {
7612
- return !!this.originalError;
7613
- }
7614
- get type() {
7615
- return this.name;
7616
- }
7617
- static defaultIcon = "\u274C";
7618
- icon;
7619
- _isWarning = false;
7620
- get tip() {
7621
- if (!this.more?.tip) return void 0;
7622
- if (my_dash_default.isArray(this.more.tip)) return this.more.tip.join("\n");
7623
- return this.more.tip;
7624
- }
7625
- get location() {
7626
- return this.more?.location;
7627
- }
7628
- get code() {
7629
- return this.more?.code;
7630
- }
7631
- get extraMetadata() {
7632
- return this.more?.extraMetadata;
7633
- }
7634
- set isWarning(w) {
7635
- this._isWarning = w;
7636
- if (this._isWarning) {
7637
- this.icon = "\u{1F9D0}";
7638
- }
7639
- }
7640
- get isWarning() {
7641
- return this._isWarning;
7642
- }
7643
- toJSON() {
7644
- return {
7645
- icon: this.icon,
7646
- type: this.type,
7647
- name: this.name,
7648
- message: this.message,
7649
- isUnexpected: this.isUnexpected,
7650
- ...this.tip && { tip: this.tip },
7651
- ...this.isWarning && { isWarning: this.isWarning }
7652
- };
7653
- }
7654
- };
7655
- var ConfigLoadError = class extends VarlockError {
7656
- static {
7657
- __name(this, "ConfigLoadError");
7658
- }
7659
- cleanedStack;
7660
- constructor(err) {
7661
- super(err);
7662
- let stackLines = (err.stack?.split("\n") || []).slice(1);
7663
- stackLines = stackLines.filter((l) => {
7664
- if (l.includes(" at ViteNodeRunner.")) return false;
7665
- if (l.includes("core/src/config-loader/config-loader.ts")) return false;
7666
- return true;
7667
- });
7668
- this.message = `${err.name}: ${err.message}`;
7669
- this.cleanedStack = stackLines || [];
7670
- }
7671
- toJSON() {
7672
- return {
7673
- ...super.toJSON(),
7674
- cleanedStack: this.cleanedStack
7675
- };
7676
- }
7677
- };
7678
- var ParseError = class extends VarlockError {
7679
- static {
7680
- __name(this, "ParseError");
7681
- }
7682
- static defaultIcon = "\u{1F635}\u200D\u{1F4AB}";
7683
- };
7684
- var SchemaError = class extends VarlockError {
7685
- static {
7686
- __name(this, "SchemaError");
7687
- }
7688
- static defaultIcon = "\u{1F9F0}";
7689
- };
7690
- var ValidationError = class extends VarlockError {
7691
- static {
7692
- __name(this, "ValidationError");
7693
- }
7694
- static defaultIcon = "\u274C";
7695
- };
7696
- var CoercionError = class extends VarlockError {
7697
- static {
7698
- __name(this, "CoercionError");
7699
- }
7700
- static defaultIcon = "\u{1F6D1}";
7701
- };
7702
- var ResolutionError = class _ResolutionError extends VarlockError {
7703
- static {
7704
- __name(this, "ResolutionError");
7705
- }
7706
- static defaultIcon = "\u26D4";
7707
- _retryable = false;
7708
- set retryable(val) {
7709
- this._retryable = val;
7710
- }
7711
- get retryable() {
7712
- if (this._retryable) return true;
7713
- if (this.originalError instanceof _ResolutionError) return this.originalError.retryable;
7714
- return false;
7715
- }
7716
- };
7717
- var EmptyRequiredValueError = class extends ValidationError {
7718
- static {
7719
- __name(this, "EmptyRequiredValueError");
7720
- }
7721
- icon = "\u2753";
7722
- constructor(_val) {
7723
- super("Value is required but is currently empty");
7724
- }
7725
- };
7726
-
7727
6797
  // src/env-graph/lib/data-types.ts
7728
6798
  var EnvGraphDataType = class {
7729
6799
  constructor(def, factory) {
@@ -8086,16 +7156,16 @@ var BaseDataTypes = [
8086
7156
  ];
8087
7157
 
8088
7158
  // ../utils/src/try-catch.ts
8089
- function isPromise2(obj) {
7159
+ function isPromise(obj) {
8090
7160
  return !!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function";
8091
7161
  }
8092
- __name(isPromise2, "isPromise");
7162
+ __name(isPromise, "isPromise");
8093
7163
  async function tryCatch(tryFn, catchFn) {
8094
7164
  try {
8095
7165
  return await tryFn();
8096
7166
  } catch (err) {
8097
7167
  const catchResult = catchFn(err);
8098
- if (isPromise2(catchResult)) {
7168
+ if (isPromise(catchResult)) {
8099
7169
  await catchResult;
8100
7170
  }
8101
7171
  }
@@ -8501,7 +7571,7 @@ var builtInRootDecorators = [
8501
7571
  dataSource._loadingError = err instanceof SchemaError ? err : new SchemaError(err);
8502
7572
  return;
8503
7573
  }
8504
- const { ConfigItem: ConfigItem2 } = await import('./config-item-QQUA44LP.js');
7574
+ const { ConfigItem: ConfigItem2 } = await import('./config-item-L25YE5DP.js');
8505
7575
  for (const [key, entry] of Object.entries(entries)) {
8506
7576
  const existsInSchema = key in graph.configSchema;
8507
7577
  if (!existsInSchema && !createMissing) {
@@ -8617,11 +7687,11 @@ function shortSha(sha) {
8617
7687
  return s || void 0;
8618
7688
  }
8619
7689
  __name(shortSha, "shortSha");
8620
- function mapToDeploymentEnvironment(value, map2) {
7690
+ function mapToDeploymentEnvironment(value, map) {
8621
7691
  if (!value || typeof value !== "string") return void 0;
8622
7692
  const trimmed = value.trim();
8623
7693
  const key = trimmed.toLowerCase();
8624
- return map2[key] ?? map2[trimmed];
7694
+ return map[key] ?? map[trimmed];
8625
7695
  }
8626
7696
  __name(mapToDeploymentEnvironment, "mapToDeploymentEnvironment");
8627
7697
  function envEq(name, value) {
@@ -9941,16 +9011,39 @@ function applyBunCryptoShim() {
9941
9011
  }
9942
9012
  }
9943
9013
  __name(applyBunCryptoShim, "applyBunCryptoShim");
9944
- function loadPluginModule(filePath) {
9014
+ var isBunRuntime = !!process.versions.bun || false;
9015
+ var varlockPluginLibExports = {
9016
+ plugin: pluginProxy,
9017
+ ValidationError,
9018
+ CoercionError,
9019
+ SchemaError,
9020
+ ResolutionError,
9021
+ createDebug
9022
+ };
9023
+ function loadPluginModuleCJS(filePath) {
9945
9024
  applyBunCryptoShim();
9946
9025
  const code = fs4.readFileSync(filePath, "utf-8");
9947
9026
  const pluginDir = path2.dirname(filePath);
9948
9027
  const moduleObj = { exports: {} };
9949
- const requireFn = createRequire(filePath);
9028
+ const baseRequire = createRequire(filePath);
9029
+ const requireFn = /* @__PURE__ */ __name((id) => {
9030
+ if (id === "varlock/plugin-lib") return varlockPluginLibExports;
9031
+ return baseRequire(id);
9032
+ }, "requireFn");
9033
+ requireFn.resolve = baseRequire.resolve.bind(baseRequire);
9034
+ requireFn.main = baseRequire.main;
9035
+ requireFn.cache = baseRequire.cache;
9950
9036
  const moduleFn = new Function("exports", "require", "module", "__filename", "__dirname", code);
9951
9037
  moduleFn(moduleObj.exports, requireFn, moduleObj, filePath, pluginDir);
9952
9038
  }
9953
- __name(loadPluginModule, "loadPluginModule");
9039
+ __name(loadPluginModuleCJS, "loadPluginModuleCJS");
9040
+ async function loadPluginModuleESM(filePath) {
9041
+ {
9042
+ const fileUrl = pathToFileURL(filePath).href;
9043
+ await import(`${fileUrl}?t=${Date.now()}`);
9044
+ }
9045
+ }
9046
+ __name(loadPluginModuleESM, "loadPluginModuleESM");
9954
9047
  var VarlockPlugin = class {
9955
9048
  static {
9956
9049
  __name(this, "VarlockPlugin");
@@ -10086,23 +9179,54 @@ var VarlockPlugin = class {
10086
9179
  return path2.join(this.localPath, pluginExport);
10087
9180
  }
10088
9181
  async executePluginModule() {
10089
- globalThis.plugin = this;
9182
+ activatePlugin(this);
9183
+ const hadGlobalPlugin = "plugin" in globalThis;
9184
+ const prevGlobalPlugin = globalThis.plugin;
9185
+ const pluginGlobalRemovedMsg = `[varlock] Plugin "${this.name}" is incompatible with this version of varlock. Please upgrade the plugin to the latest version.`;
9186
+ Object.defineProperty(globalThis, "plugin", {
9187
+ get() {
9188
+ throw new Error(pluginGlobalRemovedMsg);
9189
+ },
9190
+ set() {
9191
+ throw new Error(pluginGlobalRemovedMsg);
9192
+ },
9193
+ configurable: true
9194
+ });
10090
9195
  try {
10091
9196
  if (!await pathExists(this.pluginFilePath)) throw new Error(`Plugin file not found: ${this.pluginFilePath}`);
10092
9197
  importedPluginModulePaths.add(this.pluginFilePath);
10093
- loadPluginModule(this.pluginFilePath);
9198
+ const ext = path2.extname(this.pluginFilePath).toLowerCase();
9199
+ if (ext === ".mjs" || ext === ".ts") {
9200
+ await loadPluginModuleESM(this.pluginFilePath);
9201
+ } else {
9202
+ loadPluginModuleCJS(this.pluginFilePath);
9203
+ }
10094
9204
  } catch (err) {
10095
9205
  this.loadingError = err;
9206
+ } finally {
9207
+ if (hadGlobalPlugin) {
9208
+ Object.defineProperty(globalThis, "plugin", {
9209
+ value: prevGlobalPlugin,
9210
+ writable: true,
9211
+ configurable: true,
9212
+ enumerable: true
9213
+ });
9214
+ } else {
9215
+ delete globalThis.plugin;
9216
+ }
9217
+ deactivatePlugin();
10096
9218
  }
10097
- delete globalThis.plugin;
10098
9219
  }
10099
9220
  };
10100
9221
  async function initPluginFromLocalPath(localPath) {
10101
9222
  const stats = await fs2.stat(localPath);
10102
9223
  if (stats.isFile()) {
10103
9224
  const ext = path2.extname(localPath).toLowerCase();
10104
- if ([".js", ".cjs", ".mjs"].includes(ext) === false) {
10105
- throw new SchemaError(`Single-file plugin must be a .js, .cjs, or .mjs file: ${localPath}`);
9225
+ if (ext === ".ts" && !isBunRuntime) {
9226
+ throw new SchemaError(`TypeScript plugins (.ts) require Bun \u2014 try renaming to .mjs or compiling to .js first: ${localPath}`);
9227
+ }
9228
+ if (![".js", ".cjs", ".mjs", ".ts"].includes(ext)) {
9229
+ throw new SchemaError(`Single-file plugin must be a .js, .cjs, .mjs, or .ts file: ${localPath}`);
10106
9230
  }
10107
9231
  return new VarlockPlugin({
10108
9232
  type: "single-file",
@@ -10397,8 +9521,8 @@ var EnvGraphDataSource2 = class {
10397
9521
  return keysToImport;
10398
9522
  }
10399
9523
  }
10400
- /** adds a child data source and sets up the correct references in both directions */
10401
- async addChild(child, importMeta) {
9524
+ /** shared child-setup logic: wire up parent/graph refs, finishInit (but no import processing) */
9525
+ async _initChild(child, importMeta) {
10402
9526
  if (!this.graph) throw new Error("expected graph to be set");
10403
9527
  this.children.unshift(child);
10404
9528
  child.parent = this;
@@ -10406,6 +9530,11 @@ var EnvGraphDataSource2 = class {
10406
9530
  if (importMeta) child.importMeta = importMeta;
10407
9531
  await child.finishInit();
10408
9532
  }
9533
+ /** adds a child data source, running both finishInit and import processing */
9534
+ async addChild(child, importMeta) {
9535
+ await this._initChild(child, importMeta);
9536
+ await child._processImports();
9537
+ }
10409
9538
  /**
10410
9539
  * Whether this data source is environment-specific.
10411
9540
  * A source is env-specific if:
@@ -10472,6 +9601,13 @@ var EnvGraphDataSource2 = class {
10472
9601
  }
10473
9602
  const disabledDec = this.getRootDec("disable");
10474
9603
  if (disabledDec) {
9604
+ await disabledDec.process();
9605
+ if (disabledDec.decValueResolver) {
9606
+ for (const depKey of disabledDec.decValueResolver.deps) {
9607
+ const depItem = this.graph.configSchema[depKey];
9608
+ if (depItem) await depItem.earlyResolve();
9609
+ }
9610
+ }
10475
9611
  const disabledVal = await disabledDec.resolve();
10476
9612
  if (!my_dash_default.isBoolean(disabledVal)) {
10477
9613
  this._loadingError = new Error("expected @disable to be boolean value");
@@ -10486,6 +9622,16 @@ var EnvGraphDataSource2 = class {
10486
9622
  for (const itemKey of this.importKeys || my_dash_default.keys(this.configItemDefs)) {
10487
9623
  const itemDef = this.configItemDefs[itemKey];
10488
9624
  if (!itemDef) continue;
9625
+ const existingItem = this.graph.configSchema[itemKey];
9626
+ if (existingItem?.isResolved && itemDef.parsedValue !== void 0) {
9627
+ const isMatchingStatic = itemDef.parsedValue instanceof ParsedEnvSpecStaticValue && itemDef.parsedValue.unescapedValue === existingItem.resolvedValue;
9628
+ if (!isMatchingStatic) {
9629
+ this._schemaErrors.push(new SchemaError(
9630
+ `"${itemKey}" was already resolved during early initialization (used by @currentEnv, @import, or @disable) and cannot be redefined by ${this.label}`
9631
+ ));
9632
+ continue;
9633
+ }
9634
+ }
10489
9635
  this.graph.configSchema[itemKey] ??= new ConfigItem(this.graph, itemKey);
10490
9636
  }
10491
9637
  const currentEnvDec = this.getRootDec("currentEnv");
@@ -10538,7 +9684,16 @@ var EnvGraphDataSource2 = class {
10538
9684
  const defaultRequiredDec = this.getRootDec("defaultRequired");
10539
9685
  await defaultRequiredDec?.process();
10540
9686
  await processPluginInstallDecorators(this);
10541
- if (!this.isValid) return;
9687
+ }
9688
+ /**
9689
+ * Process @import decorators for this data source.
9690
+ * Separated from finishInit() so that DirectoryDataSource can load all
9691
+ * auto-loaded files first, then process imports once values from
9692
+ * .env, .env.local, etc. are available for import conditions.
9693
+ */
9694
+ async _processImports() {
9695
+ if (!this.graph) throw new Error("expected graph to be set");
9696
+ if (!this.isValid || this.disabled) return;
10542
9697
  const importDecs = this.getRootDecFns("import");
10543
9698
  if (importDecs.length) {
10544
9699
  for (const importDec of importDecs) {
@@ -10878,49 +10033,80 @@ var DirectoryDataSource = class extends EnvGraphDataSource2 {
10878
10033
  return `directory - ${this.basePath}`;
10879
10034
  }
10880
10035
  schemaDataSource;
10036
+ /** load a file as a child, running finishInit but NOT processing imports yet */
10881
10037
  async addAutoLoadedFile(fileName) {
10882
10038
  if (!this.graph) throw new Error("expected graph to be set");
10883
10039
  const filePath = path2.join(this.basePath, fileName);
10884
10040
  if (this.graph.virtualImports) {
10885
10041
  if (this.graph.virtualImports[filePath]) {
10886
10042
  const source2 = new DotEnvFileDataSource(filePath, { overrideContents: this.graph.virtualImports[filePath] });
10887
- await this.addChild(source2);
10043
+ await this._addChildWithoutImports(source2);
10888
10044
  return source2;
10889
10045
  }
10890
10046
  return;
10891
10047
  }
10892
10048
  if (!await pathExists(filePath)) return;
10893
10049
  const source = new DotEnvFileDataSource(filePath);
10894
- await this.addChild(source);
10050
+ await this._addChildWithoutImports(source);
10895
10051
  return source;
10896
10052
  }
10897
- async _finishInit() {
10053
+ /** like addChild but skips import processing — used so all files can be loaded before imports run */
10054
+ async _addChildWithoutImports(child) {
10055
+ await this._initChild(child);
10056
+ }
10057
+ /** resolve currentEnv from schema's envFlagKey or parent chain */
10058
+ async _resolveCurrentEnv() {
10898
10059
  if (!this.graph) throw new Error("expected graph to be set");
10899
- await this.addAutoLoadedFile(".env.schema");
10900
- await this.addAutoLoadedFile(".env");
10901
- if (this.children.length) {
10902
- this.schemaDataSource = this.children[this.children.length - 1];
10903
- }
10904
- await this.addAutoLoadedFile(".env.local");
10905
- let currentEnv;
10906
10060
  if (this.schemaDataSource?._envFlagKey) {
10907
10061
  const envFlagKey = this.schemaDataSource._envFlagKey;
10908
10062
  if (this.isPartialImport && !this.importKeys?.includes(envFlagKey)) {
10909
10063
  this._loadingError = new Error(
10910
10064
  `Imported directory has @currentEnv set to $${envFlagKey}, but "${envFlagKey}" is not included in the import list. Add "${envFlagKey}" to the @import() arguments.`
10911
10065
  );
10912
- return;
10066
+ return void 0;
10913
10067
  }
10914
10068
  const envFlagItem = this.graph.configSchema[envFlagKey];
10915
10069
  if (envFlagItem) {
10916
10070
  if (!envFlagItem.resolvedValue) await envFlagItem.earlyResolve();
10917
- currentEnv = envFlagItem.resolvedValue?.toString();
10071
+ return envFlagItem.resolvedValue?.toString();
10918
10072
  }
10919
10073
  }
10920
- currentEnv ||= (await this.resolveCurrentEnv())?.toString() || this.envFlagValue?.toString();
10074
+ return (await this.resolveCurrentEnv())?.toString() || this.envFlagValue?.toString();
10075
+ }
10076
+ /** load env-specific files (.env.ENV and .env.ENV.local) for the given environment */
10077
+ async _loadEnvSpecificFiles(currentEnv) {
10078
+ const sources = [];
10079
+ const s1 = await this.addAutoLoadedFile(`.env.${currentEnv}`);
10080
+ if (s1) sources.push(s1);
10081
+ const s2 = await this.addAutoLoadedFile(`.env.${currentEnv}.local`);
10082
+ if (s2) sources.push(s2);
10083
+ return sources;
10084
+ }
10085
+ async _finishInit() {
10086
+ if (!this.graph) throw new Error("expected graph to be set");
10087
+ await this.addAutoLoadedFile(".env.schema");
10088
+ await this.addAutoLoadedFile(".env");
10089
+ if (this.children.length) {
10090
+ this.schemaDataSource = this.children[this.children.length - 1];
10091
+ }
10092
+ await this.addAutoLoadedFile(".env.local");
10093
+ let currentEnv = await this._resolveCurrentEnv();
10094
+ if (this._loadingError) return;
10921
10095
  if (currentEnv) {
10922
- await this.addAutoLoadedFile(`.env.${currentEnv}`);
10923
- await this.addAutoLoadedFile(`.env.${currentEnv}.local`);
10096
+ await this._loadEnvSpecificFiles(currentEnv);
10097
+ }
10098
+ for (const child of [...this.children].reverse()) {
10099
+ await child._processImports();
10100
+ }
10101
+ if (!currentEnv) {
10102
+ currentEnv = await this._resolveCurrentEnv();
10103
+ if (this._loadingError) return;
10104
+ if (currentEnv) {
10105
+ const envSources = await this._loadEnvSpecificFiles(currentEnv);
10106
+ for (const source of envSources) {
10107
+ await source._processImports();
10108
+ }
10109
+ }
10924
10110
  }
10925
10111
  }
10926
10112
  };
@@ -11269,6 +10455,7 @@ var EnvGraph2 = class {
11269
10455
  this.rootDataSource = source;
11270
10456
  source.graph = this;
11271
10457
  await source.finishInit();
10458
+ await source._processImports();
11272
10459
  }
11273
10460
  async finishLoad() {
11274
10461
  for (const source of this.sortedDataSources) {
@@ -12082,8 +11269,7 @@ var ConfigItem = class {
12082
11269
  };
12083
11270
  }
12084
11271
  };
12085
- //! these are probably not relevant anymore, or needs to move to a plugin layer?
12086
11272
 
12087
- export { CoercionError, ConfigItem, ConfigLoadError, DirectoryDataSource, DotEnvFileDataSource, EnvGraph2 as EnvGraph, FileBasedDataSource, ParsedEnvSpecStaticValue, ResolutionError, SchemaError, ValidationError, VarlockError, ansis_default, detectWorkspaceInfo, envSpecUpdater, getUserVarlockDir, my_dash_default, parseEnvSpecDotEnvFile, pathExists, require_semver2 as require_semver, runWithWorkspaceInfo, tryCatch };
12088
- //# sourceMappingURL=chunk-MXPBXRWY.js.map
12089
- //# sourceMappingURL=chunk-MXPBXRWY.js.map
11273
+ export { ConfigItem, DirectoryDataSource, DotEnvFileDataSource, EnvGraph2 as EnvGraph, FileBasedDataSource, ParsedEnvSpecStaticValue, ansis_default, detectWorkspaceInfo, envSpecUpdater, getUserVarlockDir, parseEnvSpecDotEnvFile, pathExists, require_semver2 as require_semver, runWithWorkspaceInfo, tryCatch };
11274
+ //# sourceMappingURL=chunk-CU6IMJWG.js.map
11275
+ //# sourceMappingURL=chunk-CU6IMJWG.js.map