@storm-software/unbuild 0.49.59 → 0.49.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/unbuild.js CHANGED
@@ -25,20 +25,52 @@ If this sounds interesting, and you would like to help us in creating the next g
25
25
  var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
26
26
 
27
27
  // ../config/src/schema.ts
28
- var DarkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
29
- var LightColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
30
- var BrandColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
31
- var AlternateColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
32
- var AccentColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
33
- var LinkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
34
- var HelpColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
35
- var SuccessColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
36
- var InfoColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
37
- var WarningColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
38
- var DangerColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
39
- var FatalColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
40
- var PositiveColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
41
- var NegativeColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
28
+ var ColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7);
29
+ var DarkColorSchema = ColorSchema.default("#151718").describe(
30
+ "The dark background color of the workspace"
31
+ );
32
+ var LightColorSchema = ColorSchema.default("#cbd5e1").describe(
33
+ "The light background color of the workspace"
34
+ );
35
+ var BrandColorSchema = ColorSchema.default("#1fb2a6").describe(
36
+ "The primary brand specific color of the workspace"
37
+ );
38
+ var AlternateColorSchema = ColorSchema.optional().describe(
39
+ "The alternate brand specific color of the workspace"
40
+ );
41
+ var AccentColorSchema = ColorSchema.optional().describe(
42
+ "The secondary brand specific color of the workspace"
43
+ );
44
+ var LinkColorSchema = ColorSchema.default("#3fa6ff").describe(
45
+ "The color used to display hyperlink text"
46
+ );
47
+ var HelpColorSchema = ColorSchema.default("#818cf8").describe(
48
+ "The second brand specific color of the workspace"
49
+ );
50
+ var SuccessColorSchema = ColorSchema.default("#45b27e").describe(
51
+ "The success color of the workspace"
52
+ );
53
+ var InfoColorSchema = ColorSchema.default("#38bdf8").describe(
54
+ "The informational color of the workspace"
55
+ );
56
+ var WarningColorSchema = ColorSchema.default("#f3d371").describe(
57
+ "The warning color of the workspace"
58
+ );
59
+ var DangerColorSchema = ColorSchema.default("#d8314a").describe(
60
+ "The danger color of the workspace"
61
+ );
62
+ var FatalColorSchema = ColorSchema.optional().describe(
63
+ "The fatal color of the workspace"
64
+ );
65
+ var PositiveColorSchema = ColorSchema.default("#4ade80").describe(
66
+ "The positive number color of the workspace"
67
+ );
68
+ var NegativeColorSchema = ColorSchema.default("#ef4444").describe(
69
+ "The negative number color of the workspace"
70
+ );
71
+ var GradientStopsSchema = z.array(ColorSchema).optional().describe(
72
+ "The color stops for the base gradient color pattern used in the workspace"
73
+ );
42
74
  var DarkThemeColorConfigSchema = z.object({
43
75
  foreground: LightColorSchema,
44
76
  background: DarkColorSchema,
@@ -53,7 +85,8 @@ var DarkThemeColorConfigSchema = z.object({
53
85
  danger: DangerColorSchema,
54
86
  fatal: FatalColorSchema,
55
87
  positive: PositiveColorSchema,
56
- negative: NegativeColorSchema
88
+ negative: NegativeColorSchema,
89
+ gradient: GradientStopsSchema
57
90
  });
58
91
  var LightThemeColorConfigSchema = z.object({
59
92
  foreground: DarkColorSchema,
@@ -69,7 +102,8 @@ var LightThemeColorConfigSchema = z.object({
69
102
  danger: DangerColorSchema,
70
103
  fatal: FatalColorSchema,
71
104
  positive: PositiveColorSchema,
72
- negative: NegativeColorSchema
105
+ negative: NegativeColorSchema,
106
+ gradient: GradientStopsSchema
73
107
  });
74
108
  var MultiThemeColorConfigSchema = z.object({
75
109
  dark: DarkThemeColorConfigSchema,
@@ -89,7 +123,8 @@ var SingleThemeColorConfigSchema = z.object({
89
123
  danger: DangerColorSchema,
90
124
  fatal: FatalColorSchema,
91
125
  positive: PositiveColorSchema,
92
- negative: NegativeColorSchema
126
+ negative: NegativeColorSchema,
127
+ gradient: GradientStopsSchema
93
128
  });
94
129
  var RegistryUrlConfigSchema = z.url().optional().describe("A remote registry URL used to publish distributable packages");
95
130
  var RegistryConfigSchema = z.object({
@@ -273,29 +308,282 @@ var LogLevelLabel = {
273
308
  ALL: "all"
274
309
  };
275
310
 
276
- // ../config/src/types.ts
277
- var COLOR_KEYS = [
278
- "dark",
279
- "light",
280
- "base",
281
- "brand",
282
- "alternate",
283
- "accent",
284
- "link",
285
- "success",
286
- "help",
287
- "info",
288
- "warning",
289
- "danger",
290
- "fatal",
291
- "positive",
292
- "negative"
293
- ];
311
+ // ../config-tools/src/utilities/colors.ts
312
+ var DEFAULT_COLOR_CONFIG = {
313
+ light: {
314
+ background: "#fafafa",
315
+ foreground: "#1d1e22",
316
+ brand: "#1fb2a6",
317
+ alternate: "#db2777",
318
+ help: "#5C4EE5",
319
+ success: "#087f5b",
320
+ info: "#0550ae",
321
+ warning: "#e3b341",
322
+ danger: "#D8314A",
323
+ fatal: "#51070f",
324
+ link: "#3fa6ff",
325
+ positive: "#22c55e",
326
+ negative: "#dc2626",
327
+ gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
328
+ },
329
+ dark: {
330
+ background: "#1d1e22",
331
+ foreground: "#cbd5e1",
332
+ brand: "#2dd4bf",
333
+ alternate: "#db2777",
334
+ help: "#818cf8",
335
+ success: "#10b981",
336
+ info: "#58a6ff",
337
+ warning: "#f3d371",
338
+ danger: "#D8314A",
339
+ fatal: "#a40e26",
340
+ link: "#3fa6ff",
341
+ positive: "#22c55e",
342
+ negative: "#dc2626",
343
+ gradient: ["#1fb2a6", "#db2777", "#818cf8"]
344
+ }
345
+ };
294
346
 
295
- // ../config-tools/src/utilities/get-default-config.ts
296
- import { existsSync as existsSync2 } from "node:fs";
297
- import { readFile } from "node:fs/promises";
298
- import { join as join2 } from "node:path";
347
+ // ../config-tools/src/logger/chalk.ts
348
+ import chalk from "chalk";
349
+ var chalkDefault = {
350
+ hex: (_) => (message) => message,
351
+ bgHex: (_) => ({
352
+ whiteBright: (message) => message,
353
+ white: (message) => message
354
+ }),
355
+ white: (message) => message,
356
+ whiteBright: (message) => message,
357
+ gray: (message) => message,
358
+ bold: {
359
+ hex: (_) => (message) => message,
360
+ bgHex: (_) => ({
361
+ whiteBright: (message) => message,
362
+ white: (message) => message
363
+ }),
364
+ whiteBright: (message) => message,
365
+ white: (message) => message
366
+ },
367
+ dim: {
368
+ hex: (_) => (message) => message,
369
+ gray: (message) => message
370
+ }
371
+ };
372
+ var getChalk = () => {
373
+ let _chalk = chalk;
374
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
375
+ _chalk = chalkDefault;
376
+ }
377
+ return _chalk;
378
+ };
379
+
380
+ // ../config-tools/src/logger/is-unicode-supported.ts
381
+ function isUnicodeSupported() {
382
+ if (process.platform !== "win32") {
383
+ return process.env.TERM !== "linux";
384
+ }
385
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
386
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
387
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
388
+ 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";
389
+ }
390
+
391
+ // ../config-tools/src/logger/console-icons.ts
392
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
393
+ var CONSOLE_ICONS = {
394
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
395
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
396
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
397
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
398
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
399
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
400
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
401
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
402
+ };
403
+
404
+ // ../config-tools/src/logger/format-timestamp.ts
405
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
406
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
407
+ };
408
+
409
+ // ../config-tools/src/logger/get-log-level.ts
410
+ var getLogLevel = (label) => {
411
+ switch (label) {
412
+ case "all":
413
+ return LogLevel.ALL;
414
+ case "trace":
415
+ return LogLevel.TRACE;
416
+ case "debug":
417
+ return LogLevel.DEBUG;
418
+ case "info":
419
+ return LogLevel.INFO;
420
+ case "warn":
421
+ return LogLevel.WARN;
422
+ case "error":
423
+ return LogLevel.ERROR;
424
+ case "fatal":
425
+ return LogLevel.FATAL;
426
+ case "silent":
427
+ return LogLevel.SILENT;
428
+ default:
429
+ return LogLevel.INFO;
430
+ }
431
+ };
432
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
433
+ if (logLevel >= LogLevel.ALL) {
434
+ return LogLevelLabel.ALL;
435
+ }
436
+ if (logLevel >= LogLevel.TRACE) {
437
+ return LogLevelLabel.TRACE;
438
+ }
439
+ if (logLevel >= LogLevel.DEBUG) {
440
+ return LogLevelLabel.DEBUG;
441
+ }
442
+ if (logLevel >= LogLevel.INFO) {
443
+ return LogLevelLabel.INFO;
444
+ }
445
+ if (logLevel >= LogLevel.WARN) {
446
+ return LogLevelLabel.WARN;
447
+ }
448
+ if (logLevel >= LogLevel.ERROR) {
449
+ return LogLevelLabel.ERROR;
450
+ }
451
+ if (logLevel >= LogLevel.FATAL) {
452
+ return LogLevelLabel.FATAL;
453
+ }
454
+ if (logLevel <= LogLevel.SILENT) {
455
+ return LogLevelLabel.SILENT;
456
+ }
457
+ return LogLevelLabel.INFO;
458
+ };
459
+ var isVerbose = (label = LogLevelLabel.SILENT) => {
460
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
461
+ return logLevel >= LogLevel.DEBUG;
462
+ };
463
+
464
+ // ../config-tools/src/logger/console.ts
465
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
466
+ 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;
467
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
468
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
469
+ return (_) => {
470
+ };
471
+ }
472
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
473
+ return (message) => {
474
+ console.error(
475
+ `
476
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
477
+ `
478
+ );
479
+ };
480
+ }
481
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
482
+ return (message) => {
483
+ console.error(
484
+ `
485
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
486
+ `
487
+ );
488
+ };
489
+ }
490
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
491
+ return (message) => {
492
+ console.warn(
493
+ `
494
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
495
+ `
496
+ );
497
+ };
498
+ }
499
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
500
+ return (message) => {
501
+ console.info(
502
+ `
503
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
504
+ `
505
+ );
506
+ };
507
+ }
508
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
509
+ return (message) => {
510
+ console.info(
511
+ `
512
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
513
+ `
514
+ );
515
+ };
516
+ }
517
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
518
+ return (message) => {
519
+ console.debug(
520
+ `
521
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
522
+ `
523
+ );
524
+ };
525
+ }
526
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
527
+ return (message) => {
528
+ console.debug(
529
+ `
530
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
531
+ `
532
+ );
533
+ };
534
+ }
535
+ return (message) => {
536
+ console.log(
537
+ `
538
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
539
+ `
540
+ );
541
+ };
542
+ };
543
+ var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
544
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
545
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
546
+ var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
547
+ var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
548
+ var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
549
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
550
+ var getStopwatch = (name) => {
551
+ const start = process.hrtime();
552
+ return () => {
553
+ const end = process.hrtime(start);
554
+ console.info(
555
+ `
556
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
557
+ end[0] * 1e3 + end[1] / 1e6
558
+ )}ms to complete
559
+ `
560
+ );
561
+ };
562
+ };
563
+ var MAX_DEPTH = 4;
564
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
565
+ if (depth2 > MAX_DEPTH) {
566
+ return "<max depth>";
567
+ }
568
+ const prefix = options.prefix ?? "-";
569
+ const skip = options.skip ?? [];
570
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
571
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
572
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
573
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
574
+ message[key],
575
+ { prefix: `${prefix}-`, skip },
576
+ depth2 + 1
577
+ ) : message[key]}`
578
+ ).join("\n")}` : message;
579
+ };
580
+ var _isFunction = (value) => {
581
+ try {
582
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
583
+ } catch {
584
+ return false;
585
+ }
586
+ };
299
587
 
