@storm-software/config-tools 1.190.119 → 1.190.121

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 (211) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1213 -1558
  3. package/bin/config.mjs +1271 -0
  4. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  5. package/dist/config-file/get-config-file.cjs +67 -28
  6. package/dist/config-file/get-config-file.d.cts +5 -5
  7. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  8. package/dist/config-file/get-config-file.mjs +66 -0
  9. package/dist/config-file/index.cjs +4 -29
  10. package/dist/config-file/index.d.cts +2 -3
  11. package/dist/config-file/index.d.mts +4 -0
  12. package/dist/config-file/index.mjs +5 -0
  13. package/dist/create-storm-config.cjs +115 -34
  14. package/dist/create-storm-config.d.cts +5 -5
  15. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  16. package/dist/create-storm-config.mjs +113 -0
  17. package/dist/env/get-env.cjs +202 -11
  18. package/dist/env/get-env.d.cts +5 -5
  19. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  20. package/dist/env/get-env.mjs +203 -0
  21. package/dist/env/index.cjs +7 -18
  22. package/dist/env/index.d.cts +3 -4
  23. package/dist/env/index.d.mts +5 -0
  24. package/dist/env/index.mjs +6 -0
  25. package/dist/env/set-env.cjs +230 -11
  26. package/dist/env/set-env.d.cts +8 -8
  27. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  28. package/dist/env/set-env.mjs +231 -0
  29. package/dist/get-config.cjs +46 -34
  30. package/dist/get-config.d.cts +18 -18
  31. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  32. package/dist/get-config.mjs +46 -0
  33. package/dist/index.cjs +98 -201
  34. package/dist/index.d.cts +27 -28
  35. package/dist/index.d.mts +29 -0
  36. package/dist/index.mjs +26 -0
  37. package/dist/logger/chalk.cjs +43 -6
  38. package/dist/logger/chalk.d.cts +18 -17
  39. package/dist/logger/chalk.d.mts +37 -0
  40. package/dist/logger/chalk.mjs +43 -0
  41. package/dist/logger/console-icons.cjs +18 -8
  42. package/dist/logger/console-icons.d.cts +5 -8
  43. package/dist/logger/console-icons.d.mts +7 -0
  44. package/dist/logger/console-icons.mjs +20 -0
  45. package/dist/logger/console.cjs +195 -37
  46. package/dist/logger/console.d.cts +25 -25
  47. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  48. package/dist/logger/console.mjs +185 -0
  49. package/dist/logger/create-logger.cjs +34 -14
  50. package/dist/logger/create-logger.d.cts +5 -6
  51. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  52. package/dist/logger/create-logger.mjs +34 -0
  53. package/dist/logger/format-timestamp.cjs +14 -6
  54. package/dist/logger/format-timestamp.d.cts +3 -2
  55. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  56. package/dist/logger/format-timestamp.mjs +16 -0
  57. package/dist/logger/get-log-level.cjs +54 -11
  58. package/dist/logger/get-log-level.d.cts +4 -5
  59. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  60. package/dist/logger/get-log-level.mjs +54 -0
  61. package/dist/logger/index.cjs +29 -61
  62. package/dist/logger/index.d.cts +8 -10
  63. package/dist/logger/index.d.mts +10 -0
  64. package/dist/logger/index.mjs +11 -0
  65. package/dist/logger/is-unicode-supported.cjs +8 -6
  66. package/dist/logger/is-unicode-supported.d.cts +3 -2
  67. package/dist/logger/is-unicode-supported.d.mts +6 -0
  68. package/dist/logger/is-unicode-supported.mjs +10 -0
  69. package/dist/types.cjs +29 -8
  70. package/dist/types.d.cts +39 -41
  71. package/dist/types.d.mts +53 -0
  72. package/dist/types.mjs +30 -0
  73. package/dist/utilities/apply-workspace-tokens.cjs +37 -13
  74. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  75. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  76. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  77. package/dist/utilities/colors.cjs +98 -12
  78. package/dist/utilities/colors.d.cts +4 -4
  79. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  80. package/dist/utilities/colors.mjs +97 -0
  81. package/dist/utilities/correct-paths.cjs +201 -32
  82. package/dist/utilities/correct-paths.d.cts +4 -4
  83. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  84. package/dist/utilities/correct-paths.mjs +190 -0
  85. package/dist/utilities/file-path-utils.cjs +48 -11
  86. package/dist/utilities/file-path-utils.d.cts +15 -14
  87. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  88. package/dist/utilities/file-path-utils.mjs +48 -0
  89. package/dist/utilities/find-up.cjs +17 -6
  90. package/dist/utilities/find-up.d.cts +3 -2
  91. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  92. package/dist/utilities/find-up.mjs +19 -0
  93. package/dist/utilities/find-workspace-root.cjs +72 -10
  94. package/dist/utilities/find-workspace-root.d.cts +3 -2
  95. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  96. package/dist/utilities/find-workspace-root.mjs +73 -0
  97. package/dist/utilities/get-default-config.cjs +73 -11
  98. package/dist/utilities/get-default-config.d.cts +4 -4
  99. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  100. package/dist/utilities/get-default-config.mjs +74 -0
  101. package/dist/utilities/index.cjs +49 -109
  102. package/dist/utilities/index.d.cts +10 -14
  103. package/dist/utilities/index.d.mts +12 -0
  104. package/dist/utilities/index.mjs +13 -0
  105. package/dist/utilities/process-handler.cjs +38 -18
  106. package/dist/utilities/process-handler.d.cts +4 -4
  107. package/dist/utilities/process-handler.d.mts +9 -0
  108. package/dist/utilities/process-handler.mjs +38 -0
  109. package/dist/utilities/run.cjs +64 -10
  110. package/dist/utilities/run.d.cts +5 -6
  111. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  112. package/dist/utilities/run.mjs +64 -0
  113. package/dist/utilities/toml.cjs +37 -24
  114. package/dist/utilities/toml.d.cts +148 -147
  115. package/dist/utilities/toml.d.mts +192 -0
  116. package/dist/utilities/toml.mjs +33 -0
  117. package/package.json +106 -158
  118. package/bin/config.js +0 -1616
  119. package/dist/chunk-24B36RDB.cjs +0 -81
  120. package/dist/chunk-27N3QEX5.js +0 -40
  121. package/dist/chunk-2AVLCXLT.js +0 -0
  122. package/dist/chunk-2RLMTBVZ.js +0 -233
  123. package/dist/chunk-2WBD2G3E.cjs +0 -38
  124. package/dist/chunk-3COHMHPU.cjs +0 -1
  125. package/dist/chunk-4Q45WJYQ.js +0 -165
  126. package/dist/chunk-5C7PIENF.js +0 -92
  127. package/dist/chunk-5J2SS4QU.js +0 -83
  128. package/dist/chunk-65SWKEHV.cjs +0 -1
  129. package/dist/chunk-6Y623TCS.cjs +0 -40
  130. package/dist/chunk-7PV6L7I7.cjs +0 -1
  131. package/dist/chunk-7QBTVNMR.cjs +0 -30
  132. package/dist/chunk-BDATZ3UB.cjs +0 -233
  133. package/dist/chunk-BZRTSWH4.cjs +0 -395
  134. package/dist/chunk-D3FRXXDE.js +0 -947
  135. package/dist/chunk-DTGT4OI3.cjs +0 -14
  136. package/dist/chunk-EC2KPWRG.cjs +0 -24
  137. package/dist/chunk-EENQN6N2.js +0 -40
  138. package/dist/chunk-ENI4UUSK.cjs +0 -35
  139. package/dist/chunk-FJNXECWU.js +0 -395
  140. package/dist/chunk-FMDVBSP6.cjs +0 -83
  141. package/dist/chunk-G2MK47WL.js +0 -14
  142. package/dist/chunk-HFS7WJVW.js +0 -81
  143. package/dist/chunk-HVVJHTFS.js +0 -36
  144. package/dist/chunk-IWD6YQKX.cjs +0 -1
  145. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  146. package/dist/chunk-JK4TT5IV.js +0 -35
  147. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  148. package/dist/chunk-JZAYHDV3.js +0 -8
  149. package/dist/chunk-KSMN3HSC.js +0 -38
  150. package/dist/chunk-L6UNTUC4.js +0 -0
  151. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  152. package/dist/chunk-MBG2FTBL.cjs +0 -47
  153. package/dist/chunk-MQG74XF7.js +0 -102
  154. package/dist/chunk-MSAQEGBK.cjs +0 -92
  155. package/dist/chunk-NJFLUTGH.cjs +0 -25
  156. package/dist/chunk-PCYB64MB.cjs +0 -40
  157. package/dist/chunk-RALMUN5C.js +0 -30
  158. package/dist/chunk-RRKB32OH.js +0 -0
  159. package/dist/chunk-RUKM6FCF.js +0 -25
  160. package/dist/chunk-SIW7AXUG.js +0 -56
  161. package/dist/chunk-SLICWTO2.cjs +0 -165
  162. package/dist/chunk-SO3FWVXC.js +0 -84
  163. package/dist/chunk-SXPH7ILL.js +0 -70
  164. package/dist/chunk-T7YISGRS.cjs +0 -102
  165. package/dist/chunk-TZZRLM5J.cjs +0 -947
  166. package/dist/chunk-UJ77IBHD.cjs +0 -233
  167. package/dist/chunk-UKGRDKIH.js +0 -0
  168. package/dist/chunk-V3GMJ4TX.js +0 -233
  169. package/dist/chunk-WQJYIPSL.cjs +0 -8
  170. package/dist/chunk-YBVOKYAM.cjs +0 -56
  171. package/dist/chunk-YX4736HU.js +0 -47
  172. package/dist/chunk-ZFNAUMQS.js +0 -24
  173. package/dist/config-file/get-config-file.js +0 -28
  174. package/dist/config-file/index.d.ts +0 -3
  175. package/dist/config-file/index.js +0 -29
  176. package/dist/create-storm-config.js +0 -35
  177. package/dist/env/get-env.js +0 -11
  178. package/dist/env/index.d.ts +0 -4
  179. package/dist/env/index.js +0 -18
  180. package/dist/env/set-env.js +0 -11
  181. package/dist/get-config.js +0 -34
  182. package/dist/index.d.ts +0 -28
  183. package/dist/index.js +0 -201
  184. package/dist/logger/chalk.d.ts +0 -34
  185. package/dist/logger/chalk.js +0 -6
  186. package/dist/logger/console-icons.d.ts +0 -8
  187. package/dist/logger/console-icons.js +0 -8
  188. package/dist/logger/console.js +0 -37
  189. package/dist/logger/create-logger.js +0 -14
  190. package/dist/logger/format-timestamp.js +0 -6
  191. package/dist/logger/get-log-level.js +0 -11
  192. package/dist/logger/index.d.ts +0 -10
  193. package/dist/logger/index.js +0 -61
  194. package/dist/logger/is-unicode-supported.d.ts +0 -3
  195. package/dist/logger/is-unicode-supported.js +0 -6
  196. package/dist/types.d.ts +0 -53
  197. package/dist/types.js +0 -8
  198. package/dist/utilities/apply-workspace-tokens.js +0 -13
  199. package/dist/utilities/colors.js +0 -12
  200. package/dist/utilities/correct-paths.js +0 -32
  201. package/dist/utilities/file-path-utils.js +0 -11
  202. package/dist/utilities/find-up.js +0 -6
  203. package/dist/utilities/find-workspace-root.js +0 -10
  204. package/dist/utilities/get-default-config.js +0 -11
  205. package/dist/utilities/index.d.ts +0 -14
  206. package/dist/utilities/index.js +0 -109
  207. package/dist/utilities/process-handler.d.ts +0 -7
  208. package/dist/utilities/process-handler.js +0 -18
  209. package/dist/utilities/run.js +0 -10
  210. package/dist/utilities/toml.d.ts +0 -189
  211. package/dist/utilities/toml.js +0 -24
