@storm-software/workspace-tools 1.263.1 → 1.264.0

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 (146) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +12 -30
  3. package/dist/{chunk-G6GGPUG7.mjs → chunk-267XQYEI.mjs} +4 -4
  4. package/dist/{chunk-2WTKQCPA.mjs → chunk-2BPV2XV2.mjs} +1 -1
  5. package/dist/{chunk-GCN3NUF6.mjs → chunk-3FTFBAIV.mjs} +1 -1
  6. package/dist/{chunk-OQ32KFGA.mjs → chunk-3PWCELL5.mjs} +2 -2
  7. package/dist/{chunk-IT3ENPW3.mjs → chunk-3RLLSZI3.mjs} +3 -3
  8. package/dist/{chunk-XEHJM6RO.mjs → chunk-5CZXBNEE.mjs} +1 -1
  9. package/dist/{chunk-VOIYJ67D.mjs → chunk-5DWBECCN.mjs} +4 -4
  10. package/dist/{chunk-GPOYI6OO.mjs → chunk-77KNPIOO.mjs} +3 -3
  11. package/dist/{chunk-4PDLEPIC.mjs → chunk-7ENGREV2.mjs} +1 -1
  12. package/dist/{chunk-IGJN2SBZ.mjs → chunk-AD4BVP7F.mjs} +2 -2
  13. package/dist/{chunk-HASYGI6W.mjs → chunk-ATIBREWM.mjs} +1 -1
  14. package/dist/{chunk-5JPH5VCU.mjs → chunk-AWKIWCLR.mjs} +2 -2
  15. package/dist/{chunk-GRU4UEE7.mjs → chunk-BMNXBEWE.mjs} +3 -3
  16. package/dist/{chunk-BV32SZPV.mjs → chunk-EVQJFIA7.mjs} +3 -3
  17. package/dist/{chunk-3I74ESKM.mjs → chunk-FIJJTQKT.mjs} +3 -3
  18. package/dist/{chunk-2PKZRCQJ.mjs → chunk-FR3YQN55.mjs} +2 -2
  19. package/dist/{chunk-U6DRC3BT.mjs → chunk-G6VTRIV6.mjs} +4 -4
  20. package/dist/{chunk-STVTZJIX.mjs → chunk-GKFEPODO.mjs} +3 -3
  21. package/dist/{chunk-6YMGUA6X.mjs → chunk-H5VTYV4U.mjs} +2 -2
  22. package/dist/{chunk-J53HKGFM.mjs → chunk-HUVBVDJ7.mjs} +1 -1
  23. package/dist/{chunk-L6CV744X.mjs → chunk-IXZ3PGBP.mjs} +3 -3
  24. package/dist/{chunk-GHJGKUBW.mjs → chunk-JIAGNEII.mjs} +1 -1
  25. package/dist/{chunk-H4RWKANW.mjs → chunk-KTJM6G4K.mjs} +1 -1
  26. package/dist/{chunk-TAJU54DW.mjs → chunk-LZ4WXOF5.mjs} +3 -3
  27. package/dist/{chunk-RGZAGFUD.mjs → chunk-MDK5L6VS.mjs} +4 -4
  28. package/dist/{chunk-3ABED6KX.mjs → chunk-NZAGHP4Q.mjs} +4 -4
  29. package/dist/{chunk-6QKCP4DS.js → chunk-PD4CDI7L.js} +296 -41
  30. package/dist/{chunk-R2BMSX6J.mjs → chunk-RLG36VMZ.mjs} +3 -3
  31. package/dist/{chunk-XIS3TY42.mjs → chunk-RMNEVFW4.mjs} +4 -4
  32. package/dist/{chunk-3XR4FSEA.mjs → chunk-V4QUJRZH.mjs} +4 -4
  33. package/dist/{chunk-AOOHLS72.mjs → chunk-VJJBBVYU.mjs} +3 -3
  34. package/dist/{chunk-EF7U4632.mjs → chunk-VYHRGNJQ.mjs} +306 -51
  35. package/dist/{chunk-OBUTMEEY.mjs → chunk-XB6ATVWM.mjs} +3 -3
  36. package/dist/{chunk-OVLYU6HE.mjs → chunk-XBRJIYCS.mjs} +2 -2
  37. package/dist/{chunk-HY43JWZ7.mjs → chunk-XDVGK64G.mjs} +2 -2
  38. package/dist/{chunk-RULS5ZOT.mjs → chunk-YBDZ7EWU.mjs} +2 -2
  39. package/dist/{chunk-BGSGM2KX.mjs → chunk-YPUNRGTW.mjs} +3 -3
  40. package/dist/{chunk-SF477J3B.mjs → chunk-YZLAY7R4.mjs} +3 -3
  41. package/dist/{chunk-WJTTZD3M.mjs → chunk-ZETTXDZO.mjs} +1 -1
  42. package/dist/{chunk-DGI7OQYG.mjs → chunk-ZPN57TH7.mjs} +4 -4
  43. package/dist/{chunk-B5OPGMAP.mjs → chunk-ZUYLHO4U.mjs} +1 -1
  44. package/dist/executors.d.mts +0 -1
  45. package/dist/executors.d.ts +0 -1
  46. package/dist/executors.js +5 -10
  47. package/dist/executors.mjs +23 -28
  48. package/dist/generators.js +5 -5
  49. package/dist/generators.mjs +20 -20
  50. package/dist/index.d.mts +0 -1
  51. package/dist/index.d.ts +0 -1
  52. package/dist/index.js +10 -15
  53. package/dist/index.mjs +45 -50
  54. package/dist/src/base/base-executor.mjs +6 -6
  55. package/dist/src/base/base-executor.untyped.mjs +1 -1
  56. package/dist/src/base/base-generator.mjs +6 -6
  57. package/dist/src/base/base-generator.untyped.mjs +1 -1
  58. package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
  59. package/dist/src/base/index.mjs +10 -10
  60. package/dist/src/base/typescript-build-executor.untyped.mjs +2 -2
  61. package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
  62. package/dist/src/executors/cargo-build/executor.mjs +8 -8
  63. package/dist/src/executors/cargo-build/untyped.mjs +1 -1
  64. package/dist/src/executors/cargo-check/executor.mjs +8 -8
  65. package/dist/src/executors/cargo-check/untyped.mjs +1 -1
  66. package/dist/src/executors/cargo-clippy/executor.mjs +8 -8
  67. package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
  68. package/dist/src/executors/cargo-doc/executor.mjs +8 -8
  69. package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
  70. package/dist/src/executors/cargo-format/executor.mjs +8 -8
  71. package/dist/src/executors/cargo-format/untyped.mjs +1 -1
  72. package/dist/src/executors/cargo-publish/executor.mjs +3 -3
  73. package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
  74. package/dist/src/executors/clean-package/executor.mjs +6 -6
  75. package/dist/src/executors/clean-package/untyped.mjs +1 -1
  76. package/dist/src/executors/esbuild/executor.js +2 -3
  77. package/dist/src/executors/esbuild/executor.mjs +7 -8
  78. package/dist/src/executors/esbuild/untyped.mjs +2 -2
  79. package/dist/src/executors/npm-publish/executor.mjs +4 -4
  80. package/dist/src/executors/npm-publish/untyped.mjs +1 -1
  81. package/dist/src/executors/size-limit/executor.mjs +7 -7
  82. package/dist/src/executors/size-limit/untyped.mjs +1 -1
  83. package/dist/src/executors/typia/executor.mjs +7 -7
  84. package/dist/src/executors/typia/untyped.mjs +1 -1
  85. package/dist/src/executors/unbuild/executor.mjs +7 -7
  86. package/dist/src/executors/unbuild/untyped.mjs +2 -2
  87. package/dist/src/generators/browser-library/generator.mjs +9 -9
  88. package/dist/src/generators/browser-library/untyped.mjs +1 -1
  89. package/dist/src/generators/config-schema/generator.mjs +7 -7
  90. package/dist/src/generators/config-schema/untyped.mjs +1 -1
  91. package/dist/src/generators/init/init.mjs +2 -2
  92. package/dist/src/generators/init/untyped.mjs +1 -1
  93. package/dist/src/generators/neutral-library/generator.mjs +9 -9
  94. package/dist/src/generators/neutral-library/untyped.mjs +1 -1
  95. package/dist/src/generators/node-library/generator.mjs +9 -9
  96. package/dist/src/generators/node-library/untyped.mjs +1 -1
  97. package/dist/src/generators/preset/generator.mjs +7 -7
  98. package/dist/src/generators/preset/untyped.mjs +1 -1
  99. package/dist/src/generators/release-version/generator.mjs +6 -6
  100. package/dist/src/generators/release-version/untyped.mjs +1 -1
  101. package/dist/src/plugins/rust/cargo-toml.mjs +4 -4
  102. package/dist/src/plugins/rust/index.mjs +4 -4
  103. package/dist/src/plugins/typescript/index.mjs +4 -4
  104. package/dist/src/plugins/typescript/project-config.mjs +4 -4
  105. package/dist/src/plugins/typescript/tsup.mjs +2 -2
  106. package/dist/src/plugins/typescript/untyped-schema.mjs +2 -2
  107. package/dist/src/types.mjs +1 -1
  108. package/dist/src/utils/apply-workspace-tokens.mjs +4 -4
  109. package/dist/src/utils/cargo.mjs +2 -2
  110. package/dist/src/utils/create-cli-options.mjs +2 -2
  111. package/dist/src/utils/get-project-configurations.mjs +4 -4
  112. package/dist/src/utils/index.mjs +14 -14
  113. package/dist/src/utils/lock-file.mjs +2 -2
  114. package/dist/src/utils/package-helpers.mjs +4 -4
  115. package/dist/src/utils/plugin-helpers.mjs +3 -3
  116. package/dist/src/utils/pnpm-deps-update.mjs +3 -3
  117. package/dist/src/utils/project-tags.mjs +2 -2
  118. package/dist/src/utils/toml.mjs +2 -2
  119. package/dist/src/utils/typia-transform.mjs +2 -2
  120. package/dist/src/utils/versions.mjs +1 -1
  121. package/executors.json +0 -5
  122. package/package.json +3 -6
  123. package/dist/chunk-55IQXVOQ.js +0 -308
  124. package/dist/chunk-IFSORSAN.js +0 -304
  125. package/dist/chunk-SE2XSR7P.mjs +0 -304
  126. package/dist/chunk-UFPTODUJ.mjs +0 -308
  127. package/dist/executor-BDvqiAmr.d.ts +0 -144
  128. package/dist/executor-KAQdKP88.d.mts +0 -144
  129. package/dist/src/executors/tsdown/executor.d.mts +0 -4
  130. package/dist/src/executors/tsdown/executor.d.ts +0 -4
  131. package/dist/src/executors/tsdown/executor.js +0 -15
  132. package/dist/src/executors/tsdown/executor.mjs +0 -15
  133. package/dist/src/executors/tsdown/schema.d.ts +0 -135
  134. package/dist/src/executors/tsdown/schema.json +0 -174
  135. package/dist/src/executors/tsdown/schema.md +0 -126
  136. package/dist/src/executors/tsdown/untyped.d.mts +0 -5
  137. package/dist/src/executors/tsdown/untyped.d.ts +0 -5
  138. package/dist/src/executors/tsdown/untyped.js +0 -19
  139. package/dist/src/executors/tsdown/untyped.mjs +0 -19
  140. package/dist/src/plugins/typescript/tsdown.d.mts +0 -7
  141. package/dist/src/plugins/typescript/tsdown.d.ts +0 -7
  142. package/dist/src/plugins/typescript/tsdown.js +0 -159
  143. package/dist/src/plugins/typescript/tsdown.mjs +0 -159
  144. package/docs/api/executors/tsdown/schema.md +0 -126
  145. /package/dist/{chunk-3J53KHVV.js → chunk-7VDOGZYO.js} +0 -0
  146. /package/dist/{chunk-V7YZ3666.mjs → chunk-BLX5SLPC.mjs} +0 -0