300
588
  // ../config-tools/src/utilities/correct-paths.ts
301
589
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
@@ -516,35 +804,29 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
516
804
  return result;
517
805
  }
518
806
 
519
- // ../config-tools/src/utilities/get-default-config.ts
520
- var DEFAULT_COLOR_CONFIG = {
521
- light: {
522
- background: "#fafafa",
523
- foreground: "#1d1e22",
524
- brand: "#1fb2a6",
525
- alternate: "#db2777",
526
- help: "#5C4EE5",
527
- success: "#087f5b",
528
- info: "#0550ae",
529
- warning: "#e3b341",
530
- danger: "#D8314A",
531
- positive: "#22c55e",
532
- negative: "#dc2626"
533
- },
534
- dark: {
535
- background: "#1d1e22",
536
- foreground: "#cbd5e1",
537
- brand: "#2dd4bf",
538
- alternate: "#db2777",
539
- help: "#818cf8",
540
- success: "#10b981",
541
- info: "#58a6ff",
542
- warning: "#f3d371",
543
- danger: "#D8314A",
544
- positive: "#22c55e",
545
- negative: "#dc2626"
546
- }
547
- };
807
+ // ../config/src/types.ts
808
+ var COLOR_KEYS = [
809
+ "dark",
810
+ "light",
811
+ "base",
812
+ "brand",
813
+ "alternate",
814
+ "accent",
815
+ "link",
816
+ "success",
817
+ "help",
818
+ "info",
819
+ "warning",
820
+ "danger",
821
+ "fatal",
822
+ "positive",
823
+ "negative"
824
+ ];
825
+
826
+ // ../config-tools/src/utilities/get-default-config.ts
827
+ import { existsSync as existsSync2 } from "node:fs";
828
+ import { readFile } from "node:fs/promises";
829
+ import { join as join2 } from "node:path";
548
830
  async function getPackageJsonConfig(root) {
549
831
  let license = STORM_DEFAULT_LICENSE;
550
832
  let homepage = void 0;
@@ -628,247 +910,6 @@ function applyDefaultConfig(config) {
628
910
  return config;
629
911
  }
630
912
 
631
- // ../config-tools/src/logger/chalk.ts
632
- import chalk from "chalk";
633
- var chalkDefault = {
634
- hex: (_) => (message) => message,
635
- bgHex: (_) => ({
636
- whiteBright: (message) => message,
637
- white: (message) => message
638
- }),
639
- white: (message) => message,
640
- whiteBright: (message) => message,
641
- gray: (message) => message,
642
- bold: {
643
- hex: (_) => (message) => message,
644
- bgHex: (_) => ({
645
- whiteBright: (message) => message,
646
- white: (message) => message
647
- }),
648
- whiteBright: (message) => message,
649
- white: (message) => message
650
- },
651
- dim: {
652
- hex: (_) => (message) => message,
653
- gray: (message) => message
654
- }
655
- };
656
- var getChalk = () => {
657
- let _chalk = chalk;
658
- if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
659
- _chalk = chalkDefault;
660
- }
661
- return _chalk;
662
- };
663
-
664
- // ../config-tools/src/logger/is-unicode-supported.ts
665
- function isUnicodeSupported() {
666
- if (process.platform !== "win32") {
667
- return process.env.TERM !== "linux";
668
- }
669
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
670
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
671
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
672
- 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";
673
- }
674
-
675
- // ../config-tools/src/logger/console-icons.ts
676
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
677
- var CONSOLE_ICONS = {
678
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
679
- [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
680
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
681
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
682
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
683
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
684
- [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
685
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
686
- };
687
-
688
- // ../config-tools/src/logger/format-timestamp.ts
689
- var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
690
- return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
691
- };
692
-
693
- // ../config-tools/src/logger/get-log-level.ts
694
- var getLogLevel = (label) => {
695
- switch (label) {
696
- case "all":
697
- return LogLevel.ALL;
698
- case "trace":
699
- return LogLevel.TRACE;
700
- case "debug":
701
- return LogLevel.DEBUG;
702
- case "info":
703
- return LogLevel.INFO;
704
- case "warn":
705
- return LogLevel.WARN;
706
- case "error":
707
- return LogLevel.ERROR;
708
- case "fatal":
709
- return LogLevel.FATAL;
710
- case "silent":
711
- return LogLevel.SILENT;
712
- default:
713
- return LogLevel.INFO;
714
- }
715
- };
716
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
717
- if (logLevel >= LogLevel.ALL) {
718
- return LogLevelLabel.ALL;
719
- }
720
- if (logLevel >= LogLevel.TRACE) {
721
- return LogLevelLabel.TRACE;
722
- }
723
- if (logLevel >= LogLevel.DEBUG) {
724
- return LogLevelLabel.DEBUG;
725
- }
726
- if (logLevel >= LogLevel.INFO) {
727
- return LogLevelLabel.INFO;
728
- }
729
- if (logLevel >= LogLevel.WARN) {
730
- return LogLevelLabel.WARN;
731
- }
732
- if (logLevel >= LogLevel.ERROR) {
733
- return LogLevelLabel.ERROR;
734
- }
735
- if (logLevel >= LogLevel.FATAL) {
736
- return LogLevelLabel.FATAL;
737
- }
738
- if (logLevel <= LogLevel.SILENT) {
739
- return LogLevelLabel.SILENT;
740
- }
741
- return LogLevelLabel.INFO;
742
- };
743
- var isVerbose = (label = LogLevelLabel.SILENT) => {
744
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
745
- return logLevel >= LogLevel.DEBUG;
746
- };
747
-
748
- // ../config-tools/src/logger/console.ts
749
- var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
750
- 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;
751
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
752
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
753
- return (_) => {
754
- };
755
- }
756
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
757
- return (message) => {
758
- console.error(
759
- `
760
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
761
- `
762
- );
763
- };
764
- }
765
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
766
- return (message) => {
767
- console.error(
768
- `
769
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
770
- `
771
- );
772
- };
773
- }
774
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
775
- return (message) => {
776
- console.warn(
777
- `
778
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
779
- `
780
- );
781
- };
782
- }
783
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
784
- return (message) => {
785
- console.info(
786
- `
787
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
788
- `
789
- );
790
- };
791
- }
792
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
793
- return (message) => {
794
- console.info(
795
- `
796
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
797
- `
798
- );
799
- };
800
- }
801
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
802
- return (message) => {
803
- console.debug(
804
- `
805
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#3e9eff")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
806
- `
807
- );
808
- };
809
- }
810
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
811
- return (message) => {
812
- console.debug(
813
- `
814
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0070E0")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
815
- `
816
- );
817
- };
818
- }
819
- return (message) => {
820
- console.log(
821
- `
822
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0356a8")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
823
- `
824
- );
825
- };
826
- };
827
- var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
828
- var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
829
- var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
830
- var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
831
- var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
832
- var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
833
- var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
834
- var getStopwatch = (name) => {
835
- const start = process.hrtime();
836
- return () => {
837
- const end = process.hrtime(start);
838
- console.info(
839
- `
840
- > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
841
- end[0] * 1e3 + end[1] / 1e6
842
- )}ms to complete
843
- `
844
- );
845
- };
846
- };
847
- var MAX_DEPTH = 4;
848
- var formatLogMessage = (message, options = {}, depth2 = 0) => {
849
- if (depth2 > MAX_DEPTH) {
850
- return "<max depth>";
851
- }
852
- const prefix = options.prefix ?? "-";
853
- const skip = options.skip ?? [];
854
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
855
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
856
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
857
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
858
- message[key],
859
- { prefix: `${prefix}-`, skip },
860
- depth2 + 1
861
- ) : message[key]}`
862
- ).join("\n")}` : message;
863
- };
864
- var _isFunction = (value) => {
865
- try {
866
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
867
- } catch (e) {
868
- return false;
869
- }
870
- };
871
-
872
913
  // ../config-tools/src/utilities/process-handler.ts
