@storm-software/cloudflare-tools 0.49.1 → 0.50.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-ZY7TM2TA.mjs → chunk-4AK2RSE7.mjs} +2 -2
  4. package/dist/{chunk-OARYMVO7.mjs → chunk-4AMWR76J.mjs} +4 -4
  5. package/dist/{chunk-CR22PACK.mjs → chunk-6RM4MALM.mjs} +1 -1
  6. package/dist/{chunk-NPJPHEFP.js → chunk-7VU6EPB4.js} +1 -1
  7. package/dist/{chunk-VPT6GF3S.mjs → chunk-HPCGVJ7R.mjs} +1 -1
  8. package/dist/{chunk-YE4FHRXJ.js → chunk-IUVV2SM4.js} +4 -4
  9. package/dist/{chunk-W5J5EWQN.js → chunk-MH545KJZ.js} +4 -4
  10. package/dist/{chunk-NKCR3FSU.js → chunk-SUASGTND.js} +2 -2
  11. package/dist/{chunk-ITLKTOIK.mjs → chunk-T6VDL633.mjs} +132 -143
  12. package/dist/{chunk-WGOT27OY.js → chunk-ULTJPRDX.js} +141 -152
  13. package/dist/executors.js +4 -4
  14. package/dist/executors.mjs +4 -4
  15. package/dist/generators.js +4 -4
  16. package/dist/generators.mjs +3 -3
  17. package/dist/index.js +7 -7
  18. package/dist/index.mjs +6 -6
  19. package/dist/src/executors/cloudflare-publish/executor.js +2 -2
  20. package/dist/src/executors/cloudflare-publish/executor.mjs +2 -2
  21. package/dist/src/executors/r2-upload-publish/executor.js +3 -3
  22. package/dist/src/executors/r2-upload-publish/executor.mjs +2 -2
  23. package/dist/src/executors/serve/executor.js +3 -3
  24. package/dist/src/executors/serve/executor.mjs +2 -2
  25. package/dist/src/generators/init/generator.js +2 -2
  26. package/dist/src/generators/init/generator.mjs +1 -1
  27. package/dist/src/generators/worker/generator.js +4 -4
  28. package/dist/src/generators/worker/generator.mjs +3 -3
  29. package/package.json +150 -1
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-XU6MTFCV.mjs";
5
5
  import {
6
6
  loadStormConfig
7
- } from "./chunk-OARYMVO7.mjs";
7
+ } from "./chunk-4AMWR76J.mjs";
8
8
  import {
9
9
  LogLevelLabel,
10
10
  StormConfigSchema,
@@ -465,8 +465,8 @@ import https from "node:https";
465
465
  var LARGE_BUFFER2 = 1024 * 1e6;
466
466
 
467
467
  // ../esbuild/src/build.ts
468
- import { hfs as hfs6 } from "@humanfs/node";
469
- import { createProjectGraphAsync as createProjectGraphAsync3, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph3, writeJsonFile } from "@nx/devkit";
468
+ import { hfs as hfs3 } from "@humanfs/node";
469
+ import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
470
470
 
471
471
  // ../build-tools/src/config.ts
472
472
  var DEFAULT_COMPILED_BANNER = `
@@ -493,13 +493,14 @@ import { stripIndents } from "@nx/devkit";
493
493
  import { relative as relative2 } from "path";
494
494
 
495
495
  // ../build-tools/src/utilities/copy-assets.ts
496
- import { hfs as hfs2 } from "@humanfs/node";
497
- import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
496
+ import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
498
497
  import { copyAssets as copyAssetsBase } from "@nx/js";
499
498
  import { glob } from "glob";
499
+ import { readFile as readFile2, writeFile } from "node:fs/promises";
500
500
 
501
501
  // ../build-tools/src/utilities/read-nx-config.ts
502
- import { hfs } from "@humanfs/node";
502
+ import { existsSync } from "node:fs";
503
+ import { readFile } from "node:fs/promises";
503
504
  var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
504
505
  let rootDir = workspaceRoot3;
505
506
  if (!rootDir) {
@@ -507,10 +508,11 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
507
508
  rootDir = config.workspaceRoot;
508
509
  }
509
510
  const nxJsonPath = joinPaths(rootDir, "nx.json");
510
- if (!await hfs.isFile(nxJsonPath)) {
511
+ if (!existsSync(nxJsonPath)) {
511
512
  throw new Error("Cannot find project.json configuration");
512
513
  }
513
- return hfs.json(nxJsonPath);
514
+ const configContent = await readFile(nxJsonPath, "utf8");
515
+ return JSON.parse(configContent);
514
516
  }, "readNxConfig");
515
517
 
516
518
  // ../build-tools/src/utilities/copy-assets.ts
@@ -545,14 +547,12 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
545
547
  });
546
548
  }
547
549
  const nxJson = readNxConfig(config.workspaceRoot);
548
- const projectGraph = await createProjectGraphAsync({
549
- exitOnError: true
550
- });
550
+ const projectGraph = readCachedProjectGraph();
551
551
  const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
552
552
  if (!projectsConfigurations?.projects?.[projectName]) {
553
553
  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.");
554
554
  }
555
- const buildTarget = projectsConfigurations.projects[projectName]?.targets?.build;
555
+ const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
556
556
  if (!buildTarget) {
557
557
  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")}`);
