@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
@@ -0,0 +1,185 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { LogLevel, LogLevelLabel } from "../types.mjs";
5
+ import { DEFAULT_COLOR_CONFIG, getColor } from "../utilities/colors.mjs";
6
+ import { getChalk } from "./chalk.mjs";
7
+ import { CONSOLE_ICONS } from "./console-icons.mjs";
8
+ import { formatTimestamp } from "./format-timestamp.mjs";
9
+ import { getLogLevel } from "./get-log-level.mjs";
10
+ import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
11
+ //#region src/logger/console.ts
12
+ /**
13
+ * Get the log function for a log level
14
+ *
15
+ * @param logLevel - The log level
16
+ * @param config - The Storm configuration
17
+ * @returns The log function
18
+ */
19
+ const getLogFn = (logLevel = LogLevel.INFO, config = {}, options = {}) => {
20
+ const { chalk: _chalk = getChalk(), fullDateTime = false, hideDateTime = false } = options;
21
+ 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;
22
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
23
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) return (_) => {};
24
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) return (message) => {
25
+ console.error(`
26
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
27
+ `);
28
+ };
29
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) return (message) => {
30
+ console.error(`
31
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
32
+ `);
33
+ };
34
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) return (message) => {
35
+ console.warn(`
36
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
37
+ `);
38
+ };
39
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) return (message) => {
40
+ console.info(`
41
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
42
+ `);
43
+ };
44
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) return (message) => {
45
+ console.info(`
46
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
47
+ `);
48
+ };
49
+ if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) return (message) => {
50
+ console.debug(`
51
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance)(`[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
52
+ `);
53
+ };
54
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) return (message) => {
55
+ console.debug(`
56
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
57
+ `);
58
+ };
59
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) return (message) => {
60
+ console.debug(`
61
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
62
+ `);
63
+ };
64
+ return (message) => {
65
+ console.log(`
66
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
67
+ `);
68
+ };
69
+ };
70
+ /**
71
+ * Write a message to the console at the `fatal` log level
72
+ *
73
+ * @param message - The message to write
74
+ * @param config - The Storm configuration
75
+ */
76
+ const writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
77
+ /**
78
+ * Write a message to the console at the `error` log level
79
+ *
80
+ * @param message - The message to write
81
+ * @param config - The Storm configuration
82
+ */
83
+ const writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
84
+ /**
85
+ * Write a message to the console at the `warning` log level
86
+ *
87
+ * @param message - The message to write
88
+ * @param config - The Storm configuration
89
+ */
90
+ const writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
91
+ /**
92
+ * Write a message to the console at the `info` log level
93
+ *
94
+ * @param message - The message to write
95
+ * @param config - The Storm configuration
96
+ */
97
+ const writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
98
+ /**
99
+ * Write a message to the console at the `success` log level
100
+ *
101
+ * @param message - The message to write
102
+ * @param config - The Storm configuration
103
+ */
104
+ const writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
105
+ /**
106
+ * Write a message to the console at the `performance` log level
107
+ *
108
+ * @param message - The message to write
109
+ * @param config - The Storm configuration
110
+ */
111
+ const writePerformance = (message, config) => getLogFn(LogLevel.PERFORMANCE, config)(message);
112
+ /**
113
+ * Write a message to the console at the `debug` log level
114
+ *
115
+ * @param message - The message to write
116
+ * @param config - The Storm configuration
117
+ */
118
+ const writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
119
+ /**
120
+ * Write a message to the console at the `trace` log level
121
+ *
122
+ * @param message - The message to write
123
+ * @param config - The Storm configuration
124
+ */
125
+ const writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
126
+ /**
127
+ * Write a message to the console at the `all` log level
128
+ *
129
+ * @param message - The message to write
130
+ * @param config - The Storm configuration
131
+ */
132
+ const writeSystem = (message, config) => getLogFn(LogLevel.ALL, config)(message);
133
+ /**
134
+ * Get a stopwatch function
135
+ *
136
+ * @param name - The name of the process
137
+ * @returns The stopwatch function
138
+ */
139
+ const getStopwatch = (name) => {
140
+ const start = /* @__PURE__ */ new Date();
141
+ return () => {
142
+ writePerformance(`The${name ? ` ${name}` : ""} process took ${formatDistanceToNow(start, { includeSeconds: true })} to complete`);
143
+ };
144
+ };
145
+ const MAX_DEPTH = 10;
146
+ /**
147
+ * 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.
148
+ *
149
+ * @param message - The message to format
150
+ * @param options - Formatting options
151
+ * @param depth - The current depth of recursion
152
+ * @returns The formatted log message
153
+ */
154
+ const formatLogMessage = (message, options = {}, depth = 0) => {
155
+ if (depth > MAX_DEPTH) return "<max depth>";
156
+ const prefix = options.prefix ?? "";
157
+ const skip = options.skip ?? [];
158
+ const sort = options.sort ?? true;
159
+ 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, {
160
+ prefix: `${prefix}--`,
161
+ skip,
162
+ sort
163
+ }, 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], {
164
+ prefix: `${prefix}--`,
165
+ skip,
166
+ sort
167
+ }, depth + 1) : message[key]}`).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
+ /**
177
+ * Get the brand icon for the console
178
+ *
179
+ * @param config - The Storm configuration
180
+ * @param _chalk - The chalk instance
181
+ * @returns The brand icon
182
+ */
183
+ const brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("🗲");
184
+ //#endregion
185
+ export { brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };
@@ -1,27 +1,34 @@
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');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_types = require("../types.cjs");
4
+ const require_logger_console = require("./console.cjs");
5
+ let chalk = require("chalk");
6
+ chalk = require_runtime.__toESM(chalk, 1);
7
+ //#region src/logger/create-logger.ts
8
+ /**
9
+ * Create a logger instance with the specified configuration.
10
+ *
11
+ * @param config - Optional partial configuration for the logger.
12
+ * @returns A promise that resolves to a Logger instance.
13
+ */
4
14
  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
- };
15
+ const writeFatal = require_logger_console.getLogFn(require_types.LogLevel.FATAL, config, { chalk: chalk.default });
16
+ const writeError = require_logger_console.getLogFn(require_types.LogLevel.ERROR, config, { chalk: chalk.default });
17
+ const writeWarning = require_logger_console.getLogFn(require_types.LogLevel.WARN, config, { chalk: chalk.default });
18
+ const writeInfo = require_logger_console.getLogFn(require_types.LogLevel.INFO, config, { chalk: chalk.default });
19
+ const writeSuccess = require_logger_console.getLogFn(require_types.LogLevel.SUCCESS, config, { chalk: chalk.default });
20
+ const writeDebug = require_logger_console.getLogFn(require_types.LogLevel.DEBUG, config, { chalk: chalk.default });
21
+ return {
22
+ fatal: writeFatal,
23
+ error: writeError,
24
+ warning: writeWarning,
25
+ info: writeInfo,
26
+ success: writeSuccess,
27
+ performance: require_logger_console.getLogFn(require_types.LogLevel.PERFORMANCE, config, { chalk: chalk.default }),
28
+ debug: writeDebug,
29
+ trace: require_logger_console.getLogFn(require_types.LogLevel.TRACE, config, { chalk: chalk.default }),
30
+ getStopwatch: require_logger_console.getStopwatch
31
+ };
24
32
  }