873
914
  var exitWithError = (config) => {
874
915
  writeFatal("Exiting script with an error status...", config);
@@ -1126,6 +1167,19 @@ var getThemeColorConfigEnv = (prefix, theme) => {
1126
1167
  return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
1127
1168
  };
1128
1169
  var getSingleThemeColorConfigEnv = (prefix) => {
1170
+ const gradient = [];
1171
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1172
+ gradient.push(
1173
+ process.env[`${prefix}GRADIENT_START`],
1174
+ process.env[`${prefix}GRADIENT_END`]
1175
+ );
1176
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1177
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1178
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1179
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1180
+ index++;
1181
+ }
1182
+ }
1129
1183
  return {
1130
1184
  dark: process.env[`${prefix}DARK`],
1131
1185
  light: process.env[`${prefix}LIGHT`],
@@ -1140,7 +1194,8 @@ var getSingleThemeColorConfigEnv = (prefix) => {
1140
1194
  danger: process.env[`${prefix}DANGER`],
1141
1195
  fatal: process.env[`${prefix}FATAL`],
1142
1196
  positive: process.env[`${prefix}POSITIVE`],
1143
- negative: process.env[`${prefix}NEGATIVE`]
1197
+ negative: process.env[`${prefix}NEGATIVE`],
1198
+ gradient
1144
1199
  };
1145
1200
  };
