@storm-software/workspace-tools 1.296.66 → 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 (183) 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 +6 -7
  28. package/dist/executors.mjs +9 -10
  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.mjs +5 -5
  42. package/dist/index.d.mts +17 -16
  43. package/dist/index.d.ts +17 -16
  44. package/dist/index.js +6 -7
  45. package/dist/index.mjs +13 -14
  46. package/dist/src/base/base-executor.d.mts +3 -5
  47. package/dist/src/base/base-executor.d.ts +3 -5
  48. package/dist/src/base/base-executor.mjs +1 -1
  49. package/dist/src/base/base-executor.untyped.mjs +1 -1
  50. package/dist/src/base/base-generator.d.mts +3 -5
  51. package/dist/src/base/base-generator.d.ts +3 -5
  52. package/dist/src/base/base-generator.mjs +1 -1
  53. package/dist/src/base/base-generator.untyped.mjs +1 -1
  54. package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
  55. package/dist/src/base/index.d.mts +3 -5
  56. package/dist/src/base/index.d.ts +3 -5
  57. package/dist/src/base/index.mjs +1 -1
  58. package/dist/src/base/typescript-build-executor.untyped.mjs +1 -1
  59. package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
  60. package/dist/src/executors/cargo-build/executor.mjs +1 -1
  61. package/dist/src/executors/cargo-build/untyped.mjs +1 -1
  62. package/dist/src/executors/cargo-check/executor.mjs +1 -1
  63. package/dist/src/executors/cargo-check/untyped.mjs +1 -1
  64. package/dist/src/executors/cargo-clippy/executor.mjs +1 -1
  65. package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
  66. package/dist/src/executors/cargo-doc/executor.mjs +1 -1
  67. package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
  68. package/dist/src/executors/cargo-format/executor.mjs +1 -1
  69. package/dist/src/executors/cargo-format/untyped.mjs +1 -1
  70. package/dist/src/executors/cargo-publish/executor.mjs +1 -1
  71. package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
  72. package/dist/src/executors/clean-package/executor.d.mts +1 -3
  73. package/dist/src/executors/clean-package/executor.d.ts +1 -3
  74. package/dist/src/executors/clean-package/executor.mjs +1 -1
  75. package/dist/src/executors/clean-package/untyped.mjs +1 -1
  76. package/dist/src/executors/esbuild/executor.d.mts +2 -4
  77. package/dist/src/executors/esbuild/executor.d.ts +2 -4
  78. package/dist/src/executors/esbuild/executor.js +2 -3
  79. package/dist/src/executors/esbuild/executor.mjs +2 -3
  80. package/dist/src/executors/esbuild/untyped.mjs +1 -1
  81. package/dist/src/executors/napi/executor.d.mts +2 -4
  82. package/dist/src/executors/napi/executor.d.ts +2 -4
  83. package/dist/src/executors/napi/executor.mjs +1 -1
  84. package/dist/src/executors/napi/untyped.mjs +1 -1
  85. package/dist/src/executors/npm-publish/executor.js +2 -2
  86. package/dist/src/executors/npm-publish/executor.mjs +2 -2
  87. package/dist/src/executors/npm-publish/untyped.mjs +1 -1
  88. package/dist/src/executors/size-limit/executor.d.mts +2 -4
  89. package/dist/src/executors/size-limit/executor.d.ts +2 -4
  90. package/dist/src/executors/size-limit/executor.mjs +1 -1
  91. package/dist/src/executors/size-limit/untyped.mjs +1 -1
  92. package/dist/src/executors/tsdown/executor.d.mts +2 -4
  93. package/dist/src/executors/tsdown/executor.d.ts +2 -4
  94. package/dist/src/executors/tsdown/executor.js +2 -3
  95. package/dist/src/executors/tsdown/executor.mjs +2 -3
  96. package/dist/src/executors/tsdown/untyped.mjs +1 -1
  97. package/dist/src/executors/typia/executor.d.mts +2 -4
  98. package/dist/src/executors/typia/executor.d.ts +2 -4
  99. package/dist/src/executors/typia/executor.mjs +1 -1
  100. package/dist/src/executors/typia/untyped.mjs +1 -1
  101. package/dist/src/executors/unbuild/executor.d.mts +2 -4
  102. package/dist/src/executors/unbuild/executor.d.ts +2 -4
  103. package/dist/src/executors/unbuild/executor.mjs +1 -1
  104. package/dist/src/executors/unbuild/untyped.mjs +1 -1
  105. package/dist/src/generators/browser-library/generator.d.mts +4 -6
  106. package/dist/src/generators/browser-library/generator.d.ts +4 -6
  107. package/dist/src/generators/browser-library/generator.mjs +2 -2
  108. package/dist/src/generators/browser-library/untyped.mjs +1 -1
  109. package/dist/src/generators/config-schema/generator.d.mts +4 -5
  110. package/dist/src/generators/config-schema/generator.d.ts +4 -5
  111. package/dist/src/generators/config-schema/generator.mjs +1 -1
  112. package/dist/src/generators/config-schema/untyped.mjs +1 -1
  113. package/dist/src/generators/init/init.mjs +1 -1
  114. package/dist/src/generators/init/untyped.mjs +1 -1
  115. package/dist/src/generators/neutral-library/generator.d.mts +4 -6
  116. package/dist/src/generators/neutral-library/generator.d.ts +4 -6
  117. package/dist/src/generators/neutral-library/generator.mjs +2 -2
  118. package/dist/src/generators/neutral-library/untyped.mjs +1 -1
  119. package/dist/src/generators/node-library/generator.d.mts +4 -6
  120. package/dist/src/generators/node-library/generator.d.ts +4 -6
  121. package/dist/src/generators/node-library/generator.mjs +2 -2
  122. package/dist/src/generators/node-library/untyped.mjs +1 -1
  123. package/dist/src/generators/preset/generator.d.mts +4 -6
  124. package/dist/src/generators/preset/generator.d.ts +4 -6
  125. package/dist/src/generators/preset/generator.mjs +2 -2
  126. package/dist/src/generators/preset/untyped.mjs +1 -1
  127. package/dist/src/plugins/rust/cargo-toml.mjs +1 -1
  128. package/dist/src/plugins/rust/index.mjs +1 -1
  129. package/dist/src/plugins/typescript/index.d.mts +3 -5
  130. package/dist/src/plugins/typescript/index.d.ts +3 -5
  131. package/dist/src/plugins/typescript/index.mjs +1 -1
  132. package/dist/src/plugins/typescript/tsdown.d.mts +3 -5
  133. package/dist/src/plugins/typescript/tsdown.d.ts +3 -5
  134. package/dist/src/plugins/typescript/tsdown.mjs +1 -1
  135. package/dist/src/plugins/typescript/tsup.d.mts +3 -5
  136. package/dist/src/plugins/typescript/tsup.d.ts +3 -5
  137. package/dist/src/plugins/typescript/tsup.mjs +1 -1
  138. package/dist/src/plugins/typescript/untyped-schema.mjs +1 -1
  139. package/dist/src/release/index.d.mts +2 -3
  140. package/dist/src/release/index.d.ts +2 -3
  141. package/dist/src/release/index.mjs +1 -1
  142. package/dist/src/release/js-version-actions.d.mts +1 -3
  143. package/dist/src/release/js-version-actions.d.ts +1 -3
  144. package/dist/src/release/js-version-actions.mjs +1 -1
  145. package/dist/src/release/rust-version-actions.d.mts +1 -3
  146. package/dist/src/release/rust-version-actions.d.ts +1 -3
  147. package/dist/src/release/rust-version-actions.mjs +1 -1
  148. package/dist/src/types.d.mts +77 -6
  149. package/dist/src/types.d.ts +77 -6
  150. package/dist/src/types.mjs +1 -1
  151. package/dist/src/utils/apply-workspace-tokens.mjs +1 -1
  152. package/dist/src/utils/cargo.mjs +1 -1
  153. package/dist/src/utils/create-cli-options.mjs +1 -1
  154. package/dist/src/utils/get-project-configurations.mjs +1 -1
  155. package/dist/src/utils/github.d.mts +1 -3
  156. package/dist/src/utils/github.d.ts +1 -3
  157. package/dist/src/utils/github.mjs +1 -1
  158. package/dist/src/utils/index.d.mts +4 -5
  159. package/dist/src/utils/index.d.ts +4 -5
  160. package/dist/src/utils/index.mjs +1 -1
  161. package/dist/src/utils/lock-file.mjs +1 -1
  162. package/dist/src/utils/nx-json.mjs +1 -1
  163. package/dist/src/utils/package-helpers.mjs +1 -1
  164. package/dist/src/utils/plugin-helpers.mjs +1 -1
  165. package/dist/src/utils/project-tags.d.mts +3 -57
  166. package/dist/src/utils/project-tags.d.ts +3 -57
  167. package/dist/src/utils/project-tags.mjs +1 -1
  168. package/dist/src/utils/registry-helpers.mjs +1 -1
  169. package/dist/src/utils/typia-transform.mjs +1 -1
  170. package/dist/src/utils/versions.mjs +1 -1
  171. package/package.json +11 -11
  172. package/dist/chunk-BCJOE7LL.mjs +0 -469
  173. package/dist/chunk-CX7LLOXP.js +0 -363
  174. package/dist/chunk-F4NO6JZL.mjs +0 -319
  175. package/dist/chunk-MI4DOBNH.js +0 -319
  176. package/dist/chunk-TFGZLFCS.mjs +0 -363
  177. package/dist/chunk-UCM45E6T.js +0 -469
  178. package/dist/types-CHANfFBa.d.ts +0 -77
  179. package/dist/types-D2zxYEAh.d.mts +0 -41
  180. package/dist/types-D2zxYEAh.d.ts +0 -41
  181. package/dist/types-DI57BUsw.d.mts +0 -243
  182. package/dist/types-DI57BUsw.d.ts +0 -243
  183. package/dist/types-E53OUdCr.d.mts +0 -77