25
-
26
-
33
+ //#endregion
27
34
  exports.createLogger = createLogger;
@@ -1,7 +1,6 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config/types';
2
- import { Logger } from '../types.cjs';
3
- import '@storm-software/config';
4
-
1
+ import { Logger } from "../types.cjs";
2
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
3
+ //#region src/logger/create-logger.d.ts
5
4
  /**
6
5
  * Create a logger instance with the specified configuration.
7
6
  *
@@ -9,5 +8,5 @@ import '@storm-software/config';
9
8
  * @returns A promise that resolves to a Logger instance.
10
9
  */
11
10
  declare function createLogger(config?: Partial<StormWorkspaceConfig>): Promise<Logger>;
12
-
13
- export { createLogger };
11
+ //#endregion
12
+ export { createLogger };
@@ -1,7 +1,8 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config/types';
2
- import { Logger } from '../types.js';
3
- import '@storm-software/config';
4
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { Logger } from "../types.mjs";
4
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
5
+ //#region src/logger/create-logger.d.ts
5
6
  /**
6
7
  * Create a logger instance with the specified configuration.
7
8
  *
@@ -9,5 +10,5 @@ import '@storm-software/config';
9
10
  * @returns A promise that resolves to a Logger instance.
10
11
  */
11
12
  declare function createLogger(config?: Partial<StormWorkspaceConfig>): Promise<Logger>;
