@storm-software/cloudflare-tools 0.55.63 → 0.55.65

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 (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-MLJ3OSJX.js → chunk-2YQVZSHO.js} +16 -16
  4. package/dist/{chunk-HBBHWDJS.mjs → chunk-4KLMKQMN.mjs} +11 -3
  5. package/dist/{chunk-KSTLYSXJ.mjs → chunk-65QGIJV4.mjs} +198 -1075
  6. package/dist/{chunk-VQLLSEHB.mjs → chunk-6YO5XRT2.mjs} +1 -1
  7. package/dist/{chunk-HA6XAX4C.mjs → chunk-7TRJIJ2N.mjs} +4 -4
  8. package/dist/{chunk-NRIZ2TF7.js → chunk-DWDJDH7W.js} +1 -1
  9. package/dist/{chunk-XFPT4O23.js → chunk-IVLCYFXD.js} +50 -42
  10. package/dist/{chunk-3O6RTR7W.mjs → chunk-NGKRYZY2.mjs} +2 -2
  11. package/dist/{chunk-UCUXAMZ3.js → chunk-NNDGLEEI.js} +12 -12
  12. package/dist/{chunk-RGBGVGWZ.mjs → chunk-PFHP5EL7.mjs} +2 -2
  13. package/dist/{chunk-UBEHQVYS.js → chunk-QGRENI3O.js} +3 -3
  14. package/dist/{chunk-ITJMNVMG.mjs → chunk-U2DL5OU3.mjs} +2 -2
  15. package/dist/{chunk-SSSAGTTW.mjs → chunk-U5WWE2HS.mjs} +1 -6
  16. package/dist/{chunk-IKNX7KR7.js → chunk-UQLMM4XV.js} +280 -1157
  17. package/dist/{chunk-TEEOPHLZ.js → chunk-V7LBWOVV.js} +1 -6
  18. package/dist/{chunk-CI3G746G.mjs → chunk-XPLMFM2J.mjs} +1 -1
  19. package/dist/{chunk-C3CWFFYT.mjs → chunk-YV555N5S.mjs} +5 -5
  20. package/dist/executors.js +5 -5
  21. package/dist/executors.mjs +8 -8
  22. package/dist/generators.js +5 -5
  23. package/dist/generators.mjs +5 -5
  24. package/dist/index.js +8 -8
  25. package/dist/index.mjs +10 -10
  26. package/dist/src/executors/cloudflare-publish/executor.js +3 -3
  27. package/dist/src/executors/cloudflare-publish/executor.mjs +6 -6
  28. package/dist/src/executors/r2-upload-publish/executor.js +5 -5
  29. package/dist/src/executors/r2-upload-publish/executor.mjs +6 -6
  30. package/dist/src/executors/serve/executor.js +4 -4
  31. package/dist/src/executors/serve/executor.mjs +5 -5
  32. package/dist/src/generators/init/generator.js +2 -2
  33. package/dist/src/generators/init/generator.mjs +2 -2
  34. package/dist/src/generators/worker/generator.js +5 -5
  35. package/dist/src/generators/worker/generator.mjs +5 -5
  36. package/dist/src/utils/index.js +3 -3
  37. package/dist/src/utils/index.mjs +3 -3
  38. package/dist/src/utils/r2-bucket-helpers.js +3 -3
  39. package/dist/src/utils/r2-bucket-helpers.mjs +3 -3
  40. package/dist/tsup.config.mjs +1 -1
  41. package/package.json +13 -39
@@ -1,16 +1,15 @@
1
1
  import {
2
2
  ProjectTagConstants,
3
3
  addProjectTag
4
- } from "./chunk-CI3G746G.mjs";
4
+ } from "./chunk-XPLMFM2J.mjs";
5
5
  import {
6
- getConfig
7
- } from "./chunk-HBBHWDJS.mjs";
6
+ getConfig,
7
+ getWorkspaceConfig
8
+ } from "./chunk-4KLMKQMN.mjs";
8
9
  import {
9
- correctPaths,
10
10
  findWorkspaceRoot,
11
11
  formatLogMessage,
12
12
  getStopwatch,
13
- isVerbose,
14
13
  joinPaths,
15
14
  stormWorkspaceConfigSchema,
16
15
  writeDebug,
@@ -20,12 +19,12 @@ import {
20
19
  writeSuccess,
21
20
  writeTrace,
22
21
  writeWarning
23
- } from "./chunk-SSSAGTTW.mjs";
22
+ } from "./chunk-U5WWE2HS.mjs";
24
23
  import {
25
24
  __dirname,
26
25
  __name,
27
26
  __require
28
- } from "./chunk-VQLLSEHB.mjs";
27
+ } from "./chunk-6YO5XRT2.mjs";
29
28
 
30
29
  // ../config-tools/src/utilities/apply-workspace-tokens.ts
31
30
  var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams) => {
@@ -80,39 +79,20 @@ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, tokenParams, t
80
79
  return result;
81
80
  }, "applyWorkspaceTokens");
82
81
 
83
- // ../config-tools/src/utilities/run.ts
84
- import { exec, execSync } from "node:child_process";
85
- var LARGE_BUFFER = 1024 * 1e6;
86
- var run = /* @__PURE__ */ __name((config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
87
- return execSync(command, {
88
- cwd,
89
- env: {
90
- ...process.env,
91
- ...env,
92
- CLICOLOR: "true",
93
- FORCE_COLOR: "true"
94
- },
95
- windowsHide: true,
96
- stdio,
97
- maxBuffer: LARGE_BUFFER,
98
- killSignal: "SIGTERM"
99
- });
100
- }, "run");
101
-
102
82
  // ../workspace-tools/src/base/base-executor.ts
103
83
  import { defu } from "defu";
104
- var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context2) => {
84
+ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context) => {
105
85
  const stopwatch = getStopwatch(name);
106
86
  let options = _options;
107
87
  let config = {};
108
88
  try {
109
- if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
89
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
110
90
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
111
91
  }
112
92
  const workspaceRoot3 = findWorkspaceRoot();
113
- const projectRoot = context2.projectsConfigurations.projects[context2.projectName].root || workspaceRoot3;
114
- const sourceRoot = context2.projectsConfigurations.projects[context2.projectName].sourceRoot || projectRoot || workspaceRoot3;
115
- const projectName = context2.projectName;
93
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot3;
94
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot3;
95
+ const projectName = context.projectName;
116
96
  config.workspaceRoot = workspaceRoot3;
117
97
  writeInfo(`\u26A1 Running the ${name} executor for ${projectName} `, config);
118
98
  if (!executorOptions.skipReadingConfig) {
@@ -138,7 +118,7 @@ ${formatLogMessage(options)}
138
118
  sourceRoot,
139
119
  projectName,
140
120
  config
141
- }, config, context2.projectsConfigurations.projects[context2.projectName]), applyWorkspaceProjectTokens);
121
+ }, config, context.projectsConfigurations.projects[context.projectName]), applyWorkspaceProjectTokens);
142
122
  writeTrace(`Executor schema tokenized options \u2699\uFE0F
143
123
  ${formatLogMessage(tokenized)}
144
124
  `, config);
@@ -147,7 +127,7 @@ ${formatLogMessage(tokenized)}
147
127
  await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
148
128
  writeDebug("Completed the preProcess hook", config);
149
129
  }
