@storm-software/config-tools 1.148.2 → 1.148.4

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 (106) hide show
  1. package/README.md +1 -1
  2. package/dist/config-file/get-config-file.cjs +66 -22
  3. package/dist/config-file/get-config-file.js +65 -21
  4. package/dist/config-file/index.cjs +1 -27
  5. package/dist/config-file/index.js +1 -27
  6. package/dist/create-storm-config.cjs +68 -26
  7. package/dist/create-storm-config.js +67 -25
  8. package/dist/env/get-env.cjs +152 -9
  9. package/dist/env/get-env.js +151 -8
  10. package/dist/env/index.cjs +2 -20
  11. package/dist/env/index.js +2 -20
  12. package/dist/env/set-env.cjs +259 -8
  13. package/dist/env/set-env.js +258 -7
  14. package/dist/get-config.cjs +9 -25
  15. package/dist/get-config.js +9 -25
  16. package/dist/index.cjs +7 -171
  17. package/dist/index.js +7 -171
  18. package/dist/logger/chalk.cjs +30 -4
  19. package/dist/logger/chalk.js +29 -3
  20. package/dist/logger/console-icons.cjs +15 -5
  21. package/dist/logger/console-icons.js +15 -5
  22. package/dist/logger/console.cjs +126 -38
  23. package/dist/logger/console.js +112 -24
  24. package/dist/logger/create-logger.cjs +31 -16
  25. package/dist/logger/create-logger.js +30 -15
  26. package/dist/logger/format-timestamp.cjs +5 -3
  27. package/dist/logger/format-timestamp.js +5 -3
  28. package/dist/logger/get-log-level.cjs +56 -6
  29. package/dist/logger/get-log-level.js +56 -6
  30. package/dist/logger/index.cjs +7 -62
  31. package/dist/logger/index.js +7 -62
  32. package/dist/logger/is-unicode-supported.cjs +16 -4
  33. package/dist/logger/is-unicode-supported.js +15 -3
  34. package/dist/types.cjs +24 -6
  35. package/dist/types.js +22 -4
  36. package/dist/utilities/apply-workspace-tokens.cjs +55 -9
  37. package/dist/utilities/apply-workspace-tokens.js +54 -8
  38. package/dist/utilities/correct-paths.cjs +242 -33
  39. package/dist/utilities/correct-paths.js +225 -16
  40. package/dist/utilities/file-path-utils.cjs +18 -5
  41. package/dist/utilities/file-path-utils.js +17 -4
  42. package/dist/utilities/find-up.cjs +22 -4
  43. package/dist/utilities/find-up.js +21 -3
  44. package/dist/utilities/find-workspace-root.cjs +64 -7
  45. package/dist/utilities/find-workspace-root.js +63 -6
  46. package/dist/utilities/get-default-config.cjs +79 -8
  47. package/dist/utilities/get-default-config.js +79 -8
  48. package/dist/utilities/index.cjs +7 -85
  49. package/dist/utilities/index.js +7 -85
  50. package/dist/utilities/process-handler.cjs +35 -17
  51. package/dist/utilities/process-handler.js +35 -17
  52. package/dist/utilities/run.cjs +34 -6
  53. package/dist/utilities/run.js +33 -5
  54. package/package.json +1 -1
  55. package/dist/chunk-2AVLCXLT.js +0 -0
  56. package/dist/chunk-2IKEUEGY.cjs +0 -94
  57. package/dist/chunk-2ZXJS2DW.js +0 -49
  58. package/dist/chunk-3557WSPY.js +0 -168
  59. package/dist/chunk-3NWKPYIG.cjs +0 -68
  60. package/dist/chunk-4DLP6LZY.cjs +0 -65
  61. package/dist/chunk-65SWKEHV.cjs +0 -1
  62. package/dist/chunk-6OM23J4N.js +0 -65
  63. package/dist/chunk-6T3V5XJK.js +0 -180
  64. package/dist/chunk-7CYF3NP3.cjs +0 -19
  65. package/dist/chunk-7NSHGJWY.cjs +0 -12
  66. package/dist/chunk-7PV6L7I7.cjs +0 -1
  67. package/dist/chunk-B7WWBK5Z.cjs +0 -93
  68. package/dist/chunk-BHZFTVXN.js +0 -42
  69. package/dist/chunk-C3W5DCMU.js +0 -19
  70. package/dist/chunk-DD3HX2NX.cjs +0 -1
  71. package/dist/chunk-GKI43HTL.cjs +0 -44
  72. package/dist/chunk-GZFXEQPB.js +0 -94
  73. package/dist/chunk-HESFC24Z.cjs +0 -245
  74. package/dist/chunk-HI33NNPB.js +0 -68
  75. package/dist/chunk-HSCCBYAV.js +0 -25
  76. package/dist/chunk-IRCFHYKZ.cjs +0 -28
  77. package/dist/chunk-IUT7Y2UY.js +0 -26
  78. package/dist/chunk-IWD6YQKX.cjs +0 -1
  79. package/dist/chunk-J2TOMCZU.cjs +0 -168
  80. package/dist/chunk-JHJGK3T7.js +0 -272
  81. package/dist/chunk-KNLWLA7O.cjs +0 -75
  82. package/dist/chunk-L6UNTUC4.js +0 -0
  83. package/dist/chunk-LOSUA6RB.js +0 -79
  84. package/dist/chunk-M7ASNATT.js +0 -142
  85. package/dist/chunk-MLUBD3PU.js +0 -245
  86. package/dist/chunk-NJVL3GF4.js +0 -0
  87. package/dist/chunk-OIEEXHKO.js +0 -75
  88. package/dist/chunk-POXTJ6GF.js +0 -28
  89. package/dist/chunk-PR7RQHRE.js +0 -12
  90. package/dist/chunk-QBS3OCHH.js +0 -22
  91. package/dist/chunk-QNYJXMP3.cjs +0 -79
  92. package/dist/chunk-RRKB32OH.js +0 -0
  93. package/dist/chunk-RVM5N5ZI.cjs +0 -22
  94. package/dist/chunk-SLGVSUEV.cjs +0 -36
  95. package/dist/chunk-SVQE7WVB.cjs +0 -180
  96. package/dist/chunk-SWX2MJHI.cjs +0 -28
  97. package/dist/chunk-TCTVN2ED.js +0 -44
  98. package/dist/chunk-U34AT42J.cjs +0 -49
  99. package/dist/chunk-ULZULP7Q.cjs +0 -142
  100. package/dist/chunk-XAJB3BSF.cjs +0 -25
  101. package/dist/chunk-XDBACKKN.cjs +0 -42
  102. package/dist/chunk-XQPQRRG3.js +0 -28
  103. package/dist/chunk-XY2LDOQ4.cjs +0 -26
  104. package/dist/chunk-XZ2SIQVM.js +0 -93
  105. package/dist/chunk-YBGTC6FM.cjs +0 -272
  106. package/dist/chunk-ZA4IO7YJ.js +0 -36
