@storm-software/pulumi-tools 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +497 -1
  3. package/dist/{chunk-EXRYBEI6.js → chunk-32GFYKQ3.js} +2 -2
  4. package/dist/{chunk-7PPYQH3N.js → chunk-6DP5HHF5.js} +2 -2
  5. package/dist/{chunk-BDMO52WS.mjs → chunk-ARPHB535.mjs} +1 -1
  6. package/dist/{chunk-IJD3Y56I.mjs → chunk-B5MURCIC.mjs} +1 -1
  7. package/dist/{chunk-OMYSB5DA.mjs → chunk-CXWKMDJU.mjs} +1 -1
  8. package/dist/{chunk-GHJM2ZLS.js → chunk-FN7UDXGG.js} +541 -1028
  9. package/dist/{chunk-TEMOWP6U.js → chunk-I7VABIBI.js} +2 -2
  10. package/dist/{chunk-L2RV7FVQ.js → chunk-IAZVTGHA.js} +2 -2
  11. package/dist/{chunk-KUMMH6MK.mjs → chunk-JTC66DXK.mjs} +511 -998
  12. package/dist/{chunk-6FXELAAU.js → chunk-N3H4DK4E.js} +2 -2
  13. package/dist/{chunk-TRHIR6LO.mjs → chunk-O6PGI6V3.mjs} +1 -1
  14. package/dist/{chunk-A6CBZSEQ.mjs → chunk-P6YUXTRU.mjs} +1 -1
  15. package/dist/{chunk-XQUDEM6K.mjs → chunk-PZVSIXQ3.mjs} +1 -1
  16. package/dist/{chunk-T6M6HPMY.mjs → chunk-QY3JQOCP.mjs} +1 -1
  17. package/dist/{chunk-WAPECT7Q.js → chunk-XXWYXYXW.js} +3 -3
  18. package/dist/{chunk-AUKNCSAG.js → chunk-YXVSSAJ7.js} +5 -5
  19. package/dist/executors.d.mts +1 -1
  20. package/dist/executors.d.ts +1 -1
  21. package/dist/executors.js +7 -7
  22. package/dist/executors.mjs +7 -7
  23. package/dist/{generators-Bk-gnn2s.d.ts → generators-CDh2w5jS.d.ts} +1 -1
  24. package/dist/{generators-kdwvS-eX.d.mts → generators-tDFGjZKk.d.mts} +1 -1
  25. package/dist/generators.d.mts +2 -2
  26. package/dist/generators.d.ts +2 -2
  27. package/dist/generators.js +3 -3
  28. package/dist/generators.mjs +2 -2
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +9 -9
  32. package/dist/index.mjs +8 -8
  33. package/dist/src/base/base-executor.d.mts +1 -1
  34. package/dist/src/base/base-executor.d.ts +1 -1
  35. package/dist/src/base/base-executor.js +3 -3
  36. package/dist/src/base/base-executor.mjs +2 -2
  37. package/dist/src/base/index.d.mts +1 -1
  38. package/dist/src/base/index.d.ts +1 -1
  39. package/dist/src/base/index.js +3 -3
  40. package/dist/src/base/index.mjs +2 -2
  41. package/dist/src/executors/config/executor.d.mts +1 -1
  42. package/dist/src/executors/config/executor.d.ts +1 -1
  43. package/dist/src/executors/config/executor.js +4 -4
  44. package/dist/src/executors/config/executor.mjs +3 -3
  45. package/dist/src/executors/import/executor.d.mts +1 -1
  46. package/dist/src/executors/import/executor.d.ts +1 -1
  47. package/dist/src/executors/import/executor.js +4 -4
  48. package/dist/src/executors/import/executor.mjs +3 -3
  49. package/dist/src/executors/preview/executor.d.mts +1 -1
  50. package/dist/src/executors/preview/executor.d.ts +1 -1
  51. package/dist/src/executors/preview/executor.js +4 -4
  52. package/dist/src/executors/preview/executor.mjs +3 -3
  53. package/dist/src/executors/refresh/executor.d.mts +1 -1
  54. package/dist/src/executors/refresh/executor.d.ts +1 -1
  55. package/dist/src/executors/refresh/executor.js +4 -4
  56. package/dist/src/executors/refresh/executor.mjs +3 -3
  57. package/dist/src/executors/up/executor.d.mts +1 -1
  58. package/dist/src/executors/up/executor.d.ts +1 -1
  59. package/dist/src/executors/up/executor.js +4 -4
  60. package/dist/src/executors/up/executor.mjs +3 -3
  61. package/dist/src/generators/init/generator.d.mts +2 -2
  62. package/dist/src/generators/init/generator.d.ts +2 -2
  63. package/dist/src/generators/init/generator.js +3 -3
  64. package/dist/src/generators/init/generator.mjs +2 -2
  65. package/dist/{types-CIJRaFHD.d.mts → types-CMF_wowV.d.mts} +5 -5
  66. package/dist/{types-CIJRaFHD.d.ts → types-CMF_wowV.d.ts} +5 -5
  67. package/package.json +1 -1
@@ -140,6 +140,8 @@ var ColorConfigMapSchema = z.union([
140
140
  }),
141
141
  z.record(z.string(), ColorConfigSchema)
142
142
  ]);
143
+ var ExtendsItemSchema = z.string().trim().describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
144
+ var ExtendsSchema = ExtendsItemSchema.or(z.array(ExtendsItemSchema)).describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
143
145
  var WorkspaceBotConfigSchema = z.object({
144
146
  name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
145
147
  email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -154,11 +156,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
154
156
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
155
157
  var StormConfigSchema = z.object({
156
158
  $schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
157
- extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
159
+ extends: ExtendsSchema.optional(),
158
160
  name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
159
161
  namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
160
162
  organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
161
- repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
163
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
162
164
  license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
163
165
  homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
164
166
  docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -221,26 +223,136 @@ var COLOR_KEYS = [
221
223
  ];
222
224
 
223
225
  // ../config-tools/src/utilities/get-default-config.ts
224
- import { existsSync as existsSync2, readFileSync } from "node:fs";
226
+ import { existsSync as existsSync2 } from "node:fs";
227
+ import { readFile } from "node:fs/promises";
225
228
  import { join as join2 } from "node:path";
226
229
 
227
230
  // ../config-tools/src/utilities/correct-paths.ts
228
- import { joinPathFragments } from "@nx/devkit";
229
- var correctPaths = /* @__PURE__ */ __name((path7) => {
230
- if (!path7) {
231
- return "";
232
- }
233
- if (!path7.toUpperCase().startsWith("C:") && path7.includes("\\")) {
234
- path7 = `C:${path7}`;
231
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
232
+ function normalizeWindowsPath(input = "") {
233
+ if (!input) {
234
+ return input;
235
235
  }
236
- return path7.replaceAll("\\", "/");
236
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
237
+ }
238
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
239
+ var _UNC_REGEX = /^[/\\]{2}/;
240
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
241
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
242
+ var correctPaths = /* @__PURE__ */ __name(function(path7) {
243
+ if (!path7 || path7.length === 0) {
244
+ return ".";
245
+ }
246
+ path7 = normalizeWindowsPath(path7);
247
+ const isUNCPath = path7.match(_UNC_REGEX);
248
+ const isPathAbsolute = isAbsolute(path7);
249
+ const trailingSeparator = path7[path7.length - 1] === "/";
250
+ path7 = normalizeString(path7, !isPathAbsolute);
251
+ if (path7.length === 0) {
252
+ if (isPathAbsolute) {
253
+ return "/";
254
+ }
255
+ return trailingSeparator ? "./" : ".";
256
+ }
257
+ if (trailingSeparator) {
258
+ path7 += "/";
259
+ }
260
+ if (_DRIVE_LETTER_RE.test(path7)) {
261
+ path7 += "/";
262
+ }
263
+ if (isUNCPath) {
264
+ if (!isPathAbsolute) {
265
+ return `//./${path7}`;
266
+ }
267
+ return `//${path7}`;
268
+ }
269
+ return isPathAbsolute && !isAbsolute(path7) ? `/${path7}` : path7;
237
270
  }, "correctPaths");
238
- var joinPaths = /* @__PURE__ */ __name((...paths) => {
239
- if (!paths || paths.length === 0) {
240
- return "";
271
+ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
272
+ let path7 = "";
273
+ for (const seg of segments) {
274
+ if (!seg) {
275
+ continue;
276
+ }
277
+ if (path7.length > 0) {
278
+ const pathTrailing = path7[path7.length - 1] === "/";
279
+ const segLeading = seg[0] === "/";
280
+ const both = pathTrailing && segLeading;
281
+ if (both) {
282
+ path7 += seg.slice(1);
283
+ } else {
284
+ path7 += pathTrailing || segLeading ? seg : `/${seg}`;
285
+ }
286
+ } else {
287
+ path7 += seg;
288
+ }
241
289
  }
242
- return correctPaths(joinPathFragments(...paths.map((path7) => correctPaths(path7))));
290
+ return correctPaths(path7);
243
291
  }, "joinPaths");
292
+ function normalizeString(path7, allowAboveRoot) {
293
+ let res = "";
294
+ let lastSegmentLength = 0;
295
+ let lastSlash = -1;
296
+ let dots = 0;
297
+ let char = null;
298
+ for (let index = 0; index <= path7.length; ++index) {
299
+ if (index < path7.length) {
300
+ char = path7[index];
301
+ } else if (char === "/") {
302
+ break;
303
+ } else {
304
+ char = "/";
305
+ }
306
+ if (char === "/") {
307
+ if (lastSlash === index - 1 || dots === 1) {
308
+ } else if (dots === 2) {
309
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
310
+ if (res.length > 2) {
311
+ const lastSlashIndex = res.lastIndexOf("/");
312
+ if (lastSlashIndex === -1) {
313
+ res = "";
314
+ lastSegmentLength = 0;
315
+ } else {
316
+ res = res.slice(0, lastSlashIndex);
317
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
318
+ }
319
+ lastSlash = index;
320
+ dots = 0;
321
+ continue;
322
+ } else if (res.length > 0) {
323
+ res = "";
324
+ lastSegmentLength = 0;
325
+ lastSlash = index;
326
+ dots = 0;
327
+ continue;
328
+ }
329
+ }
330
+ if (allowAboveRoot) {
331
+ res += res.length > 0 ? "/.." : "..";
332
+ lastSegmentLength = 2;
333
+ }
334
+ } else {
335
+ if (res.length > 0) {
336
+ res += `/${path7.slice(lastSlash + 1, index)}`;
337
+ } else {
338
+ res = path7.slice(lastSlash + 1, index);
339
+ }
340
+ lastSegmentLength = index - lastSlash - 1;
341
+ }
342
+ lastSlash = index;
343
+ dots = 0;
344
+ } else if (char === "." && dots !== -1) {
345
+ ++dots;
346
+ } else {
347
+ dots = -1;
348
+ }
349
+ }
350
+ return res;
351
+ }
352
+ __name(normalizeString, "normalizeString");
353
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
354
+ return _IS_ABSOLUTE_RE.test(p);
355
+ }, "isAbsolute");
244
356
 
245
357
  // ../config-tools/src/utilities/find-up.ts
246
358
  import { existsSync } from "node:fs";
@@ -343,17 +455,15 @@ var DEFAULT_COLOR_CONFIG = {
343
455
  "negative": "#dc2626"
344
456
  }
345
457
  };
346
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
458
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
347
459
  let license = STORM_DEFAULT_LICENSE;
348
460
  let homepage = STORM_DEFAULT_HOMEPAGE;
349
- let name;
350
- let namespace;
351
- let repository;
461
+ let name = void 0;
462
+ let namespace = void 0;
463
+ let repository = void 0;
352
464
  const workspaceRoot3 = findWorkspaceRoot(root);
353
465
  if (existsSync2(join2(workspaceRoot3, "package.json"))) {
354
- const file = readFileSync(join2(workspaceRoot3, "package.json"), {
355
- encoding: "utf8"
356
- });
466
+ const file = await readFile(joinPaths(workspaceRoot3, "package.json"), "utf8");
357
467
  if (file) {
358
468
  const packageJson = JSON.parse(file);
359
469
  if (packageJson.name) {
@@ -362,8 +472,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
362
472
  if (packageJson.namespace) {
363
473
  namespace = packageJson.namespace;
364
474
  }
365
- if (packageJson.repository?.url) {
366
- repository = packageJson.repository?.url;
475
+ if (packageJson.repository) {
476
+ if (typeof packageJson.repository === "string") {
477
+ repository = packageJson.repository;
478
+ } else if (packageJson.repository.url) {
479
+ repository = packageJson.repository.url;
480
+ }
367
481
  }
368
482
  if (packageJson.license) {
369
483
  license = packageJson.license;
@@ -503,53 +617,59 @@ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
503
617
  }, "isVerbose");
504
618
 
505
619
  // ../config-tools/src/logger/console.ts
506
- var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
507
- const _chalk = getChalk();
620
+ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
508
621
  const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
509
622
  const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
510
- if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
623
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
511
624
  return (_) => {
512
625
  };
513
626
  }
514
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
627
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
515
628
  return (message) => {
516
629
  console.error(`
517
630
  ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
518
631
  `);
519
632
  };
520
633
  }
521
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
634
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
522
635
  return (message) => {
523
636
  console.error(`
524
637
  ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
525
638
  `);
526
639
  };
527
640
  }
528
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
641
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
529
642
  return (message) => {
530
643
  console.warn(`
531
644
  ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
532
645
  `);
533
646
  };
534
647
  }
535
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
648
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
536
649
  return (message) => {
537
650
  console.info(`
538
651
  ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
539
652
  `);
540
653
  };
541
654
  }
542
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
655
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
543
656
  return (message) => {
544
657
  console.info(`
545
658
  ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
546
659
  `);
547
660
  };
548
661
  }
549
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
662
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
550
663
  return (message) => {
551
664
  console.debug(`
552
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
665
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
666
+ `);
667
+ };
668
+ }
669
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
670
+ return (message) => {
671
+ console.debug(`
672
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
553
673
  `);
554
674
  };
