@storm-software/config-tools 1.136.3 → 1.137.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 (170) hide show
  1. package/README.md +1 -1
  2. package/dist/acorn-646RJR5S.mjs +3131 -0
  3. package/dist/acorn-BKIQKJ4F.js +3131 -0
  4. package/dist/angular-BK32YZBC.mjs +3014 -0
  5. package/dist/angular-IJH6AEQ2.js +3014 -0
  6. package/dist/babel-FTNSNFRG.mjs +7166 -0
  7. package/dist/babel-MD4YJE3Y.js +7166 -0
  8. package/dist/{chunk-RP57MH2N.js → chunk-2HT4ORYA.js} +14 -14
  9. package/dist/chunk-35WYVRRU.js +1120 -0
  10. package/dist/chunk-3FDEYZAK.js +765 -0
  11. package/dist/{chunk-BOM7LGB4.js → chunk-3WTN23SK.js} +37 -37
  12. package/dist/chunk-43PFM5U5.js +1736 -0
  13. package/dist/{chunk-SWW23TCX.js → chunk-444WTFCK.js} +28 -26
  14. package/dist/chunk-4C5ULXHZ.js +6 -0
  15. package/dist/{chunk-CO2NVYPR.js → chunk-4JZSUGPE.js} +23 -23
  16. package/dist/chunk-5QGWRJPB.mjs +84 -0
  17. package/dist/{chunk-RBSVNX4W.js → chunk-5YOGYZEG.js} +13 -1
  18. package/dist/chunk-5YZA7ARA.mjs +765 -0
  19. package/dist/chunk-5Z3NLDDE.mjs +451 -0
  20. package/dist/chunk-A2B7JKBP.js +7601 -0
  21. package/dist/chunk-ARQBMHSM.mjs +510 -0
  22. package/dist/chunk-AVHETSFN.js +39947 -0
  23. package/dist/{chunk-VK6ZC6XP.js → chunk-B5LYXPCJ.js} +7 -7
  24. package/dist/{chunk-36YIAZMD.mjs → chunk-BKXOCTTA.mjs} +3 -3
  25. package/dist/{chunk-BDBWBTMW.mjs → chunk-BP57EQU7.mjs} +3 -3
  26. package/dist/{chunk-QOJMUMJR.mjs → chunk-CMYWKSBB.mjs} +1 -1
  27. package/dist/{chunk-72XOK5QO.mjs → chunk-D6HJ3XEE.mjs} +3 -3
  28. package/dist/{chunk-OONRDTMT.mjs → chunk-D7EEDW3J.mjs} +1 -1
  29. package/dist/{chunk-7LUIP6PQ.js → chunk-DANGEXD7.js} +6 -6
  30. package/dist/chunk-E25ESST2.mjs +7601 -0
  31. package/dist/{chunk-ITHOTGIJ.mjs → chunk-E3KP6D4W.mjs} +4 -4
  32. package/dist/{chunk-MJS5XRE6.mjs → chunk-EMP3EUPT.mjs} +1 -1
  33. package/dist/{chunk-Z5UYG3QU.js → chunk-FMJGAM5D.js} +4 -4
  34. package/dist/chunk-G6TE7BPR.js +84 -0
  35. package/dist/{chunk-ZHN5GXW7.mjs → chunk-GGBZLABE.mjs} +2 -2
  36. package/dist/{chunk-F526RRYA.mjs → chunk-GRGCVKMG.mjs} +11 -9
  37. package/dist/{chunk-K7V3S3BW.js → chunk-GVQZFZ6E.js} +3 -3
  38. package/dist/{chunk-PYKV5UE3.js → chunk-GWRO5VMM.js} +3 -3
  39. package/dist/chunk-HDZVYW2P.js +70 -0
  40. package/dist/{chunk-LJLITR54.mjs → chunk-HHCEURYJ.mjs} +1 -1
  41. package/dist/chunk-IXG2QO76.mjs +39948 -0
  42. package/dist/chunk-JBD6MOCX.mjs +1733 -0
  43. package/dist/{chunk-2Z2NUZGO.mjs → chunk-JTLTCOIF.mjs} +1 -1
  44. package/dist/{chunk-UNJVNXY7.js → chunk-LGIWVSRE.js} +10 -10
  45. package/dist/{chunk-D47HPUO7.mjs → chunk-LL5L564L.mjs} +11 -11
  46. package/dist/chunk-LNE3WDH6.js +6 -0
  47. package/dist/chunk-N34NGVL6.js +2644 -0
  48. package/dist/{chunk-5GHDZSSH.mjs → chunk-N3H7WTUT.mjs} +1 -1
  49. package/dist/{chunk-7GSJ2YLJ.js → chunk-O3Q5GFR2.js} +4 -4
  50. package/dist/chunk-OKAFRVSY.mjs +4054 -0
  51. package/dist/chunk-OL53L7AE.mjs +1120 -0
  52. package/dist/chunk-OW5ANXN5.mjs +2644 -0
  53. package/dist/chunk-PHAIVEXJ.js +6 -0
  54. package/dist/{chunk-LQCUO5PV.mjs → chunk-Q5A4EAHJ.mjs} +1 -1
  55. package/dist/{chunk-R2YPKFGO.mjs → chunk-QJ35PYO3.mjs} +1 -1
  56. package/dist/chunk-QP46I4IQ.js +451 -0
  57. package/dist/{chunk-LQGTS5ON.mjs → chunk-R4TY5O2X.mjs} +1 -1
  58. package/dist/{chunk-EG4OHTQF.mjs → chunk-RGQF4WBS.mjs} +2 -2
  59. package/dist/chunk-RRSNGPTK.js +4054 -0
  60. package/dist/{chunk-EVEP57Q3.mjs → chunk-RZYA76H7.mjs} +13 -0
  61. package/dist/{chunk-KVGJIBF2.mjs → chunk-SNQO46A7.mjs} +1 -1
  62. package/dist/{chunk-GQAPQGTR.mjs → chunk-UJDQ4JJ2.mjs} +4 -4
  63. package/dist/chunk-UMD3QNEF.js +510 -0
  64. package/dist/{chunk-T7WO327S.js → chunk-V2UDLRHO.js} +8 -8
  65. package/dist/{chunk-AYVEVLX7.js → chunk-VRFMKUF5.js} +27 -27
  66. package/dist/chunk-WAL7JRLU.js +6 -0
  67. package/dist/{chunk-WUGUATQE.mjs → chunk-WCZGQC7L.mjs} +2 -2
  68. package/dist/{chunk-DKTC7KUS.mjs → chunk-WDQJ7FQS.mjs} +1 -1
  69. package/dist/chunk-WT74SYKM.js +28 -0
  70. package/dist/{chunk-SEQZA3NM.js → chunk-WVJHCVAR.js} +3 -3
  71. package/dist/{chunk-OQLT27Y3.js → chunk-X3LZL2FA.js} +2 -2
  72. package/dist/config-file/get-config-file.js +26 -20
  73. package/dist/config-file/get-config-file.mjs +25 -19
  74. package/dist/config-file/index.js +27 -21
  75. package/dist/config-file/index.mjs +26 -20
  76. package/dist/create-storm-config.js +34 -28
  77. package/dist/create-storm-config.mjs +28 -22
  78. package/dist/dist-ESY54GEK.mjs +17570 -0
  79. package/dist/dist-IKT3RN2B.js +17571 -0
  80. package/dist/env/get-env.js +7 -7
  81. package/dist/env/get-env.mjs +6 -6
  82. package/dist/env/index.js +9 -9
  83. package/dist/env/index.mjs +8 -8
  84. package/dist/env/set-env.js +6 -6
  85. package/dist/env/set-env.mjs +5 -5
  86. package/dist/esm-CHY33BEA.js +1716 -0
  87. package/dist/esm-GXBYTNSY.mjs +1716 -0
  88. package/dist/estree-OISRK7S3.mjs +4859 -0
  89. package/dist/estree-ROOTGONW.js +4859 -0
  90. package/dist/execa-OBTCQJ4R.js +2424 -0
  91. package/dist/execa-Q37TRODQ.mjs +2424 -0
  92. package/dist/flow-6CYXU2JU.js +28076 -0
  93. package/dist/flow-CVR7JYJR.mjs +28076 -0
  94. package/dist/glimmer-HPLV3CEI.mjs +3062 -0
  95. package/dist/glimmer-KC46TXCG.js +3062 -0
  96. package/dist/graphql-HGTQLI6G.mjs +1355 -0
  97. package/dist/graphql-QEQ22DRF.js +1355 -0
  98. package/dist/html-BQF3QJLP.mjs +3036 -0
  99. package/dist/html-SQTQQXQE.js +3036 -0
  100. package/dist/index.js +33 -27
  101. package/dist/index.mjs +37 -31
  102. package/dist/json5-FGCHX2C5.js +10 -0
  103. package/dist/json5-PFHFTE3S.mjs +10 -0
  104. package/dist/jsonc-JYPKWISW.js +15 -0
  105. package/dist/jsonc-QMXWMKWV.mjs +15 -0
  106. package/dist/logger/chalk.js +3 -3
  107. package/dist/logger/chalk.mjs +2 -2
  108. package/dist/logger/console-icons.js +5 -5
  109. package/dist/logger/console-icons.mjs +4 -4
  110. package/dist/logger/console.js +14 -14
  111. package/dist/logger/console.mjs +13 -13
  112. package/dist/logger/format-timestamp.js +3 -3
  113. package/dist/logger/format-timestamp.mjs +2 -2
  114. package/dist/logger/get-log-level.js +4 -4
  115. package/dist/logger/get-log-level.mjs +3 -3
  116. package/dist/logger/index.js +15 -15
  117. package/dist/logger/index.mjs +20 -20
  118. package/dist/logger/is-unicode-supported.js +3 -3
  119. package/dist/logger/is-unicode-supported.mjs +2 -2
  120. package/dist/markdown-GDAB6YZK.mjs +3846 -0
  121. package/dist/markdown-VAH7N2ZD.js +3846 -0
  122. package/dist/meriyah-64TJZ2NR.mjs +2720 -0
  123. package/dist/meriyah-KXJRAU2O.js +2720 -0
  124. package/dist/multipart-parser-ACF3MON7.js +187 -0
  125. package/dist/multipart-parser-XTEGLYUH.mjs +187 -0
  126. package/dist/postcss-CTT2C6VM.mjs +5440 -0
  127. package/dist/postcss-ULTRDB4V.js +5440 -0
  128. package/dist/prettier-DDE3QA5F.mjs +23559 -0
  129. package/dist/prettier-V6MPEGHT.js +23560 -0
  130. package/dist/toml-5DG5WNM7.mjs +10 -0
  131. package/dist/toml-S745O2YV.js +10 -0
  132. package/dist/types.js +3 -3
  133. package/dist/types.mjs +2 -2
  134. package/dist/typescript-CCR5BUC6.js +14956 -0
  135. package/dist/typescript-DSR4LFJ2.mjs +14956 -0
  136. package/dist/utilities/apply-workspace-tokens.js +6 -6
  137. package/dist/utilities/apply-workspace-tokens.mjs +5 -5
  138. package/dist/utilities/correct-paths.js +3 -3
  139. package/dist/utilities/correct-paths.mjs +2 -2
  140. package/dist/utilities/file-path-utils.js +3 -3
  141. package/dist/utilities/file-path-utils.mjs +2 -2
  142. package/dist/utilities/find-up.js +3 -3
  143. package/dist/utilities/find-up.mjs +2 -2
  144. package/dist/utilities/find-workspace-root.js +5 -5
  145. package/dist/utilities/find-workspace-root.mjs +4 -4
  146. package/dist/utilities/get-default-config.js +7 -7
  147. package/dist/utilities/get-default-config.mjs +6 -6
  148. package/dist/utilities/index.js +19 -19
  149. package/dist/utilities/index.mjs +18 -18
  150. package/dist/utilities/process-handler.js +15 -15
  151. package/dist/utilities/process-handler.mjs +14 -14
  152. package/dist/utilities/run.js +3 -3
  153. package/dist/utilities/run.mjs +2 -2
  154. package/dist/yaml-FXUEXKW3.js +10 -0
  155. package/dist/yaml-I7POIORV.js +4584 -0
  156. package/dist/yaml-KYTKYGLP.mjs +10 -0
  157. package/dist/yaml-SVET52GC.mjs +4584 -0
  158. package/package.json +2 -2
  159. package/dist/chunk-22DJFJ62.js +0 -6
  160. package/dist/chunk-2K7AEY66.mjs +0 -545
  161. package/dist/chunk-5EN3BWVN.mjs +0 -28
  162. package/dist/chunk-6AYXKAF5.js +0 -28
  163. package/dist/chunk-H2652TPM.js +0 -6
  164. package/dist/chunk-HHAOVN3O.js +0 -545
  165. package/dist/chunk-JYGRRNZP.js +0 -28
  166. package/dist/chunk-OLORJVVT.js +0 -6
  167. package/dist/chunk-PIDYVUHK.js +0 -6
  168. package/dist/chunk-PYET3L7X.js +0 -431
  169. package/dist/chunk-T3JLYD7F.js +0 -70
  170. package/dist/chunk-VGI5MGGT.mjs +0 -431