@@ -1,304 +0,0 @@
1
- import {
2
- writeDebug,
3
- writeTrace
4
- } from "./chunk-L6CV744X.mjs";
5
- import {
6
- findWorkspaceRoot
7
- } from "./chunk-2PKZRCQJ.mjs";
8
- import {
9
- correctPaths,
10
- joinPaths
11
- } from "./chunk-HASYGI6W.mjs";
12
- import {
13
- __name
14
- } from "./chunk-2WTKQCPA.mjs";
15
-
16
- // ../build-tools/src/config.ts
17
- var DEFAULT_COMPILED_BANNER = `/*****************************************
18
- *
19
- * \u26A1 Built by Storm Software
20
- *
21
- *****************************************/
22
- `;
23
- var DEFAULT_ENVIRONMENT = "production";
24
- var DEFAULT_TARGET = "esnext";
25
- var DEFAULT_ORGANIZATION = "storm-software";
26
-
27
- // ../build-tools/src/utilities/copy-assets.ts
28
- import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
29
- import { glob } from "glob";
30
- import { readFile, writeFile } from "node:fs/promises";
31
- var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson = true, includeSrc = false, banner, footer) => {
32
- const pendingAssets = Array.from(assets ?? []);
33
- pendingAssets.push({
34
- input: projectRoot,
35
- glob: "*.md",
36
- output: "."
37
- });
38
- pendingAssets.push({
39
- input: ".",
40
- glob: "LICENSE",
41
- output: "."
42
- });
43
- if (generatePackageJson === false) {
44
- pendingAssets.push({
45
- input: projectRoot,
46
- glob: "package.json",
47
- output: "."
48
- });
49
- }
50
- if (includeSrc === true) {
51
- pendingAssets.push({
52
- input: sourceRoot,
53
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
54
- output: "src/"
55
- });
56
- }
57
- writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
58
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
59
- const assetHandler = new CopyAssetsHandler({
60
- projectDir: projectRoot,
61
- rootDir: config.workspaceRoot,
62
- outputDir: outputPath,
63
- assets: pendingAssets
64
- });
65
- await assetHandler.processAllAssetsOnce();
66
- if (includeSrc === true) {
67
- writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
68
- const files = await glob([
69
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
70
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
71
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
72
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
73
- ]);
74
- await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
75
-
76
- ${await readFile(file, "utf8")}
77
-
78
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
79
- }
80
- }, "copyAssets");
81
-
82
- // ../build-tools/src/utilities/generate-package-json.ts
83
- import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
84
- import { Glob } from "glob";
85
- import { existsSync, readFileSync } from "node:fs";
86
- import { readFile as readFile2 } from "node:fs/promises";
87
- import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
88
- var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
89
- const projectGraph = readCachedProjectGraph();
90
- const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
91
- const localPackages = [];
92
- for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
93
- const projectNode = project.node;
94
- if (projectNode.data.root) {
95
- const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
96
- if (existsSync(projectPackageJsonPath)) {
97
- const projectPackageJsonContent = await readFile2(projectPackageJsonPath, "utf8");
98
- const projectPackageJson = JSON.parse(projectPackageJsonContent);
99
- if (projectPackageJson.private !== true) {
100
- localPackages.push(projectPackageJson);
101
- }
102
- }
103
- }
104
- }
105
- if (localPackages.length > 0) {
106
- writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
107
- const projectJsonFile = await readFile2(joinPaths(projectRoot, "project.json"), "utf8");
108
- const projectJson = JSON.parse(projectJsonFile);
109
- const projectName2 = projectJson.name;
110
- const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
111
- if (!projectConfigurations?.projects?.[projectName2]) {
112
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
113
- }
114
- const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
115
- if (projectConfigurations.projects?.[dep]) {
116
- const depPackageJsonPath = joinPaths(workspaceRoot, projectConfigurations.projects[dep].root, "package.json");
117
- if (existsSync(depPackageJsonPath)) {
118
- const depPackageJsonContent = readFileSync(depPackageJsonPath, "utf8");
119
- const depPackageJson = JSON.parse(depPackageJsonContent);
120
- if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
121
- ret.push(depPackageJson.name);
122
- }
123
- }
124
- }
125
- return ret;
126
- }, []);
127
- packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
128
- if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name)) {
129
- ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
130
- }
131
- return ret;
132
- }, packageJson.dependencies ?? {});
133
- packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
134
- if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name)) {
135
- ret[localPackage.name] = localPackage.version || "0.0.1";
136
- }
137
- return ret;
138
- }, packageJson.devDependencies ?? {});
139
- } else {
140
- writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
141
- }
142
- return packageJson;
143
- }, "addPackageDependencies");
144
- var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
145
- const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
146
- const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot, "package.json"), "utf8");
147
- const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
148
- packageJson.type ??= "module";
149
- packageJson.sideEffects ??= false;
150
- if (includeSrc === true) {
151
- let distSrc = sourceRoot.replace(projectRoot, "");
152
- if (distSrc.startsWith("/")) {
153
- distSrc = distSrc.substring(1);
154
- }
155
- packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
156
- }
157
- packageJson.files ??= [
158
- "dist/**/*"
159
- ];
160
- if (includeSrc === true && !packageJson.files.includes("src")) {
161
- packageJson.files.push("src/**/*");
162
- }
163
- packageJson.publishConfig ??= {
164
- access: "public"
165
- };
166
- packageJson.description ??= workspacePackageJson.description;
167
- packageJson.homepage ??= workspacePackageJson.homepage;
168
- packageJson.bugs ??= workspacePackageJson.bugs;
169
- packageJson.license ??= workspacePackageJson.license;
170
- packageJson.keywords ??= workspacePackageJson.keywords;
171
- packageJson.funding ??= workspacePackageJson.funding;
172
- packageJson.author ??= workspacePackageJson.author;
173
- packageJson.maintainers ??= workspacePackageJson.maintainers;
174
- if (!packageJson.maintainers && packageJson.author) {
175
- packageJson.maintainers = [
176
- packageJson.author
177
- ];
178
- }
179
- packageJson.contributors ??= workspacePackageJson.contributors;
180
- if (!packageJson.contributors && packageJson.author) {
181
- packageJson.contributors = [
182
- packageJson.author
183
- ];
184
- }
185
- packageJson.repository ??= workspacePackageJson.repository;
186
- packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
187
- return packageJson;
188
- }, "addWorkspacePackageJsonFields");
189
- var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot) => {
190
- let entry = file.replaceAll("\\", "/");
191
- if (sourceRoot) {
192
- entry = entry.replace(sourceRoot, "");
193
- }
194
- return {
195
- import: {
196
- types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
197
- default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
198
- },
199
- require: {
200
- types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
201
- default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
202
- },
203
- default: {
204
- types: `./dist/${entry}.d.ts`,
205
- default: `./dist/${entry}.js`
206
- }
207
- };
208
- }, "addPackageJsonExport");
209
-
210
- // ../build-tools/src/utilities/get-entry-points.ts
211
- import { glob as glob2 } from "glob";
212
- var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
213
- const workspaceRoot = config.workspaceRoot || findWorkspaceRoot();
214
- const entryPoints = [];
215
- if (entry) {
216
- if (typeof entry === "string") {
217
- entryPoints.push(entry);
218
- } else if (Array.isArray(entry)) {
219
- entryPoints.push(...entry);
220
- } else {
221
- entryPoints.push(...Object.values(entry));
222
- }
223
- }
224
- if (emitOnAll) {
225
- entryPoints.push(joinPaths(workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}"));
226
- }
227
- const results = await Promise.all(entryPoints.map(async (entryPoint) => {
228
- const paths = [];
229
- if (entryPoint.includes("*")) {
230
- const files = await glob2(entryPoint, {
231
- withFileTypes: true,
232
- ignore: [
233
- "**/node_modules/**"
234
- ]
235
- });
236
- paths.push(...files.reduce((ret, filePath) => {
237
- const result = correctPaths(joinPaths(filePath.path, filePath.name).replaceAll(correctPaths(workspaceRoot), "").replaceAll(correctPaths(projectRoot), ""));
238
- if (result) {
239
- writeDebug(`Trying to add entry point ${result} at "${joinPaths(filePath.path, filePath.name)}"`, config);
240
- if (!paths.includes(result)) {
241
- paths.push(result);
242
- }
243
- }
244
- return ret;
245
- }, []));
246
- } else {
247
- paths.push(entryPoint);
248
- }
249
- return paths;
250
- }));
251
- return results.filter(Boolean).reduce((ret, result) => {
252
- result.forEach((res) => {
253
- if (res && !ret.includes(res)) {
254
- ret.push(res);
255
- }
256
- });
257
- return ret;
258
- }, []);
259
- }, "getEntryPoints");
260
-
261
- // ../build-tools/src/utilities/get-env.ts
262
- var getEnv = /* @__PURE__ */ __name((builder, options) => {
263
- return {
264
- STORM_BUILD: builder,
265
- STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
266
- STORM_NAME: options.name,
267
- STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
268
- STORM_PLATFORM: options.platform,
269
- STORM_FORMAT: JSON.stringify(options.format),
270
- STORM_TARGET: JSON.stringify(options.target),
271
- ...options.env
272
- };
273
- }, "getEnv");
274
-
275
- // ../build-tools/src/plugins/swc.ts
276
- import { transform } from "@swc/core";
277
-
278
- // ../build-tools/src/plugins/ts-resolve.ts
279
- import fs from "node:fs";
280
- import { builtinModules } from "node:module";
281
- import path from "node:path";
282
- import _resolve from "resolve";
283
-
284
- // ../build-tools/src/plugins/type-definitions.ts
285
- import { stripIndents } from "@nx/devkit";
286
- import { relative } from "path";
287
-
288
- // ../build-tools/src/utilities/read-nx-config.ts
289
- import { existsSync as existsSync2 } from "node:fs";
290
- import { readFile as readFile3 } from "node:fs/promises";
291
-
292
- // ../build-tools/src/utilities/task-graph.ts
293
- import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
294
-
295
- export {
296
- DEFAULT_COMPILED_BANNER,
297
- DEFAULT_TARGET,
298
- copyAssets,
299
- addPackageDependencies,
300
- addWorkspacePackageJsonFields,
301
- addPackageJsonExport,
302
- getEntryPoints,
303
- getEnv
304
- };
@@ -1,308 +0,0 @@
1
- import {
2
- DEFAULT_TARGET,
3
- addPackageDependencies,
4
- addPackageJsonExport,
5
- addWorkspacePackageJsonFields,
6
- copyAssets,
7
- getEntryPoints,
8
- getEnv
9
- } from "./chunk-SE2XSR7P.mjs";
10
- import {
11
- withRunExecutor
12
- } from "./chunk-VOIYJ67D.mjs";
13
- import {
14
- getConfig,
15
- getStopwatch,
16
- isVerbose,
17
- writeDebug,
18
- writeFatal,
19
- writeInfo,
20
- writeSuccess,
21
- writeWarning
22
- } from "./chunk-L6CV744X.mjs";
23
- import {
24
- joinPaths
25
- } from "./chunk-HASYGI6W.mjs";
26
- import {
27
- __name
28
- } from "./chunk-2WTKQCPA.mjs";
29
-
30
- // ../tsdown/src/build.ts
31
- import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph, writeJsonFile } from "@nx/devkit";
32
- import defu from "defu";
33
- import { existsSync } from "node:fs";
34
- import hf from "node:fs/promises";
35
- import { findWorkspaceRoot } from "nx/src/utils/find-workspace-root";
36
- import { build as tsdown } from "tsdown";
37
-
38
- // ../tsdown/src/clean.ts
39
- import { rm } from "node:fs/promises";
40
- async function cleanDirectories(name = "TSDown", directory, config) {
41
- await rm(directory, {
42
- recursive: true,
43
- force: true
44
- });
45
- }
46
- __name(cleanDirectories, "cleanDirectories");
47
-
48
- // ../tsdown/src/config.ts
49
- var DEFAULT_BUILD_OPTIONS = {
50
- platform: "node",
51
- target: "node22",
52
- format: [
53
- "esm",
54
- "cjs"
55
- ],
56
- tsconfig: "tsconfig.json",
57
- mode: "production",
58
- globalName: "globalThis",
59
- unused: {
60
- level: "error"
61
- },
62
- injectShims: true,
63
- watch: false,
64
- bundle: true,
65
- treeshake: true,
66
- clean: true,
67
- debug: false
68
- };
69
-
70
- // ../tsdown/src/build.ts
71
- var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
72
- const projectRoot = userOptions.projectRoot;
73
- const workspaceRoot = findWorkspaceRoot(projectRoot);
74
- if (!workspaceRoot) {
75
- throw new Error("Cannot find Nx workspace root");
76
- }
77
- const config = await getConfig(workspaceRoot.dir);
78
- writeDebug(" \u2699\uFE0F Resolving build options", config);
79
- const stopwatch = getStopwatch("Build options resolution");
80
- const projectGraph = await createProjectGraphAsync({
81
- exitOnError: true
82
- });
83
- const projectJsonPath = joinPaths(workspaceRoot.dir, projectRoot, "project.json");
84
- if (!existsSync(projectJsonPath)) {
85
- throw new Error("Cannot find project.json configuration");
86
- }
87
- const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
88
- const projectJson = JSON.parse(projectJsonFile);
89
- const projectName = projectJson.name;
90
- const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
91
- if (!projectConfigurations?.projects?.[projectName]) {
92
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
93
- }
94
- const options = defu(userOptions, DEFAULT_BUILD_OPTIONS);
95
- options.name ??= `${projectName}-${options.format}`;
96
- options.target ??= DEFAULT_TARGET;
97
- const packageJsonPath = joinPaths(workspaceRoot.dir, options.projectRoot, "package.json");
98
- if (!existsSync(packageJsonPath)) {
99
- throw new Error("Cannot find package.json configuration");
100
- }
101
- const env = getEnv("tsdown", options);
102
- const result = {
103
- ...options,
104
- config,
105
- ...userOptions,
106
- tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
107
- format: options.format || "cjs",
108
- entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
109
- "./src/index.ts"
110
- ], userOptions.emitOnAll),
111
- outdir: userOptions.outputPath || joinPaths("dist", projectRoot),
112
- plugins: [],
113
- name: userOptions.name || projectName,
114
- projectConfigurations,
115
- projectName,
116
- projectGraph,
117
- sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
118
- minify: userOptions.minify || !userOptions.debug,
119
- verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
120
- includeSrc: userOptions.includeSrc === true,
121
- metafile: userOptions.metafile !== false,
122
- generatePackageJson: userOptions.generatePackageJson !== false,
123
- clean: userOptions.clean !== false,
124
- emitOnAll: userOptions.emitOnAll === true,
125
- dts: userOptions.emitTypes === true ? {
126
- transformer: "oxc"
127
- } : userOptions.emitTypes,
128
- bundleDts: userOptions.emitTypes,
129
- assets: userOptions.assets ?? [],
130
- shims: userOptions.injectShims !== true,
131
- bundle: userOptions.bundle !== false,
132
- watch: userOptions.watch === true,
133
- define: {
134
- STORM_FORMAT: JSON.stringify(options.format || "cjs"),
135
- ...options.format === "cjs" && options.injectShims ? {
136
- "import.meta.url": "importMetaUrl"
137
- } : {},
138
- ...Object.keys(env || {}).reduce((res, key) => {
139
- const value = JSON.stringify(env[key]);
140
- return {
141
- ...res,
142
- [`process.env.${key}`]: value,
143
- [`import.meta.env.${key}`]: value
144
- };
145
- }, {}),
146
- ...options.define
147
- }
148
- };
149
- stopwatch();
150
- return result;
151
- }, "resolveOptions");
152
- async function generatePackageJson(options) {
153
- if (options.generatePackageJson !== false && existsSync(joinPaths(options.projectRoot, "package.json"))) {
154
- writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
155
- const stopwatch = getStopwatch("Write package.json file");
156
- const packageJsonPath = joinPaths(options.projectRoot, "project.json");
157
- if (!existsSync(packageJsonPath)) {
158
- throw new Error("Cannot find package.json configuration");
159
- }
160
- const packageJsonFile = await hf.readFile(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
161
- if (!packageJsonFile) {
162
- throw new Error("Cannot find package.json configuration file");
163
- }
164
- let packageJson = JSON.parse(packageJsonFile);
165
- packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
166
- packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
167
- packageJson.exports ??= {};
168
- packageJson.exports["./package.json"] ??= "./package.json";
169
- packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot);
170
- let entryPoints = [
171
- {
172
- in: "./src/index.ts",
173
- out: "./src/index.ts"
174
- }
175
- ];
176
- if (options.entryPoints) {
177
- if (Array.isArray(options.entryPoints)) {
178
- entryPoints = options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
179
- in: entryPoint,
180
- out: entryPoint
181
- } : entryPoint);
182
- }
183
- for (const entryPoint of entryPoints) {
184
- const split = entryPoint.out.split(".");
185
- split.pop();
186
- const entry = split.join(".").replaceAll("\\", "/");
187
- packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, options.sourceRoot);
188
- }
189
- }
190
- packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
191
- packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
192
- packageJson.types = "./dist/index.d.ts";
193
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
194
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
195
- ret[key.replace("/index", "")] = packageJson.exports[key];
196
- }
197
- return ret;
198
- }, packageJson.exports);
199
- await writeJsonFile(joinPaths(options.outdir, "package.json"), packageJson);
200
- stopwatch();
201
- }
202
- return options;
203
- }
204
- __name(generatePackageJson, "generatePackageJson");
205
- async function executeTSDown(options) {
206
- writeDebug(` \u{1F680} Running ${options.name} build`, options.config);
207
- const stopwatch = getStopwatch(`${options.name} build`);
208
- await tsdown({
209
- ...options,
210
- entry: options.entryPoints,
211
- outDir: options.outdir,
212
- config: false
213
- });
214
- stopwatch();
215
- return options;
216
- }
217
- __name(executeTSDown, "executeTSDown");
218
- async function copyBuildAssets(options) {
219
- writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
220
- const stopwatch = getStopwatch(`${options.name} asset copy`);
221
- await copyAssets(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.sourceRoot, true, false);
222
- stopwatch();
223
- return options;
224
- }
225
- __name(copyBuildAssets, "copyBuildAssets");
226
- async function reportResults(options) {
227
- writeSuccess(` \u{1F4E6} The ${options.name} build completed successfully`, options.config);
228
- }
229
- __name(reportResults, "reportResults");
230
- async function cleanOutputPath(options) {
231
- if (options.clean !== false && options.outdir) {
232
- writeDebug(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outdir}`, options.config);
233
- const stopwatch = getStopwatch(`${options.name} output clean`);
234
- await cleanDirectories(options.name, options.outdir, options.config);
235
- stopwatch();
236
- }
237
- return options;
238
- }
239
- __name(cleanOutputPath, "cleanOutputPath");
240
- async function build(options) {
241
- writeDebug(` \u26A1 Executing Storm TSDown pipeline`);
242
- const stopwatch = getStopwatch("TSDown pipeline");
243
- try {
244
- const opts = Array.isArray(options) ? options : [
245
- options
246
- ];
247
- if (opts.length === 0) {
248
- throw new Error("No build options were provided");
249
- }
250
- const resolved = await Promise.all(opts.map(async (opt) => await resolveOptions(opt)));
251
- if (resolved.length > 0) {
252
- await cleanOutputPath(resolved[0]);
253
- await generatePackageJson(resolved[0]);
254
- await Promise.all(resolved.map(async (opt) => {
255
- await executeTSDown(opt);
256
- await copyBuildAssets(opt);
257
- await reportResults(opt);
258
- }));
259
- } else {
260
- writeWarning(" \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function.");
261
- }
262
- writeSuccess(" \u{1F3C1} TSDown pipeline build completed successfully");
263
- } catch (error) {
264
- writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
265
- throw error;
266
- } finally {
267
- stopwatch();
268
- }
269
- }
270
- __name(build, "build");
271
-
272
- // src/executors/tsdown/executor.ts
273
- async function tsdownExecutorFn(options, context, config) {
274
- writeInfo("\u{1F4E6} Running Storm TSDown build executor on the workspace", config);
275
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
276
- throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
277
- }
278
- await build({
279
- ...options,
280
- projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
281
- projectName: context.projectName,
282
- sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
283
- format: options.format,
284
- platform: options.platform
285
- });
286
- return {
287
- success: true
288
- };
289
- }
290
- __name(tsdownExecutorFn, "tsdownExecutorFn");
291
- var executor_default = withRunExecutor("Storm TSDown build executor", tsdownExecutorFn, {
292
- skipReadingConfig: false,
293
- hooks: {
294
- applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
295
- options.entry ??= [
296
- "src/index.ts"
297
- ];
298
- options.outputPath ??= "dist/{projectRoot}";
299
- options.tsconfig ??= "{projectRoot}/tsconfig.json";
300
- return options;
301
- }, "applyDefaultOptions")
302
- }
303
- });
304
-
305
- export {
306
- tsdownExecutorFn,
307
- executor_default
308
- };