555
675
  }
@@ -566,7 +686,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
566
686
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
567
687
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
568
688
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
569
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
570
689
  var getStopwatch = /* @__PURE__ */ __name((name) => {
571
690
  const start = process.hrtime();
572
691
  return () => {
@@ -603,48 +722,51 @@ var _isFunction = /* @__PURE__ */ __name((value) => {
603
722
  }, "_isFunction");
604
723
 
605
724
  // ../config-tools/src/utilities/apply-workspace-tokens.ts
606
- var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenizerOptions) => {
725
+ var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams) => {
607
726
  let result = option;
608
727
  if (!result) {
609
728
  return result;
610
729
  }
611
- if (tokenizerOptions) {
612
- const optionKeys = Object.keys(tokenizerOptions);
730
+ if (tokenParams) {
731
+ const optionKeys = Object.keys(tokenParams);
613
732
  if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
614
733
  for (const optionKey of optionKeys) {
615
734
  if (result.includes(`{${optionKey}}`)) {
616
- result = result.replaceAll(`{${optionKey}}`, tokenizerOptions.config?.[optionKey] ?? "");
735
+ result = result.replaceAll(`{${optionKey}}`, tokenParams?.[optionKey] || "");
617
736
  }
618
737
  }
619
738
  }
620
739
  }
621
- if (tokenizerOptions.config) {
622
- const configKeys = Object.keys(tokenizerOptions.config);
740
+ if (tokenParams.config) {
741
+ const configKeys = Object.keys(tokenParams.config);
623
742
  if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
624
743
  for (const configKey of configKeys) {
625
744
  if (result.includes(`{${configKey}}`)) {
626
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
745
+ result = result.replaceAll(`{${configKey}}`, tokenParams.config[configKey] || "");
627
746
  }
628
747
  }
629
748
  }
630
749
  }
631
750
  if (result.includes("{workspaceRoot}")) {
632
- result = result.replaceAll("{workspaceRoot}", tokenizerOptions.workspaceRoot ?? tokenizerOptions.config?.workspaceRoot ?? findWorkspaceRoot());
751
+ result = result.replaceAll("{workspaceRoot}", tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot());
633
752
  }
634
753
  return result;
635
754
  }, "applyWorkspaceBaseTokens");
636
- var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, config, tokenizerFn) => {
755
+ var applyWorkspaceProjectTokens = /* @__PURE__ */ __name((option, tokenParams) => {
756
+ return applyWorkspaceBaseTokens(option, tokenParams);
757
+ }, "applyWorkspaceProjectTokens");
758
+ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, tokenParams, tokenizerFn) => {
637
759
  if (!options) {
638
760
  return {};
639
761
  }
640
762
  const result = {};
641
763
  for (const option of Object.keys(options)) {
642
764
  if (typeof options[option] === "string") {
643
- result[option] = await Promise.resolve(tokenizerFn(options[option], config));
765
+ result[option] = await Promise.resolve(tokenizerFn(options[option], tokenParams));
644
766
  } else if (Array.isArray(options[option])) {
645
- result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, config)) : item));
767
+ result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item));
646
768
  } else if (typeof options[option] === "object") {
647
- result[option] = await applyWorkspaceTokens(options[option], config, tokenizerFn);
769
+ result[option] = await applyWorkspaceTokens(options[option], tokenParams, tokenizerFn);
648
770
  } else {
649
771
  result[option] = options[option];
650
772
  }
@@ -655,19 +777,19 @@ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, config, tokeni
655
777
  // ../config-tools/src/config-file/get-config-file.ts
656
778
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
657
779
  const workspacePath = filePath || findWorkspaceRoot(filePath);
658
- let config = await loadConfig({
659
- cwd: workspacePath,
660
- packageJson: true,
661
- name: fileName,
662
- envName: fileName?.toUpperCase(),
663
- jitiOptions: {
664
- debug: false,
665
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
666
- },
667
- ...options
668
- });
669
- if (!config || Object.keys(config).length === 0) {
670
- config = await loadConfig({
780
+ const configs = await Promise.all([
781
+ loadConfig({
782
+ cwd: workspacePath,
783
+ packageJson: true,
784
+ name: fileName,
785
+ envName: fileName?.toUpperCase(),
786
+ jitiOptions: {
787
+ debug: false,
788
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
789
+ },
790
+ ...options
791
+ }),
792
+ loadConfig({
671
793
  cwd: workspacePath,
672
794
  packageJson: true,
673
795
  name: fileName,
@@ -678,9 +800,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
678
800
  },
679
801
  configFile: fileName,
680
802
  ...options
681
- });
682
- }
683
- return config;
803
+ })
804
+ ]);
805
+ return defu(configs[0] ?? {}, configs[1] ?? {});
684
806
  }, "getConfigFileByName");
685
807
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
686
808
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -688,7 +810,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
688
810
  let config = result.config;
689
811
  const configFile = result.configFile;
690
812
  if (config && configFile && Object.keys(config).length > 0) {
691
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
813
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
692
814
  logLevel: "all"
693
815
  });
694
816
  }
@@ -696,7 +818,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
696
818
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
697
819
  for (const result2 of results) {
698
820
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
699
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
821
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
700
822
  logLevel: "all"
701
823
  });
702
824
  config = defu(result2.config ?? {}, config ?? {});
@@ -714,6 +836,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
714
836
  import defu2 from "defu";
715
837
 
716
838
  // ../config-tools/src/env/get-env.ts
839
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
840
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
841
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
842
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
843
+ if (name) {
844
+ ret[name] = process.env[key];
845
+ }
846
+ return ret;
847
+ }, {});
848
+ }, "getExtensionEnv");
717
849
  var getConfigEnv = /* @__PURE__ */ __name(() => {
718
850
  const prefix = "STORM_";
719
851
  let config = {
@@ -873,7 +1005,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
873
1005
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
874
1006
  const prefix = "STORM_";
875
1007
  if (config.extends) {
876
- process.env[`${prefix}EXTENDS`] = config.extends;
1008
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
877
1009
  }
878
1010
  if (config.name) {
879
1011
  process.env[`${prefix}NAME`] = config.name;
@@ -1103,95 +1235,87 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1103
1235
  }, "setBaseThemeColorConfigEnv");
1104
1236
 
1105
1237
  // ../config-tools/src/create-storm-config.ts
1238
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
1106
1239
  var _static_cache = void 0;
1107
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
1108
- let config = {};
1109
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
1110
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
1111
- return _static_cache.data;
1112
- }
1113
- let _workspaceRoot = workspaceRoot3;
1114
- if (!_workspaceRoot) {
1115
- _workspaceRoot = findWorkspaceRoot();
1240
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot3, skipLogs = false) => {
1241
+ let result;
1242
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1243
+ let _workspaceRoot = workspaceRoot3;
1244
+ if (!_workspaceRoot) {
1245
+ _workspaceRoot = findWorkspaceRoot();
1246
+ }
1247
+ const configEnv = getConfigEnv();
1248
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
1249
+ const configFile = await getConfigFile(_workspaceRoot);
1250
+ if (!configFile && !skipLogs) {
1251
+ 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", {
1252
+ logLevel: "all"
1253
+ });
1254
+ }
1255
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
1256
+ result.workspaceRoot ??= _workspaceRoot;
1257
+ } else {
1258
+ result = _static_cache.data;
1116
1259
  }
1117
- const configFile = await getConfigFile(_workspaceRoot);
1118
- if (!configFile) {
1119
- 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", {
1120
- logLevel: "all"
1121
- });
1260
+ if (schema && extensionName) {
1261
+ result.extensions = {
1262
+ ...result.extensions,
1263
+ [extensionName]: createConfigExtension(extensionName, schema)
1264
+ };
1122
1265
  }
1123
- config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
1266
+ _static_cache = {
1267
+ timestamp: Date.now(),
1268
+ data: result
1269
+ };
1270
+ return result;
1271
+ }, "createStormConfig");
1272
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
1273
+ const extension_cache_key = {
1274
+ extensionName
1275
+ };
1276
+ if (_extension_cache.has(extension_cache_key)) {
1277
+ return _extension_cache.get(extension_cache_key);
1278
+ }
1279
+ let extension = getExtensionEnv(extensionName);
1280
+ if (schema) {
1281
+ extension = schema.parse(extension);
1282
+ }
1283
+ _extension_cache.set(extension_cache_key, extension);
1284
+ return extension;
1285
+ }, "createConfigExtension");
1286
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot3, skipLogs = false) => {
1287
+ const config = await createStormConfig(void 0, void 0, workspaceRoot3, skipLogs);
1124
1288
  setConfigEnv(config);
1125
- writeTrace(`\u2699\uFE0F Using Storm configuration:
1289
+ if (!skipLogs) {
1290
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
1126
1291
  ${formatLogMessage(config)}`, config);
1292
+ }
1127
1293
  return config;
1128
1294
  }, "loadStormConfig");
1129
1295
 
1130
- // ../workspace-tools/src/utils/apply-workspace-tokens.ts
1131
- var applyWorkspaceExecutorTokens = /* @__PURE__ */ __name(async (option, tokenizerOptions) => {
1132
- let result = option;
1133
- if (!result) {
1134
- return result;
1135
- }
1136
- let projectName;
1137
- let projectRoot;
1138
- let sourceRoot;
1139
- if (tokenizerOptions?.projectName) {
1140
- const context2 = tokenizerOptions;
1141
- projectName = context2.projectName;
1142
- projectRoot = context2.root;
1143
- sourceRoot = context2.sourceRoot;
1144
- } else {
1145
- const projectConfig = tokenizerOptions;
1146
- projectRoot = projectConfig.root;
1147
- if (projectConfig.name) {
1148
- projectName = projectConfig.name;
1149
- }
1150
- if (projectConfig.sourceRoot) {
1151
- sourceRoot = projectConfig.sourceRoot;
1152
- }
1153
- }
1154
- if (tokenizerOptions.config) {
1155
- const configKeys = Object.keys(tokenizerOptions.config);
1156
- if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
1157
- for (const configKey of configKeys) {
1158
- if (result.includes(`{${configKey}}`)) {
1159
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
1160
- }
1161
- }
1162
- }
1163
- }
1164
- if (result.includes("{projectName}")) {
1165
- result = result.replaceAll("{projectName}", projectName);
1166
- }
1167
- if (result.includes("{projectRoot}")) {
1168
- result = result.replaceAll("{projectRoot}", projectRoot);
1169
- }
1170
- if (result.includes("{sourceRoot}")) {
1171
- result = result.replaceAll("{sourceRoot}", sourceRoot);
1172
- }
1173
- if (result.includes("{workspaceRoot}")) {
1174
- result = result.replaceAll("{workspaceRoot}", tokenizerOptions.workspaceRoot ?? findWorkspaceRoot());
1175
- }
1176
- return result;
1177
- }, "applyWorkspaceExecutorTokens");
1296
+ // ../config-tools/src/get-config.ts
1297
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot3, skipLogs = false) => {
1298
+ return loadStormConfig(workspaceRoot3, skipLogs);
1299
+ }, "getConfig");
1178
1300
 
1179
1301
  // ../workspace-tools/src/base/base-executor.ts