@@ -0,0 +1,37 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region src/logger/chalk.d.ts
4
+ type GetChalkReturn = {
5
+ hex: (_: string) => (message?: string) => string | undefined;
6
+ bgHex: (_: string) => {
7
+ whiteBright: (message?: string) => string | undefined;
8
+ white: (message?: string) => string | undefined;
9
+ };
10
+ whiteBright: (message?: string) => string | undefined;
11
+ white: (message?: string) => string | undefined;
12
+ gray: (message?: string) => string | undefined;
13
+ bold: {
14
+ hex: (_: string) => (message?: string) => string | undefined;
15
+ bgHex: (_: string) => {
16
+ whiteBright: (message?: string) => string | undefined;
17
+ white: (message?: string) => string | undefined;
18
+ };
19
+ whiteBright: (message?: string) => string | undefined;
20
+ white: (message?: string) => string | undefined;
21
+ };
22
+ dim: {
23
+ hex: (_: string) => (message?: string) => string | undefined;
24
+ gray: (message?: string) => string | undefined;
25
+ };
26
+ };
27
+ /**
28
+ * Get the chalk instance
29
+ *
30
+ * @remarks
31
+ * Annoying polyfill to temporarily fix the issue with the `chalk` import
32
+ *
33
+ * @returns The chalk instance
34
+ */
35
+ declare const getChalk: () => GetChalkReturn;
36
+ //#endregion
37
+ export { GetChalkReturn, getChalk };
@@ -0,0 +1,43 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import chalk from "chalk";
5
+ //#region src/logger/chalk.ts
6
+ const chalkDefault = {
7
+ hex: (_) => (message) => message,
8
+ bgHex: (_) => ({
9
+ whiteBright: (message) => message,
10
+ white: (message) => message
11
+ }),
12
+ white: (message) => message,
13
+ whiteBright: (message) => message,
14
+ gray: (message) => message,
15
+ bold: {
16
+ hex: (_) => (message) => message,
17
+ bgHex: (_) => ({
18
+ whiteBright: (message) => message,
19
+ white: (message) => message
20
+ }),
21
+ whiteBright: (message) => message,
22
+ white: (message) => message
23
+ },
24
+ dim: {
25
+ hex: (_) => (message) => message,
26
+ gray: (message) => message
27
+ }
28
+ };
29
+ /**
30
+ * Get the chalk instance
31
+ *
32
+ * @remarks
33
+ * Annoying polyfill to temporarily fix the issue with the `chalk` import
34
+ *
35
+ * @returns The chalk instance
36
+ */
37
+ const getChalk = () => {
38
+ let _chalk = chalk;
39
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) _chalk = chalkDefault;
40
+ return _chalk;
41
+ };
42
+ //#endregion
43
+ export { getChalk };
@@ -1,8 +1,18 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkEC2KPWRGcjs = require('../chunk-EC2KPWRG.cjs');
4
- require('../chunk-DTGT4OI3.cjs');
5
- require('../chunk-7QBTVNMR.cjs');
6
-
7
-
8
- exports.CONSOLE_ICONS = _chunkEC2KPWRGcjs.CONSOLE_ICONS;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("../types.cjs");
3
+ const require_logger_is_unicode_supported = require("./is-unicode-supported.cjs");
4
+ //#region src/logger/console-icons.ts
5
+ const useIcon = (c, fallback) => require_logger_is_unicode_supported.isUnicodeSupported() ? c : fallback;
6
+ const CONSOLE_ICONS = {
7
+ [require_types.LogLevelLabel.ERROR]: useIcon("✘", "×"),
8
+ [require_types.LogLevelLabel.FATAL]: useIcon("🕱", "×"),
9
+ [require_types.LogLevelLabel.WARN]: useIcon("⚠", "‼"),
10
+ [require_types.LogLevelLabel.INFO]: useIcon("ℹ", "i"),
11
+ [require_types.LogLevelLabel.PERFORMANCE]: useIcon("⏱", "⏱"),
12
+ [require_types.LogLevelLabel.SUCCESS]: useIcon("✔", "√"),
13
+ [require_types.LogLevelLabel.DEBUG]: useIcon("🛠", "D"),
14
+ [require_types.LogLevelLabel.TRACE]: useIcon("⚙", "T"),
15
+ [require_types.LogLevelLabel.ALL]: useIcon("✉", "→")
16
+ };
17
+ //#endregion
18
+ exports.CONSOLE_ICONS = CONSOLE_ICONS;
@@ -1,8 +1,5 @@
1
- import { LogLevelLabel } from '../types.cjs';
2
- import '@storm-software/config';
3
-
4
- declare const CONSOLE_ICONS: {
5
- [k in LogLevelLabel]?: string;
6
- };
7
-
8
- export { CONSOLE_ICONS };
1
+ import { LogLevelLabel } from "../types.cjs";
2
+ //#region src/logger/console-icons.d.ts
3
+ declare const CONSOLE_ICONS: { [k in LogLevelLabel]?: string; };
4
+ //#endregion
5
+ export { CONSOLE_ICONS };
@@ -0,0 +1,7 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { LogLevelLabel } from "../types.mjs";
4
+ //#region src/logger/console-icons.d.ts
5
+ declare const CONSOLE_ICONS: { [k in LogLevelLabel]?: string; };
6
+ //#endregion
7
+ export { CONSOLE_ICONS };
@@ -0,0 +1,20 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { LogLevelLabel } from "../types.mjs";
5
+ import { isUnicodeSupported } from "./is-unicode-supported.mjs";
6
+ //#region src/logger/console-icons.ts
7
+ const useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
8
+ const CONSOLE_ICONS = {
9
+ [LogLevelLabel.ERROR]: useIcon("✘", "×"),
10
+ [LogLevelLabel.FATAL]: useIcon("🕱", "×"),
11
+ [LogLevelLabel.WARN]: useIcon("⚠", "‼"),
12
+ [LogLevelLabel.INFO]: useIcon("ℹ", "i"),
13
+ [LogLevelLabel.PERFORMANCE]: useIcon("⏱", "⏱"),
14
+ [LogLevelLabel.SUCCESS]: useIcon("✔", "√"),
15
+ [LogLevelLabel.DEBUG]: useIcon("🛠", "D"),
16
+ [LogLevelLabel.TRACE]: useIcon("⚙", "T"),
17
+ [LogLevelLabel.ALL]: useIcon("✉", "→")
18
+ };
19
+ //#endregion
20
+ export { CONSOLE_ICONS };
@@ -1,37 +1,195 @@
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
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("../types.cjs");
3
+ const require_utilities_colors = require("../utilities/colors.cjs");
4
+ const require_logger_chalk = require("./chalk.cjs");
5
+ const require_logger_console_icons = require("./console-icons.cjs");
6
+ const require_logger_format_timestamp = require("./format-timestamp.cjs");
7
+ const require_logger_get_log_level = require("./get-log-level.cjs");
8
+ let date_fns_formatDistanceToNow = require("date-fns/formatDistanceToNow");
9
+ //#region src/logger/console.ts
10
+ /**
11
+ * Get the log function for a log level
12
+ *
13
+ * @param logLevel - The log level
14
+ * @param config - The Storm configuration
15
+ * @returns The log function
16
+ */
17
+ const getLogFn = (logLevel = require_types.LogLevel.INFO, config = {}, options = {}) => {
18
+ const { chalk: _chalk = require_logger_chalk.getChalk(), fullDateTime = false, hideDateTime = false } = options;
19
+ const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? require_utilities_colors.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"] : require_utilities_colors.DEFAULT_COLOR_CONFIG;
20
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || require_types.LogLevelLabel.INFO;
21
+ if (logLevel > require_logger_get_log_level.getLogLevel(configLogLevel) || logLevel <= require_types.LogLevel.SILENT || require_logger_get_log_level.getLogLevel(configLogLevel) <= require_types.LogLevel.SILENT) return (_) => {};
22
+ if (typeof logLevel === "number" && require_types.LogLevel.FATAL >= logLevel) return (message) => {
23
+ console.error(`
24
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.fatal)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
25
+ `);
26
+ };
27
+ if (typeof logLevel === "number" && require_types.LogLevel.ERROR >= logLevel) return (message) => {
28
+ console.error(`
29
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.danger)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
30
+ `);
31
+ };
32
+ if (typeof logLevel === "number" && require_types.LogLevel.WARN >= logLevel) return (message) => {
33
+ console.warn(`
34
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.warning)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
35
+ `);
36
+ };
37
+ if (typeof logLevel === "number" && require_types.LogLevel.SUCCESS >= logLevel) return (message) => {
38
+ console.info(`
39
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.success)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
40
+ `);
41
+ };
42
+ if (typeof logLevel === "number" && require_types.LogLevel.INFO >= logLevel) return (message) => {
43
+ console.info(`
44
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.info)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
45
+ `);
46
+ };
47
+ if (typeof logLevel === "number" && require_types.LogLevel.PERFORMANCE >= logLevel) return (message) => {
48
+ console.debug(`
49
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.performance)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.PERFORMANCE]} Performance] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
50
+ `);
51
+ };
52
+ if (typeof logLevel === "number" && require_types.LogLevel.DEBUG >= logLevel) return (message) => {
53
+ console.debug(`
54
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.debug)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
55
+ `);
56
+ };
57
+ if (typeof logLevel === "number" && require_types.LogLevel.TRACE >= logLevel) return (message) => {
58
+ console.debug(`
59
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
60
+ `);
61
+ };
62
+ return (message) => {
63
+ console.log(`
64
+ ${hideDateTime ? "" : `${_chalk.gray(require_logger_format_timestamp.formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? require_utilities_colors.DEFAULT_COLOR_CONFIG.dark.brand)(`[${require_logger_console_icons.CONSOLE_ICONS[require_types.LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
65
+ `);
66
+ };
67
+ };
68
+ /**
69
+ * Write a message to the console at the `fatal` log level
70
+ *
71
+ * @param message - The message to write
72
+ * @param config - The Storm configuration
73
+ */
74
+ const writeFatal = (message, config) => getLogFn(require_types.LogLevel.FATAL, config)(message);
75
+ /**
76
+ * Write a message to the console at the `error` log level
77
+ *
78
+ * @param message - The message to write
79
+ * @param config - The Storm configuration
80
+ */
81
+ const writeError = (message, config) => getLogFn(require_types.LogLevel.ERROR, config)(message);
82
+ /**
83
+ * Write a message to the console at the `warning` log level
84
+ *
85
+ * @param message - The message to write
86
+ * @param config - The Storm configuration
87
+ */
88
+ const writeWarning = (message, config) => getLogFn(require_types.LogLevel.WARN, config)(message);
89
+ /**
90
+ * Write a message to the console at the `info` log level
91
+ *
92
+ * @param message - The message to write
93
+ * @param config - The Storm configuration
94
+ */
95
+ const writeInfo = (message, config) => getLogFn(require_types.LogLevel.INFO, config)(message);
96
+ /**
97
+ * Write a message to the console at the `success` log level
98
+ *
99
+ * @param message - The message to write
100
+ * @param config - The Storm configuration
101
+ */
102
+ const writeSuccess = (message, config) => getLogFn(require_types.LogLevel.SUCCESS, config)(message);
103
+ /**
104
+ * Write a message to the console at the `performance` log level
105
+ *
106
+ * @param message - The message to write
107
+ * @param config - The Storm configuration
108
+ */
109
+ const writePerformance = (message, config) => getLogFn(require_types.LogLevel.PERFORMANCE, config)(message);
110
+ /**
111
+ * Write a message to the console at the `debug` log level
112
+ *
113
+ * @param message - The message to write
114
+ * @param config - The Storm configuration
115
+ */
116
+ const writeDebug = (message, config) => getLogFn(require_types.LogLevel.DEBUG, config)(message);
117
+ /**
118
+ * Write a message to the console at the `trace` log level
119
+ *
120
+ * @param message - The message to write
121
+ * @param config - The Storm configuration
122
+ */
123
+ const writeTrace = (message, config) => getLogFn(require_types.LogLevel.TRACE, config)(message);
124
+ /**
125
+ * Write a message to the console at the `all` log level
126
+ *
127
+ * @param message - The message to write
128
+ * @param config - The Storm configuration
129
+ */
130
+ const writeSystem = (message, config) => getLogFn(require_types.LogLevel.ALL, config)(message);
131
+ /**
132
+ * Get a stopwatch function
133
+ *
134
+ * @param name - The name of the process
135
+ * @returns The stopwatch function
136
+ */
137
+ const getStopwatch = (name) => {
138
+ const start = /* @__PURE__ */ new Date();
139
+ return () => {
140
+ writePerformance(`The${name ? ` ${name}` : ""} process took ${(0, date_fns_formatDistanceToNow.formatDistanceToNow)(start, { includeSeconds: true })} to complete`);
141
+ };
142
+ };
143
+ const MAX_DEPTH = 10;
144
+ /**
145
+ * Format a log message for output to the console, handling different types of messages (e.g. strings, objects, arrays) and applying formatting options such as prefixing and skipping certain keys in objects.
146
+ *
147
+ * @param message - The message to format
148
+ * @param options - Formatting options
149
+ * @param depth - The current depth of recursion
150
+ * @returns The formatted log message
151
+ */
152
+ const formatLogMessage = (message, options = {}, depth = 0) => {
153
+ if (depth > MAX_DEPTH) return "<max depth>";
154
+ const prefix = options.prefix ?? "";
155
+ const skip = options.skip ?? [];
156
+ const sort = options.sort ?? true;
157
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `\n${message.sort(sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0).map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
158
+ prefix: `${prefix}--`,
159
+ skip,
160
+ sort
161
+ }, depth + 1)}`).join("\n")}` : typeof message === "object" && message ? `\n${Object.keys(message).filter((key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())).sort(sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter((key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())).length === 0 ? "{}" : formatLogMessage(message[key], {
162
+ prefix: `${prefix}--`,
163
+ skip,
164
+ sort
165
+ }, depth + 1) : message[key]}`).join("\n")}` : String(message);
166
+ };
167
+ const _isFunction = (value) => {
168
+ try {
169
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
170
+ } catch {
171
+ return false;
172
+ }
173
+ };
174
+ /**
175
+ * Get the brand icon for the console
176
+ *
177
+ * @param config - The Storm configuration
178
+ * @param _chalk - The chalk instance
179
+ * @returns The brand icon
180
+ */
181
+ const brandIcon = (config = {}, _chalk = require_logger_chalk.getChalk()) => _chalk.hex(require_utilities_colors.getColor("brand", config))("🗲");
182
+ //#endregion
183
+ exports.brandIcon = brandIcon;
184
+ exports.formatLogMessage = formatLogMessage;
185
+ exports.getLogFn = getLogFn;
186
+ exports.getStopwatch = getStopwatch;
187
+ exports.writeDebug = writeDebug;
188
+ exports.writeError = writeError;
189
+ exports.writeFatal = writeFatal;
190
+ exports.writeInfo = writeInfo;
191
+ exports.writePerformance = writePerformance;
192
+ exports.writeSuccess = writeSuccess;
193
+ exports.writeSystem = writeSystem;
194
+ exports.writeTrace = writeTrace;
195
+ exports.writeWarning = writeWarning;
@@ -1,24 +1,24 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
2
- import { LogLevel } from '../types.cjs';
3
- import { getChalk } from './chalk.cjs';
4
-
1
+ import { LogLevel } from "../types.cjs";
2
+ import { getChalk } from "./chalk.cjs";
3
+ import { StormWorkspaceConfig } from "@storm-software/config";
4
+ //#region src/logger/console.d.ts
5
5
  interface GetLogFnOptions {
6
- /**
7
- * Whether to include the full date and time in the log message (defaults to `false`, which only includes the time)
8
- *
9
- * @defaultValue false
10
- */
11
- fullDateTime?: boolean;
12
- /**
13
- * Whether to hide the date and time in the log message (defaults to `false`, which includes the date and time based on the `fullDateTime` option)
14
- *
15
- * @defaultValue false
16
- */
17
- hideDateTime?: boolean;
18
- /**
19
- * The color configuration to use for the log message (defaults to the default Storm color configuration)
20
- */
21
- chalk?: ReturnType<typeof getChalk>;
6
+ /**
7
+ * Whether to include the full date and time in the log message (defaults to `false`, which only includes the time)
8
+ *
9
+ * @defaultValue false
10
+ */
11
+ fullDateTime?: boolean;
12
+ /**
13
+ * Whether to hide the date and time in the log message (defaults to `false`, which includes the date and time based on the `fullDateTime` option)
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ hideDateTime?: boolean;
18
+ /**
19
+ * The color configuration to use for the log message (defaults to the default Storm color configuration)
20
+ */
21
+ chalk?: ReturnType<typeof getChalk>;
22
22
  }
23
23
  /**
24
24
  * Get the log function for a log level
@@ -99,9 +99,9 @@ declare const writeSystem: (message?: any, config?: Partial<StormWorkspaceConfig
99
99
  */
100
100
  declare const getStopwatch: (name: string) => () => void;
101
101
  type FormatLogMessageOptions = {
102
- prefix?: string;
103
- skip?: string[];
104
- sort?: boolean;
102
+ prefix?: string;
103
+ skip?: string[];
104
+ sort?: boolean;
105
105
  };
106
106
  /**
107
107
  * Format a log message for output to the console, handling different types of messages (e.g. strings, objects, arrays) and applying formatting options such as prefixing and skipping certain keys in objects.
@@ -120,5 +120,5 @@ declare const formatLogMessage: (message?: any, options?: FormatLogMessageOption
120
120
  * @returns The brand icon
121
121
  */
122
122
  declare const brandIcon: (config?: Partial<StormWorkspaceConfig>, _chalk?: ReturnType<typeof getChalk>) => string | undefined;
123
-
124
- export { type FormatLogMessageOptions, type GetLogFnOptions, brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };
123
+ //#endregion
124
+ export { FormatLogMessageOptions, GetLogFnOptions, brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };
@@ -1,24 +1,26 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
2
- import { LogLevel } from '../types.js';
3
- import { getChalk } from './chalk.js';
4
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { LogLevel } from "../types.mjs";
4
+ import { getChalk } from "./chalk.mjs";
5
+ import { StormWorkspaceConfig } from "@storm-software/config";
6
+ //#region src/logger/console.d.ts
5
7
  interface GetLogFnOptions {
6
- /**
7
- * Whether to include the full date and time in the log message (defaults to `false`, which only includes the time)
8
- *
9
- * @defaultValue false
10
- */
11
- fullDateTime?: boolean;
12
- /**
13
- * Whether to hide the date and time in the log message (defaults to `false`, which includes the date and time based on the `fullDateTime` option)
14
- *
15
- * @defaultValue false
16
- */
17
- hideDateTime?: boolean;
18
- /**
19
- * The color configuration to use for the log message (defaults to the default Storm color configuration)
20
- */
21
- chalk?: ReturnType<typeof getChalk>;
8
+ /**
9
+ * Whether to include the full date and time in the log message (defaults to `false`, which only includes the time)
10
+ *
11
+ * @defaultValue false
12
+ */
13
+ fullDateTime?: boolean;
14
+ /**
15
+ * Whether to hide the date and time in the log message (defaults to `false`, which includes the date and time based on the `fullDateTime` option)
16
+ *
17
+ * @defaultValue false
18
+ */
19
+ hideDateTime?: boolean;
20
+ /**
21
+ * The color configuration to use for the log message (defaults to the default Storm color configuration)
22
+ */
23
+ chalk?: ReturnType<typeof getChalk>;
22
24
  }
23
25
  /**
24
26
  * Get the log function for a log level
@@ -99,9 +101,9 @@ declare const writeSystem: (message?: any, config?: Partial<StormWorkspaceConfig
99
101
  */
100
102
  declare const getStopwatch: (name: string) => () => void;
101
103
  type FormatLogMessageOptions = {
102
- prefix?: string;
103
- skip?: string[];
104
- sort?: boolean;
104
+ prefix?: string;
105
+ skip?: string[];
106
+ sort?: boolean;
105
107
  };
106
108
  /**
107
109
  * Format a log message for output to the console, handling different types of messages (e.g. strings, objects, arrays) and applying formatting options such as prefixing and skipping certain keys in objects.
@@ -120,5 +122,5 @@ declare const formatLogMessage: (message?: any, options?: FormatLogMessageOption
120
122
  * @returns The brand icon
121
123
  */
122
124
  declare const brandIcon: (config?: Partial<StormWorkspaceConfig>, _chalk?: ReturnType<typeof getChalk>) => string | undefined;
123
-
124
- export { type FormatLogMessageOptions, type GetLogFnOptions, brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };
125
+ //#endregion
126
+ export { FormatLogMessageOptions, GetLogFnOptions, brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };