@storm-software/workspace-tools 1.296.65 → 1.296.69

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 (184) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-JSF2U5XJ.mjs → chunk-5HFH7JXU.mjs} +1 -1
  3. package/dist/chunk-6JPLZS7V.js +63 -0
  4. package/dist/{chunk-33X22YHZ.js → chunk-6SGLYIAR.js} +38 -62
  5. package/dist/{chunk-7GR34ULJ.mjs → chunk-DWFH4BRZ.mjs} +1 -1
  6. package/dist/{chunk-HHIEI52S.mjs → chunk-F2YQJNBF.mjs} +1 -1
  7. package/dist/{chunk-ZLMX7HR5.mjs → chunk-LWUEYMYK.mjs} +1 -1
  8. package/dist/chunk-NVQEK4YA.mjs +63 -0
  9. package/dist/{chunk-PVNPMJZX.mjs → chunk-QJ7X75J7.mjs} +18 -42
  10. package/dist/chunk-QTRRVFW3.js +646 -0
  11. package/dist/{chunk-26UFEUQD.mjs → chunk-TCAUYQGJ.mjs} +1 -1
  12. package/dist/chunk-WCG3YZT5.mjs +646 -0
  13. package/dist/{executor-C5219i5t.d.ts → executor-Bvhe30H9.d.mts} +1 -1
  14. package/dist/{executor-DadFjUp3.d.mts → executor-Bvhe30H9.d.ts} +1 -1
  15. package/dist/{executor-CIWrRfZk.d.ts → executor-ByqK10v5.d.mts} +1 -1
  16. package/dist/{executor-CG97uTCS.d.mts → executor-ByqK10v5.d.ts} +1 -1
  17. package/dist/{executor-k7EKIXAK.d.ts → executor-CfRFawOI.d.mts} +1 -1
  18. package/dist/{executor-CMTGEhxz.d.mts → executor-CfRFawOI.d.ts} +1 -1
  19. package/dist/{executor-DwZoSq9d.d.mts → executor-DGBYJ2e9.d.mts} +2 -2
  20. package/dist/{executor-ClfwHhlC.d.ts → executor-DGBYJ2e9.d.ts} +2 -2
  21. package/dist/{executor-Dy3y0dK8.d.ts → executor-DnAgSSQo.d.mts} +1 -1
  22. package/dist/{executor-BvyV-AUf.d.mts → executor-DnAgSSQo.d.ts} +1 -1
  23. package/dist/{executor-J46dd9vs.d.ts → executor-gZ6drqad.d.mts} +1 -1
  24. package/dist/{executor-BIJn8SVe.d.mts → executor-gZ6drqad.d.ts} +1 -1
  25. package/dist/executors.d.mts +8 -9
  26. package/dist/executors.d.ts +8 -9
  27. package/dist/executors.js +4 -5
  28. package/dist/executors.mjs +4 -5
  29. package/dist/{generator-pH8SQ4XZ.d.ts → generator-B84zOfal.d.ts} +1 -1
  30. package/dist/{generator-DKHHWoGN.d.mts → generator-B8e9I6Mc.d.mts} +1 -1
  31. package/dist/{generator-COkrr-Oe.d.ts → generator-BC0IbdKh.d.ts} +2 -2
  32. package/dist/{generator-B5dG5dVY.d.ts → generator-BIDPDi0P.d.ts} +2 -2
  33. package/dist/{generator-Dmk05ap8.d.mts → generator-BS0iminO.d.mts} +2 -2
  34. package/dist/{generator-CXLEWJAF.d.ts → generator-Bg8GF2dN.d.mts} +2 -2
  35. package/dist/{generator-RLXG3OeQ.d.ts → generator-CPtINS_d.d.mts} +2 -2
  36. package/dist/{generator-C3dM_v6y.d.mts → generator-D7IL5mT3.d.ts} +2 -2
  37. package/dist/{generator-BKQGstaG.d.mts → generator-DZxxv_h5.d.mts} +2 -2
  38. package/dist/{generator-OpEc9gcp.d.mts → generator-Dq3a21FT.d.ts} +2 -2
  39. package/dist/generators.d.mts +9 -10
  40. package/dist/generators.d.ts +9 -10
  41. package/dist/generators.js +2 -2
  42. package/dist/generators.mjs +7 -7
  43. package/dist/index.d.mts +17 -16
  44. package/dist/index.d.ts +17 -16
  45. package/dist/index.js +6 -7
  46. package/dist/index.mjs +10 -11
  47. package/dist/src/base/base-executor.d.mts +3 -5
  48. package/dist/src/base/base-executor.d.ts +3 -5
  49. package/dist/src/base/base-executor.mjs +1 -1
  50. package/dist/src/base/base-executor.untyped.mjs +1 -1
  51. package/dist/src/base/base-generator.d.mts +3 -5
  52. package/dist/src/base/base-generator.d.ts +3 -5
  53. package/dist/src/base/base-generator.mjs +1 -1
  54. package/dist/src/base/base-generator.untyped.mjs +1 -1
  55. package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
  56. package/dist/src/base/index.d.mts +3 -5
  57. package/dist/src/base/index.d.ts +3 -5
  58. package/dist/src/base/index.mjs +1 -1
  59. package/dist/src/base/typescript-build-executor.untyped.mjs +1 -1
  60. package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
  61. package/dist/src/executors/cargo-build/executor.mjs +1 -1
  62. package/dist/src/executors/cargo-build/untyped.mjs +1 -1
  63. package/dist/src/executors/cargo-check/executor.mjs +1 -1
  64. package/dist/src/executors/cargo-check/untyped.mjs +1 -1
  65. package/dist/src/executors/cargo-clippy/executor.mjs +1 -1
  66. package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
  67. package/dist/src/executors/cargo-doc/executor.mjs +1 -1
  68. package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
  69. package/dist/src/executors/cargo-format/executor.mjs +1 -1
  70. package/dist/src/executors/cargo-format/untyped.mjs +1 -1
  71. package/dist/src/executors/cargo-publish/executor.mjs +1 -1
  72. package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
  73. package/dist/src/executors/clean-package/executor.d.mts +1 -3
  74. package/dist/src/executors/clean-package/executor.d.ts +1 -3
  75. package/dist/src/executors/clean-package/executor.mjs +1 -1
  76. package/dist/src/executors/clean-package/untyped.mjs +1 -1
  77. package/dist/src/executors/esbuild/executor.d.mts +2 -4
  78. package/dist/src/executors/esbuild/executor.d.ts +2 -4
  79. package/dist/src/executors/esbuild/executor.js +2 -3
  80. package/dist/src/executors/esbuild/executor.mjs +2 -3
  81. package/dist/src/executors/esbuild/untyped.mjs +1 -1
  82. package/dist/src/executors/napi/executor.d.mts +2 -4
  83. package/dist/src/executors/napi/executor.d.ts +2 -4
  84. package/dist/src/executors/napi/executor.mjs +1 -1
  85. package/dist/src/executors/napi/untyped.mjs +1 -1
  86. package/dist/src/executors/npm-publish/executor.js +2 -2
  87. package/dist/src/executors/npm-publish/executor.mjs +2 -2
  88. package/dist/src/executors/npm-publish/untyped.mjs +1 -1
  89. package/dist/src/executors/size-limit/executor.d.mts +2 -4
  90. package/dist/src/executors/size-limit/executor.d.ts +2 -4
  91. package/dist/src/executors/size-limit/executor.mjs +1 -1
  92. package/dist/src/executors/size-limit/untyped.mjs +1 -1
  93. package/dist/src/executors/tsdown/executor.d.mts +2 -4
  94. package/dist/src/executors/tsdown/executor.d.ts +2 -4
  95. package/dist/src/executors/tsdown/executor.js +2 -3
  96. package/dist/src/executors/tsdown/executor.mjs +2 -3
  97. package/dist/src/executors/tsdown/untyped.mjs +1 -1
  98. package/dist/src/executors/typia/executor.d.mts +2 -4
  99. package/dist/src/executors/typia/executor.d.ts +2 -4
  100. package/dist/src/executors/typia/executor.mjs +1 -1
  101. package/dist/src/executors/typia/untyped.mjs +1 -1
  102. package/dist/src/executors/unbuild/executor.d.mts +2 -4
  103. package/dist/src/executors/unbuild/executor.d.ts +2 -4
  104. package/dist/src/executors/unbuild/executor.mjs +1 -1
  105. package/dist/src/executors/unbuild/untyped.mjs +1 -1
  106. package/dist/src/generators/browser-library/generator.d.mts +4 -6
  107. package/dist/src/generators/browser-library/generator.d.ts +4 -6
  108. package/dist/src/generators/browser-library/generator.mjs +2 -2
  109. package/dist/src/generators/browser-library/untyped.mjs +1 -1
  110. package/dist/src/generators/config-schema/generator.d.mts +4 -5
  111. package/dist/src/generators/config-schema/generator.d.ts +4 -5
  112. package/dist/src/generators/config-schema/generator.mjs +1 -1
  113. package/dist/src/generators/config-schema/untyped.mjs +1 -1
  114. package/dist/src/generators/init/init.mjs +1 -1
  115. package/dist/src/generators/init/untyped.mjs +1 -1
  116. package/dist/src/generators/neutral-library/generator.d.mts +4 -6
  117. package/dist/src/generators/neutral-library/generator.d.ts +4 -6
  118. package/dist/src/generators/neutral-library/generator.mjs +2 -2
  119. package/dist/src/generators/neutral-library/untyped.mjs +1 -1
  120. package/dist/src/generators/node-library/generator.d.mts +4 -6
  121. package/dist/src/generators/node-library/generator.d.ts +4 -6
  122. package/dist/src/generators/node-library/generator.mjs +2 -2
  123. package/dist/src/generators/node-library/untyped.mjs +1 -1
  124. package/dist/src/generators/preset/generator.d.mts +4 -6
  125. package/dist/src/generators/preset/generator.d.ts +4 -6
  126. package/dist/src/generators/preset/generator.mjs +2 -2
  127. package/dist/src/generators/preset/untyped.mjs +1 -1
  128. package/dist/src/plugins/rust/cargo-toml.mjs +1 -1
  129. package/dist/src/plugins/rust/index.mjs +1 -1
  130. package/dist/src/plugins/typescript/index.d.mts +3 -5
  131. package/dist/src/plugins/typescript/index.d.ts +3 -5
  132. package/dist/src/plugins/typescript/index.mjs +1 -1
  133. package/dist/src/plugins/typescript/tsdown.d.mts +3 -5
  134. package/dist/src/plugins/typescript/tsdown.d.ts +3 -5
  135. package/dist/src/plugins/typescript/tsdown.mjs +1 -1
  136. package/dist/src/plugins/typescript/tsup.d.mts +3 -5
  137. package/dist/src/plugins/typescript/tsup.d.ts +3 -5
  138. package/dist/src/plugins/typescript/tsup.mjs +1 -1
  139. package/dist/src/plugins/typescript/untyped-schema.mjs +1 -1
  140. package/dist/src/release/index.d.mts +2 -3
  141. package/dist/src/release/index.d.ts +2 -3
  142. package/dist/src/release/index.mjs +1 -1
  143. package/dist/src/release/js-version-actions.d.mts +1 -3
  144. package/dist/src/release/js-version-actions.d.ts +1 -3
  145. package/dist/src/release/js-version-actions.mjs +1 -1
  146. package/dist/src/release/rust-version-actions.d.mts +1 -3
  147. package/dist/src/release/rust-version-actions.d.ts +1 -3
  148. package/dist/src/release/rust-version-actions.mjs +1 -1
  149. package/dist/src/types.d.mts +77 -6
  150. package/dist/src/types.d.ts +77 -6
  151. package/dist/src/types.mjs +1 -1
  152. package/dist/src/utils/apply-workspace-tokens.mjs +1 -1
  153. package/dist/src/utils/cargo.mjs +1 -1
  154. package/dist/src/utils/create-cli-options.mjs +1 -1
  155. package/dist/src/utils/get-project-configurations.mjs +1 -1
  156. package/dist/src/utils/github.d.mts +1 -3
  157. package/dist/src/utils/github.d.ts +1 -3
  158. package/dist/src/utils/github.mjs +1 -1
  159. package/dist/src/utils/index.d.mts +4 -5
  160. package/dist/src/utils/index.d.ts +4 -5
  161. package/dist/src/utils/index.mjs +1 -1
  162. package/dist/src/utils/lock-file.mjs +1 -1
  163. package/dist/src/utils/nx-json.mjs +1 -1
  164. package/dist/src/utils/package-helpers.mjs +1 -1
  165. package/dist/src/utils/plugin-helpers.mjs +1 -1
  166. package/dist/src/utils/project-tags.d.mts +3 -57
  167. package/dist/src/utils/project-tags.d.ts +3 -57
  168. package/dist/src/utils/project-tags.mjs +1 -1
  169. package/dist/src/utils/registry-helpers.mjs +1 -1
  170. package/dist/src/utils/typia-transform.mjs +1 -1
  171. package/dist/src/utils/versions.mjs +1 -1
  172. package/package.json +11 -11
  173. package/dist/chunk-BCJOE7LL.mjs +0 -469
  174. package/dist/chunk-CX7LLOXP.js +0 -363
  175. package/dist/chunk-F4NO6JZL.mjs +0 -319
  176. package/dist/chunk-MI4DOBNH.js +0 -319
  177. package/dist/chunk-TFGZLFCS.mjs +0 -363
  178. package/dist/chunk-UCM45E6T.js +0 -469
  179. package/dist/types-CHANfFBa.d.ts +0 -77
  180. package/dist/types-D2zxYEAh.d.mts +0 -41
  181. package/dist/types-D2zxYEAh.d.ts +0 -41
  182. package/dist/types-DI57BUsw.d.mts +0 -243
  183. package/dist/types-DI57BUsw.d.ts +0 -243
  184. package/dist/types-E53OUdCr.d.mts +0 -77
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.296.65",
3
+ "version": "1.296.69",
4
4
  "description": "Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.",