1302
+ import { defu as defu3 } from "defu";
1180
1303
  var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context2) => {
1181
1304
  const stopwatch = getStopwatch(name);
1182
1305
  let options = _options;
1183
1306
  let config = {};
1184
1307
  try {
1185
- writeInfo(`\u26A1 Running the ${name} executor...
1186
- `, config);
1187
1308
  if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
1188
1309
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1189
1310
  }
1190
1311
  const workspaceRoot3 = findWorkspaceRoot();
1191
- const projectRoot = context2.projectsConfigurations.projects[context2.projectName]?.root ?? workspaceRoot3;
1192
- const sourceRoot = context2.projectsConfigurations.projects[context2.projectName]?.sourceRoot ?? workspaceRoot3;
1193
- const projectName = context2.projectsConfigurations.projects[context2.projectName]?.name ?? context2.projectName;
1312
+ const projectRoot = context2.projectsConfigurations.projects[context2.projectName].root || workspaceRoot3;
1313
+ const sourceRoot = context2.projectsConfigurations.projects[context2.projectName].sourceRoot || projectRoot || workspaceRoot3;
1314
+ const projectName = context2.projectName;
1194
1315
  config.workspaceRoot = workspaceRoot3;
1316
+ writeInfo(`
1317
+ \u26A1 Running the ${name} executor for ${projectName}
1318
+ `, config);
1195
1319
  if (!executorOptions.skipReadingConfig) {
1196
1320
  writeTrace(`Loading the Storm Config from environment variables and storm.config.js file...
1197
1321
  - workspaceRoot: ${workspaceRoot3}
@@ -1199,24 +1323,26 @@ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions
1199
1323
  - sourceRoot: ${sourceRoot}
1200
1324
  - projectName: ${projectName}
1201
1325
  `, config);
1202
- config = await loadStormConfig(workspaceRoot3);
1326
+ config = await getConfig(workspaceRoot3);
1203
1327
  }
1204
1328
  if (executorOptions?.hooks?.applyDefaultOptions) {
1205
1329
  writeDebug("Running the applyDefaultOptions hook...", config);
1206
1330
  options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
1207
1331
  writeDebug("Completed the applyDefaultOptions hook", config);
1208
1332
  }
1209
- writeTrace(`Executor schema options \u2699\uFE0F
1210
- ${Object.keys(options).map((key) => ` - ${key}=${_isFunction2(options[key]) ? "<function>" : JSON.stringify(options[key])}`).join("\n")}`, config);
1211
- const tokenized = await applyWorkspaceTokens(options, {
1212
- config,
1333
+ writeTrace(`Executor schema options \u2699\uFE0F
1334
+ ${formatLogMessage(options)}
1335
+ `, config);
1336
+ const tokenized = await applyWorkspaceTokens(options, defu3({
1213
1337
  workspaceRoot: workspaceRoot3,
1214
1338
  projectRoot,
1215
1339
  sourceRoot,
1216
1340
  projectName,
1217
- ...context2.projectsConfigurations.projects[context2.projectName],
1218
- ...executorOptions
1219
- }, applyWorkspaceExecutorTokens);
1341
+ config
1342
+ }, config, context2.projectsConfigurations.projects[context2.projectName]), applyWorkspaceProjectTokens);
1343
+ writeTrace(`Executor schema tokenized options \u2699\uFE0F
1344
+ ${formatLogMessage(tokenized)}
1345
+ `, config);
1220
1346
  if (executorOptions?.hooks?.preProcess) {
1221
1347
  writeDebug("Running the preProcess hook...", config);
1222
1348
  await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
@@ -1282,7 +1408,7 @@ var withRunGenerator = /* @__PURE__ */ __name((name, generatorFn, generatorOptio
1282
1408
  if (!generatorOptions.skipReadingConfig) {
1283
1409
  writeDebug(`Loading the Storm Config from environment variables and storm.config.js file...
1284
1410
  - workspaceRoot: ${workspaceRoot3}`, config);
1285
- config = await loadStormConfig(workspaceRoot3);
1411
+ config = await getConfig(workspaceRoot3);
1286
1412
  }
1287
1413
  if (generatorOptions?.hooks?.applyDefaultOptions) {
1288
1414
  writeDebug("Running the applyDefaultOptions hook...", config);
@@ -1353,7 +1479,7 @@ async function initGenerator(tree, schema) {
1353
1479
  __name(initGenerator, "initGenerator");
1354
1480
 
1355
1481
  // ../workspace-tools/src/utils/cargo.ts
1356
- import { joinPathFragments as joinPathFragments2, workspaceRoot } from "@nx/devkit";
1482
+ import { joinPathFragments, workspaceRoot } from "@nx/devkit";
1357
1483
  import { execSync as execSync2, spawn } from "node:child_process";
1358
1484
  import { relative } from "node:path";
1359
1485
  var INVALID_CARGO_ARGS = [
@@ -1449,7 +1575,7 @@ function cargoMetadata() {
1449
1575
  __name(cargoMetadata, "cargoMetadata");
1450
1576
  function runProcess(processCmd, ...args) {
1451
1577
  const metadata = cargoMetadata();
1452
- const targetDir = metadata?.target_directory ?? joinPathFragments2(workspaceRoot, "dist", "cargo");
1578
+ const targetDir = metadata?.target_directory ?? joinPathFragments(workspaceRoot, "dist", "cargo");
1453
1579
  return new Promise((resolve) => {
1454
1580
  if (process.env.VERCEL) {
1455
1581
  return resolve({
@@ -1529,9 +1655,10 @@ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
1529
1655
  });
1530
1656
 
1531
1657
  // ../workspace-tools/src/executors/cargo-doc/executor.ts
1532
- import deepClone from "deep-clone";
1533
1658
  async function cargoDocExecutor(options, context2) {
1534
- const opts = deepClone(options);
1659
+ const opts = {
1660
+ ...options
1661
+ };
1535
1662
  opts["no-deps"] = opts.noDeps;
1536
1663
  delete opts.noDeps;
1537
1664
  const command = buildCargoCommand("doc", options, context2);
@@ -1573,9 +1700,9 @@ var executor_default5 = withRunExecutor("Cargo Format", cargoFormatExecutor, {
1573
1700
  });
1574
1701
 
1575
1702
  // ../workspace-tools/src/executors/cargo-publish/executor.ts
1576
- import { joinPathFragments as joinPathFragments3 } from "@nx/devkit";
1703
+ import { joinPathFragments as joinPathFragments2 } from "@nx/devkit";
1577
1704
  import { execSync as execSync3 } from "node:child_process";
1578
- import { readFileSync as readFileSync2 } from "node:fs";
1705
+ import { readFileSync } from "node:fs";
1579
1706
  import https from "node:https";
1580
1707
 
1581
1708
  // ../workspace-tools/src/utils/toml.ts
@@ -1586,8 +1713,7 @@ import { logger } from "@nx/devkit";
1586
1713
  var LARGE_BUFFER2 = 1024 * 1e6;
1587
1714
 
1588
1715
  // ../esbuild/src/build.ts
1589
- import { hfs as hfs3 } from "@humanfs/node";
1590
- import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
1716
+ import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph, writeJsonFile } from "@nx/devkit";
1591
1717
 
1592
1718
  // ../build-tools/src/config.ts
1593
1719
  var DEFAULT_COMPILED_BANNER = `
@@ -1614,52 +1740,28 @@ import { stripIndents } from "@nx/devkit";
1614
1740
  import { relative as relative2 } from "path";
1615
1741
 
1616
1742
  // ../build-tools/src/utilities/copy-assets.ts
1617
- import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
1618
- import { copyAssets as copyAssetsBase } from "@nx/js";
1743
+ import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
1619
1744
  import { glob } from "glob";
1620
1745
  import { readFile as readFile2, writeFile } from "node:fs/promises";
1621
-
1622
- // ../build-tools/src/utilities/read-nx-config.ts
1623
- import { existsSync as existsSync3 } from "node:fs";
1624
- import { readFile } from "node:fs/promises";
1625
- var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
1626
- let rootDir = workspaceRoot3;
1627
- if (!rootDir) {
1628
- const config = await loadStormConfig();
1629
- rootDir = config.workspaceRoot;
1630
- }
1631
- const nxJsonPath = joinPaths(rootDir, "nx.json");
1632
- if (!existsSync3(nxJsonPath)) {
1633
- throw new Error("Cannot find project.json configuration");
1634
- }
1635
- const configContent = await readFile(nxJsonPath, "utf8");
1636
- return JSON.parse(configContent);
1637
- }, "readNxConfig");
1638
-
1639
- // ../build-tools/src/utilities/copy-assets.ts
1640
- var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson4 = true, includeSrc = false, banner, footer) => {
1746
+ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson3 = true, includeSrc = false, banner, footer) => {
1641
1747
  const pendingAssets = Array.from(assets ?? []);
1642
- if (!pendingAssets?.some((asset) => asset?.glob === "*.md")) {
1748
+ pendingAssets.push({
1749
+ input: projectRoot,
1750
+ glob: "*.md",
1751
+ output: "."
1752
+ });
1753
+ pendingAssets.push({
1754
+ input: ".",
1755
+ glob: "LICENSE",
1756
+ output: "."
1757
+ });
1758
+ if (generatePackageJson3 === false) {
1643
1759
  pendingAssets.push({
1644
1760
  input: projectRoot,
1645
- glob: "*.md",
1646
- output: "/"
1647
- });
1648
- }
1649
- if (generatePackageJson4 === false) {
1650
- pendingAssets.push({
1651
- input: sourceRoot,
1652
1761
  glob: "package.json",
1653
1762
  output: "."
1654
1763
  });
1655
1764
  }
1656
- if (!pendingAssets?.some((asset) => asset?.glob === "LICENSE")) {
1657
- pendingAssets.push({
1658
- input: "",
1659
- glob: "LICENSE",
1660
- output: "."
1661
- });
1662
- }
1663
1765
  if (includeSrc === true) {
1664
1766
  pendingAssets.push({
1665
1767
  input: sourceRoot,
@@ -1667,34 +1769,15 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
1667
1769
  output: "src/"
1668
1770
  });
1669
1771
  }
1670
- const nxJson = readNxConfig(config.workspaceRoot);
1671
- const projectGraph = readCachedProjectGraph();
1672
- const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
1673
- if (!projectsConfigurations?.projects?.[projectName]) {
1674
- 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.");
1675
- }
1676
- const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
1677
- if (!buildTarget) {
1678
- throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
1679
- }
1680
- const result = await copyAssetsBase({
1681
- assets,
1682
- watch: false,
1683
- outputPath
1684
- }, {
1685
- root: config.workspaceRoot,
1686
- targetName: "build",
1687
- target: buildTarget,
1688
- projectName,
1689
- projectGraph,
1690
- projectsConfigurations,
1691
- nxJsonConfiguration: nxJson,
1692
- cwd: config.workspaceRoot,
1693
- isVerbose: isVerbose(config.logLevel)
1772
+ writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
1773
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
1774
+ const assetHandler = new CopyAssetsHandler({
1775
+ projectDir: projectRoot,
1776
+ rootDir: config.workspaceRoot,
1777
+ outputDir: outputPath,
1778
+ assets: pendingAssets
1694
1779
  });
1695
- if (!result.success) {
1696
- throw new Error("The Build process failed trying to copy assets");
1697
- }
1780
+ await assetHandler.processAllAssetsOnce();
1698
1781
  if (includeSrc === true) {
1699
1782
  writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
1700
1783
  const files = await glob([
@@ -1714,20 +1797,20 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
1714
1797
  // ../build-tools/src/utilities/generate-package-json.ts
1715
1798
  import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
1716
1799
  import { Glob } from "glob";
1717
- import { existsSync as existsSync4 } from "node:fs";
1800
+ import { existsSync as existsSync3 } from "node:fs";
1718
1801
  import { readFile as readFile3 } from "node:fs/promises";
1719
- import { readCachedProjectGraph as readCachedProjectGraph2 } from "nx/src/project-graph/project-graph";
1802
+ import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
1720
1803
  var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, projectRoot, projectName, packageJson) => {
1721
- const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph2(), workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1804
+ const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph(), workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1722
1805
  const localPackages = [];
1723
1806
  for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot3)) {
1724
1807
  const projectNode = project.node;
1725
1808
  if (projectNode.data.root) {
1726
1809
  const projectPackageJsonPath = joinPaths(workspaceRoot3, projectNode.data.root, "package.json");
1727
- if (existsSync4(projectPackageJsonPath)) {
1810
+ if (existsSync3(projectPackageJsonPath)) {
1728
1811
  const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
1729
1812
  const projectPackageJson = JSON.parse(projectPackageJsonContent);
1730
- if (projectPackageJson.private !== false) {
1813
+ if (projectPackageJson.private !== true) {
1731
1814
  localPackages.push(projectPackageJson);
1732
1815
  }
1733
1816
  }
@@ -1825,34 +1908,6 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1825
1908
  }
1826
1909
  };
1827
1910
  }, "addPackageJsonExport");
1828
- var addPackageJsonExports = /* @__PURE__ */ __name(async (sourceRoot, packageJson) => {
1829
- packageJson.exports ??= {};
1830
- const files = await new Glob("**/*.{ts,tsx}", {
1831
- absolute: false,
1832
- cwd: sourceRoot,
1833
- root: sourceRoot
1834
- }).walk();
1835
- files.forEach((file) => {
1836
- addPackageJsonExport(file, packageJson.type, sourceRoot);
1837
- const split = file.split(".");
1838
- split.pop();
1839
- const entry = split.join(".").replaceAll("\\", "/");
1840
- packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, sourceRoot);
1841
- });
1842
- packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
1843
- packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
1844
- packageJson.types = "./dist/index.d.ts";
1845
- packageJson.exports ??= {};
1846
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
1847
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1848
- ret[key.replace("/index", "")] = packageJson.exports[key];
1849
- }
1850
- return ret;
1851
- }, packageJson.exports);
1852
- packageJson.exports["./package.json"] ??= "./package.json";
1853
- packageJson.exports["."] = packageJson.exports["."] ?? addPackageJsonExport("index", packageJson.type, sourceRoot);
1854
- return packageJson;
1855
- }, "addPackageJsonExports");
1856
1911
 
1857
1912
  // ../build-tools/src/utilities/get-entry-points.ts
1858
1913
  import { glob as glob2 } from "glob";
@@ -1930,16 +1985,22 @@ function getOutExtension(format2, pkgType) {
1930
1985
  }
1931
1986
  __name(getOutExtension, "getOutExtension");
1932
1987
 
1988
+ // ../build-tools/src/utilities/read-nx-config.ts
1989
+ import { existsSync as existsSync4 } from "node:fs";
1990
+ import { readFile as readFile4 } from "node:fs/promises";
1991
+
1933
1992
  // ../build-tools/src/utilities/task-graph.ts
1934
1993
  import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
1935
1994
 
1936
1995
  // ../esbuild/src/build.ts
1937
1996
  import { watch as createWatcher } from "chokidar";
1938
- import defu3 from "defu";
1997
+ import defu4 from "defu";
1939
1998
  import { debounce, flatten } from "es-toolkit";
1940
1999
  import { map } from "es-toolkit/compat";
1941
2000
  import * as esbuild2 from "esbuild";
1942
2001
  import { globbySync } from "globby";
2002
+ import { existsSync as existsSync6 } from "node:fs";
2003
+ import hf from "node:fs/promises";
1943
2004
  import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
1944
2005
 
1945
2006
  // ../esbuild/src/base/renderer-engine.ts
@@ -2084,21 +2145,21 @@ var RendererEngine = class {
2084
2145
  };
2085
2146
 
2086
2147
  // ../esbuild/src/clean.ts
2087
- import { hfs } from "@humanfs/node";
2088
- async function clean(name = "ESBuild", directory, config) {
2089
- writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2090
- const stopwatch = getStopwatch(`${name} output clean`);
2091
- await hfs.deleteAll(directory);
2092
- stopwatch();
2148
+ import { rm } from "node:fs/promises";
2149
+ async function cleanDirectories(name = "ESBuild", directory, config) {
2150
+ await rm(directory, {
2151
+ recursive: true,
2152
+ force: true
2153
+ });
2093
2154
  }
2094
- __name(clean, "clean");
2155
+ __name(cleanDirectories, "cleanDirectories");
2095
2156
 
2096
2157
  // ../esbuild/src/plugins/esm-split-code-to-cjs.ts
2097
2158
  import * as esbuild from "esbuild";
2098
2159
  var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2099
2160
  name: "storm:esm-split-code-to-cjs",
2100
- setup(build6) {
2101
- build6.onEnd(async (result) => {
2161
+ setup(build5) {
2162
+ build5.onEnd(async (result) => {
2102
2163
  const outFiles = Object.keys(result.metafile?.outputs ?? {});
2103
2164
  const jsFiles = outFiles.filter((f) => f.endsWith("js"));
2104
2165
  await esbuild.build({
@@ -2116,15 +2177,15 @@ var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions)
2116
2177
  // ../esbuild/src/plugins/fix-imports.ts
2117
2178
  var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2118
2179
  name: "storm:fix-imports",
2119
- setup(build6) {
2120
- build6.onResolve({
2180
+ setup(build5) {
2181
+ build5.onResolve({
2121
2182
  filter: /^spdx-exceptions/
2122
2183
  }, () => {
2123
2184
  return {
2124
2185
  path: __require.resolve("spdx-exceptions")
2125
2186
  };
2126
2187
  });
2127
- build6.onResolve({
2188
+ build5.onResolve({
2128
2189
  filter: /^spdx-license-ids/
2129
2190
  }, () => {
2130
2191
  return {
@@ -2139,8 +2200,8 @@ import { dirname } from "node:path";
2139
2200
  var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
2140
2201
  return {
2141
2202
  name: "native-node-modules",
2142
- setup(build6) {
2143
- build6.onResolve({
2203
+ setup(build5) {
2204
+ build5.onResolve({
2144
2205
  filter: /\.node$/,
2145
2206
  namespace: "file"
2146
2207
  }, (args) => {
@@ -2159,7 +2220,7 @@ var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions)
2159
2220
  path: resolvedId
2160
2221
  };
2161
2222
  });
2162
- build6.onLoad({
2223
+ build5.onLoad({
2163
2224
  filter: /.*/,
2164
2225
  namespace: "node-file"
2165
2226
  }, (args) => {
@@ -2172,14 +2233,14 @@ var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions)
2172
2233
  resolveDir: dirname(args.path)
2173
2234
  };
2174
2235
  });
2175
- build6.onResolve({
2236
+ build5.onResolve({
2176
2237
  filter: /\.node$/,
2177
2238
  namespace: "node-file"
2178
2239
  }, (args) => ({
2179
2240
  path: args.path,
2180
2241
  namespace: "file"
2181
2242
  }));
2182
- const opts = build6.initialOptions;
2243
+ const opts = build5.initialOptions;
2183
2244
  opts.loader = opts.loader || {};
2184
2245
  opts.loader[".node"] = "file";
2185
2246
  }
@@ -2205,8 +2266,8 @@ var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
2205
2266
  // ../esbuild/src/plugins/on-error.ts
2206
2267
  var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2207
2268
  name: "storm:on-error",
2208
- setup(build6) {
2209
- build6.onEnd((result) => {
2269
+ setup(build5) {
2270
+ build5.onEnd((result) => {
2210
2271
  if (result.errors.length > 0 && process.env.WATCH !== "true") {
2211
2272
  writeError(`The following errors occurred during the build:
2212
2273
  ${result.errors.map((error) => error.text).join("\n")}
@@ -2242,14 +2303,14 @@ function resolvePathsConfig(options, cwd) {
2242
2303
  __name(resolvePathsConfig, "resolvePathsConfig");
2243
2304
  var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2244
2305
  name: "storm:resolve-paths",
2245
- setup(build6) {
2246
- const parentTsConfig = build6.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build6.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
2306
+ setup(build5) {
2307
+ const parentTsConfig = build5.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build5.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
2247
2308
  const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
2248
2309
  const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
2249
- build6.onResolve({
2310
+ build5.onResolve({
2250
2311
  filter: packagesRegex
2251
2312
  }, (args) => {
2252
- if (build6.initialOptions.external?.includes(args.path)) {
2313
+ if (build5.initialOptions.external?.includes(args.path)) {
2253
2314
  return {
2254
2315
  path: args.path,
2255
2316
  external: true
@@ -2263,8 +2324,9 @@ var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2263
2324
  }), "resolvePathsPlugin");
2264
2325
 
2265
2326
  // ../esbuild/src/plugins/tsc.ts
2266
- import { hfs as hfs2 } from "@humanfs/node";
2267
2327
  import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
2328
+ import { existsSync as existsSync5 } from "node:fs";
2329
+ import fs3 from "node:fs/promises";
2268
2330
  function bundleTypeDefinitions(filename, outfile, externals, options) {
2269
2331
  const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
2270
2332
  const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
@@ -2323,11 +2385,11 @@ function bundleTypeDefinitions(filename, outfile, externals, options) {
2323
2385
  __name(bundleTypeDefinitions, "bundleTypeDefinitions");
2324
2386
  var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2325
2387
  name: "storm:tsc",
2326
- setup(build6) {
2388
+ setup(build5) {
2327
2389
  if (options.emitTypes === false) {
2328
2390
  return;
2329
2391
  }
2330
- build6.onStart(async () => {
2392
+ build5.onStart(async () => {
2331
2393
  if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
2332
2394
  await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
2333
2395
  }
@@ -2337,18 +2399,18 @@ var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2337
2399
  const entryPoint = resolvedOptions.entryPoints[0].replace(sourceRoot, "").replace(/\.ts$/, "");
2338
2400
  const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
2339
2401
  let dtsPath;
2340
- if (await hfs2.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
2402
+ if (existsSync5(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
2341
2403
  dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
2342
- } else if (await hfs2.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
2404
+ } else if (existsSync5(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
2343
2405
  dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
2344
2406
  }
2345
2407
  const ext = resolvedOptions.outExtension.dts || resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
2346
2408
  if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
2347
2409
  bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
2348
- const dtsContents = await hfs2.text(`${bundlePath}.d.ts`);
2349
- await hfs2.write(`${bundlePath}.${ext}`, dtsContents);
2410
+ const dtsContents = await fs3.readFile(`${bundlePath}.d.ts`, "utf8");
2411
+ await fs3.writeFile(`${bundlePath}.${ext}`, dtsContents);
2350
2412
  } else {
2351
- await hfs2.write(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
2413
+ await fs3.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
2352
2414
  }
2353
2415
  }
2354
2416
  });
@@ -2450,7 +2512,7 @@ var missingIgnore = [
2450
2512
  ];
2451
2513
  var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
2452
2514
  name: "storm:deps-check",
2453
- setup(build6) {
2515
+ setup(build5) {
2454
2516
  const pkgJsonPath = path5.join(process.cwd(), "package.json");
2455
2517
  const pkgContents = __require(pkgJsonPath);
2456
2518
  const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
@@ -2462,7 +2524,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
2462
2524
  ];
2463
2525
  const collectedDependencies = /* @__PURE__ */ new Set();
2464
2526
  const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
2465
- build6.onResolve({
2527
+ build5.onResolve({
2466
2528
  filter: onlyPackages
2467
2529
  }, (args) => {
2468
2530
  if (args.importer.includes(process.cwd())) {
@@ -2478,7 +2540,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
2478
2540
  external: true
2479
2541
  };
2480
2542
  });
2481
- build6.onEnd(() => {
2543
+ build5.onEnd(() => {
2482
2544
  const unusedDependencies = [
2483
2545
  ...dependencies
2484
2546
  ].filter((dep) => {
@@ -2590,30 +2652,32 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
2590
2652
  if (!workspaceRoot3) {
2591
2653
  throw new Error("Cannot find Nx workspace root");
2592
2654
  }
2593
- const config = await loadStormConfig(workspaceRoot3.dir);
2655
+ const config = await getConfig(workspaceRoot3.dir);
2594
2656
  writeDebug(" \u2699\uFE0F Resolving build options", config);
2595
2657
  const stopwatch = getStopwatch("Build options resolution");
2596
2658
  const projectGraph = await createProjectGraphAsync({
2597
2659
  exitOnError: true
2598
2660
  });
2599
2661
  const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
2600
- if (!await hfs3.isFile(projectJsonPath)) {
2662
+ if (!existsSync6(projectJsonPath)) {
2601
2663
  throw new Error("Cannot find project.json configuration");
2602
2664
  }
2603
- const projectJson = await hfs3.json(projectJsonPath);
2665
+ const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
2666
+ const projectJson = JSON.parse(projectJsonFile);
2604
2667
  const projectName = projectJson.name;
2605
- const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
2668
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
2606
2669
  if (!projectConfigurations?.projects?.[projectName]) {
2607
2670
  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.");
2608
2671
  }
2609
- const options = defu3(userOptions, DEFAULT_BUILD_OPTIONS);
2672
+ const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS);
2610
2673
  options.name ??= `${projectName}-${options.format}`;
2611
2674
  options.target ??= DEFAULT_TARGET;
2612
2675
  const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
2613
- if (!await hfs3.isFile(packageJsonPath)) {
2676
+ if (!existsSync6(packageJsonPath)) {
2614
2677
  throw new Error("Cannot find package.json configuration");
2615
2678
  }
2616
- const packageJson = await hfs3.json(packageJsonPath);
2679
+ const packageJsonFile = await hf.readFile(packageJsonPath, "utf8");
2680
+ const packageJson = JSON.parse(packageJsonFile);
2617
2681
  const outExtension = getOutputExtensionMap(options, packageJson.type);
2618
2682
  const env = getEnv("esbuild", options);
2619
2683
  const result = {
@@ -2692,14 +2756,15 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
2692
2756
  return result;
2693
2757
  }, "resolveOptions");
2694
2758
  async function generatePackageJson(context2) {
2695
- if (context2.options.generatePackageJson !== false && await hfs3.isFile(joinPaths(context2.options.projectRoot, "package.json"))) {
2759
+ if (context2.options.generatePackageJson !== false && existsSync6(joinPaths(context2.options.projectRoot, "package.json"))) {
2696
2760
  writeDebug(" \u270D\uFE0F Writing package.json file", context2.options.config);
2697
2761
  const stopwatch = getStopwatch("Write package.json file");
2698
2762
  const packageJsonPath = joinPaths(context2.options.projectRoot, "project.json");
2699
- if (!await hfs3.isFile(packageJsonPath)) {
2763
+ if (!existsSync6(packageJsonPath)) {
2700
2764
  throw new Error("Cannot find package.json configuration");
2701
2765
  }
2702
- let packageJson = await hfs3.json(joinPaths(context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"));
2766
+ const packageJsonFile = await hf.readFile(joinPaths(context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"), "utf8");
2767
+ let packageJson = JSON.parse(packageJsonFile);
2703
2768
  if (!packageJson) {
2704
2769
  throw new Error("Cannot find package.json configuration file");
2705
2770
  }
@@ -2772,7 +2837,7 @@ async function executeEsBuild(context2) {
2772
2837
  const result = await esbuild2.build(context2.options);
2773
2838
  if (result.metafile) {
2774
2839
  const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
2775
- await hfs3.write(metafilePath, JSON.stringify(result.metafile));
2840
+ await hf.writeFile(metafilePath, JSON.stringify(result.metafile));
2776
2841
  }
2777
2842
  stopwatch();
2778
2843
  return context2;
@@ -2782,7 +2847,7 @@ async function copyBuildAssets(context2) {
2782
2847
  if (context2.result?.errors.length === 0) {
2783
2848
  writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context2.options.outdir}`, context2.options.config);
2784
2849
  const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
2785
- await copyAssets(context2.options.config, context2.options.assets ?? [], context2.options.outdir, context2.options.projectRoot, context2.options.projectName, context2.options.sourceRoot, true, false);
2850
+ await copyAssets(context2.options.config, context2.options.assets ?? [], context2.options.outdir, context2.options.projectRoot, context2.options.sourceRoot, true, false);
2786
2851
  stopwatch();
2787
2852
  }
2788
2853
  return context2;
@@ -2829,7 +2894,10 @@ async function dependencyCheck(options) {
2829
2894
  __name(dependencyCheck, "dependencyCheck");
2830
2895
  async function cleanOutputPath(context2) {
2831
2896
  if (context2.options.clean !== false && context2.options.outdir) {
2832
- await clean(context2.options.name, context2.options.outdir, context2.options.config);
2897
+ writeDebug(` \u{1F9F9} Cleaning ${context2.options.name} output path: ${context2.options.outdir}`, context2.options.config);
2898
+ const stopwatch = getStopwatch(`${context2.options.name} output clean`);
2899
+ await cleanDirectories(context2.options.name, context2.options.outdir, context2.options.config);
2900
+ stopwatch();
2833
2901
  }
2834
2902
  return context2;
2835
2903
  }
@@ -2919,11 +2987,11 @@ var executor_default6 = withRunExecutor("Storm ESBuild build", esbuildExecutorFn
2919
2987
 
2920
2988
  // ../workspace-tools/src/executors/npm-publish/executor.ts
2921
2989
  import { execSync as execSync4 } from "node:child_process";
2922
- import fs3 from "node:fs/promises";
2990
+ import fs4 from "node:fs/promises";
2923
2991
 
2924
2992
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
2925
- import { existsSync as existsSync5 } from "node:fs";
2926
- import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
2993
+ import { existsSync as existsSync7 } from "node:fs";
2994
+ import { readFile as readFile5, writeFile as writeFile2 } from "node:fs/promises";
2927
2995
  import { format } from "prettier";
2928
2996
  import readYamlFile from "read-yaml-file";
2929
2997
 
@@ -2931,7 +2999,7 @@ import readYamlFile from "read-yaml-file";
2931
2999
  var LARGE_BUFFER3 = 1024 * 1e6;
2932
3000
 
2933
3001
  // ../workspace-tools/src/executors/size-limit/executor.ts
2934
- import { joinPathFragments as joinPathFragments4 } from "@nx/devkit";
3002
+ import { joinPathFragments as joinPathFragments3 } from "@nx/devkit";
2935
3003
  import esBuildPlugin from "@size-limit/esbuild";
2936
3004
  import esBuildWhyPlugin from "@size-limit/esbuild-why";
2937
3005
  import filePlugin from "@size-limit/file";
@@ -2946,7 +3014,7 @@ async function sizeLimitExecutorFn(options, context2, config) {
2946
3014
  esBuildPlugin,
2947
3015
  esBuildWhyPlugin
2948
3016
  ], {
2949
- checks: options.entry ?? context2.projectsConfigurations.projects[context2.projectName]?.sourceRoot ?? joinPathFragments4(context2.projectsConfigurations.projects[context2.projectName]?.root ?? "./", "src")
3017
+ checks: options.entry ?? context2.projectsConfigurations.projects[context2.projectName]?.sourceRoot ?? joinPathFragments3(context2.projectsConfigurations.projects[context2.projectName]?.root ?? "./", "src")
2950
3018
  }).then((result) => {
2951
3019
  writeInfo(`\u{1F4CF} ${context2.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
2952
3020
  });
@@ -2965,21 +3033,22 @@ var executor_default7 = withRunExecutor("Size-Limit Performance Test Executor",
2965
3033
  });
2966
3034
 
2967
3035
  // ../tsdown/src/build.ts
2968
- import { hfs as hfs5 } from "@humanfs/node";
2969
- import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph3, writeJsonFile as writeJsonFile2 } from "@nx/devkit";
2970
- import defu4 from "defu";
3036
+ import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile as writeJsonFile2 } from "@nx/devkit";
3037
+ import defu5 from "defu";
3038
+ import { existsSync as existsSync8 } from "node:fs";
3039
+ import hf2 from "node:fs/promises";
2971
3040
  import { findWorkspaceRoot as findWorkspaceRoot3 } from "nx/src/utils/find-workspace-root";
2972
3041
  import { build as tsdown } from "tsdown";
2973
3042
 
2974
3043
  // ../tsdown/src/clean.ts
2975
- import { hfs as hfs4 } from "@humanfs/node";
2976
- async function clean2(name = "ESBuild", directory, config) {
2977
- writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2978
- const stopwatch = getStopwatch(`${name} output clean`);
2979
- await hfs4.deleteAll(directory);
2980
- stopwatch();
3044
+ import { rm as rm2 } from "node:fs/promises";
3045
+ async function cleanDirectories2(name = "TSDown", directory, config) {
3046
+ await rm2(directory, {
3047
+ recursive: true,
3048
+ force: true
3049
+ });
2981
3050
  }
2982
- __name(clean2, "clean");
3051
+ __name(cleanDirectories2, "cleanDirectories");
2983
3052
 
2984
3053
  // ../tsdown/src/config.ts
2985
3054
  var DEFAULT_BUILD_OPTIONS2 = {
@@ -3010,27 +3079,28 @@ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
3010
3079
  if (!workspaceRoot3) {
3011
3080
  throw new Error("Cannot find Nx workspace root");
3012
3081
  }
3013
- const config = await loadStormConfig(workspaceRoot3.dir);
3082
+ const config = await getConfig(workspaceRoot3.dir);
3014
3083
  writeDebug(" \u2699\uFE0F Resolving build options", config);
3015
3084
  const stopwatch = getStopwatch("Build options resolution");
3016
3085
  const projectGraph = await createProjectGraphAsync2({
3017
3086
  exitOnError: true
3018
3087
  });
3019
3088
  const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
3020
- if (!await hfs5.isFile(projectJsonPath)) {
3089
+ if (!existsSync8(projectJsonPath)) {
3021
3090
  throw new Error("Cannot find project.json configuration");
3022
3091
  }
3023
- const projectJson = await hfs5.json(projectJsonPath);
3092
+ const projectJsonFile = await hf2.readFile(projectJsonPath, "utf8");
3093
+ const projectJson = JSON.parse(projectJsonFile);
3024
3094
  const projectName = projectJson.name;
3025
- const projectConfigurations = readProjectsConfigurationFromProjectGraph3(projectGraph);
3095
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
3026
3096
  if (!projectConfigurations?.projects?.[projectName]) {
3027
3097
  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.");
3028
3098
  }
3029
- const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS2);
3099
+ const options = defu5(userOptions, DEFAULT_BUILD_OPTIONS2);
3030
3100
  options.name ??= `${projectName}-${options.format}`;
3031
3101
  options.target ??= DEFAULT_TARGET;
3032
3102
  const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
3033
- if (!await hfs5.isFile(packageJsonPath)) {
3103
+ if (!existsSync8(packageJsonPath)) {
3034
3104
  throw new Error("Cannot find package.json configuration");
3035
3105
  }
3036
3106
  const env = getEnv("tsdown", options);
@@ -3085,17 +3155,18 @@ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
3085
3155
  return result;
3086
3156
  }, "resolveOptions");
3087
3157
  async function generatePackageJson2(options) {
3088
- if (options.generatePackageJson !== false && await hfs5.isFile(joinPaths(options.projectRoot, "package.json"))) {
3158
+ if (options.generatePackageJson !== false && existsSync8(joinPaths(options.projectRoot, "package.json"))) {
3089
3159
  writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
3090
3160
  const stopwatch = getStopwatch("Write package.json file");
3091
3161
  const packageJsonPath = joinPaths(options.projectRoot, "project.json");
3092
- if (!await hfs5.isFile(packageJsonPath)) {
3162
+ if (!existsSync8(packageJsonPath)) {
3093
3163
  throw new Error("Cannot find package.json configuration");
3094
3164
  }
3095
- let packageJson = await hfs5.json(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"));
3096
- if (!packageJson) {
3165
+ const packageJsonFile = await hf2.readFile(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
3166
+ if (!packageJsonFile) {
3097
3167
  throw new Error("Cannot find package.json configuration file");
3098
3168
  }
3169
+ let packageJson = JSON.parse(packageJsonFile);
3099
3170
  packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
3100
3171
  packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
3101
3172
  packageJson.exports ??= {};
@@ -3152,7 +3223,7 @@ __name(executeTSDown, "executeTSDown");
3152
3223
  async function copyBuildAssets2(options) {
3153
3224
  writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
3154
3225
  const stopwatch = getStopwatch(`${options.name} asset copy`);
3155
- await copyAssets(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.projectName, options.sourceRoot, true, false);
3226
+ await copyAssets(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.sourceRoot, true, false);
3156
3227
  stopwatch();
3157
3228
  return options;
3158
3229
  }
@@ -3163,7 +3234,10 @@ async function reportResults2(options) {
3163
3234
  __name(reportResults2, "reportResults");
3164
3235
  async function cleanOutputPath2(options) {
3165
3236
  if (options.clean !== false && options.outdir) {
3166
- await clean2(options.name, options.outdir, options.config);
3237
+ writeDebug(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outdir}`, options.config);
3238
+ const stopwatch = getStopwatch(`${options.name} output clean`);
3239
+ await cleanDirectories2(options.name, options.outdir, options.config);
3240
+ stopwatch();
3167
3241
  }
3168
3242
  return options;
3169
3243
  }
@@ -3269,458 +3343,49 @@ var executor_default9 = withRunExecutor("Typia runtime validation generator", ty
3269
3343
  }
3270
3344
  });
3271
3345
 
3272
- // ../unbuild/src/build.ts
3273
- import { readCachedProjectGraph as readCachedProjectGraph4, writeJsonFile as writeJsonFile3 } from "@nx/devkit";
3274
- import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
3275
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies3 } from "@nx/js/src/utils/buildable-libs-utils";
3276
- import defu5 from "defu";
3346
+ // ../workspace-tools/src/executors/unbuild/executor.ts
3347
+ import { defu as defu6 } from "defu";
3277
3348
  import { createJiti } from "jiti";
3278
- import { existsSync as existsSync6 } from "node:fs";
3279
- import { readFile as readFile5 } from "node:fs/promises";
3280
- import { relative as relative4 } from "node:path";
3281
- import { findWorkspaceRoot as findWorkspaceRoot4 } from "nx/src/utils/find-workspace-root";
3282
-
3283
- // ../unbuild/src/clean.ts
3284
- import { rm } from "node:fs/promises";
3285
- async function clean3(name = "Unbuild", directory, config) {
3286
- writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
3287
- const stopwatch = getStopwatch(`${name} output clean`);
3288
- await rm(directory, {
3289
- recursive: true,
3290
- force: true
3291
- });
3292
- stopwatch();
3293
- }
3294
- __name(clean3, "clean");
3295
-
3296
- // ../unbuild/src/plugins/analyze.ts
3297
- var formatBytes = /* @__PURE__ */ __name((bytes) => {
3298
- if (bytes === 0) return "0 Byte";
3299
- const k = 1e3;
3300
- const dm = 3;
3301
- const sizes = [
3302
- "Bytes",
3303
- "KB",
3304
- "MB",
3305
- "GB"
3306
- ];
3307
- const i = Math.floor(Math.log(bytes) / Math.log(k));
3308
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
3309
- }, "formatBytes");
3310
- var analyzePlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
3311
- return {
3312
- name: "storm:analyzer",
3313
- renderChunk(source, chunk) {
3314
- const sourceBytes = formatBytes(source.length);
3315
- const fileName = chunk.fileName;
3316
- writeInfo(` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
3317
- }
3318
- };
3319
- }, "analyzePlugin");
3320
-
3321
- // ../unbuild/src/plugins/on-error.ts
3322
- var onErrorPlugin2 = /* @__PURE__ */ __name((options, resolvedOptions) => ({
3323
- name: "storm:on-error",
3324
- buildEnd(error) {
3325
- if (error) {
3326
- writeError(`The following errors occurred during the build:
3327
- ${error ? error.message : "Unknown build error"}
3328
-
3329
- `, resolvedOptions.config);
3330
- throw new Error("Storm unbuild process failed with errors.");
3331
- }
3332
- },
3333
- renderError(error) {
3334
- writeError(`The following errors occurred during the build:
3335
- ${error ? error.message : "Unknown build error"}
3336
-
3337
- `, resolvedOptions.config);
3338
- throw new Error("Storm unbuild process failed with errors.");
3339
- }
3340
- }), "onErrorPlugin");
3341
-
3342
- // ../unbuild/src/plugins/tsc.ts
3343
- import { readCachedProjectGraph as readCachedProjectGraph3 } from "@nx/devkit";
3344
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
3345
- import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
3346
- import ts2Plugin from "rollup-plugin-typescript2";
3347
-
3348
- // ../unbuild/src/utilities/helpers.ts
3349
- import { joinPathFragments as joinPathFragments5 } from "@nx/devkit";
3350
- import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
3351
- import { dirname as dirname2, extname } from "node:path";
3352
- import { pathToFileURL } from "node:url";
3353
- import ts from "typescript";
3354
- async function loadConfig2(configPath) {
3355
- if (!/\.(js|mjs)$/.test(extname(configPath))) {
3356
- throw new Error("Unsupported config file format");
3357
- }
3358
- return import(pathToFileURL(configPath).toString()).then((config) => config.default);
3359
- }
3360
- __name(loadConfig2, "loadConfig");
3361
- async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
3362
- const tsConfigFile = ts.readConfigFile(joinPathFragments5(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
3363
- const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname2(joinPathFragments5(config.workspaceRoot, projectRoot, tsConfigPath)));
3364
- const compilerOptions = {
3365
- rootDir: projectRoot,
3366
- declaration: true,
3367
- paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
3368
- };
3369
- writeTrace(compilerOptions, config);
3370
- return compilerOptions;
3371
- }
3372
- __name(createTsCompilerOptions, "createTsCompilerOptions");
3373
-
3374
- // ../unbuild/src/plugins/tsc.ts
3375
- var tscPlugin2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
3376
- const projectGraph = readCachedProjectGraph3();
3377
- const result = calculateProjectBuildableDependencies2(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
3378
- let dependencies = result.dependencies;
3379
- const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
3380
- if (tsLibDependency) {
3381
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
3382
- dependencies.push(tsLibDependency);
3383
- }
3384
- return ts2Plugin({
3385
- check: options.emitTypes !== false,
3386
- tsconfig: resolvedOptions.tsconfig,
3387
- tsconfigOverride: {
3388
- compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
3389
- }
3390
- });
3391
- }, "tscPlugin");
3392
-
3393
- // ../unbuild/src/plugins/type-definitions.ts
3394
- import { relative as relative3 } from "node:path";
3395
- function typeDefinitions(projectRoot) {
3396
- return {
3397
- name: "storm:dts-bundle",
3398
- async generateBundle(_opts, bundle) {
3399
- for (const file of Object.values(bundle)) {
3400
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
3401
- continue;
3402
- }
3403
- const hasDefaultExport = file.exports.includes("default");
3404
- const entrySourceFileName = relative3(projectRoot, file.facadeModuleId);
3405
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
3406
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
3407
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
3408
- const dtsFileSource = hasDefaultExport ? `
3409
- export * from ${relativeSourceDtsName};
3410
- export { default } from ${relativeSourceDtsName};
3411
- ` : `export * from ${relativeSourceDtsName};
3412
- `;
3413
- this.emitFile({
3414
- type: "asset",
3415
- fileName: dtsFileName,
3416
- source: dtsFileSource
3417
- });
3418
- }
3419
- }
3420
- };
3421
- }
3422
- __name(typeDefinitions, "typeDefinitions");
3423
-
3424
- // ../unbuild/src/config.ts
3425
- var getDefaultBuildPlugins2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
3426
- analyzePlugin(options, resolvedOptions),
3427
- typeDefinitions(resolvedOptions.projectRoot),
3428
- tscPlugin2(options, resolvedOptions),
3429
- onErrorPlugin2(options, resolvedOptions)
3430
- ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
3431
-
3432
- // ../unbuild/src/build.ts
3433
- async function resolveOptions3(options) {
3434
- const projectRoot = options.projectRoot;
3435
- if (!projectRoot) {
3436
- throw new Error("Cannot find project root");
3437
- }
3438
- const outputPath = options.outputPath || joinPaths("dist", projectRoot);
3439
- const workspaceRoot3 = findWorkspaceRoot4(projectRoot);
3440
- if (!workspaceRoot3) {
3441
- throw new Error("Cannot find workspace root");
3442
- }
3443
- const config = await loadStormConfig(workspaceRoot3.dir);
3444
- writeDebug(" \u2699\uFE0F Resolving build options", config);
3445
- const stopwatch = getStopwatch("Build options resolution");
3446
- if (options.configPath) {
3447
- const configFile = await loadConfig2(options.configPath);
3448
- if (configFile) {
3449
- options = defu5(options, configFile);
3450
- }
3451
- }
3452
- const projectGraph = readCachedProjectGraph4();
3453
- const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
3454
- if (!existsSync6(projectJsonPath)) {
3455
- throw new Error("Cannot find project.json configuration");
3456
- }
3457
- const projectJsonContent = await readFile5(projectJsonPath, "utf8");
3458
- const projectJson = JSON.parse(projectJsonContent);
3459
- const projectName = projectJson.name;
3460
- const packageJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "package.json");
3461
- if (!existsSync6(packageJsonPath)) {
3462
- throw new Error("Cannot find package.json configuration");
3463
- }
3464
- const packageJsonContent = await readFile5(packageJsonPath, "utf8");
3465
- const packageJson = JSON.parse(packageJsonContent);
3466
- let tsconfig = options.tsconfig;
3467
- if (!tsconfig) {
3468
- tsconfig = joinPaths(workspaceRoot3.dir, projectRoot, "tsconfig.json");
3469
- }
3470
- if (!existsSync6(tsconfig)) {
3471
- throw new Error("Cannot find tsconfig.json configuration");
3472
- }
3473
- let sourceRoot = projectJson.sourceRoot;
3474
- if (!sourceRoot) {
3475
- sourceRoot = joinPaths(projectRoot, "src");
3349
+ async function unbuildExecutorFn(options, context2, config) {
3350
+ writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
3351
+ if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
3352
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace root directory.");
3476
3353
  }
3477
- if (!existsSync6(sourceRoot)) {
3478
- throw new Error("Cannot find sourceRoot directory");
3354
+ if (!context2.projectsConfigurations.projects[context2.projectName].root) {
3355
+ throw new Error("The Build process failed because the project root is not valid. Please run this command from a workspace root directory.");
3479
3356
  }
3480
- const result = calculateProjectBuildableDependencies3(void 0, projectGraph, workspaceRoot3.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
3481
- let dependencies = result.dependencies;
3482
- const tsLibDependency = getHelperDependency2(HelperDependency2.tsc, tsconfig, dependencies, projectGraph, true);
3483
- if (tsLibDependency) {
3484
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
3485
- dependencies.push(tsLibDependency);
3357
+ if (!context2.projectsConfigurations.projects[context2.projectName].sourceRoot) {
3358
+ 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.");
3486
3359
  }
3487
3360
  const jiti = createJiti(config.workspaceRoot, {
3488
- cache: true,
3489
- fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
3361
+ fsCache: config.skipCache ? false : joinPaths(config.workspaceRoot, config.directories.cache || "node_modules/.cache/storm", "jiti"),
3490
3362
  interopDefault: true
3491
3363
  });
3492
- const resolvedOptions = {
3493
- name: projectName,
3494
- config,
3495
- projectRoot,
3496
- sourceRoot,
3497
- projectName,
3498
- tsconfig,
3499
- jiti,
3500
- clean: false,
3501
- entries: [
3502
- {
3503
- builder: "mkdist",
3504
- input: `.${sourceRoot.replace(projectRoot, "")}`,
3505
- outDir: joinPaths(relative4(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
3506
- declaration: options.emitTypes !== false,
3507
- format: "esm"
3508
- },
3509
- {
3510
- builder: "mkdist",
3511
- input: `.${sourceRoot.replace(projectRoot, "")}`,
3512
- outDir: joinPaths(relative4(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
3513
- declaration: options.emitTypes !== false,
3514
- format: "cjs",
3515
- ext: "cjs"
3516
- }
3517
- ],
3518
- declaration: options.emitTypes !== false ? "compatible" : false,
3519
- failOnWarn: false,
3520
- sourcemap: options.sourcemap ?? !!options.debug,
3521
- outDir: outputPath,
3522
- parallel: true,
3523
- stub: false,
3524
- stubOptions: {
3525
- jiti: {}
3526
- },
3527
- externals: options.external ?? [],
3528
- dependencies: [],
3529
- peerDependencies: [],
3530
- devDependencies: [],
3531
- hooks: {},
3532
- alias: {},
3533
- replace: {},
3534
- rollup: {
3535
- replace: {},
3536
- alias: {},
3537
- json: {},
3538
- commonjs: {
3539
- sourceMap: options.sourcemap ?? true
3540
- },
3541
- emitCJS: true,
3542
- cjsBridge: true,
3543
- dts: {
3544
- respectExternal: true,
3545
- tsconfig
3546
- },
3547
- output: {
3548
- banner: options.banner || `
3549
- // \u26A1 Built by Storm Software
3550
- `,
3551
- footer: options.footer
3552
- },
3553
- resolve: {
3554
- preferBuiltins: true,
3555
- extensions: [
3556
- ".cjs",
3557
- ".mjs",
3558
- ".js",
3559
- ".jsx",
3560
- ".ts",
3561
- ".tsx",
3562
- ".json"
3563
- ]
3564
- },
3565
- esbuild: {
3566
- minify: options.minify !== false,
3567
- splitting: options.splitting !== false,
3568
- treeShaking: options.treeShaking !== false,
3569
- color: true,
3570
- logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
3571
- }
3572
- }
3573
- };
3574
- dependencies = dependencies.filter((dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app");
3575
- if (dependencies.length > 0) {
3576
- resolvedOptions.dependencies = dependencies.map((dep) => dep.name);
3577
- }
3578
- if (packageJson.devDependencies) {
3579
- resolvedOptions.devDependencies = Object.keys(packageJson.devDependencies);
3580
- }
3581
- if (packageJson.peerDependencies) {
3582
- resolvedOptions.peerDependencies = Object.keys(packageJson.peerDependencies);
3583
- }
3584
- if (options.rollup) {
3585
- let rollup = {};
3586
- if (typeof options.rollup === "string") {
3587
- const rollupFile = await loadConfig2(options.rollup);
3588
- if (rollupFile) {
3589
- rollup = rollupFile;
3590
- }
3591
- } else {
3592
- rollup = options.rollup;
3593
- }
3594
- resolvedOptions.rollup = defu5(resolvedOptions.rollup ?? {}, rollup);
3595
- }
3596
- resolvedOptions.hooks = {
3597
- "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
3598
- opts.plugins = options.plugins ?? await getDefaultBuildPlugins2(options, resolvedOptions);
3599
- }, "rollup:options")
3600
- };
3601
- stopwatch();
3602
- return resolvedOptions;
3603
- }
3604
- __name(resolveOptions3, "resolveOptions");
3605
- async function generatePackageJson3(options) {
3606
- if (options.generatePackageJson !== false && existsSync6(joinPaths(options.projectRoot, "package.json"))) {
3607
- writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
3608
- const stopwatch = getStopwatch("Write package.json file");
3609
- const packageJsonPath = joinPaths(options.projectRoot, "project.json");
3610
- if (!existsSync6(packageJsonPath)) {
3611
- throw new Error("Cannot find package.json configuration");
3612
- }
3613
- let packageJsonContent = await readFile5(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
3614
- if (!packageJsonContent) {
3615
- throw new Error("Cannot find package.json configuration file");
3616
- }
3617
- let packageJson = JSON.parse(packageJsonContent);
3618
- packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
3619
- packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
3620
- await writeJsonFile3(joinPaths(options.outDir, "package.json"), await addPackageJsonExports(options.sourceRoot, packageJson));
3621
- stopwatch();
3622
- }
3623
- return options;
3624
- }
3625
- __name(generatePackageJson3, "generatePackageJson");
3626
- async function resolveUnbuild(options) {
3627
- writeTrace(`Resolving Unbuild package with Jiti`, options.config);
3628
- try {
3629
- return options.jiti.import("unbuild");
3630
- } catch (error) {
3631
- writeError(" \u274C An error occurred while resolving the Unbuild package", options.config);
3632
- throw new Error("An error occurred while resolving the Unbuild package", {
3633
- cause: error
3634
- });
3635
- }
3636
- }
3637
- __name(resolveUnbuild, "resolveUnbuild");
3638
- async function executeUnbuild(options) {
3639
- writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
3640
- const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
3641
- try {
3642
- const unbuild = await resolveUnbuild(options);
3643
- await unbuild.build(options.projectRoot, false, {
3644
- ...options,
3645
- rootDir: options.projectRoot
3646
- });
3647
- } finally {
3648
- stopwatch();
3649
- }
3650
- return options;
3651
- }
3652
- __name(executeUnbuild, "executeUnbuild");
3653
- async function copyBuildAssets3(options) {
3654
- writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
3655
- const stopwatch = getStopwatch(`${options.name} asset copy`);
3656
- await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
3657
- stopwatch();
3658
- return options;
3659
- }
3660
- __name(copyBuildAssets3, "copyBuildAssets");
3661
- async function cleanOutputPath3(options) {
3662
- if (options.clean !== false && options.outDir) {
3663
- await clean3(options.name, options.outDir, options.config);
3664
- }
3665
- return options;
3666
- }
3667
- __name(cleanOutputPath3, "cleanOutputPath");
3668
- async function build5(options) {
3669
- writeDebug(` \u26A1 Executing Storm Unbuild pipeline`);
3670
- const stopwatch = getStopwatch("Unbuild pipeline");
3671
- try {
3672
- const resolvedOptions = await resolveOptions3(options);
3673
- await cleanOutputPath3(resolvedOptions);
3674
- await generatePackageJson3(resolvedOptions);
3675
- await executeUnbuild(resolvedOptions);
3676
- await copyBuildAssets3(resolvedOptions);
3677
- writeSuccess(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, resolvedOptions.config);
3678
- } catch (error) {
3679
- writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
3680
- throw error;
3681
- } finally {
3682
- stopwatch();
3683
- }
3684
- }
3685
- __name(build5, "build");
3686
-
3687
- // ../workspace-tools/src/executors/unbuild/executor.ts
3688
- import { defu as defu6 } from "defu";
3689
- async function unbuildExecutorFn(options, context2, config) {
3690
- writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
3691
- if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !context2.projectsConfigurations.projects[context2.projectName]?.root) {
3692
- throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
3693
- }
3694
- await build5(defu6({
3364
+ const stormUnbuild = await jiti.import(jiti.esmResolve("@storm-software/unbuild/build"));
3365
+ await stormUnbuild.build(defu6({
3695
3366
  ...options,
3696
- projectRoot: context2.projectsConfigurations.projects?.[context2.projectName].root,
3367
+ projectRoot: context2.projectsConfigurations.projects[context2.projectName].root,
3697
3368
  projectName: context2.projectName,
3698
- sourceRoot: context2.projectsConfigurations.projects?.[context2.projectName]?.sourceRoot,
3699
- platform: options.platform,
3700
- name: context2.projectName
3369
+ sourceRoot: context2.projectsConfigurations.projects[context2.projectName].sourceRoot,
3370
+ platform: options.platform
3701
3371
  }, {
3702
3372
  stubOptions: {
3703
3373
  jiti: {
3704
- cache: "node_modules/.cache/storm"
3374
+ fsCache: config.skipCache ? false : joinPaths(config.workspaceRoot, config.directories.cache || "node_modules/.cache/storm", "jiti")
3705
3375
  }
3706
3376
  },
3707
3377
  rollup: {
3708
3378
  emitCJS: true,
3709
3379
  watch: false,
3710
- cjsBridge: false,
3711
3380
  dts: {
3712
3381
  respectExternal: true
3713
3382
  },
3714
- replace: {},
3715
- alias: {},
3716
- resolve: {},
3717
- json: {},
3718
- commonjs: {},
3719
3383
  esbuild: {
3720
3384
  target: options.target,
3721
3385
  format: "esm",
3722
3386
  platform: options.platform,
3723
- minify: options.minify,
3387
+ minify: options.minify ?? !options.debug,
3388
+ sourcemap: options.sourcemap ?? options.debug,
3724
3389
  treeShaking: options.treeShaking
3725
3390
  }
3726
3391
  }
@@ -3734,10 +3399,12 @@ var executor_default10 = withRunExecutor("TypeScript Unbuild build", unbuildExec
3734
3399
  skipReadingConfig: false,
3735
3400
  hooks: {
3736
3401
  applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
3402
+ options.debug ??= false;
3403
+ options.treeShaking ??= true;
3404
+ options.platform ??= "neutral";
3737
3405
  options.entry ??= [
3738
3406
  "{sourceRoot}"
3739
3407
  ];
3740
- options.outputPath ??= "dist/{projectRoot}";
3741
3408
  options.tsconfig ??= "{projectRoot}/tsconfig.json";
3742
3409
  return options;
3743
3410
  }, "applyDefaultOptions")
@@ -3745,7 +3412,7 @@ var executor_default10 = withRunExecutor("TypeScript Unbuild build", unbuildExec
3745
3412
  });
3746
3413
 
3747
3414
  // ../workspace-tools/src/generators/browser-library/generator.ts
3748
- import { formatFiles as formatFiles3, generateFiles, joinPathFragments as joinPathFragments6, names as names2, offsetFromRoot as offsetFromRoot2 } from "@nx/devkit";
3415
+ import { formatFiles as formatFiles3, generateFiles, names as names2, offsetFromRoot as offsetFromRoot2 } from "@nx/devkit";
3749
3416
 
3750
3417
  // ../workspace-tools/src/base/typescript-library-generator.ts
3751
3418
  import { addDependenciesToPackageJson as addDependenciesToPackageJson2, addProjectConfiguration, ensurePackage, formatFiles as formatFiles2, names, offsetFromRoot, readJson, updateJson, writeJson } from "@nx/devkit";
@@ -3817,48 +3484,48 @@ var nodeVersion = "20.11.0";
3817
3484
  var pnpmVersion = "8.10.2";
3818
3485
 
3819
3486
  // ../workspace-tools/src/base/typescript-library-generator.ts
3820
- async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3821
- const options = await normalizeOptions(tree, {
3822
- ...schema
3487
+ async function typeScriptLibraryGeneratorFn(tree, options, config) {
3488
+ const normalized = await normalizeOptions(tree, {
3489
+ ...options
3823
3490
  });
3824
3491
  const tasks = [];
3825
3492
  tasks.push(await jsInitGenerator(tree, {
3826
- ...options,
3827
- tsConfigName: options.rootProject ? "tsconfig.json" : "tsconfig.base.json"
3493
+ ...normalized,
3494
+ tsConfigName: normalized.rootProject ? "tsconfig.json" : "tsconfig.base.json"
3828
3495
  }));
3829
3496
  tasks.push(addDependenciesToPackageJson2(tree, {}, {
3830
3497
  "@storm-software/workspace-tools": "latest",
3831
3498
  "@storm-software/testing-tools": "latest",
3832
- ...schema.devDependencies ?? {}
3499
+ ...options.devDependencies ?? {}
3833
3500
  }));
3834
- if (options.publishable) {
3501
+ if (normalized.publishable) {
3835
3502
  tasks.push(await setupVerdaccio(tree, {
3836
- ...options,
3503
+ ...normalized,
3837
3504
  skipFormat: true
3838
3505
  }));
3839
3506
  }
3840
3507
  const projectConfig = {
3841
- root: options.directory,
3508
+ root: normalized.directory,
3842
3509
  projectType: "library",
3843
- sourceRoot: joinPaths(options.directory ?? "", "src"),
3510
+ sourceRoot: joinPaths(normalized.directory ?? "", "src"),
3844
3511
  targets: {
3845
3512
  build: {
3846
- executor: schema.buildExecutor,
3513
+ executor: options.buildExecutor,
3847
3514
  outputs: [
3848
3515
  "{options.outputPath}"
3849
3516
  ],
3850
3517
  options: {
3851
3518
  entry: [
3852
- joinPaths(options.projectRoot, "src", "index.ts")
3519
+ joinPaths(normalized.projectRoot, "src", "index.ts")
3853
3520
  ],
3854
- outputPath: getOutputPath(options),
3855
- tsconfig: joinPaths(options.projectRoot, "tsconfig.json"),
3856
- project: joinPaths(options.projectRoot, "package.json"),
3521
+ outputPath: getOutputPath(normalized),
3522
+ tsconfig: joinPaths(normalized.projectRoot, "tsconfig.json"),
3523
+ project: joinPaths(normalized.projectRoot, "package.json"),
3857
3524
  defaultConfiguration: "production",
3858
3525
  platform: "neutral",
3859
3526
  assets: [
3860
3527
  {
3861
- input: options.projectRoot,
3528
+ input: normalized.projectRoot,
3862
3529
  glob: "*.md",
3863
3530
  output: "/"
3864
3531
  },
@@ -3882,19 +3549,19 @@ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3882
3549
  }
3883
3550
  }
3884
3551
  };
3885
- if (schema.platform) {
3886
- projectConfig.targets.build.options.platform = schema.platform === "worker" ? "node" : schema.platform;
3552
+ if (options.platform) {
3553
+ projectConfig.targets.build.options.platform = options.platform === "worker" ? "node" : options.platform;
3887
3554
  }
3888
- addProjectTag(projectConfig, ProjectTagConstants.Platform.TAG_ID, schema.platform === "node" ? ProjectTagConstants.Platform.NODE : schema.platform === "worker" ? ProjectTagConstants.Platform.WORKER : schema.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL, {
3555
+ 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, {
3889
3556
  overwrite: false
3890
3557
  });
3891
- createProjectTsConfigJson(tree, options);
3892
- addProjectConfiguration(tree, options.name, projectConfig);
3558
+ createProjectTsConfigJson(tree, normalized);
3559
+ addProjectConfiguration(tree, normalized.name, projectConfig);
3893
3560
  let repository = {
3894
3561
  type: "github",
3895
3562
  url: config?.repository || `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
3896
3563
  };
3897
- let description = schema.description || "A package developed by Storm Software used to create modern, scalable web applications.";
3564
+ let description = options.description || "A package developed by Storm Software used to create modern, scalable web applications.";
3898
3565
  if (tree.exists("package.json")) {
3899
3566
  const packageJson = readJson(tree, "package.json");
3900
3567
  if (packageJson?.repository) {
@@ -3904,18 +3571,18 @@ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3904
3571
  description = packageJson.description;
3905
3572
  }
3906
3573
  }
3907
- if (!options.importPath) {
3908
- options.importPath = options.name;
3574
+ if (!normalized.importPath) {
3575
+ normalized.importPath = normalized.name;
3909
3576
  }
3910
- const packageJsonPath = joinPaths(options.projectRoot, "package.json");
3577
+ const packageJsonPath = joinPaths(normalized.projectRoot, "package.json");
3911
3578
  if (tree.exists(packageJsonPath)) {
3912
3579
  updateJson(tree, packageJsonPath, (json) => {
3913
- if (!options.importPath) {
3914
- options.importPath = options.name;
3580
+ if (!normalized.importPath) {
3581
+ normalized.importPath = normalized.name;
3915
3582
  }
3916
- json.name = options.importPath;
3583
+ json.name = normalized.importPath;
3917
3584
  json.version = "0.0.1";
3918
- if (json.private && (options.publishable || options.rootProject)) {
3585
+ if (json.private && (normalized.publishable || normalized.rootProject)) {
3919
3586
  json.private = void 0;
3920
3587
  }
3921
3588
  return {
@@ -3924,7 +3591,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3924
3591
  description,
3925
3592
  repository: {
3926
3593
  ...repository,
3927
- directory: options.projectRoot
3594
+ directory: normalized.projectRoot
3928
3595
  },
3929
3596
  type: "module",
3930
3597
  dependencies: {
@@ -3937,37 +3604,37 @@ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3937
3604
  });
3938
3605
  } else {
3939
3606
  writeJson(tree, packageJsonPath, {
3940
- name: options.importPath,
3607
+ name: normalized.importPath,
3941
3608
  version: "0.0.1",
3942
3609
  description,
3943
3610
  repository: {
3944
3611
  ...repository,
3945
- directory: options.projectRoot
3612
+ directory: normalized.projectRoot
3946
3613
  },
3947
- private: !options.publishable || options.rootProject,
3614
+ private: !normalized.publishable || normalized.rootProject,
3948
3615
  type: "module",
3949
3616
  publishConfig: {
3950
3617
  access: "public"
3951
3618
  }
3952
3619
  });
3953
3620
  }
3954
- if (tree.exists("package.json") && options.importPath) {
3621
+ if (tree.exists("package.json") && normalized.importPath) {
3955
3622
  updateJson(tree, "package.json", (json) => ({
3956
3623
  ...json,
3957
3624
  pnpm: {
3958
3625
  ...json?.pnpm,
3959
3626
  overrides: {
3960
3627
  ...json?.pnpm?.overrides,
3961
- [options.importPath ?? ""]: "workspace:*"
3628
+ [normalized.importPath ?? ""]: "workspace:*"
3962
3629
  }
3963
3630
  }
3964
3631
  }));
3965
3632
  }
3966
- addTsConfigPath(tree, options.importPath, [
3967
- joinPaths(options.projectRoot, "./src", `index.${options.js ? "js" : "ts"}`)
3633
+ addTsConfigPath(tree, normalized.importPath, [
3634
+ joinPaths(normalized.projectRoot, "./src", `index.${normalized.js ? "js" : "ts"}`)
3968
3635
  ]);
3969
- addTsConfigPath(tree, joinPaths(options.importPath, "/*"), [
3970
- joinPaths(options.projectRoot, "./src", "/*")
3636
+ addTsConfigPath(tree, joinPaths(normalized.importPath, "/*"), [
3637
+ joinPaths(normalized.projectRoot, "./src", "/*")
3971
3638
  ]);
3972
3639
  if (tree.exists("package.json")) {
3973
3640
  const packageJson = readJson(tree, "package.json");
@@ -3978,7 +3645,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3978
3645
  description = packageJson.description;
3979
3646
  }
3980
3647
  }
3981
- const tsconfigPath = joinPaths(options.projectRoot, "tsconfig.json");
3648
+ const tsconfigPath = joinPaths(normalized.projectRoot, "tsconfig.json");
3982
3649
  if (tree.exists(tsconfigPath)) {
3983
3650
  updateJson(tree, tsconfigPath, (json) => {
3984
3651
  json.composite ??= true;
@@ -3986,10 +3653,10 @@ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
3986
3653
  });
3987
3654
  } else {
3988
3655
  writeJson(tree, tsconfigPath, {
3989
- extends: `${offsetFromRoot(options.projectRoot)}tsconfig.base.json`,
3656
+ extends: `${offsetFromRoot(normalized.projectRoot)}tsconfig.base.json`,
3990
3657
  composite: true,
3991
3658
  compilerOptions: {
3992
- outDir: `${offsetFromRoot(options.projectRoot)}dist/out-tsc`
3659
+ outDir: `${offsetFromRoot(normalized.projectRoot)}dist/out-tsc`
3993
3660
  },
3994
3661
  files: [],
3995
3662
  include: [
@@ -4048,9 +3715,13 @@ function createProjectTsConfigJson(tree, options) {
4048
3715
  writeJson(tree, joinPaths(options.projectRoot, "tsconfig.json"), tsconfig);
4049
3716
  }
4050
3717
  __name(createProjectTsConfigJson, "createProjectTsConfigJson");
4051
- async function normalizeOptions(tree, options) {
3718
+ async function normalizeOptions(tree, options, config) {
3719
+ let importPath = options.importPath;
3720
+ if (!importPath && config?.namespace) {
3721
+ importPath = `@${config?.namespace}/${options.name}`;
3722
+ }
4052
3723
  if (options.publishable) {
4053
- if (!options.importPath) {
3724
+ if (!importPath) {
4054
3725
  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)`);
4055
3726
  }
4056
3727
  }
@@ -4059,14 +3730,14 @@ async function normalizeOptions(tree, options) {
4059
3730
  bundler = "none";
4060
3731
  }
4061
3732
  const { Linter } = ensurePackage("@nx/eslint", nxVersion);
4062
- const { projectName, names: projectNames, projectRoot, importPath } = await determineProjectNameAndRootOptions(tree, {
3733
+ const rootProject = false;
3734
+ const { projectName, names: projectNames, projectRoot, importPath: normalizedImportPath } = await determineProjectNameAndRootOptions(tree, {
4063
3735
  name: options.name,
4064
3736
  projectType: "library",
4065
3737
  directory: options.directory,
4066
- importPath: options.importPath,
4067
- rootProject: options.rootProject
3738
+ importPath,
3739
+ rootProject
4068
3740
  });
4069
- options.rootProject = projectRoot === ".";
4070
3741
  const normalized = names(projectNames.projectFileName);
4071
3742
  const fileName = normalized.fileName;
4072
3743
  return {
@@ -4092,14 +3763,15 @@ async function normalizeOptions(tree, options) {
4092
3763
  projectNames,
4093
3764
  projectRoot,
4094
3765
  parsedTags: options.tags ? options.tags.split(",").map((s) => s.trim()) : [],
4095
- importPath
3766
+ importPath: normalizedImportPath,
3767
+ rootProject
4096
3768
  };
4097
3769
  }
4098
3770
  __name(normalizeOptions, "normalizeOptions");
4099
3771
 
4100
3772
  // ../workspace-tools/src/generators/browser-library/generator.ts
4101
3773
  async function browserLibraryGeneratorFn(tree, schema, config) {
4102
- const filesDir = joinPathFragments6(__dirname, "./files");
3774
+ const filesDir = joinPaths(__dirname, "src", "generators", "browser-library", "files");
4103
3775
  const tsLibraryGeneratorOptions = {
4104
3776
  buildExecutor: "@storm-software/workspace-tools:unbuild",
4105
3777
  platform: "browser",
@@ -4199,9 +3871,9 @@ var generator_default2 = withRunGenerator("Configuration Schema Creator", config
4199
3871
  });
4200
3872
 
4201
3873
  // ../workspace-tools/src/generators/neutral-library/generator.ts
4202
- import { formatFiles as formatFiles5, generateFiles as generateFiles2, joinPathFragments as joinPathFragments7, names as names3, offsetFromRoot as offsetFromRoot3 } from "@nx/devkit";
3874
+ import { formatFiles as formatFiles5, generateFiles as generateFiles2, names as names3, offsetFromRoot as offsetFromRoot3 } from "@nx/devkit";
4203
3875
  async function neutralLibraryGeneratorFn(tree, schema, config) {
4204
- const filesDir = joinPathFragments7(__dirname, "./files");
3876
+ const filesDir = joinPaths(__dirname, "src", "generators", "neutral-library", "files");
4205
3877
  const tsLibraryGeneratorOptions = {
4206
3878
  ...schema,
4207
3879
  platform: "neutral",
@@ -4242,9 +3914,9 @@ var generator_default3 = withRunGenerator("TypeScript Library Creator (Neutral P
4242
3914
  });
4243
3915
 
4244
3916
  // ../workspace-tools/src/generators/node-library/generator.ts
4245
- import { formatFiles as formatFiles6, generateFiles as generateFiles3, joinPathFragments as joinPathFragments8, names as names4, offsetFromRoot as offsetFromRoot4 } from "@nx/devkit";
3917
+ import { formatFiles as formatFiles6, generateFiles as generateFiles3, names as names4, offsetFromRoot as offsetFromRoot4 } from "@nx/devkit";
4246
3918
  async function nodeLibraryGeneratorFn(tree, schema, config) {
4247
- const filesDir = joinPathFragments8(__dirname, "./files");
3919
+ const filesDir = joinPaths(__dirname, "src", "generators", "node-library", "files");
4248
3920
  const tsLibraryGeneratorOptions = {
4249
3921
  platform: "node",
4250
3922
  devDependencies: {
@@ -4289,7 +3961,7 @@ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Pl
4289
3961
  });
4290
3962
 
4291
3963
  // ../workspace-tools/src/generators/preset/generator.ts
4292
- import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments9, updateJson as updateJson2 } from "@nx/devkit";
3964
+ import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments4, updateJson as updateJson2 } from "@nx/devkit";
4293
3965
  import * as path6 from "node:path";
4294
3966
  async function presetGeneratorFn(tree, options) {
4295
3967
  const projectRoot = ".";
@@ -4507,14 +4179,14 @@ async function presetGeneratorFn(tree, options) {
4507
4179
  "nx-cloud": "latest"
4508
4180
  };
4509
4181
  }
4510
- await Promise.resolve(addDependenciesToPackageJson3(tree, dependencies, {}, joinPathFragments9(projectRoot, "package.json")));
4182
+ await Promise.resolve(addDependenciesToPackageJson3(tree, dependencies, {}, joinPathFragments4(projectRoot, "package.json")));
4511
4183
  return null;
4512
4184
  }
4513
4185
  __name(presetGeneratorFn, "presetGeneratorFn");
4514
4186
  var generator_default5 = withRunGenerator("Storm Workspace Preset Generator", presetGeneratorFn);
4515
4187
 
4516
4188
  // ../workspace-tools/src/generators/release-version/generator.ts
4517
- import { formatFiles as formatFiles8, joinPathFragments as joinPathFragments10, output, readJson as readJson2, updateJson as updateJson3, writeJson as writeJson3 } from "@nx/devkit";
4189
+ import { formatFiles as formatFiles8, joinPathFragments as joinPathFragments5, output, readJson as readJson2, updateJson as updateJson3, writeJson as writeJson3 } from "@nx/devkit";
4518
4190
  import { resolveLocalPackageDependencies as resolveLocalPackageJsonDependencies } from "@nx/js/src/generators/release-version/utils/resolve-local-package-dependencies";
4519
4191
  import { updateLockFile } from "@nx/js/src/generators/release-version/utils/update-lock-file";
4520
4192
 
@@ -4531,7 +4203,7 @@ import ChangelogRenderer from "nx/release/changelog-renderer/index";
4531
4203
 
4532
4204
  // ../workspace-tools/src/generators/release-version/generator.ts
4533
4205
  import { exec as exec2, execSync as execSync5 } from "node:child_process";
4534
- import { relative as relative5 } from "node:path";
4206
+ import { relative as relative3 } from "node:path";
4535
4207
  import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
4536
4208
  import { getFirstGitCommit, getLatestGitTagForPattern } from "nx/src/command-line/release/utils/git";
4537
4209
  import { resolveSemverSpecifierFromConventionalCommits, resolveSemverSpecifierFromPrompt } from "nx/src/command-line/release/utils/resolve-semver-specifier";
@@ -4703,32 +4375,28 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
4703
4375
  title: "Bundle",
4704
4376
  type: "boolean",
4705
4377
  description: "Bundle the output"
4706
- },
4707
- $default: false
4378
+ }
4708
4379
  },
4709
4380
  minify: {
4710
4381
  $schema: {
4711
4382
  title: "Minify",
4712
4383
  type: "boolean",
4713
4384
  description: "Minify the output"
4714
- },
4715
- $default: false
4385
+ }
4716
4386
  },
4717
4387
  debug: {
4718
4388
  $schema: {
4719
4389
  title: "Debug",
4720
4390
  type: "boolean",
4721
4391
  description: "Debug the output"
4722
- },
4723
- $default: false
4392
+ }
4724
4393
  },
4725
4394
  sourcemap: {
4726
4395
  $schema: {
4727
4396
  title: "Sourcemap",
4728
4397
  type: "boolean",
4729
4398
  description: "Generate a sourcemap"
4730
- },
4731
- $default: false
4399
+ }
4732
4400
  },
4733
4401
  silent: {
4734
4402
  $schema: {
@@ -4878,37 +4546,17 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4878
4546
  enum: [
4879
4547
  "neutral",
4880
4548
  "node",
4549
+ "worker",
4881
4550
  "browser"
4882
4551
  ]
4883
4552
  },
4884
4553
  $default: "neutral"
4885
4554
  },
4886
- devDependencies: {
4887
- $schema: {
4888
- title: "Dev Dependencies",
4889
- type: "object",
4890
- description: "The dev dependencies to install"
4891
- }
4892
- },
4893
- dependencies: {
4894
- $schema: {
4895
- title: "Dependencies",
4896
- type: "object",
4897
- description: "The dependencies to install"
4898
- }
4899
- },
4900
- peerDependencies: {
4901
- $schema: {
4902
- title: "Peer Dependencies",
4903
- type: "object",
4904
- description: "The peer dependencies to install"
4905
- }
4906
- },
4907
- peerDependenciesMeta: {
4555
+ importPath: {
4908
4556
  $schema: {
4909
- title: "Peer Dependencies Meta",
4910
- type: "object",
4911
- description: "The peer dependencies meta"
4557
+ title: "Import Path",
4558
+ type: "string",
4559
+ description: "The import path for the library"
4912
4560
  }
4913
4561
  },
4914
4562
  tags: {
@@ -4918,41 +4566,6 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4918
4566
  description: "The tags for the library"
4919
4567
  }
4920
4568
  },
4921
- tsconfigOptions: {
4922
- $schema: {
4923
- title: "TypeScript Config (tsconfig.json) Options",
4924
- type: "object",
4925
- description: "The TypeScript configuration options"
4926
- }
4927
- },
4928
- skipFormat: {
4929
- $schema: {
4930
- title: "Skip Format",
4931
- type: "boolean",
4932
- description: "Skip formatting"
4933
- }
4934
- },
4935
- skipTsConfig: {
4936
- $schema: {
4937
- title: "Skip TsConfig",
4938
- type: "boolean",
4939
- description: "Skip TypeScript configuration"
4940
- }
4941
- },
4942
- skipPackageJson: {
4943
- $schema: {
4944
- title: "Skip Package Json",
4945
- type: "boolean",
4946
- description: "Skip package.json"
4947
- }
4948
- },
4949
- includeBabelRc: {
4950
- $schema: {
4951
- title: "Include Babel Rc",
4952
- type: "boolean",
4953
- description: "Include Babel configuration"
4954
- }
4955
- },
4956
4569
  unitTestRunner: {
4957
4570
  $schema: {
4958
4571
  title: "Unit Test Runner",
@@ -4965,13 +4578,6 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4965
4578
  description: "The unit test runner to use"
4966
4579
  }
4967
4580
  },
4968
- linter: {
4969
- $schema: {
4970
- title: "Linter",
4971
- type: "string",
4972
- description: "The linter to use"
4973
- }
4974
- },
4975
4581
  testEnvironment: {
4976
4582
  $schema: {
4977
4583
  title: "Test Environment",
@@ -4983,136 +4589,37 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4983
4589
  description: "The test environment to use"
4984
4590
  }
4985
4591
  },
4986
- importPath: {
4987
- $schema: {
4988
- title: "Import Path",
4989
- type: "string",
4990
- description: "The import path for the library"
4991
- }
4992
- },
4993
- js: {
4994
- $schema: {
4995
- title: "JavaScript",
4996
- type: "boolean",
4997
- description: "Use JavaScript instead of TypeScript"
4998
- }
4999
- },
5000
4592
  pascalCaseFiles: {
5001
4593
  $schema: {
5002
4594
  title: "Pascal Case Files",
5003
4595
  type: "boolean",
5004
4596
  description: "Use PascalCase for file names"
5005
- }
4597
+ },
4598
+ $default: false
5006
4599
  },
5007
4600
  strict: {
5008
4601
  $schema: {
5009
4602
  title: "Strict",
5010
4603
  type: "boolean",
5011
4604
  description: "Enable strict mode"
5012
- }
4605
+ },
4606
+ $default: true
5013
4607
  },
5014
4608
  publishable: {
5015
4609
  $schema: {
5016
4610
  title: "Publishable",
5017
4611
  type: "boolean",
5018
4612
  description: "Make the library publishable"
5019
- }
4613
+ },
4614
+ $default: false
5020
4615
  },
5021
4616
  buildable: {
5022
4617
  $schema: {
5023
4618
  title: "Buildable",
5024
4619
  type: "boolean",
5025
4620
  description: "Make the library buildable"
5026
- }
5027
- },
5028
- setParserOptionsProject: {
5029
- $schema: {
5030
- title: "Set Parser Options Project",
5031
- type: "boolean",
5032
- description: "Set parser options project"
5033
- }
5034
- },
5035
- config: {
5036
- $schema: {
5037
- title: "Config",
5038
- type: "string",
5039
- enum: [
5040
- "workspace",
5041
- "project",
5042
- "npm-scripts"
5043
- ],
5044
- description: "The configuration type"
5045
- }
5046
- },
5047
- compiler: {
5048
- $schema: {
5049
- title: "Compiler",
5050
- type: "string",
5051
- description: "The compiler to use"
5052
- }
5053
- },
5054
- bundler: {
5055
- $schema: {
5056
- title: "Bundler",
5057
- type: "string",
5058
- description: "The bundler to use"
5059
- }
5060
- },
5061
- skipTypeCheck: {
5062
- $schema: {
5063
- title: "Skip Type Check",
5064
- type: "boolean",
5065
- description: "Skip type checking"
5066
- }
5067
- },
5068
- minimal: {
5069
- $schema: {
5070
- title: "Minimal",
5071
- type: "boolean",
5072
- description: "Create a minimal library"
5073
- }
5074
- },
5075
- rootProject: {
5076
- $schema: {
5077
- title: "Root Project",
5078
- type: "boolean",
5079
- description: "Create a root project"
5080
- }
5081
- },
5082
- simpleName: {
5083
- $schema: {
5084
- title: "Simple Name",
5085
- type: "boolean",
5086
- description: "Use a simple name for the library"
5087
- }
5088
- },
5089
- addPlugin: {
5090
- $schema: {
5091
- title: "Add Plugin",
5092
- type: "boolean",
5093
- description: "Add a plugin to the library"
5094
- }
5095
- },
5096
- useProjectJson: {
5097
- $schema: {
5098
- title: "Use Project Json",
5099
- type: "boolean",
5100
- description: "Use project.json"
5101
- }
5102
- },
5103
- skipWorkspacesWarning: {
5104
- $schema: {
5105
- title: "Skip Workspaces Warning",
5106
- type: "boolean",
5107
- description: "Skip workspaces warning"
5108
- }
5109
- },
5110
- useTscExecutor: {
5111
- $schema: {
5112
- title: "Use Tsc Executor",
5113
- type: "boolean",
5114
- description: "Use TSC executor"
5115
- }
4621
+ },
4622
+ $default: true
5116
4623
  }
5117
4624
  });
5118
4625
 
@@ -5123,9 +4630,9 @@ import { names as names5 } from "@nx/devkit";
5123
4630
  import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/project-graph/utils/retrieve-workspace-files";
5124
4631
 
5125
4632
  // ../workspace-tools/src/utils/lock-file.ts
5126
- import { existsSync as existsSync7 } from "node:fs";
4633
+ import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "@nx/devkit";
4634
+ import { existsSync as existsSync9 } from "node:fs";
5127
4635
  import { join as join4 } from "node:path";
5128
- import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "nx/src/devkit-exports";
5129
4636
  import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";
5130
4637
  import { getPnpmLockfileDependencies, getPnpmLockfileNodes } from "nx/src/plugins/js/lock-file/pnpm-parser";
5131
4638
  import { getYarnLockfileDependencies, getYarnLockfileNodes } from "nx/src/plugins/js/lock-file/yarn-parser";
@@ -5137,8 +4644,14 @@ var NPM_LOCK_PATH = join4(workspaceRoot2, NPM_LOCK_FILE);
5137
4644
  var PNPM_LOCK_PATH = join4(workspaceRoot2, PNPM_LOCK_FILE);
5138
4645
 
5139
4646
  // ../workspace-tools/src/utils/package-helpers.ts
5140
- import { joinPathFragments as joinPathFragments11, readJsonFile as readJsonFile2 } from "@nx/devkit";
5141
- import { existsSync as existsSync8 } from "node:fs";
4647
+ import { joinPathFragments as joinPathFragments6, readJsonFile as readJsonFile2 } from "@nx/devkit";
4648
+ import { existsSync as existsSync10 } from "node:fs";
4649
+
4650
+ // ../workspace-tools/src/utils/plugin-helpers.ts
4651
+ import { readJsonFile as readJsonFile3 } from "@nx/devkit";
4652
+ import defu7 from "defu";
4653
+ import { existsSync as existsSync11 } from "node:fs";
4654
+ import { dirname as dirname2, join as join5 } from "node:path";
5142
4655
 
5143
4656
  // ../workspace-tools/src/utils/typia-transform.ts
5144
4657
  import transform2 from "typia/lib/transform";