@storm-software/config-tools 1.190.119 → 1.190.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +20 -1532
  3. package/bin/config.js +19 -1527
  4. package/dist/config-file/get-config-file.cjs +80 -25
  5. package/dist/config-file/get-config-file.js +79 -24
  6. package/dist/config-file/index.cjs +1 -29
  7. package/dist/config-file/index.js +1 -29
  8. package/dist/create-storm-config.cjs +138 -26
  9. package/dist/create-storm-config.js +140 -28
  10. package/dist/env/get-env.cjs +221 -6
  11. package/dist/env/get-env.js +221 -6
  12. package/dist/env/index.cjs +2 -18
  13. package/dist/env/index.js +2 -18
  14. package/dist/env/set-env.cjs +383 -8
  15. package/dist/env/set-env.js +382 -7
  16. package/dist/get-config.cjs +28 -27
  17. package/dist/get-config.js +29 -28
  18. package/dist/index.cjs +7 -201
  19. package/dist/index.js +7 -201
  20. package/dist/logger/chalk.cjs +32 -4
  21. package/dist/logger/chalk.js +31 -3
  22. package/dist/logger/console-icons.cjs +15 -6
  23. package/dist/logger/console-icons.js +14 -5
  24. package/dist/logger/console.cjs +191 -37
  25. package/dist/logger/console.js +176 -22
  26. package/dist/logger/create-logger.cjs +25 -12
  27. package/dist/logger/create-logger.js +24 -11
  28. package/dist/logger/format-timestamp.cjs +4 -4
  29. package/dist/logger/format-timestamp.js +3 -3
  30. package/dist/logger/get-log-level.cjs +60 -7
  31. package/dist/logger/get-log-level.js +59 -6
  32. package/dist/logger/index.cjs +7 -61
  33. package/dist/logger/index.js +7 -61
  34. package/dist/logger/is-unicode-supported.cjs +10 -4
  35. package/dist/logger/is-unicode-supported.js +9 -3
  36. package/dist/types.cjs +25 -5
  37. package/dist/types.js +24 -4
  38. package/dist/utilities/apply-workspace-tokens.cjs +72 -9
  39. package/dist/utilities/apply-workspace-tokens.js +71 -8
  40. package/dist/utilities/colors.cjs +76 -7
  41. package/dist/utilities/colors.js +75 -6
  42. package/dist/utilities/correct-paths.cjs +231 -32
  43. package/dist/utilities/correct-paths.js +215 -16
  44. package/dist/utilities/file-path-utils.cjs +29 -7
  45. package/dist/utilities/file-path-utils.js +28 -6
  46. package/dist/utilities/find-up.cjs +21 -4
  47. package/dist/utilities/find-up.js +20 -3
  48. package/dist/utilities/find-workspace-root.cjs +74 -7
  49. package/dist/utilities/find-workspace-root.js +73 -6
  50. package/dist/utilities/get-default-config.cjs +90 -6
  51. package/dist/utilities/get-default-config.js +90 -6
  52. package/dist/utilities/index.cjs +9 -109
  53. package/dist/utilities/index.js +9 -109
  54. package/dist/utilities/process-handler.cjs +46 -11
  55. package/dist/utilities/process-handler.js +47 -12
  56. package/dist/utilities/run.cjs +34 -6
  57. package/dist/utilities/run.js +33 -5
  58. package/dist/utilities/toml.cjs +42 -24
  59. package/dist/utilities/toml.js +35 -17
  60. package/package.json +4 -4
  61. package/dist/chunk-24B36RDB.cjs +0 -81
  62. package/dist/chunk-27N3QEX5.js +0 -40
  63. package/dist/chunk-2AVLCXLT.js +0 -0
  64. package/dist/chunk-2RLMTBVZ.js +0 -233
  65. package/dist/chunk-2WBD2G3E.cjs +0 -38
  66. package/dist/chunk-3COHMHPU.cjs +0 -1
  67. package/dist/chunk-4Q45WJYQ.js +0 -165
  68. package/dist/chunk-5C7PIENF.js +0 -92
  69. package/dist/chunk-5J2SS4QU.js +0 -83
  70. package/dist/chunk-65SWKEHV.cjs +0 -1
  71. package/dist/chunk-6Y623TCS.cjs +0 -40
  72. package/dist/chunk-7PV6L7I7.cjs +0 -1
  73. package/dist/chunk-7QBTVNMR.cjs +0 -30
  74. package/dist/chunk-BDATZ3UB.cjs +0 -233
  75. package/dist/chunk-BZRTSWH4.cjs +0 -395
  76. package/dist/chunk-D3FRXXDE.js +0 -947
  77. package/dist/chunk-DTGT4OI3.cjs +0 -14
  78. package/dist/chunk-EC2KPWRG.cjs +0 -24
  79. package/dist/chunk-EENQN6N2.js +0 -40
  80. package/dist/chunk-ENI4UUSK.cjs +0 -35
  81. package/dist/chunk-FJNXECWU.js +0 -395
  82. package/dist/chunk-FMDVBSP6.cjs +0 -83
  83. package/dist/chunk-G2MK47WL.js +0 -14
  84. package/dist/chunk-HFS7WJVW.js +0 -81
  85. package/dist/chunk-HVVJHTFS.js +0 -36
  86. package/dist/chunk-IWD6YQKX.cjs +0 -1
  87. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  88. package/dist/chunk-JK4TT5IV.js +0 -35
  89. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  90. package/dist/chunk-JZAYHDV3.js +0 -8
  91. package/dist/chunk-KSMN3HSC.js +0 -38
  92. package/dist/chunk-L6UNTUC4.js +0 -0
  93. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  94. package/dist/chunk-MBG2FTBL.cjs +0 -47
  95. package/dist/chunk-MQG74XF7.js +0 -102
  96. package/dist/chunk-MSAQEGBK.cjs +0 -92
  97. package/dist/chunk-NJFLUTGH.cjs +0 -25
  98. package/dist/chunk-PCYB64MB.cjs +0 -40
  99. package/dist/chunk-RALMUN5C.js +0 -30
  100. package/dist/chunk-RRKB32OH.js +0 -0
  101. package/dist/chunk-RUKM6FCF.js +0 -25
  102. package/dist/chunk-SIW7AXUG.js +0 -56
  103. package/dist/chunk-SLICWTO2.cjs +0 -165
  104. package/dist/chunk-SO3FWVXC.js +0 -84
  105. package/dist/chunk-SXPH7ILL.js +0 -70
  106. package/dist/chunk-T7YISGRS.cjs +0 -102
  107. package/dist/chunk-TZZRLM5J.cjs +0 -947
  108. package/dist/chunk-UJ77IBHD.cjs +0 -233
  109. package/dist/chunk-UKGRDKIH.js +0 -0
  110. package/dist/chunk-V3GMJ4TX.js +0 -233
  111. package/dist/chunk-WQJYIPSL.cjs +0 -8
  112. package/dist/chunk-YBVOKYAM.cjs +0 -56
  113. package/dist/chunk-YX4736HU.js +0 -47
  114. package/dist/chunk-ZFNAUMQS.js +0 -24