5
5
  "keywords": [
6
6
  "monorepo",
@@ -238,10 +238,10 @@
238
238
  "@size-limit/esbuild": "^11.2.0",
239
239
  "@size-limit/esbuild-why": "^11.2.0",
240
240
  "@size-limit/file": "^11.2.0",
241
- "@storm-software/config-tools": "^1.190.85",
242
- "@storm-software/npm-tools": "^0.6.203",
243
- "@storm-software/pnpm-tools": "^0.7.96",
244
- "@storm-software/prettier": "^0.59.138",
241
+ "@storm-software/config-tools": "^1.190.89",
242
+ "@storm-software/npm-tools": "^0.6.207",
243
+ "@storm-software/prettier": "^0.59.142",
244
+ "@storm-software/tsdown": "^0.45.250",
245
245
  "fs-extra": "11.2.0",
246
246
  "glob": "^11.1.0",
247
247
  "jiti": "^2.7.0",
@@ -255,10 +255,10 @@
255
255
  },
256
256
  "devDependencies": {
257
257
  "@napi-rs/cli": "^3.7.2",
258
- "@storm-software/esbuild": "^0.53.246",
259
- "@storm-software/package-constants": "^0.1.98",
260
- "@storm-software/tsdown": "^0.45.246",
261
- "@storm-software/unbuild": "^0.57.246",
258
+ "@storm-software/esbuild": "^0.53.250",
259
+ "@storm-software/package-constants": "^0.1.102",
260
+ "@storm-software/pnpm-tools": "^0.7.100",
261
+ "@storm-software/unbuild": "^0.57.250",
262
262
  "@types/micromatch": "^4.0.10",
263
263
  "@types/node": "^25.9.4",
264
264
  "@types/semver": "^7.7.1",
@@ -267,7 +267,7 @@
267
267
  "pkg-types": "^1.3.1",
268
268
  "prettier": "^3.9.4",
269
269
  "tsup": "8.4.0",
270
- "typescript": "^5.9.3"
270
+ "typescript": "^6.0.3"
271
271
  },
