@storm-software/cloudflare-tools 0.50.2 → 0.50.3

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 (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-IUVV2SM4.js → chunk-3JJSMPBT.js} +41 -41
  4. package/dist/{chunk-T6VDL633.mjs → chunk-6PVMDNO7.mjs} +44 -482
  5. package/dist/{chunk-JCB2DTP6.js → chunk-ABCBYQGV.js} +3 -3
  6. package/dist/{chunk-7VU6EPB4.js → chunk-AXWOHQDN.js} +1 -1
  7. package/dist/{chunk-ULTJPRDX.js → chunk-MHBXIMZJ.js} +183 -621
  8. package/dist/{chunk-SUASGTND.js → chunk-O2XVQQLQ.js} +16 -16
  9. package/dist/{chunk-6RM4MALM.mjs → chunk-O6M6COTZ.mjs} +1 -1
  10. package/dist/{chunk-VYOULWAK.mjs → chunk-OTQ3T47C.mjs} +1 -1
  11. package/dist/{chunk-RCE3CC76.js → chunk-TH4KH35P.js} +1 -2
  12. package/dist/{chunk-HPCGVJ7R.mjs → chunk-TKQA6SOX.mjs} +3 -3
  13. package/dist/{chunk-4AK2RSE7.mjs → chunk-U7RXDO26.mjs} +3 -3
  14. package/dist/{chunk-4AMWR76J.mjs → chunk-UOZU7VQX.mjs} +1 -1
  15. package/dist/{chunk-NSLK6ZDO.mjs → chunk-XBFOA367.mjs} +0 -1
  16. package/dist/{chunk-MH545KJZ.js → chunk-YYQ6E55Y.js} +12 -12
  17. package/dist/executors.js +5 -5
  18. package/dist/executors.mjs +5 -5
  19. package/dist/generators.js +5 -5
  20. package/dist/generators.mjs +4 -4
  21. package/dist/index.js +8 -8
  22. package/dist/index.mjs +7 -7
  23. package/dist/src/executors/cloudflare-publish/executor.js +3 -3
  24. package/dist/src/executors/cloudflare-publish/executor.mjs +3 -3
  25. package/dist/src/executors/r2-upload-publish/executor.js +5 -5
  26. package/dist/src/executors/r2-upload-publish/executor.mjs +4 -4
  27. package/dist/src/executors/serve/executor.js +4 -4
  28. package/dist/src/executors/serve/executor.mjs +3 -3
  29. package/dist/src/generators/init/generator.js +2 -2
  30. package/dist/src/generators/init/generator.mjs +1 -1
  31. package/dist/src/generators/worker/generator.js +5 -5
  32. package/dist/src/generators/worker/generator.mjs +4 -4
  33. package/dist/src/utils/index.js +3 -3
  34. package/dist/src/utils/index.mjs +2 -2
  35. package/dist/src/utils/r2-bucket-helpers.js +3 -3
  36. package/dist/src/utils/r2-bucket-helpers.mjs +2 -2
  37. package/package.json +1 -1
@@ -4,9 +4,8 @@ import {
4
4
  } from "./chunk-XU6MTFCV.mjs";
5
5
  import {
6
6
  loadStormConfig
7
- } from "./chunk-4AMWR76J.mjs";
7
+ } from "./chunk-UOZU7VQX.mjs";
8
8
  import {
9
- LogLevelLabel,
10
9
  StormConfigSchema,
11
10
  correctPaths,
12
11
  findWorkspaceRoot,
@@ -21,7 +20,7 @@ import {
21
20
  writeSuccess,
22
21
  writeTrace,
23
22
  writeWarning
24
- } from "./chunk-NSLK6ZDO.mjs";
23
+ } from "./chunk-XBFOA367.mjs";
25
24
  import {
26
25
  __dirname,
27
26
  __name,
@@ -516,7 +515,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
516
515
  }, "readNxConfig");
517
516
 
518
517
  // ../build-tools/src/utilities/copy-assets.ts
