@storm-software/projen 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4687 @@
1
+ import {
2
+ __dirname,
3
+ __name,
4
+ __require
5
+ } from "./chunk-XUV4U54K.mjs";
6
+
7
+ // src/generators/init/generator.ts
8
+ import { addDependenciesToPackageJson as addDependenciesToPackageJson4, formatFiles as formatFiles9, readJsonFile as readJsonFile4, runTasksInSerial } from "@nx/devkit";
9
+
10
+ // ../config-tools/src/config-file/get-config-file.ts
11
+ import { loadConfig } from "c12";
12
+ import defu from "defu";
13
+
14
+ // ../config-tools/src/types.ts
15
+ var LogLevel = {
16
+ SILENT: 0,
17
+ FATAL: 10,
18
+ ERROR: 20,
19
+ WARN: 30,
20
+ SUCCESS: 35,
21
+ INFO: 40,
22
+ DEBUG: 60,
23
+ TRACE: 70,
24
+ ALL: 100
25
+ };
26
+ var LogLevelLabel = {
27
+ SILENT: "silent",
28
+ FATAL: "fatal",
29
+ ERROR: "error",
30
+ WARN: "warn",
31
+ SUCCESS: "success",
32
+ INFO: "info",
33
+ DEBUG: "debug",
34
+ TRACE: "trace",
35
+ ALL: "all"
36
+ };
37
+
38
+ // ../config/src/constants.ts
39
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
40
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
41
+ var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
42
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
43
+
44
+ // ../config/src/schema.ts
45
+ import z from "zod";
46
+ var DarkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
47
+ var LightColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
48
+ var BrandColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
49
+ var AlternateColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
50
+ var AccentColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
51
+ var LinkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
52
+ var HelpColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
53
+ var SuccessColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
54
+ var InfoColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
55
+ var WarningColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
56
+ var DangerColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
57
+ var FatalColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
58
+ var PositiveColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
59
+ var NegativeColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
60
+ var DarkThemeColorConfigSchema = z.object({
61
+ foreground: LightColorSchema,
62
+ background: DarkColorSchema,
63
+ brand: BrandColorSchema,
64
+ alternate: AlternateColorSchema,
65
+ accent: AccentColorSchema,
66
+ link: LinkColorSchema,
67
+ help: HelpColorSchema,
68
+ success: SuccessColorSchema,
69
+ info: InfoColorSchema,
70
+ warning: WarningColorSchema,
71
+ danger: DangerColorSchema,
72
+ fatal: FatalColorSchema,
73
+ positive: PositiveColorSchema,
74
+ negative: NegativeColorSchema
75
+ });
76
+ var LightThemeColorConfigSchema = z.object({
77
+ foreground: DarkColorSchema,
78
+ background: LightColorSchema,
79
+ brand: BrandColorSchema,
80
+ alternate: AlternateColorSchema,
81
+ accent: AccentColorSchema,
82
+ link: LinkColorSchema,
83
+ help: HelpColorSchema,
84
+ success: SuccessColorSchema,
85
+ info: InfoColorSchema,
86
+ warning: WarningColorSchema,
87
+ danger: DangerColorSchema,
88
+ fatal: FatalColorSchema,
89
+ positive: PositiveColorSchema,
90
+ negative: NegativeColorSchema
91
+ });
92
+ var MultiThemeColorConfigSchema = z.object({
93
+ dark: DarkThemeColorConfigSchema,
94
+ light: LightThemeColorConfigSchema
95
+ });
96
+ var SingleThemeColorConfigSchema = z.object({
97
+ dark: DarkColorSchema,
98
+ light: LightColorSchema,
99
+ brand: BrandColorSchema,
100
+ alternate: AlternateColorSchema,
101
+ accent: AccentColorSchema,
102
+ link: LinkColorSchema,
103
+ help: HelpColorSchema,
104
+ success: SuccessColorSchema,
105
+ info: InfoColorSchema,
106
+ warning: WarningColorSchema,
107
+ danger: DangerColorSchema,
108
+ fatal: FatalColorSchema,
109
+ positive: PositiveColorSchema,
110
+ negative: NegativeColorSchema
111
+ });
112
+ var RegistryUrlConfigSchema = z.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
113
+ var RegistryConfigSchema = z.object({
114
+ github: RegistryUrlConfigSchema,
115
+ npm: RegistryUrlConfigSchema,
116
+ cargo: RegistryUrlConfigSchema,
117
+ cyclone: RegistryUrlConfigSchema,
118
+ container: RegistryUrlConfigSchema
119
+ }).default({}).describe("A list of remote registry URLs used by Storm Software");
120
+ var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
121
+ var ColorConfigMapSchema = z.union([
122
+ z.object({
123
+ "base": ColorConfigSchema
124
+ }),
125
+ z.record(z.string(), ColorConfigSchema)
126
+ ]);
127
+ var ExtendsItemSchema = z.string().trim().describe("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.");
128
+ var ExtendsSchema = ExtendsItemSchema.or(z.array(ExtendsItemSchema)).describe("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.");
129
+ var WorkspaceBotConfigSchema = z.object({
130
+ name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
131
+ email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
132
+ }).describe("The workspace's bot user's config used to automated various operations tasks");
133
+ var WorkspaceDirectoryConfigSchema = z.object({
134
+ cache: z.string().trim().optional().describe("The directory used to store the environment's cached file data"),
135
+ data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
136
+ config: z.string().trim().optional().describe("The directory used to store the environment's configuration files"),
137
+ temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
138
+ log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
139
+ build: z.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
140
+ }).describe("Various directories used by the workspace to store data, cache, and configuration files");
141
+ var StormConfigSchema = z.object({
142
+ $schema: z.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"),
143
+ extends: ExtendsSchema.optional(),
144
+ name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
145
+ namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
146
+ organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
147
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
148
+ license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
149
+ homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
150
+ docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
151
+ licensing: z.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
152
+ branch: z.string().trim().default("main").describe("The branch of the workspace"),
153
+ preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
154
+ owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
155
+ bot: WorkspaceBotConfigSchema,
156
+ env: z.enum([
157
+ "development",
158
+ "staging",
159
+ "production"
160
+ ]).default("production").describe("The current runtime environment name for the package"),
161
+ workspaceRoot: z.string().trim().default("").describe("The root directory of the workspace"),
162
+ externalPackagePatterns: z.array(z.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
163
+ skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
164
+ directories: WorkspaceDirectoryConfigSchema,
165
+ packageManager: z.enum([
166
+ "npm",
167
+ "yarn",
168
+ "pnpm",
169
+ "bun"
170
+ ]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
171
+ timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
172
+ locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
173
+ logLevel: z.enum([
174
+ "silent",
175
+ "fatal",
176
+ "error",
177
+ "warn",
178
+ "success",
179
+ "info",
180
+ "debug",
181
+ "trace",
182
+ "all"
183
+ ]).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`)."),
184
+ registry: RegistryConfigSchema,
185
+ configFile: z.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."),
186
+ colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
187
+ extensions: z.record(z.any()).optional().default({}).describe("Configuration of each used extension")
188
+ }).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.");
189
+
190
+ // ../config/src/types.ts
191
+ var COLOR_KEYS = [
192
+ "dark",
193
+ "light",
194
+ "base",
195
+ "brand",
196
+ "alternate",
197
+ "accent",
198
+ "link",
199
+ "success",
200
+ "help",
201
+ "info",
202
+ "warning",
203
+ "danger",
204
+ "fatal",
205
+ "positive",
206
+ "negative"
207
+ ];
208
+
209
+ // ../config-tools/src/utilities/get-default-config.ts
210
+ import { existsSync as existsSync2 } from "node:fs";
211
+ import { readFile } from "node:fs/promises";
212
+ import { join as join2 } from "node:path";
213
+
214
+ // ../config-tools/src/utilities/correct-paths.ts
215
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
216
+ function normalizeWindowsPath(input = "") {
217
+ if (!input) {
218
+ return input;
219
+ }
220
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
221
+ }
222
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
223
+ var _UNC_REGEX = /^[/\\]{2}/;
224
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
225
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
226
+ var correctPaths = /* @__PURE__ */ __name(function(path7) {
227
+ if (!path7 || path7.length === 0) {
228
+ return ".";
229
+ }
230
+ path7 = normalizeWindowsPath(path7);
231
+ const isUNCPath = path7.match(_UNC_REGEX);
232
+ const isPathAbsolute = isAbsolute(path7);
233
+ const trailingSeparator = path7[path7.length - 1] === "/";
234
+ path7 = normalizeString(path7, !isPathAbsolute);
235
+ if (path7.length === 0) {
236
+ if (isPathAbsolute) {
237
+ return "/";
238
+ }
239
+ return trailingSeparator ? "./" : ".";
240
+ }
241
+ if (trailingSeparator) {
242
+ path7 += "/";
243
+ }
244
+ if (_DRIVE_LETTER_RE.test(path7)) {
245
+ path7 += "/";
246
+ }
247
+ if (isUNCPath) {
248
+ if (!isPathAbsolute) {
249
+ return `//./${path7}`;
250
+ }
251
+ return `//${path7}`;
252
+ }
253
+ return isPathAbsolute && !isAbsolute(path7) ? `/${path7}` : path7;
254
+ }, "correctPaths");
255
+ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
256
+ let path7 = "";
257
+ for (const seg of segments) {
258
+ if (!seg) {
259
+ continue;
260
+ }
261
+ if (path7.length > 0) {
262
+ const pathTrailing = path7[path7.length - 1] === "/";
263
+ const segLeading = seg[0] === "/";
264
+ const both = pathTrailing && segLeading;
265
+ if (both) {
266
+ path7 += seg.slice(1);
267
+ } else {
268
+ path7 += pathTrailing || segLeading ? seg : `/${seg}`;
269
+ }
270
+ } else {
271
+ path7 += seg;
272
+ }
273
+ }
274
+ return correctPaths(path7);
275
+ }, "joinPaths");
276
+ function normalizeString(path7, allowAboveRoot) {
277
+ let res = "";
278
+ let lastSegmentLength = 0;
279
+ let lastSlash = -1;
280
+ let dots = 0;
281
+ let char = null;
282
+ for (let index = 0; index <= path7.length; ++index) {
283
+ if (index < path7.length) {
284
+ char = path7[index];
285
+ } else if (char === "/") {
286
+ break;
287
+ } else {
288
+ char = "/";
289
+ }
290
+ if (char === "/") {
291
+ if (lastSlash === index - 1 || dots === 1) {
292
+ } else if (dots === 2) {
293
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
294
+ if (res.length > 2) {
295
+ const lastSlashIndex = res.lastIndexOf("/");
296
+ if (lastSlashIndex === -1) {
297
+ res = "";
298
+ lastSegmentLength = 0;
299
+ } else {
300
+ res = res.slice(0, lastSlashIndex);
301
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
302
+ }
303
+ lastSlash = index;
304
+ dots = 0;
305
+ continue;
306
+ } else if (res.length > 0) {
307
+ res = "";
308
+ lastSegmentLength = 0;
309
+ lastSlash = index;
310
+ dots = 0;
311
+ continue;
312
+ }
313
+ }
314
+ if (allowAboveRoot) {
315
+ res += res.length > 0 ? "/.." : "..";
316
+ lastSegmentLength = 2;
317
+ }
318
+ } else {
319
+ if (res.length > 0) {
320
+ res += `/${path7.slice(lastSlash + 1, index)}`;
321
+ } else {
322
+ res = path7.slice(lastSlash + 1, index);
323
+ }
324
+ lastSegmentLength = index - lastSlash - 1;
325
+ }
326
+ lastSlash = index;
327
+ dots = 0;
328
+ } else if (char === "." && dots !== -1) {
329
+ ++dots;
330
+ } else {
331
+ dots = -1;
332
+ }
333
+ }
334
+ return res;
335
+ }
336
+ __name(normalizeString, "normalizeString");
337
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
338
+ return _IS_ABSOLUTE_RE.test(p);
339
+ }, "isAbsolute");
340
+
341
+ // ../config-tools/src/utilities/find-up.ts
342
+ import { existsSync } from "node:fs";
343
+ import { join } from "node:path";
344
+ var MAX_PATH_SEARCH_DEPTH = 30;
345
+ var depth = 0;
346
+ function findFolderUp(startPath, endFileNames) {
347
+ const _startPath = startPath ?? process.cwd();
348
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
349
+ return _startPath;
350
+ }
351
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
352
+ const parent = join(_startPath, "..");
353
+ return findFolderUp(parent, endFileNames);
354
+ }
355
+ return void 0;
356
+ }
357
+ __name(findFolderUp, "findFolderUp");
358
+
359
+ // ../config-tools/src/utilities/find-workspace-root.ts
360
+ var rootFiles = [
361
+ "storm.json",
362
+ "storm.json",
363
+ "storm.yaml",
364
+ "storm.yml",
365
+ "storm.js",
366
+ "storm.ts",
367
+ ".storm.json",
368
+ ".storm.yaml",
369
+ ".storm.yml",
370
+ ".storm.js",
371
+ ".storm.ts",
372
+ "lerna.json",
373
+ "nx.json",
374
+ "turbo.json",
375
+ "npm-workspace.json",
376
+ "yarn-workspace.json",
377
+ "pnpm-workspace.json",
378
+ "npm-workspace.yaml",
379
+ "yarn-workspace.yaml",
380
+ "pnpm-workspace.yaml",
381
+ "npm-workspace.yml",
382
+ "yarn-workspace.yml",
383
+ "pnpm-workspace.yml",
384
+ "npm-lock.json",
385
+ "yarn-lock.json",
386
+ "pnpm-lock.json",
387
+ "npm-lock.yaml",
388
+ "yarn-lock.yaml",
389
+ "pnpm-lock.yaml",
390
+ "npm-lock.yml",
391
+ "yarn-lock.yml",
392
+ "pnpm-lock.yml",
393
+ "bun.lockb"
394
+ ];
395
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
396
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
397
+ return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
398
+ }
399
+ return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles));
400
+ }
401
+ __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
402
+ function findWorkspaceRoot(pathInsideMonorepo) {
403
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
404
+ if (!result) {
405
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
406
+ ${rootFiles.join("\n")}
407
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
408
+ }
409
+ return result;
410
+ }
411
+ __name(findWorkspaceRoot, "findWorkspaceRoot");
412
+
413
+ // ../config-tools/src/utilities/get-default-config.ts
414
+ var DEFAULT_COLOR_CONFIG = {
415
+ "light": {
416
+ "background": "#fafafa",
417
+ "foreground": "#1d1e22",
418
+ "brand": "#1fb2a6",
419
+ "alternate": "#db2777",
420
+ "help": "#5C4EE5",
421
+ "success": "#087f5b",
422
+ "info": "#0550ae",
423
+ "warning": "#e3b341",
424
+ "danger": "#D8314A",
425
+ "positive": "#22c55e",
426
+ "negative": "#dc2626"
427
+ },
428
+ "dark": {
429
+ "background": "#1d1e22",
430
+ "foreground": "#cbd5e1",
431
+ "brand": "#2dd4bf",
432
+ "alternate": "#db2777",
433
+ "help": "#818cf8",
434
+ "success": "#10b981",
435
+ "info": "#58a6ff",
436
+ "warning": "#f3d371",
437
+ "danger": "#D8314A",
438
+ "positive": "#22c55e",
439
+ "negative": "#dc2626"
440
+ }
441
+ };
442
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
443
+ let license = STORM_DEFAULT_LICENSE;
444
+ let homepage = STORM_DEFAULT_HOMEPAGE;
445
+ let name = void 0;
446
+ let namespace = void 0;
447
+ let repository = void 0;
448
+ const workspaceRoot3 = findWorkspaceRoot(root);
449
+ if (existsSync2(join2(workspaceRoot3, "package.json"))) {
450
+ const file = await readFile(joinPaths(workspaceRoot3, "package.json"), "utf8");
451
+ if (file) {
452
+ const packageJson = JSON.parse(file);
453
+ if (packageJson.name) {
454
+ name = packageJson.name;
455
+ }
456
+ if (packageJson.namespace) {
457
+ namespace = packageJson.namespace;
458
+ }
459
+ if (packageJson.repository) {
460
+ if (typeof packageJson.repository === "string") {
461
+ repository = packageJson.repository;
462
+ } else if (packageJson.repository.url) {
463
+ repository = packageJson.repository.url;
464
+ }
465
+ }
466
+ if (packageJson.license) {
467
+ license = packageJson.license;
468
+ }
469
+ if (packageJson.homepage) {
470
+ homepage = packageJson.homepage;
471
+ }
472
+ }
473
+ }
474
+ return {
475
+ workspaceRoot: workspaceRoot3,
476
+ name,
477
+ namespace,
478
+ repository,
479
+ license,
480
+ homepage,
481
+ docs: `${homepage || STORM_DEFAULT_HOMEPAGE}/docs`,
482
+ licensing: `${homepage || STORM_DEFAULT_HOMEPAGE}/license`
483
+ };
484
+ }, "getDefaultConfig");
485
+
486
+ // ../config-tools/src/logger/chalk.ts
487
+ import chalk from "chalk";
488
+ var chalkDefault = {
489
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
490
+ bgHex: /* @__PURE__ */ __name((_) => ({
491
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
492
+ }), "bgHex"),
493
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright"),
494
+ gray: /* @__PURE__ */ __name((message) => message, "gray"),
495
+ bold: {
496
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
497
+ bgHex: /* @__PURE__ */ __name((_) => ({
498
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
499
+ }), "bgHex"),
500
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
501
+ },
502
+ dim: {
503
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
504
+ gray: /* @__PURE__ */ __name((message) => message, "gray")
505
+ }
506
+ };
507
+ var getChalk = /* @__PURE__ */ __name(() => {
508
+ let _chalk = chalk;
509
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
510
+ _chalk = chalkDefault;
511
+ }
512
+ return _chalk;
513
+ }, "getChalk");
514
+
515
+ // ../config-tools/src/logger/is-unicode-supported.ts
516
+ import process2 from "node:process";
517
+ function isUnicodeSupported() {
518
+ const { env } = process2;
519
+ const { TERM, TERM_PROGRAM } = env;
520
+ if (process2.platform !== "win32") {
521
+ return TERM !== "linux";
522
+ }
523
+ return Boolean(env.WT_SESSION) || // Windows Terminal
524
+ Boolean(env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
525
+ env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
526
+ TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
527
+ }
528
+ __name(isUnicodeSupported, "isUnicodeSupported");
529
+
530
+ // ../config-tools/src/logger/console-icons.ts
531
+ var useIcon = /* @__PURE__ */ __name((c, fallback) => isUnicodeSupported() ? c : fallback, "useIcon");
532
+ var CONSOLE_ICONS = {
533
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
534
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
535
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
536
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
537
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
538
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
539
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
540
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
541
+ };
542
+
543
+ // ../config-tools/src/logger/format-timestamp.ts
544
+ var formatTimestamp = /* @__PURE__ */ __name((date = /* @__PURE__ */ new Date()) => {
545
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
546
+ }, "formatTimestamp");
547
+
548
+ // ../config-tools/src/logger/get-log-level.ts
549
+ var getLogLevel = /* @__PURE__ */ __name((label) => {
550
+ switch (label) {
551
+ case "all":
552
+ return LogLevel.ALL;
553
+ case "trace":
554
+ return LogLevel.TRACE;
555
+ case "debug":
556
+ return LogLevel.DEBUG;
557
+ case "info":
558
+ return LogLevel.INFO;
559
+ case "warn":
560
+ return LogLevel.WARN;
561
+ case "error":
562
+ return LogLevel.ERROR;
563
+ case "fatal":
564
+ return LogLevel.FATAL;
565
+ case "silent":
566
+ return LogLevel.SILENT;
567
+ default:
568
+ return LogLevel.INFO;
569
+ }
570
+ }, "getLogLevel");
571
+ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
572
+ if (logLevel >= LogLevel.ALL) {
573
+ return LogLevelLabel.ALL;
574
+ }
575
+ if (logLevel >= LogLevel.TRACE) {
576
+ return LogLevelLabel.TRACE;
577
+ }
578
+ if (logLevel >= LogLevel.DEBUG) {
579
+ return LogLevelLabel.DEBUG;
580
+ }
581
+ if (logLevel >= LogLevel.INFO) {
582
+ return LogLevelLabel.INFO;
583
+ }
584
+ if (logLevel >= LogLevel.WARN) {
585
+ return LogLevelLabel.WARN;
586
+ }
587
+ if (logLevel >= LogLevel.ERROR) {
588
+ return LogLevelLabel.ERROR;
589
+ }
590
+ if (logLevel >= LogLevel.FATAL) {
591
+ return LogLevelLabel.FATAL;
592
+ }
593
+ if (logLevel <= LogLevel.SILENT) {
594
+ return LogLevelLabel.SILENT;
595
+ }
596
+ return LogLevelLabel.INFO;
597
+ }, "getLogLevelLabel");
598
+ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
599
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
600
+ return logLevel >= LogLevel.DEBUG;
601
+ }, "isVerbose");
602
+
603
+ // ../config-tools/src/logger/console.ts
604
+ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
605
+ 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;
606
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
607
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
608
+ return (_) => {
609
+ };
610
+ }
611
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
612
+ return (message) => {
613
+ console.error(`
614
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
615
+ `);
616
+ };
617
+ }
618
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
619
+ return (message) => {
620
+ console.error(`
621
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
622
+ `);
623
+ };
624
+ }
625
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
626
+ return (message) => {
627
+ console.warn(`
628
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
629
+ `);
630
+ };
631
+ }
632
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
633
+ return (message) => {
634
+ console.info(`
635
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
636
+ `);
637
+ };
638
+ }
639
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
640
+ return (message) => {
641
+ console.info(`
642
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
643
+ `);
644
+ };
645
+ }
646
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
647
+ return (message) => {
648
+ console.debug(`
649
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
650
+ `);
651
+ };
652
+ }
653
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
654
+ return (message) => {
655
+ console.debug(`
656
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
657
+ `);
658
+ };
659
+ }
660
+ return (message) => {
661
+ console.log(`
662
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
663
+ `);
664
+ };
665
+ }, "getLogFn");
666
+ var writeFatal = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
667
+ var writeError = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
668
+ var writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.WARN, config)(message), "writeWarning");
669
+ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.INFO, config)(message), "writeInfo");
670
+ var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
671
+ var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
672
+ var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
673
+ var getStopwatch = /* @__PURE__ */ __name((name) => {
674
+ const start = process.hrtime();
675
+ return () => {
676
+ const end = process.hrtime(start);
677
+ console.info(`
678
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(end[0] * 1e3 + end[1] / 1e6)}ms to complete
679
+
680
+ `);
681
+ };
682
+ }, "getStopwatch");
683
+ var MAX_DEPTH = 4;
684
+ var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth2 = 0) => {
685
+ if (depth2 > MAX_DEPTH) {
686
+ return "<max depth>";
687
+ }
688
+ const prefix = options.prefix ?? "-";
689
+ const skip2 = options.skip ?? [];
690
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
691
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
692
+ prefix: `${prefix}-`,
693
+ skip: skip2
694
+ }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
695
+ ${Object.keys(message).filter((key) => !skip2.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
696
+ prefix: `${prefix}-`,
697
+ skip: skip2
698
+ }, depth2 + 1) : message[key]}`).join("\n")}` : message;
699
+ }, "formatLogMessage");
700
+ var _isFunction = /* @__PURE__ */ __name((value) => {
701
+ try {
702
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
703
+ } catch (e) {
704
+ return false;
705
+ }
706
+ }, "_isFunction");
707
+
708
+ // ../config-tools/src/utilities/apply-workspace-tokens.ts
709
+ var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams) => {
710
+ let result = option;
711
+ if (!result) {
712
+ return result;
713
+ }
714
+ if (tokenParams) {
715
+ const optionKeys = Object.keys(tokenParams);
716
+ if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
717
+ for (const optionKey of optionKeys) {
718
+ if (result.includes(`{${optionKey}}`)) {
719
+ result = result.replaceAll(`{${optionKey}}`, tokenParams?.[optionKey] || "");
720
+ }
721
+ }
722
+ }
723
+ }
724
+ if (tokenParams.config) {
725
+ const configKeys = Object.keys(tokenParams.config);
726
+ if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
727
+ for (const configKey of configKeys) {
728
+ if (result.includes(`{${configKey}}`)) {
729
+ result = result.replaceAll(`{${configKey}}`, tokenParams.config[configKey] || "");
730
+ }
731
+ }
732
+ }
733
+ }
734
+ if (result.includes("{workspaceRoot}")) {
735
+ result = result.replaceAll("{workspaceRoot}", tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot());
736
+ }
737
+ return result;
738
+ }, "applyWorkspaceBaseTokens");
739
+ var applyWorkspaceProjectTokens = /* @__PURE__ */ __name((option, tokenParams) => {
740
+ return applyWorkspaceBaseTokens(option, tokenParams);
741
+ }, "applyWorkspaceProjectTokens");
742
+ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, tokenParams, tokenizerFn) => {
743
+ if (!options) {
744
+ return {};
745
+ }
746
+ const result = {};
747
+ for (const option of Object.keys(options)) {
748
+ if (typeof options[option] === "string") {
749
+ result[option] = await Promise.resolve(tokenizerFn(options[option], tokenParams));
750
+ } else if (Array.isArray(options[option])) {
751
+ result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item));
752
+ } else if (typeof options[option] === "object") {
753
+ result[option] = await applyWorkspaceTokens(options[option], tokenParams, tokenizerFn);
754
+ } else {
755
+ result[option] = options[option];
756
+ }
757
+ }
758
+ return result;
759
+ }, "applyWorkspaceTokens");
760
+
761
+ // ../config-tools/src/utilities/run.ts
762
+ import { exec, execSync } from "node:child_process";
763
+ var LARGE_BUFFER = 1024 * 1e6;
764
+ var run = /* @__PURE__ */ __name((config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
765
+ return execSync(command, {
766
+ cwd,
767
+ env: {
768
+ ...process.env,
769
+ ...env,
770
+ CLICOLOR: "true",
771
+ FORCE_COLOR: "true"
772
+ },
773
+ windowsHide: true,
774
+ stdio,
775
+ maxBuffer: LARGE_BUFFER,
776
+ killSignal: "SIGTERM"
777
+ });
778
+ }, "run");
779
+
780
+ // ../config-tools/src/config-file/get-config-file.ts
781
+ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
782
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
783
+ const configs = await Promise.all([
784
+ loadConfig({
785
+ cwd: workspacePath,
786
+ packageJson: true,
787
+ name: fileName,
788
+ envName: fileName?.toUpperCase(),
789
+ jitiOptions: {
790
+ debug: false,
791
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
792
+ },
793
+ ...options
794
+ }),
795
+ loadConfig({
796
+ cwd: workspacePath,
797
+ packageJson: true,
798
+ name: fileName,
799
+ envName: fileName?.toUpperCase(),
800
+ jitiOptions: {
801
+ debug: false,
802
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
803
+ },
804
+ configFile: fileName,
805
+ ...options
806
+ })
807
+ ]);
808
+ return defu(configs[0] ?? {}, configs[1] ?? {});
809
+ }, "getConfigFileByName");
810
+ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
811
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
812
+ const result = await getConfigFileByName("storm", workspacePath);
813
+ let config = result.config;
814
+ const configFile = result.configFile;
815
+ if (config && configFile && Object.keys(config).length > 0) {
816
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
817
+ logLevel: "all"
818
+ });
819
+ }
820
+ if (additionalFileNames && additionalFileNames.length > 0) {
821
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
822
+ for (const result2 of results) {
823
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
824
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
825
+ logLevel: "all"
826
+ });
827
+ config = defu(result2.config ?? {}, config ?? {});
828
+ }
829
+ }
830
+ }
831
+ if (!config) {
832
+ return void 0;
833
+ }
834
+ config.configFile = configFile;
835
+ return config;
836
+ }, "getConfigFile");
837
+
838
+ // ../config-tools/src/create-storm-config.ts
839
+ import defu2 from "defu";
840
+
841
+ // ../config-tools/src/env/get-env.ts
842
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
843
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
844
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
845
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
846
+ if (name) {
847
+ ret[name] = process.env[key];
848
+ }
849
+ return ret;
850
+ }, {});
851
+ }, "getExtensionEnv");
852
+ var getConfigEnv = /* @__PURE__ */ __name(() => {
853
+ const prefix = "STORM_";
854
+ let config = {
855
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
856
+ name: process.env[`${prefix}NAME`] || void 0,
857
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
858
+ owner: process.env[`${prefix}OWNER`] || void 0,
859
+ bot: {
860
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
861
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
862
+ },
863
+ organization: process.env[`${prefix}ORGANIZATION`] || void 0,
864
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
865
+ license: process.env[`${prefix}LICENSE`] || void 0,
866
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
867
+ docs: process.env[`${prefix}DOCS`] || void 0,
868
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
869
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
870
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
871
+ configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
872
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
873
+ directories: {
874
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : void 0,
875
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : void 0,
876
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : void 0,
877
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : void 0,
878
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : void 0,
879
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : void 0
880
+ },
881
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
882
+ env: (process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
883
+ // ci:
884
+ // process.env[`${prefix}CI`] !== undefined
885
+ // ? Boolean(
886
+ // process.env[`${prefix}CI`] ??
887
+ // process.env.CI ??
888
+ // process.env.CONTINUOUS_INTEGRATION
889
+ // )
890
+ // : undefined,
891
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
892
+ branch: process.env[`${prefix}BRANCH`] || void 0,
893
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
894
+ externalPackagePatterns: process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] ? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`]) : [],
895
+ registry: {
896
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
897
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
898
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
899
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
900
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
901
+ },
902
+ 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
903
+ };
904
+ 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}`)));
905
+ config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
906
+ ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
907
+ return ret;
908
+ }, {}) : getThemeColorConfigEnv(prefix);
909
+ if (config.docs === STORM_DEFAULT_DOCS) {
910
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
911
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
912
+ } else {
913
+ config.docs = `${config.homepage}/docs`;
914
+ }
915
+ }
916
+ if (config.licensing === STORM_DEFAULT_LICENSING) {
917
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
918
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
919
+ } else {
920
+ config.licensing = `${config.homepage}/docs`;
921
+ }
922
+ }
923
+ const serializedConfig = process.env[`${prefix}CONFIG`];
924
+ if (serializedConfig) {
925
+ const parsed = JSON.parse(serializedConfig);
926
+ config = {
927
+ ...config,
928
+ ...parsed,
929
+ colors: {
930
+ ...config.colors,
931
+ ...parsed.colors
932
+ },
933
+ extensions: {
934
+ ...config.extensions,
935
+ ...parsed.extensions
936
+ }
937
+ };
938
+ }
939
+ return config;
940
+ }, "getConfigEnv");
941
+ var getThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, theme) => {
942
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
943
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
944
+ }, "getThemeColorConfigEnv");
945
+ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
946
+ return {
947
+ dark: process.env[`${prefix}DARK`],
948
+ light: process.env[`${prefix}LIGHT`],
949
+ brand: process.env[`${prefix}BRAND`],
950
+ alternate: process.env[`${prefix}ALTERNATE`],
951
+ accent: process.env[`${prefix}ACCENT`],
952
+ link: process.env[`${prefix}LINK`],
953
+ help: process.env[`${prefix}HELP`],
954
+ success: process.env[`${prefix}SUCCESS`],
955
+ info: process.env[`${prefix}INFO`],
956
+ warning: process.env[`${prefix}WARNING`],
957
+ danger: process.env[`${prefix}DANGER`],
958
+ fatal: process.env[`${prefix}FATAL`],
959
+ positive: process.env[`${prefix}POSITIVE`],
960
+ negative: process.env[`${prefix}NEGATIVE`]
961
+ };
962
+ }, "getSingleThemeColorConfigEnv");
963
+ var getMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
964
+ return {
965
+ light: getBaseThemeColorConfigEnv(`${prefix}_LIGHT_`),
966
+ dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
967
+ };
968
+ }, "getMultiThemeColorConfigEnv");
969
+ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
970
+ return {
971
+ foreground: process.env[`${prefix}FOREGROUND`],
972
+ background: process.env[`${prefix}BACKGROUND`],
973
+ brand: process.env[`${prefix}BRAND`],
974
+ alternate: process.env[`${prefix}ALTERNATE`],
975
+ accent: process.env[`${prefix}ACCENT`],
976
+ link: process.env[`${prefix}LINK`],
977
+ help: process.env[`${prefix}HELP`],
978
+ success: process.env[`${prefix}SUCCESS`],
979
+ info: process.env[`${prefix}INFO`],
980
+ warning: process.env[`${prefix}WARNING`],
981
+ danger: process.env[`${prefix}DANGER`],
982
+ fatal: process.env[`${prefix}FATAL`],
983
+ positive: process.env[`${prefix}POSITIVE`],
984
+ negative: process.env[`${prefix}NEGATIVE`]
985
+ };
986
+ }, "getBaseThemeColorConfigEnv");
987
+
988
+ // ../config-tools/src/env/set-env.ts
989
+ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
990
+ for (const key of Object.keys(extension ?? {})) {
991
+ if (extension[key]) {
992
+ const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
993
+ let extensionKey;
994
+ if (result.length === 0) {
995
+ return;
996
+ }
997
+ if (result.length === 1) {
998
+ extensionKey = result[0]?.toUpperCase() ?? "";
999
+ } else {
1000
+ extensionKey = result.reduce((ret, part) => {
1001
+ return `${ret}_${part.toLowerCase()}`;
1002
+ });
1003
+ }
1004
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
1005
+ }
1006
+ }
1007
+ }, "setExtensionEnv");
1008
+ var setConfigEnv = /* @__PURE__ */ __name((config) => {
1009
+ const prefix = "STORM_";
1010
+ if (config.extends) {
1011
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
1012
+ }
1013
+ if (config.name) {
1014
+ process.env[`${prefix}NAME`] = config.name;
1015
+ }
1016
+ if (config.namespace) {
1017
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
1018
+ }
1019
+ if (config.owner) {
1020
+ process.env[`${prefix}OWNER`] = config.owner;
1021
+ }
1022
+ if (config.bot) {
1023
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
1024
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
1025
+ }
1026
+ if (config.organization) {
1027
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
1028
+ }
1029
+ if (config.packageManager) {
1030
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1031
+ }
1032
+ if (config.license) {
1033
+ process.env[`${prefix}LICENSE`] = config.license;
1034
+ }
1035
+ if (config.homepage) {
1036
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
1037
+ }
1038
+ if (config.docs) {
1039
+ process.env[`${prefix}DOCS`] = config.docs;
1040
+ }
1041
+ if (config.licensing) {
1042
+ process.env[`${prefix}LICENSING`] = config.licensing;
1043
+ }
1044
+ if (config.timezone) {
1045
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
1046
+ process.env.TZ = config.timezone;
1047
+ process.env.DEFAULT_TIMEZONE = config.timezone;
1048
+ }
1049
+ if (config.locale) {
1050
+ process.env[`${prefix}LOCALE`] = config.locale;
1051
+ process.env.LOCALE = config.locale;
1052
+ process.env.DEFAULT_LOCALE = config.locale;
1053
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1054
+ }
1055
+ if (config.configFile) {
1056
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
1057
+ }
1058
+ if (config.workspaceRoot) {
1059
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1060
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1061
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1062
+ }
1063
+ if (config.directories) {
1064
+ if (!config.skipCache && config.directories.cache) {
1065
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
1066
+ }
1067
+ if (config.directories.data) {
1068
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1069
+ }
1070
+ if (config.directories.config) {
1071
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
1072
+ }
1073
+ if (config.directories.temp) {
1074
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1075
+ }
1076
+ if (config.directories.log) {
1077
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1078
+ }
1079
+ if (config.directories.build) {
1080
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
1081
+ }
1082
+ }
1083
+ if (config.skipCache !== void 0) {
1084
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1085
+ if (config.skipCache) {
1086
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1087
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1088
+ }
1089
+ }
1090
+ if (config.env) {
1091
+ process.env[`${prefix}ENV`] = config.env;
1092
+ process.env.NODE_ENV = config.env;
1093
+ process.env.ENVIRONMENT = config.env;
1094
+ }
1095
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
1096
+ for (const key of Object.keys(config.colors)) {
1097
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1098
+ }
1099
+ } else {
1100
+ setThemeColorConfigEnv(`${prefix}COLOR_`, config.colors);
1101
+ }
1102
+ if (config.repository) {
1103
+ process.env[`${prefix}REPOSITORY`] = config.repository;
1104
+ }
1105
+ if (config.branch) {
1106
+ process.env[`${prefix}BRANCH`] = config.branch;
1107
+ }
1108
+ if (config.preid) {
1109
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
1110
+ }
1111
+ if (config.externalPackagePatterns) {
1112
+ process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(config.externalPackagePatterns);
1113
+ }
1114
+ if (config.registry) {
1115
+ if (config.registry.github) {
1116
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1117
+ }
1118
+ if (config.registry.npm) {
1119
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1120
+ }
1121
+ if (config.registry.cargo) {
1122
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1123
+ }
1124
+ if (config.registry.cyclone) {
1125
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
1126
+ }
1127
+ if (config.registry.container) {
1128
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.cyclone);
1129
+ }
1130
+ }
1131
+ if (config.logLevel) {
1132
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1133
+ process.env.LOG_LEVEL = String(config.logLevel);
1134
+ process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
1135
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1136
+ }
1137
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
1138
+ for (const key of Object.keys(config.extensions ?? {})) {
1139
+ config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
1140
+ }
1141
+ }, "setConfigEnv");
1142
+ var setThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1143
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
1144
+ }, "setThemeColorConfigEnv");
1145
+ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1146
+ if (config.dark) {
1147
+ process.env[`${prefix}DARK`] = config.dark;
1148
+ }
1149
+ if (config.light) {
1150
+ process.env[`${prefix}LIGHT`] = config.light;
1151
+ }
1152
+ if (config.brand) {
1153
+ process.env[`${prefix}BRAND`] = config.brand;
1154
+ }
1155
+ if (config.alternate) {
1156
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1157
+ }
1158
+ if (config.accent) {
1159
+ process.env[`${prefix}ACCENT`] = config.accent;
1160
+ }
1161
+ if (config.link) {
1162
+ process.env[`${prefix}LINK`] = config.link;
1163
+ }
1164
+ if (config.help) {
1165
+ process.env[`${prefix}HELP`] = config.help;
1166
+ }
1167
+ if (config.success) {
1168
+ process.env[`${prefix}SUCCESS`] = config.success;
1169
+ }
1170
+ if (config.info) {
1171
+ process.env[`${prefix}INFO`] = config.info;
1172
+ }
1173
+ if (config.warning) {
1174
+ process.env[`${prefix}WARNING`] = config.warning;
1175
+ }
1176
+ if (config.danger) {
1177
+ process.env[`${prefix}DANGER`] = config.danger;
1178
+ }
1179
+ if (config.fatal) {
1180
+ process.env[`${prefix}FATAL`] = config.fatal;
1181
+ }
1182
+ if (config.positive) {
1183
+ process.env[`${prefix}POSITIVE`] = config.positive;
1184
+ }
1185
+ if (config.negative) {
1186
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1187
+ }
1188
+ }, "setSingleThemeColorConfigEnv");
1189
+ var setMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1190
+ return {
1191
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
1192
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
1193
+ };
1194
+ }, "setMultiThemeColorConfigEnv");
1195
+ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1196
+ if (config.foreground) {
1197
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
1198
+ }
1199
+ if (config.background) {
1200
+ process.env[`${prefix}BACKGROUND`] = config.background;
1201
+ }
1202
+ if (config.brand) {
1203
+ process.env[`${prefix}BRAND`] = config.brand;
1204
+ }
1205
+ if (config.alternate) {
1206
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1207
+ }
1208
+ if (config.accent) {
1209
+ process.env[`${prefix}ACCENT`] = config.accent;
1210
+ }
1211
+ if (config.link) {
1212
+ process.env[`${prefix}LINK`] = config.link;
1213
+ }
1214
+ if (config.help) {
1215
+ process.env[`${prefix}HELP`] = config.help;
1216
+ }
1217
+ if (config.success) {
1218
+ process.env[`${prefix}SUCCESS`] = config.success;
1219
+ }
1220
+ if (config.info) {
1221
+ process.env[`${prefix}INFO`] = config.info;
1222
+ }
1223
+ if (config.warning) {
1224
+ process.env[`${prefix}WARNING`] = config.warning;
1225
+ }
1226
+ if (config.danger) {
1227
+ process.env[`${prefix}DANGER`] = config.danger;
1228
+ }
1229
+ if (config.fatal) {
1230
+ process.env[`${prefix}FATAL`] = config.fatal;
1231
+ }
1232
+ if (config.positive) {
1233
+ process.env[`${prefix}POSITIVE`] = config.positive;
1234
+ }
1235
+ if (config.negative) {
1236
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1237
+ }
1238
+ }, "setBaseThemeColorConfigEnv");
1239
+
1240
+ // ../config-tools/src/create-storm-config.ts
1241
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
1242
+ var _static_cache = void 0;
1243
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot3, skipLogs = false) => {
1244
+ let result;
1245
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1246
+ let _workspaceRoot = workspaceRoot3;
1247
+ if (!_workspaceRoot) {
1248
+ _workspaceRoot = findWorkspaceRoot();
1249
+ }
1250
+ const configEnv = getConfigEnv();
1251
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
1252
+ const configFile = await getConfigFile(_workspaceRoot);
1253
+ if (!configFile && !skipLogs) {
1254
+ 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", {
1255
+ logLevel: "all"
1256
+ });
1257
+ }
1258
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
1259
+ result.workspaceRoot ??= _workspaceRoot;
1260
+ } else {
1261
+ result = _static_cache.data;
1262
+ }
1263
+ if (schema && extensionName) {
1264
+ result.extensions = {
1265
+ ...result.extensions,
1266
+ [extensionName]: createConfigExtension(extensionName, schema)
1267
+ };
1268
+ }
1269
+ _static_cache = {
1270
+ timestamp: Date.now(),
1271
+ data: result
1272
+ };
1273
+ return result;
1274
+ }, "createStormConfig");
1275
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
1276
+ const extension_cache_key = {
1277
+ extensionName
1278
+ };
1279
+ if (_extension_cache.has(extension_cache_key)) {
1280
+ return _extension_cache.get(extension_cache_key);
1281
+ }
1282
+ let extension = getExtensionEnv(extensionName);
1283
+ if (schema) {
1284
+ extension = schema.parse(extension);
1285
+ }
1286
+ _extension_cache.set(extension_cache_key, extension);
1287
+ return extension;
1288
+ }, "createConfigExtension");
1289
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot3, skipLogs = false) => {
1290
+ const config = await createStormConfig(void 0, void 0, workspaceRoot3, skipLogs);
1291
+ setConfigEnv(config);
1292
+ if (!skipLogs) {
1293
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
1294
+ ${formatLogMessage(config)}`, config);
1295
+ }
1296
+ return config;
1297
+ }, "loadStormConfig");
1298
+
1299
+ // ../config-tools/src/get-config.ts
1300
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot3, skipLogs = false) => {
1301
+ return loadStormConfig(workspaceRoot3, skipLogs);
1302
+ }, "getConfig");
1303
+
1304
+ // ../workspace-tools/src/base/base-executor.ts
1305
+ import { defu as defu3 } from "defu";
1306
+ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context2) => {
1307
+ const stopwatch = getStopwatch(name);
1308
+ let options = _options;
1309
+ let config = {};
1310
+ try {
1311
+ if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
1312
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1313
+ }
1314
+ const workspaceRoot3 = findWorkspaceRoot();
1315
+ const projectRoot = context2.projectsConfigurations.projects[context2.projectName].root || workspaceRoot3;
1316
+ const sourceRoot = context2.projectsConfigurations.projects[context2.projectName].sourceRoot || projectRoot || workspaceRoot3;
1317
+ const projectName = context2.projectName;
1318
+ config.workspaceRoot = workspaceRoot3;
1319
+ writeInfo(`
1320
+ \u26A1 Running the ${name} executor for ${projectName}
1321
+ `, config);
1322
+ if (!executorOptions.skipReadingConfig) {
1323
+ writeTrace(`Loading the Storm Config from environment variables and storm.config.js file...
1324
+ - workspaceRoot: ${workspaceRoot3}
1325
+ - projectRoot: ${projectRoot}
1326
+ - sourceRoot: ${sourceRoot}
1327
+ - projectName: ${projectName}
1328
+ `, config);
1329
+ config = await getConfig(workspaceRoot3);
1330
+ }
1331
+ if (executorOptions?.hooks?.applyDefaultOptions) {
1332
+ writeDebug("Running the applyDefaultOptions hook...", config);
1333
+ options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
1334
+ writeDebug("Completed the applyDefaultOptions hook", config);
1335
+ }
1336
+ writeTrace(`Executor schema options \u2699\uFE0F
1337
+ ${formatLogMessage(options)}
1338
+ `, config);
1339
+ const tokenized = await applyWorkspaceTokens(options, defu3({
1340
+ workspaceRoot: workspaceRoot3,
1341
+ projectRoot,
1342
+ sourceRoot,
1343
+ projectName,
1344
+ config
1345
+ }, config, context2.projectsConfigurations.projects[context2.projectName]), applyWorkspaceProjectTokens);
1346
+ writeTrace(`Executor schema tokenized options \u2699\uFE0F
1347
+ ${formatLogMessage(tokenized)}
1348
+ `, config);
1349
+ if (executorOptions?.hooks?.preProcess) {
1350
+ writeDebug("Running the preProcess hook...", config);
1351
+ await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
1352
+ writeDebug("Completed the preProcess hook", config);
1353
+ }
1354
+ const ret = executorFn(tokenized, context2, config);
1355
+ if (_isFunction2(ret?.next)) {
1356
+ const asyncGen = ret;
1357
+ for await (const iter of asyncGen) {
1358
+ }
1359
+ }
1360
+ const result = await Promise.resolve(ret);
1361
+ if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
1362
+ writeTrace(`Failure determined by the ${name} executor
1363
+ ${formatLogMessage(result)}`, config);
1364
+ console.error(result);
1365
+ throw new Error(`The ${name} executor failed to run`, {
1366
+ cause: result?.error
1367
+ });
1368
+ }
1369
+ if (executorOptions?.hooks?.postProcess) {
1370
+ writeDebug("Running the postProcess hook...", config);
1371
+ await Promise.resolve(executorOptions.hooks.postProcess(config));
1372
+ writeDebug("Completed the postProcess hook", config);
1373
+ }
1374
+ writeSuccess(`Completed running the ${name} task executor!
1375
+ `, config);
1376
+ return {
1377
+ success: true
1378
+ };
1379
+ } catch (error) {
1380
+ writeFatal("A fatal error occurred while running the executor - the process was forced to terminate", config);
1381
+ writeError(`An exception was thrown in the executor's process
1382
+ - Details: ${error.message}
1383
+ - Stacktrace: ${error.stack}`, config);
1384
+ return {
1385
+ success: false
1386
+ };
1387
+ } finally {
1388
+ stopwatch();
1389
+ }
1390
+ }, "withRunExecutor");
1391
+ var _isFunction2 = /* @__PURE__ */ __name((value) => {
1392
+ try {
1393
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
1394
+ } catch (e) {
1395
+ return false;
1396
+ }
1397
+ }, "_isFunction");
1398
+
1399
+ // ../workspace-tools/src/utils/cargo.ts
1400
+ import { joinPathFragments, workspaceRoot } from "@nx/devkit";
1401
+ import { execSync as execSync2, spawn } from "node:child_process";
1402
+ import { relative } from "node:path";
1403
+ var INVALID_CARGO_ARGS = [
1404
+ "allFeatures",
1405
+ "allTargets",
1406
+ "main",
1407
+ "outputPath",
1408
+ "package",
1409
+ "tsConfig"
1410
+ ];
1411
+ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context2) => {
1412
+ const args = [];
1413
+ if (options.toolchain && options.toolchain !== "stable") {
1414
+ args.push(`+${options.toolchain}`);
1415
+ }
1416
+ args.push(baseCommand);
1417
+ for (const [key, value] of Object.entries(options)) {
1418
+ if (key === "toolchain" || key === "release" || INVALID_CARGO_ARGS.includes(key)) {
1419
+ continue;
1420
+ }
1421
+ if (typeof value === "boolean") {
1422
+ if (value) {
1423
+ args.push(`--${key}`);
1424
+ }
1425
+ } else if (Array.isArray(value)) {
1426
+ for (const item of value) {
1427
+ args.push(`--${key}`, item);
1428
+ }
1429
+ } else {
1430
+ args.push(`--${key}`, String(value));
1431
+ }
1432
+ }
1433
+ if (context2.projectName) {
1434
+ args.push("-p", context2.projectName);
1435
+ }
1436
+ if (options.allFeatures && !args.includes("--all-features")) {
1437
+ args.push("--all-features");
1438
+ }
1439
+ if (options.allTargets && !args.includes("--all-targets")) {
1440
+ args.push("--all-targets");
1441
+ }
1442
+ if (options.release && !args.includes("--profile")) {
1443
+ args.push("--release");
1444
+ }
1445
+ if (options.outputPath && !args.includes("--target-dir")) {
1446
+ args.push("--target-dir", options.outputPath);
1447
+ }
1448
+ return args;
1449
+ }, "buildCargoCommand");
1450
+ async function cargoCommand(...args) {
1451
+ console.log(`> cargo ${args.join(" ")}`);
1452
+ args.push("--color", "always");
1453
+ return await Promise.resolve(runProcess("cargo", ...args));
1454
+ }
1455
+ __name(cargoCommand, "cargoCommand");
1456
+ function cargoCommandSync(args = "", options) {
1457
+ const normalizedOptions = {
1458
+ stdio: options?.stdio ?? "inherit",
1459
+ env: {
1460
+ ...process.env,
1461
+ ...options?.env
1462
+ }
1463
+ };
1464
+ try {
1465
+ return {
1466
+ output: execSync2(`cargo ${args}`, {
1467
+ encoding: "utf8",
1468
+ windowsHide: true,
1469
+ stdio: normalizedOptions.stdio,
1470
+ env: normalizedOptions.env,
1471
+ maxBuffer: 1024 * 1024 * 10
1472
+ }),
1473
+ success: true
1474
+ };
1475
+ } catch (e) {
1476
+ return {
1477
+ output: e,
1478
+ success: false
1479
+ };
1480
+ }
1481
+ }
1482
+ __name(cargoCommandSync, "cargoCommandSync");
1483
+ function cargoMetadata() {
1484
+ const output3 = cargoCommandSync("metadata --format-version=1", {
1485
+ stdio: "pipe"
1486
+ });
1487
+ if (!output3.success) {
1488
+ console.error("Failed to get cargo metadata");
1489
+ return null;
1490
+ }
1491
+ return JSON.parse(output3.output);
1492
+ }
1493
+ __name(cargoMetadata, "cargoMetadata");
1494
+ function runProcess(processCmd, ...args) {
1495
+ const metadata = cargoMetadata();
1496
+ const targetDir = metadata?.target_directory ?? joinPathFragments(workspaceRoot, "dist", "cargo");
1497
+ return new Promise((resolve) => {
1498
+ if (process.env.VERCEL) {
1499
+ return resolve({
1500
+ success: true
1501
+ });
1502
+ }
1503
+ execSync2(`${processCmd} ${args.join(" ")}`, {
1504
+ cwd: process.cwd(),
1505
+ env: {
1506
+ ...process.env,
1507
+ RUSTC_WRAPPER: "",
1508
+ CARGO_TARGET_DIR: targetDir,
1509
+ CARGO_BUILD_TARGET_DIR: targetDir
1510
+ },
1511
+ windowsHide: true,
1512
+ stdio: [
1513
+ "inherit",
1514
+ "inherit",
1515
+ "inherit"
1516
+ ]
1517
+ });
1518
+ resolve({
1519
+ success: true
1520
+ });
1521
+ });
1522
+ }
1523
+ __name(runProcess, "runProcess");
1524
+
1525
+ // ../workspace-tools/src/executors/cargo-build/executor.ts
1526
+ async function cargoBuildExecutor(options, context2) {
1527
+ const command = buildCargoCommand("build", options, context2);
1528
+ return await cargoCommand(...command);
1529
+ }
1530
+ __name(cargoBuildExecutor, "cargoBuildExecutor");
1531
+ var executor_default = withRunExecutor("Cargo Build", cargoBuildExecutor, {
1532
+ skipReadingConfig: false,
1533
+ hooks: {
1534
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
1535
+ options.outputPath ??= "dist/target/{projectRoot}";
1536
+ options.toolchain ??= "stable";
1537
+ return options;
1538
+ }, "applyDefaultOptions")
1539
+ }
1540
+ });
1541
+
1542
+ // ../workspace-tools/src/executors/cargo-check/executor.ts
1543
+ async function cargoCheckExecutor(options, context2) {
1544
+ const command = buildCargoCommand("check", options, context2);
1545
+ return await cargoCommand(...command);
1546
+ }
1547
+ __name(cargoCheckExecutor, "cargoCheckExecutor");
1548
+ var executor_default2 = withRunExecutor("Cargo Check", cargoCheckExecutor, {
1549
+ skipReadingConfig: false,
1550
+ hooks: {
1551
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
1552
+ options.toolchain ??= "stable";
1553
+ return options;
1554
+ }, "applyDefaultOptions")
1555
+ }
1556
+ });
1557
+
1558
+ // ../workspace-tools/src/executors/cargo-clippy/executor.ts
1559
+ async function cargoClippyExecutor(options, context2) {
1560
+ const command = buildCargoCommand("clippy", options, context2);
1561
+ return await cargoCommand(...command);
1562
+ }
1563
+ __name(cargoClippyExecutor, "cargoClippyExecutor");
1564
+ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
1565
+ skipReadingConfig: false,
1566
+ hooks: {
1567
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
1568
+ options.toolchain ??= "stable";
1569
+ options.fix ??= false;
1570
+ return options;
1571
+ }, "applyDefaultOptions")
1572
+ }
1573
+ });
1574
+
1575
+ // ../workspace-tools/src/executors/cargo-doc/executor.ts
1576
+ async function cargoDocExecutor(options, context2) {
1577
+ const opts = {
1578
+ ...options
1579
+ };
1580
+ opts["no-deps"] = opts.noDeps;
1581
+ delete opts.noDeps;
1582
+ const command = buildCargoCommand("doc", options, context2);
1583
+ return await cargoCommand(...command);
1584
+ }
1585
+ __name(cargoDocExecutor, "cargoDocExecutor");
1586
+ var executor_default4 = withRunExecutor("Cargo Doc", cargoDocExecutor, {
1587
+ skipReadingConfig: false,
1588
+ hooks: {
1589
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
1590
+ options.outputPath ??= "dist/docs/{projectRoot}";
1591
+ options.toolchain ??= "stable";
1592
+ options.release ??= options.profile ? false : true;
1593
+ options.allFeatures ??= true;
1594
+ options.lib ??= true;
1595
+ options.bins ??= true;
1596
+ options.examples ??= true;
1597
+ options.noDeps ??= false;
1598
+ return options;
1599
+ }, "applyDefaultOptions")
1600
+ }
1601
+ });
1602
+
1603
+ // ../workspace-tools/src/executors/cargo-format/executor.ts
1604
+ async function cargoFormatExecutor(options, context2) {
1605
+ const command = buildCargoCommand("fmt", options, context2);
1606
+ return await cargoCommand(...command);
1607
+ }
1608
+ __name(cargoFormatExecutor, "cargoFormatExecutor");
1609
+ var executor_default5 = withRunExecutor("Cargo Format", cargoFormatExecutor, {
1610
+ skipReadingConfig: false,
1611
+ hooks: {
1612
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
1613
+ options.outputPath ??= "dist/target/{projectRoot}";
1614
+ options.toolchain ??= "stable";
1615
+ return options;
1616
+ }, "applyDefaultOptions")
1617
+ }
1618
+ });
1619
+
1620
+ // ../workspace-tools/src/executors/cargo-publish/executor.ts
1621
+ import { joinPathFragments as joinPathFragments2 } from "@nx/devkit";
1622
+ import { execSync as execSync3 } from "node:child_process";
1623
+ import { readFileSync } from "node:fs";
1624
+ import https from "node:https";
1625
+
1626
+ // ../workspace-tools/src/utils/toml.ts
1627
+ import TOML from "@ltd/j-toml";
1628
+ import { logger } from "@nx/devkit";
1629
+
1630
+ // ../workspace-tools/src/executors/cargo-publish/executor.ts
1631
+ var LARGE_BUFFER2 = 1024 * 1e6;
1632
+
1633
+ // ../esbuild/src/build.ts
1634
+ import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph, writeJsonFile } from "@nx/devkit";
1635
+
1636
+ // ../build-tools/src/config.ts
1637
+ var DEFAULT_COMPILED_BANNER = `
1638
+ /**
1639
+ * \u26A1 Built by Storm Software
1640
+ */
1641
+
1642
+ `;
1643
+ var DEFAULT_ENVIRONMENT = "production";
1644
+ var DEFAULT_TARGET = "esnext";
1645
+ var DEFAULT_ORGANIZATION = "storm-software";
1646
+
1647
+ // ../build-tools/src/plugins/swc.ts
1648
+ import { transform } from "@swc/core";
1649
+
1650
+ // ../build-tools/src/plugins/ts-resolve.ts
1651
+ import fs from "node:fs";
1652
+ import { builtinModules } from "node:module";
1653
+ import path from "node:path";
1654
+ import _resolve from "resolve";
1655
+
1656
+ // ../build-tools/src/plugins/type-definitions.ts
1657
+ import { stripIndents } from "@nx/devkit";
1658
+ import { relative as relative2 } from "path";
1659
+
1660
+ // ../build-tools/src/utilities/copy-assets.ts
1661
+ import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
1662
+ import { glob } from "glob";
1663
+ import { readFile as readFile2, writeFile } from "node:fs/promises";
1664
+ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson3 = true, includeSrc = false, banner, footer) => {
1665
+ const pendingAssets = Array.from(assets ?? []);
1666
+ pendingAssets.push({
1667
+ input: projectRoot,
1668
+ glob: "*.md",
1669
+ output: "."
1670
+ });
1671
+ pendingAssets.push({
1672
+ input: ".",
1673
+ glob: "LICENSE",
1674
+ output: "."
1675
+ });
1676
+ if (generatePackageJson3 === false) {
1677
+ pendingAssets.push({
1678
+ input: projectRoot,
1679
+ glob: "package.json",
1680
+ output: "."
1681
+ });
1682
+ }
1683
+ if (includeSrc === true) {
1684
+ pendingAssets.push({
1685
+ input: sourceRoot,
1686
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
1687
+ output: "src/"
1688
+ });
1689
+ }
1690
+ writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
1691
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
1692
+ const assetHandler = new CopyAssetsHandler({
1693
+ projectDir: projectRoot,
1694
+ rootDir: config.workspaceRoot,
1695
+ outputDir: outputPath,
1696
+ assets: pendingAssets
1697
+ });
1698
+ await assetHandler.processAllAssetsOnce();
1699
+ if (includeSrc === true) {
1700
+ writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
1701
+ const files = await glob([
1702
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
1703
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
1704
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
1705
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
1706
+ ]);
1707
+ await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
1708
+
1709
+ ${await readFile2(file, "utf8")}
1710
+
1711
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
1712
+ }
1713
+ }, "copyAssets");
1714
+
1715
+ // ../build-tools/src/utilities/generate-package-json.ts
1716
+ import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
1717
+ import { Glob } from "glob";
1718
+ import { existsSync as existsSync3 } from "node:fs";
1719
+ import { readFile as readFile3 } from "node:fs/promises";
1720
+ import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
1721
+ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, projectRoot, projectName, packageJson) => {
1722
+ const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph(), workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1723
+ const localPackages = [];
1724
+ for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot3)) {
1725
+ const projectNode = project.node;
1726
+ if (projectNode.data.root) {
1727
+ const projectPackageJsonPath = joinPaths(workspaceRoot3, projectNode.data.root, "package.json");
1728
+ if (existsSync3(projectPackageJsonPath)) {
1729
+ const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
1730
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
1731
+ if (projectPackageJson.private !== true) {
1732
+ localPackages.push(projectPackageJson);
1733
+ }
1734
+ }
1735
+ }
1736
+ }
1737
+ if (localPackages.length > 0) {
1738
+ writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
1739
+ packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
1740
+ if (!ret[localPackage.name]) {
1741
+ ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
1742
+ }
1743
+ return ret;
1744
+ }, packageJson.peerDependencies ?? {});
1745
+ packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
1746
+ if (!ret[localPackage.name]) {
1747
+ ret[localPackage.name] = {
1748
+ optional: false
1749
+ };
1750
+ }
1751
+ return ret;
1752
+ }, packageJson.peerDependenciesMeta ?? {});
1753
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
1754
+ if (!ret[localPackage.name]) {
1755
+ ret[localPackage.name] = localPackage.version || "0.0.1";
1756
+ }
1757
+ return ret;
1758
+ }, packageJson.peerDependencies ?? {});
1759
+ } else {
1760
+ writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
1761
+ }
1762
+ return packageJson;
1763
+ }, "addPackageDependencies");
1764
+ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
1765
+ const workspaceRoot3 = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
1766
+ const workspacePackageJsonContent = await readFile3(joinPaths(workspaceRoot3, "package.json"), "utf8");
1767
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
1768
+ packageJson.type ??= "module";
1769
+ packageJson.sideEffects ??= false;
1770
+ if (includeSrc === true) {
1771
+ let distSrc = sourceRoot.replace(projectRoot, "");
1772
+ if (distSrc.startsWith("/")) {
1773
+ distSrc = distSrc.substring(1);
1774
+ }
1775
+ packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
1776
+ }
1777
+ packageJson.files ??= [
1778
+ "dist/**/*"
1779
+ ];
1780
+ if (includeSrc === true && !packageJson.files.includes("src")) {
1781
+ packageJson.files.push("src/**/*");
1782
+ }
1783
+ packageJson.publishConfig ??= {
1784
+ access: "public"
1785
+ };
1786
+ packageJson.description ??= workspacePackageJson.description;
1787
+ packageJson.homepage ??= workspacePackageJson.homepage;
1788
+ packageJson.bugs ??= workspacePackageJson.bugs;
1789
+ packageJson.license ??= workspacePackageJson.license;
1790
+ packageJson.keywords ??= workspacePackageJson.keywords;
1791
+ packageJson.funding ??= workspacePackageJson.funding;
1792
+ packageJson.author ??= workspacePackageJson.author;
1793
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
1794
+ if (!packageJson.maintainers && packageJson.author) {
1795
+ packageJson.maintainers = [
1796
+ packageJson.author
1797
+ ];
1798
+ }
1799
+ packageJson.contributors ??= workspacePackageJson.contributors;
1800
+ if (!packageJson.contributors && packageJson.author) {
1801
+ packageJson.contributors = [
1802
+ packageJson.author
1803
+ ];
1804
+ }
1805
+ packageJson.repository ??= workspacePackageJson.repository;
1806
+ packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
1807
+ return packageJson;
1808
+ }, "addWorkspacePackageJsonFields");
1809
+ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot) => {
1810
+ let entry = file.replaceAll("\\", "/");
1811
+ if (sourceRoot) {
1812
+ entry = entry.replace(sourceRoot, "");
1813
+ }
1814
+ return {
1815
+ "import": {
1816
+ "types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
1817
+ "default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
1818
+ },
1819
+ "require": {
1820
+ "types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
1821
+ "default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
1822
+ },
1823
+ "default": {
1824
+ "types": `./dist/${entry}.d.ts`,
1825
+ "default": `./dist/${entry}.js`
1826
+ }
1827
+ };
1828
+ }, "addPackageJsonExport");
1829
+
1830
+ // ../build-tools/src/utilities/get-entry-points.ts
1831
+ import { glob as glob2 } from "glob";
1832
+ var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
1833
+ const workspaceRoot3 = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
1834
+ const entryPoints = [];
1835
+ if (entry) {
1836
+ if (Array.isArray(entry)) {
1837
+ entryPoints.push(...entry);
1838
+ } else if (typeof entry === "string") {
1839
+ entryPoints.push(entry);
1840
+ } else {
1841
+ entryPoints.push(...Object.values(entry));
1842
+ }
1843
+ }
1844
+ if (emitOnAll) {
1845
+ entryPoints.push(joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}"));
1846
+ }
1847
+ const results = [];
1848
+ for (const entryPoint in entryPoints) {
1849
+ if (entryPoint.includes("*")) {
1850
+ const files = await glob2(entryPoint, {
1851
+ withFileTypes: true
1852
+ });
1853
+ results.push(...files.reduce((ret, filePath) => {
1854
+ const result = correctPaths(joinPaths(filePath.path, filePath.name).replaceAll(correctPaths(workspaceRoot3), "").replaceAll(correctPaths(projectRoot), ""));
1855
+ if (result) {
1856
+ writeDebug(`Trying to add entry point ${result} at "${joinPaths(filePath.path, filePath.name)}"`, config);
1857
+ if (!results.includes(result)) {
1858
+ results.push(result);
1859
+ }
1860
+ }
1861
+ return ret;
1862
+ }, []));
1863
+ } else {
1864
+ results.push(entryPoint);
1865
+ }
1866
+ }
1867
+ return results;
1868
+ }, "getEntryPoints");
1869
+
1870
+ // ../build-tools/src/utilities/get-env.ts
1871
+ var getEnv = /* @__PURE__ */ __name((builder, options) => {
1872
+ return {
1873
+ STORM_BUILD: builder,
1874
+ STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
1875
+ STORM_NAME: options.name,
1876
+ STORM_ENV: options.envName || DEFAULT_ENVIRONMENT,
1877
+ STORM_PLATFORM: options.platform,
1878
+ STORM_FORMAT: JSON.stringify(options.format),
1879
+ STORM_TARGET: JSON.stringify(options.target),
1880
+ ...options.env
1881
+ };
1882
+ }, "getEnv");
1883
+
1884
+ // ../build-tools/src/utilities/get-out-extension.ts
1885
+ function getOutExtension(format2, pkgType) {
1886
+ let jsExtension = ".js";
1887
+ let dtsExtension = ".d.ts";
1888
+ if (pkgType === "module" && format2 === "cjs") {
1889
+ jsExtension = ".cjs";
1890
+ dtsExtension = ".d.cts";
1891
+ }
1892
+ if (pkgType !== "module" && format2 === "esm") {
1893
+ jsExtension = ".mjs";
1894
+ dtsExtension = ".d.mts";
1895
+ }
1896
+ if (format2 === "iife") {
1897
+ jsExtension = ".global.js";
1898
+ }
1899
+ return {
1900
+ js: jsExtension,
1901
+ dts: dtsExtension
1902
+ };
1903
+ }
1904
+ __name(getOutExtension, "getOutExtension");
1905
+
1906
+ // ../build-tools/src/utilities/read-nx-config.ts
1907
+ import { existsSync as existsSync4 } from "node:fs";
1908
+ import { readFile as readFile4 } from "node:fs/promises";
1909
+
1910
+ // ../build-tools/src/utilities/task-graph.ts
1911
+ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
1912
+
1913
+ // ../esbuild/src/build.ts
1914
+ import { watch as createWatcher } from "chokidar";
1915
+ import defu4 from "defu";
1916
+ import { debounce, flatten } from "es-toolkit";
1917
+ import { map } from "es-toolkit/compat";
1918
+ import * as esbuild2 from "esbuild";
1919
+ import { globbySync } from "globby";
1920
+ import { existsSync as existsSync6 } from "node:fs";
1921
+ import hf from "node:fs/promises";
1922
+ import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
1923
+
1924
+ // ../esbuild/src/base/renderer-engine.ts
1925
+ import path3 from "node:path";
1926
+ import { SourceMapConsumer, SourceMapGenerator } from "source-map";
1927
+
1928
+ // ../esbuild/src/utilities/output-file.ts
1929
+ import fs2 from "node:fs";
1930
+ import path2 from "node:path";
1931
+ var outputFile = /* @__PURE__ */ __name(async (filepath, data, options) => {
1932
+ await fs2.promises.mkdir(path2.dirname(filepath), {
1933
+ recursive: true
1934
+ });
1935
+ await fs2.promises.writeFile(filepath, data, options);
1936
+ }, "outputFile");
1937
+
1938
+ // ../esbuild/src/base/renderer-engine.ts
1939
+ var parseSourceMap = /* @__PURE__ */ __name((map2) => {
1940
+ return typeof map2 === "string" ? JSON.parse(map2) : map2;
1941
+ }, "parseSourceMap");
1942
+ var isJS = /* @__PURE__ */ __name((path7) => /\.(js|mjs|cjs)$/.test(path7), "isJS");
1943
+ var isCSS = /* @__PURE__ */ __name((path7) => /\.css$/.test(path7), "isCSS");
1944
+ var getSourcemapComment = /* @__PURE__ */ __name((inline, map2, filepath, isCssFile) => {
1945
+ if (!map2) return "";
1946
+ const prefix = isCssFile ? "/*" : "//";
1947
+ const suffix = isCssFile ? " */" : "";
1948
+ const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${path3.basename(filepath)}.map`;
1949
+ return `${prefix}# sourceMappingURL=${url}${suffix}`;
1950
+ }, "getSourcemapComment");
1951
+ var RendererEngine = class {
1952
+ static {
1953
+ __name(this, "RendererEngine");
1954
+ }
1955
+ #renderers;
1956
+ #options;
1957
+ constructor(renderers) {
1958
+ this.#renderers = renderers;
1959
+ }
1960
+ setOptions(options) {
1961
+ this.#options = options;
1962
+ }
1963
+ getOptions() {
1964
+ if (!this.#options) {
1965
+ throw new Error(`Renderer options is not set`);
1966
+ }
1967
+ return this.#options;
1968
+ }
1969
+ modifyEsbuildOptions(options) {
1970
+ for (const renderer of this.#renderers) {
1971
+ if (renderer.esbuildOptions) {
1972
+ renderer.esbuildOptions.call(this.getOptions(), options);
1973
+ }
1974
+ }
1975
+ }
1976
+ async buildStarted() {
1977
+ for (const renderer of this.#renderers) {
1978
+ if (renderer.buildStart) {
1979
+ await renderer.buildStart.call(this.getOptions());
1980
+ }
1981
+ }
1982
+ }
1983
+ async buildFinished({ outputFiles, metafile }) {
1984
+ const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
1985
+ if (isJS(file.path) || isCSS(file.path)) {
1986
+ let relativePath = path3.relative(this.getOptions().config.workspaceRoot, file.path);
1987
+ if (!relativePath.startsWith("\\\\?\\")) {
1988
+ relativePath = relativePath.replace(/\\/g, "/");
1989
+ }
1990
+ const meta = metafile?.outputs[relativePath];
1991
+ return {
1992
+ type: "chunk",
1993
+ path: file.path,
1994
+ code: file.text,
1995
+ map: outputFiles.find((f) => f.path === `${file.path}.map`)?.text,
1996
+ entryPoint: meta?.entryPoint,
1997
+ exports: meta?.exports,
1998
+ imports: meta?.imports
1999
+ };
2000
+ } else {
2001
+ return {
2002
+ type: "asset",
2003
+ path: file.path,
2004
+ contents: file.contents
2005
+ };
2006
+ }
2007
+ });
2008
+ const writtenFiles = [];
2009
+ await Promise.all(files.map(async (info) => {
2010
+ for (const renderer of this.#renderers) {
2011
+ if (info.type === "chunk" && renderer.renderChunk) {
2012
+ const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
2013
+ if (result) {
2014
+ info.code = result.code;
2015
+ if (result.map) {
2016
+ const originalConsumer = await new SourceMapConsumer(parseSourceMap(info.map));
2017
+ const newConsumer = await new SourceMapConsumer(parseSourceMap(result.map));
2018
+ const generator = SourceMapGenerator.fromSourceMap(newConsumer);
2019
+ generator.applySourceMap(originalConsumer, info.path);
2020
+ info.map = generator.toJSON();
2021
+ originalConsumer.destroy();
2022
+ newConsumer.destroy();
2023
+ }
2024
+ }
2025
+ }
2026
+ }
2027
+ const inlineSourceMap = this.#options.sourcemap === "inline";
2028
+ const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
2029
+ await outputFile(info.path, contents, {
2030
+ mode: info.type === "chunk" ? info.mode : void 0
2031
+ });
2032
+ writtenFiles.push({
2033
+ get name() {
2034
+ return path3.relative(process.cwd(), info.path);
2035
+ },
2036
+ get size() {
2037
+ return contents.length;
2038
+ }
2039
+ });
2040
+ if (info.type === "chunk" && info.map && !inlineSourceMap) {
2041
+ const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
2042
+ const outPath = `${info.path}.map`;
2043
+ const contents2 = JSON.stringify(map2);
2044
+ await outputFile(outPath, contents2);
2045
+ writtenFiles.push({
2046
+ get name() {
2047
+ return path3.relative(process.cwd(), outPath);
2048
+ },
2049
+ get size() {
2050
+ return contents2.length;
2051
+ }
2052
+ });
2053
+ }
2054
+ }));
2055
+ for (const renderer of this.#renderers) {
2056
+ if (renderer.buildEnd) {
2057
+ await renderer.buildEnd.call(this.getOptions(), {
2058
+ writtenFiles
2059
+ });
2060
+ }
2061
+ }
2062
+ }
2063
+ };
2064
+
2065
+ // ../esbuild/src/clean.ts
2066
+ import { rm } from "node:fs/promises";
2067
+ async function cleanDirectories(name = "ESBuild", directory, config) {
2068
+ await rm(directory, {
2069
+ recursive: true,
2070
+ force: true
2071
+ });
2072
+ }
2073
+ __name(cleanDirectories, "cleanDirectories");
2074
+
2075
+ // ../esbuild/src/plugins/esm-split-code-to-cjs.ts
2076
+ import * as esbuild from "esbuild";
2077
+ var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2078
+ name: "storm:esm-split-code-to-cjs",
2079
+ setup(build5) {
2080
+ build5.onEnd(async (result) => {
2081
+ const outFiles = Object.keys(result.metafile?.outputs ?? {});
2082
+ const jsFiles = outFiles.filter((f) => f.endsWith("js"));
2083
+ await esbuild.build({
2084
+ outdir: resolvedOptions.outdir,
2085
+ entryPoints: jsFiles,
2086
+ allowOverwrite: true,
2087
+ format: "cjs",
2088
+ logLevel: "error",
2089
+ packages: "external"
2090
+ });
2091
+ });
2092
+ }
2093
+ }), "esmSplitCodeToCjsPlugin");
2094
+
2095
+ // ../esbuild/src/plugins/fix-imports.ts
2096
+ var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2097
+ name: "storm:fix-imports",
2098
+ setup(build5) {
2099
+ build5.onResolve({
2100
+ filter: /^spdx-exceptions/
2101
+ }, () => {
2102
+ return {
2103
+ path: __require.resolve("spdx-exceptions")
2104
+ };
2105
+ });
2106
+ build5.onResolve({
2107
+ filter: /^spdx-license-ids/
2108
+ }, () => {
2109
+ return {
2110
+ path: __require.resolve("spdx-license-ids")
2111
+ };
2112
+ });
2113
+ }
2114
+ }), "fixImportsPlugin");
2115
+
2116
+ // ../esbuild/src/plugins/native-node-module.ts
2117
+ import { dirname } from "node:path";
2118
+ var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
2119
+ return {
2120
+ name: "native-node-modules",
2121
+ setup(build5) {
2122
+ build5.onResolve({
2123
+ filter: /\.node$/,
2124
+ namespace: "file"
2125
+ }, (args) => {
2126
+ const resolvedId = __require.resolve(args.path, {
2127
+ paths: [
2128
+ args.resolveDir
2129
+ ]
2130
+ });
2131
+ if (resolvedId.endsWith(".node")) {
2132
+ return {
2133
+ path: resolvedId,
2134
+ namespace: "node-file"
2135
+ };
2136
+ }
2137
+ return {
2138
+ path: resolvedId
2139
+ };
2140
+ });
2141
+ build5.onLoad({
2142
+ filter: /.*/,
2143
+ namespace: "node-file"
2144
+ }, (args) => {
2145
+ return {
2146
+ contents: `
2147
+ import path from ${JSON.stringify(args.path)}
2148
+ try { module.exports = require(path) }
2149
+ catch {}
2150
+ `,
2151
+ resolveDir: dirname(args.path)
2152
+ };
2153
+ });
2154
+ build5.onResolve({
2155
+ filter: /\.node$/,
2156
+ namespace: "node-file"
2157
+ }, (args) => ({
2158
+ path: args.path,
2159
+ namespace: "file"
2160
+ }));
2161
+ const opts = build5.initialOptions;
2162
+ opts.loader = opts.loader || {};
2163
+ opts.loader[".node"] = "file";
2164
+ }
2165
+ };
2166
+ }, "nativeNodeModulesPlugin");
2167
+
2168
+ // ../esbuild/src/plugins/node-protocol.ts
2169
+ var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
2170
+ const nodeProtocol = "node:";
2171
+ return {
2172
+ name: "node-protocol-plugin",
2173
+ setup({ onResolve }) {
2174
+ onResolve({
2175
+ filter: /^node:/
2176
+ }, ({ path: path7 }) => ({
2177
+ path: path7.slice(nodeProtocol.length),
2178
+ external: true
2179
+ }));
2180
+ }
2181
+ };
2182
+ }, "nodeProtocolPlugin");
2183
+
2184
+ // ../esbuild/src/plugins/on-error.ts
2185
+ var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2186
+ name: "storm:on-error",
2187
+ setup(build5) {
2188
+ build5.onEnd((result) => {
2189
+ if (result.errors.length > 0 && process.env.WATCH !== "true") {
2190
+ writeError(`The following errors occurred during the build:
2191
+ ${result.errors.map((error) => error.text).join("\n")}
2192
+
2193
+ `, resolvedOptions.config);
2194
+ throw new Error("Storm esbuild process failed with errors.");
2195
+ }
2196
+ });
2197
+ }
2198
+ }), "onErrorPlugin");
2199
+
2200
+ // ../esbuild/src/plugins/resolve-paths.ts
2201
+ import path4 from "node:path";
2202
+ function resolvePathsConfig(options, cwd) {
2203
+ if (options?.compilerOptions?.paths) {
2204
+ const paths = Object.entries(options.compilerOptions.paths);
2205
+ const resolvedPaths = paths.map(([key, paths2]) => {
2206
+ return [
2207
+ key,
2208
+ paths2.map((v) => path4.resolve(cwd, v))
2209
+ ];
2210
+ });
2211
+ return Object.fromEntries(resolvedPaths);
2212
+ }
2213
+ if (options.extends) {
2214
+ const extendsPath = path4.resolve(cwd, options.extends);
2215
+ const extendsDir = path4.dirname(extendsPath);
2216
+ const extendsConfig = __require(extendsPath);
2217
+ return resolvePathsConfig(extendsConfig, extendsDir);
2218
+ }
2219
+ return [];
2220
+ }
2221
+ __name(resolvePathsConfig, "resolvePathsConfig");
2222
+ var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2223
+ name: "storm:resolve-paths",
2224
+ setup(build5) {
2225
+ const parentTsConfig = build5.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build5.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
2226
+ const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
2227
+ const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
2228
+ build5.onResolve({
2229
+ filter: packagesRegex
2230
+ }, (args) => {
2231
+ if (build5.initialOptions.external?.includes(args.path)) {
2232
+ return {
2233
+ path: args.path,
2234
+ external: true
2235
+ };
2236
+ }
2237
+ return {
2238
+ path: `${resolvedTsPaths[args.path][0]}/index.ts`
2239
+ };
2240
+ });
2241
+ }
2242
+ }), "resolvePathsPlugin");
2243
+
2244
+ // ../esbuild/src/plugins/tsc.ts
2245
+ import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
2246
+ import { existsSync as existsSync5 } from "node:fs";
2247
+ import fs3 from "node:fs/promises";
2248
+ function bundleTypeDefinitions(filename, outfile, externals, options) {
2249
+ const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
2250
+ const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
2251
+ p,
2252
+ getTypeDependencyPackageName(p)
2253
+ ]);
2254
+ const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
2255
+ p,
2256
+ getTypeDependencyPackageName(p)
2257
+ ]);
2258
+ const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
2259
+ p,
2260
+ getTypeDependencyPackageName(p)
2261
+ ]);
2262
+ const includeDeps = devDependenciesKeys;
2263
+ const excludeDeps = /* @__PURE__ */ new Set([
2264
+ ...dependenciesKeys,
2265
+ ...peerDependenciesKeys,
2266
+ ...externals
2267
+ ]);
2268
+ const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
2269
+ const extractorConfig = ExtractorConfig.prepare({
2270
+ configObject: {
2271
+ projectFolder: options.projectRoot,
2272
+ mainEntryPointFilePath: filename,
2273
+ bundledPackages,
2274
+ compiler: {
2275
+ tsconfigFilePath: options.tsconfig,
2276
+ overrideTsconfig: {
2277
+ compilerOptions: {
2278
+ paths: {}
2279
+ // bug with api extract + paths
2280
+ }
2281
+ }
2282
+ },
2283
+ dtsRollup: {
2284
+ enabled: true,
2285
+ untrimmedFilePath: joinPaths(options.outdir, `${outfile}.d.ts`)
2286
+ },
2287
+ tsdocMetadata: {
2288
+ enabled: false
2289
+ }
2290
+ },
2291
+ packageJsonFullPath: joinPaths(options.projectRoot, "package.json"),
2292
+ configObjectFullPath: void 0
2293
+ });
2294
+ const extractorResult = Extractor.invoke(extractorConfig, {
2295
+ showVerboseMessages: true,
2296
+ localBuild: true
2297
+ });
2298
+ if (extractorResult.succeeded === false) {
2299
+ writeError(`API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
2300
+ throw new Error("API Extractor completed with errors");
2301
+ }
2302
+ }
2303
+ __name(bundleTypeDefinitions, "bundleTypeDefinitions");
2304
+ var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2305
+ name: "storm:tsc",
2306
+ setup(build5) {
2307
+ if (options.emitTypes === false) {
2308
+ return;
2309
+ }
2310
+ build5.onStart(async () => {
2311
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
2312
+ await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
2313
+ }
2314
+ if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0] && resolvedOptions.entryPoints[0].endsWith(".ts")) {
2315
+ const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
2316
+ const typeOutDir = resolvedOptions.outdir;
2317
+ const entryPoint = resolvedOptions.entryPoints[0].replace(sourceRoot, "").replace(/\.ts$/, "");
2318
+ const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
2319
+ let dtsPath;
2320
+ if (existsSync5(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
2321
+ dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
2322
+ } else if (existsSync5(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
2323
+ dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
2324
+ }
2325
+ const ext = resolvedOptions.outExtension.dts || resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
2326
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
2327
+ bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
2328
+ const dtsContents = await fs3.readFile(`${bundlePath}.d.ts`, "utf8");
2329
+ await fs3.writeFile(`${bundlePath}.${ext}`, dtsContents);
2330
+ } else {
2331
+ await fs3.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
2332
+ }
2333
+ }
2334
+ });
2335
+ }
2336
+ }), "tscPlugin");
2337
+ function getTypeDependencyPackageName(npmPackage) {
2338
+ if (npmPackage.startsWith("@")) {
2339
+ const [scope, name] = npmPackage.split("/");
2340
+ return `@types/${scope?.slice(1)}__${name}`;
2341
+ }
2342
+ return `@types/${npmPackage}`;
2343
+ }
2344
+ __name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
2345
+
2346
+ // ../esbuild/src/config.ts
2347
+ var getOutputExtensionMap = /* @__PURE__ */ __name((options, pkgType) => {
2348
+ return options.outExtension ? options.outExtension(options.format, pkgType) : getOutExtension(options.format, pkgType);
2349
+ }, "getOutputExtensionMap");
2350
+ var getDefaultBuildPlugins = /* @__PURE__ */ __name((options, resolvedOptions) => [
2351
+ nodeProtocolPlugin(options, resolvedOptions),
2352
+ resolvePathsPlugin(options, resolvedOptions),
2353
+ fixImportsPlugin(options, resolvedOptions),
2354
+ nativeNodeModulesPlugin(options, resolvedOptions),
2355
+ esmSplitCodeToCjsPlugin(options, resolvedOptions),
2356
+ tscPlugin(options, resolvedOptions),
2357
+ onErrorPlugin(options, resolvedOptions)
2358
+ ], "getDefaultBuildPlugins");
2359
+ var DEFAULT_BUILD_OPTIONS = {
2360
+ platform: "node",
2361
+ target: "node22",
2362
+ format: "cjs",
2363
+ external: [],
2364
+ logLevel: "error",
2365
+ tsconfig: "tsconfig.json",
2366
+ envName: "production",
2367
+ keepNames: true,
2368
+ metafile: true,
2369
+ injectShims: true,
2370
+ color: true,
2371
+ watch: false,
2372
+ bundle: true,
2373
+ clean: true,
2374
+ debug: false,
2375
+ loader: {
2376
+ ".aac": "file",
2377
+ ".css": "file",
2378
+ ".eot": "file",
2379
+ ".flac": "file",
2380
+ ".gif": "file",
2381
+ ".jpeg": "file",
2382
+ ".jpg": "file",
2383
+ ".mp3": "file",
2384
+ ".mp4": "file",
2385
+ ".ogg": "file",
2386
+ ".otf": "file",
2387
+ ".png": "file",
2388
+ ".svg": "file",
2389
+ ".ttf": "file",
2390
+ ".wav": "file",
2391
+ ".webm": "file",
2392
+ ".webp": "file",
2393
+ ".woff": "file",
2394
+ ".woff2": "file"
2395
+ },
2396
+ banner: DEFAULT_COMPILED_BANNER
2397
+ };
2398
+
2399
+ // ../esbuild/src/plugins/deps-check.ts
2400
+ import { builtinModules as builtinModules2 } from "node:module";
2401
+ import path5 from "node:path";
2402
+ var unusedIgnore = [
2403
+ // these are our dev dependencies
2404
+ /@types\/.*?/,
2405
+ /@typescript-eslint.*?/,
2406
+ /eslint.*?/,
2407
+ "esbuild",
2408
+ "husky",
2409
+ "is-ci",
2410
+ "lint-staged",
2411
+ "prettier",
2412
+ "typescript",
2413
+ "ts-node",
2414
+ "ts-jest",
2415
+ "@swc/core",
2416
+ "@swc/jest",
2417
+ "jest",
2418
+ // these are missing 3rd party deps
2419
+ "spdx-exceptions",
2420
+ "spdx-license-ids",
2421
+ // type-only, so it is not detected
2422
+ "ts-toolbelt",
2423
+ // these are indirectly used by build
2424
+ "buffer"
2425
+ ];
2426
+ var missingIgnore = [
2427
+ ".prisma",
2428
+ "@prisma/client",
2429
+ "ts-toolbelt"
2430
+ ];
2431
+ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
2432
+ name: "storm:deps-check",
2433
+ setup(build5) {
2434
+ const pkgJsonPath = path5.join(process.cwd(), "package.json");
2435
+ const pkgContents = __require(pkgJsonPath);
2436
+ const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
2437
+ const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
2438
+ const peerDependencies = Object.keys(pkgContents["peerDependencies"] ?? {});
2439
+ const dependencies = [
2440
+ ...regDependencies,
2441
+ ...bundle ? devDependencies : []
2442
+ ];
2443
+ const collectedDependencies = /* @__PURE__ */ new Set();
2444
+ const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
2445
+ build5.onResolve({
2446
+ filter: onlyPackages
2447
+ }, (args) => {
2448
+ if (args.importer.includes(process.cwd())) {
2449
+ if (args.path[0] === "@") {
2450
+ const [org, pkg] = args.path.split("/");
2451
+ collectedDependencies.add(`${org}/${pkg}`);
2452
+ } else {
2453
+ const [pkg] = args.path.split("/");
2454
+ collectedDependencies.add(pkg);
2455
+ }
2456
+ }
2457
+ return {
2458
+ external: true
2459
+ };
2460
+ });
2461
+ build5.onEnd(() => {
2462
+ const unusedDependencies = [
2463
+ ...dependencies
2464
+ ].filter((dep) => {
2465
+ return !collectedDependencies.has(dep) || builtinModules2.includes(dep);
2466
+ });
2467
+ const missingDependencies = [
2468
+ ...collectedDependencies
2469
+ ].filter((dep) => {
2470
+ return !dependencies.includes(dep) && !builtinModules2.includes(dep);
2471
+ });
2472
+ const filteredUnusedDeps = unusedDependencies.filter((dep) => {
2473
+ return !unusedIgnore.some((pattern) => dep.match(pattern));
2474
+ });
2475
+ const filteredMissingDeps = missingDependencies.filter((dep) => {
2476
+ return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
2477
+ });
2478
+ writeWarning(`Unused Dependencies: ${JSON.stringify(filteredUnusedDeps)}`);
2479
+ writeError(`Missing Dependencies: ${JSON.stringify(filteredMissingDeps)}`);
2480
+ if (filteredMissingDeps.length > 0) {
2481
+ throw new Error(`Missing dependencies detected - please install them:
2482
+ ${JSON.stringify(filteredMissingDeps)}
2483
+ `);
2484
+ }
2485
+ });
2486
+ }
2487
+ }), "depsCheckPlugin");
2488
+
2489
+ // ../esbuild/src/renderers/shebang.ts
2490
+ var shebangRenderer = {
2491
+ name: "shebang",
2492
+ renderChunk(_, __, info) {
2493
+ if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
2494
+ info.mode = 493;
2495
+ }
2496
+ }
2497
+ };
2498
+
2499
+ // ../esbuild/src/utilities/helpers.ts
2500
+ function handleSync(fn) {
2501
+ try {
2502
+ return fn();
2503
+ } catch (error_) {
2504
+ return error_;
2505
+ }
2506
+ }
2507
+ __name(handleSync, "handleSync");
2508
+ async function handleAsync(fn) {
2509
+ try {
2510
+ return await fn();
2511
+ } catch (error_) {
2512
+ return error_;
2513
+ }
2514
+ }
2515
+ __name(handleAsync, "handleAsync");
2516
+ var handle = handleSync;
2517
+ handle.async = handleAsync;
2518
+ var skip = Symbol("skip");
2519
+ function transduceSync(list, transformer) {
2520
+ const transduced = [];
2521
+ for (const [i, element_] of list.entries()) {
2522
+ const transformed = transformer(element_, i);
2523
+ if (transformed !== skip) {
2524
+ transduced[transduced.length] = transformed;
2525
+ }
2526
+ }
2527
+ return transduced;
2528
+ }
2529
+ __name(transduceSync, "transduceSync");
2530
+ async function transduceAsync(list, transformer) {
2531
+ const transduced = [];
2532
+ await Promise.all(list.entries().map(async ([i, element_]) => {
2533
+ const transformed = await transformer(element_, i);
2534
+ if (transformed !== skip) {
2535
+ transduced[transduced.length] = transformed;
2536
+ }
2537
+ }));
2538
+ return transduced;
2539
+ }
2540
+ __name(transduceAsync, "transduceAsync");
2541
+ var transduce = transduceSync;
2542
+ transduce.async = transduceAsync;
2543
+ function pipeSync(fn, ...fns) {
2544
+ return (...args) => {
2545
+ let result = fn(...args);
2546
+ for (let i = 0; result !== skip && i < fns.length; ++i) {
2547
+ result = fns[i]?.(result);
2548
+ }
2549
+ return result;
2550
+ };
2551
+ }
2552
+ __name(pipeSync, "pipeSync");
2553
+ function pipeAsync(fn, ...fns) {
2554
+ return async (...args) => {
2555
+ let result = await fn(...args);
2556
+ for (let i = 0; result !== skip && i < fns.length; ++i) {
2557
+ result = await fns[i]?.(result);
2558
+ }
2559
+ return result;
2560
+ };
2561
+ }
2562
+ __name(pipeAsync, "pipeAsync");
2563
+ var pipe = pipeSync;
2564
+ pipe.async = pipeAsync;
2565
+
2566
+ // ../esbuild/src/build.ts
2567
+ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
2568
+ const projectRoot = userOptions.projectRoot;
2569
+ const workspaceRoot3 = findWorkspaceRoot2(projectRoot);
2570
+ if (!workspaceRoot3) {
2571
+ throw new Error("Cannot find Nx workspace root");
2572
+ }
2573
+ const config = await getConfig(workspaceRoot3.dir);
2574
+ writeDebug(" \u2699\uFE0F Resolving build options", config);
2575
+ const stopwatch = getStopwatch("Build options resolution");
2576
+ const projectGraph = await createProjectGraphAsync({
2577
+ exitOnError: true
2578
+ });
2579
+ const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
2580
+ if (!existsSync6(projectJsonPath)) {
2581
+ throw new Error("Cannot find project.json configuration");
2582
+ }
2583
+ const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
2584
+ const projectJson = JSON.parse(projectJsonFile);
2585
+ const projectName = projectJson.name;
2586
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
2587
+ if (!projectConfigurations?.projects?.[projectName]) {
2588
+ 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.");
2589
+ }
2590
+ const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS);
2591
+ options.name ??= `${projectName}-${options.format}`;
2592
+ options.target ??= DEFAULT_TARGET;
2593
+ const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
2594
+ if (!existsSync6(packageJsonPath)) {
2595
+ throw new Error("Cannot find package.json configuration");
2596
+ }
2597
+ const packageJsonFile = await hf.readFile(packageJsonPath, "utf8");
2598
+ const packageJson = JSON.parse(packageJsonFile);
2599
+ const outExtension = getOutputExtensionMap(options, packageJson.type);
2600
+ const env = getEnv("esbuild", options);
2601
+ const result = {
2602
+ ...options,
2603
+ config,
2604
+ mainFields: options.platform === "node" ? [
2605
+ "module",
2606
+ "main"
2607
+ ] : [
2608
+ "browser",
2609
+ "module",
2610
+ "main"
2611
+ ],
2612
+ resolveExtensions: [
2613
+ ".ts",
2614
+ ".js",
2615
+ ".node"
2616
+ ],
2617
+ ...userOptions,
2618
+ tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
2619
+ format: options.format || "cjs",
2620
+ entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
2621
+ "./src/index.ts"
2622
+ ], userOptions.emitOnAll),
2623
+ outdir: userOptions.outputPath || joinPaths("dist", projectRoot),
2624
+ plugins: [],
2625
+ name: userOptions.name || projectName,
2626
+ projectConfigurations,
2627
+ projectName,
2628
+ projectGraph,
2629
+ sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
2630
+ minify: userOptions.minify || !userOptions.debug,
2631
+ verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
2632
+ includeSrc: userOptions.includeSrc === true,
2633
+ metafile: userOptions.metafile !== false,
2634
+ generatePackageJson: userOptions.generatePackageJson !== false,
2635
+ clean: userOptions.clean !== false,
2636
+ emitOnAll: userOptions.emitOnAll === true,
2637
+ assets: userOptions.assets ?? [],
2638
+ injectShims: userOptions.injectShims !== true,
2639
+ bundle: userOptions.bundle !== false,
2640
+ keepNames: true,
2641
+ watch: userOptions.watch === true,
2642
+ outExtension,
2643
+ footer: userOptions.footer,
2644
+ banner: {
2645
+ js: options.banner || DEFAULT_COMPILED_BANNER,
2646
+ css: options.banner || DEFAULT_COMPILED_BANNER
2647
+ },
2648
+ splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
2649
+ treeShaking: options.format === "esm",
2650
+ env,
2651
+ define: {
2652
+ STORM_FORMAT: JSON.stringify(options.format || "cjs"),
2653
+ ...options.format === "cjs" && options.injectShims ? {
2654
+ "import.meta.url": "importMetaUrl"
2655
+ } : {},
2656
+ ...options.define,
2657
+ ...Object.keys(env || {}).reduce((res, key) => {
2658
+ const value = JSON.stringify(env[key]);
2659
+ return {
2660
+ ...res,
2661
+ [`process.env.${key}`]: value,
2662
+ [`import.meta.env.${key}`]: value
2663
+ };
2664
+ }, {})
2665
+ },
2666
+ inject: [
2667
+ options.format === "cjs" && options.injectShims ? joinPaths(__dirname, "../assets/cjs_shims.js") : "",
2668
+ options.format === "esm" && options.injectShims && options.platform === "node" ? joinPaths(__dirname, "../assets/esm_shims.js") : "",
2669
+ ...options.inject ?? []
2670
+ ].filter(Boolean)
2671
+ };
2672
+ result.plugins = userOptions.plugins ?? getDefaultBuildPlugins(userOptions, result);
2673
+ stopwatch();
2674
+ return result;
2675
+ }, "resolveOptions");
2676
+ async function generatePackageJson(context2) {
2677
+ if (context2.options.generatePackageJson !== false && existsSync6(joinPaths(context2.options.projectRoot, "package.json"))) {
2678
+ writeDebug(" \u270D\uFE0F Writing package.json file", context2.options.config);
2679
+ const stopwatch = getStopwatch("Write package.json file");
2680
+ const packageJsonPath = joinPaths(context2.options.projectRoot, "project.json");
2681
+ if (!existsSync6(packageJsonPath)) {
2682
+ throw new Error("Cannot find package.json configuration");
2683
+ }
2684
+ const packageJsonFile = await hf.readFile(joinPaths(context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"), "utf8");
2685
+ let packageJson = JSON.parse(packageJsonFile);
2686
+ if (!packageJson) {
2687
+ throw new Error("Cannot find package.json configuration file");
2688
+ }
2689
+ packageJson = await addPackageDependencies(context2.options.config.workspaceRoot, context2.options.projectRoot, context2.options.projectName, packageJson);
2690
+ packageJson = await addWorkspacePackageJsonFields(context2.options.config, context2.options.projectRoot, context2.options.sourceRoot, context2.options.projectName, false, packageJson);
2691
+ packageJson.exports ??= {};
2692
+ packageJson.exports["./package.json"] ??= "./package.json";
2693
+ packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, context2.options.sourceRoot);
2694
+ let entryPoints = [
2695
+ {
2696
+ in: "./src/index.ts",
2697
+ out: "./src/index.ts"
2698
+ }
2699
+ ];
2700
+ if (context2.options.entryPoints) {
2701
+ if (Array.isArray(context2.options.entryPoints)) {
2702
+ entryPoints = context2.options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
2703
+ in: entryPoint,
2704
+ out: entryPoint
2705
+ } : entryPoint);
2706
+ }
2707
+ for (const entryPoint of entryPoints) {
2708
+ const split = entryPoint.out.split(".");
2709
+ split.pop();
2710
+ const entry = split.join(".").replaceAll("\\", "/");
2711
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, context2.options.sourceRoot);
2712
+ }
2713
+ }
2714
+ packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
2715
+ packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
2716
+ packageJson.types = "./dist/index.d.ts";
2717
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
2718
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
2719
+ ret[key.replace("/index", "")] = packageJson.exports[key];
2720
+ }
2721
+ return ret;
2722
+ }, packageJson.exports);
2723
+ await writeJsonFile(joinPaths(context2.options.outdir, "package.json"), packageJson);
2724
+ stopwatch();
2725
+ }
2726
+ return context2;
2727
+ }
2728
+ __name(generatePackageJson, "generatePackageJson");
2729
+ async function createOptions(options) {
2730
+ return flatten(await Promise.all(map(options, (opt) => [
2731
+ // we defer it so that we don't trigger glob immediately
2732
+ () => resolveOptions(opt)
2733
+ ])));
2734
+ }
2735
+ __name(createOptions, "createOptions");
2736
+ async function generateContext(getOptions) {
2737
+ const options = await getOptions();
2738
+ const rendererEngine = new RendererEngine([
2739
+ shebangRenderer,
2740
+ ...options.renderers || []
2741
+ ]);
2742
+ return {
2743
+ options,
2744
+ rendererEngine
2745
+ };
2746
+ }
2747
+ __name(generateContext, "generateContext");
2748
+ async function executeEsBuild(context2) {
2749
+ writeDebug(` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
2750
+ const stopwatch = getStopwatch(`${context2.options.name} build`);
2751
+ if (process.env.WATCH === "true") {
2752
+ const ctx = await esbuild2.context(context2.options);
2753
+ watch(ctx, context2.options);
2754
+ }
2755
+ const result = await esbuild2.build(context2.options);
2756
+ if (result.metafile) {
2757
+ const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
2758
+ await hf.writeFile(metafilePath, JSON.stringify(result.metafile));
2759
+ }
2760
+ stopwatch();
2761
+ return context2;
2762
+ }
2763
+ __name(executeEsBuild, "executeEsBuild");
2764
+ async function copyBuildAssets(context2) {
2765
+ if (context2.result?.errors.length === 0) {
2766
+ writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context2.options.outdir}`, context2.options.config);
2767
+ const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
2768
+ await copyAssets(context2.options.config, context2.options.assets ?? [], context2.options.outdir, context2.options.projectRoot, context2.options.sourceRoot, true, false);
2769
+ stopwatch();
2770
+ }
2771
+ return context2;
2772
+ }
2773
+ __name(copyBuildAssets, "copyBuildAssets");
2774
+ async function reportResults(context2) {
2775
+ if (context2.result?.errors.length === 0) {
2776
+ if (context2.result.warnings.length > 0) {
2777
+ writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context2.result.warnings.map((warning) => warning.text).join("\n")}`, context2.options.config);
2778
+ }
2779
+ writeSuccess(` \u{1F4E6} The ${context2.options.name} build completed successfully`, context2.options.config);
2780
+ }
2781
+ }
2782
+ __name(reportResults, "reportResults");
2783
+ async function dependencyCheck(options) {
2784
+ if (process.env.DEV === "true") {
2785
+ return void 0;
2786
+ }
2787
+ if (process.env.CI && !process.env.BUILDKITE) {
2788
+ return void 0;
2789
+ }
2790
+ const buildPromise = esbuild2.build({
2791
+ entryPoints: globbySync("**/*.{j,t}s", {
2792
+ // We don't check dependencies in ecosystem tests because tests are isolated from the build.
2793
+ ignore: [
2794
+ "./src/__tests__/**/*",
2795
+ "./tests/e2e/**/*",
2796
+ "./dist/**/*"
2797
+ ],
2798
+ gitignore: true
2799
+ }),
2800
+ logLevel: "silent",
2801
+ bundle: true,
2802
+ write: false,
2803
+ outdir: "out",
2804
+ plugins: [
2805
+ depsCheckPlugin(options.bundle)
2806
+ ]
2807
+ });
2808
+ await buildPromise.catch(() => {
2809
+ });
2810
+ return void 0;
2811
+ }
2812
+ __name(dependencyCheck, "dependencyCheck");
2813
+ async function cleanOutputPath(context2) {
2814
+ if (context2.options.clean !== false && context2.options.outdir) {
2815
+ writeDebug(` \u{1F9F9} Cleaning ${context2.options.name} output path: ${context2.options.outdir}`, context2.options.config);
2816
+ const stopwatch = getStopwatch(`${context2.options.name} output clean`);
2817
+ await cleanDirectories(context2.options.name, context2.options.outdir, context2.options.config);
2818
+ stopwatch();
2819
+ }
2820
+ return context2;
2821
+ }
2822
+ __name(cleanOutputPath, "cleanOutputPath");
2823
+ async function build3(options) {
2824
+ writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
2825
+ const stopwatch = getStopwatch("ESBuild pipeline");
2826
+ try {
2827
+ const opts = Array.isArray(options) ? options : [
2828
+ options
2829
+ ];
2830
+ if (opts.length === 0) {
2831
+ throw new Error("No build options were provided");
2832
+ }
2833
+ void transduce.async(opts, dependencyCheck);
2834
+ await transduce.async(await createOptions(opts), pipe.async(generateContext, cleanOutputPath, generatePackageJson, executeEsBuild, copyBuildAssets, reportResults));
2835
+ writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
2836
+ } catch (error) {
2837
+ writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
2838
+ throw error;
2839
+ } finally {
2840
+ stopwatch();
2841
+ }
2842
+ }
2843
+ __name(build3, "build");
2844
+ var watch = /* @__PURE__ */ __name((context2, options) => {
2845
+ if (!options.watch) {
2846
+ return context2;
2847
+ }
2848
+ const config = {
2849
+ ignoreInitial: true,
2850
+ useFsEvents: true,
2851
+ ignored: [
2852
+ "./src/__tests__/**/*",
2853
+ "./package.json"
2854
+ ]
2855
+ };
2856
+ const changeWatcher = createWatcher([
2857
+ "./src/**/*"
2858
+ ], config);
2859
+ const fastRebuild = debounce(async () => {
2860
+ const timeBefore = Date.now();
2861
+ const rebuildResult = await handle.async(() => {
2862
+ return context2.rebuild();
2863
+ });
2864
+ if (rebuildResult instanceof Error) {
2865
+ writeError(rebuildResult.message);
2866
+ }
2867
+ writeTrace(`${Date.now() - timeBefore}ms [${options.name ?? ""}]`);
2868
+ }, 10);
2869
+ changeWatcher.on("change", fastRebuild);
2870
+ return void 0;
2871
+ }, "watch");
2872
+
2873
+ // ../workspace-tools/src/executors/esbuild/executor.ts
2874
+ async function esbuildExecutorFn(options, context2, config) {
2875
+ writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
2876
+ if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !context2.projectsConfigurations.projects[context2.projectName]?.root) {
2877
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
2878
+ }
2879
+ await build3({
2880
+ ...options,
2881
+ projectRoot: context2.projectsConfigurations.projects?.[context2.projectName].root,
2882
+ projectName: context2.projectName,
2883
+ sourceRoot: context2.projectsConfigurations.projects?.[context2.projectName]?.sourceRoot,
2884
+ format: options.format,
2885
+ platform: options.format
2886
+ });
2887
+ return {
2888
+ success: true
2889
+ };
2890
+ }
2891
+ __name(esbuildExecutorFn, "esbuildExecutorFn");
2892
+ var executor_default6 = withRunExecutor("Storm ESBuild build", esbuildExecutorFn, {
2893
+ skipReadingConfig: false,
2894
+ hooks: {
2895
+ applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
2896
+ options.entry ??= [
2897
+ "src/index.ts"
2898
+ ];
2899
+ options.outputPath ??= "dist/{projectRoot}";
2900
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
2901
+ return options;
2902
+ }, "applyDefaultOptions")
2903
+ }
2904
+ });
2905
+
2906
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
2907
+ import { execSync as execSync4 } from "node:child_process";
2908
+ import fs4 from "node:fs/promises";
2909
+
2910
+ // ../workspace-tools/src/utils/pnpm-deps-update.ts
2911
+ import { existsSync as existsSync7 } from "node:fs";
2912
+ import { readFile as readFile5, writeFile as writeFile2 } from "node:fs/promises";
2913
+ import { format } from "prettier";
2914
+ import readYamlFile from "read-yaml-file";
2915
+
2916
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
2917
+ var LARGE_BUFFER3 = 1024 * 1e6;
2918
+
2919
+ // ../workspace-tools/src/executors/size-limit/executor.ts
2920
+ import { joinPathFragments as joinPathFragments3 } from "@nx/devkit";
2921
+ import esBuildPlugin from "@size-limit/esbuild";
2922
+ import esBuildWhyPlugin from "@size-limit/esbuild-why";
2923
+ import filePlugin from "@size-limit/file";
2924
+ import sizeLimit from "size-limit";
2925
+ async function sizeLimitExecutorFn(options, context2, config) {
2926
+ if (!context2?.projectName || !context2.projectsConfigurations?.projects || !context2.projectsConfigurations.projects[context2.projectName]) {
2927
+ throw new Error("The Size-Limit process failed because the context is not valid. Please run this command from a workspace.");
2928
+ }
2929
+ writeInfo(`\u{1F4CF} Running Size-Limit on ${context2.projectName}`, config);
2930
+ sizeLimit([
2931
+ filePlugin,
2932
+ esBuildPlugin,
2933
+ esBuildWhyPlugin
2934
+ ], {
2935
+ checks: options.entry ?? context2.projectsConfigurations.projects[context2.projectName]?.sourceRoot ?? joinPathFragments3(context2.projectsConfigurations.projects[context2.projectName]?.root ?? "./", "src")
2936
+ }).then((result) => {
2937
+ writeInfo(`\u{1F4CF} ${context2.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
2938
+ });
2939
+ return {
2940
+ success: true
2941
+ };
2942
+ }
2943
+ __name(sizeLimitExecutorFn, "sizeLimitExecutorFn");
2944
+ var executor_default7 = withRunExecutor("Size-Limit Performance Test Executor", sizeLimitExecutorFn, {
2945
+ skipReadingConfig: false,
2946
+ hooks: {
2947
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
2948
+ return options;
2949
+ }, "applyDefaultOptions")
2950
+ }
2951
+ });
2952
+
2953
+ // ../tsdown/src/build.ts
2954
+ import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile as writeJsonFile2 } from "@nx/devkit";
2955
+ import defu5 from "defu";
2956
+ import { existsSync as existsSync8 } from "node:fs";
2957
+ import hf2 from "node:fs/promises";
2958
+ import { findWorkspaceRoot as findWorkspaceRoot3 } from "nx/src/utils/find-workspace-root";
2959
+ import { build as tsdown } from "tsdown";
2960
+
2961
+ // ../tsdown/src/clean.ts
2962
+ import { rm as rm2 } from "node:fs/promises";
2963
+ async function cleanDirectories2(name = "TSDown", directory, config) {
2964
+ await rm2(directory, {
2965
+ recursive: true,
2966
+ force: true
2967
+ });
2968
+ }
2969
+ __name(cleanDirectories2, "cleanDirectories");
2970
+
2971
+ // ../tsdown/src/config.ts
2972
+ var DEFAULT_BUILD_OPTIONS2 = {
2973
+ platform: "node",
2974
+ target: "node22",
2975
+ format: [
2976
+ "esm",
2977
+ "cjs"
2978
+ ],
2979
+ tsconfig: "tsconfig.json",
2980
+ envName: "production",
2981
+ globalName: "globalThis",
2982
+ unused: {
2983
+ level: "error"
2984
+ },
2985
+ injectShims: true,
2986
+ watch: false,
2987
+ bundle: true,
2988
+ treeshake: true,
2989
+ clean: true,
2990
+ debug: false
2991
+ };
2992
+
2993
+ // ../tsdown/src/build.ts
2994
+ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
2995
+ const projectRoot = userOptions.projectRoot;
2996
+ const workspaceRoot3 = findWorkspaceRoot3(projectRoot);
2997
+ if (!workspaceRoot3) {
2998
+ throw new Error("Cannot find Nx workspace root");
2999
+ }
3000
+ const config = await getConfig(workspaceRoot3.dir);
3001
+ writeDebug(" \u2699\uFE0F Resolving build options", config);
3002
+ const stopwatch = getStopwatch("Build options resolution");
3003
+ const projectGraph = await createProjectGraphAsync2({
3004
+ exitOnError: true
3005
+ });
3006
+ const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
3007
+ if (!existsSync8(projectJsonPath)) {
3008
+ throw new Error("Cannot find project.json configuration");
3009
+ }
3010
+ const projectJsonFile = await hf2.readFile(projectJsonPath, "utf8");
3011
+ const projectJson = JSON.parse(projectJsonFile);
3012
+ const projectName = projectJson.name;
3013
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
3014
+ if (!projectConfigurations?.projects?.[projectName]) {
3015
+ 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.");
3016
+ }
3017
+ const options = defu5(userOptions, DEFAULT_BUILD_OPTIONS2);
3018
+ options.name ??= `${projectName}-${options.format}`;
3019
+ options.target ??= DEFAULT_TARGET;
3020
+ const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
3021
+ if (!existsSync8(packageJsonPath)) {
3022
+ throw new Error("Cannot find package.json configuration");
3023
+ }
3024
+ const env = getEnv("tsdown", options);
3025
+ const result = {
3026
+ ...options,
3027
+ config,
3028
+ ...userOptions,
3029
+ tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
3030
+ format: options.format || "cjs",
3031
+ entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
3032
+ "./src/index.ts"
3033
+ ], userOptions.emitOnAll),
3034
+ outdir: userOptions.outputPath || joinPaths("dist", projectRoot),
3035
+ plugins: [],
3036
+ name: userOptions.name || projectName,
3037
+ projectConfigurations,
3038
+ projectName,
3039
+ projectGraph,
3040
+ sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
3041
+ minify: userOptions.minify || !userOptions.debug,
3042
+ verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
3043
+ includeSrc: userOptions.includeSrc === true,
3044
+ metafile: userOptions.metafile !== false,
3045
+ generatePackageJson: userOptions.generatePackageJson !== false,
3046
+ clean: userOptions.clean !== false,
3047
+ emitOnAll: userOptions.emitOnAll === true,
3048
+ dts: userOptions.emitTypes === true ? {
3049
+ transformer: "oxc"
3050
+ } : userOptions.emitTypes,
3051
+ bundleDts: userOptions.emitTypes,
3052
+ assets: userOptions.assets ?? [],
3053
+ shims: userOptions.injectShims !== true,
3054
+ bundle: userOptions.bundle !== false,
3055
+ watch: userOptions.watch === true,
3056
+ define: {
3057
+ STORM_FORMAT: JSON.stringify(options.format || "cjs"),
3058
+ ...options.format === "cjs" && options.injectShims ? {
3059
+ "import.meta.url": "importMetaUrl"
3060
+ } : {},
3061
+ ...Object.keys(env || {}).reduce((res, key) => {
3062
+ const value = JSON.stringify(env[key]);
3063
+ return {
3064
+ ...res,
3065
+ [`process.env.${key}`]: value,
3066
+ [`import.meta.env.${key}`]: value
3067
+ };
3068
+ }, {}),
3069
+ ...options.define
3070
+ }
3071
+ };
3072
+ stopwatch();
3073
+ return result;
3074
+ }, "resolveOptions");
3075
+ async function generatePackageJson2(options) {
3076
+ if (options.generatePackageJson !== false && existsSync8(joinPaths(options.projectRoot, "package.json"))) {
3077
+ writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
3078
+ const stopwatch = getStopwatch("Write package.json file");
3079
+ const packageJsonPath = joinPaths(options.projectRoot, "project.json");
3080
+ if (!existsSync8(packageJsonPath)) {
3081
+ throw new Error("Cannot find package.json configuration");
3082
+ }
3083
+ const packageJsonFile = await hf2.readFile(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
3084
+ if (!packageJsonFile) {
3085
+ throw new Error("Cannot find package.json configuration file");
3086
+ }
3087
+ let packageJson = JSON.parse(packageJsonFile);
3088
+ packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
3089
+ packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
3090
+ packageJson.exports ??= {};
3091
+ packageJson.exports["./package.json"] ??= "./package.json";
3092
+ packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot);
3093
+ let entryPoints = [
3094
+ {
3095
+ in: "./src/index.ts",
3096
+ out: "./src/index.ts"
3097
+ }
3098
+ ];
3099
+ if (options.entryPoints) {
3100
+ if (Array.isArray(options.entryPoints)) {
3101
+ entryPoints = options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
3102
+ in: entryPoint,
3103
+ out: entryPoint
3104
+ } : entryPoint);
3105
+ }
3106
+ for (const entryPoint of entryPoints) {
3107
+ const split = entryPoint.out.split(".");
3108
+ split.pop();
3109
+ const entry = split.join(".").replaceAll("\\", "/");
3110
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, options.sourceRoot);
3111
+ }
3112
+ }
3113
+ packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
3114
+ packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
3115
+ packageJson.types = "./dist/index.d.ts";
3116
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
3117
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
3118
+ ret[key.replace("/index", "")] = packageJson.exports[key];
3119
+ }
3120
+ return ret;
3121
+ }, packageJson.exports);
3122
+ await writeJsonFile2(joinPaths(options.outdir, "package.json"), packageJson);
3123
+ stopwatch();
3124
+ }
3125
+ return options;
3126
+ }
3127
+ __name(generatePackageJson2, "generatePackageJson");
3128
+ async function executeTSDown(options) {
3129
+ writeDebug(` \u{1F680} Running ${options.name} build`, options.config);
3130
+ const stopwatch = getStopwatch(`${options.name} build`);
3131
+ await tsdown({
3132
+ ...options,
3133
+ entry: options.entryPoints,
3134
+ outDir: options.outdir,
3135
+ config: false
3136
+ });
3137
+ stopwatch();
3138
+ return options;
3139
+ }
3140
+ __name(executeTSDown, "executeTSDown");
3141
+ async function copyBuildAssets2(options) {
3142
+ writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
3143
+ const stopwatch = getStopwatch(`${options.name} asset copy`);
3144
+ await copyAssets(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.sourceRoot, true, false);
3145
+ stopwatch();
3146
+ return options;
3147
+ }
3148
+ __name(copyBuildAssets2, "copyBuildAssets");
3149
+ async function reportResults2(options) {
3150
+ writeSuccess(` \u{1F4E6} The ${options.name} build completed successfully`, options.config);
3151
+ }
3152
+ __name(reportResults2, "reportResults");
3153
+ async function cleanOutputPath2(options) {
3154
+ if (options.clean !== false && options.outdir) {
3155
+ writeDebug(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outdir}`, options.config);
3156
+ const stopwatch = getStopwatch(`${options.name} output clean`);
3157
+ await cleanDirectories2(options.name, options.outdir, options.config);
3158
+ stopwatch();
3159
+ }
3160
+ return options;
3161
+ }
3162
+ __name(cleanOutputPath2, "cleanOutputPath");
3163
+ async function build4(options) {
3164
+ writeDebug(` \u26A1 Executing Storm TSDown pipeline`);
3165
+ const stopwatch = getStopwatch("TSDown pipeline");
3166
+ try {
3167
+ const opts = Array.isArray(options) ? options : [
3168
+ options
3169
+ ];
3170
+ if (opts.length === 0) {
3171
+ throw new Error("No build options were provided");
3172
+ }
3173
+ const resolved = await Promise.all(opts.map(async (opt) => await resolveOptions2(opt)));
3174
+ if (resolved.length > 0) {
3175
+ await cleanOutputPath2(resolved[0]);
3176
+ await generatePackageJson2(resolved[0]);
3177
+ await Promise.all(resolved.map(async (opt) => {
3178
+ await executeTSDown(opt);
3179
+ await copyBuildAssets2(opt);
3180
+ await reportResults2(opt);
3181
+ }));
3182
+ } else {
3183
+ writeWarning(" \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function.");
3184
+ }
3185
+ writeSuccess(" \u{1F3C1} TSDown pipeline build completed successfully");
3186
+ } catch (error) {
3187
+ writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
3188
+ throw error;
3189
+ } finally {
3190
+ stopwatch();
3191
+ }
3192
+ }
3193
+ __name(build4, "build");
3194
+
3195
+ // ../workspace-tools/src/executors/tsdown/executor.ts
3196
+ async function tsdownExecutorFn(options, context2, config) {
3197
+ writeInfo("\u{1F4E6} Running Storm TSDown build executor on the workspace", config);
3198
+ if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !context2.projectsConfigurations.projects[context2.projectName]?.root) {
3199
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
3200
+ }
3201
+ await build4({
3202
+ ...options,
3203
+ projectRoot: context2.projectsConfigurations.projects?.[context2.projectName].root,
3204
+ projectName: context2.projectName,
3205
+ sourceRoot: context2.projectsConfigurations.projects?.[context2.projectName]?.sourceRoot,
3206
+ format: options.format,
3207
+ platform: options.platform
3208
+ });
3209
+ return {
3210
+ success: true
3211
+ };
3212
+ }
3213
+ __name(tsdownExecutorFn, "tsdownExecutorFn");
3214
+ var executor_default8 = withRunExecutor("Storm TSDown build executor", tsdownExecutorFn, {
3215
+ skipReadingConfig: false,
3216
+ hooks: {
3217
+ applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
3218
+ options.entry ??= [
3219
+ "src/index.ts"
3220
+ ];
3221
+ options.outputPath ??= "dist/{projectRoot}";
3222
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
3223
+ return options;
3224
+ }, "applyDefaultOptions")
3225
+ }
3226
+ });
3227
+
3228
+ // ../workspace-tools/src/executors/typia/executor.ts
3229
+ import { removeSync } from "fs-extra";
3230
+ import { TypiaProgrammer } from "typia/lib/programmers/TypiaProgrammer.js";
3231
+ async function typiaExecutorFn(options, _, config) {
3232
+ if (options.clean !== false) {
3233
+ writeInfo(`\u{1F9F9} Cleaning output path: ${options.outputPath}`, config);
3234
+ removeSync(options.outputPath);
3235
+ }
3236
+ await Promise.all(options.entry.map((entry) => {
3237
+ writeInfo(`\u{1F680} Running Typia on entry: ${entry}`, config);
3238
+ return TypiaProgrammer.build({
3239
+ input: entry,
3240
+ output: options.outputPath,
3241
+ project: options.tsconfig
3242
+ });
3243
+ }));
3244
+ return {
3245
+ success: true
3246
+ };
3247
+ }
3248
+ __name(typiaExecutorFn, "typiaExecutorFn");
3249
+ var executor_default9 = withRunExecutor("Typia runtime validation generator", typiaExecutorFn, {
3250
+ skipReadingConfig: false,
3251
+ hooks: {
3252
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
3253
+ options.entry ??= [
3254
+ "{sourceRoot}/index.ts"
3255
+ ];
3256
+ options.outputPath ??= "{sourceRoot}/__generated__/typia";
3257
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
3258
+ options.clean ??= true;
3259
+ return options;
3260
+ }, "applyDefaultOptions")
3261
+ }
3262
+ });
3263
+
3264
+ // ../workspace-tools/src/executors/unbuild/executor.ts
3265
+ import { defu as defu6 } from "defu";
3266
+ import { createJiti } from "jiti";
3267
+ async function unbuildExecutorFn(options, context2, config) {
3268
+ writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
3269
+ if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
3270
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace root directory.");
3271
+ }
3272
+ if (!context2.projectsConfigurations.projects[context2.projectName].root) {
3273
+ throw new Error("The Build process failed because the project root is not valid. Please run this command from a workspace root directory.");
3274
+ }
3275
+ if (!context2.projectsConfigurations.projects[context2.projectName].sourceRoot) {
3276
+ throw new Error("The Build process failed because the project's source root is not valid. Please run this command from a workspace root directory.");
3277
+ }
3278
+ const jiti = createJiti(config.workspaceRoot, {
3279
+ fsCache: config.skipCache ? false : joinPaths(config.workspaceRoot, config.directories.cache || "node_modules/.cache/storm", "jiti"),
3280
+ interopDefault: true
3281
+ });
3282
+ const stormUnbuild = await jiti.import(jiti.esmResolve("@storm-software/unbuild/build"));
3283
+ await stormUnbuild.build(defu6({
3284
+ ...options,
3285
+ projectRoot: context2.projectsConfigurations.projects[context2.projectName].root,
3286
+ projectName: context2.projectName,
3287
+ sourceRoot: context2.projectsConfigurations.projects[context2.projectName].sourceRoot,
3288
+ platform: options.platform
3289
+ }, {
3290
+ stubOptions: {
3291
+ jiti: {
3292
+ fsCache: config.skipCache ? false : joinPaths(config.workspaceRoot, config.directories.cache || "node_modules/.cache/storm", "jiti")
3293
+ }
3294
+ },
3295
+ rollup: {
3296
+ emitCJS: true,
3297
+ watch: false,
3298
+ dts: {
3299
+ respectExternal: true
3300
+ },
3301
+ esbuild: {
3302
+ target: options.target,
3303
+ format: "esm",
3304
+ platform: options.platform,
3305
+ minify: options.minify ?? !options.debug,
3306
+ sourcemap: options.sourcemap ?? options.debug,
3307
+ treeShaking: options.treeShaking
3308
+ }
3309
+ }
3310
+ }));
3311
+ return {
3312
+ success: true
3313
+ };
3314
+ }
3315
+ __name(unbuildExecutorFn, "unbuildExecutorFn");
3316
+ var executor_default10 = withRunExecutor("TypeScript Unbuild build", unbuildExecutorFn, {
3317
+ skipReadingConfig: false,
3318
+ hooks: {
3319
+ applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
3320
+ options.debug ??= false;
3321
+ options.treeShaking ??= true;
3322
+ options.platform ??= "neutral";
3323
+ options.entry ??= [
3324
+ "{sourceRoot}"
3325
+ ];
3326
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
3327
+ return options;
3328
+ }, "applyDefaultOptions")
3329
+ }
3330
+ });
3331
+
3332
+ // ../workspace-tools/src/generators/browser-library/generator.ts
3333
+ import { formatFiles as formatFiles2, generateFiles, names as names2, offsetFromRoot as offsetFromRoot2 } from "@nx/devkit";
3334
+
3335
+ // ../workspace-tools/src/base/base-generator.ts
3336
+ var withRunGenerator = /* @__PURE__ */ __name((name, generatorFn, generatorOptions = {
3337
+ skipReadingConfig: false
3338
+ }) => async (tree, _options) => {
3339
+ const stopwatch = getStopwatch(name);
3340
+ let options = _options;
3341
+ let config;
3342
+ try {
3343
+ writeInfo(`\u26A1 Running the ${name} generator...
3344
+
3345
+ `, config);
3346
+ const workspaceRoot3 = findWorkspaceRoot();
3347
+ if (!generatorOptions.skipReadingConfig) {
3348
+ writeDebug(`Loading the Storm Config from environment variables and storm.config.js file...
3349
+ - workspaceRoot: ${workspaceRoot3}`, config);
3350
+ config = await getConfig(workspaceRoot3);
3351
+ }
3352
+ if (generatorOptions?.hooks?.applyDefaultOptions) {
3353
+ writeDebug("Running the applyDefaultOptions hook...", config);
3354
+ options = await Promise.resolve(generatorOptions.hooks.applyDefaultOptions(options, config));
3355
+ writeDebug("Completed the applyDefaultOptions hook", config);
3356
+ }
3357
+ writeTrace(`Generator schema options \u2699\uFE0F
3358
+ ${Object.keys(options ?? {}).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`, config);
3359
+ const tokenized = await applyWorkspaceTokens(options, {
3360
+ workspaceRoot: tree.root,
3361
+ config
3362
+ }, applyWorkspaceBaseTokens);
3363
+ if (generatorOptions?.hooks?.preProcess) {
3364
+ writeDebug("Running the preProcess hook...", config);
3365
+ await Promise.resolve(generatorOptions.hooks.preProcess(tokenized, config));
3366
+ writeDebug("Completed the preProcess hook", config);
3367
+ }
3368
+ const result = await Promise.resolve(generatorFn(tree, tokenized, config));
3369
+ if (result) {
3370
+ if (result.success === false || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string") {
3371
+ throw new Error(`The ${name} generator failed to run`, {
3372
+ cause: result?.error
3373
+ });
3374
+ } else if (result.success && result.data) {
3375
+ return result;
3376
+ }
3377
+ }
3378
+ if (generatorOptions?.hooks?.postProcess) {
3379
+ writeDebug("Running the postProcess hook...", config);
3380
+ await Promise.resolve(generatorOptions.hooks.postProcess(config));
3381
+ writeDebug("Completed the postProcess hook", config);
3382
+ }
3383
+ return () => {
3384
+ writeSuccess(`Completed running the ${name} generator!
3385
+ `, config);
3386
+ };
3387
+ } catch (error) {
3388
+ return () => {
3389
+ writeFatal("A fatal error occurred while running the generator - the process was forced to terminate", config);
3390
+ writeError(`An exception was thrown in the generator's process
3391
+ - Details: ${error.message}
3392
+ - Stacktrace: ${error.stack}`, config);
3393
+ };
3394
+ } finally {
3395
+ stopwatch();
3396
+ }
3397
+ }, "withRunGenerator");
3398
+
3399
+ // ../workspace-tools/src/base/typescript-library-generator.ts
3400
+ import { addDependenciesToPackageJson, addProjectConfiguration, ensurePackage, formatFiles, names, offsetFromRoot, readJson, updateJson, writeJson } from "@nx/devkit";
3401
+ import { determineProjectNameAndRootOptions } from "@nx/devkit/src/generators/project-name-and-root-utils";
3402
+ import { addTsConfigPath, getRelativePathToRootTsConfig, tsConfigBaseOptions } from "@nx/js";
3403
+ import jsInitGenerator from "@nx/js/src/generators/init/init";
3404
+ import setupVerdaccio from "@nx/js/src/generators/setup-verdaccio/generator";
3405
+
3406
+ // ../workspace-tools/src/utils/project-tags.ts
3407
+ var ProjectTagConstants = {
3408
+ Language: {
3409
+ TAG_ID: "language",
3410
+ TYPESCRIPT: "typescript",
3411
+ RUST: "rust"
3412
+ },
3413
+ ProjectType: {
3414
+ TAG_ID: "type",
3415
+ LIBRARY: "library",
3416
+ APPLICATION: "application"
3417
+ },
3418
+ DistStyle: {
3419
+ TAG_ID: "dist-style",
3420
+ NORMAL: "normal",
3421
+ CLEAN: "clean"
3422
+ },
3423
+ Provider: {
3424
+ TAG_ID: "provider"
3425
+ },
3426
+ Platform: {
3427
+ TAG_ID: "platform",
3428
+ NODE: "node",
3429
+ BROWSER: "browser",
3430
+ NEUTRAL: "neutral",
3431
+ WORKER: "worker"
3432
+ },
3433
+ Registry: {
3434
+ TAG_ID: "registry",
3435
+ CARGO: "cargo",
3436
+ NPM: "npm",
3437
+ CONTAINER: "container",
3438
+ CYCLONE: "cyclone"
3439
+ },
3440
+ Plugin: {
3441
+ TAG_ID: "plugin"
3442
+ }
3443
+ };
3444
+ var formatProjectTag = /* @__PURE__ */ __name((variant, value) => {
3445
+ return `${variant}:${value}`;
3446
+ }, "formatProjectTag");
3447
+ var hasProjectTag = /* @__PURE__ */ __name((project, variant) => {
3448
+ project.tags = project.tags ?? [];
3449
+ const prefix = formatProjectTag(variant, "");
3450
+ return project.tags.some((tag) => tag.startsWith(prefix) && tag.length > prefix.length);
3451
+ }, "hasProjectTag");
3452
+ var addProjectTag = /* @__PURE__ */ __name((project, variant, value, options = {
3453
+ overwrite: false
3454
+ }) => {
3455
+ project.tags = project.tags ?? [];
3456
+ if (options.overwrite || !hasProjectTag(project, variant)) {
3457
+ project.tags = project.tags.filter((tag) => !tag.startsWith(formatProjectTag(variant, "")));
3458
+ project.tags.push(formatProjectTag(variant, value));
3459
+ }
3460
+ }, "addProjectTag");
3461
+
3462
+ // ../workspace-tools/src/utils/versions.ts
3463
+ var typesNodeVersion = "20.9.0";
3464
+ var nxVersion = "^18.0.4";
3465
+ var nodeVersion = "20.11.0";
3466
+ var pnpmVersion = "8.10.2";
3467
+
3468
+ // ../workspace-tools/src/base/typescript-library-generator.ts
3469
+ async function typeScriptLibraryGeneratorFn(tree, options, config) {
3470
+ const normalized = await normalizeOptions(tree, {
3471
+ ...options
3472
+ });
3473
+ const tasks = [];
3474
+ tasks.push(await jsInitGenerator(tree, {
3475
+ ...normalized,
3476
+ tsConfigName: normalized.rootProject ? "tsconfig.json" : "tsconfig.base.json"
3477
+ }));
3478
+ tasks.push(addDependenciesToPackageJson(tree, {}, {
3479
+ "@storm-software/workspace-tools": "latest",
3480
+ "@storm-software/testing-tools": "latest",
3481
+ ...options.devDependencies ?? {}
3482
+ }));
3483
+ if (normalized.publishable) {
3484
+ tasks.push(await setupVerdaccio(tree, {
3485
+ ...normalized,
3486
+ skipFormat: true
3487
+ }));
3488
+ }
3489
+ const projectConfig = {
3490
+ root: normalized.directory,
3491
+ projectType: "library",
3492
+ sourceRoot: joinPaths(normalized.directory ?? "", "src"),
3493
+ targets: {
3494
+ build: {
3495
+ executor: options.buildExecutor,
3496
+ outputs: [
3497
+ "{options.outputPath}"
3498
+ ],
3499
+ options: {
3500
+ entry: [
3501
+ joinPaths(normalized.projectRoot, "src", "index.ts")
3502
+ ],
3503
+ outputPath: getOutputPath(normalized),
3504
+ tsconfig: joinPaths(normalized.projectRoot, "tsconfig.json"),
3505
+ project: joinPaths(normalized.projectRoot, "package.json"),
3506
+ defaultConfiguration: "production",
3507
+ platform: "neutral",
3508
+ assets: [
3509
+ {
3510
+ input: normalized.projectRoot,
3511
+ glob: "*.md",
3512
+ output: "/"
3513
+ },
3514
+ {
3515
+ input: "",
3516
+ glob: "LICENSE",
3517
+ output: "/"
3518
+ }
3519
+ ]
3520
+ },
3521
+ configurations: {
3522
+ production: {
3523
+ debug: false,
3524
+ verbose: false
3525
+ },
3526
+ development: {
3527
+ debug: true,
3528
+ verbose: true
3529
+ }
3530
+ }
3531
+ }
3532
+ }
3533
+ };
3534
+ if (options.platform) {
3535
+ projectConfig.targets.build.options.platform = options.platform === "worker" ? "node" : options.platform;
3536
+ }
3537
+ addProjectTag(projectConfig, ProjectTagConstants.Platform.TAG_ID, options.platform === "node" ? ProjectTagConstants.Platform.NODE : options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL, {
3538
+ overwrite: false
3539
+ });
3540
+ createProjectTsConfigJson(tree, normalized);
3541
+ addProjectConfiguration(tree, normalized.name, projectConfig);
3542
+ let repository = {
3543
+ type: "github",
3544
+ url: config?.repository || `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
3545
+ };
3546
+ let description = options.description || "A package developed by Storm Software used to create modern, scalable web applications.";
3547
+ if (tree.exists("package.json")) {
3548
+ const packageJson = readJson(tree, "package.json");
3549
+ if (packageJson?.repository) {
3550
+ repository = packageJson.repository;
3551
+ }
3552
+ if (packageJson?.description) {
3553
+ description = packageJson.description;
3554
+ }
3555
+ }
3556
+ if (!normalized.importPath) {
3557
+ normalized.importPath = normalized.name;
3558
+ }
3559
+ const packageJsonPath = joinPaths(normalized.projectRoot, "package.json");
3560
+ if (tree.exists(packageJsonPath)) {
3561
+ updateJson(tree, packageJsonPath, (json) => {
3562
+ if (!normalized.importPath) {
3563
+ normalized.importPath = normalized.name;
3564
+ }
3565
+ json.name = normalized.importPath;
3566
+ json.version = "0.0.1";
3567
+ if (json.private && (normalized.publishable || normalized.rootProject)) {
3568
+ json.private = void 0;
3569
+ }
3570
+ return {
3571
+ ...json,
3572
+ version: "0.0.1",
3573
+ description,
3574
+ repository: {
3575
+ ...repository,
3576
+ directory: normalized.projectRoot
3577
+ },
3578
+ type: "module",
3579
+ dependencies: {
3580
+ ...json.dependencies
3581
+ },
3582
+ publishConfig: {
3583
+ access: "public"
3584
+ }
3585
+ };
3586
+ });
3587
+ } else {
3588
+ writeJson(tree, packageJsonPath, {
3589
+ name: normalized.importPath,
3590
+ version: "0.0.1",
3591
+ description,
3592
+ repository: {
3593
+ ...repository,
3594
+ directory: normalized.projectRoot
3595
+ },
3596
+ private: !normalized.publishable || normalized.rootProject,
3597
+ type: "module",
3598
+ publishConfig: {
3599
+ access: "public"
3600
+ }
3601
+ });
3602
+ }
3603
+ if (tree.exists("package.json") && normalized.importPath) {
3604
+ updateJson(tree, "package.json", (json) => ({
3605
+ ...json,
3606
+ pnpm: {
3607
+ ...json?.pnpm,
3608
+ overrides: {
3609
+ ...json?.pnpm?.overrides,
3610
+ [normalized.importPath ?? ""]: "workspace:*"
3611
+ }
3612
+ }
3613
+ }));
3614
+ }
3615
+ addTsConfigPath(tree, normalized.importPath, [
3616
+ joinPaths(normalized.projectRoot, "./src", `index.${normalized.js ? "js" : "ts"}`)
3617
+ ]);
3618
+ addTsConfigPath(tree, joinPaths(normalized.importPath, "/*"), [
3619
+ joinPaths(normalized.projectRoot, "./src", "/*")
3620
+ ]);
3621
+ if (tree.exists("package.json")) {
3622
+ const packageJson = readJson(tree, "package.json");
3623
+ if (packageJson?.repository) {
3624
+ repository = packageJson.repository;
3625
+ }
3626
+ if (packageJson?.description) {
3627
+ description = packageJson.description;
3628
+ }
3629
+ }
3630
+ const tsconfigPath = joinPaths(normalized.projectRoot, "tsconfig.json");
3631
+ if (tree.exists(tsconfigPath)) {
3632
+ updateJson(tree, tsconfigPath, (json) => {
3633
+ json.composite ??= true;
3634
+ return json;
3635
+ });
3636
+ } else {
3637
+ writeJson(tree, tsconfigPath, {
3638
+ extends: `${offsetFromRoot(normalized.projectRoot)}tsconfig.base.json`,
3639
+ composite: true,
3640
+ compilerOptions: {
3641
+ outDir: `${offsetFromRoot(normalized.projectRoot)}dist/out-tsc`
3642
+ },
3643
+ files: [],
3644
+ include: [
3645
+ "src/**/*.ts",
3646
+ "src/**/*.js"
3647
+ ],
3648
+ exclude: [
3649
+ "jest.config.ts",
3650
+ "src/**/*.spec.ts",
3651
+ "src/**/*.test.ts"
3652
+ ]
3653
+ });
3654
+ }
3655
+ await formatFiles(tree);
3656
+ return null;
3657
+ }
3658
+ __name(typeScriptLibraryGeneratorFn, "typeScriptLibraryGeneratorFn");
3659
+ function getOutputPath(options) {
3660
+ const parts = [
3661
+ "dist"
3662
+ ];
3663
+ if (options.projectRoot === ".") {
3664
+ parts.push(options.name);
3665
+ } else {
3666
+ parts.push(options.projectRoot);
3667
+ }
3668
+ return joinPaths(...parts);
3669
+ }
3670
+ __name(getOutputPath, "getOutputPath");
3671
+ function createProjectTsConfigJson(tree, options) {
3672
+ const tsconfig = {
3673
+ extends: options.rootProject ? void 0 : getRelativePathToRootTsConfig(tree, options.projectRoot),
3674
+ ...options?.tsconfigOptions ?? {},
3675
+ compilerOptions: {
3676
+ ...options.rootProject ? tsConfigBaseOptions : {},
3677
+ outDir: joinPaths(offsetFromRoot(options.projectRoot), "dist/out-tsc"),
3678
+ noEmit: true,
3679
+ ...options?.tsconfigOptions?.compilerOptions ?? {}
3680
+ },
3681
+ files: [
3682
+ ...options?.tsconfigOptions?.files ?? []
3683
+ ],
3684
+ include: [
3685
+ ...options?.tsconfigOptions?.include ?? [],
3686
+ "src/**/*.ts",
3687
+ "src/**/*.js",
3688
+ "bin/**/*"
3689
+ ],
3690
+ exclude: [
3691
+ ...options?.tsconfigOptions?.exclude ?? [],
3692
+ "jest.config.ts",
3693
+ "src/**/*.spec.ts",
3694
+ "src/**/*.test.ts"
3695
+ ]
3696
+ };
3697
+ writeJson(tree, joinPaths(options.projectRoot, "tsconfig.json"), tsconfig);
3698
+ }
3699
+ __name(createProjectTsConfigJson, "createProjectTsConfigJson");
3700
+ async function normalizeOptions(tree, options, config) {
3701
+ let importPath = options.importPath;
3702
+ if (!importPath && config?.namespace) {
3703
+ importPath = `@${config?.namespace}/${options.name}`;
3704
+ }
3705
+ if (options.publishable) {
3706
+ if (!importPath) {
3707
+ throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
3708
+ }
3709
+ }
3710
+ let bundler = "tsc";
3711
+ if (options.publishable === false && options.buildable === false) {
3712
+ bundler = "none";
3713
+ }
3714
+ const { Linter } = ensurePackage("@nx/eslint", nxVersion);
3715
+ const rootProject = false;
3716
+ const { projectName, names: projectNames, projectRoot, importPath: normalizedImportPath } = await determineProjectNameAndRootOptions(tree, {
3717
+ name: options.name,
3718
+ projectType: "library",
3719
+ directory: options.directory,
3720
+ importPath,
3721
+ rootProject
3722
+ });
3723
+ const normalized = names(projectNames.projectFileName);
3724
+ const fileName = normalized.fileName;
3725
+ return {
3726
+ js: false,
3727
+ pascalCaseFiles: false,
3728
+ skipFormat: false,
3729
+ skipTsConfig: false,
3730
+ includeBabelRc: false,
3731
+ unitTestRunner: "jest",
3732
+ linter: Linter.EsLint,
3733
+ testEnvironment: "node",
3734
+ config: "project",
3735
+ compiler: "tsc",
3736
+ bundler,
3737
+ skipTypeCheck: false,
3738
+ minimal: false,
3739
+ hasPlugin: false,
3740
+ isUsingTsSolutionConfig: false,
3741
+ projectPackageManagerWorkspaceState: "included",
3742
+ ...options,
3743
+ fileName,
3744
+ name: projectName,
3745
+ projectNames,
3746
+ projectRoot,
3747
+ parsedTags: options.tags ? options.tags.split(",").map((s) => s.trim()) : [],
3748
+ importPath: normalizedImportPath,
3749
+ rootProject
3750
+ };
3751
+ }
3752
+ __name(normalizeOptions, "normalizeOptions");
3753
+
3754
+ // ../workspace-tools/src/generators/browser-library/generator.ts
3755
+ async function browserLibraryGeneratorFn(tree, schema, config) {
3756
+ const filesDir = joinPaths(__dirname, "src", "generators", "browser-library", "files");
3757
+ const tsLibraryGeneratorOptions = {
3758
+ buildExecutor: "@storm-software/workspace-tools:unbuild",
3759
+ platform: "browser",
3760
+ devDependencies: {
3761
+ "@types/react": "^18.3.6",
3762
+ "@types/react-dom": "^18.3.0"
3763
+ },
3764
+ peerDependencies: {
3765
+ react: "^18.3.0",
3766
+ "react-dom": "^18.3.0",
3767
+ "react-native": "*"
3768
+ },
3769
+ peerDependenciesMeta: {
3770
+ "react-dom": {
3771
+ optional: true
3772
+ },
3773
+ "react-native": {
3774
+ optional: true
3775
+ }
3776
+ },
3777
+ ...schema,
3778
+ description: schema.description,
3779
+ directory: schema.directory
3780
+ };
3781
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
3782
+ const { className, name, propertyName } = names2(options.projectNames.projectFileName);
3783
+ generateFiles(tree, filesDir, options.projectRoot, {
3784
+ ...schema,
3785
+ dot: ".",
3786
+ className,
3787
+ name,
3788
+ namespace: process.env.STORM_NAMESPACE ?? "storm-software",
3789
+ description: schema.description ?? "",
3790
+ propertyName,
3791
+ js: !!options.js,
3792
+ cliCommand: "nx",
3793
+ strict: void 0,
3794
+ tmpl: "",
3795
+ offsetFromRoot: offsetFromRoot2(options.projectRoot),
3796
+ buildable: options.bundler && options.bundler !== "none",
3797
+ hasUnitTestRunner: options.unitTestRunner !== "none",
3798
+ tsConfigOptions: {
3799
+ compilerOptions: {
3800
+ jsx: "react",
3801
+ types: [
3802
+ "node",
3803
+ "@nx/react/typings/cssmodule.d.ts",
3804
+ "@nx/react/typings/image.d.ts"
3805
+ ]
3806
+ }
3807
+ }
3808
+ });
3809
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
3810
+ await formatFiles2(tree);
3811
+ return null;
3812
+ }
3813
+ __name(browserLibraryGeneratorFn, "browserLibraryGeneratorFn");
3814
+ var generator_default = withRunGenerator("TypeScript Library Creator (Browser Platform)", browserLibraryGeneratorFn, {
3815
+ hooks: {
3816
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
3817
+ options.description ??= "A library used by Storm Software to support browser applications";
3818
+ options.platform ??= "browser";
3819
+ return options;
3820
+ }, "applyDefaultOptions")
3821
+ }
3822
+ });
3823
+
3824
+ // ../workspace-tools/src/generators/config-schema/generator.ts
3825
+ import { formatFiles as formatFiles3, writeJson as writeJson2 } from "@nx/devkit";
3826
+ import { zodToJsonSchema } from "zod-to-json-schema";
3827
+ async function configSchemaGeneratorFn(tree, options, config) {
3828
+ writeInfo("\u{1F4E6} Running Storm Configuration JSON Schema generator", config);
3829
+ writeTrace(`Determining the Storm Configuration JSON Schema...`, config);
3830
+ const jsonSchema = zodToJsonSchema(StormConfigSchema, {
3831
+ name: "StormWorkspaceConfiguration"
3832
+ });
3833
+ writeTrace(jsonSchema, config);
3834
+ const outputPath = options.outputFile.replaceAll("{workspaceRoot}", "").replaceAll(config?.workspaceRoot ?? findWorkspaceRoot(), options.outputFile?.startsWith("./") ? "" : "./");
3835
+ writeTrace(`\u{1F4DD} Writing Storm Configuration JSON Schema to "${outputPath}"`, config);
3836
+ writeJson2(tree, outputPath, jsonSchema, {
3837
+ spaces: 2
3838
+ });
3839
+ await formatFiles3(tree);
3840
+ writeSuccess("\u{1F680} Storm Configuration JSON Schema creation has completed successfully!", config);
3841
+ return {
3842
+ success: true
3843
+ };
3844
+ }
3845
+ __name(configSchemaGeneratorFn, "configSchemaGeneratorFn");
3846
+ var generator_default2 = withRunGenerator("Configuration Schema Creator", configSchemaGeneratorFn, {
3847
+ hooks: {
3848
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
3849
+ options.outputFile ??= "{workspaceRoot}/storm-workspace.schema.json";
3850
+ return options;
3851
+ }, "applyDefaultOptions")
3852
+ }
3853
+ });
3854
+
3855
+ // ../workspace-tools/src/generators/init/init.ts
3856
+ import { addDependenciesToPackageJson as addDependenciesToPackageJson2, formatFiles as formatFiles4 } from "@nx/devkit";
3857
+ async function initGenerator(tree, schema) {
3858
+ const task = addDependenciesToPackageJson2(tree, {
3859
+ nx: "^19.6.2",
3860
+ "@nx/workspace": "^19.6.2",
3861
+ "@nx/js": "^19.6.2",
3862
+ "@storm-software/eslint": "latest",
3863
+ "@storm-software/prettier": "latest",
3864
+ "@storm-software/config-tools": "latest",
3865
+ "@storm-software/testing-tools": "latest",
3866
+ "@storm-software/git-tools": "latest",
3867
+ "@storm-software/linting-tools": "latest"
3868
+ }, {});
3869
+ if (!schema.skipFormat) {
3870
+ await formatFiles4(tree);
3871
+ }
3872
+ return task;
3873
+ }
3874
+ __name(initGenerator, "initGenerator");
3875
+
3876
+ // ../workspace-tools/src/generators/neutral-library/generator.ts
3877
+ import { formatFiles as formatFiles5, generateFiles as generateFiles2, names as names3, offsetFromRoot as offsetFromRoot3 } from "@nx/devkit";
3878
+ async function neutralLibraryGeneratorFn(tree, schema, config) {
3879
+ const filesDir = joinPaths(__dirname, "src", "generators", "neutral-library", "files");
3880
+ const tsLibraryGeneratorOptions = {
3881
+ ...schema,
3882
+ platform: "neutral",
3883
+ devDependencies: {},
3884
+ buildExecutor: "@storm-software/workspace-tools:unbuild"
3885
+ };
3886
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
3887
+ const { className, name, propertyName } = names3(options.projectNames.projectFileName);
3888
+ generateFiles2(tree, filesDir, options.projectRoot, {
3889
+ ...schema,
3890
+ dot: ".",
3891
+ className,
3892
+ name,
3893
+ namespace: process.env.STORM_NAMESPACE ?? "storm-software",
3894
+ description: schema.description ?? "",
3895
+ propertyName,
3896
+ js: !!options.js,
3897
+ cliCommand: "nx",
3898
+ strict: void 0,
3899
+ tmpl: "",
3900
+ offsetFromRoot: offsetFromRoot3(options.projectRoot),
3901
+ buildable: options.bundler && options.bundler !== "none",
3902
+ hasUnitTestRunner: options.unitTestRunner !== "none"
3903
+ });
3904
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
3905
+ await formatFiles5(tree);
3906
+ return null;
3907
+ }
3908
+ __name(neutralLibraryGeneratorFn, "neutralLibraryGeneratorFn");
3909
+ var generator_default3 = withRunGenerator("TypeScript Library Creator (Neutral Platform)", neutralLibraryGeneratorFn, {
3910
+ hooks: {
3911
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
3912
+ options.description ??= "A library used by Storm Software to support either browser or NodeJs applications";
3913
+ options.platform = "neutral";
3914
+ return options;
3915
+ }, "applyDefaultOptions")
3916
+ }
3917
+ });
3918
+
3919
+ // ../workspace-tools/src/generators/node-library/generator.ts
3920
+ import { formatFiles as formatFiles6, generateFiles as generateFiles3, names as names4, offsetFromRoot as offsetFromRoot4 } from "@nx/devkit";
3921
+ async function nodeLibraryGeneratorFn(tree, schema, config) {
3922
+ const filesDir = joinPaths(__dirname, "src", "generators", "node-library", "files");
3923
+ const tsLibraryGeneratorOptions = {
3924
+ platform: "node",
3925
+ devDependencies: {
3926
+ "@types/node": typesNodeVersion
3927
+ },
3928
+ buildExecutor: "@storm-software/workspace-tools:unbuild",
3929
+ ...schema,
3930
+ directory: schema.directory,
3931
+ description: schema.description
3932
+ };
3933
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
3934
+ const { className, name, propertyName } = names4(options.name);
3935
+ generateFiles3(tree, filesDir, options.projectRoot, {
3936
+ ...schema,
3937
+ dot: ".",
3938
+ className,
3939
+ name,
3940
+ namespace: process.env.STORM_NAMESPACE ?? "storm-software",
3941
+ description: schema.description ?? "",
3942
+ propertyName,
3943
+ js: !!options.js,
3944
+ cliCommand: "nx",
3945
+ strict: void 0,
3946
+ tmpl: "",
3947
+ offsetFromRoot: offsetFromRoot4(options.projectRoot),
3948
+ buildable: options.bundler && options.bundler !== "none",
3949
+ hasUnitTestRunner: options.unitTestRunner !== "none"
3950
+ });
3951
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
3952
+ await formatFiles6(tree);
3953
+ return null;
3954
+ }
3955
+ __name(nodeLibraryGeneratorFn, "nodeLibraryGeneratorFn");
3956
+ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Platform)", nodeLibraryGeneratorFn, {
3957
+ hooks: {
3958
+ applyDefaultOptions: /* @__PURE__ */ __name((options) => {
3959
+ options.description ??= "A library used by Storm Software to support NodeJs applications";
3960
+ options.platform ??= "node";
3961
+ return options;
3962
+ }, "applyDefaultOptions")
3963
+ }
3964
+ });
3965
+
3966
+ // ../workspace-tools/src/generators/preset/generator.ts
3967
+ import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments4, updateJson as updateJson2 } from "@nx/devkit";
3968
+ import * as path6 from "node:path";
3969
+ async function presetGeneratorFn(tree, options) {
3970
+ const projectRoot = ".";
3971
+ options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
3972
+ options.namespace ??= options.organization;
3973
+ addProjectConfiguration2(tree, `@${options.namespace}/${options.name}`, {
3974
+ root: projectRoot,
3975
+ projectType: "application",
3976
+ targets: {
3977
+ "local-registry": {
3978
+ executor: "@nx/js:verdaccio",
3979
+ options: {
3980
+ port: 4873,
3981
+ config: ".verdaccio/config.yml",
3982
+ storage: "tmp/local-registry/storage"
3983
+ }
3984
+ }
3985
+ }
3986
+ });
3987
+ updateJson2(tree, "package.json", (json) => {
3988
+ json.scripts = json.scripts || {};
3989
+ json.version = "0.0.0";
3990
+ json.triggerEmptyDevReleaseByIncrementingThisNumber = 0;
3991
+ json.private = true;
3992
+ json.keywords ??= [
3993
+ options.name,
3994
+ options.namespace,
3995
+ "storm",
3996
+ "storm-stack",
3997
+ "storm-ops",
3998
+ "acidic",
3999
+ "acidic-engine",
4000
+ "cyclone-ui",
4001
+ "rust",
4002
+ "nx",
4003
+ "graphql",
4004
+ "sullivanpj",
4005
+ "monorepo"
4006
+ ];
4007
+ json.homepage ??= "https://stormsoftware.com";
4008
+ json.bugs ??= {
4009
+ url: `https://github.com/${options.organization}/${options.name}/issues`,
4010
+ email: "support@stormsoftware.com"
4011
+ };
4012
+ json.license = "Apache-2.0";
4013
+ json.author ??= {
4014
+ name: "Storm Software",
4015
+ email: "contact@stormsoftware.com",
4016
+ url: "https://stormsoftware.com"
4017
+ };
4018
+ json.maintainers ??= [
4019
+ {
4020
+ "name": "Storm Software",
4021
+ "email": "contact@stormsoftware.com",
4022
+ "url": "https://stormsoftware.com"
4023
+ },
4024
+ {
4025
+ "name": "Pat Sullivan",
4026
+ "email": "admin@stormsoftware.com",
4027
+ "url": "https://patsullivan.org"
4028
+ }
4029
+ ];
4030
+ json.funding ??= {
4031
+ type: "github",
4032
+ url: "https://github.com/sponsors/storm-software"
4033
+ };
4034
+ json.namespace ??= `@${options.namespace}`;
4035
+ json.description ??= options.description;
4036
+ options.repositoryUrl ??= `https://github.com/${options.organization}/${options.name}`;
4037
+ json.repository ??= {
4038
+ type: "github",
4039
+ url: `${options.repositoryUrl}.git`
4040
+ };
4041
+ json.packageManager ??= "pnpm@9.15.2";
4042
+ json.engines ??= {
4043
+ "node": ">=20.11.0",
4044
+ "pnpm": ">=9.15.2"
4045
+ };
4046
+ json.prettier = "@storm-software/prettier/config.json";
4047
+ json.nx ??= {
4048
+ "includedScripts": [
4049
+ "lint-sherif",
4050
+ "lint-knip",
4051
+ "lint-ls",
4052
+ "lint",
4053
+ "format",
4054
+ "format-sherif",
4055
+ "format-readme",
4056
+ "format-prettier",
4057
+ "format-toml",
4058
+ "commit",
4059
+ "release"
4060
+ ]
4061
+ };
4062
+ json.scripts.adr = "pnpm log4brains adr new";
4063
+ json.scripts["adr-preview"] = "pnpm log4brains preview";
4064
+ json.scripts.prepare = "pnpm add lefthook -w && pnpm lefthook install";
4065
+ json.scripts.preinstall = "npx -y only-allow pnpm";
4066
+ json.scripts["install-csb"] = "corepack enable && pnpm install --no-frozen-lockfile";
4067
+ json.scripts.clean = "rimraf dist && rimraf --glob packages/**/dist && rimraf --glob tools/**/dist && rimraf --glob docs/**/dist && rimraf --glob apps/**/dist && rimraf --glob libs/**/dist";
4068
+ json.scripts.nuke = "nx clear-cache && rimraf .nx/cache && rimraf .nx/workspace-data && pnpm clean && rimraf pnpm-lock.yaml && rimraf --glob packages/**/node_modules && rimraf --glob tools/**/node_modules && rimraf node_modules";
4069
+ json.scripts.prebuild = "pnpm clean";
4070
+ json.scripts.build = "nx affected -t build --parallel=5";
4071
+ json.scripts["build-all"] = "nx run-many -t build --all --parallel=5";
4072
+ json.scripts["build-prod"] = "nx run-many -t build --all --prod --parallel=5";
4073
+ json.scripts["build-tools"] = "nx run-many -t build --projects=tools/* --parallel=5";
4074
+ json.scripts["build-docs"] = "nx run-many -t build --projects=docs/* --parallel=5";
4075
+ if (!options.includeApps) {
4076
+ json.scripts["build-packages"] = "nx run-many -t build --projects=packages/* --parallel=5";
4077
+ } else {
4078
+ json.scripts["build-apps"] = "nx run-many -t build --projects=apps/* --parallel=5";
4079
+ json.scripts["build-libs"] = "nx run-many -t build --projects=libs/* --parallel=5";
4080
+ json.scripts["build-storybook"] = "storybook build -s public";
4081
+ }
4082
+ json.scripts.nx = "nx";
4083
+ json.scripts.graph = "nx graph";
4084
+ json.scripts.lint = "pnpm storm-lint all --skip-cspell --skip-alex";
4085
+ if (options.includeApps) {
4086
+ json.scripts.start = "nx serve";
4087
+ json.scripts.storybook = "pnpm storybook dev -p 6006";
4088
+ }
4089
+ json.scripts.help = "nx help";
4090
+ json.scripts["dep-graph"] = "nx dep-graph";
4091
+ json.scripts["local-registry"] = `nx local-registry @${options.namespace}/${options.name}`;
4092
+ json.scripts.e2e = "nx e2e";
4093
+ if (options.includeApps) {
4094
+ json.scripts.test = "nx test && pnpm test-storybook";
4095
+ json.scripts["test-storybook"] = "pnpm test-storybook";
4096
+ } else {
4097
+ json.scripts.test = "nx test";
4098
+ }
4099
+ json.scripts.lint = "pnpm storm-lint all --skip-cspell --skip-alex";
4100
+ json.scripts.commit = "pnpm storm-git commit";
4101
+ json.scripts["api-extractor"] = 'pnpm storm-docs api-extractor --outputPath="docs/api-reference" --clean';
4102
+ json.scripts.release = "pnpm storm-git release";
4103
+ json.scripts.format = "nx format:write";
4104
+ json.scripts["format-sherif"] = "pnpm exec sherif -f -i typescript -i react -i react-dom";
4105
+ json.scripts["format-toml"] = 'pnpm exec taplo format --config="./node_modules/@storm-software/linting-tools/taplo/config.toml" --cache-path="./node_modules/.cache/storm/taplo"';
4106
+ json.scripts["format-readme"] = 'pnpm storm-git readme --templates="tools/readme-templates"';
4107
+ json.scripts["format-prettier"] = "pnpm exec prettier --write --ignore-unknown --no-error-on-unmatched-pattern --cache && git update-index";
4108
+ json.scripts.lint = "pnpm storm-lint all --skip-cspell";
4109
+ json.scripts["lint-knip"] = "pnpm exec knip";
4110
+ json.scripts["lint-sherif"] = "pnpm exec sherif -i typescript -i react -i react-dom";
4111
+ json.scripts["lint-ls"] = 'pnpm exec ls-lint --config="./node_modules/@storm-software/linting-tools/ls-lint/ls-lint.yml"';
4112
+ json.packageManager ??= `pnpm@${pnpmVersion}`;
4113
+ json.engines = {
4114
+ node: `>=${nodeVersion}`,
4115
+ pnpm: `>=${pnpmVersion}`
4116
+ };
4117
+ return json;
4118
+ });
4119
+ generateFiles4(tree, path6.join(__dirname, "files"), projectRoot, {
4120
+ ...options,
4121
+ pnpmVersion,
4122
+ nodeVersion
4123
+ });
4124
+ await formatFiles7(tree);
4125
+ let dependencies = {
4126
+ "@ls-lint/ls-lint": "2.2.3",
4127
+ "@ltd/j-toml": "1.38.0",
4128
+ "@nx/devkit": "^20.2.2",
4129
+ "@nx/eslint-plugin": "^20.2.2",
4130
+ "@nx/js": "^20.2.2",
4131
+ "@nx/workspace": "^20.2.2",
4132
+ "@storm-software/config": "latest",
4133
+ "@storm-software/git-tools": "latest",
4134
+ "@storm-software/linting-tools": "latest",
4135
+ "@storm-software/testing-tools": "latest",
4136
+ "@storm-software/workspace-tools": "latest",
4137
+ "@storm-software/eslint": "latest",
4138
+ "@storm-software/cspell": "latest",
4139
+ "@storm-software/prettier": "latest",
4140
+ "@taplo/cli": "0.7.0",
4141
+ "@types/node": "^20.14.10",
4142
+ "copyfiles": "2.4.1",
4143
+ "eslint": "9.5.0",
4144
+ "jest": "29.7.0",
4145
+ "jest-environment-node": "29.7.0",
4146
+ "knip": "5.25.2",
4147
+ "lefthook": "1.6.18",
4148
+ "nx": "^20.2.2",
4149
+ "prettier": "3.3.2",
4150
+ "prettier-plugin-prisma": "5.0.0",
4151
+ "rimraf": "5.0.7",
4152
+ "sherif": "0.10.0",
4153
+ "ts-jest": "29.1.5",
4154
+ "ts-node": "10.9.2",
4155
+ "tslib": "2.6.3",
4156
+ "typescript": "5.5.3",
4157
+ "verdaccio": "5.31.1"
4158
+ };
4159
+ if (options.includeApps) {
4160
+ dependencies = {
4161
+ ...dependencies,
4162
+ react: "latest",
4163
+ "react-dom": "latest",
4164
+ storybook: "latest",
4165
+ "@storybook/addons": "latest",
4166
+ "@nx/react": "latest",
4167
+ "@nx/next": "latest",
4168
+ "@nx/node": "latest",
4169
+ "@nx/storybook": "latest",
4170
+ "jest-environment-jsdom": "29.7.0"
4171
+ };
4172
+ }
4173
+ if (options.includeRust) {
4174
+ dependencies = {
4175
+ ...dependencies,
4176
+ "@monodon/rust": "1.4.0"
4177
+ };
4178
+ }
4179
+ if (options.nxCloud) {
4180
+ dependencies = {
4181
+ ...dependencies,
4182
+ "nx-cloud": "latest"
4183
+ };
4184
+ }
4185
+ await Promise.resolve(addDependenciesToPackageJson3(tree, dependencies, {}, joinPathFragments4(projectRoot, "package.json")));
4186
+ return null;
4187
+ }
4188
+ __name(presetGeneratorFn, "presetGeneratorFn");
4189
+ var generator_default5 = withRunGenerator("Storm Workspace Preset Generator", presetGeneratorFn);
4190
+
4191
+ // ../workspace-tools/src/generators/release-version/generator.ts
4192
+ import { formatFiles as formatFiles8, joinPathFragments as joinPathFragments5, output, readJson as readJson2, updateJson as updateJson3, writeJson as writeJson3 } from "@nx/devkit";
4193
+ import { resolveLocalPackageDependencies as resolveLocalPackageJsonDependencies } from "@nx/js/src/generators/release-version/utils/resolve-local-package-dependencies";
4194
+ import { updateLockFile } from "@nx/js/src/generators/release-version/utils/update-lock-file";
4195
+
4196
+ // ../git-tools/src/types.ts
4197
+ var RuleConfigSeverity;
4198
+ (function(RuleConfigSeverity2) {
4199
+ RuleConfigSeverity2[RuleConfigSeverity2["Disabled"] = 0] = "Disabled";
4200
+ RuleConfigSeverity2[RuleConfigSeverity2["Warning"] = 1] = "Warning";
4201
+ RuleConfigSeverity2[RuleConfigSeverity2["Error"] = 2] = "Error";
4202
+ })(RuleConfigSeverity || (RuleConfigSeverity = {}));
4203
+
4204
+ // ../git-tools/src/release/changelog-renderer.ts
4205
+ import ChangelogRenderer from "nx/release/changelog-renderer/index";
4206
+
4207
+ // ../workspace-tools/src/generators/release-version/generator.ts
4208
+ import { exec as exec2, execSync as execSync5 } from "node:child_process";
4209
+ import { relative as relative3 } from "node:path";
4210
+ import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
4211
+ import { getFirstGitCommit, getLatestGitTagForPattern } from "nx/src/command-line/release/utils/git";
4212
+ import { resolveSemverSpecifierFromConventionalCommits, resolveSemverSpecifierFromPrompt } from "nx/src/command-line/release/utils/resolve-semver-specifier";
4213
+ import { isValidSemverSpecifier } from "nx/src/command-line/release/utils/semver";
4214
+ import { deriveNewSemverVersion, validReleaseVersionPrefixes } from "nx/src/command-line/release/version";
4215
+ import { interpolate } from "nx/src/tasks-runner/utils";
4216
+ import { prerelease } from "semver";
4217
+
4218
+ // ../workspace-tools/src/base/base-executor.untyped.ts
4219
+ import { defineUntypedSchema } from "untyped";
4220
+ var base_executor_untyped_default = defineUntypedSchema({
4221
+ $schema: {
4222
+ id: "baseExecutor",
4223
+ title: "Base Executor",
4224
+ description: "A base type definition for an executor schema"
4225
+ },
4226
+ outputPath: {
4227
+ $schema: {
4228
+ title: "Output Path",
4229
+ type: "string",
4230
+ format: "path",
4231
+ description: "The output path for the build"
4232
+ },
4233
+ $default: "dist/{projectRoot}"
4234
+ }
4235
+ });
4236
+
4237
+ // ../workspace-tools/src/base/base-generator.untyped.ts
4238
+ import { defineUntypedSchema as defineUntypedSchema2 } from "untyped";
4239
+ var base_generator_untyped_default = defineUntypedSchema2({
4240
+ $schema: {
4241
+ id: "BaseGeneratorSchema",
4242
+ title: "Base Generator",
4243
+ description: "A type definition for the base Generator schema"
4244
+ },
4245
+ directory: {
4246
+ $schema: {
4247
+ title: "Directory",
4248
+ type: "string",
4249
+ description: "The directory to create the library in"
4250
+ }
4251
+ }
4252
+ });
4253
+
4254
+ // ../workspace-tools/src/base/cargo-base-executor.untyped.ts
4255
+ import { defineUntypedSchema as defineUntypedSchema3 } from "untyped";
4256
+ var cargo_base_executor_untyped_default = defineUntypedSchema3({
4257
+ ...base_executor_untyped_default,
4258
+ $schema: {
4259
+ id: "cargoBaseExecutor",
4260
+ title: "Cargo Base Executor",
4261
+ description: "A base type definition for a Cargo/rust related executor schema"
4262
+ },
4263
+ package: {
4264
+ $schema: {
4265
+ title: "Cargo.toml Path",
4266
+ type: "string",
4267
+ format: "path",
4268
+ description: "The path to the Cargo.toml file"
4269
+ },
4270
+ $default: "{projectRoot}/Cargo.toml"
4271
+ },
4272
+ toolchain: {
4273
+ $schema: {
4274
+ title: "Toolchain",
4275
+ description: "The type of toolchain to use for the build",
4276
+ enum: [
4277
+ "stable",
4278
+ "beta",
4279
+ "nightly"
4280
+ ],
4281
+ default: "stable"
4282
+ },
4283
+ $default: "stable"
4284
+ },
4285
+ target: {
4286
+ $schema: {
4287
+ title: "Target",
4288
+ type: "string",
4289
+ description: "The target to build"
4290
+ }
4291
+ },
4292
+ allTargets: {
4293
+ $schema: {
4294
+ title: "All Targets",
4295
+ type: "boolean",
4296
+ description: "Build all targets"
4297
+ }
4298
+ },
4299
+ profile: {
4300
+ $schema: {
4301
+ title: "Profile",
4302
+ type: "string",
4303
+ description: "The profile to build"
4304
+ }
4305
+ },
4306
+ release: {
4307
+ $schema: {
4308
+ title: "Release",
4309
+ type: "boolean",
4310
+ description: "Build in release mode"
4311
+ }
4312
+ },
4313
+ features: {
4314
+ $schema: {
4315
+ title: "Features",
4316
+ type: "string",
4317
+ description: "The features to build",
4318
+ oneOf: [
4319
+ {
4320
+ type: "string"
4321
+ },
4322
+ {
4323
+ type: "array",
4324
+ items: {
4325
+ type: "string"
4326
+ }
4327
+ }
4328
+ ]
4329
+ }
4330
+ },
4331
+ allFeatures: {
4332
+ $schema: {
4333
+ title: "All Features",
4334
+ type: "boolean",
4335
+ description: "Build all features"
4336
+ }
4337
+ }
4338
+ });
4339
+
4340
+ // ../workspace-tools/src/base/typescript-build-executor.untyped.ts
4341
+ import { defineUntypedSchema as defineUntypedSchema4 } from "untyped";
4342
+ var typescript_build_executor_untyped_default = defineUntypedSchema4({
4343
+ ...base_executor_untyped_default,
4344
+ $schema: {
4345
+ id: "TypeScriptBuildExecutorSchema",
4346
+ title: "TypeScript Build Executor",
4347
+ description: "A type definition for the base TypeScript build executor schema",
4348
+ required: [
4349
+ "entry",
4350
+ "tsconfig"
4351
+ ]
4352
+ },
4353
+ entry: {
4354
+ $schema: {
4355
+ title: "Entry File(s)",
4356
+ format: "path",
4357
+ type: "array",
4358
+ description: "The entry file or files to build",
4359
+ items: {
4360
+ type: "string"
4361
+ }
4362
+ },
4363
+ $default: [
4364
+ "{sourceRoot}/index.ts"
4365
+ ]
4366
+ },
4367
+ tsconfig: {
4368
+ $schema: {
4369
+ title: "TSConfig Path",
4370
+ type: "string",
4371
+ format: "path",
4372
+ description: "The path to the tsconfig file"
4373
+ },
4374
+ $default: "{projectRoot}/tsconfig.json"
4375
+ },
4376
+ bundle: {
4377
+ $schema: {
4378
+ title: "Bundle",
4379
+ type: "boolean",
4380
+ description: "Bundle the output"
4381
+ }
4382
+ },
4383
+ minify: {
4384
+ $schema: {
4385
+ title: "Minify",
4386
+ type: "boolean",
4387
+ description: "Minify the output"
4388
+ }
4389
+ },
4390
+ debug: {
4391
+ $schema: {
4392
+ title: "Debug",
4393
+ type: "boolean",
4394
+ description: "Debug the output"
4395
+ }
4396
+ },
4397
+ sourcemap: {
4398
+ $schema: {
4399
+ title: "Sourcemap",
4400
+ type: "boolean",
4401
+ description: "Generate a sourcemap"
4402
+ }
4403
+ },
4404
+ silent: {
4405
+ $schema: {
4406
+ title: "Silent",
4407
+ type: "boolean",
4408
+ description: "Should the build run silently - only report errors back to the user"
4409
+ },
4410
+ $default: false
4411
+ },
4412
+ target: {
4413
+ $schema: {
4414
+ title: "Target",
4415
+ type: "string",
4416
+ description: "The target to build",
4417
+ enum: [
4418
+ "es3",
4419
+ "es5",
4420
+ "es6",
4421
+ "es2015",
4422
+ "es2016",
4423
+ "es2017",
4424
+ "es2018",
4425
+ "es2019",
4426
+ "es2020",
4427
+ "es2021",
4428
+ "es2022",
4429
+ "es2023",
4430
+ "es2024",
4431
+ "esnext",
4432
+ "node12",
4433
+ "node14",
4434
+ "node16",
4435
+ "node18",
4436
+ "node20",
4437
+ "node22",
4438
+ "browser",
4439
+ "chrome58",
4440
+ "chrome59",
4441
+ "chrome60"
4442
+ ]
4443
+ },
4444
+ $default: "esnext",
4445
+ $resolve: /* @__PURE__ */ __name((val = "esnext") => val.toLowerCase(), "$resolve")
4446
+ },
4447
+ format: {
4448
+ $schema: {
4449
+ title: "Format",
4450
+ type: "array",
4451
+ description: "The format to build",
4452
+ items: {
4453
+ type: "string",
4454
+ enum: [
4455
+ "cjs",
4456
+ "esm",
4457
+ "iife"
4458
+ ]
4459
+ }
4460
+ },
4461
+ $resolve: /* @__PURE__ */ __name((val = [
4462
+ "cjs",
4463
+ "esm"
4464
+ ]) => [].concat(val), "$resolve")
4465
+ },
4466
+ platform: {
4467
+ $schema: {
4468
+ title: "Platform",
4469
+ type: "string",
4470
+ description: "The platform to build",
4471
+ enum: [
4472
+ "neutral",
4473
+ "node",
4474
+ "browser"
4475
+ ]
4476
+ },
4477
+ $default: "neutral"
4478
+ },
4479
+ external: {
4480
+ $schema: {
4481
+ title: "External",
4482
+ type: "array",
4483
+ description: "The external dependencies"
4484
+ },
4485
+ $resolve: /* @__PURE__ */ __name((val = []) => [].concat(val), "$resolve")
4486
+ },
4487
+ define: {
4488
+ $schema: {
4489
+ title: "Define",
4490
+ type: "object",
4491
+ tsType: "Record<string, string>",
4492
+ description: "The define values"
4493
+ },
4494
+ $resolve: /* @__PURE__ */ __name((val = {}) => val, "$resolve"),
4495
+ $default: {}
4496
+ },
4497
+ env: {
4498
+ $schema: {
4499
+ title: "Environment Variables",
4500
+ type: "object",
4501
+ tsType: "Record<string, string>",
4502
+ description: "The environment variable values"
4503
+ },
4504
+ $resolve: /* @__PURE__ */ __name((val = {}) => val, "$resolve"),
4505
+ $default: {}
4506
+ }
4507
+ });
4508
+
4509
+ // ../workspace-tools/src/base/typescript-library-generator.untyped.ts
4510
+ import { defineUntypedSchema as defineUntypedSchema5 } from "untyped";
4511
+ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4512
+ ...base_generator_untyped_default,
4513
+ $schema: {
4514
+ id: "TypeScriptLibraryGeneratorSchema",
4515
+ title: "TypeScript Library Generator",
4516
+ description: "A type definition for the base TypeScript Library Generator schema",
4517
+ required: [
4518
+ "directory",
4519
+ "name"
4520
+ ]
4521
+ },
4522
+ name: {
4523
+ $schema: {
4524
+ title: "Name",
4525
+ type: "string",
4526
+ description: "The name of the library"
4527
+ }
4528
+ },
4529
+ description: {
4530
+ $schema: {
4531
+ title: "Description",
4532
+ type: "string",
4533
+ description: "The description of the library"
4534
+ }
4535
+ },
4536
+ buildExecutor: {
4537
+ $schema: {
4538
+ title: "Build Executor",
4539
+ type: "string",
4540
+ description: "The executor to use for building the library"
4541
+ },
4542
+ $default: "@storm-software/workspace-tools:unbuild"
4543
+ },
4544
+ platform: {
4545
+ $schema: {
4546
+ title: "Platform",
4547
+ type: "string",
4548
+ description: "The platform to target with the library",
4549
+ enum: [
4550
+ "neutral",
4551
+ "node",
4552
+ "worker",
4553
+ "browser"
4554
+ ]
4555
+ },
4556
+ $default: "neutral"
4557
+ },
4558
+ importPath: {
4559
+ $schema: {
4560
+ title: "Import Path",
4561
+ type: "string",
4562
+ description: "The import path for the library"
4563
+ }
4564
+ },
4565
+ tags: {
4566
+ $schema: {
4567
+ title: "Tags",
4568
+ type: "string",
4569
+ description: "The tags for the library"
4570
+ }
4571
+ },
4572
+ unitTestRunner: {
4573
+ $schema: {
4574
+ title: "Unit Test Runner",
4575
+ type: "string",
4576
+ enum: [
4577
+ "jest",
4578
+ "vitest",
4579
+ "none"
4580
+ ],
4581
+ description: "The unit test runner to use"
4582
+ }
4583
+ },
4584
+ testEnvironment: {
4585
+ $schema: {
4586
+ title: "Test Environment",
4587
+ type: "string",
4588
+ enum: [
4589
+ "jsdom",
4590
+ "node"
4591
+ ],
4592
+ description: "The test environment to use"
4593
+ }
4594
+ },
4595
+ pascalCaseFiles: {
4596
+ $schema: {
4597
+ title: "Pascal Case Files",
4598
+ type: "boolean",
4599
+ description: "Use PascalCase for file names"
4600
+ },
4601
+ $default: false
4602
+ },
4603
+ strict: {
4604
+ $schema: {
4605
+ title: "Strict",
4606
+ type: "boolean",
4607
+ description: "Enable strict mode"
4608
+ },
4609
+ $default: true
4610
+ },
4611
+ publishable: {
4612
+ $schema: {
4613
+ title: "Publishable",
4614
+ type: "boolean",
4615
+ description: "Make the library publishable"
4616
+ },
4617
+ $default: false
4618
+ },
4619
+ buildable: {
4620
+ $schema: {
4621
+ title: "Buildable",
4622
+ type: "boolean",
4623
+ description: "Make the library buildable"
4624
+ },
4625
+ $default: true
4626
+ }
4627
+ });
4628
+
4629
+ // ../workspace-tools/src/utils/create-cli-options.ts
4630
+ import { names as names5 } from "@nx/devkit";
4631
+
4632
+ // ../workspace-tools/src/utils/get-project-configurations.ts
4633
+ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/project-graph/utils/retrieve-workspace-files";
4634
+
4635
+ // ../workspace-tools/src/utils/lock-file.ts
4636
+ import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "@nx/devkit";
4637
+ import { existsSync as existsSync9 } from "node:fs";
4638
+ import { join as join4 } from "node:path";
4639
+ import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";
4640
+ import { getPnpmLockfileDependencies, getPnpmLockfileNodes } from "nx/src/plugins/js/lock-file/pnpm-parser";
4641
+ import { getYarnLockfileDependencies, getYarnLockfileNodes } from "nx/src/plugins/js/lock-file/yarn-parser";
4642
+ var YARN_LOCK_FILE = "yarn.lock";
4643
+ var NPM_LOCK_FILE = "package-lock.json";
4644
+ var PNPM_LOCK_FILE = "pnpm-lock.yaml";
4645
+ var YARN_LOCK_PATH = join4(workspaceRoot2, YARN_LOCK_FILE);
4646
+ var NPM_LOCK_PATH = join4(workspaceRoot2, NPM_LOCK_FILE);
4647
+ var PNPM_LOCK_PATH = join4(workspaceRoot2, PNPM_LOCK_FILE);
4648
+
4649
+ // ../workspace-tools/src/utils/package-helpers.ts
4650
+ import { joinPathFragments as joinPathFragments6, readJsonFile as readJsonFile2 } from "@nx/devkit";
4651
+ import { existsSync as existsSync10 } from "node:fs";
4652
+
4653
+ // ../workspace-tools/src/utils/plugin-helpers.ts
4654
+ import { readJsonFile as readJsonFile3 } from "@nx/devkit";
4655
+ import defu7 from "defu";
4656
+ import { existsSync as existsSync11 } from "node:fs";
4657
+ import { dirname as dirname2, join as join5 } from "node:path";
4658
+
4659
+ // ../workspace-tools/src/utils/typia-transform.ts
4660
+ import transform2 from "typia/lib/transform";
4661
+
4662
+ // src/generators/init/generator.ts
4663
+ async function initGeneratorFn(tree, options, config) {
4664
+ const task = initGenerator(tree, options);
4665
+ await runTasksInSerial(addProjenDeps(tree, options))();
4666
+ if (!options.skipFormat) {
4667
+ await formatFiles9(tree);
4668
+ }
4669
+ return task;
4670
+ }
4671
+ __name(initGeneratorFn, "initGeneratorFn");
4672
+ var generator_default6 = withRunGenerator("Initialize Storm Projen workspace", initGeneratorFn);
4673
+ function addProjenDeps(tree, options) {
4674
+ return () => {
4675
+ const packageJson = readJsonFile4(`${options.directory}/package.json`);
4676
+ packageJson.dependencies["projen"] ??= "^0.91.6";
4677
+ if (packageJson) {
4678
+ addDependenciesToPackageJson4(tree, packageJson.dependencies || {}, packageJson.devDependencies || {})();
4679
+ }
4680
+ };
4681
+ }
4682
+ __name(addProjenDeps, "addProjenDeps");
4683
+
4684
+ export {
4685
+ initGeneratorFn,
4686
+ generator_default6 as generator_default
4687
+ };