@storm-software/cloudflare-tools 0.48.0 → 0.49.0

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 (81) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunk-3J7KBHMJ.mjs +0 -0
  3. package/dist/chunk-7Z5PILRU.mjs +0 -0
  4. package/dist/chunk-A4ZIZ2JU.mjs +228 -0
  5. package/dist/chunk-A7FFSBE6.mjs +26 -0
  6. package/dist/chunk-CVGPWUNP.js +1 -0
  7. package/dist/chunk-DHBG5ASJ.js +1 -0
  8. package/dist/chunk-I4XNMV5U.js +227 -0
  9. package/dist/chunk-J5SB6L2L.js +18 -0
  10. package/dist/chunk-JCB2DTP6.js +42 -0
  11. package/dist/chunk-KKOHB7JH.js +239 -0
  12. package/dist/chunk-MTM5OTKD.mjs +239 -0
  13. package/dist/chunk-NKCR3FSU.js +153 -0
  14. package/dist/chunk-NSLK6ZDO.mjs +603 -0
  15. package/dist/chunk-OARYMVO7.mjs +501 -0
  16. package/dist/chunk-OJNZ4PXQ.mjs +3466 -0
  17. package/dist/chunk-QEWY5YJA.mjs +89 -0
  18. package/dist/chunk-R7AIVBS7.js +89 -0
  19. package/dist/chunk-RCE3CC76.js +603 -0
  20. package/dist/chunk-VPT6GF3S.mjs +153 -0
  21. package/dist/chunk-VTHBMY4B.js +133 -0
  22. package/dist/chunk-VYOULWAK.mjs +42 -0
  23. package/dist/chunk-XO66D74Z.js +1 -0
  24. package/dist/chunk-XU6MTFCV.mjs +133 -0
  25. package/dist/chunk-YE4FHRXJ.js +501 -0
  26. package/dist/chunk-YSCEY447.mjs +0 -0
  27. package/dist/chunk-Z46UO4N7.js +3465 -0
  28. package/dist/executors.d.mts +2 -0
  29. package/dist/executors.d.ts +2 -0
  30. package/dist/executors.js +9 -0
  31. package/dist/executors.mjs +9 -0
  32. package/dist/generator-DJ1RuHyR.d.mts +14 -0
  33. package/dist/generator-DJ1RuHyR.d.ts +14 -0
  34. package/dist/generator-DW-9W9Fk.d.mts +22 -0
  35. package/dist/generator-DW-9W9Fk.d.ts +22 -0
  36. package/dist/generators.d.mts +4 -0
  37. package/dist/generators.d.ts +4 -0
  38. package/dist/generators.js +18 -0
  39. package/dist/generators.mjs +18 -0
  40. package/dist/index.d.mts +45 -0
  41. package/dist/index.d.ts +45 -0
  42. package/dist/index.js +151 -0
  43. package/dist/index.mjs +151 -0
  44. package/dist/schema.d-DgA16PUG.d.mts +24 -0
  45. package/dist/schema.d-DgA16PUG.d.ts +24 -0
  46. package/dist/schema.d-oSirXiCO.d.mts +11 -0
  47. package/dist/schema.d-oSirXiCO.d.ts +11 -0
  48. package/dist/src/executors/cloudflare-publish/executor.d.mts +8 -0
  49. package/dist/src/executors/cloudflare-publish/executor.d.ts +8 -0
  50. package/dist/src/executors/cloudflare-publish/executor.js +11 -0
  51. package/dist/src/executors/cloudflare-publish/executor.mjs +11 -0
  52. package/dist/src/executors/r2-upload-publish/executor.d.mts +8 -0
  53. package/dist/src/executors/r2-upload-publish/executor.d.ts +8 -0
  54. package/dist/src/executors/r2-upload-publish/executor.js +11 -0
  55. package/dist/src/executors/r2-upload-publish/executor.mjs +11 -0
  56. package/dist/src/executors/serve/executor.d.mts +1240 -0
  57. package/dist/src/executors/serve/executor.d.ts +1240 -0
  58. package/dist/src/executors/serve/executor.js +75 -0
  59. package/dist/src/executors/serve/executor.mjs +75 -0
  60. package/dist/src/executors/serve/schema.d.ts +1 -1
  61. package/dist/src/generators/init/generator.d.mts +2 -0
  62. package/dist/src/generators/init/generator.d.ts +2 -0
  63. package/dist/src/generators/init/generator.js +11 -0
  64. package/dist/src/generators/init/generator.mjs +11 -0
  65. package/dist/src/generators/worker/generator.d.mts +3 -0
  66. package/dist/src/generators/worker/generator.d.ts +3 -0
  67. package/dist/src/generators/worker/generator.js +14 -0
  68. package/dist/src/generators/worker/generator.mjs +14 -0
  69. package/dist/src/utils/index.d.mts +3 -0
  70. package/dist/src/utils/index.d.ts +3 -0
  71. package/dist/src/utils/index.js +11 -0
  72. package/dist/src/utils/index.mjs +11 -0
  73. package/dist/src/utils/r2-bucket-helpers.d.mts +7 -0
  74. package/dist/src/utils/r2-bucket-helpers.d.ts +7 -0
  75. package/dist/src/utils/r2-bucket-helpers.js +10 -0
  76. package/dist/src/utils/r2-bucket-helpers.mjs +10 -0
  77. package/dist/tsup.config.d.mts +5 -0
  78. package/dist/tsup.config.d.ts +5 -0
  79. package/dist/tsup.config.js +35 -0
  80. package/dist/tsup.config.mjs +35 -0
  81. package/package.json +1 -1