519
- var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson4 = true, includeSrc = false, banner, footer) => {
518
+ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson3 = true, includeSrc = false, banner, footer) => {
520
519
  const pendingAssets = Array.from(assets ?? []);
521
520
  if (!pendingAssets?.some((asset) => asset?.glob === "*.md")) {
522
521
  pendingAssets.push({
@@ -525,7 +524,7 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
525
524
  output: "/"
526
525
  });
527
526
  }
528
- if (generatePackageJson4 === false) {
527
+ if (generatePackageJson3 === false) {
529
528
  pendingAssets.push({
530
529
  input: sourceRoot,
531
530
  glob: "package.json",
@@ -704,34 +703,6 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
704
703
  }
705
704
  };
706
705
  }, "addPackageJsonExport");
707
- var addPackageJsonExports = /* @__PURE__ */ __name(async (sourceRoot, packageJson) => {
708
- packageJson.exports ??= {};
709
- const files = await new Glob("**/*.{ts,tsx}", {
710
- absolute: false,
711
- cwd: sourceRoot,
712
- root: sourceRoot
713
- }).walk();
714
- files.forEach((file) => {
715
- addPackageJsonExport(file, packageJson.type, sourceRoot);
716
- const split = file.split(".");
717
- split.pop();
718
- const entry = split.join(".").replaceAll("\\", "/");
719
- packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, sourceRoot);
720
- });
721
- packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
722
- packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
723
- packageJson.types = "./dist/index.d.ts";
724
- packageJson.exports ??= {};
725
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
726
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
727
- ret[key.replace("/index", "")] = packageJson.exports[key];
728
- }
729
- return ret;
730
- }, packageJson.exports);
731
- packageJson.exports["./package.json"] ??= "./package.json";
732
- packageJson.exports["."] = packageJson.exports["."] ?? addPackageJsonExport("index", packageJson.type, sourceRoot);
733
- return packageJson;
734
- }, "addPackageJsonExports");
735
706
 
736
707
  // ../build-tools/src/utilities/get-entry-points.ts
737
708
  import { glob as glob2 } from "glob";
@@ -976,8 +947,8 @@ __name(clean, "clean");
976
947
  import * as esbuild from "esbuild";
977
948
  var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
978
949
  name: "storm:esm-split-code-to-cjs",