@@ -0,0 +1,1733 @@
1
+ import {
2
+ basename,
3
+ defu,
4
+ dirname,
5
+ extname,
6
+ fileURLToPath,
7
+ findWorkspaceDir,
8
+ join,
9
+ readPackageJSON,
10
+ resolve
11
+ } from "./chunk-E25ESST2.mjs";
12
+ import {
13
+ writeSystem
14
+ } from "./chunk-LL5L564L.mjs";
15
+ import {
16
+ findWorkspaceRoot
17
+ } from "./chunk-BKXOCTTA.mjs";
18
+ import {
19
+ joinPaths
20
+ } from "./chunk-IXG2QO76.mjs";
21
+ import {
22
+ __commonJS,
23
+ __name,
24
+ __require,
25
+ __toESM,
26
+ init_esm_shims
27
+ } from "./chunk-RZYA76H7.mjs";
28
+
29
+ // ../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/package.json
30
+ var require_package = __commonJS({
31
+ "../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/package.json"(exports, module) {
32
+ module.exports = {
33
+ name: "dotenv",
34
+ version: "16.4.7",
35
+ description: "Loads environment variables from .env file",
36
+ main: "lib/main.js",
37
+ types: "lib/main.d.ts",
38
+ exports: {
39
+ ".": {
40
+ types: "./lib/main.d.ts",
41
+ require: "./lib/main.js",
42
+ default: "./lib/main.js"
43
+ },
44
+ "./config": "./config.js",
45
+ "./config.js": "./config.js",
46
+ "./lib/env-options": "./lib/env-options.js",
47
+ "./lib/env-options.js": "./lib/env-options.js",
48
+ "./lib/cli-options": "./lib/cli-options.js",
49
+ "./lib/cli-options.js": "./lib/cli-options.js",
50
+ "./package.json": "./package.json"
51
+ },
52
+ scripts: {
53
+ "dts-check": "tsc --project tests/types/tsconfig.json",
54
+ lint: "standard",
55
+ pretest: "npm run lint && npm run dts-check",
56
+ test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
57
+ "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",
58
+ prerelease: "npm test",
59
+ release: "standard-version"
60
+ },
61
+ repository: {
62
+ type: "git",
63
+ url: "git://github.com/motdotla/dotenv.git"
64
+ },
65
+ funding: "https://dotenvx.com",
66
+ keywords: [
67
+ "dotenv",
68
+ "env",
69
+ ".env",
70
+ "environment",
71
+ "variables",
72
+ "config",
73
+ "settings"
74
+ ],
75
+ readmeFilename: "README.md",
76
+ license: "BSD-2-Clause",
77
+ devDependencies: {
78
+ "@types/node": "^18.11.3",
79
+ decache: "^4.6.2",
80
+ sinon: "^14.0.1",
81
+ standard: "^17.0.0",
82
+ "standard-version": "^9.5.0",
83
+ tap: "^19.2.0",
84
+ typescript: "^4.8.4"
85
+ },
86
+ engines: {
87
+ node: ">=12"
88
+ },
89
+ browser: {
90
+ fs: false
91
+ }
92
+ };
93
+ }
94
+ });
95
+
96
+ // ../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/lib/main.js
97
+ var require_main = __commonJS({
98
+ "../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/lib/main.js"(exports, module) {
99
+ init_esm_shims();
100
+ var fs = __require("fs");
101
+ var path = __require("path");
102
+ var os = __require("os");
103
+ var crypto = __require("crypto");
104
+ var packageJson = require_package();
105
+ var version = packageJson.version;
106
+ var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
107
+ function parse3(src) {
108
+ const obj = {};
109
+ let lines = src.toString();
110
+ lines = lines.replace(/\r\n?/mg, "\n");
111
+ let match;
112
+ while ((match = LINE.exec(lines)) != null) {
113
+ const key = match[1];
114
+ let value = match[2] || "";
115
+ value = value.trim();
116
+ const maybeQuote = value[0];
117
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
118
+ if (maybeQuote === '"') {
119
+ value = value.replace(/\\n/g, "\n");
120
+ value = value.replace(/\\r/g, "\r");
121
+ }
122
+ obj[key] = value;
123
+ }
124
+ return obj;
125
+ }
126
+ __name(parse3, "parse");
127
+ function _parseVault(options) {
128
+ const vaultPath = _vaultPath(options);
129
+ const result = DotenvModule.configDotenv({
130
+ path: vaultPath
131
+ });
132
+ if (!result.parsed) {
133
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
134
+ err.code = "MISSING_DATA";
135
+ throw err;
136
+ }
137
+ const keys = _dotenvKey(options).split(",");
138
+ const length = keys.length;
139
+ let decrypted;
140
+ for (let i = 0; i < length; i++) {
141
+ try {
142
+ const key = keys[i].trim();
143
+ const attrs = _instructions(result, key);
144
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
145
+ break;
146
+ } catch (error) {
147
+ if (i + 1 >= length) {
148
+ throw error;
149
+ }
150
+ }
151
+ }
152
+ return DotenvModule.parse(decrypted);
153
+ }
154
+ __name(_parseVault, "_parseVault");
155
+ function _log(message) {
156
+ console.log(`[dotenv@${version}][INFO] ${message}`);
157
+ }
158
+ __name(_log, "_log");
159
+ function _warn(message) {
160
+ console.log(`[dotenv@${version}][WARN] ${message}`);
161
+ }
162
+ __name(_warn, "_warn");
163
+ function _debug(message) {
164
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
165
+ }
166
+ __name(_debug, "_debug");
167
+ function _dotenvKey(options) {
168
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
169
+ return options.DOTENV_KEY;
170
+ }
171
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
172
+ return process.env.DOTENV_KEY;
173
+ }
174
+ return "";
175
+ }
176
+ __name(_dotenvKey, "_dotenvKey");
177
+ function _instructions(result, dotenvKey) {
178
+ let uri;
179
+ try {
180
+ uri = new URL(dotenvKey);
181
+ } catch (error) {
182
+ if (error.code === "ERR_INVALID_URL") {
183
+ const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
184
+ err.code = "INVALID_DOTENV_KEY";
185
+ throw err;
186
+ }
187
+ throw error;
188
+ }
189
+ const key = uri.password;
190
+ if (!key) {
191
+ const err = new Error("INVALID_DOTENV_KEY: Missing key part");
192
+ err.code = "INVALID_DOTENV_KEY";
193
+ throw err;
194
+ }
195
+ const environment = uri.searchParams.get("environment");
196
+ if (!environment) {
197
+ const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
198
+ err.code = "INVALID_DOTENV_KEY";
199
+ throw err;
200
+ }
201
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
202
+ const ciphertext = result.parsed[environmentKey];
203
+ if (!ciphertext) {
204
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
205
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
206
+ throw err;
207
+ }
208
+ return {
209
+ ciphertext,
210
+ key
211
+ };
212
+ }
213
+ __name(_instructions, "_instructions");
214
+ function _vaultPath(options) {
215
+ let possibleVaultPath = null;
216
+ if (options && options.path && options.path.length > 0) {
217
+ if (Array.isArray(options.path)) {
218
+ for (const filepath of options.path) {
219
+ if (fs.existsSync(filepath)) {
220
+ possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
221
+ }
222
+ }
223
+ } else {
224
+ possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
225
+ }
226
+ } else {
227
+ possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
228
+ }
229
+ if (fs.existsSync(possibleVaultPath)) {
230
+ return possibleVaultPath;
231
+ }
232
+ return null;
233
+ }
234
+ __name(_vaultPath, "_vaultPath");
235
+ function _resolveHome(envPath) {
236
+ return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
237
+ }
238
+ __name(_resolveHome, "_resolveHome");
239
+ function _configVault(options) {
240
+ _log("Loading env from encrypted .env.vault");
241
+ const parsed = DotenvModule._parseVault(options);
242
+ let processEnv = process.env;
243
+ if (options && options.processEnv != null) {
244
+ processEnv = options.processEnv;
245
+ }
246
+ DotenvModule.populate(processEnv, parsed, options);
247
+ return {
248
+ parsed
249
+ };
250
+ }
251
+ __name(_configVault, "_configVault");
252
+ function configDotenv(options) {
253
+ const dotenvPath = path.resolve(process.cwd(), ".env");
254
+ let encoding = "utf8";
255
+ const debug = Boolean(options && options.debug);
256
+ if (options && options.encoding) {
257
+ encoding = options.encoding;
258
+ } else {
259
+ if (debug) {
260
+ _debug("No encoding is specified. UTF-8 is used by default");
261
+ }
262
+ }
263
+ let optionPaths = [
264
+ dotenvPath
265
+ ];
266
+ if (options && options.path) {
267
+ if (!Array.isArray(options.path)) {
268
+ optionPaths = [
269
+ _resolveHome(options.path)
270
+ ];
271
+ } else {
272
+ optionPaths = [];
273
+ for (const filepath of options.path) {
274
+ optionPaths.push(_resolveHome(filepath));
275
+ }
276
+ }
277
+ }
278
+ let lastError;
279
+ const parsedAll = {};
280
+ for (const path2 of optionPaths) {
281
+ try {
282
+ const parsed = DotenvModule.parse(fs.readFileSync(path2, {
283
+ encoding
284
+ }));
285
+ DotenvModule.populate(parsedAll, parsed, options);
286
+ } catch (e) {
287
+ if (debug) {
288
+ _debug(`Failed to load ${path2} ${e.message}`);
289
+ }
290
+ lastError = e;
291
+ }
292
+ }
293
+ let processEnv = process.env;
294
+ if (options && options.processEnv != null) {
295
+ processEnv = options.processEnv;
296
+ }
297
+ DotenvModule.populate(processEnv, parsedAll, options);
298
+ if (lastError) {
299
+ return {
300
+ parsed: parsedAll,
301
+ error: lastError
302
+ };
303
+ } else {
304
+ return {
305
+ parsed: parsedAll
306
+ };
307
+ }
308
+ }
309
+ __name(configDotenv, "configDotenv");
310
+ function config(options) {
311
+ if (_dotenvKey(options).length === 0) {
312
+ return DotenvModule.configDotenv(options);
313
+ }
314
+ const vaultPath = _vaultPath(options);
315
+ if (!vaultPath) {
316
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
317
+ return DotenvModule.configDotenv(options);
318
+ }
319
+ return DotenvModule._configVault(options);
320
+ }
321
+ __name(config, "config");
322
+ function decrypt(encrypted, keyStr) {
323
+ const key = Buffer.from(keyStr.slice(-64), "hex");
324
+ let ciphertext = Buffer.from(encrypted, "base64");
325
+ const nonce = ciphertext.subarray(0, 12);
326
+ const authTag = ciphertext.subarray(-16);
327
+ ciphertext = ciphertext.subarray(12, -16);
328
+ try {
329
+ const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
330
+ aesgcm.setAuthTag(authTag);
331
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
332
+ } catch (error) {
333
+ const isRange = error instanceof RangeError;
334
+ const invalidKeyLength = error.message === "Invalid key length";
335
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
336
+ if (isRange || invalidKeyLength) {
337
+ const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
338
+ err.code = "INVALID_DOTENV_KEY";
339
+ throw err;
340
+ } else if (decryptionFailed) {
341
+ const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
342
+ err.code = "DECRYPTION_FAILED";
343
+ throw err;
344
+ } else {
345
+ throw error;
346
+ }
347
+ }
348
+ }
349
+ __name(decrypt, "decrypt");
350
+ function populate(processEnv, parsed, options = {}) {
351
+ const debug = Boolean(options && options.debug);
352
+ const override = Boolean(options && options.override);
353
+ if (typeof parsed !== "object") {
354
+ const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
355
+ err.code = "OBJECT_REQUIRED";
356
+ throw err;
357
+ }
358
+ for (const key of Object.keys(parsed)) {
359
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
360
+ if (override === true) {
361
+ processEnv[key] = parsed[key];
362
+ }
363
+ if (debug) {
364
+ if (override === true) {
365
+ _debug(`"${key}" is already defined and WAS overwritten`);
366
+ } else {
367
+ _debug(`"${key}" is already defined and was NOT overwritten`);
368
+ }
369
+ }
370
+ } else {
371
+ processEnv[key] = parsed[key];
372
+ }
373
+ }
374
+ }
375
+ __name(populate, "populate");
376
+ var DotenvModule = {
377
+ configDotenv,
378
+ _configVault,
379
+ _parseVault,
380
+ config,
381
+ decrypt,
382
+ parse: parse3,
383
+ populate
384
+ };
385
+ module.exports.configDotenv = DotenvModule.configDotenv;
386
+ module.exports._configVault = DotenvModule._configVault;
387
+ module.exports._parseVault = DotenvModule._parseVault;
388
+ module.exports.config = DotenvModule.config;
389
+ module.exports.decrypt = DotenvModule.decrypt;
390
+ module.exports.parse = DotenvModule.parse;
391
+ module.exports.populate = DotenvModule.populate;
392
+ module.exports = DotenvModule;
393
+ }
394
+ });
395
+
396
+ // src/config-file/get-config-file.ts
397
+ init_esm_shims();
398
+
399
+ // ../../node_modules/.pnpm/c12@2.0.1/node_modules/c12/dist/index.mjs
400
+ init_esm_shims();
401
+
402
+ // ../../node_modules/.pnpm/c12@2.0.1/node_modules/c12/dist/shared/c12.B4fc1S0C.mjs
403
+ init_esm_shims();
404
+ import { existsSync as existsSync2, promises } from "node:fs";
405
+ import { rm, readFile } from "node:fs/promises";
406
+ import { homedir as homedir2 } from "node:os";
407
+ import { createJiti } from "jiti";
408
+
409
+ // ../../node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs
410
+ init_esm_shims();
411
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
412
+ import { resolve as resolve2 } from "node:path";
413
+ import { homedir } from "node:os";
414
+
415
+ // ../../node_modules/.pnpm/destr@2.0.3/node_modules/destr/dist/index.mjs
416
+ init_esm_shims();
417
+ var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
418
+ var suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
419
+ var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
420
+ function jsonParseTransform(key, value) {
421
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
422
+ warnKeyDropped(key);
423
+ return;
424
+ }
425
+ return value;
426
+ }
427
+ __name(jsonParseTransform, "jsonParseTransform");
428
+ function warnKeyDropped(key) {
429
+ console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
430
+ }
431
+ __name(warnKeyDropped, "warnKeyDropped");
432
+ function destr(value, options = {}) {
433
+ if (typeof value !== "string") {
434
+ return value;
435
+ }
436
+ const _value = value.trim();
437
+ if (
438
+ // eslint-disable-next-line unicorn/prefer-at
439
+ value[0] === '"' && value.endsWith('"') && !value.includes("\\")
440
+ ) {
441
+ return _value.slice(1, -1);
442
+ }
443
+ if (_value.length <= 9) {
444
+ const _lval = _value.toLowerCase();
445
+ if (_lval === "true") {
446
+ return true;
447
+ }
448
+ if (_lval === "false") {
449
+ return false;
450
+ }
451
+ if (_lval === "undefined") {
452
+ return void 0;
453
+ }
454
+ if (_lval === "null") {
455
+ return null;
456
+ }
457
+ if (_lval === "nan") {
458
+ return Number.NaN;
459
+ }
460
+ if (_lval === "infinity") {
461
+ return Number.POSITIVE_INFINITY;
462
+ }
463
+ if (_lval === "-infinity") {
464
+ return Number.NEGATIVE_INFINITY;
465
+ }
466
+ }
467
+ if (!JsonSigRx.test(value)) {
468
+ if (options.strict) {
469
+ throw new SyntaxError("[destr] Invalid JSON");
470
+ }
471
+ return value;
472
+ }
473
+ try {
474
+ if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
475
+ if (options.strict) {
476
+ throw new Error("[destr] Possible prototype pollution");
477
+ }
478
+ return JSON.parse(value, jsonParseTransform);
479
+ }
480
+ return JSON.parse(value);
481
+ } catch (error) {
482
+ if (options.strict) {
483
+ throw error;
484
+ }
485
+ return value;
486
+ }
487
+ }
488
+ __name(destr, "destr");
489
+
490
+ // ../../node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs
491
+ function isBuffer(obj) {
492
+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
493
+ }
494
+ __name(isBuffer, "isBuffer");
495
+ function keyIdentity(key) {
496
+ return key;
497
+ }
498
+ __name(keyIdentity, "keyIdentity");
499
+ function flatten(target, opts) {
500
+ opts = opts || {};
501
+ const delimiter = opts.delimiter || ".";
502
+ const maxDepth = opts.maxDepth;
503
+ const transformKey = opts.transformKey || keyIdentity;
504
+ const output = {};
505
+ function step(object, prev, currentDepth) {
506
+ currentDepth = currentDepth || 1;
507
+ Object.keys(object).forEach(function(key) {
508
+ const value = object[key];
509
+ const isarray = opts.safe && Array.isArray(value);
510
+ const type = Object.prototype.toString.call(value);
511
+ const isbuffer = isBuffer(value);
512
+ const isobject = type === "[object Object]" || type === "[object Array]";
513
+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
514
+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {
515
+ return step(value, newKey, currentDepth + 1);
516
+ }
517
+ output[newKey] = value;
518
+ });
519
+ }
520
+ __name(step, "step");
521
+ step(target);
522
+ return output;
523
+ }
524
+ __name(flatten, "flatten");
525
+ function unflatten(target, opts) {
526
+ opts = opts || {};
527
+ const delimiter = opts.delimiter || ".";
528
+ const overwrite = opts.overwrite || false;
529
+ const transformKey = opts.transformKey || keyIdentity;
530
+ const result = {};
531
+ const isbuffer = isBuffer(target);
532
+ if (isbuffer || Object.prototype.toString.call(target) !== "[object Object]") {
533
+ return target;
534
+ }
535
+ function getkey(key) {
536
+ const parsedKey = Number(key);
537
+ return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
538
+ }
539
+ __name(getkey, "getkey");
540
+ function addKeys(keyPrefix, recipient, target2) {
541
+ return Object.keys(target2).reduce(function(result2, key) {
542
+ result2[keyPrefix + delimiter + key] = target2[key];
543
+ return result2;
544
+ }, recipient);
545
+ }
546
+ __name(addKeys, "addKeys");
547
+ function isEmpty(val) {
548
+ const type = Object.prototype.toString.call(val);
549
+ const isArray = type === "[object Array]";
550
+ const isObject = type === "[object Object]";
551
+ if (!val) {
552
+ return true;
553
+ } else if (isArray) {
554
+ return !val.length;
555
+ } else if (isObject) {
556
+ return !Object.keys(val).length;
557
+ }
558
+ }
559
+ __name(isEmpty, "isEmpty");
560
+ target = Object.keys(target).reduce(function(result2, key) {
561
+ const type = Object.prototype.toString.call(target[key]);
562
+ const isObject = type === "[object Object]" || type === "[object Array]";
563
+ if (!isObject || isEmpty(target[key])) {
564
+ result2[key] = target[key];
565
+ return result2;
566
+ } else {
567
+ return addKeys(
568
+ key,
569
+ result2,
570
+ flatten(target[key], opts)
571
+ );
572
+ }
573
+ }, {});
574
+ Object.keys(target).forEach(function(key) {
575
+ const split = key.split(delimiter).map(transformKey);
576
+ let key1 = getkey(split.shift());
577
+ let key2 = getkey(split[0]);
578
+ let recipient = result;
579
+ while (key2 !== void 0) {
580
+ if (key1 === "__proto__") {
581
+ return;
582
+ }
583
+ const type = Object.prototype.toString.call(recipient[key1]);
584
+ const isobject = type === "[object Object]" || type === "[object Array]";
585
+ if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") {
586
+ return;
587
+ }
588
+ if (overwrite && !isobject || !overwrite && recipient[key1] == null) {
589
+ recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
590
+ }
591
+ recipient = recipient[key1];
592
+ if (split.length > 0) {
593
+ key1 = getkey(split.shift());
594
+ key2 = getkey(split[0]);
595
+ }
596
+ }
597
+ recipient[key1] = unflatten(target[key], opts);
598
+ });
599
+ return result;
600
+ }
601
+ __name(unflatten, "unflatten");
602
+ var RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
603
+ var RE_LINES = /\n|\r|\r\n/;
604
+ var defaults = {
605
+ name: ".conf",
606
+ dir: process.cwd(),
607
+ flat: false
608
+ };
609
+ function withDefaults(options) {
610
+ if (typeof options === "string") {
611
+ options = { name: options };
612
+ }
613
+ return { ...defaults, ...options };
614
+ }
615
+ __name(withDefaults, "withDefaults");
616
+ function parse(contents, options = {}) {
617
+ const config = {};
618
+ const lines = contents.split(RE_LINES);
619
+ for (const line of lines) {
620
+ const match = line.match(RE_KEY_VAL);
621
+ if (!match) {
622
+ continue;
623
+ }
624
+ const key = match[1];
625
+ if (!key || key === "__proto__" || key === "constructor") {
626
+ continue;
627
+ }
628
+ const value = destr(
629
+ (match[2] || "").trim()
630
+ /* val */
631
+ );
632
+ if (key.endsWith("[]")) {
633
+ const nkey = key.slice(0, Math.max(0, key.length - 2));
634
+ config[nkey] = (config[nkey] || []).concat(value);
635
+ continue;
636
+ }
637
+ config[key] = value;
638
+ }
639
+ return options.flat ? config : unflatten(config, { overwrite: true });
640
+ }
641
+ __name(parse, "parse");
642
+ function parseFile(path, options) {
643
+ if (!existsSync(path)) {
644
+ return {};
645
+ }
646
+ return parse(readFileSync(path, "utf8"), options);
647
+ }
648
+ __name(parseFile, "parseFile");
649
+ function read(options) {
650
+ options = withDefaults(options);
651
+ return parseFile(resolve2(options.dir, options.name), options);
652
+ }
653
+ __name(read, "read");
654
+ function readUser(options) {
655
+ options = withDefaults(options);
656
+ options.dir = process.env.XDG_CONFIG_HOME || homedir();
657
+ return read(options);
658
+ }
659
+ __name(readUser, "readUser");
660
+
661
+ // ../../node_modules/.pnpm/ohash@1.1.4/node_modules/ohash/dist/index.mjs
662
+ init_esm_shims();
663
+ var defaults2 = Object.freeze({
664
+ ignoreUnknown: false,
665
+ respectType: false,
666
+ respectFunctionNames: false,
667
+ respectFunctionProperties: false,
668
+ unorderedObjects: true,
669
+ unorderedArrays: false,
670
+ unorderedSets: false,
671
+ excludeKeys: void 0,
672
+ excludeValues: void 0,
673
+ replacer: void 0
674
+ });
675
+ function objectHash(object, options) {
676
+ if (options) {
677
+ options = { ...defaults2, ...options };
678
+ } else {
679
+ options = defaults2;
680
+ }
681
+ const hasher = createHasher(options);
682
+ hasher.dispatch(object);
683
+ return hasher.toString();
684
+ }
685
+ __name(objectHash, "objectHash");
686
+ var defaultPrototypesKeys = Object.freeze([
687
+ "prototype",
688
+ "__proto__",
689
+ "constructor"
690
+ ]);
691
+ function createHasher(options) {
692
+ let buff = "";
693
+ let context = /* @__PURE__ */ new Map();
694
+ const write = /* @__PURE__ */ __name((str) => {
695
+ buff += str;
696
+ }, "write");
697
+ return {
698
+ toString() {
699
+ return buff;
700
+ },
701
+ getContext() {
702
+ return context;
703
+ },
704
+ dispatch(value) {
705
+ if (options.replacer) {
706
+ value = options.replacer(value);
707
+ }
708
+ const type = value === null ? "null" : typeof value;
709
+ return this[type](value);
710
+ },
711
+ object(object) {
712
+ if (object && typeof object.toJSON === "function") {
713
+ return this.object(object.toJSON());
714
+ }
715
+ const objString = Object.prototype.toString.call(object);
716
+ let objType = "";
717
+ const objectLength = objString.length;
718
+ if (objectLength < 10) {
719
+ objType = "unknown:[" + objString + "]";
720
+ } else {
721
+ objType = objString.slice(8, objectLength - 1);
722
+ }
723
+ objType = objType.toLowerCase();
724
+ let objectNumber = null;
725
+ if ((objectNumber = context.get(object)) === void 0) {
726
+ context.set(object, context.size);
727
+ } else {
728
+ return this.dispatch("[CIRCULAR:" + objectNumber + "]");
729
+ }
730
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
731
+ write("buffer:");
732
+ return write(object.toString("utf8"));
733
+ }
734
+ if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
735
+ if (this[objType]) {
736
+ this[objType](object);
737
+ } else if (!options.ignoreUnknown) {
738
+ this.unkown(object, objType);
739
+ }
740
+ } else {
741
+ let keys = Object.keys(object);
742
+ if (options.unorderedObjects) {
743
+ keys = keys.sort();
744
+ }
745
+ let extraKeys = [];
746
+ if (options.respectType !== false && !isNativeFunction(object)) {
747
+ extraKeys = defaultPrototypesKeys;
748
+ }
749
+ if (options.excludeKeys) {
750
+ keys = keys.filter((key) => {
751
+ return !options.excludeKeys(key);
752
+ });
753
+ extraKeys = extraKeys.filter((key) => {
754
+ return !options.excludeKeys(key);
755
+ });
756
+ }
757
+ write("object:" + (keys.length + extraKeys.length) + ":");
758
+ const dispatchForKey = /* @__PURE__ */ __name((key) => {
759
+ this.dispatch(key);
760
+ write(":");
761
+ if (!options.excludeValues) {
762
+ this.dispatch(object[key]);
763
+ }
764
+ write(",");
765
+ }, "dispatchForKey");
766
+ for (const key of keys) {
767
+ dispatchForKey(key);
768
+ }
769
+ for (const key of extraKeys) {
770
+ dispatchForKey(key);
771
+ }
772
+ }
773
+ },
774
+ array(arr, unordered) {
775
+ unordered = unordered === void 0 ? options.unorderedArrays !== false : unordered;
776
+ write("array:" + arr.length + ":");
777
+ if (!unordered || arr.length <= 1) {
778
+ for (const entry of arr) {
779
+ this.dispatch(entry);
780
+ }
781
+ return;
782
+ }
783
+ const contextAdditions = /* @__PURE__ */ new Map();
784
+ const entries = arr.map((entry) => {
785
+ const hasher = createHasher(options);
786
+ hasher.dispatch(entry);
787
+ for (const [key, value] of hasher.getContext()) {
788
+ contextAdditions.set(key, value);
789
+ }
790
+ return hasher.toString();
791
+ });
792
+ context = contextAdditions;
793
+ entries.sort();
794
+ return this.array(entries, false);
795
+ },
796
+ date(date) {
797
+ return write("date:" + date.toJSON());
798
+ },
799
+ symbol(sym) {
800
+ return write("symbol:" + sym.toString());
801
+ },
802
+ unkown(value, type) {
803
+ write(type);
804
+ if (!value) {
805
+ return;
806
+ }
807
+ write(":");
808
+ if (value && typeof value.entries === "function") {
809
+ return this.array(
810
+ Array.from(value.entries()),
811
+ true
812
+ /* ordered */
813
+ );
814
+ }
815
+ },
816
+ error(err) {
817
+ return write("error:" + err.toString());
818
+ },
819
+ boolean(bool) {
820
+ return write("bool:" + bool);
821
+ },
822
+ string(string) {
823
+ write("string:" + string.length + ":");
824
+ write(string);
825
+ },
826
+ function(fn) {
827
+ write("fn:");
828
+ if (isNativeFunction(fn)) {
829
+ this.dispatch("[native]");
830
+ } else {
831
+ this.dispatch(fn.toString());
832
+ }
833
+ if (options.respectFunctionNames !== false) {
834
+ this.dispatch("function-name:" + String(fn.name));
835
+ }
836
+ if (options.respectFunctionProperties) {
837
+ this.object(fn);
838
+ }
839
+ },
840
+ number(number) {
841
+ return write("number:" + number);
842
+ },
843
+ xml(xml) {
844
+ return write("xml:" + xml.toString());
845
+ },
846
+ null() {
847
+ return write("Null");
848
+ },
849
+ undefined() {
850
+ return write("Undefined");
851
+ },
852
+ regexp(regex) {
853
+ return write("regex:" + regex.toString());
854
+ },
855
+ uint8array(arr) {
856
+ write("uint8array:");
857
+ return this.dispatch(Array.prototype.slice.call(arr));
858
+ },
859
+ uint8clampedarray(arr) {
860
+ write("uint8clampedarray:");
861
+ return this.dispatch(Array.prototype.slice.call(arr));
862
+ },
863
+ int8array(arr) {
864
+ write("int8array:");
865
+ return this.dispatch(Array.prototype.slice.call(arr));
866
+ },
867
+ uint16array(arr) {
868
+ write("uint16array:");
869
+ return this.dispatch(Array.prototype.slice.call(arr));
870
+ },
871
+ int16array(arr) {
872
+ write("int16array:");
873
+ return this.dispatch(Array.prototype.slice.call(arr));
874
+ },
875
+ uint32array(arr) {
876
+ write("uint32array:");
877
+ return this.dispatch(Array.prototype.slice.call(arr));
878
+ },
879
+ int32array(arr) {
880
+ write("int32array:");
881
+ return this.dispatch(Array.prototype.slice.call(arr));
882
+ },
883
+ float32array(arr) {
884
+ write("float32array:");
885
+ return this.dispatch(Array.prototype.slice.call(arr));
886
+ },
887
+ float64array(arr) {
888
+ write("float64array:");
889
+ return this.dispatch(Array.prototype.slice.call(arr));
890
+ },
891
+ arraybuffer(arr) {
892
+ write("arraybuffer:");
893
+ return this.dispatch(new Uint8Array(arr));
894
+ },
895
+ url(url) {
896
+ return write("url:" + url.toString());
897
+ },
898
+ map(map) {
899
+ write("map:");
900
+ const arr = [...map];
901
+ return this.array(arr, options.unorderedSets !== false);
902
+ },
903
+ set(set) {
904
+ write("set:");
905
+ const arr = [...set];
906
+ return this.array(arr, options.unorderedSets !== false);
907
+ },
908
+ file(file) {
909
+ write("file:");
910
+ return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
911
+ },
912
+ blob() {
913
+ if (options.ignoreUnknown) {
914
+ return write("[blob]");
915
+ }
916
+ throw new Error(
917
+ 'Hashing Blob objects is currently not supported\nUse "options.replacer" or "options.ignoreUnknown"\n'
918
+ );
919
+ },
920
+ domwindow() {
921
+ return write("domwindow");
922
+ },
923
+ bigint(number) {
924
+ return write("bigint:" + number.toString());
925
+ },
926
+ /* Node.js standard native objects */
927
+ process() {
928
+ return write("process");
929
+ },
930
+ timer() {
931
+ return write("timer");
932
+ },
933
+ pipe() {
934
+ return write("pipe");
935
+ },
936
+ tcp() {
937
+ return write("tcp");
938
+ },
939
+ udp() {
940
+ return write("udp");
941
+ },
942
+ tty() {
943
+ return write("tty");
944
+ },
945
+ statwatcher() {
946
+ return write("statwatcher");
947
+ },
948
+ securecontext() {
949
+ return write("securecontext");
950
+ },
951
+ connection() {
952
+ return write("connection");
953
+ },
954
+ zlib() {
955
+ return write("zlib");
956
+ },
957
+ context() {
958
+ return write("context");
959
+ },
960
+ nodescript() {
961
+ return write("nodescript");
962
+ },
963
+ httpparser() {
964
+ return write("httpparser");
965
+ },
966
+ dataview() {
967
+ return write("dataview");
968
+ },
969
+ signal() {
970
+ return write("signal");
971
+ },
972
+ fsevent() {
973
+ return write("fsevent");
974
+ },
975
+ tlswrap() {
976
+ return write("tlswrap");
977
+ }
978
+ };
979
+ }
980
+ __name(createHasher, "createHasher");
981
+ var nativeFunc = "[native code] }";
982
+ var nativeFuncLength = nativeFunc.length;
983
+ function isNativeFunction(f) {
984
+ if (typeof f !== "function") {
985
+ return false;
986
+ }
987
+ return Function.prototype.toString.call(f).slice(-nativeFuncLength) === nativeFunc;
988
+ }
989
+ __name(isNativeFunction, "isNativeFunction");
990
+ var __defProp$1 = Object.defineProperty;
991
+ var __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, "__defNormalProp$1");
992
+ var __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => {
993
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
994
+ return value;
995
+ }, "__publicField$1");
996
+ var WordArray = class _WordArray {
997
+ static {
998
+ __name(this, "WordArray");
999
+ }
1000
+ constructor(words, sigBytes) {
1001
+ __publicField$1(this, "words");
1002
+ __publicField$1(this, "sigBytes");
1003
+ words = this.words = words || [];
1004
+ this.sigBytes = sigBytes === void 0 ? words.length * 4 : sigBytes;
1005
+ }
1006
+ toString(encoder) {
1007
+ return (encoder || Hex).stringify(this);
1008
+ }
1009
+ concat(wordArray) {
1010
+ this.clamp();
1011
+ if (this.sigBytes % 4) {
1012
+ for (let i = 0; i < wordArray.sigBytes; i++) {
1013
+ const thatByte = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
1014
+ this.words[this.sigBytes + i >>> 2] |= thatByte << 24 - (this.sigBytes + i) % 4 * 8;
1015
+ }
1016
+ } else {
1017
+ for (let j = 0; j < wordArray.sigBytes; j += 4) {
1018
+ this.words[this.sigBytes + j >>> 2] = wordArray.words[j >>> 2];
1019
+ }
1020
+ }
1021
+ this.sigBytes += wordArray.sigBytes;
1022
+ return this;
1023
+ }
1024
+ clamp() {
1025
+ this.words[this.sigBytes >>> 2] &= 4294967295 << 32 - this.sigBytes % 4 * 8;
1026
+ this.words.length = Math.ceil(this.sigBytes / 4);
1027
+ }
1028
+ clone() {
1029
+ return new _WordArray([...this.words]);
1030
+ }
1031
+ };
1032
+ var Hex = {
1033
+ stringify(wordArray) {
1034
+ const hexChars = [];
1035
+ for (let i = 0; i < wordArray.sigBytes; i++) {
1036
+ const bite = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
1037
+ hexChars.push((bite >>> 4).toString(16), (bite & 15).toString(16));
1038
+ }
1039
+ return hexChars.join("");
1040
+ }
1041
+ };
1042
+ var Base64 = {
1043
+ stringify(wordArray) {
1044
+ const keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1045
+ const base64Chars = [];
1046
+ for (let i = 0; i < wordArray.sigBytes; i += 3) {
1047
+ const byte1 = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
1048
+ const byte2 = wordArray.words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255;
1049
+ const byte3 = wordArray.words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255;
1050
+ const triplet = byte1 << 16 | byte2 << 8 | byte3;
1051
+ for (let j = 0; j < 4 && i * 8 + j * 6 < wordArray.sigBytes * 8; j++) {
1052
+ base64Chars.push(keyStr.charAt(triplet >>> 6 * (3 - j) & 63));
1053
+ }
1054
+ }
1055
+ return base64Chars.join("");
1056
+ }
1057
+ };
1058
+ var Latin1 = {
1059
+ parse(latin1Str) {
1060
+ const latin1StrLength = latin1Str.length;
1061
+ const words = [];
1062
+ for (let i = 0; i < latin1StrLength; i++) {
1063
+ words[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8;
1064
+ }
1065
+ return new WordArray(words, latin1StrLength);
1066
+ }
1067
+ };
1068
+ var Utf8 = {
1069
+ parse(utf8Str) {
1070
+ return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
1071
+ }
1072
+ };
1073
+ var BufferedBlockAlgorithm = class {
1074
+ static {
1075
+ __name(this, "BufferedBlockAlgorithm");
1076
+ }
1077
+ constructor() {
1078
+ __publicField$1(this, "_data", new WordArray());
1079
+ __publicField$1(this, "_nDataBytes", 0);
1080
+ __publicField$1(this, "_minBufferSize", 0);
1081
+ __publicField$1(this, "blockSize", 512 / 32);
1082
+ }
1083
+ reset() {
1084
+ this._data = new WordArray();
1085
+ this._nDataBytes = 0;
1086
+ }
1087
+ _append(data) {
1088
+ if (typeof data === "string") {
1089
+ data = Utf8.parse(data);
1090
+ }
1091
+ this._data.concat(data);
1092
+ this._nDataBytes += data.sigBytes;
1093
+ }
1094
+ _doProcessBlock(_dataWords, _offset) {
1095
+ }
1096
+ _process(doFlush) {
1097
+ let processedWords;
1098
+ let nBlocksReady = this._data.sigBytes / (this.blockSize * 4);
1099
+ if (doFlush) {
1100
+ nBlocksReady = Math.ceil(nBlocksReady);
1101
+ } else {
1102
+ nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
1103
+ }
1104
+ const nWordsReady = nBlocksReady * this.blockSize;
1105
+ const nBytesReady = Math.min(nWordsReady * 4, this._data.sigBytes);
1106
+ if (nWordsReady) {
1107
+ for (let offset = 0; offset < nWordsReady; offset += this.blockSize) {
1108
+ this._doProcessBlock(this._data.words, offset);
1109
+ }
1110
+ processedWords = this._data.words.splice(0, nWordsReady);
1111
+ this._data.sigBytes -= nBytesReady;
1112
+ }
1113
+ return new WordArray(processedWords, nBytesReady);
1114
+ }
1115
+ };
1116
+ var Hasher = class extends BufferedBlockAlgorithm {
1117
+ static {
1118
+ __name(this, "Hasher");
1119
+ }
1120
+ update(messageUpdate) {
1121
+ this._append(messageUpdate);
1122
+ this._process();
1123
+ return this;
1124
+ }
1125
+ finalize(messageUpdate) {
1126
+ if (messageUpdate) {
1127
+ this._append(messageUpdate);
1128
+ }
1129
+ }
1130
+ };
1131
+ var __defProp = Object.defineProperty;
1132
+ var __defNormalProp = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, "__defNormalProp");
1133
+ var __publicField = /* @__PURE__ */ __name((obj, key, value) => {
1134
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1135
+ return value;
1136
+ }, "__publicField");
1137
+ var H = [
1138
+ 1779033703,
1139
+ -1150833019,
1140
+ 1013904242,
1141
+ -1521486534,
1142
+ 1359893119,
1143
+ -1694144372,
1144
+ 528734635,
1145
+ 1541459225
1146
+ ];
1147
+ var K = [
1148
+ 1116352408,
1149
+ 1899447441,
1150
+ -1245643825,
1151
+ -373957723,
1152
+ 961987163,
1153
+ 1508970993,
1154
+ -1841331548,
1155
+ -1424204075,
1156
+ -670586216,
1157
+ 310598401,
1158
+ 607225278,
1159
+ 1426881987,
1160
+ 1925078388,
1161
+ -2132889090,
1162
+ -1680079193,
1163
+ -1046744716,
1164
+ -459576895,
1165
+ -272742522,
1166
+ 264347078,
1167
+ 604807628,
1168
+ 770255983,
1169
+ 1249150122,
1170
+ 1555081692,
1171
+ 1996064986,
1172
+ -1740746414,
1173
+ -1473132947,
1174
+ -1341970488,
1175
+ -1084653625,
1176
+ -958395405,
1177
+ -710438585,
1178
+ 113926993,
1179
+ 338241895,
1180
+ 666307205,
1181
+ 773529912,
1182
+ 1294757372,
1183
+ 1396182291,
1184
+ 1695183700,
1185
+ 1986661051,
1186
+ -2117940946,
1187
+ -1838011259,
1188
+ -1564481375,
1189
+ -1474664885,
1190
+ -1035236496,
1191
+ -949202525,
1192
+ -778901479,
1193
+ -694614492,
1194
+ -200395387,
1195
+ 275423344,
1196
+ 430227734,
1197
+ 506948616,
1198
+ 659060556,
1199
+ 883997877,
1200
+ 958139571,
1201
+ 1322822218,
1202
+ 1537002063,
1203
+ 1747873779,
1204
+ 1955562222,
1205
+ 2024104815,
1206
+ -2067236844,
1207
+ -1933114872,
1208
+ -1866530822,
1209
+ -1538233109,
1210
+ -1090935817,
1211
+ -965641998
1212
+ ];
1213
+ var W = [];
1214
+ var SHA256 = class extends Hasher {
1215
+ static {
1216
+ __name(this, "SHA256");
1217
+ }
1218
+ constructor() {
1219
+ super(...arguments);
1220
+ __publicField(this, "_hash", new WordArray([...H]));
1221
+ }
1222
+ /**
1223
+ * Resets the internal state of the hash object to initial values.
1224
+ */
1225
+ reset() {
1226
+ super.reset();
1227
+ this._hash = new WordArray([...H]);
1228
+ }
1229
+ _doProcessBlock(M, offset) {
1230
+ const H2 = this._hash.words;
1231
+ let a = H2[0];
1232
+ let b = H2[1];
1233
+ let c = H2[2];
1234
+ let d = H2[3];
1235
+ let e = H2[4];
1236
+ let f = H2[5];
1237
+ let g = H2[6];
1238
+ let h = H2[7];
1239
+ for (let i = 0; i < 64; i++) {
1240
+ if (i < 16) {
1241
+ W[i] = M[offset + i] | 0;
1242
+ } else {
1243
+ const gamma0x = W[i - 15];
1244
+ const gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3;
1245
+ const gamma1x = W[i - 2];
1246
+ const gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
1247
+ W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
1248
+ }
1249
+ const ch = e & f ^ ~e & g;
1250
+ const maj = a & b ^ a & c ^ b & c;
1251
+ const sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
1252
+ const sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
1253
+ const t1 = h + sigma1 + ch + K[i] + W[i];
1254
+ const t2 = sigma0 + maj;
1255
+ h = g;
1256
+ g = f;
1257
+ f = e;
1258
+ e = d + t1 | 0;
1259
+ d = c;
1260
+ c = b;
1261
+ b = a;
1262
+ a = t1 + t2 | 0;
1263
+ }
1264
+ H2[0] = H2[0] + a | 0;
1265
+ H2[1] = H2[1] + b | 0;
1266
+ H2[2] = H2[2] + c | 0;
1267
+ H2[3] = H2[3] + d | 0;
1268
+ H2[4] = H2[4] + e | 0;
1269
+ H2[5] = H2[5] + f | 0;
1270
+ H2[6] = H2[6] + g | 0;
1271
+ H2[7] = H2[7] + h | 0;
1272
+ }
1273
+ /**
1274
+ * Finishes the hash calculation and returns the hash as a WordArray.
1275
+ *
1276
+ * @param {string} messageUpdate - Additional message content to include in the hash.
1277
+ * @returns {WordArray} The finalised hash as a WordArray.
1278
+ */
1279
+ finalize(messageUpdate) {
1280
+ super.finalize(messageUpdate);
1281
+ const nBitsTotal = this._nDataBytes * 8;
1282
+ const nBitsLeft = this._data.sigBytes * 8;
1283
+ this._data.words[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
1284
+ this._data.words[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(
1285
+ nBitsTotal / 4294967296
1286
+ );
1287
+ this._data.words[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
1288
+ this._data.sigBytes = this._data.words.length * 4;
1289
+ this._process();
1290
+ return this._hash;
1291
+ }
1292
+ };
1293
+ function sha256base64(message) {
1294
+ return new SHA256().finalize(message).toString(Base64);
1295
+ }
1296
+ __name(sha256base64, "sha256base64");
1297
+ function hash(object, options = {}) {
1298
+ const hashed = typeof object === "string" ? object : objectHash(object, options);
1299
+ return sha256base64(hashed).slice(0, 10);
1300
+ }
1301
+ __name(hash, "hash");
1302
+
1303
+ // ../../node_modules/.pnpm/c12@2.0.1/node_modules/c12/dist/shared/c12.B4fc1S0C.mjs
1304
+ var dotenv = __toESM(require_main(), 1);
1305
+ async function setupDotenv(options) {
1306
+ const targetEnvironment = options.env ?? process.env;
1307
+ const environment = await loadDotenv({
1308
+ cwd: options.cwd,
1309
+ fileName: options.fileName ?? ".env",
1310
+ env: targetEnvironment,
1311
+ interpolate: options.interpolate ?? true
1312
+ });
1313
+ for (const key in environment) {
1314
+ if (!key.startsWith("_") && targetEnvironment[key] === void 0) {
1315
+ targetEnvironment[key] = environment[key];
1316
+ }
1317
+ }
1318
+ return environment;
1319
+ }
1320
+ __name(setupDotenv, "setupDotenv");
1321
+ async function loadDotenv(options) {
1322
+ const environment = /* @__PURE__ */ Object.create(null);
1323
+ const dotenvFile = resolve(options.cwd, options.fileName);
1324
+ if (existsSync2(dotenvFile)) {
1325
+ const parsed = dotenv.parse(await promises.readFile(dotenvFile, "utf8"));
1326
+ Object.assign(environment, parsed);
1327
+ }
1328
+ if (!options.env?._applied) {
1329
+ Object.assign(environment, options.env);
1330
+ environment._applied = true;
1331
+ }
1332
+ if (options.interpolate) {
1333
+ interpolate(environment);
1334
+ }
1335
+ return environment;
1336
+ }
1337
+ __name(loadDotenv, "loadDotenv");
1338
+ function interpolate(target, source = {}, parse3 = (v) => v) {
1339
+ function getValue(key) {
1340
+ return source[key] === void 0 ? target[key] : source[key];
1341
+ }
1342
+ __name(getValue, "getValue");
1343
+ function interpolate2(value, parents = []) {
1344
+ if (typeof value !== "string") {
1345
+ return value;
1346
+ }
1347
+ const matches = value.match(/(.?\${?(?:[\w:]+)?}?)/g) || [];
1348
+ return parse3(
1349
+ // eslint-disable-next-line unicorn/no-array-reduce
1350
+ matches.reduce((newValue, match) => {
1351
+ const parts = /(.?)\${?([\w:]+)?}?/g.exec(match) || [];
1352
+ const prefix = parts[1];
1353
+ let value2, replacePart;
1354
+ if (prefix === "\\") {
1355
+ replacePart = parts[0] || "";
1356
+ value2 = replacePart.replace(String.raw`\$`, "$");
1357
+ } else {
1358
+ const key = parts[2];
1359
+ replacePart = (parts[0] || "").slice(prefix.length);
1360
+ if (parents.includes(key)) {
1361
+ console.warn(
1362
+ `Please avoid recursive environment variables ( loop: ${parents.join(
1363
+ " > "
1364
+ )} > ${key} )`
1365
+ );
1366
+ return "";
1367
+ }
1368
+ value2 = getValue(key);
1369
+ value2 = interpolate2(value2, [...parents, key]);
1370
+ }
1371
+ return value2 === void 0 ? newValue : newValue.replace(replacePart, value2);
1372
+ }, value)
1373
+ );
1374
+ }
1375
+ __name(interpolate2, "interpolate2");
1376
+ for (const key in target) {
1377
+ target[key] = interpolate2(getValue(key));
1378
+ }
1379
+ }
1380
+ __name(interpolate, "interpolate");
1381
+ var _normalize = /* @__PURE__ */ __name((p) => p?.replace(/\\/g, "/"), "_normalize");
1382
+ var ASYNC_LOADERS = {
1383
+ ".yaml": /* @__PURE__ */ __name(() => import("./yaml-KYTKYGLP.mjs").then((r) => r.parseYAML), ".yaml"),
1384
+ ".yml": /* @__PURE__ */ __name(() => import("./yaml-KYTKYGLP.mjs").then((r) => r.parseYAML), ".yml"),
1385
+ ".jsonc": /* @__PURE__ */ __name(() => import("./jsonc-QMXWMKWV.mjs").then((r) => r.parseJSONC), ".jsonc"),
1386
+ ".json5": /* @__PURE__ */ __name(() => import("./json5-PFHFTE3S.mjs").then((r) => r.parseJSON5), ".json5"),
1387
+ ".toml": /* @__PURE__ */ __name(() => import("./toml-5DG5WNM7.mjs").then((r) => r.parseTOML), ".toml")
1388
+ };
1389
+ var SUPPORTED_EXTENSIONS = [
1390
+ // with jiti
1391
+ ".js",
1392
+ ".ts",
1393
+ ".mjs",
1394
+ ".cjs",
1395
+ ".mts",
1396
+ ".cts",
1397
+ ".json",
1398
+ // with confbox
1399
+ ".jsonc",
1400
+ ".json5",
1401
+ ".yaml",
1402
+ ".yml",
1403
+ ".toml"
1404
+ ];
1405
+ async function loadConfig(options) {
1406
+ options.cwd = resolve(process.cwd(), options.cwd || ".");
1407
+ options.name = options.name || "config";
1408
+ options.envName = options.envName ?? process.env.NODE_ENV;
1409
+ options.configFile = options.configFile ?? (options.name === "config" ? "config" : `${options.name}.config`);
1410
+ options.rcFile = options.rcFile ?? `.${options.name}rc`;
1411
+ if (options.extend !== false) {
1412
+ options.extend = {
1413
+ extendKey: "extends",
1414
+ ...options.extend
1415
+ };
1416
+ }
1417
+ const _merger = options.merger || defu;
1418
+ options.jiti = options.jiti || createJiti(join(options.cwd, options.configFile), {
1419
+ interopDefault: true,
1420
+ moduleCache: false,
1421
+ extensions: [...SUPPORTED_EXTENSIONS],
1422
+ ...options.jitiOptions
1423
+ });
1424
+ const r = {
1425
+ config: {},
1426
+ cwd: options.cwd,
1427
+ configFile: resolve(options.cwd, options.configFile),
1428
+ layers: []
1429
+ };
1430
+ const _configs = {
1431
+ overrides: options.overrides,
1432
+ main: void 0,
1433
+ rc: void 0,
1434
+ packageJson: void 0,
1435
+ defaultConfig: options.defaultConfig
1436
+ };
1437
+ if (options.dotenv) {
1438
+ await setupDotenv({
1439
+ cwd: options.cwd,
1440
+ ...options.dotenv === true ? {} : options.dotenv
1441
+ });
1442
+ }
1443
+ const _mainConfig = await resolveConfig(".", options);
1444
+ if (_mainConfig.configFile) {
1445
+ _configs.main = _mainConfig.config;
1446
+ r.configFile = _mainConfig.configFile;
1447
+ }
1448
+ if (options.rcFile) {
1449
+ const rcSources = [];
1450
+ rcSources.push(read({ name: options.rcFile, dir: options.cwd }));
1451
+ if (options.globalRc) {
1452
+ const workspaceDir = await findWorkspaceDir(options.cwd).catch(() => {
1453
+ });
1454
+ if (workspaceDir) {
1455
+ rcSources.push(read({ name: options.rcFile, dir: workspaceDir }));
1456
+ }
1457
+ rcSources.push(readUser({ name: options.rcFile, dir: options.cwd }));
1458
+ }
1459
+ _configs.rc = _merger({}, ...rcSources);
1460
+ }
1461
+ if (options.packageJson) {
1462
+ const keys = (Array.isArray(options.packageJson) ? options.packageJson : [
1463
+ typeof options.packageJson === "string" ? options.packageJson : options.name
1464
+ ]).filter((t) => t && typeof t === "string");
1465
+ const pkgJsonFile = await readPackageJSON(options.cwd).catch(() => {
1466
+ });
1467
+ const values = keys.map((key) => pkgJsonFile?.[key]);
1468
+ _configs.packageJson = _merger({}, ...values);
1469
+ }
1470
+ const configs = {};
1471
+ for (const key in _configs) {
1472
+ const value = _configs[key];
1473
+ configs[key] = await (typeof value === "function" ? value({ configs }) : value);
1474
+ }
1475
+ r.config = _merger(
1476
+ configs.overrides,
1477
+ configs.main,
1478
+ configs.rc,
1479
+ configs.packageJson,
1480
+ configs.defaultConfig
1481
+ );
1482
+ if (options.extend) {
1483
+ await extendConfig(r.config, options);
1484
+ r.layers = r.config._layers;
1485
+ delete r.config._layers;
1486
+ r.config = _merger(r.config, ...r.layers.map((e) => e.config));
1487
+ }
1488
+ const baseLayers = [
1489
+ configs.overrides && {
1490
+ config: configs.overrides,
1491
+ configFile: void 0,
1492
+ cwd: void 0
1493
+ },
1494
+ { config: configs.main, configFile: options.configFile, cwd: options.cwd },
1495
+ configs.rc && { config: configs.rc, configFile: options.rcFile },
1496
+ configs.packageJson && {
1497
+ config: configs.packageJson,
1498
+ configFile: "package.json"
1499
+ }
1500
+ ].filter((l) => l && l.config);
1501
+ r.layers = [...baseLayers, ...r.layers];
1502
+ if (options.defaults) {
1503
+ r.config = _merger(r.config, options.defaults);
1504
+ }
1505
+ if (options.omit$Keys) {
1506
+ for (const key in r.config) {
1507
+ if (key.startsWith("$")) {
1508
+ delete r.config[key];
1509
+ }
1510
+ }
1511
+ }
1512
+ return r;
1513
+ }
1514
+ __name(loadConfig, "loadConfig");
1515
+ async function extendConfig(config, options) {
1516
+ config._layers = config._layers || [];
1517
+ if (!options.extend) {
1518
+ return;
1519
+ }
1520
+ let keys = options.extend.extendKey;
1521
+ if (typeof keys === "string") {
1522
+ keys = [keys];
1523
+ }
1524
+ const extendSources = [];
1525
+ for (const key of keys) {
1526
+ extendSources.push(
1527
+ ...(Array.isArray(config[key]) ? config[key] : [config[key]]).filter(
1528
+ Boolean
1529
+ )
1530
+ );
1531
+ delete config[key];
1532
+ }
1533
+ for (let extendSource of extendSources) {
1534
+ const originalExtendSource = extendSource;
1535
+ let sourceOptions = {};
1536
+ if (extendSource.source) {
1537
+ sourceOptions = extendSource.options || {};
1538
+ extendSource = extendSource.source;
1539
+ }
1540
+ if (Array.isArray(extendSource)) {
1541
+ sourceOptions = extendSource[1] || {};
1542
+ extendSource = extendSource[0];
1543
+ }
1544
+ if (typeof extendSource !== "string") {
1545
+ console.warn(
1546
+ `Cannot extend config from \`${JSON.stringify(
1547
+ originalExtendSource
1548
+ )}\` in ${options.cwd}`
1549
+ );
1550
+ continue;
1551
+ }
1552
+ const _config = await resolveConfig(extendSource, options, sourceOptions);
1553
+ if (!_config.config) {
1554
+ console.warn(
1555
+ `Cannot extend config from \`${extendSource}\` in ${options.cwd}`
1556
+ );
1557
+ continue;
1558
+ }
1559
+ await extendConfig(_config.config, { ...options, cwd: _config.cwd });
1560
+ config._layers.push(_config);
1561
+ if (_config.config._layers) {
1562
+ config._layers.push(..._config.config._layers);
1563
+ delete _config.config._layers;
1564
+ }
1565
+ }
1566
+ }
1567
+ __name(extendConfig, "extendConfig");
1568
+ var GIGET_PREFIXES = [
1569
+ "gh:",
1570
+ "github:",
1571
+ "gitlab:",
1572
+ "bitbucket:",
1573
+ "https://",
1574
+ "http://"
1575
+ ];
1576
+ var NPM_PACKAGE_RE = /^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;
1577
+ async function resolveConfig(source, options, sourceOptions = {}) {
1578
+ if (options.resolve) {
1579
+ const res2 = await options.resolve(source, options);
1580
+ if (res2) {
1581
+ return res2;
1582
+ }
1583
+ }
1584
+ const _merger = options.merger || defu;
1585
+ if (options.giget !== false && GIGET_PREFIXES.some((prefix) => source.startsWith(prefix))) {
1586
+ const { downloadTemplate } = await import("./dist-ESY54GEK.mjs");
1587
+ const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + hash(source);
1588
+ let cloneDir;
1589
+ const localNodeModules = resolve(options.cwd, "node_modules");
1590
+ const parentDir = dirname(options.cwd);
1591
+ if (basename(parentDir) === ".c12") {
1592
+ cloneDir = join(parentDir, cloneName);
1593
+ } else if (existsSync2(localNodeModules)) {
1594
+ cloneDir = join(localNodeModules, ".c12", cloneName);
1595
+ } else {
1596
+ cloneDir = process.env.XDG_CACHE_HOME ? resolve(process.env.XDG_CACHE_HOME, "c12", cloneName) : resolve(homedir2(), ".cache/c12", cloneName);
1597
+ }
1598
+ if (existsSync2(cloneDir) && !sourceOptions.install) {
1599
+ await rm(cloneDir, { recursive: true });
1600
+ }
1601
+ const cloned = await downloadTemplate(source, {
1602
+ dir: cloneDir,
1603
+ install: sourceOptions.install,
1604
+ force: sourceOptions.install,
1605
+ auth: sourceOptions.auth,
1606
+ ...options.giget,
1607
+ ...sourceOptions.giget
1608
+ });
1609
+ source = cloned.dir;
1610
+ }
1611
+ const tryResolve = /* @__PURE__ */ __name((id) => {
1612
+ const resolved = options.jiti.esmResolve(id, { try: true });
1613
+ return resolved ? fileURLToPath(resolved) : void 0;
1614
+ }, "tryResolve");
1615
+ if (NPM_PACKAGE_RE.test(source)) {
1616
+ source = tryResolve(source) || source;
1617
+ }
1618
+ const ext = extname(source);
1619
+ const isDir = !ext || ext === basename(source);
1620
+ const cwd = resolve(options.cwd, isDir ? source : dirname(source));
1621
+ if (isDir) {
1622
+ source = options.configFile;
1623
+ }
1624
+ const res = {
1625
+ config: void 0,
1626
+ configFile: void 0,
1627
+ cwd,
1628
+ source,
1629
+ sourceOptions
1630
+ };
1631
+ res.configFile = tryResolve(resolve(cwd, source)) || tryResolve(resolve(cwd, ".config", source.replace(/\.config$/, ""))) || tryResolve(resolve(cwd, ".config", source)) || source;
1632
+ if (!existsSync2(res.configFile)) {
1633
+ return res;
1634
+ }
1635
+ const configFileExt = extname(res.configFile) || "";
1636
+ if (configFileExt in ASYNC_LOADERS) {
1637
+ const asyncLoader = await ASYNC_LOADERS[configFileExt]();
1638
+ const contents = await readFile(res.configFile, "utf8");
1639
+ res.config = asyncLoader(contents);
1640
+ } else {
1641
+ res.config = await options.jiti.import(res.configFile, {
1642
+ default: true
1643
+ });
1644
+ }
1645
+ if (res.config instanceof Function) {
1646
+ res.config = await res.config();
1647
+ }
1648
+ if (options.envName) {
1649
+ const envConfig = {
1650
+ ...res.config["$" + options.envName],
1651
+ ...res.config.$env?.[options.envName]
1652
+ };
1653
+ if (Object.keys(envConfig).length > 0) {
1654
+ res.config = _merger(envConfig, res.config);
1655
+ }
1656
+ }
1657
+ res.meta = defu(res.sourceOptions.meta, res.config.$meta);
1658
+ delete res.config.$meta;
1659
+ if (res.sourceOptions.overrides) {
1660
+ res.config = _merger(res.sourceOptions.overrides, res.config);
1661
+ }
1662
+ res.configFile = _normalize(res.configFile);
1663
+ res.source = _normalize(res.source);
1664
+ return res;
1665
+ }
1666
+ __name(resolveConfig, "resolveConfig");
1667
+
1668
+ // ../../node_modules/.pnpm/c12@2.0.1/node_modules/c12/dist/index.mjs
1669
+ import "jiti";
1670
+ var import_dotenv = __toESM(require_main(), 1);
1671
+
1672
+ // src/config-file/get-config-file.ts
1673
+ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
1674
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
1675
+ let config = await loadConfig({
1676
+ cwd: workspacePath,
1677
+ packageJson: true,
1678
+ name: fileName,
1679
+ envName: fileName?.toUpperCase(),
1680
+ jitiOptions: {
1681
+ debug: false,
1682
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
1683
+ },
1684
+ ...options
1685
+ });
1686
+ if (!config || Object.keys(config).length === 0) {
1687
+ config = await loadConfig({
1688
+ cwd: workspacePath,
1689
+ packageJson: true,
1690
+ name: fileName,
1691
+ envName: fileName?.toUpperCase(),
1692
+ jitiOptions: {
1693
+ debug: false,
1694
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
1695
+ },
1696
+ configFile: fileName,
1697
+ ...options
1698
+ });
1699
+ }
1700
+ return config;
1701
+ }, "getConfigFileByName");
1702
+ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
1703
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
1704
+ const result = await getConfigFileByName("storm", workspacePath);
1705
+ let config = result.config;
1706
+ const configFile = result.configFile;
1707
+ if (config && configFile && Object.keys(config).length > 0) {
1708
+ writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
1709
+ logLevel: "all"
1710
+ });
1711
+ }
1712
+ if (additionalFileNames && additionalFileNames.length > 0) {
1713
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
1714
+ for (const result2 of results) {
1715
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
1716
+ writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
1717
+ logLevel: "all"
1718
+ });
1719
+ config = defu(result2.config ?? {}, config ?? {});
1720
+ }
1721
+ }
1722
+ }
1723
+ if (!config) {
1724
+ return void 0;
1725
+ }
1726
+ config.configFile = configFile;
1727
+ return config;
1728
+ }, "getConfigFile");
1729
+
1730
+ export {
1731
+ getConfigFileByName,
1732
+ getConfigFile
1733
+ };