@storm-software/unbuild 0.17.1 → 0.17.2

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.
package/bin/unbuild.cjs CHANGED
@@ -23,42 +23,1346 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  mod
24
24
  ));
25
25
 
26
+ // ../config/src/schema.ts
27
+ var import_zod = __toESM(require("zod"));
28
+
29
+ // ../config/src/constants.ts
30
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
31
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
32
+ var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
33
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
34
+
35
+ // ../config/src/schema.ts
36
+ var DarkColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
37
+ var LightColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
38
+ var BrandColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
39
+ var AlternateColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
40
+ var AccentColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
41
+ var LinkColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
42
+ var HelpColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
43
+ var SuccessColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
44
+ var InfoColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
45
+ var WarningColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
46
+ var DangerColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
47
+ var FatalColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
48
+ var PositiveColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
49
+ var NegativeColorSchema = import_zod.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
50
+ var DarkThemeColorConfigSchema = import_zod.default.object({
51
+ foreground: LightColorSchema,
52
+ background: DarkColorSchema,
53
+ brand: BrandColorSchema,
54
+ alternate: AlternateColorSchema,
55
+ accent: AccentColorSchema,
56
+ link: LinkColorSchema,
57
+ help: HelpColorSchema,
58
+ success: SuccessColorSchema,
59
+ info: InfoColorSchema,
60
+ warning: WarningColorSchema,
61
+ danger: DangerColorSchema,
62
+ fatal: FatalColorSchema,
63
+ positive: PositiveColorSchema,
64
+ negative: NegativeColorSchema
65
+ });
66
+ var LightThemeColorConfigSchema = import_zod.default.object({
67
+ foreground: DarkColorSchema,
68
+ background: LightColorSchema,
69
+ brand: BrandColorSchema,
70
+ alternate: AlternateColorSchema,
71
+ accent: AccentColorSchema,
72
+ link: LinkColorSchema,
73
+ help: HelpColorSchema,
74
+ success: SuccessColorSchema,
75
+ info: InfoColorSchema,
76
+ warning: WarningColorSchema,
77
+ danger: DangerColorSchema,
78
+ fatal: FatalColorSchema,
79
+ positive: PositiveColorSchema,
80
+ negative: NegativeColorSchema
81
+ });
82
+ var MultiThemeColorConfigSchema = import_zod.default.object({
83
+ dark: DarkThemeColorConfigSchema,
84
+ light: LightThemeColorConfigSchema
85
+ });
86
+ var SingleThemeColorConfigSchema = import_zod.default.object({
87
+ dark: DarkColorSchema,
88
+ light: LightColorSchema,
89
+ brand: BrandColorSchema,
90
+ alternate: AlternateColorSchema,
91
+ accent: AccentColorSchema,
92
+ link: LinkColorSchema,
93
+ help: HelpColorSchema,
94
+ success: SuccessColorSchema,
95
+ info: InfoColorSchema,
96
+ warning: WarningColorSchema,
97
+ danger: DangerColorSchema,
98
+ fatal: FatalColorSchema,
99
+ positive: PositiveColorSchema,
100
+ negative: NegativeColorSchema
101
+ });
102
+ var RegistryUrlConfigSchema = import_zod.default.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
103
+ var RegistryConfigSchema = import_zod.default.object({
104
+ github: RegistryUrlConfigSchema,
105
+ npm: RegistryUrlConfigSchema,
106
+ cargo: RegistryUrlConfigSchema,
107
+ cyclone: RegistryUrlConfigSchema,
108
+ container: RegistryUrlConfigSchema
109
+ }).default({}).describe("A list of remote registry URLs used by Storm Software");
110
+ var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
111
+ var ColorConfigMapSchema = import_zod.default.union([
112
+ import_zod.default.object({
113
+ "base": ColorConfigSchema
114
+ }),
115
+ import_zod.default.record(import_zod.default.string(), ColorConfigSchema)
116
+ ]);
117
+ var WorkspaceBotConfigSchema = import_zod.default.object({
118
+ name: import_zod.default.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
119
+ email: import_zod.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
120
+ }).describe("The workspace's bot user's config used to automated various operations tasks");
121
+ var WorkspaceDirectoryConfigSchema = import_zod.default.object({
122
+ cache: import_zod.default.string().trim().optional().describe("The directory used to store the environment's cached file data"),
123
+ data: import_zod.default.string().trim().optional().describe("The directory used to store the environment's data files"),
124
+ config: import_zod.default.string().trim().optional().describe("The directory used to store the environment's configuration files"),
125
+ temp: import_zod.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
126
+ log: import_zod.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
127
+ build: import_zod.default.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
128
+ }).describe("Various directories used by the workspace to store data, cache, and configuration files");
129
+ var StormConfigSchema = import_zod.default.object({
130
+ $schema: import_zod.default.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
131
+ extends: import_zod.default.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
132
+ name: import_zod.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
133
+ namespace: import_zod.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
134
+ organization: import_zod.default.string().trim().default("storm-software").describe("The organization of the workspace"),
135
+ repository: import_zod.default.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
136
+ license: import_zod.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
137
+ homepage: import_zod.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
138
+ docs: import_zod.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
139
+ licensing: import_zod.default.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
140
+ branch: import_zod.default.string().trim().default("main").describe("The branch of the workspace"),
141
+ preid: import_zod.default.string().optional().describe("A tag specifying the version pre-release identifier"),
142
+ owner: import_zod.default.string().trim().default("@storm-software/admin").describe("The owner of the package"),
143
+ bot: WorkspaceBotConfigSchema,
144
+ env: import_zod.default.enum([
145
+ "development",
146
+ "staging",
147
+ "production"
148
+ ]).default("production").describe("The current runtime environment name for the package"),
149
+ workspaceRoot: import_zod.default.string().trim().default("").describe("The root directory of the workspace"),
150
+ externalPackagePatterns: import_zod.default.array(import_zod.default.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
151
+ skipCache: import_zod.default.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
152
+ directories: WorkspaceDirectoryConfigSchema,
153
+ packageManager: import_zod.default.enum([
154
+ "npm",
155
+ "yarn",
156
+ "pnpm",
157
+ "bun"
158
+ ]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
159
+ timezone: import_zod.default.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
160
+ locale: import_zod.default.string().trim().default("en-US").describe("The default locale of the workspace"),
161
+ logLevel: import_zod.default.enum([
162
+ "silent",
163
+ "fatal",
164
+ "error",
165
+ "warn",
166
+ "info",
167
+ "debug",
168
+ "trace",
169
+ "all"
170
+ ]).default("info").describe("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`)."),
171
+ registry: RegistryConfigSchema,
172
+ configFile: import_zod.default.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
173
+ colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
174
+ extensions: import_zod.default.record(import_zod.default.any()).optional().default({}).describe("Configuration of each used extension")
175
+ }).describe("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.");
176
+
177
+ // ../config-tools/src/create-storm-config.ts
178
+ var import_defu2 = __toESM(require("defu"));
179
+
180
+ // ../config-tools/src/config-file/get-config-file.ts
181
+ var import_c12 = require("c12");
182
+ var import_defu = __toESM(require("defu"));
183
+
184
+ // ../config-tools/src/types.ts
185
+ var LogLevel = {
186
+ SILENT: 0,
187
+ FATAL: 10,
188
+ ERROR: 20,
189
+ WARN: 30,
190
+ SUCCESS: 35,
191
+ INFO: 40,
192
+ DEBUG: 60,
193
+ TRACE: 70,
194
+ ALL: 100
195
+ };
196
+ var LogLevelLabel = {
197
+ SILENT: "silent",
198
+ FATAL: "fatal",
199
+ ERROR: "error",
200
+ WARN: "warn",
201
+ INFO: "info",
202
+ DEBUG: "debug",
203
+ TRACE: "trace",
204
+ ALL: "all"
205
+ };
206
+
207
+ // ../config/src/types.ts
208
+ var COLOR_KEYS = [
209
+ "dark",
210
+ "light",
211
+ "base",
212
+ "brand",
213
+ "alternate",
214
+ "accent",
215
+ "link",
216
+ "success",
217
+ "help",
218
+ "info",
219
+ "warning",
220
+ "danger",
221
+ "fatal",
222
+ "positive",
223
+ "negative"
224
+ ];
225
+
226
+ // ../config-tools/src/utilities/get-default-config.ts
227
+ var import_node_fs2 = require("fs");
228
+ var import_node_path2 = require("path");
229
+
230
+ // ../config-tools/src/utilities/correct-paths.ts
231
+ var import_devkit = require("@nx/devkit");
232
+ var correctPaths = /* @__PURE__ */ __name((path2) => {
233
+ if (!path2) {
234
+ return "";
235
+ }
236
+ if (!path2.toUpperCase().startsWith("C:") && path2.includes("\\")) {
237
+ path2 = `C:${path2}`;
238
+ }
239
+ return path2.replaceAll("\\", "/");
240
+ }, "correctPaths");
241
+ var joinPaths = /* @__PURE__ */ __name((...paths) => {
242
+ if (!paths || paths.length === 0) {
243
+ return "";
244
+ }
245
+ return correctPaths((0, import_devkit.joinPathFragments)(...paths.map((path2) => correctPaths(path2))));
246
+ }, "joinPaths");
247
+
248
+ // ../config-tools/src/utilities/find-up.ts
249
+ var import_node_fs = require("fs");
250
+ var import_node_path = require("path");
251
+ var MAX_PATH_SEARCH_DEPTH = 30;
252
+ var depth = 0;
253
+ function findFolderUp(startPath, endFileNames) {
254
+ const _startPath = startPath ?? process.cwd();
255
+ if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
256
+ return _startPath;
257
+ }
258
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
259
+ const parent = (0, import_node_path.join)(_startPath, "..");
260
+ return findFolderUp(parent, endFileNames);
261
+ }
262
+ return void 0;
263
+ }
264
+ __name(findFolderUp, "findFolderUp");
265
+
266
+ // ../config-tools/src/utilities/find-workspace-root.ts
267
+ var rootFiles = [
268
+ "storm.json",
269
+ "storm.json",
270
+ "storm.yaml",
271
+ "storm.yml",
272
+ "storm.js",
273
+ "storm.ts",
274
+ ".storm.json",
275
+ ".storm.yaml",
276
+ ".storm.yml",
277
+ ".storm.js",
278
+ ".storm.ts",
279
+ "lerna.json",
280
+ "nx.json",
281
+ "turbo.json",
282
+ "npm-workspace.json",
283
+ "yarn-workspace.json",
284
+ "pnpm-workspace.json",
285
+ "npm-workspace.yaml",
286
+ "yarn-workspace.yaml",
287
+ "pnpm-workspace.yaml",
288
+ "npm-workspace.yml",
289
+ "yarn-workspace.yml",
290
+ "pnpm-workspace.yml",
291
+ "npm-lock.json",
292
+ "yarn-lock.json",
293
+ "pnpm-lock.json",
294
+ "npm-lock.yaml",
295
+ "yarn-lock.yaml",
296
+ "pnpm-lock.yaml",
297
+ "npm-lock.yml",
298
+ "yarn-lock.yml",
299
+ "pnpm-lock.yml",
300
+ "bun.lockb"
301
+ ];
302
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
303
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
304
+ return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
305
+ }
306
+ return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles));
307
+ }
308
+ __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
309
+ function findWorkspaceRoot(pathInsideMonorepo) {
310
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
311
+ if (!result) {
312
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
313
+ ${rootFiles.join("\n")}
314
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
315
+ }
316
+ return result;
317
+ }
318
+ __name(findWorkspaceRoot, "findWorkspaceRoot");
319
+
320
+ // ../config-tools/src/utilities/get-default-config.ts
321
+ var DEFAULT_COLOR_CONFIG = {
322
+ "light": {
323
+ "background": "#fafafa",
324
+ "foreground": "#1d1e22",
325
+ "brand": "#1fb2a6",
326
+ "alternate": "#db2777",
327
+ "help": "#5C4EE5",
328
+ "success": "#087f5b",
329
+ "info": "#0550ae",
330
+ "warning": "#e3b341",
331
+ "danger": "#D8314A",
332
+ "positive": "#22c55e",
333
+ "negative": "#dc2626"
334
+ },
335
+ "dark": {
336
+ "background": "#1d1e22",
337
+ "foreground": "#cbd5e1",
338
+ "brand": "#2dd4bf",
339
+ "alternate": "#db2777",
340
+ "help": "#818cf8",
341
+ "success": "#10b981",
342
+ "info": "#58a6ff",
343
+ "warning": "#f3d371",
344
+ "danger": "#D8314A",
345
+ "positive": "#22c55e",
346
+ "negative": "#dc2626"
347
+ }
348
+ };
349
+ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
350
+ let license = STORM_DEFAULT_LICENSE;
351
+ let homepage = STORM_DEFAULT_HOMEPAGE;
352
+ let name;
353
+ let namespace;
354
+ let repository;
355
+ const workspaceRoot = findWorkspaceRoot(root);
356
+ if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
357
+ const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
358
+ encoding: "utf8"
359
+ });
360
+ if (file) {
361
+ const packageJson = JSON.parse(file);
362
+ if (packageJson.name) {
363
+ name = packageJson.name;
364
+ }
365
+ if (packageJson.namespace) {
366
+ namespace = packageJson.namespace;
367
+ }
368
+ if (packageJson.repository?.url) {
369
+ repository = packageJson.repository?.url;
370
+ }
371
+ if (packageJson.license) {
372
+ license = packageJson.license;
373
+ }
374
+ if (packageJson.homepage) {
375
+ homepage = packageJson.homepage;
376
+ }
377
+ }
378
+ }
379
+ return {
380
+ workspaceRoot,
381
+ name,
382
+ namespace,
383
+ repository,
384
+ license,
385
+ homepage,
386
+ docs: `${homepage || STORM_DEFAULT_HOMEPAGE}/docs`,
387
+ licensing: `${homepage || STORM_DEFAULT_HOMEPAGE}/license`
388
+ };
389
+ }, "getDefaultConfig");
390
+
391
+ // ../config-tools/src/logger/chalk.ts
392
+ var import_chalk = __toESM(require("chalk"));
393
+ var chalkDefault = {
394
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
395
+ bgHex: /* @__PURE__ */ __name((_) => ({
396
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
397
+ }), "bgHex"),
398
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright"),
399
+ bold: {
400
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
401
+ bgHex: /* @__PURE__ */ __name((_) => ({
402
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
403
+ }), "bgHex"),
404
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
405
+ }
406
+ };
407
+ var getChalk = /* @__PURE__ */ __name(() => {
408
+ let _chalk = import_chalk.default;
409
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
410
+ _chalk = chalkDefault;
411
+ }
412
+ return _chalk;
413
+ }, "getChalk");
414
+
415
+ // ../config-tools/src/logger/get-log-level.ts
416
+ var getLogLevel = /* @__PURE__ */ __name((label) => {
417
+ switch (label) {
418
+ case "all":
419
+ return LogLevel.ALL;
420
+ case "trace":
421
+ return LogLevel.TRACE;
422
+ case "debug":
423
+ return LogLevel.DEBUG;
424
+ case "info":
425
+ return LogLevel.INFO;
426
+ case "warn":
427
+ return LogLevel.WARN;
428
+ case "error":
429
+ return LogLevel.ERROR;
430
+ case "fatal":
431
+ return LogLevel.FATAL;
432
+ case "silent":
433
+ return LogLevel.SILENT;
434
+ default:
435
+ return LogLevel.INFO;
436
+ }
437
+ }, "getLogLevel");
438
+ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
439
+ if (logLevel >= LogLevel.ALL) {
440
+ return LogLevelLabel.ALL;
441
+ }
442
+ if (logLevel >= LogLevel.TRACE) {
443
+ return LogLevelLabel.TRACE;
444
+ }
445
+ if (logLevel >= LogLevel.DEBUG) {
446
+ return LogLevelLabel.DEBUG;
447
+ }
448
+ if (logLevel >= LogLevel.INFO) {
449
+ return LogLevelLabel.INFO;
450
+ }
451
+ if (logLevel >= LogLevel.WARN) {
452
+ return LogLevelLabel.WARN;
453
+ }
454
+ if (logLevel >= LogLevel.ERROR) {
455
+ return LogLevelLabel.ERROR;
456
+ }
457
+ if (logLevel >= LogLevel.FATAL) {
458
+ return LogLevelLabel.FATAL;
459
+ }
460
+ if (logLevel <= LogLevel.SILENT) {
461
+ return LogLevelLabel.SILENT;
462
+ }
463
+ return LogLevelLabel.INFO;
464
+ }, "getLogLevelLabel");
465
+ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
466
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
467
+ return logLevel <= LogLevel.DEBUG;
468
+ }, "isVerbose");
469
+
470
+ // ../config-tools/src/logger/console.ts
471
+ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
472
+ const _chalk = getChalk();
473
+ 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;
474
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
475
+ if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
476
+ return (_) => {
477
+ };
478
+ }
479
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
480
+ return (message) => {
481
+ console.error(`${_chalk.bold.hex(colors.fatal ?? "#7d1a1a")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#7d1a1a").whiteBright(" \u{1F480} Fatal ")} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(formatLogMessage(message))}
482
+ `);
483
+ };
484
+ }
485
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
486
+ return (message) => {
487
+ console.error(`${_chalk.bold.hex(colors.danger ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.danger ?? "#f85149").whiteBright(" \u2718 Error ")} ${_chalk.hex(colors.danger ?? "#f85149")(formatLogMessage(message))}
488
+ `);
489
+ };
490
+ }
491
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
492
+ return (message) => {
493
+ console.warn(`${_chalk.bold.hex(colors.warning ?? "#e3b341")(">")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(" \u26A0 Warn ")} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
494
+ `);
495
+ };
496
+ }
497
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
498
+ return (message) => {
499
+ console.info(`${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(" \u2713 Success ")} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
500
+ `);
501
+ };
502
+ }
503
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
504
+ return (message) => {
505
+ console.info(`${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(" \u2139 Info ")} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
506
+ `);
507
+ };
508
+ }
509
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
510
+ return (message) => {
511
+ console.debug(`${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.brand ?? "#1fb2a6").whiteBright(" \u{1F6E0} Debug ")} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
512
+ `);
513
+ };
514
+ }
515
+ return (message) => {
516
+ console.log(`${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.brand ?? "#1fb2a6").whiteBright(" \u2709 System ")} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
517
+ `);
518
+ };
519
+ }, "getLogFn");
520
+ var writeFatal = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
521
+ var writeError = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
522
+ var writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.WARN, config)(message), "writeWarning");
523
+ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.INFO, config)(message), "writeInfo");
524
+ var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
525
+ var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
526
+ var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
527
+ var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
528
+ var getStopwatch = /* @__PURE__ */ __name((name) => {
529
+ const start = process.hrtime();
530
+ return () => {
531
+ const end = process.hrtime(start);
532
+ console.info(`
533
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(end[0] * 1e3 + end[1] / 1e6)}ms to complete
534
+
535
+ `);
536
+ };
537
+ }, "getStopwatch");
538
+ var MAX_DEPTH = 4;
539
+ var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth2 = 0) => {
540
+ if (depth2 > MAX_DEPTH) {
541
+ return "<max depth>";
542
+ }
543
+ const prefix = options.prefix ?? "-";
544
+ const skip = options.skip ?? [];
545
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
546
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
547
+ prefix: `${prefix}-`,
548
+ skip
549
+ }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
550
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
551
+ prefix: `${prefix}-`,
552
+ skip
553
+ }, depth2 + 1) : message[key]}`).join("\n")}` : message;
554
+ }, "formatLogMessage");
555
+ var _isFunction = /* @__PURE__ */ __name((value) => {
556
+ try {
557
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
558
+ } catch (e) {
559
+ return false;
560
+ }
561
+ }, "_isFunction");
562
+
563
+ // ../config-tools/src/utilities/process-handler.ts
564
+ var exitWithError = /* @__PURE__ */ __name((config) => {
565
+ writeFatal("Exiting script with an error status...", config);
566
+ process.exit(1);
567
+ }, "exitWithError");
568
+ var exitWithSuccess = /* @__PURE__ */ __name((config) => {
569
+ writeSuccess("Script completed successfully. Exiting...", config);
570
+ process.exit(0);
571
+ }, "exitWithSuccess");
572
+ var handleProcess = /* @__PURE__ */ __name((config) => {
573
+ writeTrace(`Using the following arguments to process the script: ${process.argv.join(", ")}`, config);
574
+ process.on("unhandledRejection", (error) => {
575
+ writeError(`An Unhandled Rejection occurred while running the program: ${error}`, config);
576
+ exitWithError(config);
577
+ });
578
+ process.on("uncaughtException", (error) => {
579
+ writeError(`An Uncaught Exception occurred while running the program: ${error.message}
580
+ Stacktrace: ${error.stack}`, config);
581
+ exitWithError(config);
582
+ });
583
+ process.on("SIGTERM", (signal) => {
584
+ writeError(`The program terminated with signal code: ${signal}`, config);
585
+ exitWithError(config);
586
+ });
587
+ process.on("SIGINT", (signal) => {
588
+ writeError(`The program terminated with signal code: ${signal}`, config);
589
+ exitWithError(config);
590
+ });
591
+ process.on("SIGHUP", (signal) => {
592
+ writeError(`The program terminated with signal code: ${signal}`, config);
593
+ exitWithError(config);
594
+ });
595
+ }, "handleProcess");
596
+
597
+ // ../config-tools/src/config-file/get-config-file.ts
598
+ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
599
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
600
+ let config = (0, import_c12.loadConfig)({
601
+ cwd: workspacePath,
602
+ packageJson: true,
603
+ name: fileName,
604
+ envName: fileName?.toUpperCase(),
605
+ jitiOptions: {
606
+ debug: false,
607
+ cache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache", "storm")
608
+ },
609
+ ...options
610
+ });
611
+ if (!config || Object.keys(config).length === 0) {
612
+ config = (0, import_c12.loadConfig)({
613
+ cwd: workspacePath,
614
+ packageJson: true,
615
+ name: fileName,
616
+ envName: fileName?.toUpperCase(),
617
+ jitiOptions: {
618
+ debug: false,
619
+ cache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache", "storm")
620
+ },
621
+ configFile: fileName,
622
+ ...options
623
+ });
624
+ }
625
+ return config;
626
+ }, "getConfigFileByName");
627
+ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
628
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
629
+ const result = await getConfigFileByName("storm", workspacePath);
630
+ let config = result.config;
631
+ const configFile = result.configFile;
632
+ if (config && configFile && Object.keys(config).length > 0) {
633
+ writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
634
+ logLevel: "all"
635
+ });
636
+ }
637
+ if (additionalFileNames && additionalFileNames.length > 0) {
638
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
639
+ for (const result2 of results) {
640
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
641
+ writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
642
+ logLevel: "all"
643
+ });
644
+ config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
645
+ }
646
+ }
647
+ }
648
+ if (!config) {
649
+ return void 0;
650
+ }
651
+ config.configFile = configFile;
652
+ return config;
653
+ }, "getConfigFile");
654
+
655
+ // ../config-tools/src/env/get-env.ts
656
+ var getConfigEnv = /* @__PURE__ */ __name(() => {
657
+ const prefix = "STORM_";
658
+ let config = {
659
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
660
+ name: process.env[`${prefix}NAME`] || void 0,
661
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
662
+ owner: process.env[`${prefix}OWNER`] || void 0,
663
+ bot: {
664
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
665
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
666
+ },
667
+ organization: process.env[`${prefix}ORGANIZATION`] || void 0,
668
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
669
+ license: process.env[`${prefix}LICENSE`] || void 0,
670
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
671
+ docs: process.env[`${prefix}DOCS`] || void 0,
672
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
673
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
674
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
675
+ configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
676
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
677
+ directories: {
678
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : void 0,
679
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : void 0,
680
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : void 0,
681
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : void 0,
682
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : void 0,
683
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : void 0
684
+ },
685
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
686
+ env: (process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
687
+ // ci:
688
+ // process.env[`${prefix}CI`] !== undefined
689
+ // ? Boolean(
690
+ // process.env[`${prefix}CI`] ??
691
+ // process.env.CI ??
692
+ // process.env.CONTINUOUS_INTEGRATION
693
+ // )
694
+ // : undefined,
695
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
696
+ branch: process.env[`${prefix}BRANCH`] || void 0,
697
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
698
+ externalPackagePatterns: process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] ? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`]) : [],
699
+ registry: {
700
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
701
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
702
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
703
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
704
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
705
+ },
706
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
707
+ };
708
+ const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
709
+ config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
710
+ ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
711
+ return ret;
712
+ }, {}) : getThemeColorConfigEnv(prefix);
713
+ if (config.docs === STORM_DEFAULT_DOCS) {
714
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
715
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
716
+ } else {
717
+ config.docs = `${config.homepage}/docs`;
718
+ }
719
+ }
720
+ if (config.licensing === STORM_DEFAULT_LICENSING) {
721
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
722
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
723
+ } else {
724
+ config.licensing = `${config.homepage}/docs`;
725
+ }
726
+ }
727
+ const serializedConfig = process.env[`${prefix}CONFIG`];
728
+ if (serializedConfig) {
729
+ const parsed = JSON.parse(serializedConfig);
730
+ config = {
731
+ ...config,
732
+ ...parsed,
733
+ colors: {
734
+ ...config.colors,
735
+ ...parsed.colors
736
+ },
737
+ extensions: {
738
+ ...config.extensions,
739
+ ...parsed.extensions
740
+ }
741
+ };
742
+ }
743
+ return config;
744
+ }, "getConfigEnv");
745
+ var getThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, theme) => {
746
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
747
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
748
+ }, "getThemeColorConfigEnv");
749
+ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
750
+ return {
751
+ dark: process.env[`${prefix}DARK`],
752
+ light: process.env[`${prefix}LIGHT`],
753
+ brand: process.env[`${prefix}BRAND`],
754
+ alternate: process.env[`${prefix}ALTERNATE`],
755
+ accent: process.env[`${prefix}ACCENT`],
756
+ link: process.env[`${prefix}LINK`],
757
+ help: process.env[`${prefix}HELP`],
758
+ success: process.env[`${prefix}SUCCESS`],
759
+ info: process.env[`${prefix}INFO`],
760
+ warning: process.env[`${prefix}WARNING`],
761
+ danger: process.env[`${prefix}DANGER`],
762
+ fatal: process.env[`${prefix}FATAL`],
763
+ positive: process.env[`${prefix}POSITIVE`],
764
+ negative: process.env[`${prefix}NEGATIVE`]
765
+ };
766
+ }, "getSingleThemeColorConfigEnv");
767
+ var getMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
768
+ return {
769
+ light: getBaseThemeColorConfigEnv(`${prefix}_LIGHT_`),
770
+ dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
771
+ };
772
+ }, "getMultiThemeColorConfigEnv");
773
+ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
774
+ return {
775
+ foreground: process.env[`${prefix}FOREGROUND`],
776
+ background: process.env[`${prefix}BACKGROUND`],
777
+ brand: process.env[`${prefix}BRAND`],
778
+ alternate: process.env[`${prefix}ALTERNATE`],
779
+ accent: process.env[`${prefix}ACCENT`],
780
+ link: process.env[`${prefix}LINK`],
781
+ help: process.env[`${prefix}HELP`],
782
+ success: process.env[`${prefix}SUCCESS`],
783
+ info: process.env[`${prefix}INFO`],
784
+ warning: process.env[`${prefix}WARNING`],
785
+ danger: process.env[`${prefix}DANGER`],
786
+ fatal: process.env[`${prefix}FATAL`],
787
+ positive: process.env[`${prefix}POSITIVE`],
788
+ negative: process.env[`${prefix}NEGATIVE`]
789
+ };
790
+ }, "getBaseThemeColorConfigEnv");
791
+
792
+ // ../config-tools/src/env/set-env.ts
793
+ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
794
+ for (const key of Object.keys(extension ?? {})) {
795
+ if (extension[key]) {
796
+ const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
797
+ let extensionKey;
798
+ if (result.length === 0) {
799
+ return;
800
+ }
801
+ if (result.length === 1) {
802
+ extensionKey = result[0]?.toUpperCase() ?? "";
803
+ } else {
804
+ extensionKey = result.reduce((ret, part) => {
805
+ return `${ret}_${part.toLowerCase()}`;
806
+ });
807
+ }
808
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
809
+ }
810
+ }
811
+ }, "setExtensionEnv");
812
+ var setConfigEnv = /* @__PURE__ */ __name((config) => {
813
+ const prefix = "STORM_";
814
+ if (config.extends) {
815
+ process.env[`${prefix}EXTENDS`] = config.extends;
816
+ }
817
+ if (config.name) {
818
+ process.env[`${prefix}NAME`] = config.name;
819
+ }
820
+ if (config.namespace) {
821
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
822
+ }
823
+ if (config.owner) {
824
+ process.env[`${prefix}OWNER`] = config.owner;
825
+ }
826
+ if (config.bot) {
827
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
828
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
829
+ }
830
+ if (config.organization) {
831
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
832
+ }
833
+ if (config.packageManager) {
834
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
835
+ }
836
+ if (config.license) {
837
+ process.env[`${prefix}LICENSE`] = config.license;
838
+ }
839
+ if (config.homepage) {
840
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
841
+ }
842
+ if (config.docs) {
843
+ process.env[`${prefix}DOCS`] = config.docs;
844
+ }
845
+ if (config.licensing) {
846
+ process.env[`${prefix}LICENSING`] = config.licensing;
847
+ }
848
+ if (config.timezone) {
849
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
850
+ process.env.TZ = config.timezone;
851
+ process.env.DEFAULT_TIMEZONE = config.timezone;
852
+ }
853
+ if (config.locale) {
854
+ process.env[`${prefix}LOCALE`] = config.locale;
855
+ process.env.LOCALE = config.locale;
856
+ process.env.DEFAULT_LOCALE = config.locale;
857
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
858
+ }
859
+ if (config.configFile) {
860
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
861
+ }
862
+ if (config.workspaceRoot) {
863
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
864
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
865
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
866
+ }
867
+ if (config.directories) {
868
+ if (!config.skipCache && config.directories.cache) {
869
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
870
+ }
871
+ if (config.directories.data) {
872
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
873
+ }
874
+ if (config.directories.config) {
875
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
876
+ }
877
+ if (config.directories.temp) {
878
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
879
+ }
880
+ if (config.directories.log) {
881
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
882
+ }
883
+ if (config.directories.build) {
884
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
885
+ }
886
+ }
887
+ if (config.skipCache !== void 0) {
888
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
889
+ if (config.skipCache) {
890
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
891
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
892
+ }
893
+ }
894
+ if (config.env) {
895
+ process.env[`${prefix}ENV`] = config.env;
896
+ process.env.NODE_ENV = config.env;
897
+ process.env.ENVIRONMENT = config.env;
898
+ }
899
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
900
+ for (const key of Object.keys(config.colors)) {
901
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
902
+ }
903
+ } else {
904
+ setThemeColorConfigEnv(`${prefix}COLOR_`, config.colors);
905
+ }
906
+ if (config.repository) {
907
+ process.env[`${prefix}REPOSITORY`] = config.repository;
908
+ }
909
+ if (config.branch) {
910
+ process.env[`${prefix}BRANCH`] = config.branch;
911
+ }
912
+ if (config.preid) {
913
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
914
+ }
915
+ if (config.externalPackagePatterns) {
916
+ process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(config.externalPackagePatterns);
917
+ }
918
+ if (config.registry) {
919
+ if (config.registry.github) {
920
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
921
+ }
922
+ if (config.registry.npm) {
923
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
924
+ }
925
+ if (config.registry.cargo) {
926
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
927
+ }
928
+ if (config.registry.cyclone) {
929
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
930
+ }
931
+ if (config.registry.container) {
932
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.cyclone);
933
+ }
934
+ }
935
+ if (config.logLevel) {
936
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
937
+ process.env.LOG_LEVEL = String(config.logLevel);
938
+ process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
939
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
940
+ }
941
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
942
+ for (const key of Object.keys(config.extensions ?? {})) {
943
+ config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
944
+ }
945
+ }, "setConfigEnv");
946
+ var setThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
947
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
948
+ }, "setThemeColorConfigEnv");
949
+ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
950
+ if (config.dark) {
951
+ process.env[`${prefix}DARK`] = config.dark;
952
+ }
953
+ if (config.light) {
954
+ process.env[`${prefix}LIGHT`] = config.light;
955
+ }
956
+ if (config.brand) {
957
+ process.env[`${prefix}BRAND`] = config.brand;
958
+ }
959
+ if (config.alternate) {
960
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
961
+ }
962
+ if (config.accent) {
963
+ process.env[`${prefix}ACCENT`] = config.accent;
964
+ }
965
+ if (config.link) {
966
+ process.env[`${prefix}LINK`] = config.link;
967
+ }
968
+ if (config.help) {
969
+ process.env[`${prefix}HELP`] = config.help;
970
+ }
971
+ if (config.success) {
972
+ process.env[`${prefix}SUCCESS`] = config.success;
973
+ }
974
+ if (config.info) {
975
+ process.env[`${prefix}INFO`] = config.info;
976
+ }
977
+ if (config.warning) {
978
+ process.env[`${prefix}WARNING`] = config.warning;
979
+ }
980
+ if (config.danger) {
981
+ process.env[`${prefix}DANGER`] = config.danger;
982
+ }
983
+ if (config.fatal) {
984
+ process.env[`${prefix}FATAL`] = config.fatal;
985
+ }
986
+ if (config.positive) {
987
+ process.env[`${prefix}POSITIVE`] = config.positive;
988
+ }
989
+ if (config.negative) {
990
+ process.env[`${prefix}NEGATIVE`] = config.negative;
991
+ }
992
+ }, "setSingleThemeColorConfigEnv");
993
+ var setMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
994
+ return {
995
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
996
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
997
+ };
998
+ }, "setMultiThemeColorConfigEnv");
999
+ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1000
+ if (config.foreground) {
1001
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
1002
+ }
1003
+ if (config.background) {
1004
+ process.env[`${prefix}BACKGROUND`] = config.background;
1005
+ }
1006
+ if (config.brand) {
1007
+ process.env[`${prefix}BRAND`] = config.brand;
1008
+ }
1009
+ if (config.alternate) {
1010
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1011
+ }
1012
+ if (config.accent) {
1013
+ process.env[`${prefix}ACCENT`] = config.accent;
1014
+ }
1015
+ if (config.link) {
1016
+ process.env[`${prefix}LINK`] = config.link;
1017
+ }
1018
+ if (config.help) {
1019
+ process.env[`${prefix}HELP`] = config.help;
1020
+ }
1021
+ if (config.success) {
1022
+ process.env[`${prefix}SUCCESS`] = config.success;
1023
+ }
1024
+ if (config.info) {
1025
+ process.env[`${prefix}INFO`] = config.info;
1026
+ }
1027
+ if (config.warning) {
1028
+ process.env[`${prefix}WARNING`] = config.warning;
1029
+ }
1030
+ if (config.danger) {
1031
+ process.env[`${prefix}DANGER`] = config.danger;
1032
+ }
1033
+ if (config.fatal) {
1034
+ process.env[`${prefix}FATAL`] = config.fatal;
1035
+ }
1036
+ if (config.positive) {
1037
+ process.env[`${prefix}POSITIVE`] = config.positive;
1038
+ }
1039
+ if (config.negative) {
1040
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1041
+ }
1042
+ }, "setBaseThemeColorConfigEnv");
1043
+
1044
+ // ../config-tools/src/create-storm-config.ts
1045
+ var _static_cache = void 0;
1046
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
1047
+ let config = {};
1048
+ if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
1049
+ writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
1050
+ return _static_cache.data;
1051
+ }
1052
+ let _workspaceRoot = workspaceRoot;
1053
+ if (!_workspaceRoot) {
1054
+ _workspaceRoot = findWorkspaceRoot();
1055
+ }
1056
+ const configFile = await getConfigFile(_workspaceRoot);
1057
+ if (!configFile) {
1058
+ writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
1059
+ logLevel: "all"
1060
+ });
1061
+ }
1062
+ config = (0, import_defu2.default)(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
1063
+ setConfigEnv(config);
1064
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
1065
+ ${formatLogMessage(config)}`, config);
1066
+ return config;
1067
+ }, "loadStormConfig");
1068
+
26
1069
  // bin/unbuild.ts