1146
1201
  var getMultiThemeColorConfigEnv = (prefix) => {
@@ -1152,6 +1207,19 @@ var getMultiThemeColorConfigEnv = (prefix) => {
1152
1207
  };
1153
1208
  };
1154
1209
  var getBaseThemeColorConfigEnv = (prefix) => {
1210
+ const gradient = [];
1211
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1212
+ gradient.push(
1213
+ process.env[`${prefix}GRADIENT_START`],
1214
+ process.env[`${prefix}GRADIENT_END`]
1215
+ );
1216
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1217
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1218
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1219
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1220
+ index++;
1221
+ }
1222
+ }
1155
1223
  return {
1156
1224
  foreground: process.env[`${prefix}FOREGROUND`],
1157
1225
  background: process.env[`${prefix}BACKGROUND`],
@@ -1166,7 +1234,8 @@ var getBaseThemeColorConfigEnv = (prefix) => {
1166
1234
  danger: process.env[`${prefix}DANGER`],
1167
1235
  fatal: process.env[`${prefix}FATAL`],
1168
1236
  positive: process.env[`${prefix}POSITIVE`],
1169
- negative: process.env[`${prefix}NEGATIVE`]
1237
+ negative: process.env[`${prefix}NEGATIVE`],
1238
+ gradient
1170
1239
  };
1171
1240
  };