@@ -1,37 +1,191 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- var _chunkTZZRLM5Jcjs = require('../chunk-TZZRLM5J.cjs');
16
- require('../chunk-FMDVBSP6.cjs');
17
- require('../chunk-LOY6ICHZ.cjs');
18
- require('../chunk-EC2KPWRG.cjs');
19
- require('../chunk-DTGT4OI3.cjs');
20
- require('../chunk-WQJYIPSL.cjs');
21
- require('../chunk-JWLDCEBZ.cjs');
22
- require('../chunk-7QBTVNMR.cjs');
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
- exports.brandIcon = _chunkTZZRLM5Jcjs.brandIcon; exports.formatLogMessage = _chunkTZZRLM5Jcjs.formatLogMessage; exports.getLogFn = _chunkTZZRLM5Jcjs.getLogFn; exports.getStopwatch = _chunkTZZRLM5Jcjs.getStopwatch; exports.writeDebug = _chunkTZZRLM5Jcjs.writeDebug; exports.writeError = _chunkTZZRLM5Jcjs.writeError; exports.writeFatal = _chunkTZZRLM5Jcjs.writeFatal; exports.writeInfo = _chunkTZZRLM5Jcjs.writeInfo; exports.writePerformance = _chunkTZZRLM5Jcjs.writePerformance; exports.writeSuccess = _chunkTZZRLM5Jcjs.writeSuccess; exports.writeSystem = _chunkTZZRLM5Jcjs.writeSystem; exports.writeTrace = _chunkTZZRLM5Jcjs.writeTrace; exports.writeWarning = _chunkTZZRLM5Jcjs.writeWarning;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _formatDistanceToNow = require('date-fns/formatDistanceToNow');
2
+ var _types = require('../types');
3
+ var _colors = require('../utilities/colors');
4
+ var _chalk2 = require('./chalk');
5
+ var _consoleicons = require('./console-icons');
6
+ var _formattimestamp = require('./format-timestamp');
7
+ var _getloglevel = require('./get-log-level');
8
+ const getLogFn = (logLevel = _types.LogLevel.INFO, config = {}, options = {}) => {
9
+ const {
10
+ chalk: _chalk = _chalk2.getChalk.call(void 0, ),
11
+ fullDateTime = false,
12
+ hideDateTime = false
13
+ } = options;
14
+ const colors = !_optionalChain([config, 'access', _2 => _2.colors, 'optionalAccess', _3 => _3.dark]) && !_optionalChain([config, 'access', _4 => _4.colors, 'optionalAccess', _5 => _5["base"]]) && !_optionalChain([config, 'access', _6 => _6.colors, 'optionalAccess', _7 => _7["base"], 'optionalAccess', _8 => _8.dark]) ? _colors.DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15["base"]]) ? _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"]]) : _colors.DEFAULT_COLOR_CONFIG;
15
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || _types.LogLevelLabel.INFO;
16
+ if (logLevel > _getloglevel.getLogLevel.call(void 0, configLogLevel) || logLevel <= _types.LogLevel.SILENT || _getloglevel.getLogLevel.call(void 0, configLogLevel) <= _types.LogLevel.SILENT) {
17
+ return (_) => {
18
+ };
19
+ }
20
+ if (typeof logLevel === "number" && _types.LogLevel.FATAL >= logLevel) {
21
+ return (message) => {
22
+ console.error(
23
+ `
24
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.fatal)))(
25
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.FATAL]} Fatal] `
26
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
27
+ `
28
+ );
29
+ };
30
+ }
31
+ if (typeof logLevel === "number" && _types.LogLevel.ERROR >= logLevel) {
32
+ return (message) => {
33
+ console.error(
34
+ `
35
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.danger, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.danger)))(
36
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.ERROR]} Error] `
37
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
38
+ `
39
+ );
40
+ };
41
+ }
42
+ if (typeof logLevel === "number" && _types.LogLevel.WARN >= logLevel) {
43
+ return (message) => {
44
+ console.warn(
45
+ `
46
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.warning, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.warning)))(
47
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.WARN]} Warn] `
48
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
49
+ `
50
+ );
51
+ };
52
+ }
53
+ if (typeof logLevel === "number" && _types.LogLevel.SUCCESS >= logLevel) {
54
+ return (message) => {
55
+ console.info(
56
+ `
57
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.success, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.success)))(
58
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.SUCCESS]} Success] `
59
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
60
+ `
61
+ );
62
+ };
63
+ }
64
+ if (typeof logLevel === "number" && _types.LogLevel.INFO >= logLevel) {
65
+ return (message) => {
66
+ console.info(
67
+ `
68
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.info, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.info)))(
69
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.INFO]} Info] `
70
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
71
+ `
72
+ );
73
+ };
74
+ }
75
+ if (typeof logLevel === "number" && _types.LogLevel.PERFORMANCE >= logLevel) {
76
+ return (message) => {
77
+ console.debug(
78
+ `
79
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.performance, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.performance)))(
80
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.PERFORMANCE]} Performance] `
81
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
82
+ `
83
+ );
84
+ };
85
+ }
86
+ if (typeof logLevel === "number" && _types.LogLevel.DEBUG >= logLevel) {
87
+ return (message) => {
88
+ console.debug(
89
+ `
90
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.debug, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.debug)))(
91
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.DEBUG]} Debug] `
92
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
93
+ `
94
+ );
95
+ };
96
+ }
97
+ if (typeof logLevel === "number" && _types.LogLevel.TRACE >= logLevel) {
98
+ return (message) => {
99
+ console.debug(
100
+ `
101
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex("#bbbbbb")(
102
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.TRACE]} Trace] `
103
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
104
+ `
105
+ );
106
+ };
107
+ }
108
+ return (message) => {
109
+ console.log(
110
+ `
111
+ ${hideDateTime ? "" : `${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, fullDateTime))} `}${_chalk.hex(_nullishCoalesce(colors.brand, () => ( _colors.DEFAULT_COLOR_CONFIG.dark.brand)))(
112
+ `[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.ALL]} System] `
113
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
114
+ `
115
+ );
116
+ };
117
+ };
118
+ const writeFatal = (message, config) => getLogFn(_types.LogLevel.FATAL, config)(message);
119
+ const writeError = (message, config) => getLogFn(_types.LogLevel.ERROR, config)(message);
120
+ const writeWarning = (message, config) => getLogFn(_types.LogLevel.WARN, config)(message);
121
+ const writeInfo = (message, config) => getLogFn(_types.LogLevel.INFO, config)(message);
122
+ const writeSuccess = (message, config) => getLogFn(_types.LogLevel.SUCCESS, config)(message);
123
+ const writePerformance = (message, config) => getLogFn(_types.LogLevel.PERFORMANCE, config)(message);
124
+ const writeDebug = (message, config) => getLogFn(_types.LogLevel.DEBUG, config)(message);
125
+ const writeTrace = (message, config) => getLogFn(_types.LogLevel.TRACE, config)(message);
126
+ const writeSystem = (message, config) => getLogFn(_types.LogLevel.ALL, config)(message);
127
+ const getStopwatch = (name) => {
128
+ const start = /* @__PURE__ */ new Date();
129
+ return () => {
130
+ writePerformance(
131
+ `The${name ? ` ${name}` : ""} process took ${_formatDistanceToNow.formatDistanceToNow.call(void 0, start, {
132
+ includeSeconds: true
133
+ })} to complete`
134
+ );
135
+ };
136
+ };
137
+ const MAX_DEPTH = 10;
138
+ const formatLogMessage = (message, options = {}, depth = 0) => {
139
+ if (depth > MAX_DEPTH) {
140
+ return "<max depth>";
141
+ }
142
+ const prefix = _nullishCoalesce(options.prefix, () => ( ""));
143
+ const skip = _nullishCoalesce(options.skip, () => ( []));
144
+ const sort = _nullishCoalesce(options.sort, () => ( true));
145
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
146
+ ${message.sort(
147
+ sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
148
+ ).map(
149
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
150
+ item,
151
+ { prefix: `${prefix}--`, skip, sort },
152
+ depth + 1
153
+ )}`
154
+ ).join("\n")}` : typeof message === "object" && message ? `
155
+ ${Object.keys(message).filter(
156
+ (key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())
157
+ ).sort(
158
+ sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
159
+ ).map(
160
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter(
161
+ (key2) => typeof key2 !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key2.toLowerCase().trim())
162
+ ).length === 0 ? "{}" : formatLogMessage(
163
+ message[key],
164
+ { prefix: `${prefix}--`, skip, sort },
165
+ depth + 1
166
+ ) : message[key]}`
167
+ ).join("\n")}` : String(message);
168
+ };
169
+ const _isFunction = (value) => {
170
+ try {
171
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _18 => _18.constructor]) && _optionalChain([value, 'optionalAccess', _19 => _19.call]) && _optionalChain([value, 'optionalAccess', _20 => _20.apply]));
172
+ } catch (e) {
173
+ return false;
174
+ }
175
+ };
176
+ const brandIcon = (config = {}, _chalk = _chalk2.getChalk.call(void 0, )) => _chalk.hex(_colors.getColor.call(void 0, "brand", config))("\u{1F5F2}");
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ exports.brandIcon = brandIcon; exports.formatLogMessage = formatLogMessage; exports.getLogFn = getLogFn; exports.getStopwatch = getStopwatch; exports.writeDebug = writeDebug; exports.writeError = writeError; exports.writeFatal = writeFatal; exports.writeInfo = writeInfo; exports.writePerformance = writePerformance; exports.writeSuccess = writeSuccess; exports.writeSystem = writeSystem; exports.writeTrace = writeTrace; exports.writeWarning = writeWarning;
@@ -1,25 +1,179 @@
1
- import {
2
- brandIcon,
3
- formatLogMessage,
4
- getLogFn,
5
- getStopwatch,
6
- writeDebug,
7
- writeError,
8
- writeFatal,
9
- writeInfo,
10
- writePerformance,
11
- writeSuccess,
12
- writeSystem,
13
- writeTrace,
14
- writeWarning
15
- } from "../chunk-D3FRXXDE.js";
16
- import "../chunk-5J2SS4QU.js";
17
- import "../chunk-HVVJHTFS.js";
18
- import "../chunk-ZFNAUMQS.js";
19
- import "../chunk-G2MK47WL.js";
20
- import "../chunk-JZAYHDV3.js";
21
- import "../chunk-SXPH7ILL.js";
22
- import "../chunk-RALMUN5C.js";
1
+ import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
2
+ import { LogLevel, LogLevelLabel } from "../types";
3
+ import { DEFAULT_COLOR_CONFIG, getColor } from "../utilities/colors";
4
+ import { getChalk } from "./chalk";
5
+ import { CONSOLE_ICONS } from "./console-icons";
6
+ import { formatTimestamp } from "./format-timestamp";
7
+ import { getLogLevel } from "./get-log-level";
8
+ const getLogFn = (logLevel = LogLevel.INFO, config = {}, options = {}) => {
9
+ const {
10
+ chalk: _chalk = getChalk(),
11
+ fullDateTime = false,
12
+ hideDateTime = false
13
+ } = options;
14
+ 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;
15
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
16
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
17
+ return (_) => {
18
+ };
19
+ }
20
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
21
+ return (message) => {
22
+ console.error(
23
+ `
24
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(
25
+ `[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `
26
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
27
+ `
28
+ );
29
+ };
30
+ }
31
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
32
+ return (message) => {
33
+ console.error(
34
+ `
35
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(
36
+ `[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `
37
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
38
+ `
39
+ );
40
+ };
41
+ }
42
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
43
+ return (message) => {
44
+ console.warn(
45
+ `
46
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(
47
+ `[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `
48
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
49
+ `
50
+ );
51
+ };
52
+ }
53
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
54
+ return (message) => {
55
+ console.info(
56
+ `
57
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(
58
+ `[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `
59
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
60
+ `
61
+ );
62
+ };
63
+ }
64
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
65
+ return (message) => {
66
+ console.info(
67
+ `
68
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(
69
+ `[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `
70
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
71
+ `
72
+ );
73
+ };
74
+ }
75
+ if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) {
76
+ return (message) => {
77
+ console.debug(
78
+ `
79
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance)(
80
+ `[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `
81
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
82
+ `
83
+ );
84
+ };
85
+ }
86
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
87
+ return (message) => {
88
+ console.debug(
89
+ `
90
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug)(
91
+ `[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `
92
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
93
+ `
94
+ );
95
+ };
96
+ }
97
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
98
+ return (message) => {
99
+ console.debug(
100
+ `
101
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(
102
+ `[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `
103
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
104
+ `
105
+ );
106
+ };
107
+ }
108
+ return (message) => {
109
+ console.log(
110
+ `
111
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(
112
+ `[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `
113
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
114
+ `
115
+ );
116
+ };
117
+ };
118
+ const writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
119
+ const writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
120
+ const writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
121
+ const writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
122
+ const writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
123
+ const writePerformance = (message, config) => getLogFn(LogLevel.PERFORMANCE, config)(message);
124
+ const writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
125
+ const writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
126
+ const writeSystem = (message, config) => getLogFn(LogLevel.ALL, config)(message);
127
+ const getStopwatch = (name) => {
128
+ const start = /* @__PURE__ */ new Date();
129
+ return () => {
130
+ writePerformance(
131
+ `The${name ? ` ${name}` : ""} process took ${formatDistanceToNow(start, {
132
+ includeSeconds: true
133
+ })} to complete`
134
+ );
135
+ };
136
+ };
137
+ const MAX_DEPTH = 10;
138
+ const formatLogMessage = (message, options = {}, depth = 0) => {
139
+ if (depth > MAX_DEPTH) {
140
+ return "<max depth>";
141
+ }
142
+ const prefix = options.prefix ?? "";
143
+ const skip = options.skip ?? [];
144
+ const sort = options.sort ?? true;
145
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
146
+ ${message.sort(
147
+ sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
148
+ ).map(
149
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
150
+ item,
151
+ { prefix: `${prefix}--`, skip, sort },
152
+ depth + 1
153
+ )}`
154
+ ).join("\n")}` : typeof message === "object" && message ? `
155
+ ${Object.keys(message).filter(
156
+ (key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())
157
+ ).sort(
158
+ sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
159
+ ).map(
160
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter(
161
+ (key2) => typeof key2 !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key2.toLowerCase().trim())
162
+ ).length === 0 ? "{}" : formatLogMessage(
163
+ message[key],
164
+ { prefix: `${prefix}--`, skip, sort },
165
+ depth + 1
166
+ ) : message[key]}`
167
+ ).join("\n")}` : String(message);
168
+ };
169
+ const _isFunction = (value) => {
170
+ try {
171
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
172
+ } catch {
173
+ return false;
174
+ }
175
+ };
176
+ const brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("\u{1F5F2}");
23
177
  export {
24
178
  brandIcon,
25
179
  formatLogMessage,
@@ -1,14 +1,27 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
2
+ var _types = require('../types');
3
+ var _console = require('./console');
4
+ async function createLogger(config) {
5
+ const writeFatal = _console.getLogFn.call(void 0, _types.LogLevel.FATAL, config, { chalk: _chalk2.default });
6
+ const writeError = _console.getLogFn.call(void 0, _types.LogLevel.ERROR, config, { chalk: _chalk2.default });
7
+ const writeWarning = _console.getLogFn.call(void 0, _types.LogLevel.WARN, config, { chalk: _chalk2.default });
8
+ const writeInfo = _console.getLogFn.call(void 0, _types.LogLevel.INFO, config, { chalk: _chalk2.default });
9
+ const writeSuccess = _console.getLogFn.call(void 0, _types.LogLevel.SUCCESS, config, { chalk: _chalk2.default });
10
+ const writeDebug = _console.getLogFn.call(void 0, _types.LogLevel.DEBUG, config, { chalk: _chalk2.default });
11
+ const writePerformance = _console.getLogFn.call(void 0, _types.LogLevel.PERFORMANCE, config, { chalk: _chalk2.default });
12
+ const writeTrace = _console.getLogFn.call(void 0, _types.LogLevel.TRACE, config, { chalk: _chalk2.default });
13
+ return {
14
+ fatal: writeFatal,
15
+ error: writeError,
16
+ warning: writeWarning,
17
+ info: writeInfo,
18
+ success: writeSuccess,
19
+ performance: writePerformance,
20
+ debug: writeDebug,
21
+ trace: writeTrace,
22
+ getStopwatch: _console.getStopwatch
23
+ };
24
+ }
2
25
 
3
- var _chunkENI4UUSKcjs = require('../chunk-ENI4UUSK.cjs');
4
- require('../chunk-TZZRLM5J.cjs');
5
- require('../chunk-FMDVBSP6.cjs');
6
- require('../chunk-LOY6ICHZ.cjs');
7
- require('../chunk-EC2KPWRG.cjs');
8
- require('../chunk-DTGT4OI3.cjs');
9
- require('../chunk-WQJYIPSL.cjs');
10
- require('../chunk-JWLDCEBZ.cjs');
11
- require('../chunk-7QBTVNMR.cjs');
12
26
 
13
-
14
- exports.createLogger = _chunkENI4UUSKcjs.createLogger;
27
+ exports.createLogger = createLogger;
@@ -1,14 +1,27 @@
1
- import {
2
- createLogger
3
- } from "../chunk-JK4TT5IV.js";
4
- import "../chunk-D3FRXXDE.js";
5
- import "../chunk-5J2SS4QU.js";
6
- import "../chunk-HVVJHTFS.js";
7
- import "../chunk-ZFNAUMQS.js";
8
- import "../chunk-G2MK47WL.js";
9
- import "../chunk-JZAYHDV3.js";
10
- import "../chunk-SXPH7ILL.js";
11
- import "../chunk-RALMUN5C.js";
1
+ import chalk from "chalk";
2
+ import { LogLevel } from "../types";
3
+ import { getLogFn, getStopwatch } from "./console";
4
+ async function createLogger(config) {
5
+ const writeFatal = getLogFn(LogLevel.FATAL, config, { chalk });
6
+ const writeError = getLogFn(LogLevel.ERROR, config, { chalk });
7
+ const writeWarning = getLogFn(LogLevel.WARN, config, { chalk });
8
+ const writeInfo = getLogFn(LogLevel.INFO, config, { chalk });
9
+ const writeSuccess = getLogFn(LogLevel.SUCCESS, config, { chalk });
10
+ const writeDebug = getLogFn(LogLevel.DEBUG, config, { chalk });
11
+ const writePerformance = getLogFn(LogLevel.PERFORMANCE, config, { chalk });
12
+ const writeTrace = getLogFn(LogLevel.TRACE, config, { chalk });
13
+ return {
14
+ fatal: writeFatal,
15
+ error: writeError,
16
+ warning: writeWarning,
17
+ info: writeInfo,
18
+ success: writeSuccess,
19
+ performance: writePerformance,
20
+ debug: writeDebug,
21
+ trace: writeTrace,
22
+ getStopwatch
23
+ };
24
+ }
12
25
  export {
13
26
  createLogger
14
27
  };
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});const formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
2
+ return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
3
+ };
2
4
 
3
- var _chunkWQJYIPSLcjs = require('../chunk-WQJYIPSL.cjs');
4
5
 
5
-
6
- exports.formatTimestamp = _chunkWQJYIPSLcjs.formatTimestamp;
6
+ exports.formatTimestamp = formatTimestamp;
@@ -1,6 +1,6 @@
1
- import {
2
- formatTimestamp
3
- } from "../chunk-JZAYHDV3.js";
1
+ const formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
2
+ return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
3
+ };
4
4
  export {
5
5
  formatTimestamp
6
6
  };
@@ -1,11 +1,64 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../types');
2
+ const getLogLevel = (label) => {
3
+ switch (label) {
4
+ case "all":
5
+ return _types.LogLevel.ALL;
6
+ case "trace":
7
+ return _types.LogLevel.TRACE;
8
+ case "debug":
9
+ return _types.LogLevel.DEBUG;
10
+ case "performance":
11
+ return _types.LogLevel.PERFORMANCE;
12
+ case "info":
13
+ return _types.LogLevel.INFO;
14
+ case "warn":
15
+ return _types.LogLevel.WARN;
16
+ case "error":
17
+ return _types.LogLevel.ERROR;
18
+ case "fatal":
19
+ return _types.LogLevel.FATAL;
20
+ case "silent":
21
+ return _types.LogLevel.SILENT;
22
+ default:
23
+ return _types.LogLevel.INFO;
24
+ }
25
+ };
26
+ const getLogLevelLabel = (logLevel = _types.LogLevel.INFO) => {
27
+ if (logLevel >= _types.LogLevel.ALL) {
28
+ return _types.LogLevelLabel.ALL;
29
+ }
30
+ if (logLevel >= _types.LogLevel.TRACE) {
31
+ return _types.LogLevelLabel.TRACE;
32
+ }
33
+ if (logLevel >= _types.LogLevel.DEBUG) {
34
+ return _types.LogLevelLabel.DEBUG;
35
+ }
36
+ if (logLevel >= _types.LogLevel.PERFORMANCE) {
37
+ return _types.LogLevelLabel.PERFORMANCE;
38
+ }
39
+ if (logLevel >= _types.LogLevel.INFO) {
40
+ return _types.LogLevelLabel.INFO;
41
+ }
42
+ if (logLevel >= _types.LogLevel.WARN) {
43
+ return _types.LogLevelLabel.WARN;
44
+ }
45
+ if (logLevel >= _types.LogLevel.ERROR) {
46
+ return _types.LogLevelLabel.ERROR;
47
+ }
48
+ if (logLevel >= _types.LogLevel.FATAL) {
49
+ return _types.LogLevelLabel.FATAL;
50
+ }
51
+ if (logLevel <= _types.LogLevel.SILENT) {
52
+ return _types.LogLevelLabel.SILENT;
53
+ }
54
+ return _types.LogLevelLabel.INFO;
55
+ };
56
+ const isVerbose = (label = _types.LogLevelLabel.SILENT) => {
57
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
58
+ return logLevel >= _types.LogLevel.DEBUG;
59
+ };
2
60
 
3
61
 
4
62
 
5
- var _chunkJWLDCEBZcjs = require('../chunk-JWLDCEBZ.cjs');
6
- require('../chunk-7QBTVNMR.cjs');
7
63
 
8
-
9
-
10
-
11
- exports.getLogLevel = _chunkJWLDCEBZcjs.getLogLevel; exports.getLogLevelLabel = _chunkJWLDCEBZcjs.getLogLevelLabel; exports.isVerbose = _chunkJWLDCEBZcjs.isVerbose;
64
+ exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose;