@storm-software/untyped 0.24.248 → 0.24.249

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.
@@ -0,0 +1,2424 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+
25
+ // ../config/src/schema.ts
26
+ var z = __toESM(require("zod/v4/mini"), 1);
27
+
28
+ // ../config/src/constants.ts
29
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
30
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
31
+ var STORM_DEFAULT_CONTACT = "https://stormsoftware.com/contact";
32
+ var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
33
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
34
+ var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
35
+ var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
36
+ var STORM_DEFAULT_RELEASE_FOOTER = `
37
+ Storm Software is an open source software development organization with the mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
38
+
39
+ Join us on [Discord](${STORM_DEFAULT_SOCIAL_DISCORD}) to chat with the team, receive release notifications, ask questions, and get involved.
40
+
41
+ If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](${STORM_DEFAULT_CONTACT}) or join our [Slack](${STORM_DEFAULT_SOCIAL_SLACK}) channel!
42
+ `;
43
+ var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
44
+ var STORM_DEFAULT_BANNER_ALT = "The workspace's banner image";
45
+
46
+ // ../config/src/schema.ts
47
+ var schemaRegistry = z.registry();
48
+ var colorSchema = z.string().check(
49
+ z.length(7),
50
+ z.toLowerCase(),
51
+ z.regex(/^#([0-9a-f]{3}){1,2}$/i),
52
+ z.trim()
53
+ );
54
+ schemaRegistry.add(colorSchema, {
55
+ description: "A base schema for describing the format of colors"
56
+ });
57
+ var darkColorSchema = z._default(colorSchema, "#1e2124");
58
+ schemaRegistry.add(darkColorSchema, {
59
+ description: "The dark background color of the workspace"
60
+ });
61
+ var lightColorSchema = z._default(colorSchema, "#cbd5e1");
62
+ schemaRegistry.add(lightColorSchema, {
63
+ description: "The light background color of the workspace"
64
+ });
65
+ var brandColorSchema = z._default(colorSchema, "#1fb2a6");
66
+ schemaRegistry.add(brandColorSchema, {
67
+ description: "The primary brand specific color of the workspace"
68
+ });
69
+ var alternateColorSchema = z.optional(colorSchema);
70
+ schemaRegistry.add(alternateColorSchema, {
71
+ description: "The alternate brand specific color of the workspace"
72
+ });
73
+ var accentColorSchema = z.optional(colorSchema);
74
+ schemaRegistry.add(accentColorSchema, {
75
+ description: "The secondary brand specific color of the workspace"
76
+ });
77
+ var linkColorSchema = z._default(colorSchema, "#3fa6ff");
78
+ schemaRegistry.add(linkColorSchema, {
79
+ description: "The color used to display hyperlink text"
80
+ });
81
+ var discoveryColorSchema = z._default(colorSchema, "#818cf8");
82
+ schemaRegistry.add(discoveryColorSchema, {
83
+ description: "The second brand specific color of the workspace"
84
+ });
85
+ var successColorSchema = z._default(colorSchema, "#45b27e");
86
+ schemaRegistry.add(successColorSchema, {
87
+ description: "The success color of the workspace"
88
+ });
89
+ var infoColorSchema = z._default(colorSchema, "#38bdf8");
90
+ schemaRegistry.add(infoColorSchema, {
91
+ description: "The informational color of the workspace"
92
+ });
93
+ var debugColorSchema = z._default(colorSchema, "#8afafc");
94
+ schemaRegistry.add(debugColorSchema, {
95
+ description: "The debug color of the workspace"
96
+ });
97
+ var warningColorSchema = z._default(colorSchema, "#f3d371");
98
+ schemaRegistry.add(warningColorSchema, {
99
+ description: "The warning color of the workspace"
100
+ });
101
+ var dangerColorSchema = z._default(colorSchema, "#d8314a");
102
+ schemaRegistry.add(dangerColorSchema, {
103
+ description: "The danger color of the workspace"
104
+ });
105
+ var fatalColorSchema = z.optional(colorSchema);
106
+ schemaRegistry.add(fatalColorSchema, {
107
+ description: "The fatal color of the workspace"
108
+ });
109
+ var performanceColorSchema = z._default(colorSchema, "#80fd74");
110
+ schemaRegistry.add(performanceColorSchema, {
111
+ description: "The performance color of the workspace"
112
+ });
113
+ var positiveColorSchema = z._default(colorSchema, "#4ade80");
114
+ schemaRegistry.add(positiveColorSchema, {
115
+ description: "The positive number color of the workspace"
116
+ });
117
+ var negativeColorSchema = z._default(colorSchema, "#ef4444");
118
+ schemaRegistry.add(negativeColorSchema, {
119
+ description: "The negative number color of the workspace"
120
+ });
121
+ var gradientStopsSchema = z.optional(z.array(colorSchema));
122
+ schemaRegistry.add(gradientStopsSchema, {
123
+ description: "The color stops for the base gradient color pattern used in the workspace"
124
+ });
125
+ var darkColorsSchema = z.object({
126
+ foreground: lightColorSchema,
127
+ background: darkColorSchema,
128
+ brand: brandColorSchema,
129
+ alternate: alternateColorSchema,
130
+ accent: accentColorSchema,
131
+ link: linkColorSchema,
132
+ discovery: discoveryColorSchema,
133
+ success: successColorSchema,
134
+ info: infoColorSchema,
135
+ debug: debugColorSchema,
136
+ warning: warningColorSchema,
137
+ danger: dangerColorSchema,
138
+ fatal: fatalColorSchema,
139
+ performance: performanceColorSchema,
140
+ positive: positiveColorSchema,
141
+ negative: negativeColorSchema,
142
+ gradient: gradientStopsSchema
143
+ });
144
+ var lightColorsSchema = z.object({
145
+ foreground: darkColorSchema,
146
+ background: lightColorSchema,
147
+ brand: brandColorSchema,
148
+ alternate: alternateColorSchema,
149
+ accent: accentColorSchema,
150
+ link: linkColorSchema,
151
+ discovery: discoveryColorSchema,
152
+ success: successColorSchema,
153
+ info: infoColorSchema,
154
+ debug: debugColorSchema,
155
+ warning: warningColorSchema,
156
+ danger: dangerColorSchema,
157
+ fatal: fatalColorSchema,
158
+ performance: performanceColorSchema,
159
+ positive: positiveColorSchema,
160
+ negative: negativeColorSchema,
161
+ gradient: gradientStopsSchema
162
+ });
163
+ var multiColorsSchema = z.object({
164
+ dark: darkColorsSchema,
165
+ light: lightColorsSchema
166
+ });
167
+ var singleColorsSchema = z.object({
168
+ dark: darkColorSchema,
169
+ light: lightColorSchema,
170
+ brand: brandColorSchema,
171
+ alternate: alternateColorSchema,
172
+ accent: accentColorSchema,
173
+ link: linkColorSchema,
174
+ discovery: discoveryColorSchema,
175
+ success: successColorSchema,
176
+ info: infoColorSchema,
177
+ debug: debugColorSchema,
178
+ warning: warningColorSchema,
179
+ danger: dangerColorSchema,
180
+ fatal: fatalColorSchema,
181
+ performance: performanceColorSchema,
182
+ positive: positiveColorSchema,
183
+ negative: negativeColorSchema,
184
+ gradient: gradientStopsSchema
185
+ });
186
+ var registryUrlConfigSchema = z.optional(z.url());
187
+ schemaRegistry.add(registryUrlConfigSchema, {
188
+ description: "A remote registry URL used to publish distributable packages"
189
+ });
190
+ var registrySchema = z._default(
191
+ z.object({
192
+ github: registryUrlConfigSchema,
193
+ npm: registryUrlConfigSchema,
194
+ cargo: registryUrlConfigSchema,
195
+ cyclone: registryUrlConfigSchema,
196
+ container: registryUrlConfigSchema
197
+ }),
198
+ {}
199
+ );
200
+ schemaRegistry.add(registrySchema, {
201
+ description: "A list of remote registry URLs used by Storm Software"
202
+ });
203
+ var colorsSchema = z.union([singleColorsSchema, multiColorsSchema]);
204
+ schemaRegistry.add(colorsSchema, {
205
+ description: "Colors used for various workspace elements"
206
+ });
207
+ var themeColorsSchema = z.record(
208
+ z.union([z.union([z.literal("base"), z.string()]), z.string()]),
209
+ colorsSchema
210
+ );
211
+ schemaRegistry.add(themeColorsSchema, {
212
+ description: "Storm theme config values used for styling various package elements"
213
+ });
214
+ var extendsSchema = z.optional(
215
+ z.union([z.string().check(z.trim()), z.array(z.string().check(z.trim()))])
216
+ );
217
+ schemaRegistry.add(extendsSchema, {
218
+ description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
219
+ });
220
+ var workspaceBotNameSchema = z.string().check(z.trim());
221
+ schemaRegistry.add(workspaceBotNameSchema, {
222
+ description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
223
+ });
224
+ var workspaceBotEmailSchema = z.string().check(z.trim());
225
+ schemaRegistry.add(workspaceBotEmailSchema, {
226
+ description: "The email of the workspace bot"
227
+ });
228
+ var workspaceBotSchema = z.object({
229
+ name: workspaceBotNameSchema,
230
+ email: workspaceBotEmailSchema
231
+ });
232
+ schemaRegistry.add(workspaceBotSchema, {
233
+ description: "The workspace's bot user's config used to automated various operations tasks"
234
+ });
235
+ var workspaceReleaseBannerUrlSchema = z.optional(
236
+ z.string().check(z.trim(), z.url())
237
+ );
238
+ schemaRegistry.add(workspaceReleaseBannerUrlSchema, {
239
+ description: "A URL to a banner image used to display the workspace's release"
240
+ });
241
+ var workspaceReleaseBannerAltSchema = z._default(
242
+ z.string().check(z.trim()),
243
+ STORM_DEFAULT_BANNER_ALT
244
+ );
245
+ schemaRegistry.add(workspaceReleaseBannerAltSchema, {
246
+ description: "The alt text for the workspace's release banner image"
247
+ });
248
+ var workspaceReleaseBannerSchema = z.object({
249
+ url: workspaceReleaseBannerUrlSchema,
250
+ alt: workspaceReleaseBannerAltSchema
251
+ });
252
+ schemaRegistry.add(workspaceReleaseBannerSchema, {
253
+ description: "The workspace's banner image used during the release process"
254
+ });
255
+ var workspaceReleaseHeaderSchema = z.optional(
256
+ z.string().check(z.trim())
257
+ );
258
+ schemaRegistry.add(workspaceReleaseHeaderSchema, {
259
+ description: "A header message appended to the start of the workspace's release notes"
260
+ });
261
+ var workspaceReleaseFooterSchema = z.optional(
262
+ z.string().check(z.trim())
263
+ );
264
+ schemaRegistry.add(workspaceReleaseFooterSchema, {
265
+ description: "A footer message appended to the end of the workspace's release notes"
266
+ });
267
+ var workspaceReleaseSchema = z.object({
268
+ banner: z.union([
269
+ workspaceReleaseBannerSchema,
270
+ z.string().check(z.trim(), z.url())
271
+ ]),
272
+ header: workspaceReleaseHeaderSchema,
273
+ footer: workspaceReleaseFooterSchema
274
+ });
275
+ schemaRegistry.add(workspaceReleaseSchema, {
276
+ description: "The workspace's release config used during the release process"
277
+ });
278
+ var workspaceSocialsTwitterSchema = z.optional(
279
+ z.string().check(z.trim())
280
+ );
281
+ schemaRegistry.add(workspaceSocialsTwitterSchema, {
282
+ description: "A Twitter/X account associated with the organization/project"
283
+ });
284
+ var workspaceSocialsDiscordSchema = z.optional(
285
+ z.string().check(z.trim())
286
+ );
287
+ schemaRegistry.add(workspaceSocialsDiscordSchema, {
288
+ description: "A Discord account associated with the organization/project"
289
+ });
290
+ var workspaceSocialsTelegramSchema = z.optional(
291
+ z.string().check(z.trim())
292
+ );
293
+ schemaRegistry.add(workspaceSocialsTelegramSchema, {
294
+ description: "A Telegram account associated with the organization/project"
295
+ });
296
+ var workspaceSocialsSlackSchema = z.optional(
297
+ z.string().check(z.trim())
298
+ );
299
+ schemaRegistry.add(workspaceSocialsSlackSchema, {
300
+ description: "A Slack account associated with the organization/project"
301
+ });
302
+ var workspaceSocialsMediumSchema = z.optional(
303
+ z.string().check(z.trim())
304
+ );
305
+ schemaRegistry.add(workspaceSocialsMediumSchema, {
306
+ description: "A Medium account associated with the organization/project"
307
+ });
308
+ var workspaceSocialsGithubSchema = z.optional(
309
+ z.string().check(z.trim())
310
+ );
311
+ schemaRegistry.add(workspaceSocialsGithubSchema, {
312
+ description: "A GitHub account associated with the organization/project"
313
+ });
314
+ var workspaceSocialsSchema = z.object({
315
+ twitter: workspaceSocialsTwitterSchema,
316
+ discord: workspaceSocialsDiscordSchema,
317
+ telegram: workspaceSocialsTelegramSchema,
318
+ slack: workspaceSocialsSlackSchema,
319
+ medium: workspaceSocialsMediumSchema,
320
+ github: workspaceSocialsGithubSchema
321
+ });
322
+ schemaRegistry.add(workspaceSocialsSchema, {
323
+ description: "The workspace's account config used to store various social media links"
324
+ });
325
+ var workspaceDirectoryCacheSchema = z.optional(
326
+ z.string().check(z.trim())
327
+ );
328
+ schemaRegistry.add(workspaceDirectoryCacheSchema, {
329
+ description: "The directory used to store the environment's cached file data"
330
+ });
331
+ var workspaceDirectoryDataSchema = z.optional(
332
+ z.string().check(z.trim())
333
+ );
334
+ schemaRegistry.add(workspaceDirectoryDataSchema, {
335
+ description: "The directory used to store the environment's data files"
336
+ });
337
+ var workspaceDirectoryConfigSchema = z.optional(
338
+ z.string().check(z.trim())
339
+ );
340
+ schemaRegistry.add(workspaceDirectoryConfigSchema, {
341
+ description: "The directory used to store the environment's configuration files"
342
+ });
343
+ var workspaceDirectoryTempSchema = z.optional(
344
+ z.string().check(z.trim())
345
+ );
346
+ schemaRegistry.add(workspaceDirectoryTempSchema, {
347
+ description: "The directory used to store the environment's temp files"
348
+ });
349
+ var workspaceDirectoryLogSchema = z.optional(
350
+ z.string().check(z.trim())
351
+ );
352
+ schemaRegistry.add(workspaceDirectoryLogSchema, {
353
+ description: "The directory used to store the environment's log files"
354
+ });
355
+ var workspaceDirectoryBuildSchema = z._default(
356
+ z.string().check(z.trim()),
357
+ "dist"
358
+ );
359
+ schemaRegistry.add(workspaceDirectoryBuildSchema, {
360
+ description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
361
+ });
362
+ var workspaceDirectorySchema = z.object({
363
+ cache: workspaceDirectoryCacheSchema,
364
+ data: workspaceDirectoryDataSchema,
365
+ config: workspaceDirectoryConfigSchema,
366
+ temp: workspaceDirectoryTempSchema,
367
+ log: workspaceDirectoryLogSchema,
368
+ build: workspaceDirectoryBuildSchema
369
+ });
370
+ schemaRegistry.add(workspaceDirectorySchema, {
371
+ description: "Various directories used by the workspace to store data, cache, and configuration files"
372
+ });
373
+ var variantSchema = z._default(
374
+ z.enum(["minimal", "monorepo"]),
375
+ "monorepo"
376
+ );
377
+ schemaRegistry.add(variantSchema, {
378
+ description: "The variant of the workspace. This can be used to enable or disable certain features or configurations."
379
+ });
380
+ var errorCodesFileSchema = z._default(
381
+ z.string().check(z.trim()),
382
+ STORM_DEFAULT_ERROR_CODES_FILE
383
+ );
384
+ schemaRegistry.add(errorCodesFileSchema, {
385
+ description: "The path to the workspace's error codes JSON file"
386
+ });
387
+ var errorUrlSchema = z.optional(z.url());
388
+ schemaRegistry.add(errorUrlSchema, {
389
+ description: "A URL to a page that looks up the workspace's error messages given a specific error code"
390
+ });
391
+ var errorSchema = z.object({
392
+ codesFile: errorCodesFileSchema,
393
+ url: errorUrlSchema
394
+ });
395
+ schemaRegistry.add(errorSchema, {
396
+ description: "The workspace's error config used when creating error details during a system error"
397
+ });
398
+ var organizationNameSchema = z.optional(
399
+ z.string().check(z.trim(), z.toLowerCase())
400
+ );
401
+ schemaRegistry.add(organizationNameSchema, {
402
+ description: "The name of the organization"
403
+ });
404
+ var organizationDescriptionSchema = z.optional(
405
+ z.string().check(z.trim())
406
+ );
407
+ schemaRegistry.add(organizationDescriptionSchema, {
408
+ description: "A description of the organization"
409
+ });
410
+ var organizationLogoSchema = z.optional(z.url());
411
+ schemaRegistry.add(organizationLogoSchema, {
412
+ description: "A URL to the organization's logo image"
413
+ });
414
+ var organizationIconSchema = z.optional(z.url());
415
+ schemaRegistry.add(organizationIconSchema, {
416
+ description: "A URL to the organization's icon image"
417
+ });
418
+ var organizationUrlSchema = z.optional(z.url());
419
+ schemaRegistry.add(organizationUrlSchema, {
420
+ description: "A URL to a page that provides more information about the organization"
421
+ });
422
+ var organizationSchema = z.object({
423
+ name: organizationNameSchema,
424
+ description: organizationDescriptionSchema,
425
+ logo: organizationLogoSchema,
426
+ icon: organizationIconSchema,
427
+ url: organizationUrlSchema
428
+ });
429
+ schemaRegistry.add(organizationSchema, {
430
+ description: "The workspace's organization details"
431
+ });
432
+ var schemaNameSchema = z._default(
433
+ z.string().check(z.trim(), z.toLowerCase()),
434
+ "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
435
+ );
436
+ schemaRegistry.add(schemaNameSchema, {
437
+ description: "The URL or file path to the JSON schema file that describes the Storm configuration file"
438
+ });
439
+ var nameSchema = z.string().check(z.trim(), z.toLowerCase());
440
+ schemaRegistry.add(nameSchema, {
441
+ description: "The name of the workspace/project/service/package/scope using this configuration"
442
+ });
443
+ var namespaceSchema = z.string().check(z.trim(), z.toLowerCase());
444
+ schemaRegistry.add(namespaceSchema, {
445
+ description: "The namespace of the workspace/project/service/package/scope using this configuration"
446
+ });
447
+ var orgSchema = z.union([
448
+ organizationSchema,
449
+ z.string().check(z.trim(), z.toLowerCase())
450
+ ]);
451
+ schemaRegistry.add(orgSchema, {
452
+ description: "The organization of the workspace. This can be a string or an object containing the organization's details"
453
+ });
454
+ var repositorySchema = z.string().check(z.trim(), z.toLowerCase());
455
+ schemaRegistry.add(repositorySchema, {
456
+ description: "The repo URL of the workspace (i.e. the GitHub repository URL)"
457
+ });
458
+ var licenseSchema = z._default(
459
+ z.string().check(z.trim()),
460
+ "Apache-2.0"
461
+ );
462
+ schemaRegistry.add(licenseSchema, {
463
+ description: "The license type of the package"
464
+ });
465
+ var homepageSchema = z.optional(z.url());
466
+ schemaRegistry.add(homepageSchema, {
467
+ description: "The homepage of the workspace"
468
+ });
469
+ var docsSchema = z.optional(z.url());
470
+ schemaRegistry.add(docsSchema, {
471
+ description: "The documentation site for the workspace"
472
+ });
473
+ var portalSchema = z.optional(z.url());
474
+ schemaRegistry.add(portalSchema, {
475
+ description: "The development portal site for the workspace"
476
+ });
477
+ var licensingSchema = z.optional(z.url());
478
+ schemaRegistry.add(licensingSchema, {
479
+ description: "The licensing site for the workspace"
480
+ });
481
+ var contactSchema = z.optional(z.url());
482
+ schemaRegistry.add(contactSchema, {
483
+ description: "The contact site for the workspace"
484
+ });
485
+ var supportSchema = z.optional(z.url());
486
+ schemaRegistry.add(supportSchema, {
487
+ description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
488
+ });
489
+ var branchSchema = z._default(
490
+ z.string().check(z.trim(), z.toLowerCase()),
491
+ "main"
492
+ );
493
+ schemaRegistry.add(branchSchema, {
494
+ description: "The branch of the workspace"
495
+ });
496
+ var preidSchema = z.optional(
497
+ z.string().check(z.trim(), z.toLowerCase())
498
+ );
499
+ schemaRegistry.add(preidSchema, {
500
+ description: "A tag specifying the version pre-release identifier"
501
+ });
502
+ var ownerSchema = z.optional(
503
+ z.string().check(z.trim(), z.toLowerCase())
504
+ );
505
+ schemaRegistry.add(ownerSchema, {
506
+ description: "The owner of the package"
507
+ });
508
+ var modeSchema = z._default(
509
+ z.enum(["development", "test", "production"]).check(z.trim(), z.toLowerCase()),
510
+ "production"
511
+ );
512
+ schemaRegistry.add(modeSchema, {
513
+ description: "The current runtime environment mode for the package"
514
+ });
515
+ var workspaceRootSchema = z.string().check(z.trim(), z.toLowerCase());
516
+ schemaRegistry.add(workspaceRootSchema, {
517
+ description: "The root directory of the workspace"
518
+ });
519
+ var skipCacheSchema = z._default(z.boolean(), false);
520
+ schemaRegistry.add(skipCacheSchema, {
521
+ description: "Should all known types of workspace caching be skipped?"
522
+ });
523
+ var packageManagerSchema = z._default(
524
+ z.enum(["npm", "yarn", "pnpm", "bun"]),
525
+ "npm"
526
+ );
527
+ schemaRegistry.add(packageManagerSchema, {
528
+ description: "The JavaScript/TypeScript package manager used by the repository"
529
+ });
530
+ var timezoneSchema = z._default(
531
+ z.string().check(z.trim()),
532
+ "America/New_York"
533
+ );
534
+ schemaRegistry.add(timezoneSchema, {
535
+ description: "The default timezone of the workspace"
536
+ });
537
+ var localeSchema = z._default(z.string().check(z.trim()), "en-US");
538
+ schemaRegistry.add(localeSchema, {
539
+ description: "The default locale of the workspace"
540
+ });
541
+ var logLevelSchema = z._default(
542
+ z.enum([
543
+ "silent",
544
+ "fatal",
545
+ "error",
546
+ "warn",
547
+ "success",
548
+ "info",
549
+ "performance",
550
+ "debug",
551
+ "trace",
552
+ "all"
553
+ ]),
554
+ "info"
555
+ );
556
+ schemaRegistry.add(logLevelSchema, {
557
+ description: "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
558
+ });
559
+ var skipConfigLoggingSchema = z._default(z.boolean(), true);
560
+ schemaRegistry.add(skipConfigLoggingSchema, {
561
+ description: "Should the logging of the current Storm Workspace configuration be skipped?"
562
+ });
563
+ var configFileSchema = z._default(
564
+ z.nullable(z.string().check(z.trim())),
565
+ null
566
+ );
567
+ schemaRegistry.add(configFileSchema, {
568
+ description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
569
+ });
570
+ var extensionsSchema = z._default(z.record(z.string(), z.any()), {});
571
+ schemaRegistry.add(extensionsSchema, {
572
+ description: "Configuration of each used extension"
573
+ });
574
+ var workspaceConfigSchema = z.object({
575
+ $schema: schemaNameSchema,
576
+ extends: extendsSchema,
577
+ name: nameSchema,
578
+ variant: variantSchema,
579
+ namespace: namespaceSchema,
580
+ organization: orgSchema,
581
+ repository: repositorySchema,
582
+ license: licenseSchema,
583
+ homepage: homepageSchema,
584
+ docs: docsSchema,
585
+ portal: portalSchema,
586
+ licensing: licensingSchema,
587
+ contact: contactSchema,
588
+ support: supportSchema,
589
+ branch: branchSchema,
590
+ preid: preidSchema,
591
+ owner: ownerSchema,
592
+ bot: workspaceBotSchema,
593
+ release: workspaceReleaseSchema,
594
+ socials: workspaceSocialsSchema,
595
+ error: errorSchema,
596
+ mode: modeSchema,
597
+ workspaceRoot: workspaceRootSchema,
598
+ skipCache: skipCacheSchema,
599
+ directories: workspaceDirectorySchema,
600
+ packageManager: packageManagerSchema,
601
+ timezone: timezoneSchema,
602
+ locale: localeSchema,
603
+ logLevel: logLevelSchema,
604
+ skipConfigLogging: skipConfigLoggingSchema,
605
+ registry: registrySchema,
606
+ configFile: configFileSchema,
607
+ colors: z.union([colorsSchema, themeColorsSchema]),
608
+ extensions: extensionsSchema
609
+ });
610
+ schemaRegistry.add(extensionsSchema, {
611
+ description: "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
612
+ });
613
+
614
+ // ../config-tools/src/create-storm-config.ts
615
+ var import_defu2 = __toESM(require("defu"), 1);
616
+ var import_node_fs3 = require("fs");
617
+
618
+ // ../config-tools/src/config-file/get-config-file.ts
619
+ var import_c12 = require("c12");
620
+ var import_defu = __toESM(require("defu"), 1);
621
+
622
+ // ../config-tools/src/logger/console.ts
623
+ var import_formatDistanceToNow = require("date-fns/formatDistanceToNow");
624
+
625
+ // ../config-tools/src/types.ts
626
+ var LogLevel = {
627
+ SILENT: 0,
628
+ FATAL: 10,
629
+ ERROR: 20,
630
+ WARN: 30,
631
+ SUCCESS: 35,
632
+ INFO: 40,
633
+ PERFORMANCE: 50,
634
+ DEBUG: 60,
635
+ TRACE: 70,
636
+ ALL: 100
637
+ };
638
+ var LogLevelLabel = {
639
+ SILENT: "silent",
640
+ FATAL: "fatal",
641
+ ERROR: "error",
642
+ WARN: "warn",
643
+ SUCCESS: "success",
644
+ INFO: "info",
645
+ PERFORMANCE: "performance",
646
+ DEBUG: "debug",
647
+ TRACE: "trace",
648
+ ALL: "all"
649
+ };
650
+
651
+ // ../config-tools/src/utilities/colors.ts
652
+ var DEFAULT_COLOR_CONFIG = {
653
+ light: {
654
+ background: "#fafafa",
655
+ foreground: "#1d1e22",
656
+ brand: "#1fb2a6",
657
+ alternate: "#db2777",
658
+ discovery: "#5C4EE5",
659
+ success: "#087f5b",
660
+ info: "#0550ae",
661
+ debug: "#8afafc",
662
+ warning: "#e3b341",
663
+ danger: "#D8314A",
664
+ fatal: "#51070f",
665
+ performance: "#13c302",
666
+ link: "#3fa6ff",
667
+ positive: "#22c55e",
668
+ negative: "#dc2626",
669
+ gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
670
+ },
671
+ dark: {
672
+ background: "#1e2124",
673
+ foreground: "#cbd5e1",
674
+ brand: "#2dd4bf",
675
+ alternate: "#db2777",
676
+ discovery: "#818cf8",
677
+ success: "#10b981",
678
+ info: "#58a6ff",
679
+ debug: "#8afafc",
680
+ warning: "#f3d371",
681
+ danger: "#D8314A",
682
+ fatal: "#a40e26",
683
+ performance: "#80fd74",
684
+ link: "#3fa6ff",
685
+ positive: "#22c55e",
686
+ negative: "#dc2626",
687
+ gradient: ["#1fb2a6", "#db2777", "#818cf8"]
688
+ }
689
+ };
690
+ function getColors(config) {
691
+ if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) {
692
+ return DEFAULT_COLOR_CONFIG;
693
+ }
694
+ if (config.colors["base"]) {
695
+ if (typeof config.colors["base"]["dark"] === "object") {
696
+ return config.colors["base"]["dark"];
697
+ } else if (config.colors["base"]["dark"] === "string") {
698
+ return config.colors["base"];
699
+ }
700
+ }
701
+ if (typeof config.colors["dark"] === "object") {
702
+ return config.colors["dark"];
703
+ }
704
+ return config.colors ?? DEFAULT_COLOR_CONFIG;
705
+ }
706
+ function getColor(key, config) {
707
+ const colors = getColors(config);
708
+ const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
709
+ if (result) {
710
+ return result;
711
+ }
712
+ if (key === "link" || key === "debug") {
713
+ return getColor("info", config);
714
+ } else if (key === "fatal") {
715
+ return getColor("danger", config);
716
+ }
717
+ return getColor("brand", config);
718
+ }
719
+
720
+ // ../config-tools/src/logger/chalk.ts
721
+ var import_chalk = __toESM(require("chalk"), 1);
722
+ var chalkDefault = {
723
+ hex: (_) => (message) => message,
724
+ bgHex: (_) => ({
725
+ whiteBright: (message) => message,
726
+ white: (message) => message
727
+ }),
728
+ white: (message) => message,
729
+ whiteBright: (message) => message,
730
+ gray: (message) => message,
731
+ bold: {
732
+ hex: (_) => (message) => message,
733
+ bgHex: (_) => ({
734
+ whiteBright: (message) => message,
735
+ white: (message) => message
736
+ }),
737
+ whiteBright: (message) => message,
738
+ white: (message) => message
739
+ },
740
+ dim: {
741
+ hex: (_) => (message) => message,
742
+ gray: (message) => message
743
+ }
744
+ };
745
+ var getChalk = () => {
746
+ let _chalk = import_chalk.default;
747
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
748
+ _chalk = chalkDefault;
749
+ }
750
+ return _chalk;
751
+ };
752
+
753
+ // ../config-tools/src/logger/is-unicode-supported.ts
754
+ function isUnicodeSupported() {
755
+ if (process.platform !== "win32") {
756
+ return process.env.TERM !== "linux";
757
+ }
758
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
759
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
760
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
761
+ 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";
762
+ }
763
+
764
+ // ../config-tools/src/logger/console-icons.ts
765
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
766
+ var CONSOLE_ICONS = {
767
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
768
+ [LogLevelLabel.FATAL]: useIcon("\u{1F571}", "\xD7"),
769
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
770
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
771
+ [LogLevelLabel.PERFORMANCE]: useIcon("\u23F1", "\u23F1"),
772
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
773
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
774
+ [LogLevelLabel.TRACE]: useIcon("\u2699", "T"),
775
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
776
+ };
777
+
778
+ // ../config-tools/src/logger/format-timestamp.ts
779
+ var formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
780
+ return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
781
+ };
782
+
783
+ // ../config-tools/src/logger/get-log-level.ts
784
+ var getLogLevel = (label) => {
785
+ switch (label) {
786
+ case "all":
787
+ return LogLevel.ALL;
788
+ case "trace":
789
+ return LogLevel.TRACE;
790
+ case "debug":
791
+ return LogLevel.DEBUG;
792
+ case "performance":
793
+ return LogLevel.PERFORMANCE;
794
+ case "info":
795
+ return LogLevel.INFO;
796
+ case "warn":
797
+ return LogLevel.WARN;
798
+ case "error":
799
+ return LogLevel.ERROR;
800
+ case "fatal":
801
+ return LogLevel.FATAL;
802
+ case "silent":
803
+ return LogLevel.SILENT;
804
+ default:
805
+ return LogLevel.INFO;
806
+ }
807
+ };
808
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
809
+ if (logLevel >= LogLevel.ALL) {
810
+ return LogLevelLabel.ALL;
811
+ }
812
+ if (logLevel >= LogLevel.TRACE) {
813
+ return LogLevelLabel.TRACE;
814
+ }
815
+ if (logLevel >= LogLevel.DEBUG) {
816
+ return LogLevelLabel.DEBUG;
817
+ }
818
+ if (logLevel >= LogLevel.PERFORMANCE) {
819
+ return LogLevelLabel.PERFORMANCE;
820
+ }
821
+ if (logLevel >= LogLevel.INFO) {
822
+ return LogLevelLabel.INFO;
823
+ }
824
+ if (logLevel >= LogLevel.WARN) {
825
+ return LogLevelLabel.WARN;
826
+ }
827
+ if (logLevel >= LogLevel.ERROR) {
828
+ return LogLevelLabel.ERROR;
829
+ }
830
+ if (logLevel >= LogLevel.FATAL) {
831
+ return LogLevelLabel.FATAL;
832
+ }
833
+ if (logLevel <= LogLevel.SILENT) {
834
+ return LogLevelLabel.SILENT;
835
+ }
836
+ return LogLevelLabel.INFO;
837
+ };
838
+
839
+ // ../config-tools/src/logger/console.ts
840
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, options = {}) => {
841
+ const {
842
+ chalk: _chalk = getChalk(),
843
+ fullDateTime = false,
844
+ hideDateTime = false
845
+ } = options;
846
+ 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;
847
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
848
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
849
+ return (_) => {
850
+ };
851
+ }
852
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
853
+ return (message) => {
854
+ console.error(
855
+ `
856
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(
857
+ `[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `
858
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
859
+ `
860
+ );
861
+ };
862
+ }
863
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
864
+ return (message) => {
865
+ console.error(
866
+ `
867
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(
868
+ `[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `
869
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
870
+ `
871
+ );
872
+ };
873
+ }
874
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
875
+ return (message) => {
876
+ console.warn(
877
+ `
878
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(
879
+ `[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `
880
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
881
+ `
882
+ );
883
+ };
884
+ }
885
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
886
+ return (message) => {
887
+ console.info(
888
+ `
889
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(
890
+ `[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `
891
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
892
+ `
893
+ );
894
+ };
895
+ }
896
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
897
+ return (message) => {
898
+ console.info(
899
+ `
900
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(
901
+ `[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `
902
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
903
+ `
904
+ );
905
+ };
906
+ }
907
+ if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) {
908
+ return (message) => {
909
+ console.debug(
910
+ `
911
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance)(
912
+ `[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `
913
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
914
+ `
915
+ );
916
+ };
917
+ }
918
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
919
+ return (message) => {
920
+ console.debug(
921
+ `
922
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug)(
923
+ `[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `
924
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
925
+ `
926
+ );
927
+ };
928
+ }
929
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
930
+ return (message) => {
931
+ console.debug(
932
+ `
933
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(
934
+ `[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `
935
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
936
+ `
937
+ );
938
+ };
939
+ }
940
+ return (message) => {
941
+ console.log(
942
+ `
943
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(
944
+ `[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `
945
+ )}${_chalk.bold.whiteBright(formatLogMessage(message))}
946
+ `
947
+ );
948
+ };
949
+ };
950
+ var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
951
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
952
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
953
+ var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
954
+ var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
955
+ var writePerformance = (message, config) => getLogFn(LogLevel.PERFORMANCE, config)(message);
956
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
957
+ var getStopwatch = (name) => {
958
+ const start = /* @__PURE__ */ new Date();
959
+ return () => {
960
+ writePerformance(
961
+ `The${name ? ` ${name}` : ""} process took ${(0, import_formatDistanceToNow.formatDistanceToNow)(start, {
962
+ includeSeconds: true
963
+ })} to complete`
964
+ );
965
+ };
966
+ };
967
+ var MAX_DEPTH = 10;
968
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
969
+ if (depth2 > MAX_DEPTH) {
970
+ return "<max depth>";
971
+ }
972
+ const prefix = options.prefix ?? "";
973
+ const skip = options.skip ?? [];
974
+ const sort = options.sort ?? true;
975
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
976
+ ${message.sort(
977
+ sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
978
+ ).map(
979
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
980
+ item,
981
+ { prefix: `${prefix}--`, skip, sort },
982
+ depth2 + 1
983
+ )}`
984
+ ).join("\n")}` : typeof message === "object" && message ? `
985
+ ${Object.keys(message).filter(
986
+ (key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())
987
+ ).sort(
988
+ sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
989
+ ).map(
990
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter(
991
+ (key2) => typeof key2 !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key2.toLowerCase().trim())
992
+ ).length === 0 ? "{}" : formatLogMessage(
993
+ message[key],
994
+ { prefix: `${prefix}--`, skip, sort },
995
+ depth2 + 1
996
+ ) : message[key]}`
997
+ ).join("\n")}` : String(message);
998
+ };
999
+ var _isFunction = (value) => {
1000
+ try {
1001
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
1002
+ } catch {
1003
+ return false;
1004
+ }
1005
+ };
1006
+ var brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("\u{1F5F2}");
1007
+
1008
+ // ../config-tools/src/utilities/correct-paths.ts
1009
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
1010
+ function normalizeWindowsPath(input = "") {
1011
+ if (!input) {
1012
+ return input;
1013
+ }
1014
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
1015
+ }
1016
+ var _UNC_REGEX = /^[/\\]{2}/;
1017
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
1018
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
1019
+ var correctPaths = function(path) {
1020
+ if (!path || path.length === 0) {
1021
+ return ".";
1022
+ }
1023
+ path = normalizeWindowsPath(path);
1024
+ const isUNCPath = path?.match(_UNC_REGEX);
1025
+ const isPathAbsolute = isAbsolute(path);
1026
+ const trailingSeparator = path[path.length - 1] === "/";
1027
+ path = normalizeString(path, !isPathAbsolute);
1028
+ if (path.length === 0) {
1029
+ if (isPathAbsolute) {
1030
+ return "/";
1031
+ }
1032
+ return trailingSeparator ? "./" : ".";
1033
+ }
1034
+ if (trailingSeparator) {
1035
+ path += "/";
1036
+ }
1037
+ if (_DRIVE_LETTER_RE.test(path)) {
1038
+ path += "/";
1039
+ }
1040
+ if (isUNCPath) {
1041
+ if (!isPathAbsolute) {
1042
+ return `//./${path}`;
1043
+ }
1044
+ return `//${path}`;
1045
+ }
1046
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
1047
+ };
1048
+ var joinPaths = function(...segments) {
1049
+ let path = "";
1050
+ for (const seg of segments) {
1051
+ if (!seg) {
1052
+ continue;
1053
+ }
1054
+ if (path.length > 0) {
1055
+ const pathTrailing = path[path.length - 1] === "/";
1056
+ const segLeading = seg[0] === "/";
1057
+ const both = pathTrailing && segLeading;
1058
+ if (both) {
1059
+ path += seg.slice(1);
1060
+ } else {
1061
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
1062
+ }
1063
+ } else {
1064
+ path += seg;
1065
+ }
1066
+ }
1067
+ return correctPaths(path);
1068
+ };
1069
+ function normalizeString(path, allowAboveRoot) {
1070
+ let res = "";
1071
+ let lastSegmentLength = 0;
1072
+ let lastSlash = -1;
1073
+ let dots = 0;
1074
+ let char = null;
1075
+ for (let index = 0; index <= path.length; ++index) {
1076
+ if (index < path.length) {
1077
+ char = path[index];
1078
+ } else if (char === "/") {
1079
+ break;
1080
+ } else {
1081
+ char = "/";
1082
+ }
1083
+ if (char === "/") {
1084
+ if (lastSlash === index - 1 || dots === 1) {
1085
+ } else if (dots === 2) {
1086
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
1087
+ if (res.length > 2) {
1088
+ const lastSlashIndex = res.lastIndexOf("/");
1089
+ if (lastSlashIndex === -1) {
1090
+ res = "";
1091
+ lastSegmentLength = 0;
1092
+ } else {
1093
+ res = res.slice(0, lastSlashIndex);
1094
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1095
+ }
1096
+ lastSlash = index;
1097
+ dots = 0;
1098
+ continue;
1099
+ } else if (res.length > 0) {
1100
+ res = "";
1101
+ lastSegmentLength = 0;
1102
+ lastSlash = index;
1103
+ dots = 0;
1104
+ continue;
1105
+ }
1106
+ }
1107
+ if (allowAboveRoot) {
1108
+ res += res.length > 0 ? "/.." : "..";
1109
+ lastSegmentLength = 2;
1110
+ }
1111
+ } else {
1112
+ if (res.length > 0) {
1113
+ res += `/${path.slice(lastSlash + 1, index)}`;
1114
+ } else {
1115
+ res = path.slice(lastSlash + 1, index);
1116
+ }
1117
+ lastSegmentLength = index - lastSlash - 1;
1118
+ }
1119
+ lastSlash = index;
1120
+ dots = 0;
1121
+ } else if (char === "." && dots !== -1) {
1122
+ ++dots;
1123
+ } else {
1124
+ dots = -1;
1125
+ }
1126
+ }
1127
+ return res;
1128
+ }
1129
+ var isAbsolute = function(p) {
1130
+ return _IS_ABSOLUTE_RE.test(p);
1131
+ };
1132
+
1133
+ // ../config-tools/src/utilities/find-up.ts
1134
+ var import_node_fs = require("fs");
1135
+ var import_node_path = require("path");
1136
+ var MAX_PATH_SEARCH_DEPTH = 30;
1137
+ var depth = 0;
1138
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
1139
+ const _startPath = startPath ?? process.cwd();
1140
+ if (endDirectoryNames.some(
1141
+ (endDirName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endDirName))
1142
+ )) {
1143
+ return _startPath;
1144
+ }
1145
+ if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
1146
+ return _startPath;
1147
+ }
1148
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
1149
+ const parent = (0, import_node_path.join)(_startPath, "..");
1150
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
1151
+ }
1152
+ return void 0;
1153
+ }
1154
+
1155
+ // ../config-tools/src/utilities/find-workspace-root.ts
1156
+ var rootFiles = [
1157
+ "storm-workspace.json",
1158
+ "storm-workspace.yaml",
1159
+ "storm-workspace.yml",
1160
+ "storm-workspace.js",
1161
+ "storm-workspace.ts",
1162
+ ".storm-workspace.json",
1163
+ ".storm-workspace.yaml",
1164
+ ".storm-workspace.yml",
1165
+ ".storm-workspace.js",
1166
+ ".storm-workspace.ts",
1167
+ "lerna.json",
1168
+ "nx.json",
1169
+ "turbo.json",
1170
+ "npm-workspace.json",
1171
+ "yarn-workspace.json",
1172
+ "pnpm-workspace.json",
1173
+ "npm-workspace.yaml",
1174
+ "yarn-workspace.yaml",
1175
+ "pnpm-workspace.yaml",
1176
+ "npm-workspace.yml",
1177
+ "yarn-workspace.yml",
1178
+ "pnpm-workspace.yml",
1179
+ "npm-lock.json",
1180
+ "yarn-lock.json",
1181
+ "pnpm-lock.json",
1182
+ "npm-lock.yaml",
1183
+ "yarn-lock.yaml",
1184
+ "pnpm-lock.yaml",
1185
+ "npm-lock.yml",
1186
+ "yarn-lock.yml",
1187
+ "pnpm-lock.yml",
1188
+ "bun.lockb",
1189
+ "bun.lock",
1190
+ "bunfig.toml"
1191
+ ];
1192
+ var rootDirectories = [
1193
+ ".storm-workspace",
1194
+ ".nx",
1195
+ ".git",
1196
+ ".github",
1197
+ ".vscode",
1198
+ ".verdaccio"
1199
+ ];
1200
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
1201
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
1202
+ return correctPaths(
1203
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
1204
+ );
1205
+ }
1206
+ return correctPaths(
1207
+ findFolderUp(
1208
+ pathInsideMonorepo ?? process.cwd(),
1209
+ rootFiles,
1210
+ rootDirectories
1211
+ )
1212
+ );
1213
+ }
1214
+ function findWorkspaceRoot(pathInsideMonorepo) {
1215
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
1216
+ if (!result) {
1217
+ throw new Error(
1218
+ `Cannot find workspace root upwards from known path. Files search list includes:
1219
+ ${rootFiles.join(
1220
+ "\n"
1221
+ )}
1222
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
1223
+ );
1224
+ }
1225
+ return result;
1226
+ }
1227
+
1228
+ // ../config/src/types.ts
1229
+ var COLOR_KEYS = [
1230
+ "dark",
1231
+ "light",
1232
+ "base",
1233
+ "brand",
1234
+ "alternate",
1235
+ "accent",
1236
+ "link",
1237
+ "success",
1238
+ "discovery",
1239
+ "info",
1240
+ "warning",
1241
+ "danger",
1242
+ "fatal",
1243
+ "performance",
1244
+ "positive",
1245
+ "negative"
1246
+ ];
1247
+
1248
+ // ../config-tools/src/utilities/get-default-config.ts
1249
+ var import_node_fs2 = require("fs");
1250
+ var import_promises = require("fs/promises");
1251
+ var import_node_path2 = require("path");
1252
+ async function getPackageJsonConfig(root) {
1253
+ let license = STORM_DEFAULT_LICENSE;
1254
+ let homepage = void 0;
1255
+ let support = void 0;
1256
+ let name = void 0;
1257
+ let namespace = void 0;
1258
+ let repository = void 0;
1259
+ const workspaceRoot = findWorkspaceRoot(root);
1260
+ if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
1261
+ const file = await (0, import_promises.readFile)(
1262
+ joinPaths(workspaceRoot, "package.json"),
1263
+ "utf8"
1264
+ );
1265
+ if (file) {
1266
+ const packageJson = JSON.parse(file);
1267
+ if (packageJson.name) {
1268
+ name = packageJson.name;
1269
+ }
1270
+ if (packageJson.namespace) {
1271
+ namespace = packageJson.namespace;
1272
+ }
1273
+ if (packageJson.repository) {
1274
+ if (typeof packageJson.repository === "string") {
1275
+ repository = packageJson.repository;
1276
+ } else if (packageJson.repository.url) {
1277
+ repository = packageJson.repository.url;
1278
+ }
1279
+ }
1280
+ if (packageJson.license) {
1281
+ license = packageJson.license;
1282
+ }
1283
+ if (packageJson.homepage) {
1284
+ homepage = packageJson.homepage;
1285
+ }
1286
+ if (packageJson.bugs) {
1287
+ if (typeof packageJson.bugs === "string") {
1288
+ support = packageJson.bugs;
1289
+ } else if (packageJson.bugs.url) {
1290
+ support = packageJson.bugs.url;
1291
+ }
1292
+ }
1293
+ }
1294
+ }
1295
+ return {
1296
+ workspaceRoot,
1297
+ name,
1298
+ namespace,
1299
+ repository,
1300
+ license,
1301
+ homepage,
1302
+ support
1303
+ };
1304
+ }
1305
+ function applyDefaultConfig(config) {
1306
+ if (!config.support && config.contact) {
1307
+ config.support = config.contact;
1308
+ }
1309
+ if (!config.contact && config.support) {
1310
+ config.contact = config.support;
1311
+ }
1312
+ if (config.homepage) {
1313
+ if (!config.docs) {
1314
+ config.docs = `${config.homepage}/docs`;
1315
+ }
1316
+ if (!config.license) {
1317
+ config.license = `${config.homepage}/license`;
1318
+ }
1319
+ if (!config.support) {
1320
+ config.support = `${config.homepage}/support`;
1321
+ }
1322
+ if (!config.contact) {
1323
+ config.contact = `${config.homepage}/contact`;
1324
+ }
1325
+ if (!config.error?.codesFile || !config?.error?.url) {
1326
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
1327
+ if (config.homepage) {
1328
+ config.error.url ??= `${config.homepage}/errors`;
1329
+ }
1330
+ }
1331
+ }
1332
+ return config;
1333
+ }
1334
+
1335
+ // ../config-tools/src/utilities/process-handler.ts
1336
+ var exitWithError = (config) => {
1337
+ writeFatal("Exiting script with an error status...", config);
1338
+ process.exit(1);
1339
+ };
1340
+ var exitWithSuccess = (config) => {
1341
+ writeSuccess("Script completed successfully. Exiting...", config);
1342
+ process.exit(0);
1343
+ };
1344
+ var handleProcess = (config) => {
1345
+ writeTrace(
1346
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
1347
+ config
1348
+ );
1349
+ process.on("unhandledRejection", (error) => {
1350
+ writeError(
1351
+ `An Unhandled Rejection occurred while running the program: ${error}`,
1352
+ config
1353
+ );
1354
+ exitWithError(config);
1355
+ });
1356
+ process.on("uncaughtException", (error) => {
1357
+ writeError(
1358
+ `An Uncaught Exception occurred while running the program: ${error.message}
1359
+ Stacktrace: ${error.stack}`,
1360
+ config
1361
+ );
1362
+ exitWithError(config);
1363
+ });
1364
+ process.on("SIGTERM", (signal) => {
1365
+ writeError(`The program terminated with signal code: ${signal}`, config);
1366
+ exitWithError(config);
1367
+ });
1368
+ process.on("SIGINT", (signal) => {
1369
+ writeError(`The program terminated with signal code: ${signal}`, config);
1370
+ exitWithError(config);
1371
+ });
1372
+ process.on("SIGHUP", (signal) => {
1373
+ writeError(`The program terminated with signal code: ${signal}`, config);
1374
+ exitWithError(config);
1375
+ });
1376
+ };
1377
+
1378
+ // ../config-tools/src/config-file/get-config-file.ts
1379
+ var getConfigFileByName = async (fileName, filePath, options = {}) => {
1380
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
1381
+ const configs = await Promise.all([
1382
+ (0, import_c12.loadConfig)({
1383
+ cwd: workspacePath,
1384
+ packageJson: true,
1385
+ name: fileName,
1386
+ envName: fileName?.toUpperCase(),
1387
+ jitiOptions: {
1388
+ debug: false,
1389
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
1390
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
1391
+ "jiti"
1392
+ )
1393
+ },
1394
+ ...options
1395
+ }),
1396
+ (0, import_c12.loadConfig)({
1397
+ cwd: workspacePath,
1398
+ packageJson: true,
1399
+ name: fileName,
1400
+ envName: fileName?.toUpperCase(),
1401
+ jitiOptions: {
1402
+ debug: false,
1403
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
1404
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
1405
+ "jiti"
1406
+ )
1407
+ },
1408
+ configFile: fileName,
1409
+ ...options
1410
+ })
1411
+ ]);
1412
+ return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
1413
+ };
1414
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
1415
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
1416
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
1417
+ let config = result.config;
1418
+ const configFile = result.configFile;
1419
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
1420
+ writeTrace(
1421
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
1422
+ {
1423
+ logLevel: "all"
1424
+ }
1425
+ );
1426
+ }
1427
+ if (additionalFileNames && additionalFileNames.length > 0) {
1428
+ const results = await Promise.all(
1429
+ additionalFileNames.map(
1430
+ (fileName) => getConfigFileByName(fileName, workspacePath)
1431
+ )
1432
+ );
1433
+ for (const result2 of results) {
1434
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
1435
+ if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
1436
+ writeTrace(
1437
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
1438
+ {
1439
+ logLevel: "all"
1440
+ }
1441
+ );
1442
+ }
1443
+ config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
1444
+ }
1445
+ }
1446
+ }
1447
+ if (!config || Object.keys(config).length === 0) {
1448
+ return void 0;
1449
+ }
1450
+ config.configFile = configFile;
1451
+ return config;
1452
+ };
1453
+
1454
+ // ../config-tools/src/env/get-env.ts
1455
+ var getExtensionEnv = (extensionName) => {
1456
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
1457
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
1458
+ const name = key.replace(prefix, "").split("_").map(
1459
+ (i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
1460
+ ).join("");
1461
+ if (name) {
1462
+ ret[name] = process.env[key];
1463
+ }
1464
+ return ret;
1465
+ }, {});
1466
+ };
1467
+ var getConfigEnv = () => {
1468
+ const prefix = "STORM_";
1469
+ let config = {
1470
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
1471
+ name: process.env[`${prefix}NAME`] || void 0,
1472
+ variant: process.env[`${prefix}VARIANT`] || void 0,
1473
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
1474
+ owner: process.env[`${prefix}OWNER`] || void 0,
1475
+ bot: {
1476
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
1477
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
1478
+ },
1479
+ release: {
1480
+ banner: {
1481
+ url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
1482
+ alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
1483
+ },
1484
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
1485
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
1486
+ },
1487
+ error: {
1488
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
1489
+ url: process.env[`${prefix}ERROR_URL`] || void 0
1490
+ },
1491
+ socials: {
1492
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
1493
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
1494
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
1495
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
1496
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
1497
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
1498
+ },
1499
+ organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
1500
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
1501
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
1502
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
1503
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
1504
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
1505
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
1506
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
1507
+ license: process.env[`${prefix}LICENSE`] || void 0,
1508
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
1509
+ docs: process.env[`${prefix}DOCS`] || void 0,
1510
+ portal: process.env[`${prefix}PORTAL`] || void 0,
1511
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
1512
+ contact: process.env[`${prefix}CONTACT`] || void 0,
1513
+ support: process.env[`${prefix}SUPPORT`] || void 0,
1514
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
1515
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
1516
+ configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
1517
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
1518
+ directories: {
1519
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
1520
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
1521
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
1522
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
1523
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
1524
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
1525
+ },
1526
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
1527
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
1528
+ // ci:
1529
+ // process.env[`${prefix}CI`] !== undefined
1530
+ // ? Boolean(
1531
+ // process.env[`${prefix}CI`] ??
1532
+ // process.env.CI ??
1533
+ // process.env.CONTINUOUS_INTEGRATION
1534
+ // )
1535
+ // : undefined,
1536
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
1537
+ branch: process.env[`${prefix}BRANCH`] || void 0,
1538
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
1539
+ registry: {
1540
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
1541
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
1542
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
1543
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
1544
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
1545
+ },
1546
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
1547
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1548
+ ) ? getLogLevelLabel(
1549
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1550
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
1551
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
1552
+ };
1553
+ const themeNames = Object.keys(process.env).filter(
1554
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
1555
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
1556
+ )
1557
+ );
1558
+ config.colors = themeNames.length > 0 ? themeNames.reduce(
1559
+ (ret, themeName) => {
1560
+ ret[themeName] = getThemeColorsEnv(prefix, themeName);
1561
+ return ret;
1562
+ },
1563
+ {}
1564
+ ) : getThemeColorsEnv(prefix);
1565
+ if (config.docs === STORM_DEFAULT_DOCS) {
1566
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1567
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
1568
+ } else {
1569
+ config.docs = `${config.homepage}/docs`;
1570
+ }
1571
+ }
1572
+ if (config.licensing === STORM_DEFAULT_LICENSING) {
1573
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1574
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
1575
+ } else {
1576
+ config.licensing = `${config.homepage}/docs`;
1577
+ }
1578
+ }
1579
+ const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
1580
+ if (serializedConfig) {
1581
+ const parsed = JSON.parse(serializedConfig);
1582
+ config = {
1583
+ ...config,
1584
+ ...parsed,
1585
+ colors: { ...config.colors, ...parsed.colors },
1586
+ extensions: { ...config.extensions, ...parsed.extensions }
1587
+ };
1588
+ }
1589
+ return config;
1590
+ };
1591
+ var getThemeColorsEnv = (prefix, theme) => {
1592
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
1593
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
1594
+ };
1595
+ var getSingleThemeColorsEnv = (prefix) => {
1596
+ const gradient = [];
1597
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1598
+ gradient.push(
1599
+ process.env[`${prefix}GRADIENT_START`],
1600
+ process.env[`${prefix}GRADIENT_END`]
1601
+ );
1602
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1603
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1604
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1605
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1606
+ index++;
1607
+ }
1608
+ }
1609
+ return {
1610
+ dark: process.env[`${prefix}DARK`],
1611
+ light: process.env[`${prefix}LIGHT`],
1612
+ brand: process.env[`${prefix}BRAND`],
1613
+ alternate: process.env[`${prefix}ALTERNATE`],
1614
+ accent: process.env[`${prefix}ACCENT`],
1615
+ link: process.env[`${prefix}LINK`],
1616
+ discovery: process.env[`${prefix}DISCOVERY`],
1617
+ success: process.env[`${prefix}SUCCESS`],
1618
+ info: process.env[`${prefix}INFO`],
1619
+ debug: process.env[`${prefix}DEBUG`],
1620
+ warning: process.env[`${prefix}WARNING`],
1621
+ danger: process.env[`${prefix}DANGER`],
1622
+ fatal: process.env[`${prefix}FATAL`],
1623
+ performance: process.env[`${prefix}PERFORMANCE`],
1624
+ positive: process.env[`${prefix}POSITIVE`],
1625
+ negative: process.env[`${prefix}NEGATIVE`],
1626
+ gradient
1627
+ };
1628
+ };
1629
+ var getMultiThemeColorsEnv = (prefix) => {
1630
+ return {
1631
+ light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
1632
+ dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
1633
+ };
1634
+ };
1635
+ var getBaseThemeColorsEnv = (prefix) => {
1636
+ const gradient = [];
1637
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1638
+ gradient.push(
1639
+ process.env[`${prefix}GRADIENT_START`],
1640
+ process.env[`${prefix}GRADIENT_END`]
1641
+ );
1642
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1643
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1644
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1645
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1646
+ index++;
1647
+ }
1648
+ }
1649
+ return {
1650
+ foreground: process.env[`${prefix}FOREGROUND`],
1651
+ background: process.env[`${prefix}BACKGROUND`],
1652
+ brand: process.env[`${prefix}BRAND`],
1653
+ alternate: process.env[`${prefix}ALTERNATE`],
1654
+ accent: process.env[`${prefix}ACCENT`],
1655
+ link: process.env[`${prefix}LINK`],
1656
+ discovery: process.env[`${prefix}DISCOVERY`],
1657
+ success: process.env[`${prefix}SUCCESS`],
1658
+ info: process.env[`${prefix}INFO`],
1659
+ debug: process.env[`${prefix}DEBUG`],
1660
+ warning: process.env[`${prefix}WARNING`],
1661
+ danger: process.env[`${prefix}DANGER`],
1662
+ fatal: process.env[`${prefix}FATAL`],
1663
+ performance: process.env[`${prefix}PERFORMANCE`],
1664
+ positive: process.env[`${prefix}POSITIVE`],
1665
+ negative: process.env[`${prefix}NEGATIVE`],
1666
+ gradient
1667
+ };
1668
+ };
1669
+
1670
+ // ../config-tools/src/env/set-env.ts
1671
+ var setExtensionEnv = (extensionName, extension) => {
1672
+ for (const key of Object.keys(extension ?? {})) {
1673
+ if (extension[key]) {
1674
+ const result = key?.replace(
1675
+ /([A-Z])+/g,
1676
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
1677
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
1678
+ let extensionKey;
1679
+ if (result.length === 0) {
1680
+ return;
1681
+ }
1682
+ if (result.length === 1) {
1683
+ extensionKey = result[0]?.toUpperCase() ?? "";
1684
+ } else {
1685
+ extensionKey = result.reduce((ret, part) => {
1686
+ return `${ret}_${part.toLowerCase()}`;
1687
+ });
1688
+ }
1689
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
1690
+ }
1691
+ }
1692
+ };
1693
+ var setConfigEnv = (config) => {
1694
+ const prefix = "STORM_";
1695
+ if (config.extends) {
1696
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
1697
+ }
1698
+ if (config.name) {
1699
+ process.env[`${prefix}NAME`] = config.name;
1700
+ }
1701
+ if (config.variant) {
1702
+ process.env[`${prefix}VARIANT`] = config.variant;
1703
+ }
1704
+ if (config.namespace) {
1705
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
1706
+ }
1707
+ if (config.owner) {
1708
+ process.env[`${prefix}OWNER`] = config.owner;
1709
+ }
1710
+ if (config.bot) {
1711
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
1712
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
1713
+ }
1714
+ if (config.error) {
1715
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
1716
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
1717
+ }
1718
+ if (config.release) {
1719
+ if (config.release.banner) {
1720
+ if (typeof config.release.banner === "string") {
1721
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
1722
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
1723
+ } else {
1724
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
1725
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
1726
+ process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
1727
+ }
1728
+ }
1729
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
1730
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
1731
+ }
1732
+ if (config.socials) {
1733
+ if (config.socials.twitter) {
1734
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
1735
+ }
1736
+ if (config.socials.discord) {
1737
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
1738
+ }
1739
+ if (config.socials.telegram) {
1740
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
1741
+ }
1742
+ if (config.socials.slack) {
1743
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
1744
+ }
1745
+ if (config.socials.medium) {
1746
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
1747
+ }
1748
+ if (config.socials.github) {
1749
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
1750
+ }
1751
+ }
1752
+ if (config.organization) {
1753
+ if (typeof config.organization === "string") {
1754
+ process.env[`${prefix}ORG`] = config.organization;
1755
+ process.env[`${prefix}ORG_NAME`] = config.organization;
1756
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
1757
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
1758
+ } else {
1759
+ process.env[`${prefix}ORG`] = config.organization.name;
1760
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
1761
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
1762
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
1763
+ if (config.organization.url) {
1764
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
1765
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1766
+ }
1767
+ if (config.organization.description) {
1768
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1769
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1770
+ }
1771
+ if (config.organization.logo) {
1772
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1773
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1774
+ }
1775
+ if (config.organization.icon) {
1776
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1777
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1778
+ }
1779
+ }
1780
+ }
1781
+ if (config.packageManager) {
1782
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1783
+ }
1784
+ if (config.license) {
1785
+ process.env[`${prefix}LICENSE`] = config.license;
1786
+ }
1787
+ if (config.homepage) {
1788
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
1789
+ }
1790
+ if (config.docs) {
1791
+ process.env[`${prefix}DOCS`] = config.docs;
1792
+ }
1793
+ if (config.portal) {
1794
+ process.env[`${prefix}PORTAL`] = config.portal;
1795
+ }
1796
+ if (config.licensing) {
1797
+ process.env[`${prefix}LICENSING`] = config.licensing;
1798
+ }
1799
+ if (config.contact) {
1800
+ process.env[`${prefix}CONTACT`] = config.contact;
1801
+ }
1802
+ if (config.support) {
1803
+ process.env[`${prefix}SUPPORT`] = config.support;
1804
+ }
1805
+ if (config.timezone) {
1806
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
1807
+ process.env.TZ = config.timezone;
1808
+ process.env.DEFAULT_TIMEZONE = config.timezone;
1809
+ process.env.TIMEZONE = config.timezone;
1810
+ }
1811
+ if (config.locale) {
1812
+ process.env[`${prefix}LOCALE`] = config.locale;
1813
+ process.env.DEFAULT_LOCALE = config.locale;
1814
+ process.env.LOCALE = config.locale;
1815
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1816
+ }
1817
+ if (config.configFile) {
1818
+ process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(
1819
+ config.configFile
1820
+ );
1821
+ }
1822
+ if (config.workspaceRoot) {
1823
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1824
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1825
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1826
+ }
1827
+ if (config.directories) {
1828
+ if (!config.skipCache && config.directories.cache) {
1829
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
1830
+ config.directories.cache
1831
+ );
1832
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1833
+ }
1834
+ if (config.directories.data) {
1835
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1836
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1837
+ }
1838
+ if (config.directories.config) {
1839
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
1840
+ config.directories.config
1841
+ );
1842
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1843
+ }
1844
+ if (config.directories.temp) {
1845
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1846
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1847
+ }
1848
+ if (config.directories.log) {
1849
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1850
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1851
+ }
1852
+ if (config.directories.build) {
1853
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
1854
+ config.directories.build
1855
+ );
1856
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1857
+ }
1858
+ }
1859
+ if (config.skipCache !== void 0) {
1860
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1861
+ if (config.skipCache) {
1862
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1863
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1864
+ }
1865
+ }
1866
+ if (config.mode) {
1867
+ process.env[`${prefix}MODE`] = config.mode;
1868
+ process.env.NODE_ENV = config.mode;
1869
+ process.env.ENVIRONMENT = config.mode;
1870
+ }
1871
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
1872
+ for (const key of Object.keys(config.colors)) {
1873
+ setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1874
+ }
1875
+ } else {
1876
+ setThemeColorsEnv(
1877
+ `${prefix}COLOR_`,
1878
+ config.colors
1879
+ );
1880
+ }
1881
+ if (config.repository) {
1882
+ process.env[`${prefix}REPOSITORY`] = config.repository;
1883
+ }
1884
+ if (config.branch) {
1885
+ process.env[`${prefix}BRANCH`] = config.branch;
1886
+ }
1887
+ if (config.preid) {
1888
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
1889
+ }
1890
+ if (config.registry) {
1891
+ if (config.registry.github) {
1892
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1893
+ }
1894
+ if (config.registry.npm) {
1895
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1896
+ }
1897
+ if (config.registry.cargo) {
1898
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1899
+ }
1900
+ if (config.registry.cyclone) {
1901
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
1902
+ config.registry.cyclone
1903
+ );
1904
+ }
1905
+ if (config.registry.container) {
1906
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
1907
+ config.registry.container
1908
+ );
1909
+ }
1910
+ }
1911
+ if (config.logLevel) {
1912
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1913
+ process.env.LOG_LEVEL = String(config.logLevel);
1914
+ process.env.NX_VERBOSE_LOGGING = String(
1915
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
1916
+ );
1917
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1918
+ }
1919
+ if (config.skipConfigLogging !== void 0) {
1920
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
1921
+ config.skipConfigLogging
1922
+ );
1923
+ }
1924
+ process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
1925
+ for (const key of Object.keys(config.extensions ?? {})) {
1926
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
1927
+ setExtensionEnv(key, config.extensions[key]);
1928
+ }
1929
+ }
1930
+ };
1931
+ var setThemeColorsEnv = (prefix, config) => {
1932
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
1933
+ };
1934
+ var setSingleThemeColorsEnv = (prefix, config) => {
1935
+ if (config.dark) {
1936
+ process.env[`${prefix}DARK`] = config.dark;
1937
+ }
1938
+ if (config.light) {
1939
+ process.env[`${prefix}LIGHT`] = config.light;
1940
+ }
1941
+ if (config.brand) {
1942
+ process.env[`${prefix}BRAND`] = config.brand;
1943
+ }
1944
+ if (config.alternate) {
1945
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1946
+ }
1947
+ if (config.accent) {
1948
+ process.env[`${prefix}ACCENT`] = config.accent;
1949
+ }
1950
+ if (config.link) {
1951
+ process.env[`${prefix}LINK`] = config.link;
1952
+ }
1953
+ if (config.discovery) {
1954
+ process.env[`${prefix}DISCOVERY`] = config.discovery;
1955
+ }
1956
+ if (config.success) {
1957
+ process.env[`${prefix}SUCCESS`] = config.success;
1958
+ }
1959
+ if (config.info) {
1960
+ process.env[`${prefix}INFO`] = config.info;
1961
+ }
1962
+ if (config.debug) {
1963
+ process.env[`${prefix}DEBUG`] = config.debug;
1964
+ }
1965
+ if (config.warning) {
1966
+ process.env[`${prefix}WARNING`] = config.warning;
1967
+ }
1968
+ if (config.danger) {
1969
+ process.env[`${prefix}DANGER`] = config.danger;
1970
+ }
1971
+ if (config.fatal) {
1972
+ process.env[`${prefix}FATAL`] = config.fatal;
1973
+ }
1974
+ if (config.performance) {
1975
+ process.env[`${prefix}PERFORMANCE`] = config.performance;
1976
+ }
1977
+ if (config.positive) {
1978
+ process.env[`${prefix}POSITIVE`] = config.positive;
1979
+ }
1980
+ if (config.negative) {
1981
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1982
+ }
1983
+ if (config.gradient) {
1984
+ for (let i = 0; i < config.gradient.length; i++) {
1985
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1986
+ }
1987
+ }
1988
+ };
1989
+ var setMultiThemeColorsEnv = (prefix, config) => {
1990
+ return {
1991
+ light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
1992
+ dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
1993
+ };
1994
+ };
1995
+ var setBaseThemeColorsEnv = (prefix, config) => {
1996
+ if (config.foreground) {
1997
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
1998
+ }
1999
+ if (config.background) {
2000
+ process.env[`${prefix}BACKGROUND`] = config.background;
2001
+ }
2002
+ if (config.brand) {
2003
+ process.env[`${prefix}BRAND`] = config.brand;
2004
+ }
2005
+ if (config.alternate) {
2006
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
2007
+ }
2008
+ if (config.accent) {
2009
+ process.env[`${prefix}ACCENT`] = config.accent;
2010
+ }
2011
+ if (config.link) {
2012
+ process.env[`${prefix}LINK`] = config.link;
2013
+ }
2014
+ if (config.discovery) {
2015
+ process.env[`${prefix}DISCOVERY`] = config.discovery;
2016
+ }
2017
+ if (config.success) {
2018
+ process.env[`${prefix}SUCCESS`] = config.success;
2019
+ }
2020
+ if (config.info) {
2021
+ process.env[`${prefix}INFO`] = config.info;
2022
+ }
2023
+ if (config.debug) {
2024
+ process.env[`${prefix}DEBUG`] = config.debug;
2025
+ }
2026
+ if (config.warning) {
2027
+ process.env[`${prefix}WARNING`] = config.warning;
2028
+ }
2029
+ if (config.danger) {
2030
+ process.env[`${prefix}DANGER`] = config.danger;
2031
+ }
2032
+ if (config.fatal) {
2033
+ process.env[`${prefix}FATAL`] = config.fatal;
2034
+ }
2035
+ if (config.performance) {
2036
+ process.env[`${prefix}PERFORMANCE`] = config.performance;
2037
+ }
2038
+ if (config.positive) {
2039
+ process.env[`${prefix}POSITIVE`] = config.positive;
2040
+ }
2041
+ if (config.negative) {
2042
+ process.env[`${prefix}NEGATIVE`] = config.negative;
2043
+ }
2044
+ if (config.gradient) {
2045
+ for (let i = 0; i < config.gradient.length; i++) {
2046
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
2047
+ }
2048
+ }
2049
+ };
2050
+
2051
+ // ../config-tools/src/create-storm-config.ts
2052
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
2053
+ var _static_cache = void 0;
2054
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
2055
+ let result;
2056
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
2057
+ let _workspaceRoot = workspaceRoot;
2058
+ if (!_workspaceRoot) {
2059
+ _workspaceRoot = findWorkspaceRoot();
2060
+ }
2061
+ const configEnv = getConfigEnv();
2062
+ const configFile = await getConfigFile(_workspaceRoot);
2063
+ if (!configFile) {
2064
+ if (!skipLogs) {
2065
+ writeWarning(
2066
+ "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
2067
+ { logLevel: "all" }
2068
+ );
2069
+ }
2070
+ if (useDefault === false) {
2071
+ return void 0;
2072
+ }
2073
+ }
2074
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
2075
+ const configInput = (0, import_defu2.default)(
2076
+ configEnv,
2077
+ configFile,
2078
+ defaultConfig
2079
+ );
2080
+ if (!configInput.variant) {
2081
+ configInput.variant = (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, "nx.json")) || (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, ".nx")) || (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, "lerna.json")) || (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
2082
+ }
2083
+ try {
2084
+ const parseResult = await Promise.resolve(
2085
+ workspaceConfigSchema._zod.parse(
2086
+ { value: configInput, issues: [] },
2087
+ { async: true }
2088
+ )
2089
+ );
2090
+ result = applyDefaultConfig(parseResult.value);
2091
+ result.workspaceRoot ??= _workspaceRoot;
2092
+ } catch (error) {
2093
+ throw new Error(
2094
+ `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
2095
+
2096
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
2097
+ configInput
2098
+ )}`,
2099
+ {
2100
+ cause: error
2101
+ }
2102
+ );
2103
+ }
2104
+ } else {
2105
+ result = _static_cache.data;
2106
+ }
2107
+ if (schema && extensionName) {
2108
+ result.extensions = {
2109
+ ...result.extensions,
2110
+ [extensionName]: createConfigExtension(extensionName, schema)
2111
+ };
2112
+ }
2113
+ _static_cache = {
2114
+ timestamp: Date.now(),
2115
+ data: result
2116
+ };
2117
+ return result;
2118
+ };
2119
+ var createConfigExtension = (extensionName, schema) => {
2120
+ const extension_cache_key = { extensionName };
2121
+ if (_extension_cache.has(extension_cache_key)) {
2122
+ return _extension_cache.get(extension_cache_key);
2123
+ }
2124
+ let extension = getExtensionEnv(extensionName);
2125
+ if (schema) {
2126
+ extension = schema.parse(extension);
2127
+ }
2128
+ _extension_cache.set(extension_cache_key, extension);
2129
+ return extension;
2130
+ };
2131
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
2132
+ const config = await createStormWorkspaceConfig(
2133
+ void 0,
2134
+ void 0,
2135
+ workspaceRoot,
2136
+ skipLogs,
2137
+ true
2138
+ );
2139
+ setConfigEnv(config);
2140
+ if (!skipLogs && !config.skipConfigLogging) {
2141
+ writeTrace(
2142
+ `\u2699\uFE0F Using Storm Workspace configuration:
2143
+ ${formatLogMessage(config)}`,
2144
+ config
2145
+ );
2146
+ }
2147
+ return config;
2148
+ };
2149
+
2150
+ // ../config-tools/src/get-config.ts
2151
+ function getConfig(workspaceRoot, skipLogs = false) {
2152
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
2153
+ }
2154
+
2155
+ // bin/untyped.ts
2156
+ var import_commander = require("commander");
2157
+
2158
+ // src/generate.ts
2159
+ var import_glob = require("glob");
2160
+ var import_loader = require("untyped/loader");
2161
+
2162
+ // src/generators/dts.ts
2163
+ var import_promises2 = require("fs/promises");
2164
+ var import_untyped = require("untyped");
2165
+
2166
+ // src/utilities.ts
2167
+ var getOutputFile = (file, extension) => {
2168
+ let fileName = file.name.slice(0, file.name.lastIndexOf(".")).replace(".untyped", "").replace("untyped", "").replace(".schema", "").replace("schema", "");
2169
+ if (!fileName) {
2170
+ fileName = "schema";
2171
+ }
2172
+ if (fileName !== "schema") {
2173
+ fileName = `${fileName}.schema`;
2174
+ }
2175
+ return joinPaths(file.parentPath, `${fileName}.${extension}`);
2176
+ };
2177
+
2178
+ // src/generators/dts.ts
2179
+ function generateDeclaration(schema, generatedBy = "@storm-software/untyped") {
2180
+ return `
2181
+ // Generated by ${generatedBy}
2182
+ // Do not edit this file directly
2183
+
2184
+ ${(0, import_untyped.generateTypes)(schema, {
2185
+ addExport: true,
2186
+ partial: true,
2187
+ interfaceName: `${schema.title?.replaceAll(" ", "") || "Type"}Schema`
2188
+ })}
2189
+
2190
+ `;
2191
+ }
2192
+ function generateDeclarationFile(schema, file, generatedBy = "@storm-software/untyped", config) {
2193
+ try {
2194
+ const declarations = getOutputFile(file, "d.ts");
2195
+ writeTrace(`Writing type declaration file ${declarations}`, config);
2196
+ return (0, import_promises2.writeFile)(declarations, generateDeclaration(schema, generatedBy));
2197
+ } catch (error) {
2198
+ writeError(
2199
+ `Error writing declaration file for ${file.name}
2200
+
2201
+ Error:
2202
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
2203
+ Stack Trace: ${error.stack}` : ""}
2204
+
2205
+ Parsed schema:
2206
+ ${JSON.stringify(schema)}
2207
+ `,
2208
+ config
2209
+ );
2210
+ throw error;
2211
+ }
2212
+ }
2213
+
2214
+ // src/generators/json-schema.ts
2215
+ var import_promises3 = require("fs/promises");
2216
+ function generateJsonSchemaFile(schema, file, config) {
2217
+ try {
2218
+ const jsonSchema = getOutputFile(file, "json");
2219
+ writeTrace(`Writing JSON schema file ${jsonSchema}`, config);
2220
+ return (0, import_promises3.writeFile)(jsonSchema, JSON.stringify(schema, null, 2));
2221
+ } catch (error) {
2222
+ writeError(
2223
+ `Error writing JSON schema file for ${file.name}
2224
+
2225
+ Error:
2226
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
2227
+ Stack Trace: ${error.stack}` : ""}
2228
+
2229
+ Parsed schema:
2230
+ ${JSON.stringify(schema)}
2231
+ `,
2232
+ config
2233
+ );
2234
+ throw error;
2235
+ }
2236
+ }
2237
+
2238
+ // src/generators/markdown.ts
2239
+ var import_promises4 = require("fs/promises");
2240
+ function generateMarkdown(schema, generatedBy = "@storm-software/untyped") {
2241
+ return `
2242
+ <!-- Generated by ${generatedBy} -->
2243
+ <!-- Do not edit this file directly -->
2244
+
2245
+ ${generateMarkdownLevel(schema, schema.title || "", "#").join("\n")}
2246
+
2247
+ `;
2248
+ }
2249
+ function generateMarkdownLevel(schema, title, level) {
2250
+ const lines = [];
2251
+ lines.push(`${level} ${title}`);
2252
+ if (schema.type === "object") {
2253
+ for (const key in schema.properties) {
2254
+ const val = schema.properties[key];
2255
+ lines.push("", ...generateMarkdownLevel(val, `\`${key}\``, level + "#"));
2256
+ }
2257
+ return lines;
2258
+ }
2259
+ lines.push(
2260
+ `- **Type**: \`${schema.markdownType || schema.tsType || schema.type}\``
2261
+ );
2262
+ if ("default" in schema) {
2263
+ lines.push(`- **Default**: \`${JSON.stringify(schema.default)}\``);
2264
+ }
2265
+ lines.push("");
2266
+ if (schema.title) {
2267
+ lines.push("> " + schema.title, "");
2268
+ }
2269
+ if (schema.description) {
2270
+ lines.push("", schema.description, "");
2271
+ }
2272
+ return lines;
2273
+ }
2274
+ function generateMarkdownFile(schema, file, generatedBy = "@storm-software/untyped", config) {
2275
+ try {
2276
+ const declarations = getOutputFile(file, "md");
2277
+ writeTrace(`Writing type markdown file ${declarations}`, config);
2278
+ return (0, import_promises4.writeFile)(declarations, generateMarkdown(schema, generatedBy));
2279
+ } catch (error) {
2280
+ writeError(
2281
+ `Error writing markdown file for ${file.name}
2282
+
2283
+ Error:
2284
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
2285
+ Stack Trace: ${error.stack}` : ""}
2286
+
2287
+ Parsed schema:
2288
+ ${JSON.stringify(schema)}
2289
+ `,
2290
+ config
2291
+ );
2292
+ throw error;
2293
+ }
2294
+ }
2295
+
2296
+ // src/generate.ts
2297
+ var getGenerateAction = (config) => async (options) => {
2298
+ writeTrace(
2299
+ `Running Storm Untyped with options: ${JSON.stringify(options)}`,
2300
+ config
2301
+ );
2302
+ const files = await (0, import_glob.glob)(options.entry || "**/{untyped.ts,*.untyped.ts}", {
2303
+ ignore: [
2304
+ "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}",
2305
+ "**/dist/**",
2306
+ "**/tmp/**",
2307
+ "**/node_modules/**",
2308
+ "**/.git/**",
2309
+ "**/.cache/**",
2310
+ "**/.nx/**"
2311
+ ],
2312
+ withFileTypes: true,
2313
+ cwd: config.workspaceRoot
2314
+ });
2315
+ await Promise.all(
2316
+ files.map(async (file) => {
2317
+ writeTrace(
2318
+ `Generating files for schema file: ${joinPaths(file.parentPath, file.name)}`,
2319
+ config
2320
+ );
2321
+ let schema;
2322
+ try {
2323
+ schema = await (0, import_loader.loadSchema)(joinPaths(file.parentPath, file.name), {
2324
+ jiti: {
2325
+ fsCache: config.skipCache ? false : joinPaths(
2326
+ config.directories.cache || joinPaths(
2327
+ config.workspaceRoot,
2328
+ "node_modules/.cache/storm"
2329
+ ),
2330
+ "jiti"
2331
+ ),
2332
+ interopDefault: true
2333
+ }
2334
+ });
2335
+ } catch (error) {
2336
+ writeError(
2337
+ `Error while parsing schema file: ${joinPaths(file.parentPath, file.name)}
2338
+
2339
+ Error:
2340
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
2341
+ Stack Trace: ${error.stack}` : ""}
2342
+
2343
+ Parsed schema:
2344
+ ${JSON.stringify(schema)}
2345
+ `,
2346
+ config
2347
+ );
2348
+ throw error;
2349
+ }
2350
+ const promises = [];
2351
+ promises.push(
2352
+ generateDeclarationFile(schema, file, options.generatedBy, config)
2353
+ );
2354
+ promises.push(
2355
+ generateMarkdownFile(schema, file, options.generatedBy, config)
2356
+ );
2357
+ promises.push(generateJsonSchemaFile(schema, file, config));
2358
+ return Promise.all(promises);
2359
+ })
2360
+ );
2361
+ };
2362
+
2363
+ // bin/untyped.ts
2364
+ async function createProgram(config) {
2365
+ try {
2366
+ writeInfo(
2367
+ `${brandIcon(config)} Running Storm Untyped codegen utility`,
2368
+ config
2369
+ );
2370
+ const root = findWorkspaceRootSafe();
2371
+ process.env.STORM_WORKSPACE_ROOT ??= root;
2372
+ process.env.NX_WORKSPACE_ROOT_PATH ??= root;
2373
+ if (root) {
2374
+ process.chdir(root);
2375
+ }
2376
+ const program = new import_commander.Command("storm-untyped");
2377
+ program.version("1.0.0", "-v --version", "display CLI version");
2378
+ program.description("Run the Storm untyped codegen utility").showHelpAfterError(true).showSuggestionAfterError();
2379
+ program.command("generate", { isDefault: true }).alias("bundle").description(
2380
+ "Run a TypeScript build using Untyped, API-Extractor, and TSC (for type generation)."
2381
+ ).option(
2382
+ "-e --entry <path>",
2383
+ "The path to the entry file to generate types for. This can be a file or a directory. Globs are supported."
2384
+ ).option(
2385
+ "-o --output-path <path>",
2386
+ "The path of the project's source folder to build"
2387
+ ).action(getGenerateAction(config));
2388
+ return program;
2389
+ } catch (e) {
2390
+ writeFatal(
2391
+ `A fatal error occurred while running the program: ${e.message}`,
2392
+ config
2393
+ );
2394
+ process.exit(1);
2395
+ }
2396
+ }
2397
+ void (async () => {
2398
+ const config = await getConfig();
2399
+ const stopwatch = getStopwatch("Storm Untyped executable");
2400
+ try {
2401
+ handleProcess(config);
2402
+ const program = await createProgram(config);
2403
+ await program.parseAsync(process.argv);
2404
+ writeSuccess(
2405
+ `\u2714 Storm Untyped executable has completed successfully!`,
2406
+ config
2407
+ );
2408
+ exitWithSuccess(config);
2409
+ } catch (error) {
2410
+ writeFatal(
2411
+ `A fatal error occurred while running Storm Untyped executable:
2412
+
2413
+ Error:
2414
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
2415
+ Stack Trace: ${error.stack}` : ""}
2416
+ `,
2417
+ config
2418
+ );
2419
+ exitWithError(config);
2420
+ process.exit(1);
2421
+ } finally {
2422
+ stopwatch();
2423
+ }
2424
+ })();