@storm-software/tsup 0.1.1 → 0.2.1

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.
@@ -0,0 +1,1712 @@
1
+ import {
2
+ DEFAULT_BUILD_OPTIONS,
3
+ getEnv
4
+ } from "./chunk-MUIYLO6F.js";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-7BI4SQSF.js";
8
+
9
+ // src/options.ts
10
+ init_esm_shims();
11
+ import {
12
+ createProjectGraphAsync,
13
+ readProjectsConfigurationFromProjectGraph
14
+ } from "@nx/devkit";
15
+
16
+ // ../config-tools/dist/get-config.js
17
+ init_esm_shims();
18
+
19
+ // ../config-tools/dist/chunk-WOLTMI7X.js
20
+ init_esm_shims();
21
+
22
+ // ../config-tools/dist/chunk-R7MTORRG.js
23
+ init_esm_shims();
24
+
25
+ // ../config-tools/dist/chunk-RZM3NYPM.js
26
+ init_esm_shims();
27
+
28
+ // ../config-tools/dist/chunk-4A2P7H63.js
29
+ init_esm_shims();
30
+
31
+ // ../config-tools/dist/chunk-6JBGUE4A.js
32
+ init_esm_shims();
33
+ import { existsSync } from "node:fs";
34
+ import { join } from "node:path";
35
+ var MAX_PATH_SEARCH_DEPTH = 30;
36
+ var depth = 0;
37
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
38
+ const _startPath = startPath ?? process.cwd();
39
+ if (endDirectoryNames.some(
40
+ (endDirName) => existsSync(join(_startPath, endDirName))
41
+ )) {
42
+ return _startPath;
43
+ }
44
+ if (endFileNames.some(
45
+ (endFileName) => existsSync(join(_startPath, endFileName))
46
+ )) {
47
+ return _startPath;
48
+ }
49
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
50
+ const parent = join(_startPath, "..");
51
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
52
+ }
53
+ return void 0;
54
+ }
55
+
56
+ // ../config-tools/dist/chunk-V3GMJ4TX.js
57
+ init_esm_shims();
58
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
59
+ function normalizeWindowsPath(input = "") {
60
+ if (!input) {
61
+ return input;
62
+ }
63
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r3) => r3.toUpperCase());
64
+ }
65
+ var _UNC_REGEX = /^[/\\]{2}/;
66
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
67
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
68
+ var correctPaths = function(path) {
69
+ if (!path || path.length === 0) {
70
+ return ".";
71
+ }
72
+ path = normalizeWindowsPath(path);
73
+ const isUNCPath = path?.match(_UNC_REGEX);
74
+ const isPathAbsolute = isAbsolute(path);
75
+ const trailingSeparator = path[path.length - 1] === "/";
76
+ path = normalizeString(path, !isPathAbsolute);
77
+ if (path.length === 0) {
78
+ if (isPathAbsolute) {
79
+ return "/";
80
+ }
81
+ return trailingSeparator ? "./" : ".";
82
+ }
83
+ if (trailingSeparator) {
84
+ path += "/";
85
+ }
86
+ if (_DRIVE_LETTER_RE.test(path)) {
87
+ path += "/";
88
+ }
89
+ if (isUNCPath) {
90
+ if (!isPathAbsolute) {
91
+ return `//./${path}`;
92
+ }
93
+ return `//${path}`;
94
+ }
95
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
96
+ };
97
+ var joinPaths = function(...segments) {
98
+ let path = "";
99
+ for (const seg of segments) {
100
+ if (!seg) {
101
+ continue;
102
+ }
103
+ if (path.length > 0) {
104
+ const pathTrailing = path[path.length - 1] === "/";
105
+ const segLeading = seg[0] === "/";
106
+ const both = pathTrailing && segLeading;
107
+ if (both) {
108
+ path += seg.slice(1);
109
+ } else {
110
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
111
+ }
112
+ } else {
113
+ path += seg;
114
+ }
115
+ }
116
+ return correctPaths(path);
117
+ };
118
+ function normalizeString(path, allowAboveRoot) {
119
+ let res = "";
120
+ let lastSegmentLength = 0;
121
+ let lastSlash = -1;
122
+ let dots = 0;
123
+ let char = null;
124
+ for (let index = 0; index <= path.length; ++index) {
125
+ if (index < path.length) {
126
+ char = path[index];
127
+ } else if (char === "/") {
128
+ break;
129
+ } else {
130
+ char = "/";
131
+ }
132
+ if (char === "/") {
133
+ if (lastSlash === index - 1 || dots === 1) {
134
+ } else if (dots === 2) {
135
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
136
+ if (res.length > 2) {
137
+ const lastSlashIndex = res.lastIndexOf("/");
138
+ if (lastSlashIndex === -1) {
139
+ res = "";
140
+ lastSegmentLength = 0;
141
+ } else {
142
+ res = res.slice(0, lastSlashIndex);
143
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
144
+ }
145
+ lastSlash = index;
146
+ dots = 0;
147
+ continue;
148
+ } else if (res.length > 0) {
149
+ res = "";
150
+ lastSegmentLength = 0;
151
+ lastSlash = index;
152
+ dots = 0;
153
+ continue;
154
+ }
155
+ }
156
+ if (allowAboveRoot) {
157
+ res += res.length > 0 ? "/.." : "..";
158
+ lastSegmentLength = 2;
159
+ }
160
+ } else {
161
+ if (res.length > 0) {
162
+ res += `/${path.slice(lastSlash + 1, index)}`;
163
+ } else {
164
+ res = path.slice(lastSlash + 1, index);
165
+ }
166
+ lastSegmentLength = index - lastSlash - 1;
167
+ }
168
+ lastSlash = index;
169
+ dots = 0;
170
+ } else if (char === "." && dots !== -1) {
171
+ ++dots;
172
+ } else {
173
+ dots = -1;
174
+ }
175
+ }
176
+ return res;
177
+ }
178
+ var isAbsolute = function(p3) {
179
+ return _IS_ABSOLUTE_RE.test(p3);
180
+ };
181
+
182
+ // ../config-tools/dist/chunk-4A2P7H63.js
183
+ var rootFiles = [
184
+ "storm-workspace.json",
185
+ "storm-workspace.yaml",
186
+ "storm-workspace.yml",
187
+ "storm-workspace.js",
188
+ "storm-workspace.ts",
189
+ ".storm-workspace.json",
190
+ ".storm-workspace.yaml",
191
+ ".storm-workspace.yml",
192
+ ".storm-workspace.js",
193
+ ".storm-workspace.ts",
194
+ "lerna.json",
195
+ "nx.json",
196
+ "turbo.json",
197
+ "npm-workspace.json",
198
+ "yarn-workspace.json",
199
+ "pnpm-workspace.json",
200
+ "npm-workspace.yaml",
201
+ "yarn-workspace.yaml",
202
+ "pnpm-workspace.yaml",
203
+ "npm-workspace.yml",
204
+ "yarn-workspace.yml",
205
+ "pnpm-workspace.yml",
206
+ "npm-lock.json",
207
+ "yarn-lock.json",
208
+ "pnpm-lock.json",
209
+ "npm-lock.yaml",
210
+ "yarn-lock.yaml",
211
+ "pnpm-lock.yaml",
212
+ "npm-lock.yml",
213
+ "yarn-lock.yml",
214
+ "pnpm-lock.yml",
215
+ "bun.lockb"
216
+ ];
217
+ var rootDirectories = [
218
+ ".storm-workspace",
219
+ ".nx",
220
+ ".git",
221
+ ".github",
222
+ ".vscode",
223
+ ".verdaccio"
224
+ ];
225
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
226
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
227
+ return correctPaths(
228
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
229
+ );
230
+ }
231
+ return correctPaths(
232
+ findFolderUp(
233
+ pathInsideMonorepo ?? process.cwd(),
234
+ rootFiles,
235
+ rootDirectories
236
+ )
237
+ );
238
+ }
239
+ function findWorkspaceRoot(pathInsideMonorepo) {
240
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
241
+ if (!result) {
242
+ throw new Error(
243
+ `Cannot find workspace root upwards from known path. Files search list includes:
244
+ ${rootFiles.join(
245
+ "\n"
246
+ )}
247
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
248
+ );
249
+ }
250
+ return result;
251
+ }
252
+
253
+ // ../config-tools/dist/chunk-7L77OWOV.js
254
+ init_esm_shims();
255
+
256
+ // ../config-tools/dist/chunk-LA3S35UI.js
257
+ init_esm_shims();
258
+ var DEFAULT_COLOR_CONFIG = {
259
+ light: {
260
+ background: "#fafafa",
261
+ foreground: "#1d1e22",
262
+ brand: "#1fb2a6",
263
+ alternate: "#db2777",
264
+ help: "#5C4EE5",
265
+ success: "#087f5b",
266
+ info: "#0550ae",
267
+ warning: "#e3b341",
268
+ danger: "#D8314A",
269
+ fatal: "#51070f",
270
+ link: "#3fa6ff",
271
+ positive: "#22c55e",
272
+ negative: "#dc2626",
273
+ gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
274
+ },
275
+ dark: {
276
+ background: "#1d1e22",
277
+ foreground: "#cbd5e1",
278
+ brand: "#2dd4bf",
279
+ alternate: "#db2777",
280
+ help: "#818cf8",
281
+ success: "#10b981",
282
+ info: "#58a6ff",
283
+ warning: "#f3d371",
284
+ danger: "#D8314A",
285
+ fatal: "#a40e26",
286
+ link: "#3fa6ff",
287
+ positive: "#22c55e",
288
+ negative: "#dc2626",
289
+ gradient: ["#1fb2a6", "#db2777", "#818cf8"]
290
+ }
291
+ };
292
+
293
+ // ../config-tools/dist/chunk-HVVJHTFS.js
294
+ init_esm_shims();
295
+ import chalk from "chalk";
296
+ var chalkDefault = {
297
+ hex: (_3) => (message) => message,
298
+ bgHex: (_3) => ({
299
+ whiteBright: (message) => message,
300
+ white: (message) => message
301
+ }),
302
+ white: (message) => message,
303
+ whiteBright: (message) => message,
304
+ gray: (message) => message,
305
+ bold: {
306
+ hex: (_3) => (message) => message,
307
+ bgHex: (_3) => ({
308
+ whiteBright: (message) => message,
309
+ white: (message) => message
310
+ }),
311
+ whiteBright: (message) => message,
312
+ white: (message) => message
313
+ },
314
+ dim: {
315
+ hex: (_3) => (message) => message,
316
+ gray: (message) => message
317
+ }
318
+ };
319
+ var getChalk = () => {
320
+ let _chalk = chalk;
321
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
322
+ _chalk = chalkDefault;
323
+ }
324
+ return _chalk;
325
+ };
326
+
327
+ // ../config-tools/dist/chunk-LM2UMGYA.js
328
+ init_esm_shims();
329
+
330
+ // ../config-tools/dist/chunk-G2MK47WL.js
331
+ init_esm_shims();
332
+ function isUnicodeSupported() {
333
+ if (process.platform !== "win32") {
334
+ return process.env.TERM !== "linux";
335
+ }
336
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
337
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
338
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
339
+ process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
340
+ }
341
+
342
+ // ../config-tools/dist/chunk-POXTJ6GF.js
343
+ init_esm_shims();
344
+ var LogLevel = {
345
+ SILENT: 0,
346
+ FATAL: 10,
347
+ ERROR: 20,
348
+ WARN: 30,
349
+ SUCCESS: 35,
350
+ INFO: 40,
351
+ DEBUG: 60,
352
+ TRACE: 70,
353
+ ALL: 100
354
+ };
355
+ var LogLevelLabel = {
356
+ SILENT: "silent",
357
+ FATAL: "fatal",
358
+ ERROR: "error",
359
+ WARN: "warn",
360
+ SUCCESS: "success",
361
+ INFO: "info",
362
+ DEBUG: "debug",
363
+ TRACE: "trace",
364
+ ALL: "all"
365
+ };
366
+
367
+ // ../config-tools/dist/chunk-LM2UMGYA.js
368
+ var useIcon = (c3, fallback) => isUnicodeSupported() ? c3 : fallback;
369
+ var CONSOLE_ICONS = {
370
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
371
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
372
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
373
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
374
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
375
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
376
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
377
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
378
+ };
379
+
380
+ // ../config-tools/dist/chunk-CZ4IE2QN.js
381
+ init_esm_shims();
382
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
383
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
384
+ };
385
+
386
+ // ../config-tools/dist/chunk-K4CDYUQR.js
387
+ init_esm_shims();
388
+ var getLogLevel = (label) => {
389
+ switch (label) {
390
+ case "all":
391
+ return LogLevel.ALL;
392
+ case "trace":
393
+ return LogLevel.TRACE;
394
+ case "debug":
395
+ return LogLevel.DEBUG;
396
+ case "info":
397
+ return LogLevel.INFO;
398
+ case "warn":
399
+ return LogLevel.WARN;
400
+ case "error":
401
+ return LogLevel.ERROR;
402
+ case "fatal":
403
+ return LogLevel.FATAL;
404
+ case "silent":
405
+ return LogLevel.SILENT;
406
+ default:
407
+ return LogLevel.INFO;
408
+ }
409
+ };
410
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
411
+ if (logLevel >= LogLevel.ALL) {
412
+ return LogLevelLabel.ALL;
413
+ }
414
+ if (logLevel >= LogLevel.TRACE) {
415
+ return LogLevelLabel.TRACE;
416
+ }
417
+ if (logLevel >= LogLevel.DEBUG) {
418
+ return LogLevelLabel.DEBUG;
419
+ }
420
+ if (logLevel >= LogLevel.INFO) {
421
+ return LogLevelLabel.INFO;
422
+ }
423
+ if (logLevel >= LogLevel.WARN) {
424
+ return LogLevelLabel.WARN;
425
+ }
426
+ if (logLevel >= LogLevel.ERROR) {
427
+ return LogLevelLabel.ERROR;
428
+ }
429
+ if (logLevel >= LogLevel.FATAL) {
430
+ return LogLevelLabel.FATAL;
431
+ }
432
+ if (logLevel <= LogLevel.SILENT) {
433
+ return LogLevelLabel.SILENT;
434
+ }
435
+ return LogLevelLabel.INFO;
436
+ };
437
+
438
+ // ../config-tools/dist/chunk-7L77OWOV.js
439
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
440
+ const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
441
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
442
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
443
+ return (_3) => {
444
+ };
445
+ }
446
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
447
+ return (message) => {
448
+ console.error(
449
+ `
450
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
451
+ `
452
+ );
453
+ };
454
+ }
455
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
456
+ return (message) => {
457
+ console.error(
458
+ `
459
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
460
+ `
461
+ );
462
+ };
463
+ }
464
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
465
+ return (message) => {
466
+ console.warn(
467
+ `
468
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
469
+ `
470
+ );
471
+ };
472
+ }
473
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
474
+ return (message) => {
475
+ console.info(
476
+ `
477
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
478
+ `
479
+ );
480
+ };
481
+ }
482
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
483
+ return (message) => {
484
+ console.info(
485
+ `
486
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
487
+ `
488
+ );
489
+ };
490
+ }
491
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
492
+ return (message) => {
493
+ console.debug(
494
+ `
495
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
496
+ `
497
+ );
498
+ };
499
+ }
500
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
501
+ return (message) => {
502
+ console.debug(
503
+ `
504
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
505
+ `
506
+ );
507
+ };
508
+ }
509
+ return (message) => {
510
+ console.log(
511
+ `
512
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
513
+ `
514
+ );
515
+ };
516
+ };
517
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
518
+ var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
519
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
520
+ var getStopwatch = (name) => {
521
+ const start = process.hrtime();
522
+ return () => {
523
+ const end = process.hrtime(start);
524
+ console.info(
525
+ `
526
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
527
+ end[0] * 1e3 + end[1] / 1e6
528
+ )}ms to complete
529
+ `
530
+ );
531
+ };
532
+ };
533
+ var MAX_DEPTH = 4;
534
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
535
+ if (depth2 > MAX_DEPTH) {
536
+ return "<max depth>";
537
+ }
538
+ const prefix = options.prefix ?? "-";
539
+ const skip = options.skip ?? [];
540
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
541
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
542
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
543
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
544
+ message[key],
545
+ { prefix: `${prefix}-`, skip },
546
+ depth2 + 1
547
+ ) : message[key]}`
548
+ ).join("\n")}` : message;
549
+ };
550
+ var _isFunction = (value) => {
551
+ try {
552
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
553
+ } catch {
554
+ return false;
555
+ }
556
+ };
557
+
558
+ // ../config-tools/dist/chunk-RZM3NYPM.js
559
+ import { loadConfig } from "c12";
560
+ import defu from "defu";
561
+ var getConfigFileByName = async (fileName, filePath, options = {}) => {
562
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
563
+ const configs = await Promise.all([
564
+ loadConfig({
565
+ cwd: workspacePath,
566
+ packageJson: true,
567
+ name: fileName,
568
+ envName: fileName?.toUpperCase(),
569
+ jitiOptions: {
570
+ debug: false,
571
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
572
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
573
+ "jiti"
574
+ )
575
+ },
576
+ ...options
577
+ }),
578
+ loadConfig({
579
+ cwd: workspacePath,
580
+ packageJson: true,
581
+ name: fileName,
582
+ envName: fileName?.toUpperCase(),
583
+ jitiOptions: {
584
+ debug: false,
585
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
586
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
587
+ "jiti"
588
+ )
589
+ },
590
+ configFile: fileName,
591
+ ...options
592
+ })
593
+ ]);
594
+ return defu(configs[0] ?? {}, configs[1] ?? {});
595
+ };
596
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
597
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
598
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
599
+ let config = result.config;
600
+ const configFile = result.configFile;
601
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
602
+ writeTrace(
603
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
604
+ {
605
+ logLevel: "all"
606
+ }
607
+ );
608
+ }
609
+ if (additionalFileNames && additionalFileNames.length > 0) {
610
+ const results = await Promise.all(
611
+ additionalFileNames.map(
612
+ (fileName) => getConfigFileByName(fileName, workspacePath)
613
+ )
614
+ );
615
+ for (const result2 of results) {
616
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
617
+ if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
618
+ writeTrace(
619
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
620
+ {
621
+ logLevel: "all"
622
+ }
623
+ );
624
+ }
625
+ config = defu(result2.config ?? {}, config ?? {});
626
+ }
627
+ }
628
+ }
629
+ if (!config || Object.keys(config).length === 0) {
630
+ return void 0;
631
+ }
632
+ config.configFile = configFile;
633
+ return config;
634
+ };
635
+
636
+ // ../config-tools/dist/chunk-OEBHWAYK.js
637
+ init_esm_shims();
638
+
639
+ // ../config/dist/index.js
640
+ init_esm_shims();
641
+
642
+ // ../config/dist/chunk-5QIMO5EY.js
643
+ init_esm_shims();
644
+
645
+ // ../config/dist/chunk-ZXJP5Q3G.js
646
+ init_esm_shims();
647
+
648
+ // ../config/dist/chunk-TYDRIJER.js
649
+ init_esm_shims();
650
+ var s = "https://docs.stormsoftware.com";
651
+ var r = "https://stormsoftware.com";
652
+ var t = "https://stormsoftware.com/contact";
653
+ var a = "https://stormsoftware.com/license";
654
+ var i = "Apache-2.0";
655
+ var o = "https://discord.gg/MQ6YVzakM5";
656
+ var e = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
657
+ var E = `
658
+ Storm Software is an open source software development organization with the mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
659
+
660
+ Join us on [Discord](${o}) to chat with the team, receive release notifications, ask questions, and get involved.
661
+
662
+ If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](${t}) or join our [Slack](${e}) channel!
663
+ `;
664
+ var S = "tools/errors/codes.json";
665
+ var A = "The workspace's banner image";
666
+
667
+ // ../config/dist/chunk-ZXJP5Q3G.js
668
+ import * as e2 from "zod/mini";
669
+ var o2 = e2.registry();
670
+ var t2 = e2.string().check(e2.length(7), e2.toLowerCase(), e2.regex(/^#([0-9a-f]{3}){1,2}$/i), e2.trim());
671
+ o2.add(t2, { description: "A base schema for describing the format of colors" });
672
+ var a2 = e2._default(t2, "#151718");
673
+ o2.add(a2, { description: "The dark background color of the workspace" });
674
+ var i2 = e2._default(t2, "#cbd5e1");
675
+ o2.add(i2, { description: "The light background color of the workspace" });
676
+ var c = e2._default(t2, "#1fb2a6");
677
+ o2.add(c, { description: "The primary brand specific color of the workspace" });
678
+ var s2 = e2.optional(t2);
679
+ o2.add(s2, { description: "The alternate brand specific color of the workspace" });
680
+ var n = e2.optional(t2);
681
+ o2.add(n, { description: "The secondary brand specific color of the workspace" });
682
+ var d = e2._default(t2, "#3fa6ff");
683
+ o2.add(d, { description: "The color used to display hyperlink text" });
684
+ var p = e2._default(t2, "#818cf8");
685
+ o2.add(p, { description: "The second brand specific color of the workspace" });
686
+ var h = e2._default(t2, "#45b27e");
687
+ o2.add(h, { description: "The success color of the workspace" });
688
+ var l = e2._default(t2, "#38bdf8");
689
+ o2.add(l, { description: "The informational color of the workspace" });
690
+ var m = e2._default(t2, "#f3d371");
691
+ o2.add(m, { description: "The warning color of the workspace" });
692
+ var z = e2._default(t2, "#d8314a");
693
+ o2.add(z, { description: "The danger color of the workspace" });
694
+ var g = e2.optional(t2);
695
+ o2.add(g, { description: "The fatal color of the workspace" });
696
+ var u = e2._default(t2, "#4ade80");
697
+ o2.add(u, { description: "The positive number color of the workspace" });
698
+ var f = e2._default(t2, "#ef4444");
699
+ o2.add(f, { description: "The negative number color of the workspace" });
700
+ var k = e2.optional(e2.array(t2));
701
+ o2.add(k, { description: "The color stops for the base gradient color pattern used in the workspace" });
702
+ var je = e2.object({ foreground: i2, background: a2, brand: c, alternate: s2, accent: n, link: d, help: p, success: h, info: l, warning: m, danger: z, fatal: g, positive: u, negative: f, gradient: k });
703
+ var Ae = e2.object({ foreground: a2, background: i2, brand: c, alternate: s2, accent: n, link: d, help: p, success: h, info: l, warning: m, danger: z, fatal: g, positive: u, negative: f, gradient: k });
704
+ var Re = e2.object({ dark: je, light: Ae });
705
+ var Ue = e2.object({ dark: a2, light: i2, brand: c, alternate: s2, accent: n, link: d, help: p, success: h, info: l, warning: m, danger: z, fatal: g, positive: u, negative: f, gradient: k });
706
+ var r2 = e2.optional(e2.url());
707
+ o2.add(r2, { description: "A remote registry URL used to publish distributable packages" });
708
+ var T = e2._default(e2.object({ github: r2, npm: r2, cargo: r2, cyclone: r2, container: r2 }), {});
709
+ o2.add(T, { description: "A list of remote registry URLs used by Storm Software" });
710
+ var w = e2.union([Ue, Re]);
711
+ o2.add(w, { description: "Colors used for various workspace elements" });
712
+ var v = e2.record(e2.union([e2.union([e2.literal("base"), e2.string()]), e2.string()]), w);
713
+ o2.add(v, { description: "Storm theme config values used for styling various package elements" });
714
+ var y = e2.optional(e2.union([e2.string().check(e2.trim()), e2.array(e2.string().check(e2.trim()))]));
715
+ o2.add(y, { description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration." });
716
+ var C = e2.string().check(e2.trim());
717
+ o2.add(C, { description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)" });
718
+ var _ = e2.string().check(e2.trim());
719
+ o2.add(_, { description: "The email of the workspace bot" });
720
+ var L = e2.object({ name: C, email: _ });
721
+ o2.add(L, { description: "The workspace's bot user's config used to automated various operations tasks" });
722
+ var j = e2.optional(e2.string().check(e2.trim(), e2.url()));
723
+ o2.add(j, { description: "A URL to a banner image used to display the workspace's release" });
724
+ var A2 = e2._default(e2.string().check(e2.trim()), A);
725
+ o2.add(A2, { description: "The alt text for the workspace's release banner image" });
726
+ var R = e2.object({ url: j, alt: A2 });
727
+ o2.add(R, { description: "The workspace's banner image used during the release process" });
728
+ var U = e2.optional(e2.string().check(e2.trim()));
729
+ o2.add(U, { description: "A header message appended to the start of the workspace's release notes" });
730
+ var D = e2.optional(e2.string().check(e2.trim()));
731
+ o2.add(D, { description: "A footer message appended to the end of the workspace's release notes" });
732
+ var B = e2.object({ banner: e2.union([R, e2.string().check(e2.trim(), e2.url())]), header: U, footer: D });
733
+ o2.add(B, { description: "The workspace's release config used during the release process" });
734
+ var F = e2.optional(e2.string().check(e2.trim()));
735
+ o2.add(F, { description: "A Twitter/X account associated with the organization/project" });
736
+ var N = e2.optional(e2.string().check(e2.trim()));
737
+ o2.add(N, { description: "A Discord account associated with the organization/project" });
738
+ var E2 = e2.optional(e2.string().check(e2.trim()));
739
+ o2.add(E2, { description: "A Telegram account associated with the organization/project" });
740
+ var M = e2.optional(e2.string().check(e2.trim()));
741
+ o2.add(M, { description: "A Slack account associated with the organization/project" });
742
+ var O = e2.optional(e2.string().check(e2.trim()));
743
+ o2.add(O, { description: "A Medium account associated with the organization/project" });
744
+ var I = e2.optional(e2.string().check(e2.trim()));
745
+ o2.add(I, { description: "A GitHub account associated with the organization/project" });
746
+ var G = e2.object({ twitter: F, discord: N, telegram: E2, slack: M, medium: O, github: I });
747
+ o2.add(G, { description: "The workspace's account config used to store various social media links" });
748
+ var H = e2.optional(e2.string().check(e2.trim()));
749
+ o2.add(H, { description: "The directory used to store the environment's cached file data" });
750
+ var J = e2.optional(e2.string().check(e2.trim()));
751
+ o2.add(J, { description: "The directory used to store the environment's data files" });
752
+ var W = e2.optional(e2.string().check(e2.trim()));
753
+ o2.add(W, { description: "The directory used to store the environment's configuration files" });
754
+ var P = e2.optional(e2.string().check(e2.trim()));
755
+ o2.add(P, { description: "The directory used to store the environment's temp files" });
756
+ var $ = e2.optional(e2.string().check(e2.trim()));
757
+ o2.add($, { description: "The directory used to store the environment's log files" });
758
+ var V = e2._default(e2.string().check(e2.trim()), "dist");
759
+ o2.add(V, { description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)" });
760
+ var X = e2.object({ cache: H, data: J, config: W, temp: P, log: $, build: V });
761
+ o2.add(X, { description: "Various directories used by the workspace to store data, cache, and configuration files" });
762
+ var Y = e2._default(e2.enum(["minimal", "monorepo"]), "monorepo");
763
+ o2.add(Y, { description: "The variant of the workspace. This can be used to enable or disable certain features or configurations." });
764
+ var q = e2._default(e2.string().check(e2.trim()), S);
765
+ o2.add(q, { description: "The path to the workspace's error codes JSON file" });
766
+ var K = e2.optional(e2.url());
767
+ o2.add(K, { description: "A URL to a page that looks up the workspace's error messages given a specific error code" });
768
+ var Q = e2.object({ codesFile: q, url: K });
769
+ o2.add(Q, { description: "The workspace's error config used when creating error details during a system error" });
770
+ var Z = e2.optional(e2.string().check(e2.trim(), e2.toLowerCase()));
771
+ o2.add(Z, { description: "The name of the organization" });
772
+ var ee = e2.optional(e2.string().check(e2.trim()));
773
+ o2.add(ee, { description: "A description of the organization" });
774
+ var oe = e2.optional(e2.url());
775
+ o2.add(oe, { description: "A URL to the organization's logo image" });
776
+ var te = e2.optional(e2.url());
777
+ o2.add(te, { description: "A URL to the organization's icon image" });
778
+ var re = e2.optional(e2.url());
779
+ o2.add(re, { description: "A URL to a page that provides more information about the organization" });
780
+ var ae = e2.object({ name: Z, description: ee, logo: oe, icon: te, url: re });
781
+ o2.add(ae, { description: "The workspace's organization details" });
782
+ var ie = e2._default(e2.string().check(e2.trim(), e2.toLowerCase()), "https://public.storm-cdn.com/schemas/storm-workspace.schema.json");
783
+ o2.add(ie, { description: "The URL or file path to the JSON schema file that describes the Storm configuration file" });
784
+ var ce = e2.string().check(e2.trim(), e2.toLowerCase());
785
+ o2.add(ce, { description: "The name of the workspace/project/service/package/scope using this configuration" });
786
+ var se = e2.string().check(e2.trim(), e2.toLowerCase());
787
+ o2.add(se, { description: "The namespace of the workspace/project/service/package/scope using this configuration" });
788
+ var ne = e2.union([ae, e2.string().check(e2.trim(), e2.toLowerCase())]);
789
+ o2.add(ne, { description: "The organization of the workspace. This can be a string or an object containing the organization's details" });
790
+ var de = e2.string().check(e2.trim(), e2.toLowerCase());
791
+ o2.add(de, { description: "The repo URL of the workspace (i.e. the GitHub repository URL)" });
792
+ var pe = e2._default(e2.string().check(e2.trim()), "Apache-2.0");
793
+ o2.add(pe, { description: "The license type of the package" });
794
+ var he = e2.optional(e2.url());
795
+ o2.add(he, { description: "The homepage of the workspace" });
796
+ var le = e2.optional(e2.url());
797
+ o2.add(le, { description: "The documentation site for the workspace" });
798
+ var me = e2.optional(e2.url());
799
+ o2.add(me, { description: "The development portal site for the workspace" });
800
+ var ze = e2.optional(e2.url());
801
+ o2.add(ze, { description: "The licensing site for the workspace" });
802
+ var ge = e2.optional(e2.url());
803
+ o2.add(ge, { description: "The contact site for the workspace" });
804
+ var ue = e2.optional(e2.url());
805
+ o2.add(ue, { description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value" });
806
+ var fe = e2._default(e2.string().check(e2.trim(), e2.toLowerCase()), "main");
807
+ o2.add(fe, { description: "The branch of the workspace" });
808
+ var ke = e2.optional(e2.string().check(e2.trim(), e2.toLowerCase()));
809
+ o2.add(ke, { description: "A tag specifying the version pre-release identifier" });
810
+ var we = e2.optional(e2.string().check(e2.trim(), e2.toLowerCase()));
811
+ o2.add(we, { description: "The owner of the package" });
812
+ var Se = e2._default(e2.enum(["development", "test", "production"]).check(e2.trim(), e2.toLowerCase()), "production");
813
+ o2.add(Se, { description: "The current runtime environment mode for the package" });
814
+ var xe = e2.string().check(e2.trim(), e2.toLowerCase());
815
+ o2.add(xe, { description: "The root directory of the workspace" });
816
+ var be = e2._default(e2.boolean(), false);
817
+ o2.add(be, { description: "Should all known types of workspace caching be skipped?" });
818
+ var Te = e2._default(e2.enum(["npm", "yarn", "pnpm", "bun"]), "npm");
819
+ o2.add(Te, { description: "The JavaScript/TypeScript package manager used by the repository" });
820
+ var ve = e2._default(e2.string().check(e2.trim()), "America/New_York");
821
+ o2.add(ve, { description: "The default timezone of the workspace" });
822
+ var ye = e2._default(e2.string().check(e2.trim()), "en-US");
823
+ o2.add(ye, { description: "The default locale of the workspace" });
824
+ var Ce = e2._default(e2.enum(["silent", "fatal", "error", "warn", "success", "info", "debug", "trace", "all"]), "info");
825
+ o2.add(Ce, { description: "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)." });
826
+ var _e = e2._default(e2.boolean(), true);
827
+ o2.add(_e, { description: "Should the logging of the current Storm Workspace configuration be skipped?" });
828
+ var Le = e2._default(e2.nullable(e2.string().check(e2.trim())), null);
829
+ o2.add(Le, { description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace." });
830
+ var S2 = e2._default(e2.record(e2.string(), e2.any()), {});
831
+ o2.add(S2, { description: "Configuration of each used extension" });
832
+ var Be = e2.object({ $schema: ie, extends: y, name: ce, variant: Y, namespace: se, organization: ne, repository: de, license: pe, homepage: he, docs: le, portal: me, licensing: ze, contact: ge, support: ue, branch: fe, preid: ke, owner: we, bot: L, release: B, socials: G, error: Q, mode: Se, workspaceRoot: xe, skipCache: be, directories: X, packageManager: Te, timezone: ve, locale: ye, logLevel: Ce, skipConfigLogging: _e, registry: T, configFile: Le, colors: e2.union([w, v]), extensions: S2 });
833
+ o2.add(S2, { description: "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo." });
834
+
835
+ // ../config/dist/chunk-WIOU3CJS.js
836
+ init_esm_shims();
837
+ var e3 = ["dark", "light", "base", "brand", "alternate", "accent", "link", "success", "help", "info", "warning", "danger", "fatal", "positive", "negative"];
838
+
839
+ // ../config-tools/dist/chunk-OEBHWAYK.js
840
+ import { existsSync as existsSync2 } from "node:fs";
841
+ import { readFile } from "node:fs/promises";
842
+ import { join as join2 } from "node:path";
843
+ async function getPackageJsonConfig(root) {
844
+ let license = i;
845
+ let homepage = void 0;
846
+ let support = void 0;
847
+ let name = void 0;
848
+ let namespace = void 0;
849
+ let repository = void 0;
850
+ const workspaceRoot = findWorkspaceRoot(root);
851
+ if (existsSync2(join2(workspaceRoot, "package.json"))) {
852
+ const file = await readFile(
853
+ joinPaths(workspaceRoot, "package.json"),
854
+ "utf8"
855
+ );
856
+ if (file) {
857
+ const packageJson = JSON.parse(file);
858
+ if (packageJson.name) {
859
+ name = packageJson.name;
860
+ }
861
+ if (packageJson.namespace) {
862
+ namespace = packageJson.namespace;
863
+ }
864
+ if (packageJson.repository) {
865
+ if (typeof packageJson.repository === "string") {
866
+ repository = packageJson.repository;
867
+ } else if (packageJson.repository.url) {
868
+ repository = packageJson.repository.url;
869
+ }
870
+ }
871
+ if (packageJson.license) {
872
+ license = packageJson.license;
873
+ }
874
+ if (packageJson.homepage) {
875
+ homepage = packageJson.homepage;
876
+ }
877
+ if (packageJson.bugs) {
878
+ if (typeof packageJson.bugs === "string") {
879
+ support = packageJson.bugs;
880
+ } else if (packageJson.bugs.url) {
881
+ support = packageJson.bugs.url;
882
+ }
883
+ }
884
+ }
885
+ }
886
+ return {
887
+ workspaceRoot,
888
+ name,
889
+ namespace,
890
+ repository,
891
+ license,
892
+ homepage,
893
+ support
894
+ };
895
+ }
896
+ function applyDefaultConfig(config) {
897
+ if (!config.support && config.contact) {
898
+ config.support = config.contact;
899
+ }
900
+ if (!config.contact && config.support) {
901
+ config.contact = config.support;
902
+ }
903
+ if (config.homepage) {
904
+ if (!config.docs) {
905
+ config.docs = `${config.homepage}/docs`;
906
+ }
907
+ if (!config.license) {
908
+ config.license = `${config.homepage}/license`;
909
+ }
910
+ if (!config.support) {
911
+ config.support = `${config.homepage}/support`;
912
+ }
913
+ if (!config.contact) {
914
+ config.contact = `${config.homepage}/contact`;
915
+ }
916
+ if (!config.error?.codesFile || !config?.error?.url) {
917
+ config.error ??= { codesFile: S };
918
+ if (config.homepage) {
919
+ config.error.url ??= `${config.homepage}/errors`;
920
+ }
921
+ }
922
+ }
923
+ return config;
924
+ }
925
+
926
+ // ../config-tools/dist/chunk-KJ7E5BJ3.js
927
+ init_esm_shims();
928
+ var setExtensionEnv = (extensionName, extension) => {
929
+ for (const key of Object.keys(extension ?? {})) {
930
+ if (extension[key]) {
931
+ const result = key?.replace(
932
+ /([A-Z])+/g,
933
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
934
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
935
+ let extensionKey;
936
+ if (result.length === 0) {
937
+ return;
938
+ }
939
+ if (result.length === 1) {
940
+ extensionKey = result[0]?.toUpperCase() ?? "";
941
+ } else {
942
+ extensionKey = result.reduce((ret, part) => {
943
+ return `${ret}_${part.toLowerCase()}`;
944
+ });
945
+ }
946
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
947
+ }
948
+ }
949
+ };
950
+ var setConfigEnv = (config) => {
951
+ const prefix = "STORM_";
952
+ if (config.extends) {
953
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
954
+ }
955
+ if (config.name) {
956
+ process.env[`${prefix}NAME`] = config.name;
957
+ }
958
+ if (config.variant) {
959
+ process.env[`${prefix}VARIANT`] = config.variant;
960
+ }
961
+ if (config.namespace) {
962
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
963
+ }
964
+ if (config.owner) {
965
+ process.env[`${prefix}OWNER`] = config.owner;
966
+ }
967
+ if (config.bot) {
968
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
969
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
970
+ }
971
+ if (config.error) {
972
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
973
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
974
+ }
975
+ if (config.release) {
976
+ if (config.release.banner) {
977
+ if (typeof config.release.banner === "string") {
978
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
979
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
980
+ } else {
981
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
982
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
983
+ process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
984
+ }
985
+ }
986
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
987
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
988
+ }
989
+ if (config.socials) {
990
+ if (config.socials.twitter) {
991
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
992
+ }
993
+ if (config.socials.discord) {
994
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
995
+ }
996
+ if (config.socials.telegram) {
997
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
998
+ }
999
+ if (config.socials.slack) {
1000
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
1001
+ }
1002
+ if (config.socials.medium) {
1003
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
1004
+ }
1005
+ if (config.socials.github) {
1006
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
1007
+ }
1008
+ }
1009
+ if (config.organization) {
1010
+ if (typeof config.organization === "string") {
1011
+ process.env[`${prefix}ORG`] = config.organization;
1012
+ process.env[`${prefix}ORG_NAME`] = config.organization;
1013
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
1014
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
1015
+ } else {
1016
+ process.env[`${prefix}ORG`] = config.organization.name;
1017
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
1018
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
1019
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
1020
+ if (config.organization.url) {
1021
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
1022
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1023
+ }
1024
+ if (config.organization.description) {
1025
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1026
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1027
+ }
1028
+ if (config.organization.logo) {
1029
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1030
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1031
+ }
1032
+ if (config.organization.icon) {
1033
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1034
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1035
+ }
1036
+ }
1037
+ }
1038
+ if (config.packageManager) {
1039
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1040
+ }
1041
+ if (config.license) {
1042
+ process.env[`${prefix}LICENSE`] = config.license;
1043
+ }
1044
+ if (config.homepage) {
1045
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
1046
+ }
1047
+ if (config.docs) {
1048
+ process.env[`${prefix}DOCS`] = config.docs;
1049
+ }
1050
+ if (config.portal) {
1051
+ process.env[`${prefix}PORTAL`] = config.portal;
1052
+ }
1053
+ if (config.licensing) {
1054
+ process.env[`${prefix}LICENSING`] = config.licensing;
1055
+ }
1056
+ if (config.contact) {
1057
+ process.env[`${prefix}CONTACT`] = config.contact;
1058
+ }
1059
+ if (config.support) {
1060
+ process.env[`${prefix}SUPPORT`] = config.support;
1061
+ }
1062
+ if (config.timezone) {
1063
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
1064
+ process.env.TZ = config.timezone;
1065
+ process.env.DEFAULT_TIMEZONE = config.timezone;
1066
+ process.env.TIMEZONE = config.timezone;
1067
+ }
1068
+ if (config.locale) {
1069
+ process.env[`${prefix}LOCALE`] = config.locale;
1070
+ process.env.DEFAULT_LOCALE = config.locale;
1071
+ process.env.LOCALE = config.locale;
1072
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1073
+ }
1074
+ if (config.configFile) {
1075
+ process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(
1076
+ config.configFile
1077
+ );
1078
+ }
1079
+ if (config.workspaceRoot) {
1080
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1081
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1082
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1083
+ }
1084
+ if (config.directories) {
1085
+ if (!config.skipCache && config.directories.cache) {
1086
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
1087
+ config.directories.cache
1088
+ );
1089
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1090
+ }
1091
+ if (config.directories.data) {
1092
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1093
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1094
+ }
1095
+ if (config.directories.config) {
1096
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
1097
+ config.directories.config
1098
+ );
1099
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1100
+ }
1101
+ if (config.directories.temp) {
1102
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1103
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1104
+ }
1105
+ if (config.directories.log) {
1106
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1107
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1108
+ }
1109
+ if (config.directories.build) {
1110
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
1111
+ config.directories.build
1112
+ );
1113
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1114
+ }
1115
+ }
1116
+ if (config.skipCache !== void 0) {
1117
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1118
+ if (config.skipCache) {
1119
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1120
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1121
+ }
1122
+ }
1123
+ if (config.mode) {
1124
+ process.env[`${prefix}MODE`] = config.mode;
1125
+ process.env.NODE_ENV = config.mode;
1126
+ process.env.ENVIRONMENT = config.mode;
1127
+ }
1128
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
1129
+ for (const key of Object.keys(config.colors)) {
1130
+ setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1131
+ }
1132
+ } else {
1133
+ setThemeColorsEnv(
1134
+ `${prefix}COLOR_`,
1135
+ config.colors
1136
+ );
1137
+ }
1138
+ if (config.repository) {
1139
+ process.env[`${prefix}REPOSITORY`] = config.repository;
1140
+ }
1141
+ if (config.branch) {
1142
+ process.env[`${prefix}BRANCH`] = config.branch;
1143
+ }
1144
+ if (config.preid) {
1145
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
1146
+ }
1147
+ if (config.registry) {
1148
+ if (config.registry.github) {
1149
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1150
+ }
1151
+ if (config.registry.npm) {
1152
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1153
+ }
1154
+ if (config.registry.cargo) {
1155
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1156
+ }
1157
+ if (config.registry.cyclone) {
1158
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
1159
+ config.registry.cyclone
1160
+ );
1161
+ }
1162
+ if (config.registry.container) {
1163
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
1164
+ config.registry.container
1165
+ );
1166
+ }
1167
+ }
1168
+ if (config.logLevel) {
1169
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1170
+ process.env.LOG_LEVEL = String(config.logLevel);
1171
+ process.env.NX_VERBOSE_LOGGING = String(
1172
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
1173
+ );
1174
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1175
+ }
1176
+ if (config.skipConfigLogging !== void 0) {
1177
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
1178
+ config.skipConfigLogging
1179
+ );
1180
+ }
1181
+ process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
1182
+ for (const key of Object.keys(config.extensions ?? {})) {
1183
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
1184
+ setExtensionEnv(key, config.extensions[key]);
1185
+ }
1186
+ }
1187
+ };
1188
+ var setThemeColorsEnv = (prefix, config) => {
1189
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
1190
+ };
1191
+ var setSingleThemeColorsEnv = (prefix, config) => {
1192
+ if (config.dark) {
1193
+ process.env[`${prefix}DARK`] = config.dark;
1194
+ }
1195
+ if (config.light) {
1196
+ process.env[`${prefix}LIGHT`] = config.light;
1197
+ }
1198
+ if (config.brand) {
1199
+ process.env[`${prefix}BRAND`] = config.brand;
1200
+ }
1201
+ if (config.alternate) {
1202
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1203
+ }
1204
+ if (config.accent) {
1205
+ process.env[`${prefix}ACCENT`] = config.accent;
1206
+ }
1207
+ if (config.link) {
1208
+ process.env[`${prefix}LINK`] = config.link;
1209
+ }
1210
+ if (config.help) {
1211
+ process.env[`${prefix}HELP`] = config.help;
1212
+ }
1213
+ if (config.success) {
1214
+ process.env[`${prefix}SUCCESS`] = config.success;
1215
+ }
1216
+ if (config.info) {
1217
+ process.env[`${prefix}INFO`] = config.info;
1218
+ }
1219
+ if (config.warning) {
1220
+ process.env[`${prefix}WARNING`] = config.warning;
1221
+ }
1222
+ if (config.danger) {
1223
+ process.env[`${prefix}DANGER`] = config.danger;
1224
+ }
1225
+ if (config.fatal) {
1226
+ process.env[`${prefix}FATAL`] = config.fatal;
1227
+ }
1228
+ if (config.positive) {
1229
+ process.env[`${prefix}POSITIVE`] = config.positive;
1230
+ }
1231
+ if (config.negative) {
1232
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1233
+ }
1234
+ if (config.gradient) {
1235
+ for (let i3 = 0; i3 < config.gradient.length; i3++) {
1236
+ process.env[`${prefix}GRADIENT_${i3}`] = config.gradient[i3];
1237
+ }
1238
+ }
1239
+ };
1240
+ var setMultiThemeColorsEnv = (prefix, config) => {
1241
+ return {
1242
+ light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
1243
+ dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
1244
+ };
1245
+ };
1246
+ var setBaseThemeColorsEnv = (prefix, config) => {
1247
+ if (config.foreground) {
1248
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
1249
+ }
1250
+ if (config.background) {
1251
+ process.env[`${prefix}BACKGROUND`] = config.background;
1252
+ }
1253
+ if (config.brand) {
1254
+ process.env[`${prefix}BRAND`] = config.brand;
1255
+ }
1256
+ if (config.alternate) {
1257
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1258
+ }
1259
+ if (config.accent) {
1260
+ process.env[`${prefix}ACCENT`] = config.accent;
1261
+ }
1262
+ if (config.link) {
1263
+ process.env[`${prefix}LINK`] = config.link;
1264
+ }
1265
+ if (config.help) {
1266
+ process.env[`${prefix}HELP`] = config.help;
1267
+ }
1268
+ if (config.success) {
1269
+ process.env[`${prefix}SUCCESS`] = config.success;
1270
+ }
1271
+ if (config.info) {
1272
+ process.env[`${prefix}INFO`] = config.info;
1273
+ }
1274
+ if (config.warning) {
1275
+ process.env[`${prefix}WARNING`] = config.warning;
1276
+ }
1277
+ if (config.danger) {
1278
+ process.env[`${prefix}DANGER`] = config.danger;
1279
+ }
1280
+ if (config.fatal) {
1281
+ process.env[`${prefix}FATAL`] = config.fatal;
1282
+ }
1283
+ if (config.positive) {
1284
+ process.env[`${prefix}POSITIVE`] = config.positive;
1285
+ }
1286
+ if (config.negative) {
1287
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1288
+ }
1289
+ if (config.gradient) {
1290
+ for (let i3 = 0; i3 < config.gradient.length; i3++) {
1291
+ process.env[`${prefix}GRADIENT_${i3}`] = config.gradient[i3];
1292
+ }
1293
+ }
1294
+ };
1295
+
1296
+ // ../config-tools/dist/chunk-ZWZLRNXP.js
1297
+ init_esm_shims();
1298
+ var getExtensionEnv = (extensionName) => {
1299
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
1300
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
1301
+ const name = key.replace(prefix, "").split("_").map(
1302
+ (i3) => i3.length > 0 ? i3.trim().charAt(0).toUpperCase() + i3.trim().slice(1) : ""
1303
+ ).join("");
1304
+ if (name) {
1305
+ ret[name] = process.env[key];
1306
+ }
1307
+ return ret;
1308
+ }, {});
1309
+ };
1310
+ var getConfigEnv = () => {
1311
+ const prefix = "STORM_";
1312
+ let config = {
1313
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
1314
+ name: process.env[`${prefix}NAME`] || void 0,
1315
+ variant: process.env[`${prefix}VARIANT`] || void 0,
1316
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
1317
+ owner: process.env[`${prefix}OWNER`] || void 0,
1318
+ bot: {
1319
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
1320
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
1321
+ },
1322
+ release: {
1323
+ banner: {
1324
+ url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
1325
+ alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
1326
+ },
1327
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
1328
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
1329
+ },
1330
+ error: {
1331
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
1332
+ url: process.env[`${prefix}ERROR_URL`] || void 0
1333
+ },
1334
+ socials: {
1335
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
1336
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
1337
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
1338
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
1339
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
1340
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
1341
+ },
1342
+ organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
1343
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
1344
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
1345
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
1346
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
1347
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
1348
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
1349
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
1350
+ license: process.env[`${prefix}LICENSE`] || void 0,
1351
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
1352
+ docs: process.env[`${prefix}DOCS`] || void 0,
1353
+ portal: process.env[`${prefix}PORTAL`] || void 0,
1354
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
1355
+ contact: process.env[`${prefix}CONTACT`] || void 0,
1356
+ support: process.env[`${prefix}SUPPORT`] || void 0,
1357
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
1358
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
1359
+ configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
1360
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
1361
+ directories: {
1362
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
1363
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
1364
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
1365
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
1366
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
1367
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
1368
+ },
1369
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
1370
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
1371
+ // ci:
1372
+ // process.env[`${prefix}CI`] !== undefined
1373
+ // ? Boolean(
1374
+ // process.env[`${prefix}CI`] ??
1375
+ // process.env.CI ??
1376
+ // process.env.CONTINUOUS_INTEGRATION
1377
+ // )
1378
+ // : undefined,
1379
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
1380
+ branch: process.env[`${prefix}BRANCH`] || void 0,
1381
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
1382
+ registry: {
1383
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
1384
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
1385
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
1386
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
1387
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
1388
+ },
1389
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
1390
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1391
+ ) ? getLogLevelLabel(
1392
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1393
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
1394
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
1395
+ };
1396
+ const themeNames = Object.keys(process.env).filter(
1397
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && e3.every(
1398
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
1399
+ )
1400
+ );
1401
+ config.colors = themeNames.length > 0 ? themeNames.reduce(
1402
+ (ret, themeName) => {
1403
+ ret[themeName] = getThemeColorsEnv(prefix, themeName);
1404
+ return ret;
1405
+ },
1406
+ {}
1407
+ ) : getThemeColorsEnv(prefix);
1408
+ if (config.docs === s) {
1409
+ if (config.homepage === r) {
1410
+ config.docs = `${r}/projects/${config.name}/docs`;
1411
+ } else {
1412
+ config.docs = `${config.homepage}/docs`;
1413
+ }
1414
+ }
1415
+ if (config.licensing === a) {
1416
+ if (config.homepage === r) {
1417
+ config.licensing = `${r}/projects/${config.name}/licensing`;
1418
+ } else {
1419
+ config.licensing = `${config.homepage}/docs`;
1420
+ }
1421
+ }
1422
+ const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
1423
+ if (serializedConfig) {
1424
+ const parsed = JSON.parse(serializedConfig);
1425
+ config = {
1426
+ ...config,
1427
+ ...parsed,
1428
+ colors: { ...config.colors, ...parsed.colors },
1429
+ extensions: { ...config.extensions, ...parsed.extensions }
1430
+ };
1431
+ }
1432
+ return config;
1433
+ };
1434
+ var getThemeColorsEnv = (prefix, theme) => {
1435
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
1436
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
1437
+ };
1438
+ var getSingleThemeColorsEnv = (prefix) => {
1439
+ const gradient = [];
1440
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1441
+ gradient.push(
1442
+ process.env[`${prefix}GRADIENT_START`],
1443
+ process.env[`${prefix}GRADIENT_END`]
1444
+ );
1445
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1446
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1447
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1448
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1449
+ index++;
1450
+ }
1451
+ }
1452
+ return {
1453
+ dark: process.env[`${prefix}DARK`],
1454
+ light: process.env[`${prefix}LIGHT`],
1455
+ brand: process.env[`${prefix}BRAND`],
1456
+ alternate: process.env[`${prefix}ALTERNATE`],
1457
+ accent: process.env[`${prefix}ACCENT`],
1458
+ link: process.env[`${prefix}LINK`],
1459
+ help: process.env[`${prefix}HELP`],
1460
+ success: process.env[`${prefix}SUCCESS`],
1461
+ info: process.env[`${prefix}INFO`],
1462
+ warning: process.env[`${prefix}WARNING`],
1463
+ danger: process.env[`${prefix}DANGER`],
1464
+ fatal: process.env[`${prefix}FATAL`],
1465
+ positive: process.env[`${prefix}POSITIVE`],
1466
+ negative: process.env[`${prefix}NEGATIVE`],
1467
+ gradient
1468
+ };
1469
+ };
1470
+ var getMultiThemeColorsEnv = (prefix) => {
1471
+ return {
1472
+ light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
1473
+ dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
1474
+ };
1475
+ };
1476
+ var getBaseThemeColorsEnv = (prefix) => {
1477
+ const gradient = [];
1478
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1479
+ gradient.push(
1480
+ process.env[`${prefix}GRADIENT_START`],
1481
+ process.env[`${prefix}GRADIENT_END`]
1482
+ );
1483
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1484
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1485
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1486
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1487
+ index++;
1488
+ }
1489
+ }
1490
+ return {
1491
+ foreground: process.env[`${prefix}FOREGROUND`],
1492
+ background: process.env[`${prefix}BACKGROUND`],
1493
+ brand: process.env[`${prefix}BRAND`],
1494
+ alternate: process.env[`${prefix}ALTERNATE`],
1495
+ accent: process.env[`${prefix}ACCENT`],
1496
+ link: process.env[`${prefix}LINK`],
1497
+ help: process.env[`${prefix}HELP`],
1498
+ success: process.env[`${prefix}SUCCESS`],
1499
+ info: process.env[`${prefix}INFO`],
1500
+ warning: process.env[`${prefix}WARNING`],
1501
+ danger: process.env[`${prefix}DANGER`],
1502
+ fatal: process.env[`${prefix}FATAL`],
1503
+ positive: process.env[`${prefix}POSITIVE`],
1504
+ negative: process.env[`${prefix}NEGATIVE`],
1505
+ gradient
1506
+ };
1507
+ };
1508
+
1509
+ // ../config/dist/schema.js
1510
+ init_esm_shims();
1511
+
1512
+ // ../config-tools/dist/chunk-R7MTORRG.js
1513
+ import defu2 from "defu";
1514
+ import { existsSync as existsSync3 } from "node:fs";
1515
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
1516
+ var _static_cache = void 0;
1517
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
1518
+ let result;
1519
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1520
+ let _workspaceRoot = workspaceRoot;
1521
+ if (!_workspaceRoot) {
1522
+ _workspaceRoot = findWorkspaceRoot();
1523
+ }
1524
+ const configEnv = getConfigEnv();
1525
+ const configFile = await getConfigFile(_workspaceRoot);
1526
+ if (!configFile) {
1527
+ if (!skipLogs) {
1528
+ writeWarning(
1529
+ "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
1530
+ { logLevel: "all" }
1531
+ );
1532
+ }
1533
+ if (useDefault === false) {
1534
+ return void 0;
1535
+ }
1536
+ }
1537
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1538
+ const configInput = defu2(
1539
+ configEnv,
1540
+ configFile,
1541
+ defaultConfig
1542
+ );
1543
+ if (!configInput.variant) {
1544
+ configInput.variant = existsSync3(joinPaths(_workspaceRoot, "nx.json")) || existsSync3(joinPaths(_workspaceRoot, ".nx")) || existsSync3(joinPaths(_workspaceRoot, "lerna.json")) || existsSync3(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
1545
+ }
1546
+ try {
1547
+ result = applyDefaultConfig(
1548
+ await Be.parseAsync(configInput)
1549
+ );
1550
+ result.workspaceRoot ??= _workspaceRoot;
1551
+ } catch (error) {
1552
+ throw new Error(
1553
+ `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
1554
+
1555
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
1556
+ configInput
1557
+ )}`,
1558
+ {
1559
+ cause: error
1560
+ }
1561
+ );
1562
+ }
1563
+ } else {
1564
+ result = _static_cache.data;
1565
+ }
1566
+ if (schema && extensionName) {
1567
+ result.extensions = {
1568
+ ...result.extensions,
1569
+ [extensionName]: createConfigExtension(extensionName, schema)
1570
+ };
1571
+ }
1572
+ _static_cache = {
1573
+ timestamp: Date.now(),
1574
+ data: result
1575
+ };
1576
+ return result;
1577
+ };
1578
+ var createConfigExtension = (extensionName, schema) => {
1579
+ const extension_cache_key = { extensionName };
1580
+ if (_extension_cache.has(extension_cache_key)) {
1581
+ return _extension_cache.get(extension_cache_key);
1582
+ }
1583
+ let extension = getExtensionEnv(extensionName);
1584
+ if (schema) {
1585
+ extension = schema.parse(extension);
1586
+ }
1587
+ _extension_cache.set(extension_cache_key, extension);
1588
+ return extension;
1589
+ };
1590
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
1591
+ const config = await createStormWorkspaceConfig(
1592
+ void 0,
1593
+ void 0,
1594
+ workspaceRoot,
1595
+ skipLogs,
1596
+ true
1597
+ );
1598
+ setConfigEnv(config);
1599
+ if (!skipLogs && !config.skipConfigLogging) {
1600
+ writeTrace(
1601
+ `\u2699\uFE0F Using Storm Workspace configuration:
1602
+ ${formatLogMessage(config)}`,
1603
+ config
1604
+ );
1605
+ }
1606
+ return config;
1607
+ };
1608
+
1609
+ // ../config-tools/dist/chunk-WOLTMI7X.js
1610
+ function getConfig(workspaceRoot, skipLogs = false) {
1611
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
1612
+ }
1613
+ function getWorkspaceConfig(skipLogs = true, options = {}) {
1614
+ let workspaceRoot = options.workspaceRoot;
1615
+ if (!workspaceRoot) {
1616
+ workspaceRoot = findWorkspaceRoot(options.cwd);
1617
+ }
1618
+ return getConfig(workspaceRoot, skipLogs);
1619
+ }
1620
+
1621
+ // ../config-tools/dist/logger/console.js
1622
+ init_esm_shims();
1623
+
1624
+ // ../config-tools/dist/utilities/correct-paths.js
1625
+ init_esm_shims();
1626
+
1627
+ // src/options.ts
1628
+ import defu3 from "defu";
1629
+ import { existsSync as existsSync4 } from "node:fs";
1630
+ import hf from "node:fs/promises";
1631
+ import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
1632
+ async function resolveOptions(userOptions) {
1633
+ const projectRoot = userOptions.projectRoot;
1634
+ const workspaceRoot = findWorkspaceRoot2(projectRoot);
1635
+ if (!workspaceRoot) {
1636
+ throw new Error("Cannot find Nx workspace root");
1637
+ }
1638
+ const workspaceConfig = await getWorkspaceConfig(true, {
1639
+ workspaceRoot: workspaceRoot.dir
1640
+ });
1641
+ writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
1642
+ const stopwatch = getStopwatch("Build options resolution");
1643
+ const projectGraph = await createProjectGraphAsync({
1644
+ exitOnError: true
1645
+ });
1646
+ const projectJsonPath = joinPaths(
1647
+ workspaceRoot.dir,
1648
+ projectRoot,
1649
+ "project.json"
1650
+ );
1651
+ if (!existsSync4(projectJsonPath)) {
1652
+ throw new Error("Cannot find project.json configuration");
1653
+ }
1654
+ const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
1655
+ const projectJson = JSON.parse(projectJsonFile);
1656
+ const projectName = projectJson.name || userOptions.name;
1657
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
1658
+ if (!projectConfigurations?.projects?.[projectName]) {
1659
+ throw new Error(
1660
+ "The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project."
1661
+ );
1662
+ }
1663
+ const options = defu3(userOptions, DEFAULT_BUILD_OPTIONS);
1664
+ options.name ??= projectName;
1665
+ const packageJsonPath = joinPaths(
1666
+ workspaceRoot.dir,
1667
+ options.projectRoot,
1668
+ "package.json"
1669
+ );
1670
+ if (!existsSync4(packageJsonPath)) {
1671
+ throw new Error("Cannot find package.json configuration");
1672
+ }
1673
+ const env = getEnv("esbuild", options);
1674
+ const define = defu3(options.define ?? {}, env ?? {});
1675
+ const resolvedOptions = {
1676
+ name: projectName,
1677
+ entry: [joinPaths(workspaceRoot.dir, projectRoot, "src/index.ts")],
1678
+ clean: true,
1679
+ ...options,
1680
+ outDir: options.outputPath || joinPaths(workspaceConfig.workspaceRoot, "dist", options.projectRoot),
1681
+ tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : joinPaths(workspaceRoot.dir, projectRoot, "tsconfig.json"),
1682
+ env,
1683
+ define: {
1684
+ STORM_FORMAT: JSON.stringify(options.format),
1685
+ ...Object.keys(define).filter((key) => define[key] !== void 0).reduce((res, key) => {
1686
+ const value = JSON.stringify(define[key]);
1687
+ const safeKey = key.replaceAll("(", "").replaceAll(")", "");
1688
+ return {
1689
+ ...res,
1690
+ [`process.env.${safeKey}`]: value,
1691
+ [`import.meta.env.${safeKey}`]: value
1692
+ };
1693
+ }, {})
1694
+ }
1695
+ };
1696
+ stopwatch();
1697
+ if (options.verbose) {
1698
+ writeDebug(
1699
+ ` \u2699\uFE0F Build options resolved:
1700
+
1701
+ ${formatLogMessage(resolvedOptions)}`,
1702
+ workspaceConfig
1703
+ );
1704
+ }
1705
+ return resolvedOptions;
1706
+ }
1707
+
1708
+ export {
1709
+ writeDebug,
1710
+ getStopwatch,
1711
+ resolveOptions
1712
+ };