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