@@ -0,0 +1,501 @@
1
+ import {
2
+ COLOR_KEYS,
3
+ LogLevel,
4
+ STORM_DEFAULT_DOCS,
5
+ STORM_DEFAULT_HOMEPAGE,
6
+ STORM_DEFAULT_LICENSING,
7
+ correctPaths,
8
+ findWorkspaceRoot,
9
+ formatLogMessage,
10
+ getDefaultConfig,
11
+ getLogLevel,
12
+ getLogLevelLabel,
13
+ joinPaths,
14
+ writeSystem,
15
+ writeTrace,
16
+ writeWarning
17
+ } from "./chunk-NSLK6ZDO.mjs";
18
+ import {
19
+ __name
20
+ } from "./chunk-A7FFSBE6.mjs";
21
+
22
+ // ../config-tools/src/create-storm-config.ts
23
+ import defu2 from "defu";
24
+
25
+ // ../config-tools/src/config-file/get-config-file.ts
26
+ import { loadConfig } from "c12";
27
+ import defu from "defu";
28
+ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
29
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
30
+ let config = loadConfig({
31
+ cwd: workspacePath,
32
+ packageJson: true,
33
+ name: fileName,
34
+ envName: fileName?.toUpperCase(),
35
+ jitiOptions: {
36
+ debug: false,
37
+ cache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache", "storm")
38
+ },
39
+ ...options
40
+ });
41
+ if (!config || Object.keys(config).length === 0) {
42
+ config = loadConfig({
43
+ cwd: workspacePath,
44
+ packageJson: true,
45
+ name: fileName,
46
+ envName: fileName?.toUpperCase(),
47
+ jitiOptions: {
48
+ debug: false,
49
+ cache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache", "storm")
50
+ },
51
+ configFile: fileName,
52
+ ...options
53
+ });
54
+ }
55
+ return config;
56
+ }, "getConfigFileByName");
57
+ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
58
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
59
+ const result = await getConfigFileByName("storm", workspacePath);
60
+ let config = result.config;
61
+ const configFile = result.configFile;
62
+ if (config && configFile && Object.keys(config).length > 0) {
63
+ writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
64
+ logLevel: "all"
65
+ });
66
+ }
67
+ if (additionalFileNames && additionalFileNames.length > 0) {
68
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
69
+ for (const result2 of results) {
70
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
71
+ writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
72
+ logLevel: "all"
73
+ });
74
+ config = defu(result2.config ?? {}, config ?? {});
75
+ }
76
+ }
77
+ }
78
+ if (!config) {
79
+ return void 0;
80
+ }
81
+ config.configFile = configFile;
82
+ return config;
83
+ }, "getConfigFile");
84
+
85
+ // ../config-tools/src/env/get-env.ts
86
+ var getConfigEnv = /* @__PURE__ */ __name(() => {
87
+ const prefix = "STORM_";
88
+ let config = {
89
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
90
+ name: process.env[`${prefix}NAME`] || void 0,
91
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
92
+ owner: process.env[`${prefix}OWNER`] || void 0,
93
+ bot: {
94
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
95
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
96
+ },
97
+ organization: process.env[`${prefix}ORGANIZATION`] || void 0,
98
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
99
+ license: process.env[`${prefix}LICENSE`] || void 0,
100
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
101
+ docs: process.env[`${prefix}DOCS`] || void 0,
102
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
103
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
104
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
105
+ configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
106
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
107
+ directories: {
108
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : void 0,
109
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : void 0,
110
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : void 0,
111
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : void 0,
112
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : void 0,
113
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : void 0
114
+ },
115
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
116
+ env: (process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
117
+ // ci:
118
+ // process.env[`${prefix}CI`] !== undefined
119
+ // ? Boolean(
120
+ // process.env[`${prefix}CI`] ??
121
+ // process.env.CI ??
122
+ // process.env.CONTINUOUS_INTEGRATION
123
+ // )
124
+ // : undefined,
125
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
126
+ branch: process.env[`${prefix}BRANCH`] || void 0,
127
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
128
+ externalPackagePatterns: process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] ? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`]) : [],
129
+ registry: {
130
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
131
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
132
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
133
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
134
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
135
+ },
136
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
137
+ };
138
+ const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
139
+ config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
140
+ ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
141
+ return ret;
142
+ }, {}) : getThemeColorConfigEnv(prefix);
143
+ if (config.docs === STORM_DEFAULT_DOCS) {
144
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
145
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
146
+ } else {
147
+ config.docs = `${config.homepage}/docs`;
148
+ }
149
+ }
150
+ if (config.licensing === STORM_DEFAULT_LICENSING) {
151
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
152
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
153
+ } else {
154
+ config.licensing = `${config.homepage}/docs`;
155
+ }
156
+ }
157
+ const serializedConfig = process.env[`${prefix}CONFIG`];
158
+ if (serializedConfig) {
159
+ const parsed = JSON.parse(serializedConfig);
160
+ config = {
161
+ ...config,
162
+ ...parsed,
163
+ colors: {
164
+ ...config.colors,
165
+ ...parsed.colors
166
+ },
167
+ extensions: {
168
+ ...config.extensions,
169
+ ...parsed.extensions
170
+ }
171
+ };
172
+ }
173
+ return config;
174
+ }, "getConfigEnv");
175
+ var getThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, theme) => {
176
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
177
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
178
+ }, "getThemeColorConfigEnv");
179
+ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
180
+ return {
181
+ dark: process.env[`${prefix}DARK`],
182
+ light: process.env[`${prefix}LIGHT`],
183
+ brand: process.env[`${prefix}BRAND`],
184
+ alternate: process.env[`${prefix}ALTERNATE`],
185
+ accent: process.env[`${prefix}ACCENT`],
186
+ link: process.env[`${prefix}LINK`],
187
+ help: process.env[`${prefix}HELP`],
188
+ success: process.env[`${prefix}SUCCESS`],
189
+ info: process.env[`${prefix}INFO`],
190
+ warning: process.env[`${prefix}WARNING`],
191
+ danger: process.env[`${prefix}DANGER`],
192
+ fatal: process.env[`${prefix}FATAL`],
193
+ positive: process.env[`${prefix}POSITIVE`],
194
+ negative: process.env[`${prefix}NEGATIVE`]
195
+ };
196
+ }, "getSingleThemeColorConfigEnv");
197
+ var getMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
198
+ return {
199
+ light: getBaseThemeColorConfigEnv(`${prefix}_LIGHT_`),
200
+ dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
201
+ };
202
+ }, "getMultiThemeColorConfigEnv");
203
+ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
204
+ return {
205
+ foreground: process.env[`${prefix}FOREGROUND`],
206
+ background: process.env[`${prefix}BACKGROUND`],
207
+ brand: process.env[`${prefix}BRAND`],
208
+ alternate: process.env[`${prefix}ALTERNATE`],
209
+ accent: process.env[`${prefix}ACCENT`],
210
+ link: process.env[`${prefix}LINK`],
211
+ help: process.env[`${prefix}HELP`],
212
+ success: process.env[`${prefix}SUCCESS`],
213
+ info: process.env[`${prefix}INFO`],
214
+ warning: process.env[`${prefix}WARNING`],
215
+ danger: process.env[`${prefix}DANGER`],
216
+ fatal: process.env[`${prefix}FATAL`],
217
+ positive: process.env[`${prefix}POSITIVE`],
218
+ negative: process.env[`${prefix}NEGATIVE`]
219
+ };
220
+ }, "getBaseThemeColorConfigEnv");
221
+
222
+ // ../config-tools/src/env/set-env.ts
223
+ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
224
+ for (const key of Object.keys(extension ?? {})) {
225
+ if (extension[key]) {
226
+ const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
227
+ let extensionKey;
228
+ if (result.length === 0) {
229
+ return;
230
+ }
231
+ if (result.length === 1) {
232
+ extensionKey = result[0]?.toUpperCase() ?? "";
233
+ } else {
234
+ extensionKey = result.reduce((ret, part) => {
235
+ return `${ret}_${part.toLowerCase()}`;
236
+ });
237
+ }
238
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
239
+ }
240
+ }
241
+ }, "setExtensionEnv");
242
+ var setConfigEnv = /* @__PURE__ */ __name((config) => {
243
+ const prefix = "STORM_";
244
+ if (config.extends) {
245
+ process.env[`${prefix}EXTENDS`] = config.extends;
246
+ }
247
+ if (config.name) {
248
+ process.env[`${prefix}NAME`] = config.name;
249
+ }
250
+ if (config.namespace) {
251
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
252
+ }
253
+ if (config.owner) {
254
+ process.env[`${prefix}OWNER`] = config.owner;
255
+ }
256
+ if (config.bot) {
257
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
258
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
259
+ }
260
+ if (config.organization) {
261
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
262
+ }
263
+ if (config.packageManager) {
264
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
265
+ }
266
+ if (config.license) {
267
+ process.env[`${prefix}LICENSE`] = config.license;
268
+ }
269
+ if (config.homepage) {
270
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
271
+ }
272
+ if (config.docs) {
273
+ process.env[`${prefix}DOCS`] = config.docs;
274
+ }
275
+ if (config.licensing) {
276
+ process.env[`${prefix}LICENSING`] = config.licensing;
277
+ }
278
+ if (config.timezone) {
279
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
280
+ process.env.TZ = config.timezone;
281
+ process.env.DEFAULT_TIMEZONE = config.timezone;
282
+ }
283
+ if (config.locale) {
284
+ process.env[`${prefix}LOCALE`] = config.locale;
285
+ process.env.LOCALE = config.locale;
286
+ process.env.DEFAULT_LOCALE = config.locale;
287
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
288
+ }
289
+ if (config.configFile) {
290
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
291
+ }
292
+ if (config.workspaceRoot) {
293
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
294
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
295
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
296
+ }
297
+ if (config.directories) {
298
+ if (!config.skipCache && config.directories.cache) {
299
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
300
+ }
301
+ if (config.directories.data) {
302
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
303
+ }
304
+ if (config.directories.config) {
305
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
306
+ }
307
+ if (config.directories.temp) {
308
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
309
+ }
310
+ if (config.directories.log) {
311
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
312
+ }
313
+ if (config.directories.build) {
314
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
315
+ }
316
+ }
317
+ if (config.skipCache !== void 0) {
318
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
319
+ if (config.skipCache) {
320
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
321
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
322
+ }
323
+ }
324
+ if (config.env) {
325
+ process.env[`${prefix}ENV`] = config.env;
326
+ process.env.NODE_ENV = config.env;
327
+ process.env.ENVIRONMENT = config.env;
328
+ }
329
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
330
+ for (const key of Object.keys(config.colors)) {
331
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
332
+ }
333
+ } else {
334
+ setThemeColorConfigEnv(`${prefix}COLOR_`, config.colors);
335
+ }
336
+ if (config.repository) {
337
+ process.env[`${prefix}REPOSITORY`] = config.repository;
338
+ }
339
+ if (config.branch) {
340
+ process.env[`${prefix}BRANCH`] = config.branch;
341
+ }
342
+ if (config.preid) {
343
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
344
+ }
345
+ if (config.externalPackagePatterns) {
346
+ process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(config.externalPackagePatterns);
347
+ }
348
+ if (config.registry) {
349
+ if (config.registry.github) {
350
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
351
+ }
352
+ if (config.registry.npm) {
353
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
354
+ }
355
+ if (config.registry.cargo) {
356
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
357
+ }
358
+ if (config.registry.cyclone) {
359
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
360
+ }
361
+ if (config.registry.container) {
362
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.cyclone);
363
+ }
364
+ }
365
+ if (config.logLevel) {
366
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
367
+ process.env.LOG_LEVEL = String(config.logLevel);
368
+ process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
369
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
370
+ }
371
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
372
+ for (const key of Object.keys(config.extensions ?? {})) {
373
+ config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
374
+ }
375
+ }, "setConfigEnv");
376
+ var setThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
377
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
378
+ }, "setThemeColorConfigEnv");
379
+ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
380
+ if (config.dark) {
381
+ process.env[`${prefix}DARK`] = config.dark;
382
+ }
383
+ if (config.light) {
384
+ process.env[`${prefix}LIGHT`] = config.light;
385
+ }
386
+ if (config.brand) {
387
+ process.env[`${prefix}BRAND`] = config.brand;
388
+ }
389
+ if (config.alternate) {
390
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
391
+ }
392
+ if (config.accent) {
393
+ process.env[`${prefix}ACCENT`] = config.accent;
394
+ }
395
+ if (config.link) {
396
+ process.env[`${prefix}LINK`] = config.link;
397
+ }
398
+ if (config.help) {
399
+ process.env[`${prefix}HELP`] = config.help;
400
+ }
401
+ if (config.success) {
402
+ process.env[`${prefix}SUCCESS`] = config.success;
403
+ }
404
+ if (config.info) {
405
+ process.env[`${prefix}INFO`] = config.info;
406
+ }
407
+ if (config.warning) {
408
+ process.env[`${prefix}WARNING`] = config.warning;
409
+ }
410
+ if (config.danger) {
411
+ process.env[`${prefix}DANGER`] = config.danger;
412
+ }
413
+ if (config.fatal) {
414
+ process.env[`${prefix}FATAL`] = config.fatal;
415
+ }
416
+ if (config.positive) {
417
+ process.env[`${prefix}POSITIVE`] = config.positive;
418
+ }
419
+ if (config.negative) {
420
+ process.env[`${prefix}NEGATIVE`] = config.negative;
421
+ }
422
+ }, "setSingleThemeColorConfigEnv");
423
+ var setMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
424
+ return {
425
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
426
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
427
+ };
428
+ }, "setMultiThemeColorConfigEnv");
429
+ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
430
+ if (config.foreground) {
431
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
432
+ }
433
+ if (config.background) {
434
+ process.env[`${prefix}BACKGROUND`] = config.background;
435
+ }
436
+ if (config.brand) {
437
+ process.env[`${prefix}BRAND`] = config.brand;
438
+ }
439
+ if (config.alternate) {
440
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
441
+ }
442
+ if (config.accent) {
443
+ process.env[`${prefix}ACCENT`] = config.accent;
444
+ }
445
+ if (config.link) {
446
+ process.env[`${prefix}LINK`] = config.link;
447
+ }
448
+ if (config.help) {
449
+ process.env[`${prefix}HELP`] = config.help;
450
+ }
451
+ if (config.success) {
452
+ process.env[`${prefix}SUCCESS`] = config.success;
453
+ }
454
+ if (config.info) {
455
+ process.env[`${prefix}INFO`] = config.info;
456
+ }
457
+ if (config.warning) {
458
+ process.env[`${prefix}WARNING`] = config.warning;
459
+ }
460
+ if (config.danger) {
461
+ process.env[`${prefix}DANGER`] = config.danger;
462
+ }
463
+ if (config.fatal) {
464
+ process.env[`${prefix}FATAL`] = config.fatal;
465
+ }
466
+ if (config.positive) {
467
+ process.env[`${prefix}POSITIVE`] = config.positive;
468
+ }
469
+ if (config.negative) {
470
+ process.env[`${prefix}NEGATIVE`] = config.negative;
471
+ }
472
+ }, "setBaseThemeColorConfigEnv");
473
+
474
+ // ../config-tools/src/create-storm-config.ts
475
+ var _static_cache = void 0;
476
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
477
+ let config = {};
478
+ if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
479
+ writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
480
+ return _static_cache.data;
481
+ }
482
+ let _workspaceRoot = workspaceRoot;
483
+ if (!_workspaceRoot) {
484
+ _workspaceRoot = findWorkspaceRoot();
485
+ }
486
+ const configFile = await getConfigFile(_workspaceRoot);
487
+ if (!configFile) {
488
+ writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
489
+ logLevel: "all"
490
+ });
491
+ }
492
+ config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
493
+ setConfigEnv(config);
494
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
495
+ ${formatLogMessage(config)}`, config);
496
+ return config;
497
+ }, "loadStormConfig");
498
+
499
+ export {
500
+ loadStormConfig
501
+ };