@@ -0,0 +1,646 @@
1
+ import {
2
+ withRunExecutor
3
+ } from "./chunk-BVY6TUTT.mjs";
4
+ import {
5
+ getWorkspaceConfig
6
+ } from "./chunk-JGXYRLRO.mjs";
7
+ import {
8
+ brandIcon,
9
+ getStopwatch,
10
+ writeDebug,
11
+ writeFatal,
12
+ writeInfo,
13
+ writeSuccess,
14
+ writeTrace,
15
+ writeWarning
16
+ } from "./chunk-45CW7OJB.mjs";
17
+ import {
18
+ findWorkspaceRoot
19
+ } from "./chunk-3J2CP54B.mjs";
20
+ import {
21
+ joinPaths
22
+ } from "./chunk-TBW5MCN6.mjs";
23
+
24
+ // ../tsdown/src/build.ts
25
+ import {
26
+ createProjectGraphAsync as createProjectGraphAsync2,
27
+ readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2,
28
+ writeJsonFile
29
+ } from "@nx/devkit";
30
+
31
+ // ../build-tools/src/config.ts
32
+ var DEFAULT_ENVIRONMENT = "production";
33
+ var DEFAULT_TARGET = "esnext";
34
+ var DEFAULT_ORGANIZATION = "storm-software";
35
+
36
+ // ../build-tools/src/plugins/swc.ts
37
+ import { transform } from "@swc/core";
38
+
39
+ // ../build-tools/src/plugins/ts-resolve.ts
40
+ import fs from "node:fs";
41
+ import { builtinModules } from "node:module";
42
+ import path from "node:path";
43
+ import _resolve from "resolve";
44
+
45
+ // ../build-tools/src/plugins/type-definitions.ts
46
+ import { stripIndents } from "@nx/devkit";
47
+ import { relative } from "path";
48
+
49
+ // ../build-tools/src/utilities/copy-assets.ts
50
+ import { CopyAssetsHandler } from "@nx/js/internal";
51
+ import { glob } from "glob";
52
+ import { readFile, writeFile } from "node:fs/promises";
53
+ var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
54
+ const pendingAssets = Array.from(assets ?? []);
55
+ pendingAssets.push({
56
+ input: projectRoot,
57
+ glob: "*.md",
58
+ output: "."
59
+ });
60
+ pendingAssets.push({
61
+ input: ".",
62
+ glob: "LICENSE",
63
+ output: "."
64
+ });
65
+ if (generatePackageJson2 === false) {
66
+ pendingAssets.push({
67
+ input: projectRoot,
68
+ glob: "package.json",
69
+ output: "."
70
+ });
71
+ }
72
+ if (includeSrc === true) {
73
+ pendingAssets.push({
74
+ input: sourceRoot,
75
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
76
+ output: "src/"
77
+ });
78
+ }
79
+ writeTrace(
80
+ `\u{1F4DD} Copying the following assets to the output directory:
81
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
82
+ config
83
+ );
84
+ const assetHandler = new CopyAssetsHandler({
85
+ projectDir: projectRoot,
86
+ rootDir: config.workspaceRoot,
87
+ outputDir: outputPath,
88
+ assets: pendingAssets
89
+ });
90
+ await assetHandler.processAllAssetsOnce();
91
+ writeTrace("Completed copying assets to the output directory", config);
92
+ if (includeSrc === true) {
93
+ writeDebug(
94
+ `\u{1F4DD} Adding banner and writing source files: ${joinPaths(
95
+ outputPath,
96
+ "src"
97
+ )}`,
98
+ config
99
+ );
100
+ const files = await glob([
101
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
102
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
103
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
104
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
105
+ ]);
106
+ await Promise.allSettled(
107
+ files.map(
108
+ async (file) => writeFile(
109
+ file,
110
+ `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
111
+
112
+ ${await readFile(file, "utf8")}
113
+
114
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
115
+ )
116
+ )
117
+ );
118
+ }
119
+ };
120
+
121
+ // ../build-tools/src/utilities/generate-package-json.ts
122
+ import { calculateProjectBuildableDependencies } from "@nx/js/internal";
123
+ import { Glob } from "glob";
124
+ import { existsSync, readFileSync } from "node:fs";
125
+ import { readFile as readFile2 } from "node:fs/promises";
126
+ import {
127
+ createProjectGraphAsync,
128
+ readCachedProjectGraph,
129
+ readProjectsConfigurationFromProjectGraph
130
+ } from "nx/src/project-graph/project-graph";
131
+ var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, packageJson) => {
132
+ let projectGraph;
133
+ try {
134
+ projectGraph = readCachedProjectGraph();
135
+ } catch {
136
+ await createProjectGraphAsync();
137
+ projectGraph = readCachedProjectGraph();
138
+ }
139
+ if (!projectGraph) {
140
+ throw new Error(
141
+ "The Build process failed because the project graph is not available. Please run the build command again."
142
+ );
143
+ }
144
+ const projectDependencies = calculateProjectBuildableDependencies(
145
+ void 0,
146
+ projectGraph,
147
+ workspaceRoot,
148
+ projectName,
149
+ process.env.NX_TASK_TARGET_TARGET || "build",
150
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
151
+ true
152
+ );
153
+ const localPackages = [];
154
+ for (const project of projectDependencies.dependencies.filter(
155
+ (dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot
156
+ )) {
157
+ const projectNode = project.node;
158
+ if (projectNode.data.root) {
159
+ const projectPackageJsonPath = joinPaths(
160
+ workspaceRoot,
161
+ projectNode.data.root,
162
+ "package.json"
163
+ );
164
+ if (existsSync(projectPackageJsonPath)) {
165
+ const projectPackageJsonContent = await readFile2(
166
+ projectPackageJsonPath,
167
+ "utf8"
168
+ );
169
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
170
+ if (projectPackageJson.private !== true) {
171
+ localPackages.push(projectPackageJson);
172
+ }
173
+ }
174
+ }
175
+ }
176
+ if (localPackages.length > 0) {
177
+ writeTrace(
178
+ `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
179
+ );
180
+ const projectJsonFile = await readFile2(
181
+ joinPaths(projectRoot, "project.json"),
182
+ "utf8"
183
+ );
184
+ const projectJson = JSON.parse(projectJsonFile);
185
+ const projectName2 = projectJson.name;
186
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
187
+ if (!projectConfigurations?.projects?.[projectName2]) {
188
+ throw new Error(
189
+ "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."
190
+ );
191
+ }
192
+ const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
193
+ if (projectConfigurations.projects?.[dep]) {
194
+ const depPackageJsonPath = joinPaths(
195
+ workspaceRoot,
196
+ projectConfigurations.projects[dep].root,
197
+ "package.json"
198
+ );
199
+ if (existsSync(depPackageJsonPath)) {
200
+ const depPackageJsonContent = readFileSync(
201
+ depPackageJsonPath,
202
+ "utf8"
203
+ );
204
+ const depPackageJson = JSON.parse(depPackageJsonContent);
205
+ if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
206
+ ret.push(depPackageJson.name);
207
+ }
208
+ }
209
+ }
210
+ return ret;
211
+ }, []);
212
+ packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
213
+ if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
214
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
215
+ }
216
+ return ret;
217
+ }, packageJson.dependencies ?? {});
218
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
219
+ if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
220
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
221
+ }
222
+ return ret;
223
+ }, packageJson.devDependencies ?? {});
224
+ } else {
225
+ writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
226
+ }
227
+ return packageJson;
228
+ };
229
+ var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
230
+ const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
231
+ const workspacePackageJsonContent = await readFile2(
232
+ joinPaths(workspaceRoot, "package.json"),
233
+ "utf8"
234
+ );
235
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
236
+ packageJson.type ??= "module";
237
+ packageJson.sideEffects ??= false;
238
+ if (includeSrc === true) {
239
+ let distSrc = sourceRoot.replace(projectRoot, "");
240
+ if (distSrc.startsWith("/")) {
241
+ distSrc = distSrc.substring(1);
242
+ }
243
+ packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
244
+ }
245
+ packageJson.files ??= ["dist/**/*"];
246
+ if (includeSrc === true && !packageJson.files.includes("src")) {
247
+ packageJson.files.push("src/**/*");
248
+ }
249
+ packageJson.publishConfig ??= {
250
+ access: "public"
251
+ };
252
+ packageJson.description ??= workspacePackageJson.description;
253
+ packageJson.homepage ??= workspacePackageJson.homepage;
254
+ packageJson.bugs ??= workspacePackageJson.bugs;
255
+ packageJson.license ??= workspacePackageJson.license;
256
+ packageJson.keywords ??= workspacePackageJson.keywords;
257
+ packageJson.funding ??= workspacePackageJson.funding;
258
+ packageJson.author ??= workspacePackageJson.author;
259
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
260
+ if (!packageJson.maintainers && packageJson.author) {
261
+ packageJson.maintainers = [packageJson.author];
262
+ }
263
+ packageJson.contributors ??= workspacePackageJson.contributors;
264
+ if (!packageJson.contributors && packageJson.author) {
265
+ packageJson.contributors = [packageJson.author];
266
+ }
267
+ packageJson.repository ??= workspacePackageJson.repository;
268
+ packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
269
+ return packageJson;
270
+ };
271
+ var addPackageJsonExport = (file, type = "module", sourceRoot) => {
272
+ let entry = file.replaceAll("\\", "/");
273
+ if (sourceRoot) {
274
+ entry = entry.replace(sourceRoot, "");
275
+ }
276
+ return {
277
+ import: {
278
+ types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
279
+ default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
280
+ },
281
+ require: {
282
+ types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
283
+ default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
284
+ },
285
+ default: {
286
+ types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
287
+ default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
288
+ }
289
+ };
290
+ };
291
+
292
+ // ../build-tools/src/utilities/get-entry-points.ts
293
+ import { glob as glob2 } from "glob";
294
+
295
+ // ../build-tools/src/utilities/get-env.ts
296
+ var getEnv = (builder, options) => {
297
+ return {
298
+ STORM_BUILD: builder,
299
+ STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
300
+ STORM_NAME: options.name,
301
+ STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
302
+ STORM_PLATFORM: options.platform,
303
+ STORM_FORMAT: JSON.stringify(options.format),
304
+ STORM_TARGET: JSON.stringify(options.target),
305
+ ...options.env
306
+ };
307
+ };
308
+
309
+ // ../build-tools/src/utilities/read-nx-config.ts
310
+ import { existsSync as existsSync2 } from "node:fs";
311
+ import { readFile as readFile3 } from "node:fs/promises";
312
+
313
+ // ../build-tools/src/utilities/task-graph.ts
314
+ import {
315
+ createTaskGraph,
316
+ mapTargetDefaultsToDependencies
317
+ } from "nx/src/tasks-runner/create-task-graph";
318
+
319
+ // ../tsdown/src/build.ts
320
+ import defu from "defu";
321
+ import { existsSync as existsSync3 } from "node:fs";
322
+ import hf from "node:fs/promises";
323
+ import { build as tsdown } from "tsdown";
324
+
325
+ // ../tsdown/src/clean.ts
326
+ import { rm } from "node:fs/promises";
327
+ async function cleanDirectories(name = "TSDown", directory, config) {
328
+ await rm(directory, { recursive: true, force: true });
329
+ }
330
+
331
+ // ../tsdown/src/config.ts
332
+ function getDefaultOptions(config) {
333
+ return {
334
+ entry: ["./src/*.ts"],
335
+ platform: "node",
336
+ target: "esnext",
337
+ mode: "production",
338
+ dts: true,
339
+ unused: {
340
+ level: "error",
341
+ ignore: ["typescript"]
342
+ },
343
+ publint: true,
344
+ fixedExtension: true,
345
+ ...config
346
+ };
347
+ }
348
+ function toTSDownFormat(format) {
349
+ if (!format || Array.isArray(format) && format.length === 0) {
350
+ return ["cjs", "es"];
351
+ } else if (format === "esm") {
352
+ return "es";
353
+ } else if (Array.isArray(format)) {
354
+ return format.map((f) => f === "esm" ? "es" : f);
355
+ }
356
+ return format;
357
+ }
358
+
359
+ // ../tsdown/src/build.ts
360
+ var resolveOptions = async (userOptions) => {
361
+ const options = getDefaultOptions(userOptions);
362
+ const workspaceRoot = findWorkspaceRoot(options.projectRoot);
363
+ if (!workspaceRoot) {
364
+ throw new Error("Cannot find Nx workspace root");
365
+ }
366
+ const workspaceConfig = await getWorkspaceConfig(options.debug === true, {
367
+ workspaceRoot
368
+ });
369
+ writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
370
+ const stopwatch = getStopwatch("Build options resolution");
371
+ const projectGraph = await createProjectGraphAsync2({
372
+ exitOnError: true
373
+ });
374
+ const projectJsonPath = joinPaths(
375
+ workspaceRoot,
376
+ options.projectRoot,
377
+ "project.json"
378
+ );
379
+ if (!existsSync3(projectJsonPath)) {
380
+ throw new Error("Cannot find project.json configuration");
381
+ }
382
+ const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
383
+ const projectJson = JSON.parse(projectJsonFile);
384
+ const projectName = projectJson.name;
385
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
386
+ if (!projectConfigurations?.projects?.[projectName]) {
387
+ throw new Error(
388
+ "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."
389
+ );
390
+ }
391
+ const packageJsonPath = joinPaths(
392
+ workspaceRoot,
393
+ options.projectRoot,
394
+ "package.json"
395
+ );
396
+ if (!existsSync3(packageJsonPath)) {
397
+ throw new Error("Cannot find package.json configuration");
398
+ }
399
+ const debug = options.debug ?? (options.mode || workspaceConfig.mode) === "development";
400
+ const sourceRoot = projectJson.sourceRoot || joinPaths(options.projectRoot, "src");
401
+ const result = {
402
+ name: projectName,
403
+ mode: "production",
404
+ target: DEFAULT_TARGET,
405
+ generatePackageJson: true,
406
+ outDir: joinPaths("dist", options.projectRoot),
407
+ minify: !debug,
408
+ plugins: [],
409
+ assets: [],
410
+ dts: true,
411
+ shims: true,
412
+ logLevel: workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" || workspaceConfig.logLevel === "debug" || workspaceConfig.logLevel === "trace" || workspaceConfig.logLevel === "all" ? "info" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel,
413
+ sourcemap: debug ? "inline" : false,
414
+ clean: false,
415
+ fixedExtension: true,
416
+ nodeProtocol: true,
417
+ tsconfig: joinPaths(options.projectRoot, "tsconfig.json"),
418
+ debug,
419
+ sourceRoot,
420
+ cwd: workspaceConfig.workspaceRoot,
421
+ entry: {
422
+ ["index"]: joinPaths(sourceRoot, "index.ts")
423
+ },
424
+ workspace: true,
425
+ ...options,
426
+ treeshake: options.treeShaking !== false,
427
+ format: toTSDownFormat(options.format),
428
+ workspaceConfig,
429
+ projectName,
430
+ projectGraph,
431
+ projectConfigurations
432
+ };
433
+ result.env = defu(
434
+ options.env,
435
+ getEnv("tsdown", result)
436
+ );
437
+ stopwatch();
438
+ return result;
439
+ };
440
+ async function generatePackageJson(options) {
441
+ if (options.generatePackageJson !== false && existsSync3(joinPaths(options.projectRoot, "package.json"))) {
442
+ writeDebug(" \u270D\uFE0F Writing package.json file", options.workspaceConfig);
443
+ const stopwatch = getStopwatch("Write package.json file");
444
+ const packageJsonPath = joinPaths(options.projectRoot, "project.json");
445
+ if (!existsSync3(packageJsonPath)) {
446
+ throw new Error("Cannot find package.json configuration");
447
+ }
448
+ const packageJsonFile = await hf.readFile(
449
+ joinPaths(
450
+ options.workspaceConfig.workspaceRoot,
451
+ options.projectRoot,
452
+ "package.json"
453
+ ),
454
+ "utf8"
455
+ );
456
+ if (!packageJsonFile) {
457
+ throw new Error("Cannot find package.json configuration file");
458
+ }
459
+ let packageJson = JSON.parse(packageJsonFile);
460
+ packageJson = await addPackageDependencies(
461
+ options.workspaceConfig.workspaceRoot,
462
+ options.projectRoot,
463
+ options.projectName,
464
+ packageJson
465
+ );
466
+ packageJson = await addWorkspacePackageJsonFields(
467
+ options.workspaceConfig,
468
+ options.projectRoot,
469
+ options.sourceRoot,
470
+ options.projectName,
471
+ false,
472
+ packageJson
473
+ );
474
+ packageJson.exports ??= {};
475
+ packageJson.exports["./package.json"] ??= "./package.json";
476
+ packageJson.exports["."] ??= addPackageJsonExport(
477
+ "index",
478
+ packageJson.type,
479
+ options.sourceRoot
480
+ );
481
+ let entry = [{ in: "./src/index.ts", out: "./src/index.ts" }];
482
+ if (options.entry) {
483
+ if (Array.isArray(options.entry)) {
484
+ entry = options.entry.map(
485
+ (entryPoint) => typeof entryPoint === "string" ? { in: entryPoint, out: entryPoint } : entryPoint
486
+ );
487
+ }
488
+ for (const entryPoint of entry) {
489
+ const split = entryPoint.out.split(".");
490
+ split.pop();
491
+ const entry2 = split.join(".").replaceAll("\\", "/");
492
+ packageJson.exports[`./${entry2}`] ??= addPackageJsonExport(
493
+ entry2,
494
+ options.fixedExtension ? "fixed" : packageJson.type,
495
+ options.sourceRoot
496
+ );
497
+ }
498
+ }
499
+ packageJson.main = !options.fixedExtension && packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
500
+ packageJson.module = !options.fixedExtension && packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
501
+ packageJson.types = `./dist/index.d.${!options.fixedExtension ? "ts" : "mts"}`;
502
+ packageJson.exports = Object.keys(packageJson.exports).reduce(
503
+ (ret, key) => {
504
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
505
+ ret[key.replace("/index", "")] = packageJson.exports[key];
506
+ }
507
+ return ret;
508
+ },
509
+ packageJson.exports
510
+ );
511
+ await writeJsonFile(joinPaths(options.outDir, "package.json"), packageJson);
512
+ stopwatch();
513
+ }
514
+ return options;
515
+ }
516
+ async function executeTSDown(options) {
517
+ writeDebug(` \u{1F680} Running ${options.name} build`, options.workspaceConfig);
518
+ const stopwatch = getStopwatch(`${options.name} build`);
519
+ await tsdown({
520
+ ...options,
521
+ entry: options.entry,
522
+ config: false
523
+ });
524
+ stopwatch();
525
+ return options;
526
+ }
527
+ async function copyBuildAssets(options) {
528
+ writeDebug(
529
+ ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`,
530
+ options.workspaceConfig
531
+ );
532
+ const stopwatch = getStopwatch(`${options.name} asset copy`);
533
+ await copyAssets(
534
+ options.workspaceConfig,
535
+ options.assets ?? [],
536
+ options.outDir,
537
+ options.projectRoot,
538
+ options.sourceRoot,
539
+ true,
540
+ false
541
+ );
542
+ stopwatch();
543
+ return options;
544
+ }
545
+ async function reportResults(options) {
546
+ writeSuccess(
547
+ ` \u{1F4E6} The ${options.name} build completed successfully`,
548
+ options.workspaceConfig
549
+ );
550
+ }
551
+ async function cleanOutputPath(options) {
552
+ if (options.clean !== false && options.workspaceConfig) {
553
+ writeDebug(
554
+ ` \u{1F9F9} Cleaning ${options.name} output path: ${options.workspaceConfig}`,
555
+ options.workspaceConfig
556
+ );
557
+ const stopwatch = getStopwatch(`${options.name} output clean`);
558
+ await cleanDirectories(
559
+ options.name,
560
+ options.outDir,
561
+ options.workspaceConfig
562
+ );
563
+ stopwatch();
564
+ }
565
+ return options;
566
+ }
567
+ async function build(options) {
568
+ writeDebug(` ${brandIcon()} Executing Storm TSDown pipeline`);
569
+ const stopwatch = getStopwatch("TSDown pipeline");
570
+ try {
571
+ const opts = Array.isArray(options) ? options : [options];
572
+ if (opts.length === 0) {
573
+ throw new Error("No build options were provided");
574
+ }
575
+ const resolved = await Promise.all(
576
+ opts.map(async (opt) => await resolveOptions(opt))
577
+ );
578
+ if (resolved.length > 0) {
579
+ await cleanOutputPath(resolved[0]);
580
+ await generatePackageJson(resolved[0]);
581
+ await Promise.all(
582
+ resolved.map(async (opt) => {
583
+ await executeTSDown(opt);
584
+ await copyBuildAssets(opt);
585
+ await reportResults(opt);
586
+ })
587
+ );
588
+ } else {
589
+ writeWarning(
590
+ " \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function."
591
+ );
592
+ }
593
+ writeSuccess(" \u{1F3C1} TSDown pipeline build completed successfully");
594
+ } catch (error) {
595
+ writeFatal(
596
+ "Fatal errors that the build process could not recover from have occured. The build process has been terminated."
597
+ );
598
+ throw error;
599
+ } finally {
600
+ stopwatch();
601
+ }
602
+ }
603
+
604
+ // src/executors/tsdown/executor.ts
605
+ async function tsdownExecutorFn(options, context, config) {
606
+ writeInfo("\u{1F4E6} Running Storm TSDown executor on the workspace", config);
607
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
608
+ throw new Error(
609
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
610
+ );
611
+ }
612
+ await build({
613
+ ...options,
614
+ projectRoot: (
615
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
616
+ context.projectsConfigurations.projects?.[context.projectName].root
617
+ ),
618
+ name: context.projectName,
619
+ sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
620
+ format: options.format,
621
+ platform: options.platform
622
+ });
623
+ return {
624
+ success: true
625
+ };
626
+ }
627
+ var executor_default = withRunExecutor(
628
+ "Storm TSDown build",
629
+ tsdownExecutorFn,
630
+ {
631
+ skipReadingConfig: false,
632
+ hooks: {
633
+ applyDefaultOptions: async (options) => {
634
+ options.entry ??= ["src/index.ts"];
635
+ options.outputPath ??= "dist/{projectRoot}";
636
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
637
+ return options;
638
+ }
639
+ }
640
+ }
641
+ );
642
+
643
+ export {
644
+ tsdownExecutorFn,
645
+ executor_default
646
+ };
@@ -1,6 +1,6 @@
1
1
  import * as _nx_devkit from '@nx/devkit';
2
2
  import { ExecutorContext } from '@nx/devkit';
3
- import { S as StormWorkspaceConfig } from './types-DI57BUsw.js';
3
+ import { StormWorkspaceConfig } from '@storm-software/config';
4
4
 
5
5
  // Generated by @storm-software/untyped
6
6
  // Do not edit this file directly
@@ -1,6 +1,6 @@
1
1
  import * as _nx_devkit from '@nx/devkit';
2
2
  import { ExecutorContext } from '@nx/devkit';
3
- import { S as StormWorkspaceConfig } from './types-DI57BUsw.mjs';
3
+ import { StormWorkspaceConfig } from '@storm-software/config';
4
4
 
5
5
  // Generated by @storm-software/untyped
6
6
  // Do not edit this file directly
@@ -1,6 +1,6 @@
1
1
  import * as _nx_devkit from '@nx/devkit';
2
2
  import { ExecutorContext } from '@nx/devkit';
3
- import { S as StormWorkspaceConfig } from './types-DI57BUsw.js';
3
+ import { StormWorkspaceConfig } from '@storm-software/config';
4
4
 
5
5
  // Generated by @storm-software/untyped
6
6
  // Do not edit this file directly
@@ -1,6 +1,6 @@
1
1
  import * as _nx_devkit from '@nx/devkit';
2
2
  import { ExecutorContext } from '@nx/devkit';
3
- import { S as StormWorkspaceConfig } from './types-DI57BUsw.mjs';
3
+ import { StormWorkspaceConfig } from '@storm-software/config';
4
4
 
5
5
  // Generated by @storm-software/untyped
6
6
  // Do not edit this file directly
@@ -1,6 +1,6 @@
1
1
  import * as _nx_devkit from '@nx/devkit';
2
2
  import { ExecutorContext } from '@nx/devkit';
3
- import { S as StormWorkspaceConfig } from './types-DI57BUsw.js';
3
+ import { StormWorkspaceConfig } from '@storm-software/config';
4
4
 
5
5
  // Generated by @storm-software/untyped
6
6
  // Do not edit this file directly
@@ -1,6 +1,6 @@
1
1
  import * as _nx_devkit from '@nx/devkit';
2
2
  import { ExecutorContext } from '@nx/devkit';
3
- import { S as StormWorkspaceConfig } from './types-DI57BUsw.mjs';
3
+ import { StormWorkspaceConfig } from '@storm-software/config';
4
4
 
5
5
  // Generated by @storm-software/untyped
6
6
  // Do not edit this file directly