27
- var import_create_storm_config2 = require("@storm-software/config-tools/create-storm-config");
28
- var import_console4 = require("@storm-software/config-tools/logger/console");
29
- var import_find_workspace_root2 = require("@storm-software/config-tools/utilities/find-workspace-root");
30
- var import_process_handler = require("@storm-software/config-tools/utilities/process-handler");
31
1070
  var import_commander = require("commander");
32
1071
 
33
1072
  // src/build.ts
1073
+ var import_node5 = require("@humanfs/node");
1074
+ var import_devkit6 = require("@nx/devkit");
1075
+ var import_js2 = require("@nx/js");
1076
+ var import_buildable_libs_utils4 = require("@nx/js/src/utils/buildable-libs-utils");
1077
+
1078
+ // ../build-tools/src/plugins/swc.ts
1079
+ var import_core = require("@swc/core");
1080
+
1081
+ // ../build-tools/src/plugins/ts-resolve.ts
1082
+ var import_node_fs3 = __toESM(require("fs"));
1083
+ var import_node_module = require("module");
1084
+ var import_node_path3 = __toESM(require("path"));
1085
+ var import_resolve = __toESM(require("resolve"));
1086
+
1087
+ // ../build-tools/src/plugins/type-definitions.ts
1088
+ var import_devkit2 = require("@nx/devkit");
1089
+ var import_path = require("path");
1090
+
1091
+ // ../build-tools/src/utilities/copy-assets.ts
34
1092
  var import_node2 = require("@humanfs/node");
