@storm-software/workspace-tools 1.233.0 → 1.233.1

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 (91) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-OCXXIUSC.mjs → chunk-2DNLATEG.mjs} +1 -30
  4. package/dist/{chunk-MA2QNKZ7.js → chunk-2E2DXYRF.js} +2 -2
  5. package/dist/{chunk-LEHZZU32.js → chunk-2NYBFBUU.js} +2 -2
  6. package/dist/{chunk-T5XCHBCB.mjs → chunk-3GQ6H7GF.mjs} +3 -3
  7. package/dist/{chunk-GVBCN2FA.mjs → chunk-4G35AYIJ.mjs} +1 -1
  8. package/dist/{chunk-UPMKBKEN.js → chunk-5Z7CCIIJ.js} +2 -2
  9. package/dist/{chunk-ZMA37UYA.js → chunk-7PETCK66.js} +41 -41
  10. package/dist/{chunk-DM2FMT3G.mjs → chunk-7TEC757Y.mjs} +0 -1
  11. package/dist/{chunk-QA6M5DEJ.js → chunk-A3SB76KG.js} +2 -2
  12. package/dist/{chunk-NHSJQ3KY.mjs → chunk-AKLDSJTD.mjs} +1 -1
  13. package/dist/{chunk-HIBDVUQ5.js → chunk-BANJXE74.js} +2 -2
  14. package/dist/{chunk-5FCVQVIS.mjs → chunk-BARR5D5N.mjs} +1 -1
  15. package/dist/{chunk-5KPWW65X.mjs → chunk-CNX755OY.mjs} +1 -1
  16. package/dist/{chunk-EECNVIFZ.js → chunk-DOQEFB3U.js} +5 -5
  17. package/dist/{chunk-FHRBHQ5D.js → chunk-ENBOBX3C.js} +2 -2
  18. package/dist/{chunk-AX4OFOSN.js → chunk-FE52EM76.js} +8 -37
  19. package/dist/{chunk-VOPIMPWA.js → chunk-FQCHDI2P.js} +11 -11
  20. package/dist/{chunk-OJV4NKCZ.js → chunk-IIMNDUXX.js} +9 -9
  21. package/dist/{chunk-DNUDJEZX.mjs → chunk-IVRCEWW4.mjs} +2 -2
  22. package/dist/{chunk-SZJOJ773.mjs → chunk-KZGWRL4P.mjs} +1 -1
  23. package/dist/{chunk-4EO5ZWLS.js → chunk-MVCUW6FQ.js} +31 -31
  24. package/dist/{chunk-OFSUFHFM.mjs → chunk-N4J73OER.mjs} +2 -2
  25. package/dist/{chunk-ZYC7FHCD.js → chunk-OH2QVCID.js} +5 -5
  26. package/dist/{chunk-A4DWQQ6J.mjs → chunk-PKR4QUWJ.mjs} +1 -1
  27. package/dist/{chunk-OE5KYONM.mjs → chunk-PSMBZ5DR.mjs} +1 -1
  28. package/dist/{chunk-FZ3N3UJ5.mjs → chunk-QQHYWAVX.mjs} +3 -3
  29. package/dist/{chunk-SQHYP2JD.mjs → chunk-THMXFMSK.mjs} +1 -1
  30. package/dist/{chunk-UA7PFIEF.mjs → chunk-UROGF3KF.mjs} +1 -1
  31. package/dist/{chunk-5Q3LI7CF.js → chunk-UW6T77HF.js} +15 -15
  32. package/dist/{chunk-T2CG5RNT.js → chunk-VQMSXER7.js} +2 -2
  33. package/dist/{chunk-QCAF5WDF.mjs → chunk-VVHGKFCB.mjs} +2 -2
  34. package/dist/chunk-VWJEKC3P.mjs +83 -0
  35. package/dist/{chunk-WKYE64AL.mjs → chunk-WWSP3KEN.mjs} +1 -1
  36. package/dist/{chunk-FDI6QWNH.mjs → chunk-XOIDDNCA.mjs} +1 -1
  37. package/dist/chunk-XWYXKDH2.js +83 -0
  38. package/dist/{chunk-L2KYX6WC.js → chunk-Y2LDGJCA.js} +2 -2
  39. package/dist/{chunk-2AQPTJLC.js → chunk-YFIHF222.js} +2 -2
  40. package/dist/{chunk-CDOWHRVE.js → chunk-YO7MVS4A.js} +17 -17
  41. package/dist/{chunk-GRBZKMJI.js → chunk-ZJXBN32W.js} +1 -2
  42. package/dist/{chunk-QTW54PBD.mjs → chunk-ZPQJ7P6C.mjs} +1 -1
  43. package/dist/executors.js +14 -14
  44. package/dist/executors.mjs +13 -13
  45. package/dist/generators.js +9 -9
  46. package/dist/generators.mjs +8 -8
  47. package/dist/index.js +21 -21
  48. package/dist/index.mjs +20 -20
  49. package/dist/src/base/base-executor.js +3 -3
  50. package/dist/src/base/base-executor.mjs +2 -2
  51. package/dist/src/base/base-generator.js +3 -3
  52. package/dist/src/base/base-generator.mjs +2 -2
  53. package/dist/src/base/index.js +4 -4
  54. package/dist/src/base/index.mjs +3 -3
  55. package/dist/src/executors/cargo-build/executor.js +4 -4
  56. package/dist/src/executors/cargo-build/executor.mjs +3 -3
  57. package/dist/src/executors/cargo-check/executor.js +4 -4
  58. package/dist/src/executors/cargo-check/executor.mjs +3 -3
  59. package/dist/src/executors/cargo-clippy/executor.js +4 -4
  60. package/dist/src/executors/cargo-clippy/executor.mjs +3 -3
  61. package/dist/src/executors/cargo-doc/executor.js +4 -4
  62. package/dist/src/executors/cargo-doc/executor.mjs +3 -3
  63. package/dist/src/executors/cargo-format/executor.js +4 -4
  64. package/dist/src/executors/cargo-format/executor.mjs +3 -3
  65. package/dist/src/executors/clean-package/executor.js +5 -5
  66. package/dist/src/executors/clean-package/executor.mjs +2 -2
  67. package/dist/src/executors/esbuild/executor.js +5 -5
  68. package/dist/src/executors/esbuild/executor.mjs +4 -4
  69. package/dist/src/executors/size-limit/executor.js +4 -4
  70. package/dist/src/executors/size-limit/executor.mjs +3 -3
  71. package/dist/src/executors/tsdown/executor.js +5 -5
  72. package/dist/src/executors/tsdown/executor.mjs +4 -4
  73. package/dist/src/executors/typia/executor.js +4 -4
  74. package/dist/src/executors/typia/executor.mjs +3 -3
  75. package/dist/src/executors/unbuild/executor.js +4 -5
  76. package/dist/src/executors/unbuild/executor.mjs +3 -4
  77. package/dist/src/generators/browser-library/generator.js +4 -4
  78. package/dist/src/generators/browser-library/generator.mjs +3 -3
  79. package/dist/src/generators/config-schema/generator.js +4 -4
  80. package/dist/src/generators/config-schema/generator.mjs +3 -3
  81. package/dist/src/generators/neutral-library/generator.js +4 -4
  82. package/dist/src/generators/neutral-library/generator.mjs +3 -3
  83. package/dist/src/generators/node-library/generator.js +4 -4
  84. package/dist/src/generators/node-library/generator.mjs +3 -3
  85. package/dist/src/generators/preset/generator.js +4 -4
  86. package/dist/src/generators/preset/generator.mjs +3 -3
  87. package/dist/src/generators/release-version/generator.js +3 -3
  88. package/dist/src/generators/release-version/generator.mjs +2 -2
  89. package/package.json +5 -4
  90. package/dist/chunk-JHP7QOI4.js +0 -507
  91. package/dist/chunk-TSTK2BD6.mjs +0 -507