150
- const ret = executorFn(tokenized, context2, config);
130
+ const ret = executorFn(tokenized, context, config);
151
131
  if (_isFunction(ret?.next)) {
152
132
  const asyncGen = ret;
153
133
  for await (const iter of asyncGen) {
@@ -195,7 +175,7 @@ var _isFunction = /* @__PURE__ */ __name((value) => {
195
175
 
196
176
  // ../workspace-tools/src/utils/cargo.ts
197
177
  import { joinPathFragments, workspaceRoot } from "@nx/devkit";
198
- import { execSync as execSync2, spawn } from "node:child_process";
178
+ import { execSync, spawn } from "node:child_process";
199
179
  import { relative } from "node:path";
200
180
  var INVALID_CARGO_ARGS = [
201
181
  "allFeatures",
@@ -205,7 +185,7 @@ var INVALID_CARGO_ARGS = [
205
185
  "package",
206
186
  "tsConfig"
207
187
  ];
208
- var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context2) => {
188
+ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context) => {
209
189
  const args = [];
210
190
  if (options.toolchain && options.toolchain !== "stable") {
211
191
  args.push(`+${options.toolchain}`);
@@ -227,8 +207,8 @@ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context2)
227
207
  args.push(`--${key}`, String(value));
228
208
  }
229
209
  }
230
- if (context2.projectName) {
231
- args.push("-p", context2.projectName);
210
+ if (context.projectName) {
211
+ args.push("-p", context.projectName);
232
212
  }
233
213
  if (options.allFeatures && !args.includes("--all-features")) {
234
214
  args.push("--all-features");
@@ -260,7 +240,7 @@ function cargoCommandSync(args = "", options) {
260
240
  };
261
241
  try {
262
242
  return {
263
- output: execSync2(`cargo ${args}`, {
243
+ output: execSync(`cargo ${args}`, {
264
244
  encoding: "utf8",
265
245
  windowsHide: true,
266
246
  stdio: normalizedOptions.stdio,
@@ -297,7 +277,7 @@ function runProcess(processCmd, ...args) {
297
277
  success: true
298
278
  });
299
279
  }
300
- execSync2(`${processCmd} ${args.join(" ")}`, {
280
+ execSync(`${processCmd} ${args.join(" ")}`, {
301
281
  cwd: process.cwd(),
302
282
  env: {
303
283
  ...process.env,
@@ -320,8 +300,8 @@ function runProcess(processCmd, ...args) {
320
300
  __name(runProcess, "runProcess");
321
301
 
322
302
  // ../workspace-tools/src/executors/cargo-build/executor.ts
323
- async function cargoBuildExecutor(options, context2) {
324
- const command = buildCargoCommand("build", options, context2);
303
+ async function cargoBuildExecutor(options, context) {
304
+ const command = buildCargoCommand("build", options, context);
325
305
  return await cargoCommand(...command);
326
306
  }
327
307
  __name(cargoBuildExecutor, "cargoBuildExecutor");
@@ -337,8 +317,8 @@ var executor_default = withRunExecutor("Cargo Build", cargoBuildExecutor, {
337
317
  });
338
318
 
339
319
  // ../workspace-tools/src/executors/cargo-check/executor.ts
340
- async function cargoCheckExecutor(options, context2) {
341
- const command = buildCargoCommand("check", options, context2);
320
+ async function cargoCheckExecutor(options, context) {
321
+ const command = buildCargoCommand("check", options, context);
342
322
  return await cargoCommand(...command);
343
323
  }
344
324
  __name(cargoCheckExecutor, "cargoCheckExecutor");
@@ -353,8 +333,8 @@ var executor_default2 = withRunExecutor("Cargo Check", cargoCheckExecutor, {
353
333
  });
354
334
 
355
335
  // ../workspace-tools/src/executors/cargo-clippy/executor.ts
356
- async function cargoClippyExecutor(options, context2) {
357
- const command = buildCargoCommand("clippy", options, context2);
336
+ async function cargoClippyExecutor(options, context) {
337
+ const command = buildCargoCommand("clippy", options, context);
358
338
  return await cargoCommand(...command);
359
339
  }
360
340
  __name(cargoClippyExecutor, "cargoClippyExecutor");
@@ -370,13 +350,13 @@ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
370
350
  });
371
351
 
372
352
  // ../workspace-tools/src/executors/cargo-doc/executor.ts
373
- async function cargoDocExecutor(options, context2) {
353
+ async function cargoDocExecutor(options, context) {
374
354
  const opts = {
375
355
  ...options
376
356
  };
377
357
  opts["no-deps"] = opts.noDeps;
378
358
  delete opts.noDeps;
379
- const command = buildCargoCommand("doc", options, context2);
359
+ const command = buildCargoCommand("doc", options, context);
380
360
  return await cargoCommand(...command);
381
361
  }
382
362
  __name(cargoDocExecutor, "cargoDocExecutor");
@@ -398,8 +378,8 @@ var executor_default4 = withRunExecutor("Cargo Doc", cargoDocExecutor, {
398
378
  });
399
379
 
400
380
  // ../workspace-tools/src/executors/cargo-format/executor.ts
401
- async function cargoFormatExecutor(options, context2) {
402
- const command = buildCargoCommand("fmt", options, context2);
381
+ async function cargoFormatExecutor(options, context) {
382
+ const command = buildCargoCommand("fmt", options, context);
403
383
  return await cargoCommand(...command);
404
384
  }
405
385
  __name(cargoFormatExecutor, "cargoFormatExecutor");
@@ -416,10 +396,10 @@ var executor_default5 = withRunExecutor("Cargo Format", cargoFormatExecutor, {
416
396
 
417
397
  // ../workspace-tools/src/executors/cargo-publish/executor.ts
418
398
  import { joinPathFragments as joinPathFragments2 } from "@nx/devkit";
419
- import { execSync as execSync3 } from "node:child_process";
399
+ import { execSync as execSync2 } from "node:child_process";
420
400
  import { readFileSync } from "node:fs";
421
401
  import https from "node:https";
422
- var LARGE_BUFFER2 = 1024 * 1e6;
402
+ var LARGE_BUFFER = 1024 * 1e6;
423
403
 
424
404
  // ../esbuild/src/build.ts
425
405
  import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
@@ -556,7 +536,7 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
556
536
  }, packageJson.dependencies ?? {});
557
537
  packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
558
538
  if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
559
- ret[localPackage.name] = localPackage.version || "0.0.1";
539
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
560
540
  }
561
541
  return ret;
562
542
  }, packageJson.devDependencies ?? {});
@@ -565,8 +545,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
565
545
  }
566
546
  return packageJson;
567
547
  }, "addPackageDependencies");
568
- var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
569
- const workspaceRoot3 = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
548
+ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
549
+ const workspaceRoot3 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
570
550
  const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot3, "package.json"), "utf8");
571
551
  const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
572
552
  packageJson.type ??= "module";
@@ -637,159 +617,18 @@ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-r
637
617
 
638
618
  // ../esbuild/src/build.ts
639
619
  import { watch as createWatcher } from "chokidar";
640
- import defu3 from "defu";
641
- import { debounce, flatten } from "es-toolkit";
642
- import { map } from "es-toolkit/compat";
643
- import * as esbuild2 from "esbuild";
620
+ import defu2 from "defu";
621
+ import { debounce } from "es-toolkit";
622
+ import * as esbuild from "esbuild";
644
623
  import { globbySync } from "globby";
645
- import { existsSync as existsSync5 } from "node:fs";
624
+ import { existsSync as existsSync3 } from "node:fs";
646
625
  import hf from "node:fs/promises";
647
626
  import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
648
-
649
- // ../esbuild/src/base/renderer-engine.ts
650
- import path3 from "node:path";
651
- import { SourceMapConsumer, SourceMapGenerator } from "source-map";
652
-
653
- // ../esbuild/src/utilities/output-file.ts
654
- import fs2 from "node:fs";
655
- import path2 from "node:path";
656
- var outputFile = /* @__PURE__ */ __name(async (filepath, data, options) => {
657
- await fs2.promises.mkdir(path2.dirname(filepath), {
658
- recursive: true
659
- });
660
- await fs2.promises.writeFile(filepath, data, options);
661
- }, "outputFile");
662
-
663
- // ../esbuild/src/base/renderer-engine.ts
664
- var parseSourceMap = /* @__PURE__ */ __name((map2) => {
665
- return typeof map2 === "string" ? JSON.parse(map2) : map2;
666
- }, "parseSourceMap");
667
- var isJS = /* @__PURE__ */ __name((path7) => /\.(js|mjs|cjs)$/.test(path7), "isJS");
668
- var isCSS = /* @__PURE__ */ __name((path7) => /\.css$/.test(path7), "isCSS");
669
- var getSourcemapComment = /* @__PURE__ */ __name((inline, map2, filepath, isCssFile) => {
670
- if (!map2) return "";
671
- const prefix = isCssFile ? "/*" : "//";
672
- const suffix = isCssFile ? " */" : "";
673
- const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${path3.basename(filepath)}.map`;
674
- return `${prefix}# sourceMappingURL=${url}${suffix}`;
675
- }, "getSourcemapComment");
676
- var RendererEngine = class {
677
- static {
678
- __name(this, "RendererEngine");
679
- }
680
- #renderers;
681
- #options;
682
- constructor(renderers) {
683
- this.#renderers = renderers;
684
- }
685
- setOptions(options) {
686
- this.#options = options;
687
- }
688
- getOptions() {
689
- if (!this.#options) {
690
- throw new Error(`Renderer options is not set`);
691
- }
692
- return this.#options;
693
- }
694
- modifyEsbuildOptions(options) {
695
- for (const renderer of this.#renderers) {
696
- if (renderer.esbuildOptions) {
697
- renderer.esbuildOptions.call(this.getOptions(), options);
698
- }
699
- }
700
- }
701
- async buildStarted() {
702
- for (const renderer of this.#renderers) {
703
- if (renderer.buildStart) {
704
- await renderer.buildStart.call(this.getOptions());
705
- }
706
- }
707
- }
708
- async buildFinished({ outputFiles, metafile }) {
709
- const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
710
- if (isJS(file.path) || isCSS(file.path)) {
711
- let relativePath = path3.relative(this.getOptions().config.workspaceRoot, file.path);
712
- if (!relativePath.startsWith("\\\\?\\")) {
713
- relativePath = relativePath.replace(/\\/g, "/");
714
- }
715
- const meta = metafile?.outputs[relativePath];
716
- return {
717
- type: "chunk",
718
- path: file.path,
719
- code: file.text,
720
- map: outputFiles.find((f) => f.path === `${file.path}.map`)?.text,
721
- entryPoint: meta?.entryPoint,
722
- exports: meta?.exports,
723
- imports: meta?.imports
724
- };
725
- } else {
726
- return {
727
- type: "asset",
728
- path: file.path,
729
- contents: file.contents
730
- };
731
- }
732
- });
733
- const writtenFiles = [];
734
- await Promise.all(files.map(async (info) => {
735
- for (const renderer of this.#renderers) {
736
- if (info.type === "chunk" && renderer.renderChunk) {
737
- const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
738
- if (result) {
739
- info.code = result.code;
740
- if (result.map) {
741
- const originalConsumer = await new SourceMapConsumer(parseSourceMap(info.map));
742
- const newConsumer = await new SourceMapConsumer(parseSourceMap(result.map));
743
- const generator = SourceMapGenerator.fromSourceMap(newConsumer);
744
- generator.applySourceMap(originalConsumer, info.path);
745
- info.map = generator.toJSON();
746
- originalConsumer.destroy();
747
- newConsumer.destroy();
748
- }
749
- }
750
- }
751
- }
752
- const inlineSourceMap = this.#options.sourcemap === "inline";
753
- const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
754
- await outputFile(info.path, contents, {
755
- mode: info.type === "chunk" ? info.mode : void 0
756
- });
757
- writtenFiles.push({
758
- get name() {
759
- return path3.relative(process.cwd(), info.path);
760
- },
761
- get size() {
762
- return contents.length;
763
- }
764
- });
765
- if (info.type === "chunk" && info.map && !inlineSourceMap) {
766
- const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
767
- const outPath = `${info.path}.map`;
768
- const contents2 = JSON.stringify(map2);
769
- await outputFile(outPath, contents2);
770
- writtenFiles.push({
771
- get name() {
772
- return path3.relative(process.cwd(), outPath);
773
- },
774
- get size() {
775
- return contents2.length;
776
- }
777
- });
778
- }
779
- }));
780
- for (const renderer of this.#renderers) {
781
- if (renderer.buildEnd) {
782
- await renderer.buildEnd.call(this.getOptions(), {
783
- writtenFiles
784
- });
785
- }
786
- }
787
- }
788
- };
627
+ import { build as tsup } from "tsup";
789
628
 
790
629
  // ../esbuild/src/clean.ts
791
630
  import { rm } from "node:fs/promises";
792
- async function cleanDirectories(name = "ESBuild", directory, config) {
631
+ async function cleanDirectories(directory) {
793
632
  await rm(directory, {
794
633
  recursive: true,
795
634
  force: true
@@ -797,315 +636,24 @@ async function cleanDirectories(name = "ESBuild", directory, config) {
797
636
  }
798
637
  __name(cleanDirectories, "cleanDirectories");
799
638
 
800
- // ../esbuild/src/plugins/esm-split-code-to-cjs.ts
801
- import * as esbuild from "esbuild";
802
- var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
803
- name: "storm:esm-split-code-to-cjs",
804
- setup(build4) {
805
- build4.onEnd(async (result) => {
806
- const outFiles = Object.keys(result.metafile?.outputs ?? {});
807
- const jsFiles = outFiles.filter((f) => f.endsWith("js"));
808
- await esbuild.build({
809
- outdir: resolvedOptions.outdir,
810
- entryPoints: jsFiles,
811
- allowOverwrite: true,
812
- format: "cjs",
813
- logLevel: "error",
814
- packages: "external"
815
- });
816
- });
817
- }
818
- }), "esmSplitCodeToCjsPlugin");
819
-
820
- // ../esbuild/src/plugins/fix-imports.ts
821
- var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
822
- name: "storm:fix-imports",
823
- setup(build4) {
824
- build4.onResolve({
825
- filter: /^spdx-exceptions/
826
- }, () => {
827
- return {
828
- path: __require.resolve("spdx-exceptions")
829
- };
830
- });
831
- build4.onResolve({
832
- filter: /^spdx-license-ids/
833
- }, () => {
834
- return {
835
- path: __require.resolve("spdx-license-ids")
836
- };
837
- });
838
- }
839
- }), "fixImportsPlugin");
840
-
841
- // ../esbuild/src/plugins/native-node-module.ts
842
- import { dirname } from "node:path";
843
- var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
844
- return {
845
- name: "native-node-modules",
846
- setup(build4) {
847
- build4.onResolve({
848
- filter: /\.node$/,
849
- namespace: "file"
850
- }, (args) => {
851
- const resolvedId = __require.resolve(args.path, {
852
- paths: [
853
- args.resolveDir
854
- ]
855
- });
856
- if (resolvedId.endsWith(".node")) {
857
- return {
858
- path: resolvedId,
859
- namespace: "node-file"
860
- };
861
- }
862
- return {
863
- path: resolvedId
864
- };
865
- });
866
- build4.onLoad({
867
- filter: /.*/,
868
- namespace: "node-file"
869
- }, (args) => {
870
- return {
871
- contents: `
872
- import path from ${JSON.stringify(args.path)}
873
- try { module.exports = require(path) }
874
- catch {}
875
- `,
876
- resolveDir: dirname(args.path)
877
- };
878
- });
879
- build4.onResolve({
880
- filter: /\.node$/,
881
- namespace: "node-file"
882
- }, (args) => ({
883
- path: args.path,
884
- namespace: "file"
885
- }));
886
- const opts = build4.initialOptions;
887
- opts.loader = opts.loader || {};
888
- opts.loader[".node"] = "file";
889
- }
890
- };
891
- }, "nativeNodeModulesPlugin");
892
-
893
- // ../esbuild/src/plugins/node-protocol.ts
894
- var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
895
- const nodeProtocol = "node:";
896
- return {
897
- name: "node-protocol-plugin",
898
- setup({ onResolve }) {
899
- onResolve({
900
- filter: /^node:/
901
- }, ({ path: path7 }) => ({
902
- path: path7.slice(nodeProtocol.length),
903
- external: true
904
- }));
905
- }
906
- };
907
- }, "nodeProtocolPlugin");
908
-
909
- // ../esbuild/src/plugins/on-error.ts
910
- var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
911
- name: "storm:on-error",
912
- setup(build4) {
913
- build4.onEnd((result) => {
914
- if (result.errors.length > 0 && process.env.WATCH !== "true") {
915
- writeError(`The following errors occurred during the build:
916
- ${result.errors.map((error) => error.text).join("\n")}
917
-
918
- `, resolvedOptions.config);
919
- throw new Error("Storm esbuild process failed with errors.");
920
- }
921
- });
922
- }
923
- }), "onErrorPlugin");
924
-
925
- // ../esbuild/src/plugins/resolve-paths.ts
926
- import path4 from "node:path";
927
- function resolvePathsConfig(options, cwd) {
928
- if (options?.compilerOptions?.paths) {
929
- const paths = Object.entries(options.compilerOptions.paths);
930
- const resolvedPaths = paths.map(([key, paths2]) => {
931
- return [
932
- key,
933
- paths2.map((v) => path4.resolve(cwd, v))
934
- ];
935
- });
936
- return Object.fromEntries(resolvedPaths);
937
- }
938
- if (options.extends) {
939
- const extendsPath = path4.resolve(cwd, options.extends);
940
- const extendsDir = path4.dirname(extendsPath);
941
- const extendsConfig = __require(extendsPath);
942
- return resolvePathsConfig(extendsConfig, extendsDir);
943
- }
944
- return [];
945
- }
946
- __name(resolvePathsConfig, "resolvePathsConfig");
947
- var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
948
- name: "storm:resolve-paths",
949
- setup(build4) {
950
- const parentTsConfig = build4.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build4.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
951
- const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
952
- const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
953
- build4.onResolve({
954
- filter: packagesRegex
955
- }, (args) => {
956
- if (build4.initialOptions.external?.includes(args.path)) {
957
- return {
958
- path: args.path,
959
- external: true
960
- };
961
- }
962
- return {
963
- path: `${resolvedTsPaths[args.path][0]}/index.ts`
964
- };
965
- });
966
- }
967
- }), "resolvePathsPlugin");
968
-
969
- // ../esbuild/src/plugins/tsc.ts
970
- import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
971
- import { existsSync as existsSync3 } from "node:fs";
972
- import fs3 from "node:fs/promises";
973
- function bundleTypeDefinitions(filename, outfile, externals, options) {
974
- const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
975
- const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
976
- p,
977
- getTypeDependencyPackageName(p)
978
- ]);
979
- const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
980
- p,
981
- getTypeDependencyPackageName(p)
982
- ]);
983
- const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
984
- p,
985
- getTypeDependencyPackageName(p)
986
- ]);
987
- const includeDeps = devDependenciesKeys;
988
- const excludeDeps = /* @__PURE__ */ new Set([
989
- ...dependenciesKeys,
990
- ...peerDependenciesKeys,
991
- ...externals
992
- ]);
993
- const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
994
- const extractorConfig = ExtractorConfig.prepare({
995
- configObject: {
996
- projectFolder: options.projectRoot,
997
- mainEntryPointFilePath: filename,
998
- bundledPackages,
999
- compiler: {
1000
- tsconfigFilePath: options.tsconfig,
1001
- overrideTsconfig: {
1002
- compilerOptions: {
1003
- paths: {}
1004
- // bug with api extract + paths
1005
- }
1006
- }
1007
- },
1008
- dtsRollup: {
1009
- enabled: true,
1010
- untrimmedFilePath: joinPaths(options.outdir, `${outfile}.d.ts`)
1011
- },
1012
- tsdocMetadata: {
1013
- enabled: false
1014
- }
1015
- },
1016
- packageJsonFullPath: joinPaths(options.projectRoot, "package.json"),
1017
- configObjectFullPath: void 0
1018
- });
1019
- const extractorResult = Extractor.invoke(extractorConfig, {
1020
- showVerboseMessages: true,
1021
- localBuild: true
1022
- });
1023
- if (extractorResult.succeeded === false) {
1024
- writeError(`API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
1025
- throw new Error("API Extractor completed with errors");
1026
- }
1027
- }
1028
- __name(bundleTypeDefinitions, "bundleTypeDefinitions");
1029
- var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
1030
- name: "storm:tsc",
1031
- setup(build4) {
1032
- if (options.dts === false) {
1033
- return;
1034
- }
1035
- build4.onStart(async () => {
1036
- if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
1037
- await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
1038
- }
1039
- if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0]?.in && resolvedOptions.entryPoints[0].in.endsWith(".ts")) {
1040
- const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
1041
- const typeOutDir = resolvedOptions.outdir;
1042
- const entryPoint = resolvedOptions.entryPoints[0].in.replace(sourceRoot, "").replace(/\.ts$/, "");
1043
- const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
1044
- let dtsPath;
1045
- if (existsSync3(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
1046
- dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
1047
- } else if (existsSync3(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
1048
- dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
1049
- }
1050
- const ext = resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
1051
- if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
1052
- bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
1053
- const dtsContents = await fs3.readFile(`${bundlePath}.d.ts`, "utf8");
1054
- await fs3.writeFile(`${bundlePath}.${ext}`, dtsContents);
1055
- } else {
1056
- await fs3.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
1057
- }
1058
- }
1059
- });
1060
- }
1061
- }), "tscPlugin");
1062
- function getTypeDependencyPackageName(npmPackage) {
1063
- if (npmPackage.startsWith("@")) {
1064
- const [scope, name] = npmPackage.split("/");
1065
- return `@types/${scope?.slice(1)}__${name}`;
1066
- }
1067
- return `@types/${npmPackage}`;
1068
- }
1069
- __name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
1070
-
1071
639
  // ../esbuild/src/config.ts
1072
- var getDefaultBuildPlugins = /* @__PURE__ */ __name((options, resolvedOptions) => [
1073
- nodeProtocolPlugin(options, resolvedOptions),
1074
- resolvePathsPlugin(options, resolvedOptions),
1075
- fixImportsPlugin(options, resolvedOptions),
1076
- nativeNodeModulesPlugin(options, resolvedOptions),
1077
- esmSplitCodeToCjsPlugin(options, resolvedOptions),
1078
- tscPlugin(options, resolvedOptions),
1079
- onErrorPlugin(options, resolvedOptions)
1080
- ], "getDefaultBuildPlugins");
1081
640
  var DEFAULT_BUILD_OPTIONS = {
641
+ assets: [],
1082
642
  platform: "node",
1083
- target: "node22",
643
+ target: [
644
+ "esnext"
645
+ ],
1084
646
  format: "esm",
1085
- external: [],
1086
- logLevel: "error",
1087
647
  tsconfig: "tsconfig.json",
1088
648
  mode: "production",
649
+ generatePackageJson: true,
650
+ includeSrc: false,
1089
651
  keepNames: true,
1090
- metafile: true,
1091
- injectShims: true,
1092
- color: true,
652
+ metafile: false,
653
+ treeshake: true,
654
+ shims: false,
1093
655
  watch: false,
1094
656
  bundle: true,
1095
- clean: true,
1096
- debug: false,
1097
- resolveExtensions: [
1098
- ".tsx",
1099
- ".ts",
1100
- ".cts",
1101
- ".mts",
1102
- ".jsx",
1103
- ".js",
1104
- ".cjs",
1105
- ".mjs",
1106
- ".css",
1107
- ".json"
1108
- ],
1109
657
  loader: {
1110
658
  ".aac": "file",
1111
659
  ".css": "file",
@@ -1127,12 +675,15 @@ var DEFAULT_BUILD_OPTIONS = {
1127
675
  ".woff": "file",
1128
676
  ".woff2": "file"
1129
677
  },
1130
- banner: DEFAULT_COMPILED_BANNER
678
+ banner: {
679
+ js: DEFAULT_COMPILED_BANNER,
680
+ css: DEFAULT_COMPILED_BANNER
681
+ }
1131
682
  };
1132
683
 
1133
684
  // ../esbuild/src/plugins/deps-check.ts
1134
685
  import { builtinModules as builtinModules2 } from "node:module";
1135
- import path5 from "node:path";
686
+ import path2 from "node:path";
1136
687
  var unusedIgnore = [
1137
688
  // these are our dev dependencies
1138
689
  /@types\/.*?/,
@@ -1164,8 +715,8 @@ var missingIgnore = [
1164
715
  ];
1165
716
  var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
1166
717
  name: "storm:deps-check",
1167
- setup(build4) {
1168
- const pkgJsonPath = path5.join(process.cwd(), "package.json");
718
+ setup(build3) {
719
+ const pkgJsonPath = path2.join(process.cwd(), "package.json");
1169
720
  const pkgContents = __require(pkgJsonPath);
1170
721
  const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
1171
722
  const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
@@ -1176,7 +727,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
1176
727
  ];
1177
728
  const collectedDependencies = /* @__PURE__ */ new Set();
1178
729
  const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
1179
- build4.onResolve({
730
+ build3.onResolve({
1180
731
  filter: onlyPackages
1181
732
  }, (args) => {
1182
733
  if (args.importer.includes(process.cwd())) {
@@ -1192,7 +743,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
1192
743
  external: true
1193
744
  };
1194
745
  });
1195
- build4.onEnd(() => {
746
+ build3.onEnd(() => {
1196
747
  const unusedDependencies = [
1197
748
  ...dependencies
1198
749
  ].filter((dep) => {
@@ -1220,391 +771,53 @@ ${JSON.stringify(filteredMissingDeps)}
1220
771
  }
1221
772
  }), "depsCheckPlugin");
1222
773
 
1223
- // ../esbuild/src/renderers/shebang.ts
1224
- var shebangRenderer = {
1225
- name: "shebang",
1226
- renderChunk(_, __, info) {
1227
- if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
1228
- info.mode = 493;
1229
- }
1230
- }
1231
- };
1232
-
1233
- // ../esbuild/src/tsc.ts
1234
- import { loadTsConfig } from "bundle-require";
1235
- import defu2 from "defu";
1236
- import { existsSync as existsSync4, mkdirSync, writeFileSync } from "node:fs";
1237
- import { dirname as dirname2, isAbsolute, join, normalize } from "node:path";
1238
- import ts from "typescript";
1239
- function ensureTempDeclarationDir(workspaceConfig) {
1240
- const root = workspaceConfig.directories.temp || join(workspaceConfig.workspaceRoot, "tmp");
1241
- const dirPath = join(root, ".tsc", "declaration");
1242
- if (existsSync4(dirPath)) {
1243
- return dirPath;
1244
- }
1245
- mkdirSync(dirPath, {
1246
- recursive: true
1247
- });
1248
- const gitIgnorePath = join(root, ".tsc", ".gitignore");
1249
- writeFileSync(gitIgnorePath, "**/*\n");
1250
- return dirPath;
1251
- }
1252
- __name(ensureTempDeclarationDir, "ensureTempDeclarationDir");
1253
- function slash(path7) {
1254
- const isExtendedLengthPath = path7.startsWith("\\\\?\\");
1255
- if (isExtendedLengthPath) {
1256
- return path7;
1257
- }
1258
- return path7.replace(/\\/g, "/");
1259
- }
1260
- __name(slash, "slash");
1261
- function toAbsolutePath(workspaceConfig, p, cwd) {
1262
- if (isAbsolute(p)) {
1263
- return p;
1264
- }
1265
- return slash(normalize(join(cwd || workspaceConfig.workspaceRoot, p)));
1266
- }
1267
- __name(toAbsolutePath, "toAbsolutePath");
1268
- var AliasPool = class AliasPool2 {
1269
- static {
1270
- __name(this, "AliasPool");
1271
- }
1272
- seen = /* @__PURE__ */ new Set();
1273
- assign(name) {
1274
- let suffix = 0;
1275
- let alias = name === "default" ? "default_alias" : name;
1276
- while (this.seen.has(alias)) {
1277
- alias = `${name}_alias_${++suffix}`;
1278
- if (suffix >= 1e3) {
1279
- throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
1280
- }
1281
- }
1282
- this.seen.add(alias);
1283
- return alias;
1284
- }
1285
- };
1286
- function getExports(workspaceConfig, program, fileMapping) {
1287
- const checker = program.getTypeChecker();
1288
- const aliasPool = new AliasPool();
1289
- const assignAlias = aliasPool.assign.bind(aliasPool);
1290
- function extractExports(sourceFileName) {
1291
- const cwd = program.getCurrentDirectory();
1292
- sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
1293
- const sourceFile = program.getSourceFile(sourceFileName);
1294
- if (!sourceFile) {
1295
- return [];
1296
- }
1297
- const destFileName = fileMapping.get(sourceFileName);
1298
- if (!destFileName) {
1299
- return [];
1300
- }
1301
- const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
1302
- if (!moduleSymbol) {
1303
- return [];
1304
- }
1305
- const exports = [];
1306
- const exportSymbols = checker.getExportsOfModule(moduleSymbol);
1307
- exportSymbols.forEach((symbol) => {
1308
- const name = symbol.getName();
1309
- exports.push({
1310
- kind: "named",
1311
- sourceFileName,
1312
- destFileName,
1313
- name,
1314
- alias: assignAlias(name),
1315
- isTypeOnly: false
1316
- });
1317
- });
1318
- return exports;
1319
- }
1320
- __name(extractExports, "extractExports");
1321
- return program.getRootFileNames().flatMap(extractExports);
1322
- }
1323
- __name(getExports, "getExports");
1324
- function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
1325
- const fileMapping = /* @__PURE__ */ new Map();
1326
- const writeFile3 = /* @__PURE__ */ __name((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
1327
- const sourceFile = sourceFiles?.[0];
1328
- const sourceFileName = sourceFile?.fileName;
1329
- if (sourceFileName && !fileName.endsWith(".map")) {
1330
- const cwd = program.getCurrentDirectory();
1331
- fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
1332
- }
1333
- return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
1334
- }, "writeFile");
1335
- const emitResult = program.emit(void 0, writeFile3, void 0, emitOnlyDtsFiles, customTransformers);
1336
- const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
1337
- const diagnosticMessages = [];
1338
- diagnostics.forEach((diagnostic) => {
1339
- if (diagnostic.file) {
1340
- const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
1341
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
1342
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
1343
- } else {
1344
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
1345
- diagnosticMessages.push(message);
1346
- }
1347
- });
1348
- const diagnosticMessage = diagnosticMessages.join("\n");
1349
- if (diagnosticMessage) {
1350
- writeError(`Failed to emit declaration files.
1351
-
1352
- ${diagnosticMessage}`, workspaceConfig);
1353
- throw new Error("TypeScript compilation failed");
1354
- }
1355
- return fileMapping;
1356
- }
1357
- __name(emitDtsFiles, "emitDtsFiles");
1358
- function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
1359
- const rawTsconfig = loadTsConfig(workspaceConfig.workspaceRoot, tsconfig);
1360
- if (!rawTsconfig) {
1361
- throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
1362
- }
1363
- const declarationDir = ensureTempDeclarationDir(workspaceConfig);
1364
- const parsedTsconfig = ts.parseJsonConfigFileContent(defu2({
1365
- compilerOptions: {
1366
- // Enable declaration emit and disable javascript emit
1367
- noEmit: false,
1368
- declaration: true,
1369
- declarationMap: true,
1370
- declarationDir,
1371
- emitDeclarationOnly: true
1372
- }
1373
- }, tsconfigRaw?.compilerOptions ?? {}, rawTsconfig.data ?? {}), ts.sys, tsconfig ? dirname2(tsconfig) : "./");
1374
- const options = parsedTsconfig.options;
1375
- const host = ts.createCompilerHost(options);
1376
- const program = ts.createProgram(parsedTsconfig.fileNames, options, host);
1377
- const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
1378
- return getExports(workspaceConfig, program, fileMapping);
1379
- }
1380
- __name(emitDts, "emitDts");
1381
-
1382
- // ../esbuild/src/utilities/get-entry-points.ts
1383
- import { glob as glob3 } from "glob";
1384
- var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
1385
- const workspaceRoot3 = config.workspaceRoot || findWorkspaceRoot();
1386
- const entryPoints = [];
1387
- if (entry) {
1388
- if (typeof entry === "string") {
1389
- entryPoints.push({
1390
- in: entry,
1391
- out: entry
1392
- });
1393
- } else if (Array.isArray(entry)) {
1394
- entryPoints.push(...entry.map((entry2) => ({
1395
- in: entry2,
1396
- out: entry2
1397
- })));
1398
- } else {
1399
- entryPoints.push(...Object.entries(entry).map(([key, value]) => {
1400
- if (typeof value === "string") {
1401
- return {
1402
- in: value,
1403
- out: key
1404
- };
1405
- } else {
1406
- return {
1407
- in: key,
1408
- out: key
1409
- };
1410
- }
1411
- }));
1412
- }
1413
- }
1414
- if (emitOnAll) {
1415
- entryPoints.push({
1416
- in: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}"),
1417
- out: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}")
1418
- });
1419
- }
1420
- const results = await Promise.all(entryPoints.map(async (entryPoint) => {
1421
- const paths = [];
1422
- if (entryPoint.in.includes("*")) {
1423
- const files = await glob3(entryPoint.in, {
1424
- withFileTypes: true,
1425
- ignore: [
1426
- "**/node_modules/**"
1427
- ]
1428
- });
1429
- paths.push(...files.reduce((ret, filePath) => {
1430
- const result = correctPaths(joinPaths(filePath.path, filePath.name).replaceAll(correctPaths(workspaceRoot3), "").replaceAll(correctPaths(projectRoot), ""));
1431
- if (result) {
1432
- writeDebug(`Trying to add entry point ${result} at "${joinPaths(filePath.path, filePath.name)}"`, config);
1433
- if (!paths.some((p) => p.in === result)) {
1434
- paths.push({
1435
- in: result,
1436
- out: entryPoint.out.replace(entryPoint.in, result)
1437
- });
1438
- }
1439
- }
1440
- return ret;
1441
- }, []));
1442
- } else {
1443
- writeDebug(`Adding ESBuild entry point
1444
- - Input: ${entryPoint.in}
1445
- - Output: ${entryPoint.out}`, config);
1446
- if (!paths.some((p) => p.out === entryPoint.out)) {
1447
- paths.push(entryPoint);
1448
- }
1449
- }
1450
- return paths;
1451
- }));
1452
- return results.filter(Boolean).reduce((ret, result) => {
1453
- result.forEach((res) => {
1454
- if (res && !ret.some((p) => p.in === res.in)) {
1455
- ret.push(res);
1456
- }
1457
- });
1458
- return ret;
1459
- }, []);
1460
- }, "getEntryPoints");
1461
-
1462
- // ../esbuild/src/utilities/helpers.ts
1463
- function handleSync(fn) {
1464
- try {
1465
- return fn();
1466
- } catch (error_) {
1467
- return error_;
1468
- }
1469
- }
1470
- __name(handleSync, "handleSync");
1471
- async function handleAsync(fn) {
1472
- try {
1473
- return await fn();
1474
- } catch (error_) {
1475
- return error_;
1476
- }
1477
- }
1478
- __name(handleAsync, "handleAsync");
1479
- var handle = handleSync;
1480
- handle.async = handleAsync;
1481
- var skip = Symbol("skip");
1482
- function transduceSync(list, transformer) {
1483
- const transduced = [];
1484
- for (const [i, element_] of list.entries()) {
1485
- const transformed = transformer(element_, i);
1486
- if (transformed !== skip) {
1487
- transduced[transduced.length] = transformed;
1488
- }
1489
- }
1490
- return transduced;
1491
- }
1492
- __name(transduceSync, "transduceSync");
1493
- async function transduceAsync(list, transformer) {
1494
- const transduced = [];
1495
- await Promise.all(list.entries().map(async ([i, element_]) => {
1496
- const transformed = await transformer(element_, i);
1497
- if (transformed !== skip) {
1498
- transduced[transduced.length] = transformed;
1499
- }
1500
- }));
1501
- return transduced;
1502
- }
1503
- __name(transduceAsync, "transduceAsync");
1504
- var transduce = transduceSync;
1505
- transduce.async = transduceAsync;
1506
- function pipeSync(fn, ...fns) {
1507
- return (...args) => {
1508
- let result = fn(...args);
1509
- for (let i = 0; result !== skip && i < fns.length; ++i) {
1510
- result = fns[i]?.(result);
1511
- }
1512
- return result;
1513
- };
1514
- }
1515
- __name(pipeSync, "pipeSync");
1516
- function pipeAsync(fn, ...fns) {
1517
- return async (...args) => {
1518
- let result = await fn(...args);
1519
- for (let i = 0; result !== skip && i < fns.length; ++i) {
1520
- result = await fns[i]?.(result);
1521
- }
1522
- return result;
1523
- };
1524
- }
1525
- __name(pipeAsync, "pipeAsync");
1526
- var pipe = pipeSync;
1527
- pipe.async = pipeAsync;
1528
-
1529
774
  // ../esbuild/src/build.ts
1530
- var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
775
+ async function resolveContext(userOptions) {
1531
776
  const projectRoot = userOptions.projectRoot;
1532
777
  const workspaceRoot3 = findWorkspaceRoot2(projectRoot);
1533
778
  if (!workspaceRoot3) {
1534
779
  throw new Error("Cannot find Nx workspace root");
1535
780
  }
1536
- const config = await getConfig(workspaceRoot3.dir);
1537
- writeDebug(" \u2699\uFE0F Resolving build options", config);
781
+ const workspaceConfig = await getWorkspaceConfig(true, {
782
+ workspaceRoot: workspaceRoot3.dir
783
+ });
784
+ writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
1538
785
  const stopwatch = getStopwatch("Build options resolution");
1539
786
  const projectGraph = await createProjectGraphAsync({
1540
787
  exitOnError: true
1541
788
  });
1542
789
  const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
1543
- if (!existsSync5(projectJsonPath)) {
790
+ if (!existsSync3(projectJsonPath)) {
1544
791
  throw new Error("Cannot find project.json configuration");
1545
792
  }
1546
793
  const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
1547
794
  const projectJson = JSON.parse(projectJsonFile);
1548
- const projectName = projectJson.name;
795
+ const projectName = projectJson.name || userOptions.name;
1549
796
  const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
1550
797
  if (!projectConfigurations?.projects?.[projectName]) {
1551
798
  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.");
1552
799
  }
1553
- const options = defu3(userOptions, DEFAULT_BUILD_OPTIONS);
800
+ const options = defu2(userOptions, DEFAULT_BUILD_OPTIONS);
1554
801
  options.name ??= `${projectName}-${options.format}`;
1555
802
  options.target ??= DEFAULT_TARGET;
1556
803
  const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
1557
- if (!existsSync5(packageJsonPath)) {
804
+ if (!existsSync3(packageJsonPath)) {
1558
805
  throw new Error("Cannot find package.json configuration");
1559
806
  }
1560
807
  const env = getEnv("esbuild", options);
1561
- const result = {
808
+ const resolvedOptions = {
1562
809
  ...options,
1563
- config,
1564
- mainFields: options.platform === "node" ? [
1565
- "module",
1566
- "main"
1567
- ] : [
1568
- "browser",
1569
- "module",
1570
- "main"
1571
- ],
1572
- ...userOptions,
1573
810
  tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
1574
- format: options.format || "cjs",
1575
- entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry ?? "./src/index.ts", false),
1576
- outdir: userOptions.outputPath || joinPaths("dist", projectRoot),
1577
- distDir: userOptions.distDir || "dist",
1578
- plugins: [],
1579
- name: userOptions.name || projectName,
1580
- projectConfigurations,
1581
- projectName,
1582
- projectGraph,
1583
- sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
1584
- minify: userOptions.minify || !userOptions.debug,
1585
- verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
1586
- includeSrc: userOptions.includeSrc === true,
1587
- metafile: userOptions.metafile !== false,
1588
- generatePackageJson: userOptions.generatePackageJson !== false,
1589
- clean: userOptions.clean !== false,
1590
- assets: userOptions.assets ?? [],
1591
- injectShims: userOptions.injectShims !== true,
1592
- bundle: userOptions.bundle !== false,
1593
- keepNames: true,
1594
- watch: userOptions.watch === true,
1595
- footer: userOptions.footer,
1596
- banner: {
1597
- js: options.banner || DEFAULT_COMPILED_BANNER,
1598
- css: options.banner || DEFAULT_COMPILED_BANNER
1599
- },
1600
- splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
1601
- treeShaking: options.format === "esm",
811
+ distDir: "dist",
812
+ name: projectName,
813
+ metafile: userOptions.mode === "development",
814
+ ...userOptions,
815
+ clean: false,
816
+ target: userOptions.target || options.target,
817
+ splitting: options.format === "iife" ? false : options.treeshake === void 0 ? options.splitting : true,
1602
818
  env,
1603
819
  define: {
1604
- STORM_FORMAT: JSON.stringify(options.format || "cjs"),
1605
- ...options.format === "cjs" && options.injectShims ? {
1606
- "import.meta.url": "importMetaUrl"
1607
- } : {},
820
+ STORM_FORMAT: JSON.stringify(options.format),
1608
821
  ...options.define,
1609
822
  ...Object.keys(env || {}).reduce((res, key) => {
1610
823
  const value = JSON.stringify(env[key]);
@@ -1615,167 +828,98 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
1615
828
  [`import.meta.env.${safeKey}`]: value
1616
829
  };
1617
830
  }, {})
1618
- },
1619
- inject: [
1620
- options.format === "cjs" && options.injectShims ? joinPaths(__dirname, "../assets/cjs_shims.js") : void 0,
1621
- options.format === "esm" && options.injectShims && options.platform === "node" ? joinPaths(__dirname, "../assets/esm_shims.js") : void 0
1622
- ].filter(Boolean)
831
+ }
1623
832
  };
1624
- result.plugins = userOptions.plugins ?? getDefaultBuildPlugins(userOptions, result);
1625
- if (options.inject && Array.isArray(options.inject) && options.inject.length > 0) {
1626
- result.inject = options.inject.reduce((ret, inj) => {
1627
- if (inj && typeof inj === "string" && ret.includes(inj)) {
1628
- ret.push(inj);
1629
- }
1630
- return ret;
1631
- }, result.inject);
1632
- }
1633
- delete result.entry;
1634
- delete result.outputPath;
1635
833
  stopwatch();
1636
- return result;
1637
- }, "resolveOptions");
1638
- async function generatePackageJson(context2) {
1639
- if (context2.options.generatePackageJson !== false && existsSync5(joinPaths(context2.options.projectRoot, "package.json"))) {
1640
- writeDebug(" \u270D\uFE0F Writing package.json file", context2.options.config);
834
+ return {
835
+ options: resolvedOptions,
836
+ clean: userOptions.clean !== false,
837
+ workspaceConfig,
838
+ projectConfigurations,
839
+ projectName,
840
+ projectGraph,
841
+ sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
842
+ outputPath: resolvedOptions.outputPath || joinPaths(workspaceConfig.workspaceRoot, "dist", resolvedOptions.projectRoot),
843
+ minify: resolvedOptions.minify || resolvedOptions.mode === "production"
844
+ };
845
+ }
846
+ __name(resolveContext, "resolveContext");
847
+ async function generatePackageJson(context) {
848
+ if (context.options.generatePackageJson !== false && existsSync3(joinPaths(context.options.projectRoot, "package.json"))) {
849
+ writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
1641
850
  const stopwatch = getStopwatch("Write package.json file");
1642
- const packageJsonPath = joinPaths(context2.options.projectRoot, "project.json");
1643
- if (!existsSync5(packageJsonPath)) {
851
+ const packageJsonPath = joinPaths(context.options.projectRoot, "project.json");
852
+ if (!existsSync3(packageJsonPath)) {
1644
853
  throw new Error("Cannot find package.json configuration");
1645
854
  }
1646
- const packageJsonFile = await hf.readFile(joinPaths(context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"), "utf8");
855
+ const packageJsonFile = await hf.readFile(joinPaths(context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
1647
856
  let packageJson = JSON.parse(packageJsonFile);
1648
857
  if (!packageJson) {
1649
858
  throw new Error("Cannot find package.json configuration file");
1650
859
  }
1651
- packageJson = await addPackageDependencies(context2.options.config.workspaceRoot, context2.options.projectRoot, context2.options.projectName, packageJson);
1652
- packageJson = await addWorkspacePackageJsonFields(context2.options.config, context2.options.projectRoot, context2.options.sourceRoot, context2.options.projectName, false, packageJson);
1653
- packageJson.exports ??= {};
1654
- packageJson.exports["./package.json"] ??= "./package.json";
1655
- packageJson.exports["."] ??= `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js`;
1656
- for (const entryPoint of context2.options.entryPoints) {
1657
- if (entryPoint.out) {
1658
- const entry = entryPoint.out.replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
1659
- packageJson.exports[`./${entry}`] ??= `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/${entry}.js`;
860
+ packageJson = await addPackageDependencies(context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
861
+ packageJson = await addWorkspacePackageJsonFields(context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
862
+ if (context.options.entry) {
863
+ packageJson.exports ??= {};
864
+ packageJson.exports["./package.json"] ??= "./package.json";
865
+ packageJson.exports["."] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js`;
866
+ const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
867
+ for (const entryPoint of entryPoints) {
868
+ if (context.options.entry[entryPoint]) {
869
+ const entry = context.options.entry[entryPoint].replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
870
+ packageJson.exports[`./${entry}`] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entry}.js`;
871
+ }
1660
872
  }
1661
- }
1662
- if (context2.options.format === "esm") {
1663
- packageJson.module = packageJson.type === "module" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.mjs`;
1664
- } else {
1665
- packageJson.main = packageJson.type === "commonjs" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.cjs`;
1666
- }
1667
- packageJson.types = `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.d.ts`;
1668
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
1669
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1670
- ret[key.replace("/index", "")] = packageJson.exports[key];
873
+ if (context.options.format === "esm") {
874
+ packageJson.module = packageJson.type === "module" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.mjs`;
875
+ } else {
876
+ packageJson.main = packageJson.type === "commonjs" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.cjs`;
1671
877
  }
1672
- return ret;
1673
- }, packageJson.exports);
1674
- await writeJsonFile(joinPaths(context2.options.outdir, "package.json"), packageJson);
878
+ packageJson.types = `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.d.ts`;
879
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
880
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
881
+ ret[key.replace("/index", "")] = packageJson.exports[key];
882
+ }
883
+ return ret;
884
+ }, packageJson.exports);
885
+ }
886
+ await writeJsonFile(joinPaths(context.outputPath, "package.json"), packageJson);
1675
887
  stopwatch();
1676
888
  }
1677
- return context2;
889
+ return context;
1678
890
  }
1679
891
  __name(generatePackageJson, "generatePackageJson");
1680
- async function createOptions(options) {
1681
- return flatten(await Promise.all(map(options, (opt) => [
1682
- // we defer it so that we don't trigger glob immediately
1683
- () => resolveOptions(opt)
1684
- ])));
1685
- }
1686
- __name(createOptions, "createOptions");
1687
- async function generateContext(getOptions) {
1688
- const options = await getOptions();
1689
- const rendererEngine = new RendererEngine([
1690
- shebangRenderer,
1691
- ...options.renderers || []
1692
- ]);
1693
- return {
1694
- options,
1695
- rendererEngine
1696
- };
1697
- }
1698
- __name(generateContext, "generateContext");
1699
- async function executeEsBuild(context2) {
1700
- writeDebug(` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
1701
- const stopwatch = getStopwatch(`${context2.options.name} build`);
1702
- if (process.env.STORM_WATCH) {
1703
- const ctx = await esbuild2.context(context2.options);
1704
- watch(ctx, context2.options);
1705
- }
1706
- const options = {
1707
- ...context2.options
1708
- };
1709
- options.outdir = joinPaths(context2.options.outdir, context2.options.distDir);
1710
- if (!options.inject || !Array.isArray(options.inject) || options.inject.length === 0 || // eslint-disable-next-line no-constant-binary-expression, @typescript-eslint/no-explicit-any
1711
- options.inject === {}) {
1712
- delete options.inject;
1713
- }
1714
- delete options.dts;
1715
- delete options.env;
1716
- delete options.name;
1717
- delete options.assets;
1718
- delete options.mode;
1719
- delete options.orgName;
1720
- delete options.watch;
1721
- delete options.clean;
1722
- delete options.debug;
1723
- delete options.generatePackageJson;
1724
- delete options.distDir;
1725
- delete options.includeSrc;
1726
- delete options.verbose;
1727
- delete options.projectRoot;
1728
- delete options.projectName;
1729
- delete options.projectGraph;
1730
- delete options.projectConfigurations;
1731
- delete options.renderers;
1732
- delete options.config;
1733
- delete options.injectShims;
1734
- delete options.external;
1735
- writeTrace(`Run esbuild (${context2.options.name}) with the following options:
1736
- ${formatLogMessage({
1737
- ...options,
1738
- define: "<Hidden>"
1739
- })}`, context2.options.config);
1740
- const result = await esbuild2.build(options);
1741
- await esbuild2.stop();
1742
- if (result.metafile) {
1743
- const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
1744
- await hf.writeFile(metafilePath, JSON.stringify(result.metafile));
1745
- }
892
+ async function executeTsup(context) {
893
+ writeDebug(` \u{1F680} Running ${context.options.name} build`, context.workspaceConfig);
894
+ const stopwatch = getStopwatch(`${context.options.name} build`);
895
+ await tsup({
896
+ ...context.options,
897
+ outDir: context.outputPath,
898
+ workspaceConfig: context.workspaceConfig
899
+ });
1746
900
  stopwatch();
1747
- return context2;
1748
- }
1749
- __name(executeEsBuild, "executeEsBuild");
1750
- async function executeTypescript(context2) {
1751
- if (context2.result?.errors.length === 0 && context2.options.dts) {
1752
- writeDebug(` \u{1F4CB} Running TypeScript Compiler for ${context2.options.name}`, context2.options.config);
1753
- const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
1754
- await emitDts(context2.options.config, context2.options.tsconfig, context2.options.tsconfigRaw, true);
1755
- stopwatch();
1756
- }
1757
- return context2;
901
+ return context;
1758
902
  }
1759
- __name(executeTypescript, "executeTypescript");
1760
- async function copyBuildAssets(context2) {
1761
- if (context2.result?.errors.length === 0) {
1762
- writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context2.options.outdir}`, context2.options.config);
1763
- const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
1764
- await copyAssets(context2.options.config, context2.options.assets ?? [], context2.options.outdir, context2.options.projectRoot, context2.options.sourceRoot, true, false);
903
+ __name(executeTsup, "executeTsup");
904
+ async function copyBuildAssets(context) {
905
+ if (context.result?.errors.length === 0) {
906
+ writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context.outputPath}`, context.workspaceConfig);
907
+ const stopwatch = getStopwatch(`${context.options.name} asset copy`);
908
+ await copyAssets(context.workspaceConfig, context.options.assets ?? [], context.outputPath, context.options.projectRoot, context.sourceRoot, true, false);
1765
909
  stopwatch();
1766
910
  }
1767
- return context2;
911
+ return context;
1768
912
  }
1769
913
  __name(copyBuildAssets, "copyBuildAssets");
1770
- async function reportResults(context2) {
1771
- if (context2.result?.errors.length === 0) {
1772
- if (context2.result.warnings.length > 0) {
1773
- writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context2.result.warnings.map((warning) => warning.text).join("\n")}`, context2.options.config);
914
+ async function reportResults(context) {
915
+ if (context.result?.errors.length === 0) {
916
+ if (context.result.warnings.length > 0) {
917
+ writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
1774
918
  }
1775
- writeSuccess(` \u{1F4E6} The ${context2.options.name} build completed successfully`, context2.options.config);
1776
- } else if (context2.result?.errors && context2.result?.errors.length > 0) {
1777
- writeError(` \u274C The ${context2.options.name} build failed with the following errors: ${context2.result.errors.map((error) => error.text).join("\n")}`, context2.options.config);
1778
- throw new Error(`The ${context2.options.name} build failed with the following errors: ${context2.result.errors.map((error) => error.text).join("\n")}`);
919
+ writeSuccess(` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
920
+ } else if (context.result?.errors && context.result?.errors.length > 0) {
921
+ writeError(` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
922
+ throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
1779
923
  }
1780
924
  }
1781
925
  __name(reportResults, "reportResults");
@@ -1786,7 +930,7 @@ async function dependencyCheck(options) {
1786
930
  if (process.env.CI && !process.env.BUILDKITE) {
1787
931
  return void 0;
1788
932
  }
1789
- const buildPromise = esbuild2.build({
933
+ const buildPromise = esbuild.build({
1790
934
  entryPoints: globbySync("**/*.{j,t}s", {
1791
935
  // We don't check dependencies in ecosystem tests because tests are isolated from the build.
1792
936
  ignore: [
@@ -1809,17 +953,17 @@ async function dependencyCheck(options) {
1809
953
  return void 0;
1810
954
  }
1811
955
  __name(dependencyCheck, "dependencyCheck");
1812
- async function cleanOutputPath(context2) {
1813
- if (context2.options.clean !== false && context2.options.outdir) {
1814
- writeDebug(` \u{1F9F9} Cleaning ${context2.options.name} output path: ${context2.options.outdir}`, context2.options.config);
1815
- const stopwatch = getStopwatch(`${context2.options.name} output clean`);
1816
- await cleanDirectories(context2.options.name, context2.options.outdir, context2.options.config);
956
+ async function cleanOutputPath(context) {
957
+ if (context.clean !== false && context.outputPath) {
958
+ writeDebug(` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
959
+ const stopwatch = getStopwatch(`${context.options.name} output clean`);
960
+ await cleanDirectories(context.outputPath);
1817
961
  stopwatch();
1818
962
  }
1819
- return context2;
963
+ return context;
1820
964
  }
1821
965
  __name(cleanOutputPath, "cleanOutputPath");
1822
- async function build3(options) {
966
+ async function build2(options) {
1823
967
  writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
1824
968
  const stopwatch = getStopwatch("ESBuild pipeline");
1825
969
  try {
@@ -1829,8 +973,15 @@ async function build3(options) {
1829
973
  if (opts.length === 0) {
1830
974
  throw new Error("No build options were provided");
1831
975
  }
1832
- void transduce.async(opts, dependencyCheck);
1833
- await transduce.async(await createOptions(opts), pipe.async(generateContext, cleanOutputPath, generatePackageJson, executeTypescript, executeEsBuild, copyBuildAssets, reportResults));
976
+ const context = await resolveContext(options);
977
+ await cleanOutputPath(context);
978
+ await Promise.all([
979
+ dependencyCheck(context.options),
980
+ generatePackageJson(context),
981
+ copyBuildAssets(context),
982
+ executeTsup(context)
983
+ ]);
984
+ await reportResults(context);
1834
985
  writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
1835
986
  } catch (error) {
1836
987
  writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
@@ -1839,47 +990,19 @@ async function build3(options) {
1839
990
  stopwatch();
1840
991
  }
1841
992
  }
1842
- __name(build3, "build");
1843
- var watch = /* @__PURE__ */ __name((context2, options) => {
1844
- if (!options.watch) {
1845
- return context2;
1846
- }
1847
- const config = {
1848
- ignoreInitial: true,
1849
- useFsEvents: true,
1850
- ignored: [
1851
- "./src/__tests__/**/*",
1852
- "./package.json"
1853
- ]
1854
- };
1855
- const changeWatcher = createWatcher([
1856
- "./src/**/*"
1857
- ], config);
1858
- const fastRebuild = debounce(async () => {
1859
- const timeBefore = Date.now();
1860
- const rebuildResult = await handle.async(() => {
1861
- return context2.rebuild();
1862
- });
1863
- if (rebuildResult instanceof Error) {
1864
- writeError(rebuildResult.message);
1865
- }
1866
- writeTrace(`${Date.now() - timeBefore}ms [${options.name ?? ""}]`);
1867
- }, 10);
1868
- changeWatcher.on("change", fastRebuild);
1869
- return void 0;
1870
- }, "watch");
993
+ __name(build2, "build");
1871
994
 
1872
995
  // ../workspace-tools/src/executors/esbuild/executor.ts
1873
- async function esbuildExecutorFn(options, context2, config) {
996
+ async function esbuildExecutorFn(options, context, config) {
1874
997
  writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
1875
- if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !context2.projectsConfigurations.projects[context2.projectName]?.root) {
998
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
1876
999
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1877
1000
  }
1878
- await build3({
1001
+ await build2({
1879
1002
  ...options,
1880
- projectRoot: context2.projectsConfigurations.projects?.[context2.projectName].root,
1881
- projectName: context2.projectName,
1882
- sourceRoot: context2.projectsConfigurations.projects?.[context2.projectName]?.sourceRoot,
1003
+ projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
1004
+ name: context.projectName,
1005
+ sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
1883
1006
  format: options.format,
1884
1007
  platform: options.format
1885
1008
  });
@@ -1903,17 +1026,17 @@ var executor_default6 = withRunExecutor("Storm ESBuild build", esbuildExecutorFn
1903
1026
  });
1904
1027
 
1905
1028
  // ../workspace-tools/src/executors/npm-publish/executor.ts
1906
- import { execSync as execSync4 } from "node:child_process";
1029
+ import { execSync as execSync3 } from "node:child_process";
1907
1030
  import { readFile as readFile5 } from "node:fs/promises";
1908
1031
 
1909
1032
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
1910
- import { existsSync as existsSync6 } from "node:fs";
1033
+ import { existsSync as existsSync4 } from "node:fs";
1911
1034
  import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
1912
1035
  import { format } from "prettier";
1913
1036
  import readYamlFile from "read-yaml-file";
1914
1037
 
1915
1038
  // ../workspace-tools/src/executors/npm-publish/executor.ts
1916
- var LARGE_BUFFER3 = 1024 * 1e6;
1039
+ var LARGE_BUFFER2 = 1024 * 1e6;
1917
1040
 
1918
1041
  // ../workspace-tools/src/executors/size-limit/executor.ts
1919
1042
  import { joinPathFragments as joinPathFragments3 } from "@nx/devkit";
@@ -1921,19 +1044,19 @@ import esBuildPlugin from "@size-limit/esbuild";
1921
1044
  import esBuildWhyPlugin from "@size-limit/esbuild-why";
1922
1045
  import filePlugin from "@size-limit/file";
1923
1046
  import sizeLimit from "size-limit";
1924
- async function sizeLimitExecutorFn(options, context2, config) {
1925
- if (!context2?.projectName || !context2.projectsConfigurations?.projects || !context2.projectsConfigurations.projects[context2.projectName]) {
1047
+ async function sizeLimitExecutorFn(options, context, config) {
1048
+ if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
1926
1049
  throw new Error("The Size-Limit process failed because the context is not valid. Please run this command from a workspace.");
1927
1050
  }
1928
- writeInfo(`\u{1F4CF} Running Size-Limit on ${context2.projectName}`, config);
1051
+ writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
1929
1052
  sizeLimit([
1930
1053
  filePlugin,
1931
1054
  esBuildPlugin,
1932
1055
  esBuildWhyPlugin
1933
1056
  ], {
1934
- checks: options.entry ?? context2.projectsConfigurations.projects[context2.projectName]?.sourceRoot ?? joinPathFragments3(context2.projectsConfigurations.projects[context2.projectName]?.root ?? "./", "src")
1057
+ checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments3(context.projectsConfigurations.projects[context.projectName]?.root ?? "./", "src")
1935
1058
  }).then((result) => {
1936
- writeInfo(`\u{1F4CF} ${context2.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
1059
+ writeInfo(`\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
1937
1060
  });
1938
1061
  return {
1939
1062
  success: true
@@ -1986,17 +1109,17 @@ var executor_default8 = withRunExecutor("Typia runtime validation generator", ty
1986
1109
  });
1987
1110
 
1988
1111
  // ../workspace-tools/src/executors/unbuild/executor.ts
1989
- import { defu as defu4 } from "defu";
1112
+ import { defu as defu3 } from "defu";
1990
1113
  import { createJiti } from "jiti";
1991
- async function unbuildExecutorFn(options, context2, config) {
1114
+ async function unbuildExecutorFn(options, context, config) {
1992
1115
  writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
1993
- if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
1116
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
1994
1117
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace root directory.");
1995
1118
  }
1996
- if (!context2.projectsConfigurations.projects[context2.projectName].root) {
1119
+ if (!context.projectsConfigurations.projects[context.projectName].root) {
1997
1120
  throw new Error("The Build process failed because the project root is not valid. Please run this command from a workspace root directory.");
1998
1121
  }
1999
- if (!context2.projectsConfigurations.projects[context2.projectName].sourceRoot) {
1122
+ if (!context.projectsConfigurations.projects[context.projectName].sourceRoot) {
2000
1123
  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.");
2001
1124
  }
2002
1125
  const jiti = createJiti(config.workspaceRoot, {
@@ -2004,11 +1127,11 @@ async function unbuildExecutorFn(options, context2, config) {
2004
1127
  interopDefault: true
2005
1128
  });
2006
1129
  const stormUnbuild = await jiti.import(jiti.esmResolve("@storm-software/unbuild/build"));
2007
- await stormUnbuild.build(defu4({
1130
+ await stormUnbuild.build(defu3({
2008
1131
  ...options,
2009
- projectRoot: context2.projectsConfigurations.projects[context2.projectName].root,
2010
- projectName: context2.projectName,
2011
- sourceRoot: context2.projectsConfigurations.projects[context2.projectName].sourceRoot,
1132
+ projectRoot: context.projectsConfigurations.projects[context.projectName].root,
1133
+ projectName: context.projectName,
1134
+ sourceRoot: context.projectsConfigurations.projects[context.projectName].sourceRoot,
2012
1135
  platform: options.platform
2013
1136
  }, {
2014
1137
  stubOptions: {
@@ -2617,7 +1740,7 @@ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Pl
2617
1740
 
2618
1741
  // ../workspace-tools/src/generators/preset/generator.ts
2619
1742
  import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments4, updateJson as updateJson2 } from "@nx/devkit";
2620
- import * as path6 from "node:path";
1743
+ import * as path3 from "node:path";
2621
1744
  async function presetGeneratorFn(tree, options) {
2622
1745
  const projectRoot = ".";
2623
1746
  options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
@@ -2765,7 +1888,7 @@ async function presetGeneratorFn(tree, options) {
2765
1888
  };
2766
1889
  return json;
2767
1890
  });
2768
- generateFiles4(tree, path6.join(__dirname, "files"), projectRoot, {
1891
+ generateFiles4(tree, path3.join(__dirname, "files"), projectRoot, {
2769
1892
  ...options,
2770
1893
  pnpmVersion,
2771
1894
  nodeVersion
@@ -3044,7 +2167,7 @@ var RuleConfigSeverity;
3044
2167
  })(RuleConfigSeverity || (RuleConfigSeverity = {}));
3045
2168
 
3046
2169
  // ../workspace-tools/src/generators/release-version/generator.ts
3047
- import { exec as exec2, execSync as execSync5 } from "node:child_process";
2170
+ import { exec, execSync as execSync4 } from "node:child_process";
3048
2171
  import { relative as relative3 } from "node:path";
3049
2172
  import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
3050
2173
  import { getFirstGitCommit, getLatestGitTagForPattern } from "nx/src/command-line/release/utils/git";
@@ -3470,23 +2593,23 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
3470
2593
 
3471
2594
  // ../workspace-tools/src/utils/lock-file.ts
3472
2595
  import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "@nx/devkit";
3473
- import { existsSync as existsSync7 } from "node:fs";
3474
- import { join as join3 } from "node:path";
2596
+ import { existsSync as existsSync5 } from "node:fs";
2597
+ import { join as join2 } from "node:path";
3475
2598
  import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";
3476
2599
  import { getPnpmLockfileDependencies, getPnpmLockfileNodes } from "nx/src/plugins/js/lock-file/pnpm-parser";
3477
2600
  import { getYarnLockfileDependencies, getYarnLockfileNodes } from "nx/src/plugins/js/lock-file/yarn-parser";
3478
2601
  var YARN_LOCK_FILE = "yarn.lock";
3479
2602
  var NPM_LOCK_FILE = "package-lock.json";
3480
2603
  var PNPM_LOCK_FILE = "pnpm-lock.yaml";
3481
- var YARN_LOCK_PATH = join3(workspaceRoot2, YARN_LOCK_FILE);
3482
- var NPM_LOCK_PATH = join3(workspaceRoot2, NPM_LOCK_FILE);
3483
- var PNPM_LOCK_PATH = join3(workspaceRoot2, PNPM_LOCK_FILE);
2604
+ var YARN_LOCK_PATH = join2(workspaceRoot2, YARN_LOCK_FILE);
2605
+ var NPM_LOCK_PATH = join2(workspaceRoot2, NPM_LOCK_FILE);
2606
+ var PNPM_LOCK_PATH = join2(workspaceRoot2, PNPM_LOCK_FILE);
3484
2607
 
3485
2608
  // ../workspace-tools/src/utils/plugin-helpers.ts
3486
2609
  import { readJsonFile as readJsonFile2 } from "@nx/devkit";
3487
- import defu5 from "defu";
3488
- import { existsSync as existsSync8 } from "node:fs";
3489
- import { dirname as dirname3, join as join4 } from "node:path";
2610
+ import defu4 from "defu";
2611
+ import { existsSync as existsSync6 } from "node:fs";
2612
+ import { dirname, join as join3 } from "node:path";
3490
2613
 
3491
2614
  // ../workspace-tools/src/utils/typia-transform.ts
3492
2615
  import transform2 from "typia/lib/transform";