35
1093
  var import_devkit3 = require("@nx/devkit");
36
1094
  var import_js = require("@nx/js");
37
- var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
38
- var import_build_tools = require("@storm-software/build-tools");
39
- var import_create_storm_config = require("@storm-software/config-tools/create-storm-config");
40
- var import_console3 = require("@storm-software/config-tools/logger/console");
41
- var import_get_log_level = require("@storm-software/config-tools/logger/get-log-level");
42
- var import_types = require("@storm-software/config-tools/types");
43
- var import_correct_paths = require("@storm-software/config-tools/utilities/correct-paths");
44
- var import_defu = __toESM(require("defu"), 1);
45
- var import_node_path3 = require("path");
46
- var import_find_workspace_root = require("nx/src/utils/find-workspace-root");
1095
+ var import_glob = require("glob");
1096
+
1097
+ // ../build-tools/src/utilities/read-nx-config.ts
1098
+ var import_node = require("@humanfs/node");
1099
+ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
1100
+ let rootDir = workspaceRoot;
1101
+ if (!rootDir) {
1102
+ const config = await loadStormConfig();
1103
+ rootDir = config.workspaceRoot;
1104
+ }
1105
+ const nxJsonPath = joinPaths(rootDir, "nx.json");
1106
+ if (!await import_node.hfs.isFile(nxJsonPath)) {
1107
+ throw new Error("Cannot find project.json configuration");
1108
+ }
1109
+ return import_node.hfs.json(nxJsonPath);
1110
+ }, "readNxConfig");
1111
+
1112
+ // ../build-tools/src/utilities/copy-assets.ts
1113
+ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
1114
+ const pendingAssets = Array.from(assets ?? []);
1115
+ if (!pendingAssets?.some((asset) => asset?.glob === "*.md")) {
1116
+ pendingAssets.push({
1117
+ input: projectRoot,
1118
+ glob: "*.md",
1119
+ output: "/"
1120
+ });
1121
+ }
1122
+ if (generatePackageJson2 === false) {
1123
+ pendingAssets.push({
1124
+ input: sourceRoot,
1125
+ glob: "package.json",
1126
+ output: "."
1127
+ });
1128
+ }
1129
+ if (!pendingAssets?.some((asset) => asset?.glob === "LICENSE")) {
1130
+ pendingAssets.push({
1131
+ input: "",
1132
+ glob: "LICENSE",
1133
+ output: "."
1134
+ });
1135
+ }
1136
+ if (includeSrc === true) {
1137
+ pendingAssets.push({
1138
+ input: sourceRoot,
1139
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
1140
+ output: "src/"
1141
+ });
1142
+ }
1143
+ const nxJson = readNxConfig(config.workspaceRoot);
1144
+ const projectGraph = await (0, import_devkit3.createProjectGraphAsync)({
1145
+ exitOnError: true
1146
+ });
1147
+ const projectsConfigurations = (0, import_devkit3.readProjectsConfigurationFromProjectGraph)(projectGraph);
1148
+ if (!projectsConfigurations?.projects?.[projectName]) {
1149
+ throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
1150
+ }
1151
+ const buildTarget = projectsConfigurations.projects[projectName]?.targets?.build;
1152
+ if (!buildTarget) {
1153
+ throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
1154
+ }
1155
+ const result = await (0, import_js.copyAssets)({
1156
+ assets,
1157
+ watch: false,
1158
+ outputPath
1159
+ }, {
1160
+ root: config.workspaceRoot,
1161
+ targetName: "build",
1162
+ target: buildTarget,
1163
+ projectName,
1164
+ projectGraph,
1165
+ projectsConfigurations,
1166
+ nxJsonConfiguration: nxJson,
1167
+ cwd: config.workspaceRoot,
1168
+ isVerbose: isVerbose(config.logLevel)
1169
+ });
1170
+ if (!result.success) {
1171
+ throw new Error("The Build process failed trying to copy assets");
1172
+ }
1173
+ if (includeSrc === true) {
1174
+ writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
1175
+ const files = await (0, import_glob.glob)([
1176
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
1177
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
1178
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
1179
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
1180
+ ]);
1181
+ await Promise.allSettled(files.map(async (file) => import_node2.hfs.write(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
1182
+
1183
+ ${await import_node2.hfs.text(file)}
1184
+
1185
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
1186
+ }
1187
+ }, "copyAssets");
1188
+
1189
+ // ../build-tools/src/utilities/generate-package-json.ts
1190
+ var import_node3 = require("@humanfs/node");
1191
+ var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
1192
+ var import_glob2 = require("glob");
1193
+ var import_project_graph = require("nx/src/project-graph/project-graph");
1194
+ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
1195
+ const projectGraph = await (0, import_project_graph.createProjectGraphAsync)({
1196
+ exitOnError: true
1197
+ });
1198
+ const projectConfigurations = (0, import_project_graph.readProjectsConfigurationFromProjectGraph)(projectGraph);
1199
+ if (!projectConfigurations?.projects?.[projectName]) {
1200
+ throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
1201
+ }
1202
+ const projectJsonPath = joinPaths(workspaceRoot, projectRoot, "project.json");
1203
+ if (!await import_node3.hfs.isFile(projectJsonPath)) {
1204
+ throw new Error("Cannot find project.json configuration");
1205
+ }
1206
+ if (!projectConfigurations?.projects?.[projectName]) {
1207
+ throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
1208
+ }
1209
+ const projectDependencies = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1210
+ const localPackages = [];
1211
+ for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
1212
+ const projectNode = project.node;
1213
+ if (projectNode.data.root) {
1214
+ const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
1215
+ if (await import_node3.hfs.isFile(projectPackageJsonPath)) {
1216
+ const projectPackageJson = await import_node3.hfs.json(projectPackageJsonPath);
1217
+ if (projectPackageJson.private !== false) {
1218
+ localPackages.push(projectPackageJson);
1219
+ }
1220
+ }
1221
+ }
1222
+ }
1223
+ if (localPackages.length > 0) {
1224
+ writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
1225
+ packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
1226
+ if (!ret[localPackage.name]) {
1227
+ ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
1228
+ }
1229
+ return ret;
1230
+ }, packageJson.peerDependencies ?? {});
1231
+ packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
1232
+ if (!ret[localPackage.name]) {
1233
+ ret[localPackage.name] = {
1234
+ optional: false
1235
+ };
1236
+ }
1237
+ return ret;
1238
+ }, packageJson.peerDependenciesMeta ?? {});
1239
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
1240
+ if (!ret[localPackage.name]) {
1241
+ ret[localPackage.name] = localPackage.version || "0.0.1";
1242
+ }
1243
+ return ret;
1244
+ }, packageJson.peerDependencies ?? {});
1245
+ } else {
1246
+ writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
1247
+ }
1248
+ return packageJson;
1249
+ }, "addPackageDependencies");
1250
+ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
1251
+ const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
1252
+ const workspacePackageJson = await import_node3.hfs.json(joinPaths(workspaceRoot, "package.json"));
1253
+ packageJson.type ??= "module";
1254
+ packageJson.sideEffects ??= false;
1255
+ if (includeSrc === true) {
1256
+ let distSrc = sourceRoot.replace(projectRoot, "");
1257
+ if (distSrc.startsWith("/")) {
1258
+ distSrc = distSrc.substring(1);
1259
+ }
1260
+ packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
1261
+ }
1262
+ packageJson.files ??= [
1263
+ "dist/**/*"
1264
+ ];
1265
+ if (includeSrc === true && !packageJson.files.includes("src")) {
1266
+ packageJson.files.push("src/**/*");
1267
+ }
1268
+ packageJson.publishConfig ??= {
1269
+ access: "public"
1270
+ };
1271
+ packageJson.description ??= workspacePackageJson.description;
1272
+ packageJson.homepage ??= workspacePackageJson.homepage;
1273
+ packageJson.bugs ??= workspacePackageJson.bugs;
1274
+ packageJson.license ??= workspacePackageJson.license;
1275
+ packageJson.keywords ??= workspacePackageJson.keywords;
1276
+ packageJson.funding ??= workspacePackageJson.funding;
1277
+ packageJson.author ??= workspacePackageJson.author;
1278
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
1279
+ if (!packageJson.maintainers && packageJson.author) {
1280
+ packageJson.maintainers = [
1281
+ packageJson.author
1282
+ ];
1283
+ }
1284
+ packageJson.contributors ??= workspacePackageJson.contributors;
1285
+ if (!packageJson.contributors && packageJson.author) {
1286
+ packageJson.contributors = [
1287
+ packageJson.author
1288
+ ];
1289
+ }
1290
+ packageJson.repository ??= workspacePackageJson.repository;
1291
+ packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
1292
+ return packageJson;
1293
+ }, "addWorkspacePackageJsonFields");
1294
+ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot) => {
1295
+ let entry = file.replaceAll("\\", "/");
1296
+ if (sourceRoot) {
1297
+ entry = entry.replace(sourceRoot, "");
1298
+ }
1299
+ return {
1300
+ "import": {
1301
+ "types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
1302
+ "default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
1303
+ },
1304
+ "require": {
1305
+ "types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
1306
+ "default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
1307
+ },
1308
+ "default": {
1309
+ "types": `./dist/${entry}.d.ts`,
1310
+ "default": `./dist/${entry}.js`
1311
+ }
1312
+ };
1313
+ }, "addPackageJsonExport");
1314
+ var addPackageJsonExports = /* @__PURE__ */ __name(async (sourceRoot, packageJson) => {
1315
+ packageJson.exports ??= {};
1316
+ const files = await new import_glob2.Glob("**/*.{ts,tsx}", {
1317
+ absolute: false,
1318
+ cwd: sourceRoot,
1319
+ root: sourceRoot
1320
+ }).walk();
1321
+ files.forEach((file) => {
1322
+ addPackageJsonExport(file, packageJson.type, sourceRoot);
1323
+ const split = file.split(".");
1324
+ split.pop();
1325
+ const entry = split.join(".").replaceAll("\\", "/");
1326
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, sourceRoot);
1327
+ });
1328
+ packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
1329
+ packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
1330
+ packageJson.types = "./dist/index.d.ts";
1331
+ packageJson.exports ??= {};
1332
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
1333
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1334
+ ret[key.replace("/index", "")] = packageJson.exports[key];
1335
+ }
1336
+ return ret;
1337
+ }, packageJson.exports);
1338
+ packageJson.exports["./package.json"] ??= "./package.json";
1339
+ packageJson.exports["."] = packageJson.exports["."] ?? addPackageJsonExport("index", packageJson.type, sourceRoot);
1340
+ return packageJson;
1341
+ }, "addPackageJsonExports");
1342
+
1343
+ // ../build-tools/src/utilities/get-entry-points.ts
1344
+ var import_glob3 = require("glob");
1345
+
1346
+ // ../build-tools/src/utilities/task-graph.ts
1347
+ var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
1348
+
1349
+ // src/build.ts
1350
+ var import_defu3 = __toESM(require("defu"), 1);
1351
+ var import_node_path6 = require("path");
1352
+ var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
47
1353
  var import_unbuild = require("unbuild");
