@storm-software/config-tools 1.190.120 → 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 (156) hide show
  1. package/bin/config.cjs +1272 -105
  2. package/bin/config.mjs +1271 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  4. package/dist/config-file/get-config-file.cjs +63 -79
  5. package/dist/config-file/get-config-file.d.cts +5 -5
  6. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  7. package/dist/config-file/get-config-file.mjs +66 -0
  8. package/dist/config-file/index.cjs +4 -1
  9. package/dist/config-file/index.d.cts +2 -3
  10. package/dist/config-file/index.d.mts +4 -0
  11. package/dist/config-file/index.mjs +5 -0
  12. package/dist/create-storm-config.cjs +105 -136
  13. package/dist/create-storm-config.d.cts +5 -5
  14. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  15. package/dist/create-storm-config.mjs +113 -0
  16. package/dist/env/get-env.cjs +190 -214
  17. package/dist/env/get-env.d.cts +5 -5
  18. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  19. package/dist/env/get-env.mjs +203 -0
  20. package/dist/env/index.cjs +7 -2
  21. package/dist/env/index.d.cts +3 -4
  22. package/dist/env/index.d.mts +5 -0
  23. package/dist/env/index.mjs +6 -0
  24. package/dist/env/set-env.cjs +218 -374
  25. package/dist/env/set-env.d.cts +8 -8
  26. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  27. package/dist/env/set-env.mjs +231 -0
  28. package/dist/get-config.cjs +40 -29
  29. package/dist/get-config.d.cts +18 -18
  30. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  31. package/dist/get-config.mjs +46 -0
  32. package/dist/index.cjs +98 -7
  33. package/dist/index.d.cts +27 -28
  34. package/dist/index.d.mts +29 -0
  35. package/dist/index.mjs +26 -0
  36. package/dist/logger/chalk.cjs +38 -29
  37. package/dist/logger/chalk.d.cts +18 -17
  38. package/dist/logger/chalk.d.mts +37 -0
  39. package/dist/logger/chalk.mjs +43 -0
  40. package/dist/logger/console-icons.cjs +15 -14
  41. package/dist/logger/console-icons.d.cts +5 -8
  42. package/dist/logger/console-icons.d.mts +7 -0
  43. package/dist/logger/console-icons.mjs +20 -0
  44. package/dist/logger/console.cjs +187 -183
  45. package/dist/logger/console.d.cts +25 -25
  46. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  47. package/dist/logger/console.mjs +185 -0
  48. package/dist/logger/create-logger.cjs +31 -24
  49. package/dist/logger/create-logger.d.cts +5 -6
  50. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  51. package/dist/logger/create-logger.mjs +34 -0
  52. package/dist/logger/format-timestamp.cjs +12 -4
  53. package/dist/logger/format-timestamp.d.cts +3 -2
  54. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  55. package/dist/logger/format-timestamp.mjs +16 -0
  56. package/dist/logger/get-log-level.cjs +50 -60
  57. package/dist/logger/get-log-level.d.cts +4 -5
  58. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  59. package/dist/logger/get-log-level.mjs +54 -0
  60. package/dist/logger/index.cjs +29 -7
  61. package/dist/logger/index.d.cts +8 -10
  62. package/dist/logger/index.d.mts +10 -0
  63. package/dist/logger/index.mjs +11 -0
  64. package/dist/logger/is-unicode-supported.cjs +6 -10
  65. package/dist/logger/is-unicode-supported.d.cts +3 -2
  66. package/dist/logger/is-unicode-supported.d.mts +6 -0
  67. package/dist/logger/is-unicode-supported.mjs +10 -0
  68. package/dist/types.cjs +26 -25
  69. package/dist/types.d.cts +39 -41
  70. package/dist/types.d.mts +53 -0
  71. package/dist/types.mjs +30 -0
  72. package/dist/utilities/apply-workspace-tokens.cjs +31 -70
  73. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  74. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  75. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  76. package/dist/utilities/colors.cjs +91 -74
  77. package/dist/utilities/colors.d.cts +4 -4
  78. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  79. package/dist/utilities/colors.mjs +97 -0
  80. package/dist/utilities/correct-paths.cjs +166 -196
  81. package/dist/utilities/correct-paths.d.cts +4 -4
  82. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  83. package/dist/utilities/correct-paths.mjs +190 -0
  84. package/dist/utilities/file-path-utils.cjs +42 -27
  85. package/dist/utilities/file-path-utils.d.cts +15 -14
  86. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  87. package/dist/utilities/file-path-utils.mjs +48 -0
  88. package/dist/utilities/find-up.cjs +12 -18
  89. package/dist/utilities/find-up.d.cts +3 -2
  90. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  91. package/dist/utilities/find-up.mjs +19 -0
  92. package/dist/utilities/find-workspace-root.cjs +64 -69
  93. package/dist/utilities/find-workspace-root.d.cts +3 -2
  94. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  95. package/dist/utilities/find-workspace-root.mjs +73 -0
  96. package/dist/utilities/get-default-config.cjs +69 -91
  97. package/dist/utilities/get-default-config.d.cts +4 -4
  98. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  99. package/dist/utilities/get-default-config.mjs +74 -0
  100. package/dist/utilities/index.cjs +49 -9
  101. package/dist/utilities/index.d.cts +10 -14
  102. package/dist/utilities/index.d.mts +12 -0
  103. package/dist/utilities/index.mjs +13 -0
  104. package/dist/utilities/process-handler.cjs +32 -47
  105. package/dist/utilities/process-handler.d.cts +4 -4
  106. package/dist/utilities/process-handler.d.mts +9 -0
  107. package/dist/utilities/process-handler.mjs +38 -0
  108. package/dist/utilities/run.cjs +62 -36
  109. package/dist/utilities/run.d.cts +5 -6
  110. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  111. package/dist/utilities/run.mjs +64 -0
  112. package/dist/utilities/toml.cjs +27 -32
  113. package/dist/utilities/toml.d.cts +148 -147
  114. package/dist/utilities/toml.d.mts +192 -0
  115. package/dist/utilities/toml.mjs +33 -0
  116. package/package.json +105 -157
  117. package/bin/config.js +0 -108
  118. package/dist/config-file/get-config-file.js +0 -83
  119. package/dist/config-file/index.d.ts +0 -3
  120. package/dist/config-file/index.js +0 -1
  121. package/dist/create-storm-config.js +0 -147
  122. package/dist/env/get-env.js +0 -226
  123. package/dist/env/index.d.ts +0 -4
  124. package/dist/env/index.js +0 -2
  125. package/dist/env/set-env.js +0 -386
  126. package/dist/get-config.js +0 -35
  127. package/dist/index.d.ts +0 -28
  128. package/dist/index.js +0 -7
  129. package/dist/logger/chalk.d.ts +0 -34
  130. package/dist/logger/chalk.js +0 -34
  131. package/dist/logger/console-icons.d.ts +0 -8
  132. package/dist/logger/console-icons.js +0 -17
  133. package/dist/logger/console.js +0 -191
  134. package/dist/logger/create-logger.js +0 -27
  135. package/dist/logger/format-timestamp.js +0 -6
  136. package/dist/logger/get-log-level.js +0 -64
  137. package/dist/logger/index.d.ts +0 -10
  138. package/dist/logger/index.js +0 -7
  139. package/dist/logger/is-unicode-supported.d.ts +0 -3
  140. package/dist/logger/is-unicode-supported.js +0 -12
  141. package/dist/types.d.ts +0 -53
  142. package/dist/types.js +0 -28
  143. package/dist/utilities/apply-workspace-tokens.js +0 -76
  144. package/dist/utilities/colors.js +0 -81
  145. package/dist/utilities/correct-paths.js +0 -231
  146. package/dist/utilities/file-path-utils.js +0 -33
  147. package/dist/utilities/find-up.js +0 -23
  148. package/dist/utilities/find-workspace-root.js +0 -77
  149. package/dist/utilities/get-default-config.js +0 -95
  150. package/dist/utilities/index.d.ts +0 -14
  151. package/dist/utilities/index.js +0 -9
  152. package/dist/utilities/process-handler.d.ts +0 -7
  153. package/dist/utilities/process-handler.js +0 -53
  154. package/dist/utilities/run.js +0 -38
  155. package/dist/utilities/toml.d.ts +0 -189
  156. package/dist/utilities/toml.js +0 -42
@@ -1,191 +1,195 @@
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
- };
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
+ };
117
67
  };
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);
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
+ */
127
137
  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
- };
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
+ };
136
142
  };
137
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
+ */
138
152
  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);
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);
168
166
  };
169
167
  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
- }
168
+ try {
169
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
170
+ } catch {
171
+ return false;
172
+ }
175
173
  };
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;
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 };