@storm-software/config-tools 1.190.120 → 1.190.122

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 (157) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1272 -105
  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 +63 -79
  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 -1
  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 +105 -136
  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 +190 -214
  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 -2
  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 +218 -374
  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 +40 -29
  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 -7
  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 +38 -29
  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 +15 -14
  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 +187 -183
  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 +31 -24
  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 +12 -4
  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 +50 -60
  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 -7
  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 +6 -10
  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 +26 -25
  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 +31 -70
  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 +91 -74
  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 +166 -196
  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 +42 -27
  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 +12 -18
  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 +64 -69
  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 +69 -91
  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 -9
  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 +32 -47
  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 +62 -36
  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 +27 -32
  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 +105 -157
  118. package/bin/config.js +0 -108
  119. package/dist/config-file/get-config-file.js +0 -83
  120. package/dist/config-file/index.d.ts +0 -3
  121. package/dist/config-file/index.js +0 -1
  122. package/dist/create-storm-config.js +0 -147
  123. package/dist/env/get-env.js +0 -226
  124. package/dist/env/index.d.ts +0 -4
  125. package/dist/env/index.js +0 -2
  126. package/dist/env/set-env.js +0 -386
  127. package/dist/get-config.js +0 -35
  128. package/dist/index.d.ts +0 -28
  129. package/dist/index.js +0 -7
  130. package/dist/logger/chalk.d.ts +0 -34
  131. package/dist/logger/chalk.js +0 -34
  132. package/dist/logger/console-icons.d.ts +0 -8
  133. package/dist/logger/console-icons.js +0 -17
  134. package/dist/logger/console.js +0 -191
  135. package/dist/logger/create-logger.js +0 -27
  136. package/dist/logger/format-timestamp.js +0 -6
  137. package/dist/logger/get-log-level.js +0 -64
  138. package/dist/logger/index.d.ts +0 -10
  139. package/dist/logger/index.js +0 -7
  140. package/dist/logger/is-unicode-supported.d.ts +0 -3
  141. package/dist/logger/is-unicode-supported.js +0 -12
  142. package/dist/types.d.ts +0 -53
  143. package/dist/types.js +0 -28
  144. package/dist/utilities/apply-workspace-tokens.js +0 -76
  145. package/dist/utilities/colors.js +0 -81
  146. package/dist/utilities/correct-paths.js +0 -231
  147. package/dist/utilities/file-path-utils.js +0 -33
  148. package/dist/utilities/find-up.js +0 -23
  149. package/dist/utilities/find-workspace-root.js +0 -77
  150. package/dist/utilities/get-default-config.js +0 -95
  151. package/dist/utilities/index.d.ts +0 -14
  152. package/dist/utilities/index.js +0 -9
  153. package/dist/utilities/process-handler.d.ts +0 -7
  154. package/dist/utilities/process-handler.js +0 -53
  155. package/dist/utilities/run.js +0 -38
  156. package/dist/utilities/toml.d.ts +0 -189
  157. package/dist/utilities/toml.js +0 -42