979
- setup(build6) {
980
- build6.onEnd(async (result) => {
950
+ setup(build5) {
951
+ build5.onEnd(async (result) => {
981
952
  const outFiles = Object.keys(result.metafile?.outputs ?? {});
982
953
  const jsFiles = outFiles.filter((f) => f.endsWith("js"));
983
954
  await esbuild.build({
@@ -995,15 +966,15 @@ var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions)
995
966
  // ../esbuild/src/plugins/fix-imports.ts
996
967
  var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
997
968
  name: "storm:fix-imports",
998
- setup(build6) {
999
- build6.onResolve({
969
+ setup(build5) {
970
+ build5.onResolve({
1000
971
  filter: /^spdx-exceptions/
1001
972
  }, () => {
1002
973
  return {
1003
974
  path: __require.resolve("spdx-exceptions")
1004
975
  };
1005
976
  });
1006
- build6.onResolve({
977
+ build5.onResolve({
1007
978
  filter: /^spdx-license-ids/
1008
979
  }, () => {
1009
980
  return {
@@ -1018,8 +989,8 @@ import { dirname } from "node:path";
1018
989
  var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
1019
990
  return {
1020
991
  name: "native-node-modules",
1021
- setup(build6) {
1022
- build6.onResolve({
992
+ setup(build5) {
993
+ build5.onResolve({
1023
994
  filter: /\.node$/,
1024
995
  namespace: "file"
1025
996
  }, (args) => {
@@ -1038,7 +1009,7 @@ var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions)
1038
1009
  path: resolvedId
1039
1010
  };
1040
1011
  });
1041
- build6.onLoad({
1012
+ build5.onLoad({
1042
1013
  filter: /.*/,
1043
1014
  namespace: "node-file"
1044
1015
  }, (args) => {
@@ -1051,14 +1022,14 @@ var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions)
1051
1022
  resolveDir: dirname(args.path)
1052
1023
  };
1053
1024
  });
1054
- build6.onResolve({
1025
+ build5.onResolve({
1055
1026
  filter: /\.node$/,
1056
1027
  namespace: "node-file"
1057
1028
  }, (args) => ({
1058
1029
  path: args.path,
1059
1030
  namespace: "file"
1060
1031
  }));
1061
- const opts = build6.initialOptions;
1032
+ const opts = build5.initialOptions;
1062
1033
  opts.loader = opts.loader || {};
1063
1034
  opts.loader[".node"] = "file";
1064
1035
  }
@@ -1084,8 +1055,8 @@ var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
1084
1055
  // ../esbuild/src/plugins/on-error.ts
1085
1056
  var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
1086
1057
  name: "storm:on-error",
1087
- setup(build6) {
1088
- build6.onEnd((result) => {
1058
+ setup(build5) {
1059
+ build5.onEnd((result) => {
1089
1060
  if (result.errors.length > 0 && process.env.WATCH !== "true") {
1090
1061
  writeError(`The following errors occurred during the build:
1091
1062
  ${result.errors.map((error) => error.text).join("\n")}
@@ -1121,14 +1092,14 @@ function resolvePathsConfig(options, cwd) {
1121
1092
  __name(resolvePathsConfig, "resolvePathsConfig");
1122
1093
  var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
1123
1094
  name: "storm:resolve-paths",
1124
- setup(build6) {
1125
- const parentTsConfig = build6.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build6.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
1095
+ setup(build5) {
1096
+ const parentTsConfig = build5.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build5.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
1126
1097
  const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
1127
1098
  const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
1128
- build6.onResolve({
1099
+ build5.onResolve({
1129
1100
  filter: packagesRegex
1130
1101
  }, (args) => {
1131
- if (build6.initialOptions.external?.includes(args.path)) {
1102
+ if (build5.initialOptions.external?.includes(args.path)) {
1132
1103
  return {
1133
1104
  path: args.path,
1134
1105
  external: true
@@ -1202,11 +1173,11 @@ function bundleTypeDefinitions(filename, outfile, externals, options) {
1202
1173
  __name(bundleTypeDefinitions, "bundleTypeDefinitions");
1203
1174
  var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
1204
1175
  name: "storm:tsc",
1205
- setup(build6) {
1176
+ setup(build5) {
1206
1177
  if (options.emitTypes === false) {
1207
1178
  return;
1208
1179
  }
1209
- build6.onStart(async () => {
1180
+ build5.onStart(async () => {
1210
1181
  if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
1211
1182
  await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
1212
1183
  }
@@ -1329,7 +1300,7 @@ var missingIgnore = [
1329
1300
  ];
1330
1301
  var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
1331
1302
  name: "storm:deps-check",
1332
- setup(build6) {
1303
+ setup(build5) {
1333
1304
  const pkgJsonPath = path5.join(process.cwd(), "package.json");
1334
1305
  const pkgContents = __require(pkgJsonPath);
1335
1306
  const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
@@ -1341,7 +1312,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
1341
1312
  ];
1342
1313
  const collectedDependencies = /* @__PURE__ */ new Set();
1343
1314
  const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
1344
- build6.onResolve({
1315
+ build5.onResolve({
1345
1316
  filter: onlyPackages
1346
1317
  }, (args) => {
1347
1318
  if (args.importer.includes(process.cwd())) {
@@ -1357,7 +1328,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
1357
1328
  external: true
1358
1329
  };
1359
1330
  });
1360
- build6.onEnd(() => {
1331
+ build5.onEnd(() => {
1361
1332
  const unusedDependencies = [
1362
1333
  ...dependencies
1363
1334
  ].filter((dep) => {
@@ -2148,429 +2119,20 @@ var executor_default9 = withRunExecutor("Typia runtime validation generator", ty
2148
2119
  }
2149
2120
  });
2150
2121
 
2151
- // ../unbuild/src/build.ts
2152
- import { readCachedProjectGraph as readCachedProjectGraph4, writeJsonFile as writeJsonFile3 } from "@nx/devkit";
2153
- import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
2154
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies3 } from "@nx/js/src/utils/buildable-libs-utils";
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";
2159
- import { relative as relative4 } from "node:path";
2160
- import { findWorkspaceRoot as findWorkspaceRoot4 } from "nx/src/utils/find-workspace-root";
2161
-
2162
- // ../unbuild/src/clean.ts
2163
- import { rm } from "node:fs/promises";
2164
- async function clean3(name = "Unbuild", directory, config) {
2165
- writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2166
- const stopwatch = getStopwatch(`${name} output clean`);
2167
- await rm(directory, {
2168
- recursive: true,
2169
- force: true
2170
- });
2171
- stopwatch();
2172
- }
2173
- __name(clean3, "clean");
2174
-
2175
- // ../unbuild/src/plugins/analyze.ts
2176
- var formatBytes = /* @__PURE__ */ __name((bytes) => {
2177
- if (bytes === 0) return "0 Byte";
2178
- const k = 1e3;
2179
- const dm = 3;
2180
- const sizes = [
2181
- "Bytes",
2182
- "KB",
2183
- "MB",
2184
- "GB"
2185
- ];
2186
- const i = Math.floor(Math.log(bytes) / Math.log(k));
2187
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
2188
- }, "formatBytes");
2189
- var analyzePlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
2190
- return {
2191
- name: "storm:analyzer",
2192
- renderChunk(source, chunk) {
2193
- const sourceBytes = formatBytes(source.length);
2194
- const fileName = chunk.fileName;
2195
- writeInfo(` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
2196
- }
2197
- };
2198
- }, "analyzePlugin");
2199
-
2200
- // ../unbuild/src/plugins/on-error.ts
2201
- var onErrorPlugin2 = /* @__PURE__ */ __name((options, resolvedOptions) => ({
2202
- name: "storm:on-error",
2203
- buildEnd(error) {
2204
- if (error) {
2205
- writeError(`The following errors occurred during the build:
2206
- ${error ? error.message : "Unknown build error"}
2207
-
2208
- `, resolvedOptions.config);
2209
- throw new Error("Storm unbuild process failed with errors.");
2210
- }
2211
- },
2212
- renderError(error) {
2213
- writeError(`The following errors occurred during the build:
2214
- ${error ? error.message : "Unknown build error"}
2215
-
2216
- `, resolvedOptions.config);
2217
- throw new Error("Storm unbuild process failed with errors.");
2218
- }
2219
- }), "onErrorPlugin");
2220
-
2221
- // ../unbuild/src/plugins/tsc.ts
2222
- import { readCachedProjectGraph as readCachedProjectGraph3 } from "@nx/devkit";
2223
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
2224
- import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
2225
- import ts2Plugin from "rollup-plugin-typescript2";
2226
-
2227
- // ../unbuild/src/utilities/helpers.ts
2228
- import { joinPathFragments as joinPathFragments4 } from "@nx/devkit";
2229
- import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
2230
- import { dirname as dirname2, extname } from "node:path";
2231
- import { pathToFileURL } from "node:url";
2232
- import ts from "typescript";
2233
- async function loadConfig(configPath) {
2234
- if (!/\.(js|mjs)$/.test(extname(configPath))) {
2235
- throw new Error("Unsupported config file format");
2236
- }
2237
- return import(pathToFileURL(configPath).toString()).then((config) => config.default);
2238
- }
2239
- __name(loadConfig, "loadConfig");
2240
- async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
2241
- const tsConfigFile = ts.readConfigFile(joinPathFragments4(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
2242
- const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname2(joinPathFragments4(config.workspaceRoot, projectRoot, tsConfigPath)));
2243
- const compilerOptions = {
2244
- rootDir: projectRoot,
2245
- declaration: true,
2246
- paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
2247
- };
2248
- writeTrace(compilerOptions, config);
2249
- return compilerOptions;
2250
- }
2251
- __name(createTsCompilerOptions, "createTsCompilerOptions");
2252
-
2253
- // ../unbuild/src/plugins/tsc.ts
2254
- var tscPlugin2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
2255
- const projectGraph = readCachedProjectGraph3();
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);
2257
- let dependencies = result.dependencies;
2258
- const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
2259
- if (tsLibDependency) {
2260
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
2261
- dependencies.push(tsLibDependency);
2262
- }
2263
- return ts2Plugin({
2264
- check: options.emitTypes !== false,
2265
- tsconfig: resolvedOptions.tsconfig,
2266
- tsconfigOverride: {
2267
- compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
2268
- }
2269
- });
2270
- }, "tscPlugin");
2271
-
2272
- // ../unbuild/src/plugins/type-definitions.ts
2273
- import { relative as relative3 } from "node:path";
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 ? `
2288
- export * from ${relativeSourceDtsName};
2289
- export { default } from ${relativeSourceDtsName};
2290
- ` : `export * from ${relativeSourceDtsName};
2291
- `;
2292
- this.emitFile({
2293
- type: "asset",
2294
- fileName: dtsFileName,
2295
- source: dtsFileSource
2296
- });
2297
- }
2298
- }
2299
- };
2300
- }
2301
- __name(typeDefinitions, "typeDefinitions");
2302
-
2303
- // ../unbuild/src/config.ts
2304
- var getDefaultBuildPlugins2 = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
2305
- analyzePlugin(options, resolvedOptions),
2306
- typeDefinitions(resolvedOptions.projectRoot),
2307
- tscPlugin2(options, resolvedOptions),
2308
- onErrorPlugin2(options, resolvedOptions)
2309
- ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
2310
-
2311
- // ../unbuild/src/build.ts
2312
- async function resolveOptions3(options) {
2313
- const projectRoot = options.projectRoot;
2314
- if (!projectRoot) {
2315
- throw new Error("Cannot find project root");
2316
- }
2317
- const outputPath = options.outputPath || joinPaths("dist", projectRoot);
2318
- const workspaceRoot3 = findWorkspaceRoot4(projectRoot);
2319
- if (!workspaceRoot3) {
2320
- throw new Error("Cannot find workspace root");
2321
- }
2322
- const config = await loadStormConfig(workspaceRoot3.dir);
2323
- writeDebug(" \u2699\uFE0F Resolving build options", config);
2324
- const stopwatch = getStopwatch("Build options resolution");
2325
- if (options.configPath) {
2326
- const configFile = await loadConfig(options.configPath);
2327
- if (configFile) {
2328
- options = defu3(options, configFile);
2329
- }
2330
- }
2331
- const projectGraph = readCachedProjectGraph4();
2332
- const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
2333
- if (!existsSync4(projectJsonPath)) {
2334
- throw new Error("Cannot find project.json configuration");
2335
- }
2336
- const projectJsonContent = await readFile5(projectJsonPath, "utf8");
2337
- const projectJson = JSON.parse(projectJsonContent);
2338
- const projectName = projectJson.name;
2339
- const packageJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "package.json");
2340
- if (!existsSync4(packageJsonPath)) {
2341
- throw new Error("Cannot find package.json configuration");
2342
- }
2343
- const packageJsonContent = await readFile5(packageJsonPath, "utf8");
2344
- const packageJson = JSON.parse(packageJsonContent);
2345
- let tsconfig = options.tsconfig;
2346
- if (!tsconfig) {
2347
- tsconfig = joinPaths(workspaceRoot3.dir, projectRoot, "tsconfig.json");
2348
- }
2349
- if (!existsSync4(tsconfig)) {
2350
- throw new Error("Cannot find tsconfig.json configuration");
2351
- }
2352
- let sourceRoot = projectJson.sourceRoot;
2353
- if (!sourceRoot) {
2354
- sourceRoot = joinPaths(projectRoot, "src");
2355
- }
2356
- if (!existsSync4(sourceRoot)) {
2357
- throw new Error("Cannot find sourceRoot directory");
2358
- }
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);
2360
- let dependencies = result.dependencies;
2361
- const tsLibDependency = getHelperDependency2(HelperDependency2.tsc, tsconfig, dependencies, projectGraph, true);
2362
- if (tsLibDependency) {
2363
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
2364
- dependencies.push(tsLibDependency);
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
- });
2371
- const resolvedOptions = {
2372
- name: projectName,
2373
- config,
2374
- projectRoot,
2375
- sourceRoot,
2376
- projectName,
2377
- tsconfig,
2378
- jiti,
2379
- clean: false,
2380
- entries: [
2381
- {
2382
- builder: "mkdist",
2383
- input: `.${sourceRoot.replace(projectRoot, "")}`,
2384
- outDir: joinPaths(relative4(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
2385
- declaration: options.emitTypes !== false,
2386
- format: "esm"
2387
- },
2388
- {
2389
- builder: "mkdist",
2390
- input: `.${sourceRoot.replace(projectRoot, "")}`,
2391
- outDir: joinPaths(relative4(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
2392
- declaration: options.emitTypes !== false,
2393
- format: "cjs",
2394
- ext: "cjs"
2395
- }
2396
- ],
2397
- declaration: options.emitTypes !== false ? "compatible" : false,
2398
- failOnWarn: false,
2399
- sourcemap: options.sourcemap ?? !!options.debug,
2400
- outDir: outputPath,
2401
- parallel: true,
2402
- stub: false,
2403
- stubOptions: {
2404
- jiti: {}
2405
- },
2406
- externals: options.external ?? [],
2407
- dependencies: [],
2408
- peerDependencies: [],
2409
- devDependencies: [],
2410
- hooks: {},
2411
- alias: {},
2412
- replace: {},
2413
- rollup: {
2414
- replace: {},
2415
- alias: {},
2416
- json: {},
2417
- commonjs: {
2418
- sourceMap: options.sourcemap ?? true
2419
- },
2420
- emitCJS: true,
2421
- cjsBridge: true,
2422
- dts: {
2423
- respectExternal: true,
2424
- tsconfig
2425
- },
2426
- output: {
2427
- banner: options.banner || `
2428
- // \u26A1 Built by Storm Software
2429
- `,
2430
- footer: options.footer
2431
- },
2432
- resolve: {
2433
- preferBuiltins: true,
2434
- extensions: [
2435
- ".cjs",
2436
- ".mjs",
2437
- ".js",
2438
- ".jsx",
2439
- ".ts",
2440
- ".tsx",
2441
- ".json"
2442
- ]
2443
- },
2444
- esbuild: {
2445
- minify: options.minify !== false,
2446
- splitting: options.splitting !== false,
2447
- treeShaking: options.treeShaking !== false,
2448
- color: true,
2449
- logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
2450
- }
2451
- }
2452
- };
2453
- dependencies = dependencies.filter((dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app");
2454
- if (dependencies.length > 0) {
2455
- resolvedOptions.dependencies = dependencies.map((dep) => dep.name);
2456
- }
2457
- if (packageJson.devDependencies) {
2458
- resolvedOptions.devDependencies = Object.keys(packageJson.devDependencies);
2459
- }
2460
- if (packageJson.peerDependencies) {
2461
- resolvedOptions.peerDependencies = Object.keys(packageJson.peerDependencies);
2462
- }
2463
- if (options.rollup) {
2464
- let rollup = {};
2465
- if (typeof options.rollup === "string") {
2466
- const rollupFile = await loadConfig(options.rollup);
2467
- if (rollupFile) {
2468
- rollup = rollupFile;
2469
- }
2470
- } else {
2471
- rollup = options.rollup;
2472
- }
2473
- resolvedOptions.rollup = defu3(resolvedOptions.rollup ?? {}, rollup);
2474
- }
2475
- resolvedOptions.hooks = {
2476
- "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
2477
- opts.plugins = options.plugins ?? await getDefaultBuildPlugins2(options, resolvedOptions);
2478
- }, "rollup:options")
2479
- };
2480
- stopwatch();
2481
- return resolvedOptions;
2482
- }
2483
- __name(resolveOptions3, "resolveOptions");
2484
- async function generatePackageJson3(options) {
2485
- if (options.generatePackageJson !== false && existsSync4(joinPaths(options.projectRoot, "package.json"))) {
2486
- writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
2487
- const stopwatch = getStopwatch("Write package.json file");
2488
- const packageJsonPath = joinPaths(options.projectRoot, "project.json");
2489
- if (!existsSync4(packageJsonPath)) {
2490
- throw new Error("Cannot find package.json configuration");
2491
- }
2492
- let packageJsonContent = await readFile5(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
2493
- if (!packageJsonContent) {
2494
- throw new Error("Cannot find package.json configuration file");
2495
- }
2496
- let packageJson = JSON.parse(packageJsonContent);
2497
- packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
2498
- packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
2499
- await writeJsonFile3(joinPaths(options.outDir, "package.json"), await addPackageJsonExports(options.sourceRoot, packageJson));
2500
- stopwatch();
2501
- }
2502
- return options;
2503
- }
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");
2517
- async function executeUnbuild(options) {
2518
- writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
2519
- const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
2520
- try {
2521
- const unbuild = await resolveUnbuild(options);
2522
- await unbuild.build(options.projectRoot, false, {
2523
- ...options,
2524
- rootDir: options.projectRoot
2525
- });
2526
- } finally {
2527
- stopwatch();
2528
- }
2529
- return options;
2530
- }
2531
- __name(executeUnbuild, "executeUnbuild");
2532
- async function copyBuildAssets3(options) {
2533
- writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
2534
- const stopwatch = getStopwatch(`${options.name} asset copy`);
2535
- await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
2536
- stopwatch();
2537
- return options;
2538
- }
2539
- __name(copyBuildAssets3, "copyBuildAssets");
2540
- async function cleanOutputPath3(options) {
2541
- if (options.clean !== false && options.outDir) {
2542
- await clean3(options.name, options.outDir, options.config);
2543
- }
2544
- return options;
2545
- }
2546
- __name(cleanOutputPath3, "cleanOutputPath");
2547
- async function build5(options) {
2548
- writeDebug(` \u26A1 Executing Storm Unbuild pipeline`);
2549
- const stopwatch = getStopwatch("Unbuild pipeline");
2550
- try {
2551
- const resolvedOptions = await resolveOptions3(options);
2552
- await cleanOutputPath3(resolvedOptions);
2553
- await generatePackageJson3(resolvedOptions);
2554
- await executeUnbuild(resolvedOptions);
2555
- await copyBuildAssets3(resolvedOptions);
2556
- writeSuccess(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, resolvedOptions.config);
2557
- } catch (error) {
2558
- writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
2559
- throw error;
2560
- } finally {
2561
- stopwatch();
2562
- }
2563
- }
2564
- __name(build5, "build");
2565
-
2566
2122
  // ../workspace-tools/src/executors/unbuild/executor.ts
2567
- import { defu as defu4 } from "defu";
2123
+ import { defu as defu3 } from "defu";
2124
+ import { createJiti } from "jiti";
2568
2125
  async function unbuildExecutorFn(options, context2, config) {
2569
2126
  writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
2570
2127
  if (!context2.projectsConfigurations?.projects || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !context2.projectsConfigurations.projects[context2.projectName]?.root) {
2571
2128
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
2572
2129
  }
2573
- await build5(defu4({
2130
+ const jiti = createJiti(config.workspaceRoot, {
2131
+ fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
2132
+ interopDefault: true
2133
+ });
2134
+ const stormUnbuild = await jiti.import("@storm-software/unbuild");
2135
+ await stormUnbuild.build(defu3({
2574
2136
  ...options,
2575
2137
  projectRoot: context2.projectsConfigurations.projects?.[context2.projectName].root,
2576
2138
  projectName: context2.projectName,
@@ -2624,7 +2186,7 @@ var executor_default10 = withRunExecutor("TypeScript Unbuild build", unbuildExec
2624
2186
  });
2625
2187
 
2626
2188
  // ../workspace-tools/src/generators/browser-library/generator.ts
2627
- import { formatFiles as formatFiles2, generateFiles, joinPathFragments as joinPathFragments5, names as names2, offsetFromRoot as offsetFromRoot2 } from "@nx/devkit";
2189
+ import { formatFiles as formatFiles2, generateFiles, joinPathFragments as joinPathFragments4, names as names2, offsetFromRoot as offsetFromRoot2 } from "@nx/devkit";
2628
2190
 
2629
2191
  // ../workspace-tools/src/base/base-generator.ts
2630
2192
  var withRunGenerator = /* @__PURE__ */ __name((name, generatorFn, generatorOptions = {
@@ -2986,7 +2548,7 @@ __name(normalizeOptions, "normalizeOptions");
2986
2548
 
2987
2549
  // ../workspace-tools/src/generators/browser-library/generator.ts
2988
2550
  async function browserLibraryGeneratorFn(tree, schema, config) {
2989
- const filesDir = joinPathFragments5(__dirname, "./files");
2551
+ const filesDir = joinPathFragments4(__dirname, "./files");
2990
2552
  const tsLibraryGeneratorOptions = {
2991
2553
  buildExecutor: "@storm-software/workspace-tools:unbuild",
2992
2554
  platform: "browser",
@@ -3089,9 +2651,9 @@ var generator_default2 = withRunGenerator("Configuration Schema Creator", config
3089
2651
  import { addDependenciesToPackageJson as addDependenciesToPackageJson2, formatFiles as formatFiles4 } from "@nx/devkit";
3090
2652
 
3091
2653
  // ../workspace-tools/src/generators/neutral-library/generator.ts
3092
- import { formatFiles as formatFiles5, generateFiles as generateFiles2, joinPathFragments as joinPathFragments6, names as names3, offsetFromRoot as offsetFromRoot3 } from "@nx/devkit";
2654
+ import { formatFiles as formatFiles5, generateFiles as generateFiles2, joinPathFragments as joinPathFragments5, names as names3, offsetFromRoot as offsetFromRoot3 } from "@nx/devkit";
3093
2655
  async function neutralLibraryGeneratorFn(tree, schema, config) {
3094
- const filesDir = joinPathFragments6(__dirname, "./files");
2656
+ const filesDir = joinPathFragments5(__dirname, "./files");
3095
2657
  const tsLibraryGeneratorOptions = {
3096
2658
  ...schema,
3097
2659
  platform: "neutral",
@@ -3132,9 +2694,9 @@ var generator_default3 = withRunGenerator("TypeScript Library Creator (Neutral P
3132
2694
  });
3133
2695
 
3134
2696
  // ../workspace-tools/src/generators/node-library/generator.ts
3135
- import { formatFiles as formatFiles6, generateFiles as generateFiles3, joinPathFragments as joinPathFragments7, names as names4, offsetFromRoot as offsetFromRoot4 } from "@nx/devkit";
2697
+ import { formatFiles as formatFiles6, generateFiles as generateFiles3, joinPathFragments as joinPathFragments6, names as names4, offsetFromRoot as offsetFromRoot4 } from "@nx/devkit";
3136
2698
  async function nodeLibraryGeneratorFn(tree, schema, config) {
3137
- const filesDir = joinPathFragments7(__dirname, "./files");
2699
+ const filesDir = joinPathFragments6(__dirname, "./files");
3138
2700
  const tsLibraryGeneratorOptions = {
3139
2701
  platform: "node",
3140
2702
  devDependencies: {
@@ -3179,7 +2741,7 @@ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Pl
3179
2741
  });
3180
2742
 
3181
2743
  // ../workspace-tools/src/generators/preset/generator.ts
3182
- import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments8, updateJson as updateJson2 } from "@nx/devkit";
2744
+ import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments7, updateJson as updateJson2 } from "@nx/devkit";
3183
2745
  import * as path6 from "node:path";
3184
2746
  async function presetGeneratorFn(tree, options) {
3185
2747
  const projectRoot = ".";
@@ -3397,14 +2959,14 @@ async function presetGeneratorFn(tree, options) {
3397
2959
  "nx-cloud": "latest"
3398
2960
  };
3399
2961
  }
3400
- await Promise.resolve(addDependenciesToPackageJson3(tree, dependencies, {}, joinPathFragments8(projectRoot, "package.json")));
2962
+ await Promise.resolve(addDependenciesToPackageJson3(tree, dependencies, {}, joinPathFragments7(projectRoot, "package.json")));
3401
2963
  return null;
3402
2964
  }
3403
2965
  __name(presetGeneratorFn, "presetGeneratorFn");
3404
2966
  var generator_default5 = withRunGenerator("Storm Workspace Preset Generator", presetGeneratorFn);
3405
2967
 
3406
2968
  // ../workspace-tools/src/generators/release-version/generator.ts
3407
- import { formatFiles as formatFiles8, joinPathFragments as joinPathFragments9, output, readJson as readJson2, updateJson as updateJson3, writeJson as writeJson3 } from "@nx/devkit";
2969
+ import { formatFiles as formatFiles8, joinPathFragments as joinPathFragments8, output, readJson as readJson2, updateJson as updateJson3, writeJson as writeJson3 } from "@nx/devkit";
3408
2970
  import { resolveLocalPackageDependencies as resolveLocalPackageJsonDependencies } from "@nx/js/src/generators/release-version/utils/resolve-local-package-dependencies";
3409
2971
  import { updateLockFile } from "@nx/js/src/generators/release-version/utils/update-lock-file";
3410
2972
 
@@ -3421,7 +2983,7 @@ import ChangelogRenderer from "nx/release/changelog-renderer/index";
3421
2983
 
3422
2984
  // ../workspace-tools/src/generators/release-version/generator.ts
3423
2985
  import { exec as exec2, execSync as execSync5 } from "node:child_process";
3424
- import { relative as relative5 } from "node:path";
2986
+ import { relative as relative3 } from "node:path";
3425
2987
  import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
3426
2988
  import { getFirstGitCommit, getLatestGitTagForPattern } from "nx/src/command-line/release/utils/git";
3427
2989
  import { resolveSemverSpecifierFromConventionalCommits, resolveSemverSpecifierFromPrompt } from "nx/src/command-line/release/utils/resolve-semver-specifier";
@@ -4010,7 +3572,7 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
4010
3572
  import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/project-graph/utils/retrieve-workspace-files";
4011
3573
 
4012
3574
  // ../workspace-tools/src/utils/lock-file.ts
4013
- import { existsSync as existsSync5 } from "node:fs";
3575
+ import { existsSync as existsSync4 } from "node:fs";
4014
3576
  import { join as join2 } from "node:path";
4015
3577
  import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "nx/src/devkit-exports";
4016
3578
  import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";