@@ -1,507 +0,0 @@
1
- import {
2
- addPackageDependencies,
3
- addPackageJsonExports,
4
- addWorkspacePackageJsonFields,
5
- copyAssets
6
- } from "./chunk-OCXXIUSC.mjs";
7
- import {
8
- withRunExecutor
9
- } from "./chunk-GVBCN2FA.mjs";
10
- import {
11
- LogLevelLabel,
12
- getStopwatch,
13
- isVerbose,
14
- loadStormConfig,
15
- writeDebug,
16
- writeError,
17
- writeFatal,
18
- writeInfo,
19
- writeSuccess,
20
- writeTrace
21
- } from "./chunk-DM2FMT3G.mjs";
22
- import {
23
- joinPaths
24
- } from "./chunk-PVTEDLBL.mjs";
25
- import {
26
- __name
27
- } from "./chunk-XUV4U54K.mjs";
28
-
29
- // ../unbuild/src/build.ts
30
- import { readCachedProjectGraph as readCachedProjectGraph2, writeJsonFile } from "@nx/devkit";
31
- import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
32
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
33
- import defu from "defu";
34
- import { createJiti } from "jiti";
35
- import { existsSync } from "node:fs";
36
- import { readFile } from "node:fs/promises";
37
- import { relative as relative2 } from "node:path";
38
- import { findWorkspaceRoot } from "nx/src/utils/find-workspace-root";
39
-
40
- // ../unbuild/src/clean.ts
41
- import { rm } from "node:fs/promises";
42
- async function clean(name = "Unbuild", directory, config) {
43
- writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
44
- const stopwatch = getStopwatch(`${name} output clean`);
45
- await rm(directory, {
46
- recursive: true,
47
- force: true
48
- });
49
- stopwatch();
50
- }
51
- __name(clean, "clean");
52
-
53
- // ../unbuild/src/plugins/analyze.ts
54
- var formatBytes = /* @__PURE__ */ __name((bytes) => {
55
- if (bytes === 0) return "0 Byte";
56
- const k = 1e3;
57
- const dm = 3;
58
- const sizes = [
59
- "Bytes",
60
- "KB",
61
- "MB",
62
- "GB"
63
- ];
64
- const i = Math.floor(Math.log(bytes) / Math.log(k));
65
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
66
- }, "formatBytes");
67
- var analyzePlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
68
- return {
69
- name: "storm:analyzer",
70
- renderChunk(source, chunk) {
71
- const sourceBytes = formatBytes(source.length);
72
- const fileName = chunk.fileName;
73
- writeInfo(` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
74
- }
75
- };
76
- }, "analyzePlugin");
77
-
78
- // ../unbuild/src/plugins/on-error.ts
79
- var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
80
- name: "storm:on-error",
81
- buildEnd(error) {
82
- if (error) {
83
- writeError(`The following errors occurred during the build:
84
- ${error ? error.message : "Unknown build error"}
85
-
86
- `, resolvedOptions.config);
87
- throw new Error("Storm unbuild process failed with errors.");
88
- }
89
- },
90
- renderError(error) {
91
- writeError(`The following errors occurred during the build:
92
- ${error ? error.message : "Unknown build error"}
93
-
94
- `, resolvedOptions.config);
95
- throw new Error("Storm unbuild process failed with errors.");
96
- }
97
- }), "onErrorPlugin");
98
-
99
- // ../unbuild/src/plugins/tsc.ts
100
- import { readCachedProjectGraph } from "@nx/devkit";
101
- import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
102
- import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
103
- import ts2Plugin from "rollup-plugin-typescript2";
104
-
105
- // ../unbuild/src/utilities/helpers.ts
106
- import { joinPathFragments } from "@nx/devkit";
107
- import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
108
- import { dirname, extname } from "node:path";
109
- import { pathToFileURL } from "node:url";
110
- import ts from "typescript";
111
- async function loadConfig(configPath) {
112
- if (!/\.(js|mjs)$/.test(extname(configPath))) {
113
- throw new Error("Unsupported config file format");
114
- }
115
- return import(pathToFileURL(configPath).toString()).then((config) => config.default);
116
- }
117
- __name(loadConfig, "loadConfig");
118
- async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
119
- const tsConfigFile = ts.readConfigFile(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
120
- const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath)));
121
- const compilerOptions = {
122
- rootDir: projectRoot,
123
- declaration: true,
124
- paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
125
- };
126
- writeTrace(compilerOptions, config);
127
- return compilerOptions;
128
- }
129
- __name(createTsCompilerOptions, "createTsCompilerOptions");
130
-
131
- // ../unbuild/src/plugins/tsc.ts
132
- var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
133
- const projectGraph = readCachedProjectGraph();
134
- const result = calculateProjectBuildableDependencies(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
135
- let dependencies = result.dependencies;
136
- const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
137
- if (tsLibDependency) {
138
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
139
- dependencies.push(tsLibDependency);
140
- }
141
- return ts2Plugin({
142
- check: options.emitTypes !== false,
143
- tsconfig: resolvedOptions.tsconfig,
144
- tsconfigOverride: {
145
- compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
146
- }
147
- });
148
- }, "tscPlugin");
149
-
150
- // ../unbuild/src/plugins/type-definitions.ts
151
- import { relative } from "node:path";
152
- function typeDefinitions(projectRoot) {
153
- return {
154
- name: "storm:dts-bundle",
155
- async generateBundle(_opts, bundle) {
156
- for (const file of Object.values(bundle)) {
157
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
158
- continue;
159
- }
160
- const hasDefaultExport = file.exports.includes("default");
161
- const entrySourceFileName = relative(projectRoot, file.facadeModuleId);
162
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
163
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
164
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
165
- const dtsFileSource = hasDefaultExport ? `
166
- export * from ${relativeSourceDtsName};
167
- export { default } from ${relativeSourceDtsName};
168
- ` : `export * from ${relativeSourceDtsName};
169
- `;
170
- this.emitFile({
171
- type: "asset",
172
- fileName: dtsFileName,
173
- source: dtsFileSource
174
- });
175
- }
176
- }
177
- };
178
- }
179
- __name(typeDefinitions, "typeDefinitions");
180
-
181
- // ../unbuild/src/config.ts
182
- var getDefaultBuildPlugins = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
183
- analyzePlugin(options, resolvedOptions),
184
- typeDefinitions(resolvedOptions.projectRoot),
185
- tscPlugin(options, resolvedOptions),
186
- onErrorPlugin(options, resolvedOptions)
187
- ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
188
-
189
- // ../unbuild/src/build.ts
190
- async function resolveOptions(options) {
191
- const projectRoot = options.projectRoot;
192
- if (!projectRoot) {
193
- throw new Error("Cannot find project root");
194
- }
195
- const outputPath = options.outputPath || joinPaths("dist", projectRoot);
196
- const workspaceRoot = findWorkspaceRoot(projectRoot);
197
- if (!workspaceRoot) {
198
- throw new Error("Cannot find workspace root");
199
- }
200
- const config = await loadStormConfig(workspaceRoot.dir);
201
- writeDebug(" \u2699\uFE0F Resolving build options", config);
202
- const stopwatch = getStopwatch("Build options resolution");
203
- if (options.configPath) {
204
- const configFile = await loadConfig(options.configPath);
205
- if (configFile) {
206
- options = defu(options, configFile);
207
- }
208
- }
209
- const projectGraph = readCachedProjectGraph2();
210
- const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
211
- if (!existsSync(projectJsonPath)) {
212
- throw new Error("Cannot find project.json configuration");
213
- }
214
- const projectJsonContent = await readFile(projectJsonPath, "utf8");
215
- const projectJson = JSON.parse(projectJsonContent);
216
- const projectName = projectJson.name;
217
- const packageJsonPath = joinPaths(workspaceRoot.dir, projectRoot, "package.json");
218
- if (!existsSync(packageJsonPath)) {
219
- throw new Error("Cannot find package.json configuration");
220
- }
221
- const packageJsonContent = await readFile(packageJsonPath, "utf8");
222
- const packageJson = JSON.parse(packageJsonContent);
223
- let tsconfig = options.tsconfig;
224
- if (!tsconfig) {
225
- tsconfig = joinPaths(workspaceRoot.dir, projectRoot, "tsconfig.json");
226
- }
227
- if (!existsSync(tsconfig)) {
228
- throw new Error("Cannot find tsconfig.json configuration");
229
- }
230
- let sourceRoot = projectJson.sourceRoot;
231
- if (!sourceRoot) {
232
- sourceRoot = joinPaths(projectRoot, "src");
233
- }
234
- if (!existsSync(sourceRoot)) {
235
- throw new Error("Cannot find sourceRoot directory");
236
- }
237
- const result = calculateProjectBuildableDependencies2(void 0, projectGraph, workspaceRoot.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
238
- let dependencies = result.dependencies;
239
- const tsLibDependency = getHelperDependency2(HelperDependency2.tsc, tsconfig, dependencies, projectGraph, true);
240
- if (tsLibDependency) {
241
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
242
- dependencies.push(tsLibDependency);
243
- }
244
- const jiti = createJiti(config.workspaceRoot, {
245
- cache: true,
246
- fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
247
- interopDefault: true
248
- });
249
- const resolvedOptions = {
250
- name: projectName,
251
- config,
252
- projectRoot,
253
- sourceRoot,
254
- projectName,
255
- tsconfig,
256
- jiti,
257
- clean: false,
258
- entries: [
259
- {
260
- builder: "mkdist",
261
- input: `.${sourceRoot.replace(projectRoot, "")}`,
262
- outDir: joinPaths(relative2(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
263
- declaration: options.emitTypes !== false,
264
- format: "esm"
265
- },
266
- {
267
- builder: "mkdist",
268
- input: `.${sourceRoot.replace(projectRoot, "")}`,
269
- outDir: joinPaths(relative2(joinPaths(config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
270
- declaration: options.emitTypes !== false,
271
- format: "cjs",
272
- ext: "cjs"
273
- }
274
- ],
275
- declaration: options.emitTypes !== false ? "compatible" : false,
276
- failOnWarn: false,
277
- sourcemap: options.sourcemap ?? !!options.debug,
278
- outDir: outputPath,
279
- parallel: true,
280
- stub: false,
281
- stubOptions: {
282
- jiti: {}
283
- },
284
- externals: options.external ?? [],
285
- dependencies: [],
286
- peerDependencies: [],
287
- devDependencies: [],
288
- hooks: {},
289
- alias: {},
290
- replace: {},
291
- rollup: {
292
- replace: {},
293
- alias: {},
294
- json: {},
295
- commonjs: {
296
- sourceMap: options.sourcemap ?? true
297
- },
298
- emitCJS: true,
299
- cjsBridge: true,
300
- dts: {
301
- respectExternal: true,
302
- tsconfig
303
- },
304
- output: {
305
- banner: options.banner || `
306
- // \u26A1 Built by Storm Software
307
- `,
308
- footer: options.footer
309
- },
310
- resolve: {
311
- preferBuiltins: true,
312
- extensions: [
313
- ".cjs",
314
- ".mjs",
315
- ".js",
316
- ".jsx",
317
- ".ts",
318
- ".tsx",
319
- ".json"
320
- ]
321
- },
322
- esbuild: {
323
- minify: options.minify !== false,
324
- splitting: options.splitting !== false,
325
- treeShaking: options.treeShaking !== false,
326
- color: true,
327
- logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
328
- }
329
- }
330
- };
331
- dependencies = dependencies.filter((dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app");
332
- if (dependencies.length > 0) {
333
- resolvedOptions.dependencies = dependencies.map((dep) => dep.name);
334
- }
335
- if (packageJson.devDependencies) {
336
- resolvedOptions.devDependencies = Object.keys(packageJson.devDependencies);
337
- }
338
- if (packageJson.peerDependencies) {
339
- resolvedOptions.peerDependencies = Object.keys(packageJson.peerDependencies);
340
- }
341
- if (options.rollup) {
342
- let rollup = {};
343
- if (typeof options.rollup === "string") {
344
- const rollupFile = await loadConfig(options.rollup);
345
- if (rollupFile) {
346
- rollup = rollupFile;
347
- }
348
- } else {
349
- rollup = options.rollup;
350
- }
351
- resolvedOptions.rollup = defu(resolvedOptions.rollup ?? {}, rollup);
352
- }
353
- resolvedOptions.hooks = {
354
- "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
355
- opts.plugins = options.plugins ?? await getDefaultBuildPlugins(options, resolvedOptions);
356
- }, "rollup:options")
357
- };
358
- stopwatch();
359
- return resolvedOptions;
360
- }
361
- __name(resolveOptions, "resolveOptions");
362
- async function generatePackageJson(options) {
363
- if (options.generatePackageJson !== false && existsSync(joinPaths(options.projectRoot, "package.json"))) {
364
- writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
365
- const stopwatch = getStopwatch("Write package.json file");
366
- const packageJsonPath = joinPaths(options.projectRoot, "project.json");
367
- if (!existsSync(packageJsonPath)) {
368
- throw new Error("Cannot find package.json configuration");
369
- }
370
- let packageJsonContent = await readFile(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
371
- if (!packageJsonContent) {
372
- throw new Error("Cannot find package.json configuration file");
373
- }
374
- let packageJson = JSON.parse(packageJsonContent);
375
- packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
376
- packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
377
- await writeJsonFile(joinPaths(options.outDir, "package.json"), await addPackageJsonExports(options.sourceRoot, packageJson));
378
- stopwatch();
379
- }
380
- return options;
381
- }
382
- __name(generatePackageJson, "generatePackageJson");
383
- async function resolveUnbuild(options) {
384
- writeTrace(`Resolving Unbuild package with Jiti`, options.config);
385
- try {
386
- return options.jiti.import("unbuild");
387
- } catch (error) {
388
- writeError(" \u274C An error occurred while resolving the Unbuild package", options.config);
389
- throw new Error("An error occurred while resolving the Unbuild package", {
390
- cause: error
391
- });
392
- }
393
- }
394
- __name(resolveUnbuild, "resolveUnbuild");
395
- async function executeUnbuild(options) {
396
- writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
397
- const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
398
- try {
399
- const unbuild = await resolveUnbuild(options);
400
- await unbuild.build(options.projectRoot, false, {
401
- ...options,
402
- rootDir: options.projectRoot
403
- });
404
- } finally {
405
- stopwatch();
406
- }
407
- return options;
408
- }
409
- __name(executeUnbuild, "executeUnbuild");
410
- async function copyBuildAssets(options) {
411
- writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
412
- const stopwatch = getStopwatch(`${options.name} asset copy`);
413
- await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
414
- stopwatch();
415
- return options;
416
- }
417
- __name(copyBuildAssets, "copyBuildAssets");
418
- async function cleanOutputPath(options) {
419
- if (options.clean !== false && options.outDir) {
420
- await clean(options.name, options.outDir, options.config);
421
- }
422
- return options;
423
- }
424
- __name(cleanOutputPath, "cleanOutputPath");
425
- async function build(options) {
426
- writeDebug(` \u26A1 Executing Storm Unbuild pipeline`);
427
- const stopwatch = getStopwatch("Unbuild pipeline");
428
- try {
429
- const resolvedOptions = await resolveOptions(options);
430
- await cleanOutputPath(resolvedOptions);
431
- await generatePackageJson(resolvedOptions);
432
- await executeUnbuild(resolvedOptions);
433
- await copyBuildAssets(resolvedOptions);
434
- writeSuccess(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, resolvedOptions.config);
435
- } catch (error) {
436
- writeFatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
437
- throw error;
438
- } finally {
439
- stopwatch();
440
- }
441
- }
442
- __name(build, "build");
443
-
444
- // src/executors/unbuild/executor.ts
445
- import { defu as defu2 } from "defu";
446
- async function unbuildExecutorFn(options, context, config) {
447
- writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
448
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
449
- throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
450
- }
451
- await build(defu2({
452
- ...options,
453
- projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
454
- projectName: context.projectName,
455
- sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
456
- platform: options.platform,
457
- name: context.projectName
458
- }, {
459
- stubOptions: {
460
- jiti: {
461
- cache: "node_modules/.cache/storm"
462
- }
463
- },
464
- rollup: {
465
- emitCJS: true,
466
- watch: false,
467
- cjsBridge: false,
468
- dts: {
469
- respectExternal: true
470
- },
471
- replace: {},
472
- alias: {},
473
- resolve: {},
474
- json: {},
475
- commonjs: {},
476
- esbuild: {
477
- target: options.target,
478
- format: "esm",
479
- platform: options.platform,
480
- minify: options.minify,
481
- treeShaking: options.treeShaking
482
- }
483
- }
484
- }));
485
- return {
486
- success: true
487
- };
488
- }
489
- __name(unbuildExecutorFn, "unbuildExecutorFn");
490
- var executor_default = withRunExecutor("TypeScript Unbuild build", unbuildExecutorFn, {
491
- skipReadingConfig: false,
492
- hooks: {
493
- applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
494
- options.entry ??= [
495
- "{sourceRoot}"
496
- ];
497
- options.outputPath ??= "dist/{projectRoot}";
498
- options.tsconfig ??= "{projectRoot}/tsconfig.json";
499
- return options;
500
- }, "applyDefaultOptions")
501
- }
502
- });
503
-
504
- export {
505
- unbuildExecutorFn,
506
- executor_default
507
- };