272
272
  "peerDependencies": {
273
273
  "@napi-rs/cli": "^3.4.1",
@@ -290,5 +290,5 @@
290
290
  "publishConfig": { "access": "public" },
291
291
  "executors": "./executors.json",
292
292
  "generators": "./generators.json",
293
- "gitHead": "2b0c770dcdf373cebdbb232fc1a3d2e524ab31fc"
293
+ "gitHead": "14f9267ee6222b480c883f16346f763ca0ea21d0"
294
294
  }
@@ -1,469 +0,0 @@
1
- import {
2
- DEFAULT_CSS_BANNER,
3
- DEFAULT_JS_BANNER,
4
- addPackageDependencies,
5
- addWorkspacePackageJsonFields,
6
- copyAssets,
7
- getEnv
8
- } from "./chunk-F4NO6JZL.mjs";
9
- import {
10
- withRunExecutor
11
- } from "./chunk-BVY6TUTT.mjs";
12
- import {
13
- getWorkspaceConfig
14
- } from "./chunk-JGXYRLRO.mjs";
15
- import {
16
- brandIcon,
17
- formatLogMessage,
18
- getStopwatch,
19
- writeDebug,
20
- writeError,
21
- writeFatal,
22
- writeInfo,
23
- writeSuccess,
24
- writeWarning
25
- } from "./chunk-45CW7OJB.mjs";
26
- import {
27
- joinPaths
28
- } from "./chunk-TBW5MCN6.mjs";
29
-
30
- // ../esbuild/src/assets.ts
31
- async function copyBuildAssets(context) {
32
- if (!context.result?.errors.length && context.options.assets?.length) {
33
- writeDebug(
34
- ` \u{1F4CB} Copying ${context.options.assets.length} asset files to output directory: ${context.outputPath}`,
35
- context.workspaceConfig
36
- );
37
- const stopwatch = getStopwatch(`${context.options.name} asset copy`);
38
- await copyAssets(
39
- context.workspaceConfig,
40
- context.options.assets ?? [],
41
- context.outputPath,
42
- context.options.projectRoot,
43
- context.sourceRoot,
44
- true,
45
- false
46
- );
47
- stopwatch();
48
- }
49
- return context;
50
- }
51
-
52
- // ../esbuild/src/clean.ts
53
- import { rm } from "node:fs/promises";
54
- async function cleanDirectories(directory) {
55
- await rm(directory, { recursive: true, force: true });
56
- }
57
-
58
- // ../esbuild/src/context.ts
59
- import {
60
- createProjectGraphAsync,
61
- readProjectsConfigurationFromProjectGraph
62
- } from "@nx/devkit";
63
- import defu from "defu";
64
- import { existsSync } from "node:fs";
65
- import hf from "node:fs/promises";
66
- import { findWorkspaceRoot } from "nx/src/utils/find-workspace-root";
67
-
68
- // ../esbuild/src/config.ts
69
- var DEFAULT_BUILD_OPTIONS = {
70
- platform: "node",
71
- target: "node22",
72
- format: "esm",
73
- mode: "production",
74
- generatePackageJson: true,
75
- includeSrc: false,
76
- keepNames: true,
77
- metafile: false,
78
- treeshake: true,
79
- splitting: true,
80
- shims: false,
81
- watch: false,
82
- bundle: true,
83
- distDir: "dist",
84
- loader: {
85
- ".aac": "file",
86
- ".css": "file",
87
- ".eot": "file",
88
- ".flac": "file",
89
- ".gif": "file",
90
- ".jpeg": "file",
91
- ".jpg": "file",
92
- ".mp3": "file",
93
- ".mp4": "file",
94
- ".ogg": "file",
95
- ".otf": "file",
96
- ".png": "file",
97
- ".svg": "file",
98
- ".ttf": "file",
99
- ".wav": "file",
100
- ".webm": "file",
101
- ".webp": "file",
102
- ".woff": "file",
103
- ".woff2": "file"
104
- },
105
- banner: {
106
- js: DEFAULT_JS_BANNER,
107
- css: DEFAULT_CSS_BANNER
108
- }
109
- };
110
-
111
- // ../esbuild/src/context.ts
112
- async function resolveContext(userOptions) {
113
- const projectRoot = userOptions.projectRoot;
114
- const workspaceRoot = findWorkspaceRoot(projectRoot);
115
- if (!workspaceRoot) {
116
- throw new Error("Cannot find Nx workspace root");
117
- }
118
- const workspaceConfig = await getWorkspaceConfig(true, {
119
- workspaceRoot: workspaceRoot.dir
120
- });
121
- writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
122
- const stopwatch = getStopwatch("Build options resolution");
123
- const projectGraph = await createProjectGraphAsync({
124
- exitOnError: true
125
- });
126
- const projectJsonPath = joinPaths(
127
- workspaceRoot.dir,
128
- projectRoot,
129
- "project.json"
130
- );
131
- if (!existsSync(projectJsonPath)) {
132
- throw new Error("Cannot find project.json configuration");
133
- }
134
- const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
135
- const projectJson = JSON.parse(projectJsonFile);
136
- const projectName = projectJson.name || userOptions.name;
137
- const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
138
- if (!projectConfigurations?.projects?.[projectName]) {
139
- throw new Error(
140
- "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."
141
- );
142
- }
143
- const options = defu(userOptions, DEFAULT_BUILD_OPTIONS);
144
- options.name ??= projectName;
145
- const packageJsonPath = joinPaths(
146
- workspaceRoot.dir,
147
- options.projectRoot,
148
- "package.json"
149
- );
150
- if (!existsSync(packageJsonPath)) {
151
- throw new Error("Cannot find package.json configuration");
152
- }
153
- const env = getEnv("esbuild", options);
154
- const define = defu(options.define ?? {}, env ?? {});
155
- const resolvedOptions = {
156
- ...options,
157
- tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : joinPaths(workspaceRoot.dir, projectRoot, "tsconfig.json"),
158
- metafile: userOptions.mode === "development",
159
- clean: false,
160
- env,
161
- define: {
162
- STORM_FORMAT: JSON.stringify(options.format),
163
- ...Object.keys(define).filter((key) => define[key] !== void 0).reduce((res, key) => {
164
- const value = JSON.stringify(define[key]);
165
- const safeKey = key.replaceAll("(", "").replaceAll(")", "");
166
- return {
167
- ...res,
168
- [`process.env.${safeKey}`]: value,
169
- [`import.meta.env.${safeKey}`]: value
170
- };
171
- }, {})
172
- }
173
- };
174
- stopwatch();
175
- const context = {
176
- options: resolvedOptions,
177
- clean: userOptions.clean !== false,
178
- workspaceConfig,
179
- projectConfigurations,
180
- projectName,
181
- projectGraph,
182
- sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
183
- outputPath: resolvedOptions.outputPath || joinPaths(
184
- workspaceConfig.workspaceRoot,
185
- "dist",
186
- resolvedOptions.projectRoot
187
- ),
188
- minify: resolvedOptions.minify || resolvedOptions.mode === "production"
189
- };
190
- context.options.esbuildPlugins = [...context.options.esbuildPlugins ?? []];
191
- if (context.options.verbose) {
192
- writeDebug(
193
- ` \u2699\uFE0F Build options resolved:
194
-
195
- ${formatLogMessage(context.options)}`,
196
- workspaceConfig
197
- );
198
- }
199
- return context;
200
- }
201
-
202
- // ../esbuild/src/package-json.ts
203
- import { writeJsonFile } from "@nx/devkit";
204
- import { existsSync as existsSync2 } from "node:fs";
205
- import hf2 from "node:fs/promises";
206
- async function generatePackageJson(context) {
207
- if (context.options.generatePackageJson !== false && existsSync2(joinPaths(context.options.projectRoot, "package.json"))) {
208
- writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
209
- const stopwatch = getStopwatch("Write package.json file");
210
- const packageJsonPath = joinPaths(
211
- context.options.projectRoot,
212
- "project.json"
213
- );
214
- if (!existsSync2(packageJsonPath)) {
215
- throw new Error("Cannot find package.json configuration");
216
- }
217
- const packageJsonFile = await hf2.readFile(
218
- joinPaths(
219
- context.workspaceConfig.workspaceRoot,
220
- context.options.projectRoot,
221
- "package.json"
222
- ),
223
- "utf8"
224
- );
225
- let packageJson = JSON.parse(packageJsonFile);
226
- if (!packageJson) {
227
- throw new Error("Cannot find package.json configuration file");
228
- }
229
- packageJson = await addPackageDependencies(
230
- context.workspaceConfig.workspaceRoot,
231
- context.options.projectRoot,
232
- context.projectName,
233
- packageJson
234
- );
235
- packageJson = await addWorkspacePackageJsonFields(
236
- context.workspaceConfig,
237
- context.options.projectRoot,
238
- context.sourceRoot,
239
- context.projectName,
240
- false,
241
- packageJson
242
- );
243
- if (context.options.entry) {
244
- packageJson.exports ??= {};
245
- packageJson.exports["./package.json"] ??= "./package.json";
246
- const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
247
- if (entryPoints.length > 0) {
248
- const defaultEntry = entryPoints.includes("index") ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entryPoints[0]}`;
249
- const isEsm = Array.isArray(context.options.format) ? context.options.format.includes("esm") : context.options.format === "esm";
250
- const isCjs = Array.isArray(context.options.format) ? context.options.format.includes("cjs") : context.options.format === "cjs";
251
- const isDts = context.options.dts || context.options.experimentalDts;
252
- packageJson.exports["."] ??= `${defaultEntry}.${isEsm ? "mjs" : isCjs ? "cjs" : "js"}`;
253
- for (const entryPoint of entryPoints) {
254
- packageJson.exports[`./${entryPoint}`] ??= {};
255
- if (isEsm) {
256
- if (isDts) {
257
- packageJson.exports[`./${entryPoint}`].import = {
258
- types: `./dist/${entryPoint}.d.mts`,
259
- default: `./dist/${entryPoint}.mjs`
260
- };
261
- } else {
262
- packageJson.exports[`./${entryPoint}`].import = `./dist/${entryPoint}.mjs`;
263
- }
264
- if (isDts) {
265
- packageJson.exports[`./${entryPoint}`].default = {
266
- types: `./dist/${entryPoint}.d.mts`,
267
- default: `./dist/${entryPoint}.mjs`
268
- };
269
- } else {
270
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.mjs`;
271
- }
272
- }
273
- if (isCjs) {
274
- if (isDts) {
275
- packageJson.exports[`./${entryPoint}`].require = {
276
- types: `./dist/${entryPoint}.d.cts`,
277
- default: `./dist/${entryPoint}.cjs`
278
- };
279
- } else {
280
- packageJson.exports[`./${entryPoint}`].require = `./dist/${entryPoint}.cjs`;
281
- }
282
- if (!isEsm) {
283
- if (isDts) {
284
- packageJson.exports[`./${entryPoint}`].default = {
285
- types: `./dist/${entryPoint}.d.cts`,
286
- default: `./dist/${entryPoint}.cjs`
287
- };
288
- } else {
289
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.cjs`;
290
- }
291
- }
292
- }
293
- if (!isEsm && !isCjs) {
294
- if (isDts) {
295
- packageJson.exports[`./${entryPoint}`].default = {
296
- types: `./dist/${entryPoint}.d.ts`,
297
- default: `./dist/${entryPoint}.js`
298
- };
299
- } else {
300
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.js`;
301
- }
302
- }
303
- }
304
- if (isEsm) {
305
- packageJson.module = `${defaultEntry}.mjs`;
306
- } else {
307
- packageJson.main = `${defaultEntry}.cjs`;
308
- }
309
- if (isDts) {
310
- packageJson.types = `${defaultEntry}.d.${isEsm ? "mts" : isCjs ? "cts" : "ts"}`;
311
- }
312
- packageJson.exports = Object.keys(packageJson.exports).reduce(
313
- (ret, key) => {
314
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
315
- ret[key.replace("/index", "")] = packageJson.exports[key];
316
- }
317
- return ret;
318
- },
319
- packageJson.exports
320
- );
321
- }
322
- }
323
- await writeJsonFile(
324
- joinPaths(context.outputPath, "package.json"),
325
- packageJson
326
- );
327
- stopwatch();
328
- }
329
- return context;
330
- }
331
-
332
- // ../tsup/src/index.ts
333
- import { build as tsup } from "tsup";
334
- async function build(options) {
335
- if (!options.silent) {
336
- writeDebug(
337
- ` \u{1F680} Running ${options.name || "tsup"} build`,
338
- options.workspaceConfig
339
- );
340
- }
341
- const stopwatch = getStopwatch(`${options.name || "tsup"} build`);
342
- await tsup(options);
343
- if (!options.silent) {
344
- stopwatch();
345
- }
346
- }
347
-
348
- // ../esbuild/src/tsup.ts
349
- async function executeTsup(context) {
350
- writeDebug(
351
- ` \u{1F680} Running ${context.options.name} build`,
352
- context.workspaceConfig
353
- );
354
- const stopwatch = getStopwatch(`${context.options.name} build`);
355
- await build({
356
- ...context.options,
357
- outDir: context.options.distDir ? joinPaths(context.outputPath, context.options.distDir) : context.outputPath,
358
- workspaceConfig: context.workspaceConfig
359
- });
360
- stopwatch();
361
- return context;
362
- }
363
-
364
- // ../esbuild/src/build.ts
365
- async function reportResults(context) {
366
- if (context.result?.errors.length === 0) {
367
- if (context.result.warnings.length > 0) {
368
- writeWarning(
369
- ` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`,
370
- context.workspaceConfig
371
- );
372
- }
373
- writeSuccess(
374
- ` \u{1F4E6} The ${context.options.name} build completed successfully`,
375
- context.workspaceConfig
376
- );
377
- } else if (context.result?.errors && context.result?.errors.length > 0) {
378
- writeError(
379
- ` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`,
380
- context.workspaceConfig
381
- );
382
- throw new Error(
383
- `The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`
384
- );
385
- }
386
- }
387
- async function cleanOutputPath(context) {
388
- if (context.clean !== false && context.outputPath) {
389
- writeDebug(
390
- ` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`,
391
- context.workspaceConfig
392
- );
393
- const stopwatch = getStopwatch(`${context.options.name} output clean`);
394
- await cleanDirectories(context.outputPath);
395
- stopwatch();
396
- }
397
- return context;
398
- }
399
- async function build2(options) {
400
- writeDebug(` ${brandIcon()} Executing Storm ESBuild pipeline`);
401
- const stopwatch = getStopwatch("ESBuild pipeline");
402
- try {
403
- const opts = Array.isArray(options) ? options : [options];
404
- if (opts.length === 0) {
405
- throw new Error("No build options were provided");
406
- }
407
- const context = await resolveContext(options);
408
- await cleanOutputPath(context);
409
- await Promise.all([
410
- // dependencyCheck(context.options),
411
- generatePackageJson(context),
412
- copyBuildAssets(context),
413
- executeTsup(context)
414
- ]);
415
- await reportResults(context);
416
- writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
417
- } catch (error) {
418
- writeFatal(
419
- "Fatal errors that the build process could not recover from have occured. The build process has been terminated."
420
- );
421
- throw error;
422
- } finally {
423
- stopwatch();
424
- }
425
- }
426
-
427
- // src/executors/esbuild/executor.ts
428
- async function esbuildExecutorFn(options, context, config) {
429
- writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
430
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
431
- throw new Error(
432
- "The Build process failed because the context is not valid. Please run this command from a workspace."
433
- );
434
- }
435
- await build2({
436
- ...options,
437
- projectRoot: (
438
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
439
- context.projectsConfigurations.projects?.[context.projectName].root
440
- ),
441
- name: context.projectName,
442
- sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
443
- format: options.format,
444
- platform: options.platform
445
- });
446
- return {
447
- success: true
448
- };
449
- }
450
- var executor_default = withRunExecutor(
451
- "Storm ESBuild build",
452
- esbuildExecutorFn,
453
- {
454
- skipReadingConfig: false,
455
- hooks: {
456
- applyDefaultOptions: async (options) => {
457
- options.entry ??= ["src/index.ts"];
458
- options.outputPath ??= "dist/{projectRoot}";
459
- options.tsconfig ??= "{projectRoot}/tsconfig.json";
460
- return options;
461
- }
462
- }
463
- }
464
- );
465
-
466
- export {
467
- esbuildExecutorFn,
468
- executor_default
469
- };