@@ -1,191 +0,0 @@
1
- import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
2
- import { LogLevel, LogLevelLabel } from "../types";
3
- import { DEFAULT_COLOR_CONFIG, getColor } from "../utilities/colors";
4
- import { getChalk } from "./chalk";
5
- import { CONSOLE_ICONS } from "./console-icons";
6
- import { formatTimestamp } from "./format-timestamp";
7
- import { getLogLevel } from "./get-log-level";
8
- const getLogFn = (logLevel = LogLevel.INFO, config = {}, options = {}) => {
9
- const {
10
- chalk: _chalk = getChalk(),
11
- fullDateTime = false,
12
- hideDateTime = false
13
- } = options;
14
- const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
15
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
16
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
17
- return (_) => {
18
- };
19
- }
20
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
21
- return (message) => {
22
- console.error(
23
- `
24
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(
25
- `[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `
26
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
27
- `
28
- );
29
- };
30
- }
31
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
32
- return (message) => {
33
- console.error(
34
- `
35
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(
36
- `[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `
37
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
38
- `
39
- );
40
- };
41
- }
42
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
43
- return (message) => {
44
- console.warn(
45
- `
46
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(
47
- `[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `
48
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
49
- `
50
- );
51
- };
52
- }
53
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
54
- return (message) => {
55
- console.info(
56
- `
57
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(
58
- `[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `
59
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
60
- `
61
- );
62
- };
63
- }
64
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
65
- return (message) => {
66
- console.info(
67
- `
68
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(
69
- `[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `
70
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
71
- `
72
- );
73
- };
74
- }
75
- if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) {
76
- return (message) => {
77
- console.debug(
78
- `
79
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance)(
80
- `[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `
81
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
82
- `
83
- );
84
- };
85
- }
86
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
87
- return (message) => {
88
- console.debug(
89
- `
90
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug)(
91
- `[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `
92
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
93
- `
94
- );
95
- };
96
- }
97
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
98
- return (message) => {
99
- console.debug(
100
- `
101
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(
102
- `[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `
103
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
104
- `
105
- );
106
- };
107
- }
108
- return (message) => {
109
- console.log(
110
- `
111
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(
112
- `[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `
113
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
114
- `
115
- );
116
- };
117
- };
118
- const writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
119
- const writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
120
- const writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
121
- const writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
122
- const writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
123
- const writePerformance = (message, config) => getLogFn(LogLevel.PERFORMANCE, config)(message);
124
- const writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
125
- const writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
126
- const writeSystem = (message, config) => getLogFn(LogLevel.ALL, config)(message);
127
- const getStopwatch = (name) => {
128
- const start = /* @__PURE__ */ new Date();
129
- return () => {
130
- writePerformance(
131
- `The${name ? ` ${name}` : ""} process took ${formatDistanceToNow(start, {
132
- includeSeconds: true
133
- })} to complete`
134
- );
135
- };
136
- };
137
- const MAX_DEPTH = 10;
138
- const formatLogMessage = (message, options = {}, depth = 0) => {
139
- if (depth > MAX_DEPTH) {
140
- return "<max depth>";
141
- }
142
- const prefix = options.prefix ?? "";
143
- const skip = options.skip ?? [];
144
- const sort = options.sort ?? true;
145
- return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
146
- ${message.sort(
147
- sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
148
- ).map(
149
- (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
150
- item,
151
- { prefix: `${prefix}--`, skip, sort },
152
- depth + 1
153
- )}`
154
- ).join("\n")}` : typeof message === "object" && message ? `
155
- ${Object.keys(message).filter(
156
- (key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())
157
- ).sort(
158
- sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
159
- ).map(
160
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter(
161
- (key2) => typeof key2 !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key2.toLowerCase().trim())
162
- ).length === 0 ? "{}" : formatLogMessage(
163
- message[key],
164
- { prefix: `${prefix}--`, skip, sort },
165
- depth + 1
166
- ) : message[key]}`
167
- ).join("\n")}` : String(message);
168
- };
169
- const _isFunction = (value) => {
170
- try {
171
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
172
- } catch {
173
- return false;
174
- }
175
- };
176
- const brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("\u{1F5F2}");
177
- export {
178
- brandIcon,
179
- formatLogMessage,
180
- getLogFn,
181
- getStopwatch,
182
- writeDebug,
183
- writeError,
184
- writeFatal,
185
- writeInfo,
186
- writePerformance,
187
- writeSuccess,
188
- writeSystem,
189
- writeTrace,
190
- writeWarning
191
- };
@@ -1,27 +0,0 @@
1
- import chalk from "chalk";
2
- import { LogLevel } from "../types";
3
- import { getLogFn, getStopwatch } from "./console";
4
- async function createLogger(config) {
5
- const writeFatal = getLogFn(LogLevel.FATAL, config, { chalk });
6
- const writeError = getLogFn(LogLevel.ERROR, config, { chalk });
7
- const writeWarning = getLogFn(LogLevel.WARN, config, { chalk });
8
- const writeInfo = getLogFn(LogLevel.INFO, config, { chalk });
9
- const writeSuccess = getLogFn(LogLevel.SUCCESS, config, { chalk });
10
- const writeDebug = getLogFn(LogLevel.DEBUG, config, { chalk });
11
- const writePerformance = getLogFn(LogLevel.PERFORMANCE, config, { chalk });
12
- const writeTrace = getLogFn(LogLevel.TRACE, config, { chalk });
13
- return {
14
- fatal: writeFatal,
15
- error: writeError,
16
- warning: writeWarning,
17
- info: writeInfo,
18
- success: writeSuccess,
19
- performance: writePerformance,
20
- debug: writeDebug,
21
- trace: writeTrace,
22
- getStopwatch
23
- };
24
- }
25
- export {
26
- createLogger
27
- };
@@ -1,6 +0,0 @@
1
- const formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
2
- return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
3
- };
4
- export {
5
- formatTimestamp
6
- };
@@ -1,64 +0,0 @@
1
- import { LogLevel, LogLevelLabel } from "../types";
2
- const getLogLevel = (label) => {
3
- switch (label) {
4
- case "all":
5
- return LogLevel.ALL;
6
- case "trace":
7
- return LogLevel.TRACE;
8
- case "debug":
9
- return LogLevel.DEBUG;
10
- case "performance":
11
- return LogLevel.PERFORMANCE;
12
- case "info":
13
- return LogLevel.INFO;
14
- case "warn":
15
- return LogLevel.WARN;
16
- case "error":
17
- return LogLevel.ERROR;
18
- case "fatal":
19
- return LogLevel.FATAL;
20
- case "silent":
21
- return LogLevel.SILENT;
22
- default:
23
- return LogLevel.INFO;
24
- }
25
- };
26
- const getLogLevelLabel = (logLevel = LogLevel.INFO) => {
27
- if (logLevel >= LogLevel.ALL) {
28
- return LogLevelLabel.ALL;
29
- }
30
- if (logLevel >= LogLevel.TRACE) {
31
- return LogLevelLabel.TRACE;
32
- }
33
- if (logLevel >= LogLevel.DEBUG) {
34
- return LogLevelLabel.DEBUG;
35
- }
36
- if (logLevel >= LogLevel.PERFORMANCE) {
37
- return LogLevelLabel.PERFORMANCE;
38
- }
39
- if (logLevel >= LogLevel.INFO) {
40
- return LogLevelLabel.INFO;
41
- }
42
- if (logLevel >= LogLevel.WARN) {
43
- return LogLevelLabel.WARN;
44
- }
45
- if (logLevel >= LogLevel.ERROR) {
46
- return LogLevelLabel.ERROR;
47
- }
48
- if (logLevel >= LogLevel.FATAL) {
49
- return LogLevelLabel.FATAL;
50
- }
51
- if (logLevel <= LogLevel.SILENT) {
52
- return LogLevelLabel.SILENT;
53
- }
54
- return LogLevelLabel.INFO;
55
- };
56
- const isVerbose = (label = LogLevelLabel.SILENT) => {
57
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
58
- return logLevel >= LogLevel.DEBUG;
59
- };
60
- export {
61
- getLogLevel,
62
- getLogLevelLabel,
63
- isVerbose
64
- };
@@ -1,10 +0,0 @@
1
- export { GetChalkReturn, getChalk } from './chalk.js';
2
- export { FormatLogMessageOptions, GetLogFnOptions, brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning } from './console.js';
3
- export { CONSOLE_ICONS } from './console-icons.js';
4
- export { createLogger } from './create-logger.js';
5
- export { formatTimestamp } from './format-timestamp.js';
6
- export { getLogLevel, getLogLevelLabel, isVerbose } from './get-log-level.js';
7
- export { isUnicodeSupported } from './is-unicode-supported.js';
8
- import '@storm-software/config';
9
- import '../types.js';
10
- import '@storm-software/config/types';
@@ -1,7 +0,0 @@
1
- export * from "./chalk";
2
- export * from "./console";
3
- export * from "./console-icons";
4
- export * from "./create-logger";
5
- export * from "./format-timestamp";
6
- export * from "./get-log-level";
7
- export * from "./is-unicode-supported";
@@ -1,3 +0,0 @@
1
- declare function isUnicodeSupported(): boolean;
2
-
3
- export { isUnicodeSupported };
@@ -1,12 +0,0 @@
1
- function isUnicodeSupported() {
2
- if (process.platform !== "win32") {
3
- return process.env.TERM !== "linux";
4
- }
5
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
6
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
7
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
8
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
9
- }
10
- export {
11
- isUnicodeSupported
12
- };
package/dist/types.d.ts DELETED
@@ -1,53 +0,0 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
2
-
3
- type LogLevel = 0 | 10 | 20 | 30 | 35 | 40 | 50 | 60 | 70 | 100;
4
- declare const LogLevel: {
5
- readonly SILENT: LogLevel;
6
- readonly FATAL: LogLevel;
7
- readonly ERROR: LogLevel;
8
- readonly WARN: LogLevel;
9
- readonly SUCCESS: LogLevel;
10
- readonly INFO: LogLevel;
11
- readonly PERFORMANCE: LogLevel;
12
- readonly DEBUG: LogLevel;
13
- readonly TRACE: LogLevel;
14
- readonly ALL: LogLevel;
15
- };
16
- type LogLevelLabel = "silent" | "fatal" | "error" | "warn" | "success" | "info" | "performance" | "debug" | "trace" | "all";
17
- declare const LogLevelLabel: {
18
- readonly SILENT: LogLevelLabel;
19
- readonly FATAL: LogLevelLabel;
20
- readonly ERROR: LogLevelLabel;
21
- readonly WARN: LogLevelLabel;
22
- readonly SUCCESS: LogLevelLabel;
23
- readonly INFO: LogLevelLabel;
24
- readonly PERFORMANCE: LogLevelLabel;
25
- readonly DEBUG: LogLevelLabel;
26
- readonly TRACE: LogLevelLabel;
27
- readonly ALL: LogLevelLabel;
28
- };
29
- type Logger = {
30
- fatal: (message?: any) => void;
31
- error: (message?: any) => void;
32
- warning: (message?: any) => void;
33
- info: (message?: any) => void;
34
- success: (message?: any) => void;
35
- performance: (message?: any) => void;
36
- debug: (message?: any) => void;
37
- trace: (message?: any) => void;
38
- getStopwatch: (name: string) => () => void;
39
- };
40
- interface BaseTokenizerOptions {
41
- workspaceRoot?: string;
42
- config?: StormWorkspaceConfig;
43
- }
44
- interface ProjectTokenizerOptions extends BaseTokenizerOptions {
45
- projectRoot?: string;
46
- projectName?: string;
47
- sourceRoot?: string;
48
- }
49
- type DeepPartial<T> = {
50
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
51
- };
52
-
53
- export { type BaseTokenizerOptions, type DeepPartial, LogLevel, LogLevelLabel, type Logger, type ProjectTokenizerOptions };
package/dist/types.js DELETED
@@ -1,28 +0,0 @@
1
- const LogLevel = {
2
- SILENT: 0,
3
- FATAL: 10,
4
- ERROR: 20,
5
- WARN: 30,
6
- SUCCESS: 35,
7
- INFO: 40,
8
- PERFORMANCE: 50,
9
- DEBUG: 60,
10
- TRACE: 70,
11
- ALL: 100
12
- };
13
- const LogLevelLabel = {
14
- SILENT: "silent",
15
- FATAL: "fatal",
16
- ERROR: "error",
17
- WARN: "warn",
18
- SUCCESS: "success",
19
- INFO: "info",
20
- PERFORMANCE: "performance",
21
- DEBUG: "debug",
22
- TRACE: "trace",
23
- ALL: "all"
24
- };
25
- export {
26
- LogLevel,
27
- LogLevelLabel
28
- };
@@ -1,76 +0,0 @@
1
- import { findWorkspaceRoot } from "./find-workspace-root";
2
- const applyWorkspaceBaseTokens = async (option, tokenParams) => {
3
- let result = option;
4
- if (!result) {
5
- return result;
6
- }
7
- if (tokenParams) {
8
- const optionKeys = Object.keys(tokenParams);
9
- if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
10
- for (const optionKey of optionKeys) {
11
- if (result.includes(`{${optionKey}}`)) {
12
- result = result.replaceAll(
13
- `{${optionKey}}`,
14
- tokenParams?.[optionKey] || ""
15
- );
16
- }
17
- }
18
- }
19
- }
20
- if (tokenParams.config) {
21
- const configKeys = Object.keys(tokenParams.config);
22
- if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
23
- for (const configKey of configKeys) {
24
- if (result.includes(`{${configKey}}`)) {
25
- result = result.replaceAll(
26
- `{${configKey}}`,
27
- tokenParams.config[configKey] || ""
28
- );
29
- }
30
- }
31
- }
32
- }
33
- if (result.includes("{workspaceRoot}")) {
34
- result = result.replaceAll(
35
- "{workspaceRoot}",
36
- tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot()
37
- );
38
- }
39
- return result;
40
- };
41
- const applyWorkspaceProjectTokens = (option, tokenParams) => {
42
- return applyWorkspaceBaseTokens(option, tokenParams);
43
- };
44
- const applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
45
- if (!options) {
46
- return {};
47
- }
48
- const result = {};
49
- for (const option of Object.keys(options)) {
50
- if (typeof options[option] === "string") {
51
- result[option] = await Promise.resolve(
52
- tokenizerFn(options[option], tokenParams)
53
- );
54
- } else if (Array.isArray(options[option])) {
55
- result[option] = await Promise.all(
56
- options[option].map(
57
- async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
58
- )
59
- );
60
- } else if (typeof options[option] === "object") {
61
- result[option] = await applyWorkspaceTokens(
62
- options[option],
63
- tokenParams,
64
- tokenizerFn
65
- );
66
- } else {
67
- result[option] = options[option];
68
- }
69
- }
70
- return result;
71
- };
72
- export {
73
- applyWorkspaceBaseTokens,
74
- applyWorkspaceProjectTokens,
75
- applyWorkspaceTokens
76
- };
@@ -1,81 +0,0 @@
1
- const DEFAULT_COLOR_CONFIG = {
2
- light: {
3
- background: "#fafafa",
4
- foreground: "#1d1e22",
5
- brand: "#1fb2a6",
6
- alternate: "#db2777",
7
- discovery: "#5C4EE5",
8
- success: "#087f5b",
9
- info: "#0550ae",
10
- debug: "#8afafc",
11
- warning: "#e3b341",
12
- danger: "#D8314A",
13
- fatal: "#51070f",
14
- performance: "#13c302",
15
- link: "#3fa6ff",
16
- positive: "#22c55e",
17
- negative: "#dc2626",
18
- gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
19
- },
20
- dark: {
21
- background: "#1e2124",
22
- foreground: "#cbd5e1",
23
- brand: "#2dd4bf",
24
- alternate: "#db2777",
25
- discovery: "#818cf8",
26
- success: "#10b981",
27
- info: "#58a6ff",
28
- debug: "#8afafc",
29
- warning: "#f3d371",
30
- danger: "#D8314A",
31
- fatal: "#a40e26",
32
- performance: "#80fd74",
33
- link: "#3fa6ff",
34
- positive: "#22c55e",
35
- negative: "#dc2626",
36
- gradient: ["#1fb2a6", "#db2777", "#818cf8"]
37
- }
38
- };
39
- function getColors(config) {
40
- if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) {
41
- return DEFAULT_COLOR_CONFIG;
42
- }
43
- if (config.colors["base"]) {
44
- if (typeof config.colors["base"]["dark"] === "object") {
45
- return config.colors["base"]["dark"];
46
- } else if (config.colors["base"]["dark"] === "string") {
47
- return config.colors["base"];
48
- }
49
- }
50
- if (typeof config.colors["dark"] === "object") {
51
- return config.colors["dark"];
52
- }
53
- return config.colors ?? DEFAULT_COLOR_CONFIG;
54
- }
55
- function getColor(key, config) {
56
- const colors = getColors(config);
57
- const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
58
- if (result) {
59
- return result;
60
- }
61
- if (key === "link" || key === "debug") {
62
- return getColor("info", config);
63
- } else if (key === "fatal") {
64
- return getColor("danger", config);
65
- }
66
- return getColor("brand", config);
67
- }
68
- function getGradient(config) {
69
- const colors = getColors(config);
70
- const result = (typeof colors["dark"] === "object" ? colors["dark"].gradient : colors.gradient) || DEFAULT_COLOR_CONFIG["dark"].gradient;
71
- if (result && Array.isArray(result) && result.length > 0) {
72
- return result;
73
- }
74
- return void 0;
75
- }
76
- export {
77
- DEFAULT_COLOR_CONFIG,
78
- getColor,
79
- getColors,
80
- getGradient
81
- };