48
1354
 
49
1355
  // src/clean.ts
50
- var import_node = require("@humanfs/node");
51
- var import_console = require("@storm-software/config-tools/logger/console");
1356
+ var import_node4 = require("@humanfs/node");
52
1357
  async function clean(name = "Unbuild", directory, config) {
53
- (0, import_console.writeDebug)(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
54
- const stopwatch = (0, import_console.getStopwatch)(`${name} output clean`);
55
- await import_node.hfs.deleteAll(directory);
1358
+ writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
1359
+ const stopwatch = getStopwatch(`${name} output clean`);
1360
+ await import_node4.hfs.deleteAll(directory);
56
1361
  stopwatch();
57
1362
  }
58
1363
  __name(clean, "clean");
59
1364
 
60
1365
  // src/plugins/analyze.ts
61
- var import_config_tools = require("@storm-software/config-tools");
62
1366
  var formatBytes = /* @__PURE__ */ __name((bytes) => {
63
1367
  if (bytes === 0) return "0 Byte";
64
1368
  const k = 1e3;
@@ -78,18 +1382,17 @@ var analyzePlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
78
1382
  renderChunk(source, chunk) {
79
1383
  const sourceBytes = formatBytes(source.length);
80
1384
  const fileName = chunk.fileName;
81
- (0, import_config_tools.writeInfo)(` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
1385
+ writeInfo(` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
82
1386
  }
83
1387
  };
84
1388
  }, "analyzePlugin");
85
1389
 
86
1390
  // src/plugins/on-error.ts
87
- var import_config_tools2 = require("@storm-software/config-tools");
88
1391
  var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
89
1392
  name: "storm:on-error",
90
1393
  buildEnd(error) {
91
1394
  if (error) {
92
- (0, import_config_tools2.writeError)(`The following errors occurred during the build:
1395
+ writeError(`The following errors occurred during the build:
93
1396
  ${error ? error.message : "Unknown build error"}
94
1397
 
95
1398
  `, resolvedOptions.config);
@@ -97,7 +1400,7 @@ ${error ? error.message : "Unknown build error"}
97
1400
  }
98
1401
  },
99
1402
  renderError(error) {
100
- (0, import_config_tools2.writeError)(`The following errors occurred during the build:
1403
+ writeError(`The following errors occurred during the build:
101
1404
  ${error ? error.message : "Unknown build error"}
102
1405
 
103
1406
  `, resolvedOptions.config);
@@ -107,11 +1410,11 @@ ${error ? error.message : "Unknown build error"}
107
1410
 
108
1411
  // src/plugins/swc.ts
109
1412
  var swcPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
110
- const { transform } = require("@swc/core");
1413
+ const { transform: transform2 } = require("@swc/core");
111
1414
  return {
112
1415
  name: "storm:swc",
113
1416
  transform(code, filename) {
114
- return transform(code, {
1417
+ return transform2(code, {
115
1418
  filename,
116
1419
  jsc: {
117
1420
  transform: {
@@ -126,44 +1429,43 @@ var swcPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
126
1429
  }, "swcPlugin");
127
1430
 
128
1431
  // src/plugins/tsc.ts
129
- var import_devkit2 = require("@nx/devkit");
130
- var import_buildable_libs_utils2 = require("@nx/js/src/utils/buildable-libs-utils");
1432
+ var import_devkit5 = require("@nx/devkit");
1433
+ var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
131
1434
  var import_compiler_helper_dependency = require("@nx/js/src/utils/compiler-helper-dependency");
132
1435
  var import_rollup_plugin_typescript2 = __toESM(require("rollup-plugin-typescript2"), 1);
133
1436
 
134
1437
  // src/utilities/helpers.ts
135
- var import_devkit = require("@nx/devkit");
136
- var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
137
- var import_console2 = require("@storm-software/config-tools/logger/console");
138
- var import_node_path = require("path");
1438
+ var import_devkit4 = require("@nx/devkit");
1439
+ var import_buildable_libs_utils2 = require("@nx/js/src/utils/buildable-libs-utils");
1440
+ var import_node_path4 = require("path");
139
1441
  var import_node_url = require("url");
140
1442
  var import_typescript = __toESM(require("typescript"), 1);
141
- async function loadConfig(configPath) {
142
- if (!/\.(js|mjs)$/.test((0, import_node_path.extname)(configPath))) {
1443
+ async function loadConfig2(configPath) {
1444
+ if (!/\.(js|mjs)$/.test((0, import_node_path4.extname)(configPath))) {
143
1445
  throw new Error("Unsupported config file format");
144
1446
  }
145
1447
  return import((0, import_node_url.pathToFileURL)(configPath).toString()).then((config) => config.default);
146
1448
  }
147
- __name(loadConfig, "loadConfig");
1449
+ __name(loadConfig2, "loadConfig");
148
1450
  async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
149
- const tsConfigFile = import_typescript.default.readConfigFile((0, import_devkit.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath), import_typescript.default.sys.readFile);
150
- const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path.dirname)((0, import_devkit.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath)));
1451
+ const tsConfigFile = import_typescript.default.readConfigFile((0, import_devkit4.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath), import_typescript.default.sys.readFile);
1452
+ const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path4.dirname)((0, import_devkit4.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath)));
151
1453
  const compilerOptions = {
152
1454
  rootDir: projectRoot,
153
1455
  declaration: true,
154
- paths: (0, import_buildable_libs_utils.computeCompilerOptionsPaths)(tsConfig, dependencies ?? [])
1456
+ paths: (0, import_buildable_libs_utils2.computeCompilerOptionsPaths)(tsConfig, dependencies ?? [])
155
1457
  };
156
- (0, import_console2.writeTrace)(compilerOptions, config);
1458
+ writeTrace(compilerOptions, config);
157
1459
  return compilerOptions;
158
1460
  }
159
1461
  __name(createTsCompilerOptions, "createTsCompilerOptions");
160
1462
 
161
1463
  // src/plugins/tsc.ts
162
1464
  var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
163
- const projectGraph = await (0, import_devkit2.createProjectGraphAsync)({
1465
+ const projectGraph = await (0, import_devkit5.createProjectGraphAsync)({
164
1466
  exitOnError: true
165
1467
  });
166
- const result = (0, import_buildable_libs_utils2.calculateProjectBuildableDependencies)(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1468
+ const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
167
1469
  let dependencies = result.dependencies;
168
1470
  const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(import_compiler_helper_dependency.HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
169
1471
  if (tsLibDependency) {
@@ -180,7 +1482,7 @@ var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
180
1482
  }, "tscPlugin");
181
1483
 
182
1484
  // src/plugins/type-definitions.ts
183
- var import_node_path2 = require("path");
1485
+ var import_node_path5 = require("path");
184
1486
  var typeDefinitions = /* @__PURE__ */ __name((options, resolvedOptions) => ({
185
1487
  name: "storm:dts-bundle",
186
1488
  async generateBundle(_opts, bundle) {
@@ -189,7 +1491,7 @@ var typeDefinitions = /* @__PURE__ */ __name((options, resolvedOptions) => ({
189
1491
  continue;
190
1492
  }
191
1493
  const hasDefaultExport = file.exports.includes("default");
192
- const entrySourceFileName = (0, import_node_path2.relative)(options.projectRoot, file.facadeModuleId);
1494
+ const entrySourceFileName = (0, import_node_path5.relative)(options.projectRoot, file.facadeModuleId);
193
1495
  const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
194
1496
  const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
195
1497
  const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
@@ -222,55 +1524,55 @@ async function resolveOptions(options) {
222
1524
  if (!projectRoot) {
223
1525
  throw new Error("Cannot find project root");
224
1526
  }
225
- const outputPath = options.outputPath || (0, import_correct_paths.joinPaths)("dist", projectRoot);
226
- const workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(projectRoot);
1527
+ const outputPath = options.outputPath || joinPaths("dist", projectRoot);
1528
+ const workspaceRoot = (0, import_find_workspace_root5.findWorkspaceRoot)(projectRoot);
227
1529
  if (!workspaceRoot) {
228
1530
  throw new Error("Cannot find workspace root");
229
1531
  }
230
- const config = await (0, import_create_storm_config.loadStormConfig)(workspaceRoot.dir);
231
- (0, import_console3.writeDebug)(" \u2699\uFE0F Resolving build options", config);
232
- const stopwatch = (0, import_console3.getStopwatch)("Build options resolution");
1532
+ const config = await loadStormConfig(workspaceRoot.dir);
1533
+ writeDebug(" \u2699\uFE0F Resolving build options", config);
1534
+ const stopwatch = getStopwatch("Build options resolution");
233
1535
  if (options.configPath) {
234
- const configFile = await loadConfig(options.configPath);
1536
+ const configFile = await loadConfig2(options.configPath);
235
1537
  if (configFile) {
236
- options = (0, import_defu.default)(options, configFile);
1538
+ options = (0, import_defu3.default)(options, configFile);
237
1539
  }
238
1540
  }
239
- const projectGraph = await (0, import_devkit3.createProjectGraphAsync)({
1541
+ const projectGraph = await (0, import_devkit6.createProjectGraphAsync)({
240
1542
  exitOnError: true
241
1543
  });
242
- const projectJsonPath = (0, import_correct_paths.joinPaths)(config.workspaceRoot, projectRoot, "project.json");
243
- if (!await import_node2.hfs.isFile(projectJsonPath)) {
1544
+ const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
1545
+ if (!await import_node5.hfs.isFile(projectJsonPath)) {
244
1546
  throw new Error("Cannot find project.json configuration");
245
1547
  }
246
- const projectJson = await import_node2.hfs.json(projectJsonPath);
1548
+ const projectJson = await import_node5.hfs.json(projectJsonPath);
247
1549
  const projectName = projectJson.name;
248
- const packageJsonPath = (0, import_correct_paths.joinPaths)(workspaceRoot.dir, projectRoot, "package.json");
249
- if (!await import_node2.hfs.isFile(packageJsonPath)) {
1550
+ const packageJsonPath = joinPaths(workspaceRoot.dir, projectRoot, "package.json");
1551
+ if (!await import_node5.hfs.isFile(packageJsonPath)) {
250
1552
  throw new Error("Cannot find package.json configuration");
251
1553
  }
252
- const packageJson = await import_node2.hfs.json(packageJsonPath);
1554
+ const packageJson = await import_node5.hfs.json(packageJsonPath);
253
1555
  let tsconfig = options.tsconfig;
254
1556
  if (!tsconfig) {
255
- tsconfig = (0, import_correct_paths.joinPaths)(workspaceRoot.dir, projectRoot, "tsconfig.json");
1557
+ tsconfig = joinPaths(workspaceRoot.dir, projectRoot, "tsconfig.json");
256
1558
  }
257
- if (!await import_node2.hfs.isFile(tsconfig)) {
1559
+ if (!await import_node5.hfs.isFile(tsconfig)) {
258
1560
  throw new Error("Cannot find tsconfig.json configuration");
259
1561
  }
260
1562
  let sourceRoot = projectJson.sourceRoot;
261
1563
  if (!sourceRoot) {
262
- sourceRoot = (0, import_correct_paths.joinPaths)(projectRoot, "src");
1564
+ sourceRoot = joinPaths(projectRoot, "src");
263
1565
  }
264
- if (!await import_node2.hfs.isDirectory(sourceRoot)) {
1566
+ if (!await import_node5.hfs.isDirectory(sourceRoot)) {
265
1567
  throw new Error("Cannot find sourceRoot directory");
266
1568
  }
267
- const projectConfigurations = (0, import_devkit3.readProjectsConfigurationFromProjectGraph)(projectGraph);
1569
+ const projectConfigurations = (0, import_devkit6.readProjectsConfigurationFromProjectGraph)(projectGraph);
268
1570
  if (!projectConfigurations?.projects?.[projectName]) {
269
1571
  throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
270
1572
  }
271
- const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph, workspaceRoot.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1573
+ const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(void 0, projectGraph, workspaceRoot.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
272
1574
  let dependencies = result.dependencies;
273
- const tsLibDependency = (0, import_js.getHelperDependency)(import_js.HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
1575
+ const tsLibDependency = (0, import_js2.getHelperDependency)(import_js2.HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
274
1576
  if (tsLibDependency) {
275
1577
  dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
276
1578
  dependencies.push(tsLibDependency);
@@ -287,14 +1589,14 @@ async function resolveOptions(options) {
287
1589
  {
288
1590
  builder: "mkdist",
289
1591
  input: `.${sourceRoot.replace(projectRoot, "")}`,
290
- outDir: (0, import_correct_paths.joinPaths)((0, import_node_path3.relative)((0, import_correct_paths.joinPaths)(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
1592
+ outDir: joinPaths((0, import_node_path6.relative)(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
291
1593
  declaration: options.emitTypes !== false,
292
1594
  format: "esm"
293
1595
  },
294
1596
  {
295
1597
  builder: "mkdist",
296
1598
  input: `.${sourceRoot.replace(projectRoot, "")}`,
297
- outDir: (0, import_correct_paths.joinPaths)((0, import_node_path3.relative)((0, import_correct_paths.joinPaths)(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
1599
+ outDir: joinPaths((0, import_node_path6.relative)(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
298
1600
  declaration: options.emitTypes !== false,
299
1601
  format: "cjs",
300
1602
  ext: "cjs"
@@ -352,7 +1654,7 @@ async function resolveOptions(options) {
352
1654
  splitting: options.splitting !== false,
353
1655
  treeShaking: options.treeShaking !== false,
354
1656
  color: true,
355
- logLevel: config.logLevel === import_types.LogLevelLabel.FATAL ? import_types.LogLevelLabel.ERROR : (0, import_get_log_level.isVerbose)() ? "verbose" : config.logLevel
1657
+ logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
356
1658
  }
357
1659
  }
358
1660
  };
@@ -369,14 +1671,14 @@ async function resolveOptions(options) {
369
1671
  if (options.rollup) {
370
1672
  let rollup = {};
371
1673
  if (typeof options.rollup === "string") {
372
- const rollupFile = await loadConfig(options.rollup);
1674
+ const rollupFile = await loadConfig2(options.rollup);
373
1675
  if (rollupFile) {
374
1676
  rollup = rollupFile;
375
1677
  }
376
1678
  } else {
377
1679
  rollup = options.rollup;
378
1680
  }
379
- resolvedOptions.rollup = (0, import_defu.default)(resolvedOptions.rollup ?? {}, rollup);
1681
+ resolvedOptions.rollup = (0, import_defu3.default)(resolvedOptions.rollup ?? {}, rollup);
380
1682
  }
381
1683
  resolvedOptions.hooks = {
382
1684
  "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
@@ -388,29 +1690,29 @@ async function resolveOptions(options) {
388
1690
  }
389
1691
  __name(resolveOptions, "resolveOptions");
390
1692
  async function generatePackageJson(options) {
391
- if (options.generatePackageJson !== false && await import_node2.hfs.isFile((0, import_correct_paths.joinPaths)(options.projectRoot, "package.json"))) {
392
- (0, import_console3.writeDebug)(" \u270D\uFE0F Writing package.json file", options.config);
393
- const stopwatch = (0, import_console3.getStopwatch)("Write package.json file");
394
- const packageJsonPath = (0, import_correct_paths.joinPaths)(options.projectRoot, "project.json");
395
- if (!await import_node2.hfs.isFile(packageJsonPath)) {
1693
+ if (options.generatePackageJson !== false && await import_node5.hfs.isFile(joinPaths(options.projectRoot, "package.json"))) {
1694
+ writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
1695
+ const stopwatch = getStopwatch("Write package.json file");
1696
+ const packageJsonPath = joinPaths(options.projectRoot, "project.json");
1697
+ if (!await import_node5.hfs.isFile(packageJsonPath)) {
396
1698
  throw new Error("Cannot find package.json configuration");
397
1699
  }
398
- let packageJson = await import_node2.hfs.json((0, import_correct_paths.joinPaths)(options.config.workspaceRoot, options.projectRoot, "package.json"));
1700
+ let packageJson = await import_node5.hfs.json(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"));
399
1701
  if (!packageJson) {
400
1702
  throw new Error("Cannot find package.json configuration file");
401
1703
  }
402
- packageJson = await (0, import_build_tools.addPackageDependencies)(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
403
- packageJson = await (0, import_build_tools.addWorkspacePackageJsonFields)(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
404
- packageJson = await (0, import_build_tools.addPackageJsonExports)(options.sourceRoot, packageJson);
405
- await (0, import_devkit3.writeJsonFile)((0, import_correct_paths.joinPaths)(options.outDir, "package.json"), packageJson);
1704
+ packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
1705
+ packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
1706
+ packageJson = await addPackageJsonExports(options.sourceRoot, packageJson);
1707
+ await (0, import_devkit6.writeJsonFile)(joinPaths(options.outDir, "package.json"), packageJson);
406
1708
  stopwatch();
407
1709
  }
408
1710
  return options;
409
1711
  }
410
1712
  __name(generatePackageJson, "generatePackageJson");
411
1713
  async function executeUnbuild(options) {
412
- (0, import_console3.writeDebug)(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
413
- const stopwatch = (0, import_console3.getStopwatch)(`${options.name} (${options.projectRoot}) build`);
1714
+ writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
1715
+ const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
414
1716
  try {
415
1717
  await (0, import_unbuild.build)(options.projectRoot, false, {
416
1718
  ...options,
@@ -423,9 +1725,9 @@ async function executeUnbuild(options) {
423
1725
  }
424
1726
  __name(executeUnbuild, "executeUnbuild");
425
1727
  async function copyBuildAssets(options) {
426
- (0, import_console3.writeDebug)(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
427
- const stopwatch = (0, import_console3.getStopwatch)(`${options.name} asset copy`);
428
- await (0, import_build_tools.copyAssets)(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
1728
+ writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
1729
+ const stopwatch = getStopwatch(`${options.name} asset copy`);
1730
+ await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
429
1731
  stopwatch();
430
1732
  return options;
431
1733
  }
@@ -438,17 +1740,17 @@ async function cleanOutputPath(options) {
438
1740
  }
439
1741
  __name(cleanOutputPath, "cleanOutputPath");
440
1742
  async function build(options) {
441
- (0, import_console3.writeDebug)(` \u26A1 Executing Storm Unbuild pipeline`);
442
- const stopwatch = (0, import_console3.getStopwatch)("Unbuild pipeline");
1743
+ writeDebug(` \u26A1 Executing Storm Unbuild pipeline`);
1744
+ const stopwatch = getStopwatch("Unbuild pipeline");
443
1745
  try {
444
1746
  const resolvedOptions = await resolveOptions(options);
445
1747
  await cleanOutputPath(resolvedOptions);
446
1748
  await generatePackageJson(resolvedOptions);
447
1749
  await executeUnbuild(resolvedOptions);
448
1750
  await copyBuildAssets(resolvedOptions);
449
- (0, import_console3.writeSuccess)(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, resolvedOptions.config);
1751
+ writeSuccess(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, resolvedOptions.config);
450
1752
  } catch (error) {
451
- (0, import_console3.writeFatal)(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
1753
+ writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
452
1754
  throw error;
453
1755
  } finally {
454
1756
  stopwatch();
@@ -459,8 +1761,8 @@ __name(build, "build");
459
1761
  // bin/unbuild.ts
460
1762
  async function createProgram(config) {
461
1763
  try {
462
- (0, import_console4.writeInfo)("\u26A1 Running Storm Unbuild pipeline", config);
463
- const root = (0, import_find_workspace_root2.findWorkspaceRootSafe)();
1764
+ writeInfo("\u26A1 Running Storm Unbuild pipeline", config);
1765
+ const root = findWorkspaceRootSafe();
464
1766
  process.env.STORM_WORKSPACE_ROOT ??= root;
465
1767
  process.env.NX_WORKSPACE_ROOT_PATH ??= root;
466
1768
  root && process.chdir(root);
@@ -525,7 +1827,7 @@ async function createProgram(config) {
525
1827
  program.command("clean").alias("clear").description("Clean the output directory of the project. This command will remove the 'dist' folder.").addOption(nameOption).action(cleanAction(config));
526
1828
  return program;
527
1829
  } catch (e) {
528
- (0, import_console4.writeFatal)(`A fatal error occurred while running the program: ${e.message}`, config);
1830
+ writeFatal(`A fatal error occurred while running the program: ${e.message}`, config);
529
1831
  process.exit(1);
530
1832
  }
531
1833
  }
@@ -572,8 +1874,8 @@ var buildAction = /* @__PURE__ */ __name((config) => async (options) => {
572
1874
  }
573
1875
  });
574
1876
  } catch (e) {
575
- (0, import_console4.writeFatal)(`A fatal error occurred while cleaning the Unbuild output directory: ${e.message}`, config);
576
- (0, import_process_handler.exitWithError)(config);
1877
+ writeFatal(`A fatal error occurred while cleaning the Unbuild output directory: ${e.message}`, config);
1878
+ exitWithError(config);
577
1879
  process.exit(1);
578
1880
  }
579
1881
  }, "buildAction");
@@ -581,25 +1883,25 @@ var cleanAction = /* @__PURE__ */ __name((config) => async (options) => {
581
1883
  try {
582
1884
  await clean(options.name, options.output, config);
583
1885
  } catch (e) {
584
- (0, import_console4.writeFatal)(`A fatal error occurred while cleaning the ESBuild output directory: ${e.message}`, config);
585
- (0, import_process_handler.exitWithError)(config);
1886
+ writeFatal(`A fatal error occurred while cleaning the ESBuild output directory: ${e.message}`, config);
1887
+ exitWithError(config);
586
1888
  process.exit(1);
587
1889
  }
588
1890
  }, "cleanAction");
589
1891
  void (async () => {
590
- const config = await (0, import_create_storm_config2.loadStormConfig)();
591
- const stopwatch = (0, import_console4.getStopwatch)("Storm ESBuild executable");
1892
+ const config = await loadStormConfig();
1893
+ const stopwatch = getStopwatch("Storm ESBuild executable");
592
1894
  try {
593
- (0, import_process_handler.handleProcess)(config);
1895
+ handleProcess(config);
594
1896
  const program = await createProgram(config);
595
1897
  await program.parseAsync(process.argv);
596
- (0, import_console4.writeSuccess)(`\u{1F389} Storm ESBuild executable has completed successfully!`, config);
597
- (0, import_process_handler.exitWithSuccess)(config);
1898
+ writeSuccess(`\u{1F389} Storm ESBuild executable has completed successfully!`, config);
1899
+ exitWithSuccess(config);
598
1900
  } catch (error) {
599
- (0, import_console4.writeFatal)(`A fatal error occurred while running Storm ESBuild executable:
1901
+ writeFatal(`A fatal error occurred while running Storm ESBuild executable:
600
1902
 
601
1903
  ${error.message}`, config);
602
- (0, import_process_handler.exitWithError)(config);
1904
+ exitWithError(config);
603
1905
  process.exit(1);
604
1906
  } finally {
605
1907
  stopwatch();