1172
1241
 
@@ -1297,11 +1366,12 @@ var setConfigEnv = (config) => {
1297
1366
  process.env[`${prefix}TIMEZONE`] = config.timezone;
1298
1367
  process.env.TZ = config.timezone;
1299
1368
  process.env.DEFAULT_TIMEZONE = config.timezone;
1369
+ process.env.TIMEZONE = config.timezone;
1300
1370
  }
1301
1371
  if (config.locale) {
1302
1372
  process.env[`${prefix}LOCALE`] = config.locale;
1303
- process.env.LOCALE = config.locale;
1304
1373
  process.env.DEFAULT_LOCALE = config.locale;
1374
+ process.env.LOCALE = config.locale;
1305
1375
  process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1306
1376
  }
1307
1377
  if (config.configFile) {
@@ -1462,6 +1532,11 @@ var setSingleThemeColorConfigEnv = (prefix, config) => {
1462
1532
  if (config.negative) {
1463
1533
  process.env[`${prefix}NEGATIVE`] = config.negative;
1464
1534
  }
1535
+ if (config.gradient) {
1536
+ for (let i = 0; i < config.gradient.length; i++) {
1537
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1538
+ }
1539
+ }
1465
1540
  };
1466
1541
  var setMultiThemeColorConfigEnv = (prefix, config) => {
1467
1542
  return {
@@ -1512,6 +1587,11 @@ var setBaseThemeColorConfigEnv = (prefix, config) => {
1512
1587
  if (config.negative) {
1513
1588
  process.env[`${prefix}NEGATIVE`] = config.negative;
1514
1589
  }
1590
+ if (config.gradient) {
1591
+ for (let i = 0; i < config.gradient.length; i++) {
1592
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1593
+ }
1594
+ }
1515
1595
  };
1516
1596
 
1517
1597
  // ../config-tools/src/create-storm-config.ts