@@ -1,272 +0,0 @@
1
- import {
2
- getLogLevel
3
- } from "./chunk-HI33NNPB.js";
4
- import {
5
- correctPaths
6
- } from "./chunk-MLUBD3PU.js";
7
- import {
8
- LogLevel
9
- } from "./chunk-POXTJ6GF.js";
10
- import {
11
- __name
12
- } from "./chunk-SHUYVCID.js";
13
-
14
- // src/env/set-env.ts
15
- var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
16
- for (const key of Object.keys(extension ?? {})) {
17
- if (extension[key]) {
18
- const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
19
- let extensionKey;
20
- if (result.length === 0) {
21
- return;
22
- }
23
- if (result.length === 1) {
24
- extensionKey = result[0]?.toUpperCase() ?? "";
25
- } else {
26
- extensionKey = result.reduce((ret, part) => {
27
- return `${ret}_${part.toLowerCase()}`;
28
- });
29
- }
30
- process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
31
- }
32
- }
33
- }, "setExtensionEnv");
34
- var setConfigEnv = /* @__PURE__ */ __name((config) => {
35
- const prefix = "STORM_";
36
- if (config.extends) {
37
- process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
38
- }
39
- if (config.name) {
40
- process.env[`${prefix}NAME`] = config.name;
41
- }
42
- if (config.namespace) {
43
- process.env[`${prefix}NAMESPACE`] = config.namespace;
44
- }
45
- if (config.owner) {
46
- process.env[`${prefix}OWNER`] = config.owner;
47
- }
48
- if (config.bot) {
49
- process.env[`${prefix}BOT_NAME`] = config.bot.name;
50
- process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
51
- }
52
- if (config.organization) {
53
- process.env[`${prefix}ORGANIZATION`] = config.organization;
54
- }
55
- if (config.packageManager) {
56
- process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
57
- }
58
- if (config.license) {
59
- process.env[`${prefix}LICENSE`] = config.license;
60
- }
61
- if (config.homepage) {
62
- process.env[`${prefix}HOMEPAGE`] = config.homepage;
63
- }
64
- if (config.docs) {
65
- process.env[`${prefix}DOCS`] = config.docs;
66
- }
67
- if (config.licensing) {
68
- process.env[`${prefix}LICENSING`] = config.licensing;
69
- }
70
- if (config.timezone) {
71
- process.env[`${prefix}TIMEZONE`] = config.timezone;
72
- process.env.TZ = config.timezone;
73
- process.env.DEFAULT_TIMEZONE = config.timezone;
74
- }
75
- if (config.locale) {
76
- process.env[`${prefix}LOCALE`] = config.locale;
77
- process.env.LOCALE = config.locale;
78
- process.env.DEFAULT_LOCALE = config.locale;
79
- process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
80
- }
81
- if (config.configFile) {
82
- process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
83
- }
84
- if (config.workspaceRoot) {
85
- process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
86
- process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
87
- process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
88
- }
89
- if (config.directories) {
90
- if (!config.skipCache && config.directories.cache) {
91
- process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
92
- }
93
- if (config.directories.data) {
94
- process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
95
- }
96
- if (config.directories.config) {
97
- process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
98
- }
99
- if (config.directories.temp) {
100
- process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
101
- }
102
- if (config.directories.log) {
103
- process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
104
- }
105
- if (config.directories.build) {
106
- process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
107
- }
108
- }
109
- if (config.skipCache !== void 0) {
110
- process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
111
- if (config.skipCache) {
112
- process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
113
- process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
114
- }
115
- }
116
- if (config.env) {
117
- process.env[`${prefix}ENV`] = config.env;
118
- process.env.NODE_ENV = config.env;
119
- process.env.ENVIRONMENT = config.env;
120
- }
121
- if (config.colors?.base?.light || config.colors?.base?.dark) {
122
- for (const key of Object.keys(config.colors)) {
123
- setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
124
- }
125
- } else {
126
- setThemeColorConfigEnv(`${prefix}COLOR_`, config.colors);
127
- }
128
- if (config.repository) {
129
- process.env[`${prefix}REPOSITORY`] = config.repository;
130
- }
131
- if (config.branch) {
132
- process.env[`${prefix}BRANCH`] = config.branch;
133
- }
134
- if (config.preid) {
135
- process.env[`${prefix}PRE_ID`] = String(config.preid);
136
- }
137
- if (config.externalPackagePatterns) {
138
- process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(config.externalPackagePatterns);
139
- }
140
- if (config.registry) {
141
- if (config.registry.github) {
142
- process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
143
- }
144
- if (config.registry.npm) {
145
- process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
146
- }
147
- if (config.registry.cargo) {
148
- process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
149
- }
150
- if (config.registry.cyclone) {
151
- process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
152
- }
153
- if (config.registry.container) {
154
- process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.cyclone);
155
- }
156
- }
157
- if (config.logLevel) {
158
- process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
159
- process.env.LOG_LEVEL = String(config.logLevel);
160
- process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
161
- process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
162
- }
163
- if (config.skipConfigLogging !== void 0) {
164
- process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
165
- }
166
- process.env[`${prefix}CONFIG`] = JSON.stringify(config);
167
- for (const key of Object.keys(config.extensions ?? {})) {
168
- config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
169
- }
170
- }, "setConfigEnv");
171
- var setThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
172
- return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
173
- }, "setThemeColorConfigEnv");
174
- var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
175
- if (config.dark) {
176
- process.env[`${prefix}DARK`] = config.dark;
177
- }
178
- if (config.light) {
179
- process.env[`${prefix}LIGHT`] = config.light;
180
- }
181
- if (config.brand) {
182
- process.env[`${prefix}BRAND`] = config.brand;
183
- }
184
- if (config.alternate) {
185
- process.env[`${prefix}ALTERNATE`] = config.alternate;
186
- }
187
- if (config.accent) {
188
- process.env[`${prefix}ACCENT`] = config.accent;
189
- }
190
- if (config.link) {
191
- process.env[`${prefix}LINK`] = config.link;
192
- }
193
- if (config.help) {
194
- process.env[`${prefix}HELP`] = config.help;
195
- }
196
- if (config.success) {
197
- process.env[`${prefix}SUCCESS`] = config.success;
198
- }
199
- if (config.info) {
200
- process.env[`${prefix}INFO`] = config.info;
201
- }
202
- if (config.warning) {
203
- process.env[`${prefix}WARNING`] = config.warning;
204
- }
205
- if (config.danger) {
206
- process.env[`${prefix}DANGER`] = config.danger;
207
- }
208
- if (config.fatal) {
209
- process.env[`${prefix}FATAL`] = config.fatal;
210
- }
211
- if (config.positive) {
212
- process.env[`${prefix}POSITIVE`] = config.positive;
213
- }
214
- if (config.negative) {
215
- process.env[`${prefix}NEGATIVE`] = config.negative;
216
- }
217
- }, "setSingleThemeColorConfigEnv");
218
- var setMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
219
- return {
220
- light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
221
- dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
222
- };
223
- }, "setMultiThemeColorConfigEnv");
224
- var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
225
- if (config.foreground) {
226
- process.env[`${prefix}FOREGROUND`] = config.foreground;
227
- }
228
- if (config.background) {
229
- process.env[`${prefix}BACKGROUND`] = config.background;
230
- }
231
- if (config.brand) {
232
- process.env[`${prefix}BRAND`] = config.brand;
233
- }
234
- if (config.alternate) {
235
- process.env[`${prefix}ALTERNATE`] = config.alternate;
236
- }
237
- if (config.accent) {
238
- process.env[`${prefix}ACCENT`] = config.accent;
239
- }
240
- if (config.link) {
241
- process.env[`${prefix}LINK`] = config.link;
242
- }
243
- if (config.help) {
244
- process.env[`${prefix}HELP`] = config.help;
245
- }
246
- if (config.success) {
247
- process.env[`${prefix}SUCCESS`] = config.success;
248
- }
249
- if (config.info) {
250
- process.env[`${prefix}INFO`] = config.info;
251
- }
252
- if (config.warning) {
253
- process.env[`${prefix}WARNING`] = config.warning;
254
- }
255
- if (config.danger) {
256
- process.env[`${prefix}DANGER`] = config.danger;
257
- }
258
- if (config.fatal) {
259
- process.env[`${prefix}FATAL`] = config.fatal;
260
- }
261
- if (config.positive) {
262
- process.env[`${prefix}POSITIVE`] = config.positive;
263
- }
264
- if (config.negative) {
265
- process.env[`${prefix}NEGATIVE`] = config.negative;
266
- }
267
- }, "setBaseThemeColorConfigEnv");
268
-
269
- export {
270
- setExtensionEnv,
271
- setConfigEnv
272
- };
@@ -1,75 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _chunkSWX2MJHIcjs = require('./chunk-SWX2MJHI.cjs');
4
-
5
-
6
- var _chunkHESFC24Zcjs = require('./chunk-HESFC24Z.cjs');
7
-
8
-
9
- var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
10
-
11
- // src/utilities/find-workspace-root.ts
12
- var rootFiles = [
13
- "storm-workspace.json",
14
- "storm-workspace.json",
15
- "storm-workspace.yaml",
16
- "storm-workspace.yml",
17
- "storm-workspace.js",
18
- "storm-workspace.ts",
19
- ".storm-workspace.json",
20
- ".storm-workspace.yaml",
21
- ".storm-workspace.yml",
22
- ".storm-workspace.js",
23
- ".storm-workspace.ts",
24
- "lerna.json",
25
- "nx.json",
26
- "turbo.json",
27
- "npm-workspace.json",
28
- "yarn-workspace.json",
29
- "pnpm-workspace.json",
30
- "npm-workspace.yaml",
31
- "yarn-workspace.yaml",
32
- "pnpm-workspace.yaml",
33
- "npm-workspace.yml",
34
- "yarn-workspace.yml",
35
- "pnpm-workspace.yml",
36
- "npm-lock.json",
37
- "yarn-lock.json",
38
- "pnpm-lock.json",
39
- "npm-lock.yaml",
40
- "yarn-lock.yaml",
41
- "pnpm-lock.yaml",
42
- "npm-lock.yml",
43
- "yarn-lock.yml",
44
- "pnpm-lock.yml",
45
- "bun.lockb"
46
- ];
47
- var rootDirectories = [
48
- ".storm-workspace",
49
- ".nx",
50
- ".github",
51
- ".vscode",
52
- ".verdaccio"
53
- ];
54
- function findWorkspaceRootSafe(pathInsideMonorepo) {
55
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
56
- return _chunkHESFC24Zcjs.correctPaths.call(void 0, _nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH)));
57
- }
58
- return _chunkHESFC24Zcjs.correctPaths.call(void 0, _chunkSWX2MJHIcjs.findFolderUp.call(void 0, _nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())), rootFiles, rootDirectories));
59
- }
60
- _chunkUSNT2KNTcjs.__name.call(void 0, findWorkspaceRootSafe, "findWorkspaceRootSafe");
61
- function findWorkspaceRoot(pathInsideMonorepo) {
62
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
63
- if (!result) {
64
- throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
65
- ${rootFiles.join("\n")}
66
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
67
- }
68
- return result;
69
- }
70
- _chunkUSNT2KNTcjs.__name.call(void 0, findWorkspaceRoot, "findWorkspaceRoot");
71
-
72
-
73
-
74
-
75
- exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;
File without changes
@@ -1,79 +0,0 @@
1
- import {
2
- writeTrace
3
- } from "./chunk-M7ASNATT.js";
4
- import {
5
- findWorkspaceRoot
6
- } from "./chunk-OIEEXHKO.js";
7
- import {
8
- joinPaths
9
- } from "./chunk-MLUBD3PU.js";
10
- import {
11
- __name
12
- } from "./chunk-SHUYVCID.js";
13
-
14
- // src/config-file/get-config-file.ts
15
- import { loadConfig } from "c12";
16
- import defu from "defu";
17
- var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
18
- const workspacePath = filePath || findWorkspaceRoot(filePath);
19
- const configs = await Promise.all([
20
- loadConfig({
21
- cwd: workspacePath,
22
- packageJson: true,
23
- name: fileName,
24
- envName: fileName?.toUpperCase(),
25
- jitiOptions: {
26
- debug: false,
27
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
28
- },
29
- ...options
30
- }),
31
- loadConfig({
32
- cwd: workspacePath,
33
- packageJson: true,
34
- name: fileName,
35
- envName: fileName?.toUpperCase(),
36
- jitiOptions: {
37
- debug: false,
38
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
39
- },
40
- configFile: fileName,
41
- ...options
42
- })
43
- ]);
44
- return defu(configs[0] ?? {}, configs[1] ?? {});
45
- }, "getConfigFileByName");
46
- var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
47
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
48
- const result = await getConfigFileByName("storm-workspace", workspacePath);
49
- let config = result.config;
50
- const configFile = result.configFile;
51
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
52
- writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
53
- logLevel: "all"
54
- });
55
- }
56
- if (additionalFileNames && additionalFileNames.length > 0) {
57
- const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
58
- for (const result2 of results) {
59
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
60
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
61
- writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
62
- logLevel: "all"
63
- });
64
- }
65
- config = defu(result2.config ?? {}, config ?? {});
66
- }
67
- }
68
- }
69
- if (!config) {
70
- return void 0;
71
- }
72
- config.configFile = configFile;
73
- return config;
74
- }, "getConfigFile");
75
-
76
- export {
77
- getConfigFileByName,
78
- getConfigFile
79
- };
@@ -1,142 +0,0 @@
1
- import {
2
- getChalk
3
- } from "./chunk-ZA4IO7YJ.js";
4
- import {
5
- CONSOLE_ICONS
6
- } from "./chunk-IUT7Y2UY.js";
7
- import {
8
- formatTimestamp
9
- } from "./chunk-PR7RQHRE.js";
10
- import {
11
- DEFAULT_COLOR_CONFIG
12
- } from "./chunk-GZFXEQPB.js";
13
- import {
14
- getLogLevel
15
- } from "./chunk-HI33NNPB.js";
16
- import {
17
- LogLevel,
18
- LogLevelLabel
19
- } from "./chunk-POXTJ6GF.js";
20
- import {
21
- __name
22
- } from "./chunk-SHUYVCID.js";
23
-
24
- // src/logger/console.ts
25
- var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
26
- 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;
27
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
28
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
29
- return (_) => {
30
- };
31
- }
32
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
33
- return (message) => {
34
- console.error(`
35
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
36
- `);
37
- };
38
- }
39
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
40
- return (message) => {
41
- console.error(`
42
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
43
- `);
44
- };
45
- }
46
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
47
- return (message) => {
48
- console.warn(`
49
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
50
- `);
51
- };
52
- }
53
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
54
- return (message) => {
55
- console.info(`
56
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
57
- `);
58
- };
59
- }
60
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
61
- return (message) => {
62
- console.info(`
63
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
64
- `);
65
- };
66
- }
67
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
68
- return (message) => {
69
- console.debug(`
70
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
71
- `);
72
- };
73
- }
74
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
75
- return (message) => {
76
- console.debug(`
77
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
78
- `);
79
- };
80
- }
81
- return (message) => {
82
- console.log(`
83
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
84
- `);
85
- };
86
- }, "getLogFn");
87
- var writeFatal = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
88
- var writeError = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
89
- var writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.WARN, config)(message), "writeWarning");
90
- var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.INFO, config)(message), "writeInfo");
91
- var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
92
- var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
93
- var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
94
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
95
- var getStopwatch = /* @__PURE__ */ __name((name) => {
96
- const start = process.hrtime();
97
- return () => {
98
- const end = process.hrtime(start);
99
- console.info(`
100
- > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(end[0] * 1e3 + end[1] / 1e6)}ms to complete
101
-
102
- `);
103
- };
104
- }, "getStopwatch");
105
- var MAX_DEPTH = 4;
106
- var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth = 0) => {
107
- if (depth > MAX_DEPTH) {
108
- return "<max depth>";
109
- }
110
- const prefix = options.prefix ?? "-";
111
- const skip = options.skip ?? [];
112
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
113
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
114
- prefix: `${prefix}-`,
115
- skip
116
- }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
117
- ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
118
- prefix: `${prefix}-`,
119
- skip
120
- }, depth + 1) : message[key]}`).join("\n")}` : message;
121
- }, "formatLogMessage");
122
- var _isFunction = /* @__PURE__ */ __name((value) => {
123
- try {
124
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
125
- } catch (e) {
126
- return false;
127
- }
128
- }, "_isFunction");
129
-
130
- export {
131
- getLogFn,
132
- writeFatal,
133
- writeError,
134
- writeWarning,
135
- writeInfo,
136
- writeSuccess,
137
- writeDebug,
138
- writeTrace,
139
- writeSystem,
140
- getStopwatch,
141
- formatLogMessage
142
- };