12
-
13
- export { createLogger };
13
+ //#endregion
14
+ export { createLogger };
@@ -0,0 +1,34 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { LogLevel } from "../types.mjs";
5
+ import { getLogFn, getStopwatch } from "./console.mjs";
6
+ import chalk from "chalk";
7
+ //#region src/logger/create-logger.ts
8
+ /**
9
+ * Create a logger instance with the specified configuration.
10
+ *
11
+ * @param config - Optional partial configuration for the logger.
12
+ * @returns A promise that resolves to a Logger instance.
13
+ */
14
+ async function createLogger(config) {
15
+ const writeFatal = getLogFn(LogLevel.FATAL, config, { chalk });
16
+ const writeError = getLogFn(LogLevel.ERROR, config, { chalk });
17
+ const writeWarning = getLogFn(LogLevel.WARN, config, { chalk });
18
+ const writeInfo = getLogFn(LogLevel.INFO, config, { chalk });
19
+ const writeSuccess = getLogFn(LogLevel.SUCCESS, config, { chalk });
20
+ const writeDebug = getLogFn(LogLevel.DEBUG, config, { chalk });
21
+ return {
22
+ fatal: writeFatal,
23
+ error: writeError,
24
+ warning: writeWarning,
25
+ info: writeInfo,
26
+ success: writeSuccess,
27
+ performance: getLogFn(LogLevel.PERFORMANCE, config, { chalk }),
28
+ debug: writeDebug,
29
+ trace: getLogFn(LogLevel.TRACE, config, { chalk }),
30
+ getStopwatch
31
+ };
32
+ }
33
+ //#endregion
34
+ export { createLogger };
@@ -1,6 +1,14 @@
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()}`;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/logger/format-timestamp.ts
3
+ /**
4
+ * Format a timestamp to a human-readable string.
5
+ *
6
+ * @param fullDateTime Whether to include the full date and time in the formatted string (defaults to `false`, which only includes the time)
7
+ * @param date The date to format.
8
+ * @returns The formatted timestamp.
9
+ */
10
+ const formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
11
+ return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
3
12
  };
4
-
5
-
13
+ //#endregion
6
14
  exports.formatTimestamp = formatTimestamp;
@@ -1,3 +1,4 @@
1
+ //#region src/logger/format-timestamp.d.ts
1
2
  /**
2
3
  * Format a timestamp to a human-readable string.
3
4
  *
@@ -6,5 +7,5 @@
6
7
  * @returns The formatted timestamp.
7
8
  */
8
9
  declare const formatTimestamp: (fullDateTime?: boolean, date?: Date) => string;
9
-
10
- export { formatTimestamp };
10
+ //#endregion
11
+ export { formatTimestamp };
@@ -1,3 +1,6 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region src/logger/format-timestamp.d.ts
1
4
  /**
2
5
  * Format a timestamp to a human-readable string.
3
6
  *
@@ -6,5 +9,5 @@
6
9
  * @returns The formatted timestamp.
7
10
  */
8
11
  declare const formatTimestamp: (fullDateTime?: boolean, date?: Date) => string;
9
-
10
- export { formatTimestamp };
12
+ //#endregion
13
+ export { formatTimestamp };
@@ -0,0 +1,16 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ //#region src/logger/format-timestamp.ts
5
+ /**
6
+ * Format a timestamp to a human-readable string.
7
+ *
8
+ * @param fullDateTime Whether to include the full date and time in the formatted string (defaults to `false`, which only includes the time)
9
+ * @param date The date to format.
10
+ * @returns The formatted timestamp.
11
+ */
12
+ const formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
13
+ return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
14
+ };
15
+ //#endregion
16
+ export { formatTimestamp };
@@ -1,64 +1,54 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../types');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("../types.cjs");
3
+ //#region src/logger/get-log-level.ts
4
+ /**
5
+ * Convert the log level label to a log level
6
+ *
7
+ * @param label - The log level label to convert
8
+ * @returns The log level
9
+ */
2
10
  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
- }
11
+ switch (label) {
12
+ case "all": return require_types.LogLevel.ALL;
13
+ case "trace": return require_types.LogLevel.TRACE;
14
+ case "debug": return require_types.LogLevel.DEBUG;
15
+ case "performance": return require_types.LogLevel.PERFORMANCE;
16
+ case "info": return require_types.LogLevel.INFO;
17
+ case "warn": return require_types.LogLevel.WARN;
18
+ case "error": return require_types.LogLevel.ERROR;
19
+ case "fatal": return require_types.LogLevel.FATAL;
20
+ case "silent": return require_types.LogLevel.SILENT;
21
+ default: return require_types.LogLevel.INFO;
22
+ }
25
23
  };
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;
24
+ /**
25
+ * Convert the log level to a log level label
26
+ *
27
+ * @param logLevel - The log level to convert
28
+ * @returns The log level label
29
+ */
30
+ const getLogLevelLabel = (logLevel = require_types.LogLevel.INFO) => {
31
+ if (logLevel >= require_types.LogLevel.ALL) return require_types.LogLevelLabel.ALL;
32
+ if (logLevel >= require_types.LogLevel.TRACE) return require_types.LogLevelLabel.TRACE;
33
+ if (logLevel >= require_types.LogLevel.DEBUG) return require_types.LogLevelLabel.DEBUG;
34
+ if (logLevel >= require_types.LogLevel.PERFORMANCE) return require_types.LogLevelLabel.PERFORMANCE;
35
+ if (logLevel >= require_types.LogLevel.INFO) return require_types.LogLevelLabel.INFO;
36
+ if (logLevel >= require_types.LogLevel.WARN) return require_types.LogLevelLabel.WARN;
37
+ if (logLevel >= require_types.LogLevel.ERROR) return require_types.LogLevelLabel.ERROR;
38
+ if (logLevel >= require_types.LogLevel.FATAL) return require_types.LogLevelLabel.FATAL;
39
+ if (logLevel <= require_types.LogLevel.SILENT) return require_types.LogLevelLabel.SILENT;
40
+ return require_types.LogLevelLabel.INFO;
55
41
  };
56
- const isVerbose = (label = _types.LogLevelLabel.SILENT) => {
57
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
58
- return logLevel >= _types.LogLevel.DEBUG;
42
+ /**
43
+ * Check if the log level is verbose
44
+ *
45
+ * @param label - The log level label to check
46
+ * @returns True if the log level is verbose
47
+ */
48
+ const isVerbose = (label = require_types.LogLevelLabel.SILENT) => {
49
+ return (typeof label === "string" ? getLogLevel(label) : label) >= require_types.LogLevel.DEBUG;
59
50
  };
60
-
61
-
62
-
63
-
64
- exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose;
51
+ //#endregion
52
+ exports.getLogLevel = getLogLevel;
53
+ exports.getLogLevelLabel = getLogLevelLabel;
54
+ exports.isVerbose = isVerbose;
@@ -1,6 +1,5 @@
1
- import { LogLevel, LogLevelLabel } from '../types.cjs';
2
- import '@storm-software/config';
3
-
1
+ import { LogLevel, LogLevelLabel } from "../types.cjs";
2
+ //#region src/logger/get-log-level.d.ts
4
3
  /**
5
4
  * Convert the log level label to a log level
6
5
  *
@@ -22,5 +21,5 @@ declare const getLogLevelLabel: (logLevel?: number) => LogLevelLabel;
22
21
  * @returns True if the log level is verbose
23
22
  */
24
23
  declare const isVerbose: (label?: string | LogLevel) => boolean;
25
-
26
- export { getLogLevel, getLogLevelLabel, isVerbose };
24
+ //#endregion
25
+ export { getLogLevel, getLogLevelLabel, isVerbose };
@@ -1,6 +1,7 @@
1
- import { LogLevel, LogLevelLabel } from '../types.js';
2
- import '@storm-software/config';
3
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { LogLevel, LogLevelLabel } from "../types.mjs";
4
+ //#region src/logger/get-log-level.d.ts
4
5
  /**
5
6
  * Convert the log level label to a log level
6
7
  *
@@ -22,5 +23,5 @@ declare const getLogLevelLabel: (logLevel?: number) => LogLevelLabel;
22
23
  * @returns True if the log level is verbose
23
24
  */
24
25
  declare const isVerbose: (label?: string | LogLevel) => boolean;
25
-
26
- export { getLogLevel, getLogLevelLabel, isVerbose };
26
+ //#endregion
27
+ export { getLogLevel, getLogLevelLabel, isVerbose };
@@ -0,0 +1,54 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { LogLevel, LogLevelLabel } from "../types.mjs";
5
+ //#region src/logger/get-log-level.ts
6
+ /**
7
+ * Convert the log level label to a log level
8
+ *
9
+ * @param label - The log level label to convert
10
+ * @returns The log level
11
+ */
12
+ const getLogLevel = (label) => {
13
+ switch (label) {
14
+ case "all": return LogLevel.ALL;
15
+ case "trace": return LogLevel.TRACE;
16
+ case "debug": return LogLevel.DEBUG;
17
+ case "performance": return LogLevel.PERFORMANCE;
18
+ case "info": return LogLevel.INFO;
19
+ case "warn": return LogLevel.WARN;
20
+ case "error": return LogLevel.ERROR;
21
+ case "fatal": return LogLevel.FATAL;
22
+ case "silent": return LogLevel.SILENT;
23
+ default: return LogLevel.INFO;
24
+ }
25
+ };
26
+ /**
27
+ * Convert the log level to a log level label
28
+ *
29
+ * @param logLevel - The log level to convert
30
+ * @returns The log level label
31
+ */
32
+ const getLogLevelLabel = (logLevel = LogLevel.INFO) => {
33
+ if (logLevel >= LogLevel.ALL) return LogLevelLabel.ALL;
34
+ if (logLevel >= LogLevel.TRACE) return LogLevelLabel.TRACE;
35
+ if (logLevel >= LogLevel.DEBUG) return LogLevelLabel.DEBUG;
36
+ if (logLevel >= LogLevel.PERFORMANCE) return LogLevelLabel.PERFORMANCE;
37
+ if (logLevel >= LogLevel.INFO) return LogLevelLabel.INFO;
38
+ if (logLevel >= LogLevel.WARN) return LogLevelLabel.WARN;
39
+ if (logLevel >= LogLevel.ERROR) return LogLevelLabel.ERROR;
40
+ if (logLevel >= LogLevel.FATAL) return LogLevelLabel.FATAL;
41
+ if (logLevel <= LogLevel.SILENT) return LogLevelLabel.SILENT;
42
+ return LogLevelLabel.INFO;
43
+ };
44
+ /**
45
+ * Check if the log level is verbose
46
+ *
47
+ * @param label - The log level label to check
48
+ * @returns True if the log level is verbose
49
+ */
50
+ const isVerbose = (label = LogLevelLabel.SILENT) => {
51
+ return (typeof label === "string" ? getLogLevel(label) : label) >= LogLevel.DEBUG;
52
+ };
53
+ //#endregion
54
+ export { getLogLevel, getLogLevelLabel, isVerbose };
@@ -1,7 +1,29 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chalk = require('./chalk'); _createStarExport(_chalk);
2
- var _console = require('./console'); _createStarExport(_console);
3
- var _consoleicons = require('./console-icons'); _createStarExport(_consoleicons);
4
- var _createlogger = require('./create-logger'); _createStarExport(_createlogger);
5
- var _formattimestamp = require('./format-timestamp'); _createStarExport(_formattimestamp);
6
- var _getloglevel = require('./get-log-level'); _createStarExport(_getloglevel);
7
- var _isunicodesupported = require('./is-unicode-supported'); _createStarExport(_isunicodesupported);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_logger_chalk = require("./chalk.cjs");
3
+ const require_logger_is_unicode_supported = require("./is-unicode-supported.cjs");
4
+ const require_logger_console_icons = require("./console-icons.cjs");
5
+ const require_logger_format_timestamp = require("./format-timestamp.cjs");
6
+ const require_logger_get_log_level = require("./get-log-level.cjs");
7
+ const require_logger_console = require("./console.cjs");
8
+ const require_logger_create_logger = require("./create-logger.cjs");
9
+ exports.CONSOLE_ICONS = require_logger_console_icons.CONSOLE_ICONS;
10
+ exports.brandIcon = require_logger_console.brandIcon;
11
+ exports.createLogger = require_logger_create_logger.createLogger;
12
+ exports.formatLogMessage = require_logger_console.formatLogMessage;
13
+ exports.formatTimestamp = require_logger_format_timestamp.formatTimestamp;
14
+ exports.getChalk = require_logger_chalk.getChalk;
15
+ exports.getLogFn = require_logger_console.getLogFn;
16
+ exports.getLogLevel = require_logger_get_log_level.getLogLevel;
17
+ exports.getLogLevelLabel = require_logger_get_log_level.getLogLevelLabel;
18
+ exports.getStopwatch = require_logger_console.getStopwatch;
19
+ exports.isUnicodeSupported = require_logger_is_unicode_supported.isUnicodeSupported;
20
+ exports.isVerbose = require_logger_get_log_level.isVerbose;
21
+ exports.writeDebug = require_logger_console.writeDebug;
22
+ exports.writeError = require_logger_console.writeError;
23
+ exports.writeFatal = require_logger_console.writeFatal;
24
+ exports.writeInfo = require_logger_console.writeInfo;
25
+ exports.writePerformance = require_logger_console.writePerformance;
26
+ exports.writeSuccess = require_logger_console.writeSuccess;
27
+ exports.writeSystem = require_logger_console.writeSystem;
28
+ exports.writeTrace = require_logger_console.writeTrace;
29
+ exports.writeWarning = require_logger_console.writeWarning;