558
558
  }
@@ -582,42 +582,30 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
582
582
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
583
583
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
584
584
  ]);
585
- await Promise.allSettled(files.map(async (file) => hfs2.write(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
585
+ await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
586
586
 
587
- ${await hfs2.text(file)}
587
+ ${await readFile2(file, "utf8")}
588
588
 
589
589
  ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
590
590
  }
591
591
  }, "copyAssets");
592
592
 
593
593
  // ../build-tools/src/utilities/generate-package-json.ts
594
- import { hfs as hfs3 } from "@humanfs/node";
595
594
  import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
596
595
  import { Glob } from "glob";
597
- import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2 } from "nx/src/project-graph/project-graph";
596
+ import { existsSync as existsSync2 } from "node:fs";
597
+ import { readFile as readFile3 } from "node:fs/promises";
598
+ import { readCachedProjectGraph as readCachedProjectGraph2 } from "nx/src/project-graph/project-graph";
598
599
  var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, projectRoot, projectName, packageJson) => {
599
- const projectGraph = await createProjectGraphAsync2({
600
- exitOnError: true
601
- });
602
- const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
603
- if (!projectConfigurations?.projects?.[projectName]) {
604
- 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.");
605
- }
606
- const projectJsonPath = joinPaths(workspaceRoot3, projectRoot, "project.json");
607
- if (!await hfs3.isFile(projectJsonPath)) {
608
- throw new Error("Cannot find project.json configuration");
609
- }
610
- if (!projectConfigurations?.projects?.[projectName]) {
611
- 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.");
612
- }
613
- const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
600
+ const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph2(), workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
614
601
  const localPackages = [];
615
602
  for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot3)) {
616
603
  const projectNode = project.node;
617
604
  if (projectNode.data.root) {
618
605
  const projectPackageJsonPath = joinPaths(workspaceRoot3, projectNode.data.root, "package.json");
619
- if (await hfs3.isFile(projectPackageJsonPath)) {
620
- const projectPackageJson = await hfs3.json(projectPackageJsonPath);
606
+ if (existsSync2(projectPackageJsonPath)) {
607
+ const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
608
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
621
609
  if (projectPackageJson.private !== false) {
622
610
  localPackages.push(projectPackageJson);
623
611
  }
@@ -653,7 +641,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
653
641
  }, "addPackageDependencies");
654
642
  var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
655
643
  const workspaceRoot3 = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
656
- const workspacePackageJson = await hfs3.json(joinPaths(workspaceRoot3, "package.json"));
644
+ const workspacePackageJsonContent = await readFile3(joinPaths(workspaceRoot3, "package.json"), "utf8");
645
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
657
646
  packageJson.type ??= "module";
658
647
  packageJson.sideEffects ??= false;
659
648
  if (includeSrc === true) {
@@ -799,18 +788,18 @@ var getEnv = /* @__PURE__ */ __name((builder, options) => {
799
788
  }, "getEnv");
800
789
 
801
790
  // ../build-tools/src/utilities/get-out-extension.ts
802
- function getOutExtension(format, pkgType) {
791
+ function getOutExtension(format2, pkgType) {
803
792
  let jsExtension = ".js";
804
793
  let dtsExtension = ".d.ts";
805
- if (pkgType === "module" && format === "cjs") {
794
+ if (pkgType === "module" && format2 === "cjs") {
806
795
  jsExtension = ".cjs";
807
796
  dtsExtension = ".d.cts";
808
797
  }
809
- if (pkgType !== "module" && format === "esm") {
798
+ if (pkgType !== "module" && format2 === "esm") {
810
799
  jsExtension = ".mjs";
811
800
  dtsExtension = ".d.mts";
812
801
  }
813
- if (format === "iife") {
802
+ if (format2 === "iife") {
814
803
  jsExtension = ".global.js";
815
804
  }
816
805
  return {
@@ -974,11 +963,11 @@ var RendererEngine = class {
974
963
  };
975
964
 
976
965
  // ../esbuild/src/clean.ts
977
- import { hfs as hfs4 } from "@humanfs/node";
966
+ import { hfs } from "@humanfs/node";
978
967
  async function clean(name = "ESBuild", directory, config) {
979
968
  writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
980
969
  const stopwatch = getStopwatch(`${name} output clean`);
981
- await hfs4.deleteAll(directory);
970
+ await hfs.deleteAll(directory);
982
971
  stopwatch();
983
972
  }
984
973
  __name(clean, "clean");
@@ -1153,7 +1142,7 @@ var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
1153
1142
  }), "resolvePathsPlugin");
1154
1143
 
1155
1144
  // ../esbuild/src/plugins/tsc.ts
1156
- import { hfs as hfs5 } from "@humanfs/node";
1145
+ import { hfs as hfs2 } from "@humanfs/node";
1157
1146
  import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
1158
1147
  function bundleTypeDefinitions(filename, outfile, externals, options) {
1159
1148
  const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
@@ -1227,18 +1216,18 @@ var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
1227
1216
  const entryPoint = resolvedOptions.entryPoints[0].replace(sourceRoot, "").replace(/\.ts$/, "");
1228
1217
  const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
1229
1218
  let dtsPath;
1230
- if (await hfs5.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
1219
+ if (await hfs2.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
1231
1220
  dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
1232
- } else if (await hfs5.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
1221
+ } else if (await hfs2.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
1233
1222
  dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
1234
1223
  }
1235
1224
  const ext = resolvedOptions.outExtension.dts || resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
1236
1225
  if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
1237
1226
  bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
1238
- const dtsContents = await hfs5.text(`${bundlePath}.d.ts`);
1239
- await hfs5.write(`${bundlePath}.${ext}`, dtsContents);
1227
+ const dtsContents = await hfs2.text(`${bundlePath}.d.ts`);
1228
+ await hfs2.write(`${bundlePath}.${ext}`, dtsContents);
1240
1229
  } else {
1241
- await hfs5.write(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
1230
+ await hfs2.write(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
1242
1231
  }
1243
1232
  }
1244
1233
  });
@@ -1483,16 +1472,16 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
1483
1472
  const config = await loadStormConfig(workspaceRoot3.dir);
1484
1473
  writeDebug(" \u2699\uFE0F Resolving build options", config);
1485
1474
  const stopwatch = getStopwatch("Build options resolution");
1486
- const projectGraph = await createProjectGraphAsync3({
1475
+ const projectGraph = await createProjectGraphAsync({
1487
1476
  exitOnError: true
1488
1477
  });
1489
1478
  const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
1490
- if (!await hfs6.isFile(projectJsonPath)) {
1479
+ if (!await hfs3.isFile(projectJsonPath)) {
1491
1480
  throw new Error("Cannot find project.json configuration");
1492
1481
  }
1493
- const projectJson = await hfs6.json(projectJsonPath);
1482
+ const projectJson = await hfs3.json(projectJsonPath);
1494
1483
  const projectName = projectJson.name;
1495
- const projectConfigurations = readProjectsConfigurationFromProjectGraph3(projectGraph);
1484
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
1496
1485
  if (!projectConfigurations?.projects?.[projectName]) {
1497
1486
  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.");
1498
1487
  }
@@ -1500,10 +1489,10 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
1500
1489
  options.name ??= `${projectName}-${options.format}`;
1501
1490
  options.target ??= DEFAULT_TARGET;
1502
1491
  const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
1503
- if (!await hfs6.isFile(packageJsonPath)) {
1492
+ if (!await hfs3.isFile(packageJsonPath)) {
1504
1493
  throw new Error("Cannot find package.json configuration");
1505
1494
  }
1506
- const packageJson = await hfs6.json(packageJsonPath);
1495
+ const packageJson = await hfs3.json(packageJsonPath);
1507
1496
  const outExtension = getOutputExtensionMap(options, packageJson.type);
1508
1497
  const env = getEnv("esbuild", options);
1509
1498
  const result = {
@@ -1582,14 +1571,14 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
1582
1571
  return result;
1583
1572
  }, "resolveOptions");
1584
1573
  async function generatePackageJson(context2) {
1585
- if (context2.options.generatePackageJson !== false && await hfs6.isFile(joinPaths(context2.options.projectRoot, "package.json"))) {
1574
+ if (context2.options.generatePackageJson !== false && await hfs3.isFile(joinPaths(context2.options.projectRoot, "package.json"))) {
1586
1575
  writeDebug(" \u270D\uFE0F Writing package.json file", context2.options.config);
1587
1576
  const stopwatch = getStopwatch("Write package.json file");
1588
1577
  const packageJsonPath = joinPaths(context2.options.projectRoot, "project.json");
1589
- if (!await hfs6.isFile(packageJsonPath)) {
1578
+ if (!await hfs3.isFile(packageJsonPath)) {
1590
1579
  throw new Error("Cannot find package.json configuration");
1591
1580
  }
1592
- let packageJson = await hfs6.json(joinPaths(context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"));
1581
+ let packageJson = await hfs3.json(joinPaths(context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"));
1593
1582
  if (!packageJson) {
1594
1583
  throw new Error("Cannot find package.json configuration file");
1595
1584
  }
@@ -1662,7 +1651,7 @@ async function executeEsBuild(context2) {
1662
1651
  const result = await esbuild2.build(context2.options);
1663
1652
  if (result.metafile) {
1664
1653
  const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
1665
- await hfs6.write(metafilePath, JSON.stringify(result.metafile));
1654
+ await hfs3.write(metafilePath, JSON.stringify(result.metafile));
1666
1655
  }
1667
1656
  stopwatch();
1668
1657
  return context2;
@@ -1812,8 +1801,9 @@ import { execSync as execSync4 } from "node:child_process";
1812
1801
  import fs3 from "node:fs/promises";
1813
1802
 
1814
1803
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
1815
- import { existsSync } from "node:fs";
1816
- import { readFile, writeFile } from "node:fs/promises";
1804
+ import { existsSync as existsSync3 } from "node:fs";
1805
+ import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
1806
+ import { format } from "prettier";
1817
1807
  import readYamlFile from "read-yaml-file";
1818
1808
 
1819
1809
  // ../workspace-tools/src/executors/npm-publish/executor.ts
@@ -1854,18 +1844,18 @@ var executor_default7 = withRunExecutor("Size-Limit Performance Test Executor",
1854
1844
  });
1855
1845
 
1856
1846
  // ../tsdown/src/build.ts
1857
- import { hfs as hfs8 } from "@humanfs/node";
1858
- import { createProjectGraphAsync as createProjectGraphAsync4, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph4, writeJsonFile as writeJsonFile2 } from "@nx/devkit";
1847
+ import { hfs as hfs5 } from "@humanfs/node";
1848
+ import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph3, writeJsonFile as writeJsonFile2 } from "@nx/devkit";
1859
1849
  import defu2 from "defu";
1860
1850
  import { findWorkspaceRoot as findWorkspaceRoot3 } from "nx/src/utils/find-workspace-root";
1861
1851
  import { build as tsdown } from "tsdown";
1862
1852
 
1863
1853
  // ../tsdown/src/clean.ts
1864
- import { hfs as hfs7 } from "@humanfs/node";
1854
+ import { hfs as hfs4 } from "@humanfs/node";
1865
1855
  async function clean2(name = "ESBuild", directory, config) {
1866
1856
  writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
1867
1857
  const stopwatch = getStopwatch(`${name} output clean`);
1868
- await hfs7.deleteAll(directory);
1858
+ await hfs4.deleteAll(directory);
1869
1859
  stopwatch();
1870
1860
  }
1871
1861
  __name(clean2, "clean");
@@ -1902,16 +1892,16 @@ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
1902
1892
  const config = await loadStormConfig(workspaceRoot3.dir);
1903
1893
  writeDebug(" \u2699\uFE0F Resolving build options", config);
1904
1894
  const stopwatch = getStopwatch("Build options resolution");
1905
- const projectGraph = await createProjectGraphAsync4({
1895
+ const projectGraph = await createProjectGraphAsync2({
1906
1896
  exitOnError: true
1907
1897
  });
1908
1898
  const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
1909
- if (!await hfs8.isFile(projectJsonPath)) {
1899
+ if (!await hfs5.isFile(projectJsonPath)) {
1910
1900
  throw new Error("Cannot find project.json configuration");
1911
1901
  }
1912
- const projectJson = await hfs8.json(projectJsonPath);
1902
+ const projectJson = await hfs5.json(projectJsonPath);
1913
1903
  const projectName = projectJson.name;
1914
- const projectConfigurations = readProjectsConfigurationFromProjectGraph4(projectGraph);
1904
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph3(projectGraph);
1915
1905
  if (!projectConfigurations?.projects?.[projectName]) {
1916
1906
  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.");
1917
1907
  }
@@ -1919,7 +1909,7 @@ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
1919
1909
  options.name ??= `${projectName}-${options.format}`;
1920
1910
  options.target ??= DEFAULT_TARGET;
1921
1911
  const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
1922
- if (!await hfs8.isFile(packageJsonPath)) {
1912
+ if (!await hfs5.isFile(packageJsonPath)) {
1923
1913
  throw new Error("Cannot find package.json configuration");
1924
1914
  }
1925
1915
  const env = getEnv("tsdown", options);
@@ -1974,14 +1964,14 @@ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
1974
1964
  return result;
1975
1965
  }, "resolveOptions");
1976
1966
  async function generatePackageJson2(options) {
1977
- if (options.generatePackageJson !== false && await hfs8.isFile(joinPaths(options.projectRoot, "package.json"))) {
1967
+ if (options.generatePackageJson !== false && await hfs5.isFile(joinPaths(options.projectRoot, "package.json"))) {
1978
1968
  writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
1979
1969
  const stopwatch = getStopwatch("Write package.json file");
1980
1970
  const packageJsonPath = joinPaths(options.projectRoot, "project.json");
1981
- if (!await hfs8.isFile(packageJsonPath)) {
1971
+ if (!await hfs5.isFile(packageJsonPath)) {
1982
1972
  throw new Error("Cannot find package.json configuration");
1983
1973
  }
1984
- let packageJson = await hfs8.json(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"));
1974
+ let packageJson = await hfs5.json(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"));
1985
1975
  if (!packageJson) {
1986
1976
  throw new Error("Cannot find package.json configuration file");
1987
1977
  }
@@ -2159,21 +2149,25 @@ var executor_default9 = withRunExecutor("Typia runtime validation generator", ty
2159
2149
  });
2160
2150
 
2161
2151
  // ../unbuild/src/build.ts
2162
- import { hfs as hfs10 } from "@humanfs/node";
2163
- import { createProjectGraphAsync as createProjectGraphAsync6, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph5, writeJsonFile as writeJsonFile3 } from "@nx/devkit";
2152
+ import { readCachedProjectGraph as readCachedProjectGraph4, writeJsonFile as writeJsonFile3 } from "@nx/devkit";
2164
2153
  import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
2165
2154
  import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies3 } from "@nx/js/src/utils/buildable-libs-utils";
2166
2155
  import defu3 from "defu";
2156
+ import { createJiti } from "jiti";
2157
+ import { existsSync as existsSync4 } from "node:fs";
2158
+ import { readFile as readFile5 } from "node:fs/promises";
2167
2159
  import { relative as relative4 } from "node:path";
2168
2160
  import { findWorkspaceRoot as findWorkspaceRoot4 } from "nx/src/utils/find-workspace-root";
2169
- import { build as unbuild } from "unbuild";
2170
2161
 
2171
2162
  // ../unbuild/src/clean.ts
2172
- import { hfs as hfs9 } from "@humanfs/node";
2163
+ import { rm } from "node:fs/promises";
2173
2164
  async function clean3(name = "Unbuild", directory, config) {
2174
2165
  writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2175
2166
  const stopwatch = getStopwatch(`${name} output clean`);
2176
- await hfs9.deleteAll(directory);
2167
+ await rm(directory, {
2168
+ recursive: true,
2169
+ force: true
2170
+ });
2177
2171
  stopwatch();
2178
2172
  }
2179
2173
  __name(clean3, "clean");
@@ -2224,28 +2218,8 @@ ${error ? error.message : "Unknown build error"}
2224
2218
  }
2225
2219
  }), "onErrorPlugin");
2226
2220
 
2227
- // ../unbuild/src/plugins/swc.ts
2228
- var swcPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
2229
- const { transform: transform3 } = __require("@swc/core");
2230
- return {
2231
- name: "storm:swc",
2232
- transform(code, filename) {
2233
- return transform3(code, {
2234
- filename,
2235
- jsc: {
2236
- transform: {
2237
- react: {
2238
- runtime: "automatic"
2239
- }
2240
- }
2241
- }
2242
- });
2243
- }
2244
- };
2245
- }, "swcPlugin");
2246
-
2247
2221
  // ../unbuild/src/plugins/tsc.ts
2248
- import { createProjectGraphAsync as createProjectGraphAsync5 } from "@nx/devkit";
2222
+ import { readCachedProjectGraph as readCachedProjectGraph3 } from "@nx/devkit";
2249
2223
  import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
2250
2224
  import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
2251
2225
  import ts2Plugin from "rollup-plugin-typescript2";
@@ -2278,9 +2252,7 @@ __name(createTsCompilerOptions, "createTsCompilerOptions");
2278
2252
 
2279
2253
  // ../unbuild/src/plugins/tsc.ts
2280
2254
  var tscPlugin2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
2281
- const projectGraph = await createProjectGraphAsync5({
2282
- exitOnError: true
2283
- });
2255
+ const projectGraph = readCachedProjectGraph3();
2284
2256
  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);
2285
2257
  let dependencies = result.dependencies;
2286
2258
  const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
@@ -2299,37 +2271,39 @@ var tscPlugin2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
2299
2271
 
2300
2272
  // ../unbuild/src/plugins/type-definitions.ts
2301
2273
  import { relative as relative3 } from "node:path";
2302
- var typeDefinitions = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2303
- name: "storm:dts-bundle",
2304
- async generateBundle(_opts, bundle) {
2305
- for (const file of Object.values(bundle)) {
2306
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
2307
- continue;
2308
- }
2309
- const hasDefaultExport = file.exports.includes("default");
2310
- const entrySourceFileName = relative3(options.projectRoot, file.facadeModuleId);
2311
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
2312
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
2313
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
2314
- const dtsFileSource = hasDefaultExport ? `
2274
+ function typeDefinitions(projectRoot) {
2275
+ return {
2276
+ name: "storm:dts-bundle",
2277
+ async generateBundle(_opts, bundle) {
2278
+ for (const file of Object.values(bundle)) {
2279
+ if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
2280
+ continue;
2281
+ }
2282
+ const hasDefaultExport = file.exports.includes("default");
2283
+ const entrySourceFileName = relative3(projectRoot, file.facadeModuleId);
2284
+ const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
2285
+ const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
2286
+ const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
2287
+ const dtsFileSource = hasDefaultExport ? `
2315
2288
  export * from ${relativeSourceDtsName};
2316
2289
  export { default } from ${relativeSourceDtsName};
2317
2290
  ` : `export * from ${relativeSourceDtsName};
2318
2291
  `;
2319
- this.emitFile({
2320
- type: "asset",
2321
- fileName: dtsFileName,
2322
- source: dtsFileSource
2323
- });
2292
+ this.emitFile({
2293
+ type: "asset",
2294
+ fileName: dtsFileName,
2295
+ source: dtsFileSource
2296
+ });
2297
+ }
2324
2298
  }
2325
- }
2326
- }), "typeDefinitions");
2299
+ };
2300
+ }
2301
+ __name(typeDefinitions, "typeDefinitions");
2327
2302
 
2328
2303
  // ../unbuild/src/config.ts
2329
2304
  var getDefaultBuildPlugins2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
2330
2305
  analyzePlugin(options, resolvedOptions),
2331
- swcPlugin(options, resolvedOptions),
2332
- typeDefinitions(options, resolvedOptions),
2306
+ typeDefinitions(resolvedOptions.projectRoot),
2333
2307
  tscPlugin2(options, resolvedOptions),
2334
2308
  onErrorPlugin2(options, resolvedOptions)
2335
2309
  ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
@@ -2354,38 +2328,34 @@ async function resolveOptions3(options) {
2354
2328
  options = defu3(options, configFile);
2355
2329
  }
2356
2330
  }
2357
- const projectGraph = await createProjectGraphAsync6({
2358
- exitOnError: true
2359
- });
2331
+ const projectGraph = readCachedProjectGraph4();
2360
2332
  const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
2361
- if (!await hfs10.isFile(projectJsonPath)) {
2333
+ if (!existsSync4(projectJsonPath)) {
2362
2334
  throw new Error("Cannot find project.json configuration");
2363
2335
  }
2364
- const projectJson = await hfs10.json(projectJsonPath);
2336
+ const projectJsonContent = await readFile5(projectJsonPath, "utf8");
2337
+ const projectJson = JSON.parse(projectJsonContent);
2365
2338
  const projectName = projectJson.name;
2366
2339
  const packageJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "package.json");
2367
- if (!await hfs10.isFile(packageJsonPath)) {
2340
+ if (!existsSync4(packageJsonPath)) {
2368
2341
  throw new Error("Cannot find package.json configuration");
2369
2342
  }
2370
- const packageJson = await hfs10.json(packageJsonPath);
2343
+ const packageJsonContent = await readFile5(packageJsonPath, "utf8");
2344
+ const packageJson = JSON.parse(packageJsonContent);
2371
2345
  let tsconfig = options.tsconfig;
2372
2346
  if (!tsconfig) {
2373
2347
  tsconfig = joinPaths(workspaceRoot3.dir, projectRoot, "tsconfig.json");
2374
2348
  }
2375
- if (!await hfs10.isFile(tsconfig)) {
2349
+ if (!existsSync4(tsconfig)) {
2376
2350
  throw new Error("Cannot find tsconfig.json configuration");
2377
2351
  }
2378
2352
  let sourceRoot = projectJson.sourceRoot;
2379
2353
  if (!sourceRoot) {
2380
2354
  sourceRoot = joinPaths(projectRoot, "src");
2381
2355
  }
2382
- if (!await hfs10.isDirectory(sourceRoot)) {
2356
+ if (!existsSync4(sourceRoot)) {
2383
2357
  throw new Error("Cannot find sourceRoot directory");
2384
2358
  }
2385
- const projectConfigurations = readProjectsConfigurationFromProjectGraph5(projectGraph);
2386
- if (!projectConfigurations?.projects?.[projectName]) {
2387
- 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.");
2388
- }
2389
2359
  const result = calculateProjectBuildableDependencies3(void 0, projectGraph, workspaceRoot3.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
2390
2360
  let dependencies = result.dependencies;
2391
2361
  const tsLibDependency = getHelperDependency2(HelperDependency2.tsc, tsconfig, dependencies, projectGraph, true);
@@ -2393,6 +2363,11 @@ async function resolveOptions3(options) {
2393
2363
  dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
2394
2364
  dependencies.push(tsLibDependency);
2395
2365
  }
2366
+ const jiti = createJiti(config.workspaceRoot, {
2367
+ cache: true,
2368
+ fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
2369
+ interopDefault: true
2370
+ });
2396
2371
  const resolvedOptions = {
2397
2372
  name: projectName,
2398
2373
  config,
@@ -2400,6 +2375,7 @@ async function resolveOptions3(options) {
2400
2375
  sourceRoot,
2401
2376
  projectName,
2402
2377
  tsconfig,
2378
+ jiti,
2403
2379
  clean: false,
2404
2380
  entries: [
2405
2381
  {
@@ -2466,7 +2442,7 @@ async function resolveOptions3(options) {
2466
2442
  ]
2467
2443
  },
2468
2444
  esbuild: {
2469
- minify: !!options.minify,
2445
+ minify: options.minify !== false,
2470
2446
  splitting: options.splitting !== false,
2471
2447
  treeShaking: options.treeShaking !== false,
2472
2448
  color: true,
@@ -2506,31 +2482,44 @@ async function resolveOptions3(options) {
2506
2482
  }
2507
2483
  __name(resolveOptions3, "resolveOptions");
2508
2484
  async function generatePackageJson3(options) {
2509
- if (options.generatePackageJson !== false && await hfs10.isFile(joinPaths(options.projectRoot, "package.json"))) {
2485
+ if (options.generatePackageJson !== false && existsSync4(joinPaths(options.projectRoot, "package.json"))) {
2510
2486
  writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
2511
2487
  const stopwatch = getStopwatch("Write package.json file");
2512
2488
  const packageJsonPath = joinPaths(options.projectRoot, "project.json");
2513
- if (!await hfs10.isFile(packageJsonPath)) {
2489
+ if (!existsSync4(packageJsonPath)) {
2514
2490
  throw new Error("Cannot find package.json configuration");
2515
2491
  }
2516
- let packageJson = await hfs10.json(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"));
2517
- if (!packageJson) {
2492
+ let packageJsonContent = await readFile5(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
2493
+ if (!packageJsonContent) {
2518
2494
  throw new Error("Cannot find package.json configuration file");
2519
2495
  }
2496
+ let packageJson = JSON.parse(packageJsonContent);
2520
2497
  packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
2521
2498
  packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
2522
- packageJson = await addPackageJsonExports(options.sourceRoot, packageJson);
2523
- await writeJsonFile3(joinPaths(options.outDir, "package.json"), packageJson);
2499
+ await writeJsonFile3(joinPaths(options.outDir, "package.json"), await addPackageJsonExports(options.sourceRoot, packageJson));
2524
2500
  stopwatch();
2525
2501
  }
2526
2502
  return options;
2527
2503
  }
2528
2504
  __name(generatePackageJson3, "generatePackageJson");
2505
+ async function resolveUnbuild(options) {
2506
+ writeTrace(`Resolving Unbuild package with Jiti`, options.config);
2507
+ try {
2508
+ return options.jiti.import("unbuild");
2509
+ } catch (error) {
2510
+ writeError(" \u274C An error occurred while resolving the Unbuild package", options.config);
2511
+ throw new Error("An error occurred while resolving the Unbuild package", {
2512
+ cause: error
2513
+ });
2514
+ }
2515
+ }
2516
+ __name(resolveUnbuild, "resolveUnbuild");
2529
2517
  async function executeUnbuild(options) {
2530
2518
  writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
2531
2519
  const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
2532
2520
  try {
2533
- await unbuild(options.projectRoot, false, {
2521
+ const unbuild = await resolveUnbuild(options);
2522
+ await unbuild.build(options.projectRoot, false, {
2534
2523
  ...options,
2535
2524
  rootDir: options.projectRoot
2536
2525
  });
@@ -4021,7 +4010,7 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4021
4010
  import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/project-graph/utils/retrieve-workspace-files";
4022
4011
 
4023
4012
  // ../workspace-tools/src/utils/lock-file.ts
4024
- import { existsSync as existsSync2 } from "node:fs";
4013
+ import { existsSync as existsSync5 } from "node:fs";
4025
4014
  import { join as join2 } from "node:path";
4026
4015
  import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "nx/src/devkit-exports";
4027
4016
  import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";