@storm-software/cloudflare-tools 0.48.0 → 0.49.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 (81) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunk-3J7KBHMJ.mjs +0 -0
  3. package/dist/chunk-7Z5PILRU.mjs +0 -0
  4. package/dist/chunk-A4ZIZ2JU.mjs +228 -0
  5. package/dist/chunk-A7FFSBE6.mjs +26 -0
  6. package/dist/chunk-CVGPWUNP.js +1 -0
  7. package/dist/chunk-DHBG5ASJ.js +1 -0
  8. package/dist/chunk-I4XNMV5U.js +227 -0
  9. package/dist/chunk-J5SB6L2L.js +18 -0
  10. package/dist/chunk-JCB2DTP6.js +42 -0
  11. package/dist/chunk-KKOHB7JH.js +239 -0
  12. package/dist/chunk-MTM5OTKD.mjs +239 -0
  13. package/dist/chunk-NKCR3FSU.js +153 -0
  14. package/dist/chunk-NSLK6ZDO.mjs +603 -0
  15. package/dist/chunk-OARYMVO7.mjs +501 -0
  16. package/dist/chunk-OJNZ4PXQ.mjs +3466 -0
  17. package/dist/chunk-QEWY5YJA.mjs +89 -0
  18. package/dist/chunk-R7AIVBS7.js +89 -0
  19. package/dist/chunk-RCE3CC76.js +603 -0
  20. package/dist/chunk-VPT6GF3S.mjs +153 -0
  21. package/dist/chunk-VTHBMY4B.js +133 -0
  22. package/dist/chunk-VYOULWAK.mjs +42 -0
  23. package/dist/chunk-XO66D74Z.js +1 -0
  24. package/dist/chunk-XU6MTFCV.mjs +133 -0
  25. package/dist/chunk-YE4FHRXJ.js +501 -0
  26. package/dist/chunk-YSCEY447.mjs +0 -0
  27. package/dist/chunk-Z46UO4N7.js +3465 -0
  28. package/dist/executors.d.mts +2 -0
  29. package/dist/executors.d.ts +2 -0
  30. package/dist/executors.js +9 -0
  31. package/dist/executors.mjs +9 -0
  32. package/dist/generator-DJ1RuHyR.d.mts +14 -0
  33. package/dist/generator-DJ1RuHyR.d.ts +14 -0
  34. package/dist/generator-DW-9W9Fk.d.mts +22 -0
  35. package/dist/generator-DW-9W9Fk.d.ts +22 -0
  36. package/dist/generators.d.mts +4 -0
  37. package/dist/generators.d.ts +4 -0
  38. package/dist/generators.js +18 -0
  39. package/dist/generators.mjs +18 -0
  40. package/dist/index.d.mts +45 -0
  41. package/dist/index.d.ts +45 -0
  42. package/dist/index.js +151 -0
  43. package/dist/index.mjs +151 -0
  44. package/dist/schema.d-DgA16PUG.d.mts +24 -0
  45. package/dist/schema.d-DgA16PUG.d.ts +24 -0
  46. package/dist/schema.d-oSirXiCO.d.mts +11 -0
  47. package/dist/schema.d-oSirXiCO.d.ts +11 -0
  48. package/dist/src/executors/cloudflare-publish/executor.d.mts +8 -0
  49. package/dist/src/executors/cloudflare-publish/executor.d.ts +8 -0
  50. package/dist/src/executors/cloudflare-publish/executor.js +11 -0
  51. package/dist/src/executors/cloudflare-publish/executor.mjs +11 -0
  52. package/dist/src/executors/r2-upload-publish/executor.d.mts +8 -0
  53. package/dist/src/executors/r2-upload-publish/executor.d.ts +8 -0
  54. package/dist/src/executors/r2-upload-publish/executor.js +11 -0
  55. package/dist/src/executors/r2-upload-publish/executor.mjs +11 -0
  56. package/dist/src/executors/serve/executor.d.mts +1240 -0
  57. package/dist/src/executors/serve/executor.d.ts +1240 -0
  58. package/dist/src/executors/serve/executor.js +75 -0
  59. package/dist/src/executors/serve/executor.mjs +75 -0
  60. package/dist/src/executors/serve/schema.d.ts +1 -1
  61. package/dist/src/generators/init/generator.d.mts +2 -0
  62. package/dist/src/generators/init/generator.d.ts +2 -0
  63. package/dist/src/generators/init/generator.js +11 -0
  64. package/dist/src/generators/init/generator.mjs +11 -0
  65. package/dist/src/generators/worker/generator.d.mts +3 -0
  66. package/dist/src/generators/worker/generator.d.ts +3 -0
  67. package/dist/src/generators/worker/generator.js +14 -0
  68. package/dist/src/generators/worker/generator.mjs +14 -0
  69. package/dist/src/utils/index.d.mts +3 -0
  70. package/dist/src/utils/index.d.ts +3 -0
  71. package/dist/src/utils/index.js +11 -0
  72. package/dist/src/utils/index.mjs +11 -0
  73. package/dist/src/utils/r2-bucket-helpers.d.mts +7 -0
  74. package/dist/src/utils/r2-bucket-helpers.d.ts +7 -0
  75. package/dist/src/utils/r2-bucket-helpers.js +10 -0
  76. package/dist/src/utils/r2-bucket-helpers.mjs +10 -0
  77. package/dist/tsup.config.d.mts +5 -0
  78. package/dist/tsup.config.d.ts +5 -0
  79. package/dist/tsup.config.js +35 -0
  80. package/dist/tsup.config.mjs +35 -0
  81. package/package.json +1 -1
@@ -0,0 +1,3465 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkVTHBMY4Bjs = require('./chunk-VTHBMY4B.js');
5
+
6
+
7
+ var _chunkYE4FHRXJjs = require('./chunk-YE4FHRXJ.js');
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ var _chunkRCE3CC76js = require('./chunk-RCE3CC76.js');
25
+
26
+
27
+
28
+ var _chunkJ5SB6L2Ljs = require('./chunk-J5SB6L2L.js');
29
+
30
+ // ../config-tools/src/utilities/apply-workspace-tokens.ts
31
+ var applyWorkspaceBaseTokens = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (option, tokenizerOptions) => {
32
+ let result = option;
33
+ if (!result) {
34
+ return result;
35
+ }
36
+ if (tokenizerOptions) {
37
+ const optionKeys = Object.keys(tokenizerOptions);
38
+ if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
39
+ for (const optionKey of optionKeys) {
40
+ if (result.includes(`{${optionKey}}`)) {
41
+ result = result.replaceAll(`{${optionKey}}`, _nullishCoalesce(_optionalChain([tokenizerOptions, 'access', _2 => _2.config, 'optionalAccess', _3 => _3[optionKey]]), () => ( "")));
42
+ }
43
+ }
44
+ }
45
+ }
46
+ if (tokenizerOptions.config) {
47
+ const configKeys = Object.keys(tokenizerOptions.config);
48
+ if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
49
+ for (const configKey of configKeys) {
50
+ if (result.includes(`{${configKey}}`)) {
51
+ result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ if (result.includes("{workspaceRoot}")) {
57
+ result = result.replaceAll("{workspaceRoot}", _nullishCoalesce(_nullishCoalesce(tokenizerOptions.workspaceRoot, () => ( _optionalChain([tokenizerOptions, 'access', _4 => _4.config, 'optionalAccess', _5 => _5.workspaceRoot]))), () => ( _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, ))));
58
+ }
59
+ return result;
60
+ }, "applyWorkspaceBaseTokens");
61
+ var applyWorkspaceTokens = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (options, config, tokenizerFn) => {
62
+ if (!options) {
63
+ return {};
64
+ }
65
+ const result = {};
66
+ for (const option of Object.keys(options)) {
67
+ if (typeof options[option] === "string") {
68
+ result[option] = await Promise.resolve(tokenizerFn(options[option], config));
69
+ } else if (Array.isArray(options[option])) {
70
+ result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, config)) : item));
71
+ } else if (typeof options[option] === "object") {
72
+ result[option] = await applyWorkspaceTokens(options[option], config, tokenizerFn);
73
+ } else {
74
+ result[option] = options[option];
75
+ }
76
+ }
77
+ return result;
78
+ }, "applyWorkspaceTokens");
79
+
80
+ // ../config-tools/src/utilities/run.ts
81
+ var _child_process = require('child_process');
82
+ var LARGE_BUFFER = 1024 * 1e6;
83
+ var run = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), stdio = "inherit", env = process.env) => {
84
+ return _child_process.execSync.call(void 0, command, {
85
+ cwd,
86
+ env: {
87
+ ...process.env,
88
+ ...env,
89
+ CLICOLOR: "true",
90
+ FORCE_COLOR: "true"
91
+ },
92
+ windowsHide: true,
93
+ stdio,
94
+ maxBuffer: LARGE_BUFFER,
95
+ killSignal: "SIGTERM"
96
+ });
97
+ }, "run");
98
+
99
+ // ../workspace-tools/src/utils/apply-workspace-tokens.ts
100
+ var applyWorkspaceExecutorTokens = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (option, tokenizerOptions) => {
101
+ let result = option;
102
+ if (!result) {
103
+ return result;
104
+ }
105
+ let projectName;
106
+ let projectRoot;
107
+ let sourceRoot;
108
+ if (_optionalChain([tokenizerOptions, 'optionalAccess', _6 => _6.projectName])) {
109
+ const context2 = tokenizerOptions;
110
+ projectName = context2.projectName;
111
+ projectRoot = context2.root;
112
+ sourceRoot = context2.sourceRoot;
113
+ } else {
114
+ const projectConfig = tokenizerOptions;
115
+ projectRoot = projectConfig.root;
116
+ if (projectConfig.name) {
117
+ projectName = projectConfig.name;
118
+ }
119
+ if (projectConfig.sourceRoot) {
120
+ sourceRoot = projectConfig.sourceRoot;
121
+ }
122
+ }
123
+ if (tokenizerOptions.config) {
124
+ const configKeys = Object.keys(tokenizerOptions.config);
125
+ if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
126
+ for (const configKey of configKeys) {
127
+ if (result.includes(`{${configKey}}`)) {
128
+ result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ if (result.includes("{projectName}")) {
134
+ result = result.replaceAll("{projectName}", projectName);
135
+ }
136
+ if (result.includes("{projectRoot}")) {
137
+ result = result.replaceAll("{projectRoot}", projectRoot);
138
+ }
139
+ if (result.includes("{sourceRoot}")) {
140
+ result = result.replaceAll("{sourceRoot}", sourceRoot);
141
+ }
142
+ if (result.includes("{workspaceRoot}")) {
143
+ result = result.replaceAll("{workspaceRoot}", _nullishCoalesce(tokenizerOptions.workspaceRoot, () => ( _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, ))));
144
+ }
145
+ return result;
146
+ }, "applyWorkspaceExecutorTokens");
147
+
148
+ // ../workspace-tools/src/base/base-executor.ts
149
+ var withRunExecutor = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (name, executorFn, executorOptions = {}) => async (_options, context2) => {
150
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, name);
151
+ let options = _options;
152
+ let config = {};
153
+ try {
154
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u26A1 Running the ${name} executor...
155
+ `, config);
156
+ if (!_optionalChain([context2, 'access', _7 => _7.projectsConfigurations, 'optionalAccess', _8 => _8.projects]) || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName]) {
157
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
158
+ }
159
+ const workspaceRoot3 = _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, );
160
+ const projectRoot = _nullishCoalesce(_optionalChain([context2, 'access', _9 => _9.projectsConfigurations, 'access', _10 => _10.projects, 'access', _11 => _11[context2.projectName], 'optionalAccess', _12 => _12.root]), () => ( workspaceRoot3));
161
+ const sourceRoot = _nullishCoalesce(_optionalChain([context2, 'access', _13 => _13.projectsConfigurations, 'access', _14 => _14.projects, 'access', _15 => _15[context2.projectName], 'optionalAccess', _16 => _16.sourceRoot]), () => ( workspaceRoot3));
162
+ const projectName = _nullishCoalesce(_optionalChain([context2, 'access', _17 => _17.projectsConfigurations, 'access', _18 => _18.projects, 'access', _19 => _19[context2.projectName], 'optionalAccess', _20 => _20.name]), () => ( context2.projectName));
163
+ config.workspaceRoot = workspaceRoot3;
164
+ if (!executorOptions.skipReadingConfig) {
165
+ _chunkRCE3CC76js.writeTrace.call(void 0, `Loading the Storm Config from environment variables and storm.config.js file...
166
+ - workspaceRoot: ${workspaceRoot3}
167
+ - projectRoot: ${projectRoot}
168
+ - sourceRoot: ${sourceRoot}
169
+ - projectName: ${projectName}
170
+ `, config);
171
+ config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, workspaceRoot3);
172
+ }
173
+ if (_optionalChain([executorOptions, 'optionalAccess', _21 => _21.hooks, 'optionalAccess', _22 => _22.applyDefaultOptions])) {
174
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Running the applyDefaultOptions hook...", config);
175
+ options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
176
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Completed the applyDefaultOptions hook", config);
177
+ }
178
+ _chunkRCE3CC76js.writeTrace.call(void 0, `Executor schema options \u2699\uFE0F
179
+ ${Object.keys(options).map((key) => ` - ${key}=${_isFunction(options[key]) ? "<function>" : JSON.stringify(options[key])}`).join("\n")}`, config);
180
+ const tokenized = await applyWorkspaceTokens(options, {
181
+ config,
182
+ workspaceRoot: workspaceRoot3,
183
+ projectRoot,
184
+ sourceRoot,
185
+ projectName,
186
+ ...context2.projectsConfigurations.projects[context2.projectName],
187
+ ...executorOptions
188
+ }, applyWorkspaceExecutorTokens);
189
+ if (_optionalChain([executorOptions, 'optionalAccess', _23 => _23.hooks, 'optionalAccess', _24 => _24.preProcess])) {
190
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Running the preProcess hook...", config);
191
+ await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
192
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Completed the preProcess hook", config);
193
+ }
194
+ const ret = executorFn(tokenized, context2, config);
195
+ if (_isFunction(_optionalChain([ret, 'optionalAccess', _25 => _25.next]))) {
196
+ const asyncGen = ret;
197
+ for await (const iter of asyncGen) {
198
+ }
199
+ }
200
+ const result = await Promise.resolve(ret);
201
+ if (result && (!result.success || result.error && _optionalChain([result, 'optionalAccess', _26 => _26.error, 'optionalAccess', _27 => _27.message]) && typeof _optionalChain([result, 'optionalAccess', _28 => _28.error, 'optionalAccess', _29 => _29.message]) === "string" && _optionalChain([result, 'optionalAccess', _30 => _30.error, 'optionalAccess', _31 => _31.name]) && typeof _optionalChain([result, 'optionalAccess', _32 => _32.error, 'optionalAccess', _33 => _33.name]) === "string")) {
202
+ _chunkRCE3CC76js.writeTrace.call(void 0, `Failure determined by the ${name} executor
203
+ ${_chunkRCE3CC76js.formatLogMessage.call(void 0, result)}`, config);
204
+ console.error(result);
205
+ throw new Error(`The ${name} executor failed to run`, {
206
+ cause: _optionalChain([result, 'optionalAccess', _34 => _34.error])
207
+ });
208
+ }
209
+ if (_optionalChain([executorOptions, 'optionalAccess', _35 => _35.hooks, 'optionalAccess', _36 => _36.postProcess])) {
210
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Running the postProcess hook...", config);
211
+ await Promise.resolve(executorOptions.hooks.postProcess(config));
212
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Completed the postProcess hook", config);
213
+ }
214
+ _chunkRCE3CC76js.writeSuccess.call(void 0, `Completed running the ${name} task executor!
215
+ `, config);
216
+ return {
217
+ success: true
218
+ };
219
+ } catch (error) {
220
+ _chunkRCE3CC76js.writeFatal.call(void 0, "A fatal error occurred while running the executor - the process was forced to terminate", config);
221
+ _chunkRCE3CC76js.writeError.call(void 0, `An exception was thrown in the executor's process
222
+ - Details: ${error.message}
223
+ - Stacktrace: ${error.stack}`, config);
224
+ return {
225
+ success: false
226
+ };
227
+ } finally {
228
+ stopwatch();
229
+ }
230
+ }, "withRunExecutor");
231
+ var _isFunction = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (value) => {
232
+ try {
233
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _37 => _37.constructor]) && _optionalChain([value, 'optionalAccess', _38 => _38.call]) && _optionalChain([value, 'optionalAccess', _39 => _39.apply]));
234
+ } catch (e) {
235
+ return false;
236
+ }
237
+ }, "_isFunction");
238
+
239
+ // ../workspace-tools/src/utils/cargo.ts
240
+ var _devkit = require('@nx/devkit');
241
+
242
+ var _path = require('path'); var path6 = _interopRequireWildcard(_path);
243
+ var INVALID_CARGO_ARGS = [
244
+ "allFeatures",
245
+ "allTargets",
246
+ "main",
247
+ "outputPath",
248
+ "package",
249
+ "tsConfig"
250
+ ];
251
+ var buildCargoCommand = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (baseCommand, options, context2) => {
252
+ const args = [];
253
+ if (options.toolchain && options.toolchain !== "stable") {
254
+ args.push(`+${options.toolchain}`);
255
+ }
256
+ args.push(baseCommand);
257
+ for (const [key, value] of Object.entries(options)) {
258
+ if (key === "toolchain" || key === "release" || INVALID_CARGO_ARGS.includes(key)) {
259
+ continue;
260
+ }
261
+ if (typeof value === "boolean") {
262
+ if (value) {
263
+ args.push(`--${key}`);
264
+ }
265
+ } else if (Array.isArray(value)) {
266
+ for (const item of value) {
267
+ args.push(`--${key}`, item);
268
+ }
269
+ } else {
270
+ args.push(`--${key}`, String(value));
271
+ }
272
+ }
273
+ if (context2.projectName) {
274
+ args.push("-p", context2.projectName);
275
+ }
276
+ if (options.allFeatures && !args.includes("--all-features")) {
277
+ args.push("--all-features");
278
+ }
279
+ if (options.allTargets && !args.includes("--all-targets")) {
280
+ args.push("--all-targets");
281
+ }
282
+ if (options.release && !args.includes("--profile")) {
283
+ args.push("--release");
284
+ }
285
+ if (options.outputPath && !args.includes("--target-dir")) {
286
+ args.push("--target-dir", options.outputPath);
287
+ }
288
+ return args;
289
+ }, "buildCargoCommand");
290
+ async function cargoCommand(...args) {
291
+ console.log(`> cargo ${args.join(" ")}`);
292
+ args.push("--color", "always");
293
+ return await Promise.resolve(runProcess("cargo", ...args));
294
+ }
295
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoCommand, "cargoCommand");
296
+ function cargoCommandSync(args = "", options) {
297
+ const normalizedOptions = {
298
+ stdio: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _40 => _40.stdio]), () => ( "inherit")),
299
+ env: {
300
+ ...process.env,
301
+ ..._optionalChain([options, 'optionalAccess', _41 => _41.env])
302
+ }
303
+ };
304
+ try {
305
+ return {
306
+ output: _child_process.execSync.call(void 0, `cargo ${args}`, {
307
+ encoding: "utf8",
308
+ windowsHide: true,
309
+ stdio: normalizedOptions.stdio,
310
+ env: normalizedOptions.env,
311
+ maxBuffer: 1024 * 1024 * 10
312
+ }),
313
+ success: true
314
+ };
315
+ } catch (e) {
316
+ return {
317
+ output: e,
318
+ success: false
319
+ };
320
+ }
321
+ }
322
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoCommandSync, "cargoCommandSync");
323
+ function cargoMetadata() {
324
+ const output3 = cargoCommandSync("metadata --format-version=1", {
325
+ stdio: "pipe"
326
+ });
327
+ if (!output3.success) {
328
+ console.error("Failed to get cargo metadata");
329
+ return null;
330
+ }
331
+ return JSON.parse(output3.output);
332
+ }
333
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoMetadata, "cargoMetadata");
334
+ function runProcess(processCmd, ...args) {
335
+ const metadata = cargoMetadata();
336
+ const targetDir = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _42 => _42.target_directory]), () => ( _devkit.joinPathFragments.call(void 0, _devkit.workspaceRoot, "dist", "cargo")));
337
+ return new Promise((resolve) => {
338
+ if (process.env.VERCEL) {
339
+ return resolve({
340
+ success: true
341
+ });
342
+ }
343
+ _child_process.execSync.call(void 0, `${processCmd} ${args.join(" ")}`, {
344
+ cwd: process.cwd(),
345
+ env: {
346
+ ...process.env,
347
+ RUSTC_WRAPPER: "",
348
+ CARGO_TARGET_DIR: targetDir,
349
+ CARGO_BUILD_TARGET_DIR: targetDir
350
+ },
351
+ windowsHide: true,
352
+ stdio: [
353
+ "inherit",
354
+ "inherit",
355
+ "inherit"
356
+ ]
357
+ });
358
+ resolve({
359
+ success: true
360
+ });
361
+ });
362
+ }
363
+ _chunkJ5SB6L2Ljs.__name.call(void 0, runProcess, "runProcess");
364
+
365
+ // ../workspace-tools/src/executors/cargo-build/executor.ts
366
+ async function cargoBuildExecutor(options, context2) {
367
+ const command = buildCargoCommand("build", options, context2);
368
+ return await cargoCommand(...command);
369
+ }
370
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoBuildExecutor, "cargoBuildExecutor");
371
+ var executor_default = withRunExecutor("Cargo Build", cargoBuildExecutor, {
372
+ skipReadingConfig: false,
373
+ hooks: {
374
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
375
+ options.outputPath ??= "dist/target/{projectRoot}";
376
+ options.toolchain ??= "stable";
377
+ return options;
378
+ }, "applyDefaultOptions")
379
+ }
380
+ });
381
+
382
+ // ../workspace-tools/src/executors/cargo-check/executor.ts
383
+ async function cargoCheckExecutor(options, context2) {
384
+ const command = buildCargoCommand("check", options, context2);
385
+ return await cargoCommand(...command);
386
+ }
387
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoCheckExecutor, "cargoCheckExecutor");
388
+ var executor_default2 = withRunExecutor("Cargo Check", cargoCheckExecutor, {
389
+ skipReadingConfig: false,
390
+ hooks: {
391
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
392
+ options.toolchain ??= "stable";
393
+ return options;
394
+ }, "applyDefaultOptions")
395
+ }
396
+ });
397
+
398
+ // ../workspace-tools/src/executors/cargo-clippy/executor.ts
399
+ async function cargoClippyExecutor(options, context2) {
400
+ const command = buildCargoCommand("clippy", options, context2);
401
+ return await cargoCommand(...command);
402
+ }
403
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoClippyExecutor, "cargoClippyExecutor");
404
+ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
405
+ skipReadingConfig: false,
406
+ hooks: {
407
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
408
+ options.toolchain ??= "stable";
409
+ options.fix ??= false;
410
+ return options;
411
+ }, "applyDefaultOptions")
412
+ }
413
+ });
414
+
415
+ // ../workspace-tools/src/executors/cargo-doc/executor.ts
416
+ var _deepclone = require('deep-clone'); var _deepclone2 = _interopRequireDefault(_deepclone);
417
+ async function cargoDocExecutor(options, context2) {
418
+ const opts = _deepclone2.default.call(void 0, options);
419
+ opts["no-deps"] = opts.noDeps;
420
+ delete opts.noDeps;
421
+ const command = buildCargoCommand("doc", options, context2);
422
+ return await cargoCommand(...command);
423
+ }
424
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoDocExecutor, "cargoDocExecutor");
425
+ var executor_default4 = withRunExecutor("Cargo Doc", cargoDocExecutor, {
426
+ skipReadingConfig: false,
427
+ hooks: {
428
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
429
+ options.outputPath ??= "dist/docs/{projectRoot}";
430
+ options.toolchain ??= "stable";
431
+ options.release ??= options.profile ? false : true;
432
+ options.allFeatures ??= true;
433
+ options.lib ??= true;
434
+ options.bins ??= true;
435
+ options.examples ??= true;
436
+ options.noDeps ??= false;
437
+ return options;
438
+ }, "applyDefaultOptions")
439
+ }
440
+ });
441
+
442
+ // ../workspace-tools/src/executors/cargo-format/executor.ts
443
+ async function cargoFormatExecutor(options, context2) {
444
+ const command = buildCargoCommand("fmt", options, context2);
445
+ return await cargoCommand(...command);
446
+ }
447
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cargoFormatExecutor, "cargoFormatExecutor");
448
+ var executor_default5 = withRunExecutor("Cargo Format", cargoFormatExecutor, {
449
+ skipReadingConfig: false,
450
+ hooks: {
451
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
452
+ options.outputPath ??= "dist/target/{projectRoot}";
453
+ options.toolchain ??= "stable";
454
+ return options;
455
+ }, "applyDefaultOptions")
456
+ }
457
+ });
458
+
459
+ // ../workspace-tools/src/executors/cargo-publish/executor.ts
460
+
461
+
462
+ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
463
+ var _https = require('https'); var _https2 = _interopRequireDefault(_https);
464
+ var LARGE_BUFFER2 = 1024 * 1e6;
465
+
466
+ // ../esbuild/src/build.ts
467
+ var _node = require('@humanfs/node');
468
+
469
+
470
+ // ../build-tools/src/config.ts
471
+ var DEFAULT_COMPILED_BANNER = `
472
+ /**
473
+ * \u26A1 Built by Storm Software
474
+ */
475
+
476
+ `;
477
+ var DEFAULT_ENVIRONMENT = "production";
478
+ var DEFAULT_TARGET = "esnext";
479
+ var DEFAULT_ORGANIZATION = "storm-software";
480
+
481
+ // ../build-tools/src/plugins/swc.ts
482
+ var _core = require('@swc/core');
483
+
484
+ // ../build-tools/src/plugins/ts-resolve.ts
485
+
486
+ var _module = require('module');
487
+
488
+ var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_resolve2);
489
+
490
+ // ../build-tools/src/plugins/type-definitions.ts
491
+
492
+
493
+
494
+ // ../build-tools/src/utilities/copy-assets.ts
495
+
496
+
497
+ var _js = require('@nx/js');
498
+ var _glob = require('glob');
499
+
500
+ // ../build-tools/src/utilities/read-nx-config.ts
501
+
502
+ var readNxConfig = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (workspaceRoot3) => {
503
+ let rootDir = workspaceRoot3;
504
+ if (!rootDir) {
505
+ const config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, );
506
+ rootDir = config.workspaceRoot;
507
+ }
508
+ const nxJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, rootDir, "nx.json");
509
+ if (!await _node.hfs.isFile(nxJsonPath)) {
510
+ throw new Error("Cannot find project.json configuration");
511
+ }
512
+ return _node.hfs.json(nxJsonPath);
513
+ }, "readNxConfig");
514
+
515
+ // ../build-tools/src/utilities/copy-assets.ts
516
+ var copyAssets = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson4 = true, includeSrc = false, banner, footer) => {
517
+ const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
518
+ if (!_optionalChain([pendingAssets, 'optionalAccess', _43 => _43.some, 'call', _44 => _44((asset) => _optionalChain([asset, 'optionalAccess', _45 => _45.glob]) === "*.md")])) {
519
+ pendingAssets.push({
520
+ input: projectRoot,
521
+ glob: "*.md",
522
+ output: "/"
523
+ });
524
+ }
525
+ if (generatePackageJson4 === false) {
526
+ pendingAssets.push({
527
+ input: sourceRoot,
528
+ glob: "package.json",
529
+ output: "."
530
+ });
531
+ }
532
+ if (!_optionalChain([pendingAssets, 'optionalAccess', _46 => _46.some, 'call', _47 => _47((asset) => _optionalChain([asset, 'optionalAccess', _48 => _48.glob]) === "LICENSE")])) {
533
+ pendingAssets.push({
534
+ input: "",
535
+ glob: "LICENSE",
536
+ output: "."
537
+ });
538
+ }
539
+ if (includeSrc === true) {
540
+ pendingAssets.push({
541
+ input: sourceRoot,
542
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
543
+ output: "src/"
544
+ });
545
+ }
546
+ const nxJson = readNxConfig(config.workspaceRoot);
547
+ const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
548
+ exitOnError: true
549
+ });
550
+ const projectsConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
551
+ if (!_optionalChain([projectsConfigurations, 'optionalAccess', _49 => _49.projects, 'optionalAccess', _50 => _50[projectName]])) {
552
+ 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.");
553
+ }
554
+ const buildTarget = _optionalChain([projectsConfigurations, 'access', _51 => _51.projects, 'access', _52 => _52[projectName], 'optionalAccess', _53 => _53.targets, 'optionalAccess', _54 => _54.build]);
555
+ if (!buildTarget) {
556
+ throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${_chunkRCE3CC76js.joinPaths.call(void 0, projectRoot, "project.json")}`);
557
+ }
558
+ const result = await _js.copyAssets.call(void 0, {
559
+ assets,
560
+ watch: false,
561
+ outputPath
562
+ }, {
563
+ root: config.workspaceRoot,
564
+ targetName: "build",
565
+ target: buildTarget,
566
+ projectName,
567
+ projectGraph,
568
+ projectsConfigurations,
569
+ nxJsonConfiguration: nxJson,
570
+ cwd: config.workspaceRoot,
571
+ isVerbose: _chunkRCE3CC76js.isVerbose.call(void 0, config.logLevel)
572
+ });
573
+ if (!result.success) {
574
+ throw new Error("The Build process failed trying to copy assets");
575
+ }
576
+ if (includeSrc === true) {
577
+ _chunkRCE3CC76js.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkRCE3CC76js.joinPaths.call(void 0, outputPath, "src")}`, config);
578
+ const files = await _glob.glob.call(void 0, [
579
+ _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
580
+ _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
581
+ _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
582
+ _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
583
+ ]);
584
+ await Promise.allSettled(files.map(async (file) => _node.hfs.write(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
585
+
586
+ ${await _node.hfs.text(file)}
587
+
588
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
589
+ }
590
+ }, "copyAssets");
591
+
592
+ // ../build-tools/src/utilities/generate-package-json.ts
593
+
594
+ var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
595
+
596
+ var _projectgraph = require('nx/src/project-graph/project-graph');
597
+ var addPackageDependencies = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (workspaceRoot3, projectRoot, projectName, packageJson) => {
598
+ const projectGraph = await _projectgraph.createProjectGraphAsync.call(void 0, {
599
+ exitOnError: true
600
+ });
601
+ const projectConfigurations = _projectgraph.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
602
+ if (!_optionalChain([projectConfigurations, 'optionalAccess', _55 => _55.projects, 'optionalAccess', _56 => _56[projectName]])) {
603
+ 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.");
604
+ }
605
+ const projectJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3, projectRoot, "project.json");
606
+ if (!await _node.hfs.isFile(projectJsonPath)) {
607
+ throw new Error("Cannot find project.json configuration");
608
+ }
609
+ if (!_optionalChain([projectConfigurations, 'optionalAccess', _57 => _57.projects, 'optionalAccess', _58 => _58[projectName]])) {
610
+ 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.");
611
+ }
612
+ const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
613
+ const localPackages = [];
614
+ for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot3)) {
615
+ const projectNode = project.node;
616
+ if (projectNode.data.root) {
617
+ const projectPackageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3, projectNode.data.root, "package.json");
618
+ if (await _node.hfs.isFile(projectPackageJsonPath)) {
619
+ const projectPackageJson = await _node.hfs.json(projectPackageJsonPath);
620
+ if (projectPackageJson.private !== false) {
621
+ localPackages.push(projectPackageJson);
622
+ }
623
+ }
624
+ }
625
+ }
626
+ if (localPackages.length > 0) {
627
+ _chunkRCE3CC76js.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
628
+ packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
629
+ if (!ret[localPackage.name]) {
630
+ ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
631
+ }
632
+ return ret;
633
+ }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
634
+ packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
635
+ if (!ret[localPackage.name]) {
636
+ ret[localPackage.name] = {
637
+ optional: false
638
+ };
639
+ }
640
+ return ret;
641
+ }, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
642
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
643
+ if (!ret[localPackage.name]) {
644
+ ret[localPackage.name] = localPackage.version || "0.0.1";
645
+ }
646
+ return ret;
647
+ }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
648
+ } else {
649
+ _chunkRCE3CC76js.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
650
+ }
651
+ return packageJson;
652
+ }, "addPackageDependencies");
653
+ var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
654
+ const workspaceRoot3 = config.workspaceRoot ? config.workspaceRoot : _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, );
655
+ const workspacePackageJson = await _node.hfs.json(_chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3, "package.json"));
656
+ packageJson.type ??= "module";
657
+ packageJson.sideEffects ??= false;
658
+ if (includeSrc === true) {
659
+ let distSrc = sourceRoot.replace(projectRoot, "");
660
+ if (distSrc.startsWith("/")) {
661
+ distSrc = distSrc.substring(1);
662
+ }
663
+ packageJson.source ??= `${_chunkRCE3CC76js.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
664
+ }
665
+ packageJson.files ??= [
666
+ "dist/**/*"
667
+ ];
668
+ if (includeSrc === true && !packageJson.files.includes("src")) {
669
+ packageJson.files.push("src/**/*");
670
+ }
671
+ packageJson.publishConfig ??= {
672
+ access: "public"
673
+ };
674
+ packageJson.description ??= workspacePackageJson.description;
675
+ packageJson.homepage ??= workspacePackageJson.homepage;
676
+ packageJson.bugs ??= workspacePackageJson.bugs;
677
+ packageJson.license ??= workspacePackageJson.license;
678
+ packageJson.keywords ??= workspacePackageJson.keywords;
679
+ packageJson.funding ??= workspacePackageJson.funding;
680
+ packageJson.author ??= workspacePackageJson.author;
681
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
682
+ if (!packageJson.maintainers && packageJson.author) {
683
+ packageJson.maintainers = [
684
+ packageJson.author
685
+ ];
686
+ }
687
+ packageJson.contributors ??= workspacePackageJson.contributors;
688
+ if (!packageJson.contributors && packageJson.author) {
689
+ packageJson.contributors = [
690
+ packageJson.author
691
+ ];
692
+ }
693
+ packageJson.repository ??= workspacePackageJson.repository;
694
+ packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkRCE3CC76js.joinPaths.call(void 0, "packages", projectName);
695
+ return packageJson;
696
+ }, "addWorkspacePackageJsonFields");
697
+ var addPackageJsonExport = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (file, type = "module", sourceRoot) => {
698
+ let entry = file.replaceAll("\\", "/");
699
+ if (sourceRoot) {
700
+ entry = entry.replace(sourceRoot, "");
701
+ }
702
+ return {
703
+ "import": {
704
+ "types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
705
+ "default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
706
+ },
707
+ "require": {
708
+ "types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
709
+ "default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
710
+ },
711
+ "default": {
712
+ "types": `./dist/${entry}.d.ts`,
713
+ "default": `./dist/${entry}.js`
714
+ }
715
+ };
716
+ }, "addPackageJsonExport");
717
+ var addPackageJsonExports = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (sourceRoot, packageJson) => {
718
+ packageJson.exports ??= {};
719
+ const files = await new (0, _glob.Glob)("**/*.{ts,tsx}", {
720
+ absolute: false,
721
+ cwd: sourceRoot,
722
+ root: sourceRoot
723
+ }).walk();
724
+ files.forEach((file) => {
725
+ addPackageJsonExport(file, packageJson.type, sourceRoot);
726
+ const split = file.split(".");
727
+ split.pop();
728
+ const entry = split.join(".").replaceAll("\\", "/");
729
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, sourceRoot);
730
+ });
731
+ packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
732
+ packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
733
+ packageJson.types = "./dist/index.d.ts";
734
+ packageJson.exports ??= {};
735
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
736
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
737
+ ret[key.replace("/index", "")] = packageJson.exports[key];
738
+ }
739
+ return ret;
740
+ }, packageJson.exports);
741
+ packageJson.exports["./package.json"] ??= "./package.json";
742
+ packageJson.exports["."] = _nullishCoalesce(packageJson.exports["."], () => ( addPackageJsonExport("index", packageJson.type, sourceRoot)));
743
+ return packageJson;
744
+ }, "addPackageJsonExports");
745
+
746
+ // ../build-tools/src/utilities/get-entry-points.ts
747
+
748
+ var getEntryPoints = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
749
+ const workspaceRoot3 = config.workspaceRoot ? config.workspaceRoot : _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, );
750
+ const entryPoints = [];
751
+ if (entry) {
752
+ if (Array.isArray(entry)) {
753
+ entryPoints.push(...entry);
754
+ } else if (typeof entry === "string") {
755
+ entryPoints.push(entry);
756
+ } else {
757
+ entryPoints.push(...Object.values(entry));
758
+ }
759
+ }
760
+ if (emitOnAll) {
761
+ entryPoints.push(_chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}"));
762
+ }
763
+ const results = [];
764
+ for (const entryPoint in entryPoints) {
765
+ if (entryPoint.includes("*")) {
766
+ const files = await _glob.glob.call(void 0, entryPoint, {
767
+ withFileTypes: true
768
+ });
769
+ results.push(...files.reduce((ret, filePath) => {
770
+ const result = _chunkRCE3CC76js.correctPaths.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, filePath.path, filePath.name).replaceAll(_chunkRCE3CC76js.correctPaths.call(void 0, workspaceRoot3), "").replaceAll(_chunkRCE3CC76js.correctPaths.call(void 0, projectRoot), ""));
771
+ if (result) {
772
+ _chunkRCE3CC76js.writeDebug.call(void 0, `Trying to add entry point ${result} at "${_chunkRCE3CC76js.joinPaths.call(void 0, filePath.path, filePath.name)}"`, config);
773
+ if (!results.includes(result)) {
774
+ results.push(result);
775
+ }
776
+ }
777
+ return ret;
778
+ }, []));
779
+ } else {
780
+ results.push(entryPoint);
781
+ }
782
+ }
783
+ return results;
784
+ }, "getEntryPoints");
785
+
786
+ // ../build-tools/src/utilities/get-env.ts
787
+ var getEnv = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (builder, options) => {
788
+ return {
789
+ STORM_BUILD: builder,
790
+ STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
791
+ STORM_NAME: options.name,
792
+ STORM_ENV: options.envName || DEFAULT_ENVIRONMENT,
793
+ STORM_PLATFORM: options.platform,
794
+ STORM_FORMAT: JSON.stringify(options.format),
795
+ STORM_TARGET: JSON.stringify(options.target),
796
+ ...options.env
797
+ };
798
+ }, "getEnv");
799
+
800
+ // ../build-tools/src/utilities/get-out-extension.ts
801
+ function getOutExtension(format, pkgType) {
802
+ let jsExtension = ".js";
803
+ let dtsExtension = ".d.ts";
804
+ if (pkgType === "module" && format === "cjs") {
805
+ jsExtension = ".cjs";
806
+ dtsExtension = ".d.cts";
807
+ }
808
+ if (pkgType !== "module" && format === "esm") {
809
+ jsExtension = ".mjs";
810
+ dtsExtension = ".d.mts";
811
+ }
812
+ if (format === "iife") {
813
+ jsExtension = ".global.js";
814
+ }
815
+ return {
816
+ js: jsExtension,
817
+ dts: dtsExtension
818
+ };
819
+ }
820
+ _chunkJ5SB6L2Ljs.__name.call(void 0, getOutExtension, "getOutExtension");
821
+
822
+ // ../build-tools/src/utilities/task-graph.ts
823
+ var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph');
824
+
825
+ // ../esbuild/src/build.ts
826
+ var _chokidar = require('chokidar');
827
+ var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
828
+ var _estoolkit = require('es-toolkit');
829
+ var _compat = require('es-toolkit/compat');
830
+ var _esbuild = require('esbuild'); var esbuild2 = _interopRequireWildcard(_esbuild); var esbuild = _interopRequireWildcard(_esbuild);
831
+ var _globby = require('globby');
832
+ var _findworkspaceroot = require('nx/src/utils/find-workspace-root');
833
+
834
+ // ../esbuild/src/base/renderer-engine.ts
835
+
836
+ var _sourcemap = require('source-map');
837
+
838
+ // ../esbuild/src/utilities/output-file.ts
839
+
840
+
841
+ var outputFile = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (filepath, data, options) => {
842
+ await _fs2.default.promises.mkdir(path6.default.dirname(filepath), {
843
+ recursive: true
844
+ });
845
+ await _fs2.default.promises.writeFile(filepath, data, options);
846
+ }, "outputFile");
847
+
848
+ // ../esbuild/src/base/renderer-engine.ts
849
+ var parseSourceMap = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (map2) => {
850
+ return typeof map2 === "string" ? JSON.parse(map2) : map2;
851
+ }, "parseSourceMap");
852
+ var isJS = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (path7) => /\.(js|mjs|cjs)$/.test(path7), "isJS");
853
+ var isCSS = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (path7) => /\.css$/.test(path7), "isCSS");
854
+ var getSourcemapComment = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (inline, map2, filepath, isCssFile) => {
855
+ if (!map2) return "";
856
+ const prefix = isCssFile ? "/*" : "//";
857
+ const suffix = isCssFile ? " */" : "";
858
+ const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${path6.default.basename(filepath)}.map`;
859
+ return `${prefix}# sourceMappingURL=${url}${suffix}`;
860
+ }, "getSourcemapComment");
861
+ var RendererEngine = class {
862
+ static {
863
+ _chunkJ5SB6L2Ljs.__name.call(void 0, this, "RendererEngine");
864
+ }
865
+ #renderers;
866
+ #options;
867
+ constructor(renderers) {
868
+ this.#renderers = renderers;
869
+ }
870
+ setOptions(options) {
871
+ this.#options = options;
872
+ }
873
+ getOptions() {
874
+ if (!this.#options) {
875
+ throw new Error(`Renderer options is not set`);
876
+ }
877
+ return this.#options;
878
+ }
879
+ modifyEsbuildOptions(options) {
880
+ for (const renderer of this.#renderers) {
881
+ if (renderer.esbuildOptions) {
882
+ renderer.esbuildOptions.call(this.getOptions(), options);
883
+ }
884
+ }
885
+ }
886
+ async buildStarted() {
887
+ for (const renderer of this.#renderers) {
888
+ if (renderer.buildStart) {
889
+ await renderer.buildStart.call(this.getOptions());
890
+ }
891
+ }
892
+ }
893
+ async buildFinished({ outputFiles, metafile }) {
894
+ const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
895
+ if (isJS(file.path) || isCSS(file.path)) {
896
+ let relativePath = path6.default.relative(this.getOptions().config.workspaceRoot, file.path);
897
+ if (!relativePath.startsWith("\\\\?\\")) {
898
+ relativePath = relativePath.replace(/\\/g, "/");
899
+ }
900
+ const meta = _optionalChain([metafile, 'optionalAccess', _59 => _59.outputs, 'access', _60 => _60[relativePath]]);
901
+ return {
902
+ type: "chunk",
903
+ path: file.path,
904
+ code: file.text,
905
+ map: _optionalChain([outputFiles, 'access', _61 => _61.find, 'call', _62 => _62((f) => f.path === `${file.path}.map`), 'optionalAccess', _63 => _63.text]),
906
+ entryPoint: _optionalChain([meta, 'optionalAccess', _64 => _64.entryPoint]),
907
+ exports: _optionalChain([meta, 'optionalAccess', _65 => _65.exports]),
908
+ imports: _optionalChain([meta, 'optionalAccess', _66 => _66.imports])
909
+ };
910
+ } else {
911
+ return {
912
+ type: "asset",
913
+ path: file.path,
914
+ contents: file.contents
915
+ };
916
+ }
917
+ });
918
+ const writtenFiles = [];
919
+ await Promise.all(files.map(async (info) => {
920
+ for (const renderer of this.#renderers) {
921
+ if (info.type === "chunk" && renderer.renderChunk) {
922
+ const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
923
+ if (result) {
924
+ info.code = result.code;
925
+ if (result.map) {
926
+ const originalConsumer = await new (0, _sourcemap.SourceMapConsumer)(parseSourceMap(info.map));
927
+ const newConsumer = await new (0, _sourcemap.SourceMapConsumer)(parseSourceMap(result.map));
928
+ const generator = _sourcemap.SourceMapGenerator.fromSourceMap(newConsumer);
929
+ generator.applySourceMap(originalConsumer, info.path);
930
+ info.map = generator.toJSON();
931
+ originalConsumer.destroy();
932
+ newConsumer.destroy();
933
+ }
934
+ }
935
+ }
936
+ }
937
+ const inlineSourceMap = this.#options.sourcemap === "inline";
938
+ const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
939
+ await outputFile(info.path, contents, {
940
+ mode: info.type === "chunk" ? info.mode : void 0
941
+ });
942
+ writtenFiles.push({
943
+ get name() {
944
+ return path6.default.relative(process.cwd(), info.path);
945
+ },
946
+ get size() {
947
+ return contents.length;
948
+ }
949
+ });
950
+ if (info.type === "chunk" && info.map && !inlineSourceMap) {
951
+ const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
952
+ const outPath = `${info.path}.map`;
953
+ const contents2 = JSON.stringify(map2);
954
+ await outputFile(outPath, contents2);
955
+ writtenFiles.push({
956
+ get name() {
957
+ return path6.default.relative(process.cwd(), outPath);
958
+ },
959
+ get size() {
960
+ return contents2.length;
961
+ }
962
+ });
963
+ }
964
+ }));
965
+ for (const renderer of this.#renderers) {
966
+ if (renderer.buildEnd) {
967
+ await renderer.buildEnd.call(this.getOptions(), {
968
+ writtenFiles
969
+ });
970
+ }
971
+ }
972
+ }
973
+ };
974
+
975
+ // ../esbuild/src/clean.ts
976
+
977
+ async function clean(name = "ESBuild", directory, config) {
978
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
979
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${name} output clean`);
980
+ await _node.hfs.deleteAll(directory);
981
+ stopwatch();
982
+ }
983
+ _chunkJ5SB6L2Ljs.__name.call(void 0, clean, "clean");
984
+
985
+ // ../esbuild/src/plugins/esm-split-code-to-cjs.ts
986
+
987
+ var esmSplitCodeToCjsPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
988
+ name: "storm:esm-split-code-to-cjs",
989
+ setup(build6) {
990
+ build6.onEnd(async (result) => {
991
+ const outFiles = Object.keys(_nullishCoalesce(_optionalChain([result, 'access', _67 => _67.metafile, 'optionalAccess', _68 => _68.outputs]), () => ( {})));
992
+ const jsFiles = outFiles.filter((f) => f.endsWith("js"));
993
+ await esbuild.build({
994
+ outdir: resolvedOptions.outdir,
995
+ entryPoints: jsFiles,
996
+ allowOverwrite: true,
997
+ format: "cjs",
998
+ logLevel: "error",
999
+ packages: "external"
1000
+ });
1001
+ });
1002
+ }
1003
+ }), "esmSplitCodeToCjsPlugin");
1004
+
1005
+ // ../esbuild/src/plugins/fix-imports.ts
1006
+ var fixImportsPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
1007
+ name: "storm:fix-imports",
1008
+ setup(build6) {
1009
+ build6.onResolve({
1010
+ filter: /^spdx-exceptions/
1011
+ }, () => {
1012
+ return {
1013
+ path: _chunkJ5SB6L2Ljs.__require.resolve("spdx-exceptions")
1014
+ };
1015
+ });
1016
+ build6.onResolve({
1017
+ filter: /^spdx-license-ids/
1018
+ }, () => {
1019
+ return {
1020
+ path: _chunkJ5SB6L2Ljs.__require.resolve("spdx-license-ids")
1021
+ };
1022
+ });
1023
+ }
1024
+ }), "fixImportsPlugin");
1025
+
1026
+ // ../esbuild/src/plugins/native-node-module.ts
1027
+
1028
+ var nativeNodeModulesPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => {
1029
+ return {
1030
+ name: "native-node-modules",
1031
+ setup(build6) {
1032
+ build6.onResolve({
1033
+ filter: /\.node$/,
1034
+ namespace: "file"
1035
+ }, (args) => {
1036
+ const resolvedId = _chunkJ5SB6L2Ljs.__require.resolve(args.path, {
1037
+ paths: [
1038
+ args.resolveDir
1039
+ ]
1040
+ });
1041
+ if (resolvedId.endsWith(".node")) {
1042
+ return {
1043
+ path: resolvedId,
1044
+ namespace: "node-file"
1045
+ };
1046
+ }
1047
+ return {
1048
+ path: resolvedId
1049
+ };
1050
+ });
1051
+ build6.onLoad({
1052
+ filter: /.*/,
1053
+ namespace: "node-file"
1054
+ }, (args) => {
1055
+ return {
1056
+ contents: `
1057
+ import path from ${JSON.stringify(args.path)}
1058
+ try { module.exports = require(path) }
1059
+ catch {}
1060
+ `,
1061
+ resolveDir: _path.dirname.call(void 0, args.path)
1062
+ };
1063
+ });
1064
+ build6.onResolve({
1065
+ filter: /\.node$/,
1066
+ namespace: "node-file"
1067
+ }, (args) => ({
1068
+ path: args.path,
1069
+ namespace: "file"
1070
+ }));
1071
+ const opts = build6.initialOptions;
1072
+ opts.loader = opts.loader || {};
1073
+ opts.loader[".node"] = "file";
1074
+ }
1075
+ };
1076
+ }, "nativeNodeModulesPlugin");
1077
+
1078
+ // ../esbuild/src/plugins/node-protocol.ts
1079
+ var nodeProtocolPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => {
1080
+ const nodeProtocol = "node:";
1081
+ return {
1082
+ name: "node-protocol-plugin",
1083
+ setup({ onResolve }) {
1084
+ onResolve({
1085
+ filter: /^node:/
1086
+ }, ({ path: path7 }) => ({
1087
+ path: path7.slice(nodeProtocol.length),
1088
+ external: true
1089
+ }));
1090
+ }
1091
+ };
1092
+ }, "nodeProtocolPlugin");
1093
+
1094
+ // ../esbuild/src/plugins/on-error.ts
1095
+ var onErrorPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
1096
+ name: "storm:on-error",
1097
+ setup(build6) {
1098
+ build6.onEnd((result) => {
1099
+ if (result.errors.length > 0 && process.env.WATCH !== "true") {
1100
+ _chunkRCE3CC76js.writeError.call(void 0, `The following errors occurred during the build:
1101
+ ${result.errors.map((error) => error.text).join("\n")}
1102
+
1103
+ `, resolvedOptions.config);
1104
+ throw new Error("Storm esbuild process failed with errors.");
1105
+ }
1106
+ });
1107
+ }
1108
+ }), "onErrorPlugin");
1109
+
1110
+ // ../esbuild/src/plugins/resolve-paths.ts
1111
+
1112
+ function resolvePathsConfig(options, cwd) {
1113
+ if (_optionalChain([options, 'optionalAccess', _69 => _69.compilerOptions, 'optionalAccess', _70 => _70.paths])) {
1114
+ const paths = Object.entries(options.compilerOptions.paths);
1115
+ const resolvedPaths = paths.map(([key, paths2]) => {
1116
+ return [
1117
+ key,
1118
+ paths2.map((v) => path6.default.resolve(cwd, v))
1119
+ ];
1120
+ });
1121
+ return Object.fromEntries(resolvedPaths);
1122
+ }
1123
+ if (options.extends) {
1124
+ const extendsPath = path6.default.resolve(cwd, options.extends);
1125
+ const extendsDir = path6.default.dirname(extendsPath);
1126
+ const extendsConfig = _chunkJ5SB6L2Ljs.__require.call(void 0, extendsPath);
1127
+ return resolvePathsConfig(extendsConfig, extendsDir);
1128
+ }
1129
+ return [];
1130
+ }
1131
+ _chunkJ5SB6L2Ljs.__name.call(void 0, resolvePathsConfig, "resolvePathsConfig");
1132
+ var resolvePathsPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
1133
+ name: "storm:resolve-paths",
1134
+ setup(build6) {
1135
+ const parentTsConfig = build6.initialOptions.tsconfig ? _chunkJ5SB6L2Ljs.__require.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, build6.initialOptions.tsconfig)) : _chunkJ5SB6L2Ljs.__require.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, "tsconfig.json"));
1136
+ const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
1137
+ const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
1138
+ build6.onResolve({
1139
+ filter: packagesRegex
1140
+ }, (args) => {
1141
+ if (_optionalChain([build6, 'access', _71 => _71.initialOptions, 'access', _72 => _72.external, 'optionalAccess', _73 => _73.includes, 'call', _74 => _74(args.path)])) {
1142
+ return {
1143
+ path: args.path,
1144
+ external: true
1145
+ };
1146
+ }
1147
+ return {
1148
+ path: `${resolvedTsPaths[args.path][0]}/index.ts`
1149
+ };
1150
+ });
1151
+ }
1152
+ }), "resolvePathsPlugin");
1153
+
1154
+ // ../esbuild/src/plugins/tsc.ts
1155
+
1156
+ var _apiextractor = require('@microsoft/api-extractor');
1157
+ function bundleTypeDefinitions(filename, outfile, externals, options) {
1158
+ const { dependencies, peerDependencies, devDependencies } = _chunkJ5SB6L2Ljs.__require.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "package.json"));
1159
+ const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
1160
+ p,
1161
+ getTypeDependencyPackageName(p)
1162
+ ]);
1163
+ const peerDependenciesKeys = Object.keys(_nullishCoalesce(peerDependencies, () => ( {}))).flatMap((p) => [
1164
+ p,
1165
+ getTypeDependencyPackageName(p)
1166
+ ]);
1167
+ const devDependenciesKeys = Object.keys(_nullishCoalesce(devDependencies, () => ( {}))).flatMap((p) => [
1168
+ p,
1169
+ getTypeDependencyPackageName(p)
1170
+ ]);
1171
+ const includeDeps = devDependenciesKeys;
1172
+ const excludeDeps = /* @__PURE__ */ new Set([
1173
+ ...dependenciesKeys,
1174
+ ...peerDependenciesKeys,
1175
+ ...externals
1176
+ ]);
1177
+ const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
1178
+ const extractorConfig = _apiextractor.ExtractorConfig.prepare({
1179
+ configObject: {
1180
+ projectFolder: options.projectRoot,
1181
+ mainEntryPointFilePath: filename,
1182
+ bundledPackages,
1183
+ compiler: {
1184
+ tsconfigFilePath: options.tsconfig,
1185
+ overrideTsconfig: {
1186
+ compilerOptions: {
1187
+ paths: {}
1188
+ // bug with api extract + paths
1189
+ }
1190
+ }
1191
+ },
1192
+ dtsRollup: {
1193
+ enabled: true,
1194
+ untrimmedFilePath: _chunkRCE3CC76js.joinPaths.call(void 0, options.outdir, `${outfile}.d.ts`)
1195
+ },
1196
+ tsdocMetadata: {
1197
+ enabled: false
1198
+ }
1199
+ },
1200
+ packageJsonFullPath: _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "package.json"),
1201
+ configObjectFullPath: void 0
1202
+ });
1203
+ const extractorResult = _apiextractor.Extractor.invoke(extractorConfig, {
1204
+ showVerboseMessages: true,
1205
+ localBuild: true
1206
+ });
1207
+ if (extractorResult.succeeded === false) {
1208
+ _chunkRCE3CC76js.writeError.call(void 0, `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
1209
+ throw new Error("API Extractor completed with errors");
1210
+ }
1211
+ }
1212
+ _chunkJ5SB6L2Ljs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
1213
+ var tscPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
1214
+ name: "storm:tsc",
1215
+ setup(build6) {
1216
+ if (options.emitTypes === false) {
1217
+ return;
1218
+ }
1219
+ build6.onStart(async () => {
1220
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
1221
+ await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
1222
+ }
1223
+ if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0] && resolvedOptions.entryPoints[0].endsWith(".ts")) {
1224
+ const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
1225
+ const typeOutDir = resolvedOptions.outdir;
1226
+ const entryPoint = resolvedOptions.entryPoints[0].replace(sourceRoot, "").replace(/\.ts$/, "");
1227
+ const bundlePath = _chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.outdir, entryPoint);
1228
+ let dtsPath;
1229
+ if (await _node.hfs.isFile(_chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
1230
+ dtsPath = _chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
1231
+ } else if (await _node.hfs.isFile(_chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
1232
+ dtsPath = _chunkRCE3CC76js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
1233
+ }
1234
+ const ext = resolvedOptions.outExtension.dts || resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
1235
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
1236
+ bundleTypeDefinitions(dtsPath, bundlePath, _nullishCoalesce(resolvedOptions.external, () => ( [])), resolvedOptions);
1237
+ const dtsContents = await _node.hfs.text(`${bundlePath}.d.ts`);
1238
+ await _node.hfs.write(`${bundlePath}.${ext}`, dtsContents);
1239
+ } else {
1240
+ await _node.hfs.write(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
1241
+ }
1242
+ }
1243
+ });
1244
+ }
1245
+ }), "tscPlugin");
1246
+ function getTypeDependencyPackageName(npmPackage) {
1247
+ if (npmPackage.startsWith("@")) {
1248
+ const [scope, name] = npmPackage.split("/");
1249
+ return `@types/${_optionalChain([scope, 'optionalAccess', _75 => _75.slice, 'call', _76 => _76(1)])}__${name}`;
1250
+ }
1251
+ return `@types/${npmPackage}`;
1252
+ }
1253
+ _chunkJ5SB6L2Ljs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
1254
+
1255
+ // ../esbuild/src/config.ts
1256
+ var getOutputExtensionMap = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, pkgType) => {
1257
+ return options.outExtension ? options.outExtension(options.format, pkgType) : getOutExtension(options.format, pkgType);
1258
+ }, "getOutputExtensionMap");
1259
+ var getDefaultBuildPlugins = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => [
1260
+ nodeProtocolPlugin(options, resolvedOptions),
1261
+ resolvePathsPlugin(options, resolvedOptions),
1262
+ fixImportsPlugin(options, resolvedOptions),
1263
+ nativeNodeModulesPlugin(options, resolvedOptions),
1264
+ esmSplitCodeToCjsPlugin(options, resolvedOptions),
1265
+ tscPlugin(options, resolvedOptions),
1266
+ onErrorPlugin(options, resolvedOptions)
1267
+ ], "getDefaultBuildPlugins");
1268
+ var DEFAULT_BUILD_OPTIONS = {
1269
+ platform: "node",
1270
+ target: "node22",
1271
+ format: "cjs",
1272
+ external: [],
1273
+ logLevel: "error",
1274
+ tsconfig: "tsconfig.json",
1275
+ envName: "production",
1276
+ keepNames: true,
1277
+ metafile: true,
1278
+ injectShims: true,
1279
+ color: true,
1280
+ watch: false,
1281
+ bundle: true,
1282
+ clean: true,
1283
+ debug: false,
1284
+ loader: {
1285
+ ".aac": "file",
1286
+ ".css": "file",
1287
+ ".eot": "file",
1288
+ ".flac": "file",
1289
+ ".gif": "file",
1290
+ ".jpeg": "file",
1291
+ ".jpg": "file",
1292
+ ".mp3": "file",
1293
+ ".mp4": "file",
1294
+ ".ogg": "file",
1295
+ ".otf": "file",
1296
+ ".png": "file",
1297
+ ".svg": "file",
1298
+ ".ttf": "file",
1299
+ ".wav": "file",
1300
+ ".webm": "file",
1301
+ ".webp": "file",
1302
+ ".woff": "file",
1303
+ ".woff2": "file"
1304
+ },
1305
+ banner: DEFAULT_COMPILED_BANNER
1306
+ };
1307
+
1308
+ // ../esbuild/src/plugins/deps-check.ts
1309
+
1310
+
1311
+ var unusedIgnore = [
1312
+ // these are our dev dependencies
1313
+ /@types\/.*?/,
1314
+ /@typescript-eslint.*?/,
1315
+ /eslint.*?/,
1316
+ "esbuild",
1317
+ "husky",
1318
+ "is-ci",
1319
+ "lint-staged",
1320
+ "prettier",
1321
+ "typescript",
1322
+ "ts-node",
1323
+ "ts-jest",
1324
+ "@swc/core",
1325
+ "@swc/jest",
1326
+ "jest",
1327
+ // these are missing 3rd party deps
1328
+ "spdx-exceptions",
1329
+ "spdx-license-ids",
1330
+ // type-only, so it is not detected
1331
+ "ts-toolbelt",
1332
+ // these are indirectly used by build
1333
+ "buffer"
1334
+ ];
1335
+ var missingIgnore = [
1336
+ ".prisma",
1337
+ "@prisma/client",
1338
+ "ts-toolbelt"
1339
+ ];
1340
+ var depsCheckPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (bundle) => ({
1341
+ name: "storm:deps-check",
1342
+ setup(build6) {
1343
+ const pkgJsonPath = path6.default.join(process.cwd(), "package.json");
1344
+ const pkgContents = _chunkJ5SB6L2Ljs.__require.call(void 0, pkgJsonPath);
1345
+ const regDependencies = Object.keys(_nullishCoalesce(pkgContents["dependencies"], () => ( {})));
1346
+ const devDependencies = Object.keys(_nullishCoalesce(pkgContents["devDependencies"], () => ( {})));
1347
+ const peerDependencies = Object.keys(_nullishCoalesce(pkgContents["peerDependencies"], () => ( {})));
1348
+ const dependencies = [
1349
+ ...regDependencies,
1350
+ ...bundle ? devDependencies : []
1351
+ ];
1352
+ const collectedDependencies = /* @__PURE__ */ new Set();
1353
+ const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
1354
+ build6.onResolve({
1355
+ filter: onlyPackages
1356
+ }, (args) => {
1357
+ if (args.importer.includes(process.cwd())) {
1358
+ if (args.path[0] === "@") {
1359
+ const [org, pkg] = args.path.split("/");
1360
+ collectedDependencies.add(`${org}/${pkg}`);
1361
+ } else {
1362
+ const [pkg] = args.path.split("/");
1363
+ collectedDependencies.add(pkg);
1364
+ }
1365
+ }
1366
+ return {
1367
+ external: true
1368
+ };
1369
+ });
1370
+ build6.onEnd(() => {
1371
+ const unusedDependencies = [
1372
+ ...dependencies
1373
+ ].filter((dep) => {
1374
+ return !collectedDependencies.has(dep) || _module.builtinModules.includes(dep);
1375
+ });
1376
+ const missingDependencies = [
1377
+ ...collectedDependencies
1378
+ ].filter((dep) => {
1379
+ return !dependencies.includes(dep) && !_module.builtinModules.includes(dep);
1380
+ });
1381
+ const filteredUnusedDeps = unusedDependencies.filter((dep) => {
1382
+ return !unusedIgnore.some((pattern) => dep.match(pattern));
1383
+ });
1384
+ const filteredMissingDeps = missingDependencies.filter((dep) => {
1385
+ return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
1386
+ });
1387
+ _chunkRCE3CC76js.writeWarning.call(void 0, `Unused Dependencies: ${JSON.stringify(filteredUnusedDeps)}`);
1388
+ _chunkRCE3CC76js.writeError.call(void 0, `Missing Dependencies: ${JSON.stringify(filteredMissingDeps)}`);
1389
+ if (filteredMissingDeps.length > 0) {
1390
+ throw new Error(`Missing dependencies detected - please install them:
1391
+ ${JSON.stringify(filteredMissingDeps)}
1392
+ `);
1393
+ }
1394
+ });
1395
+ }
1396
+ }), "depsCheckPlugin");
1397
+
1398
+ // ../esbuild/src/renderers/shebang.ts
1399
+ var shebangRenderer = {
1400
+ name: "shebang",
1401
+ renderChunk(_, __, info) {
1402
+ if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
1403
+ info.mode = 493;
1404
+ }
1405
+ }
1406
+ };
1407
+
1408
+ // ../esbuild/src/utilities/helpers.ts
1409
+ function handleSync(fn) {
1410
+ try {
1411
+ return fn();
1412
+ } catch (error_) {
1413
+ return error_;
1414
+ }
1415
+ }
1416
+ _chunkJ5SB6L2Ljs.__name.call(void 0, handleSync, "handleSync");
1417
+ async function handleAsync(fn) {
1418
+ try {
1419
+ return await fn();
1420
+ } catch (error_) {
1421
+ return error_;
1422
+ }
1423
+ }
1424
+ _chunkJ5SB6L2Ljs.__name.call(void 0, handleAsync, "handleAsync");
1425
+ var handle = handleSync;
1426
+ handle.async = handleAsync;
1427
+ var skip = Symbol("skip");
1428
+ function transduceSync(list, transformer) {
1429
+ const transduced = [];
1430
+ for (const [i, element_] of list.entries()) {
1431
+ const transformed = transformer(element_, i);
1432
+ if (transformed !== skip) {
1433
+ transduced[transduced.length] = transformed;
1434
+ }
1435
+ }
1436
+ return transduced;
1437
+ }
1438
+ _chunkJ5SB6L2Ljs.__name.call(void 0, transduceSync, "transduceSync");
1439
+ async function transduceAsync(list, transformer) {
1440
+ const transduced = [];
1441
+ await Promise.all(list.entries().map(async ([i, element_]) => {
1442
+ const transformed = await transformer(element_, i);
1443
+ if (transformed !== skip) {
1444
+ transduced[transduced.length] = transformed;
1445
+ }
1446
+ }));
1447
+ return transduced;
1448
+ }
1449
+ _chunkJ5SB6L2Ljs.__name.call(void 0, transduceAsync, "transduceAsync");
1450
+ var transduce = transduceSync;
1451
+ transduce.async = transduceAsync;
1452
+ function pipeSync(fn, ...fns) {
1453
+ return (...args) => {
1454
+ let result = fn(...args);
1455
+ for (let i = 0; result !== skip && i < fns.length; ++i) {
1456
+ result = _optionalChain([fns, 'access', _77 => _77[i], 'optionalCall', _78 => _78(result)]);
1457
+ }
1458
+ return result;
1459
+ };
1460
+ }
1461
+ _chunkJ5SB6L2Ljs.__name.call(void 0, pipeSync, "pipeSync");
1462
+ function pipeAsync(fn, ...fns) {
1463
+ return async (...args) => {
1464
+ let result = await fn(...args);
1465
+ for (let i = 0; result !== skip && i < fns.length; ++i) {
1466
+ result = await _optionalChain([fns, 'access', _79 => _79[i], 'optionalCall', _80 => _80(result)]);
1467
+ }
1468
+ return result;
1469
+ };
1470
+ }
1471
+ _chunkJ5SB6L2Ljs.__name.call(void 0, pipeAsync, "pipeAsync");
1472
+ var pipe = pipeSync;
1473
+ pipe.async = pipeAsync;
1474
+
1475
+ // ../esbuild/src/build.ts
1476
+ var resolveOptions = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (userOptions) => {
1477
+ const projectRoot = userOptions.projectRoot;
1478
+ const workspaceRoot3 = _findworkspaceroot.findWorkspaceRoot.call(void 0, projectRoot);
1479
+ if (!workspaceRoot3) {
1480
+ throw new Error("Cannot find Nx workspace root");
1481
+ }
1482
+ const config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, workspaceRoot3.dir);
1483
+ _chunkRCE3CC76js.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
1484
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Build options resolution");
1485
+ const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
1486
+ exitOnError: true
1487
+ });
1488
+ const projectJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3.dir, projectRoot, "project.json");
1489
+ if (!await _node.hfs.isFile(projectJsonPath)) {
1490
+ throw new Error("Cannot find project.json configuration");
1491
+ }
1492
+ const projectJson = await _node.hfs.json(projectJsonPath);
1493
+ const projectName = projectJson.name;
1494
+ const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
1495
+ if (!_optionalChain([projectConfigurations, 'optionalAccess', _81 => _81.projects, 'optionalAccess', _82 => _82[projectName]])) {
1496
+ 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.");
1497
+ }
1498
+ const options = _defu2.default.call(void 0, userOptions, DEFAULT_BUILD_OPTIONS);
1499
+ options.name ??= `${projectName}-${options.format}`;
1500
+ options.target ??= DEFAULT_TARGET;
1501
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3.dir, options.projectRoot, "package.json");
1502
+ if (!await _node.hfs.isFile(packageJsonPath)) {
1503
+ throw new Error("Cannot find package.json configuration");
1504
+ }
1505
+ const packageJson = await _node.hfs.json(packageJsonPath);
1506
+ const outExtension = getOutputExtensionMap(options, packageJson.type);
1507
+ const env = getEnv("esbuild", options);
1508
+ const result = {
1509
+ ...options,
1510
+ config,
1511
+ mainFields: options.platform === "node" ? [
1512
+ "module",
1513
+ "main"
1514
+ ] : [
1515
+ "browser",
1516
+ "module",
1517
+ "main"
1518
+ ],
1519
+ resolveExtensions: [
1520
+ ".ts",
1521
+ ".js",
1522
+ ".node"
1523
+ ],
1524
+ ...userOptions,
1525
+ tsconfig: _chunkRCE3CC76js.joinPaths.call(void 0, projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
1526
+ format: options.format || "cjs",
1527
+ entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
1528
+ "./src/index.ts"
1529
+ ], userOptions.emitOnAll),
1530
+ outdir: userOptions.outputPath || _chunkRCE3CC76js.joinPaths.call(void 0, "dist", projectRoot),
1531
+ plugins: [],
1532
+ name: userOptions.name || projectName,
1533
+ projectConfigurations,
1534
+ projectName,
1535
+ projectGraph,
1536
+ sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || _chunkRCE3CC76js.joinPaths.call(void 0, projectRoot, "src"),
1537
+ minify: userOptions.minify || !userOptions.debug,
1538
+ verbose: userOptions.verbose || _chunkRCE3CC76js.isVerbose.call(void 0, ) || userOptions.debug === true,
1539
+ includeSrc: userOptions.includeSrc === true,
1540
+ metafile: userOptions.metafile !== false,
1541
+ generatePackageJson: userOptions.generatePackageJson !== false,
1542
+ clean: userOptions.clean !== false,
1543
+ emitOnAll: userOptions.emitOnAll === true,
1544
+ assets: _nullishCoalesce(userOptions.assets, () => ( [])),
1545
+ injectShims: userOptions.injectShims !== true,
1546
+ bundle: userOptions.bundle !== false,
1547
+ keepNames: true,
1548
+ watch: userOptions.watch === true,
1549
+ outExtension,
1550
+ footer: userOptions.footer,
1551
+ banner: {
1552
+ js: options.banner || DEFAULT_COMPILED_BANNER,
1553
+ css: options.banner || DEFAULT_COMPILED_BANNER
1554
+ },
1555
+ splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
1556
+ treeShaking: options.format === "esm",
1557
+ env,
1558
+ define: {
1559
+ STORM_FORMAT: JSON.stringify(options.format || "cjs"),
1560
+ ...options.format === "cjs" && options.injectShims ? {
1561
+ "import.meta.url": "importMetaUrl"
1562
+ } : {},
1563
+ ...options.define,
1564
+ ...Object.keys(env || {}).reduce((res, key) => {
1565
+ const value = JSON.stringify(env[key]);
1566
+ return {
1567
+ ...res,
1568
+ [`process.env.${key}`]: value,
1569
+ [`import.meta.env.${key}`]: value
1570
+ };
1571
+ }, {})
1572
+ },
1573
+ inject: [
1574
+ options.format === "cjs" && options.injectShims ? _chunkRCE3CC76js.joinPaths.call(void 0, __dirname, "../assets/cjs_shims.js") : "",
1575
+ options.format === "esm" && options.injectShims && options.platform === "node" ? _chunkRCE3CC76js.joinPaths.call(void 0, __dirname, "../assets/esm_shims.js") : "",
1576
+ ..._nullishCoalesce(options.inject, () => ( []))
1577
+ ].filter(Boolean)
1578
+ };
1579
+ result.plugins = _nullishCoalesce(userOptions.plugins, () => ( getDefaultBuildPlugins(userOptions, result)));
1580
+ stopwatch();
1581
+ return result;
1582
+ }, "resolveOptions");
1583
+ async function generatePackageJson(context2) {
1584
+ if (context2.options.generatePackageJson !== false && await _node.hfs.isFile(_chunkRCE3CC76js.joinPaths.call(void 0, context2.options.projectRoot, "package.json"))) {
1585
+ _chunkRCE3CC76js.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", context2.options.config);
1586
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Write package.json file");
1587
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, context2.options.projectRoot, "project.json");
1588
+ if (!await _node.hfs.isFile(packageJsonPath)) {
1589
+ throw new Error("Cannot find package.json configuration");
1590
+ }
1591
+ let packageJson = await _node.hfs.json(_chunkRCE3CC76js.joinPaths.call(void 0, context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"));
1592
+ if (!packageJson) {
1593
+ throw new Error("Cannot find package.json configuration file");
1594
+ }
1595
+ packageJson = await addPackageDependencies(context2.options.config.workspaceRoot, context2.options.projectRoot, context2.options.projectName, packageJson);
1596
+ packageJson = await addWorkspacePackageJsonFields(context2.options.config, context2.options.projectRoot, context2.options.sourceRoot, context2.options.projectName, false, packageJson);
1597
+ packageJson.exports ??= {};
1598
+ packageJson.exports["./package.json"] ??= "./package.json";
1599
+ packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, context2.options.sourceRoot);
1600
+ let entryPoints = [
1601
+ {
1602
+ in: "./src/index.ts",
1603
+ out: "./src/index.ts"
1604
+ }
1605
+ ];
1606
+ if (context2.options.entryPoints) {
1607
+ if (Array.isArray(context2.options.entryPoints)) {
1608
+ entryPoints = context2.options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
1609
+ in: entryPoint,
1610
+ out: entryPoint
1611
+ } : entryPoint);
1612
+ }
1613
+ for (const entryPoint of entryPoints) {
1614
+ const split = entryPoint.out.split(".");
1615
+ split.pop();
1616
+ const entry = split.join(".").replaceAll("\\", "/");
1617
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, context2.options.sourceRoot);
1618
+ }
1619
+ }
1620
+ packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
1621
+ packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
1622
+ packageJson.types = "./dist/index.d.ts";
1623
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
1624
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1625
+ ret[key.replace("/index", "")] = packageJson.exports[key];
1626
+ }
1627
+ return ret;
1628
+ }, packageJson.exports);
1629
+ await _devkit.writeJsonFile.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, context2.options.outdir, "package.json"), packageJson);
1630
+ stopwatch();
1631
+ }
1632
+ return context2;
1633
+ }
1634
+ _chunkJ5SB6L2Ljs.__name.call(void 0, generatePackageJson, "generatePackageJson");
1635
+ async function createOptions(options) {
1636
+ return _estoolkit.flatten.call(void 0, await Promise.all(_compat.map.call(void 0, options, (opt) => [
1637
+ // we defer it so that we don't trigger glob immediately
1638
+ () => resolveOptions(opt)
1639
+ ])));
1640
+ }
1641
+ _chunkJ5SB6L2Ljs.__name.call(void 0, createOptions, "createOptions");
1642
+ async function generateContext(getOptions) {
1643
+ const options = await getOptions();
1644
+ const rendererEngine = new RendererEngine([
1645
+ shebangRenderer,
1646
+ ...options.renderers || []
1647
+ ]);
1648
+ return {
1649
+ options,
1650
+ rendererEngine
1651
+ };
1652
+ }
1653
+ _chunkJ5SB6L2Ljs.__name.call(void 0, generateContext, "generateContext");
1654
+ async function executeEsBuild(context2) {
1655
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
1656
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${context2.options.name} build`);
1657
+ if (process.env.WATCH === "true") {
1658
+ const ctx = await esbuild2.context(context2.options);
1659
+ watch(ctx, context2.options);
1660
+ }
1661
+ const result = await esbuild2.build(context2.options);
1662
+ if (result.metafile) {
1663
+ const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
1664
+ await _node.hfs.write(metafilePath, JSON.stringify(result.metafile));
1665
+ }
1666
+ stopwatch();
1667
+ return context2;
1668
+ }
1669
+ _chunkJ5SB6L2Ljs.__name.call(void 0, executeEsBuild, "executeEsBuild");
1670
+ async function copyBuildAssets(context2) {
1671
+ if (_optionalChain([context2, 'access', _83 => _83.result, 'optionalAccess', _84 => _84.errors, 'access', _85 => _85.length]) === 0) {
1672
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${context2.options.outdir}`, context2.options.config);
1673
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${context2.options.name} asset copy`);
1674
+ await copyAssets(context2.options.config, _nullishCoalesce(context2.options.assets, () => ( [])), context2.options.outdir, context2.options.projectRoot, context2.options.projectName, context2.options.sourceRoot, true, false);
1675
+ stopwatch();
1676
+ }
1677
+ return context2;
1678
+ }
1679
+ _chunkJ5SB6L2Ljs.__name.call(void 0, copyBuildAssets, "copyBuildAssets");
1680
+ async function reportResults(context2) {
1681
+ if (_optionalChain([context2, 'access', _86 => _86.result, 'optionalAccess', _87 => _87.errors, 'access', _88 => _88.length]) === 0) {
1682
+ if (context2.result.warnings.length > 0) {
1683
+ _chunkRCE3CC76js.writeWarning.call(void 0, ` \u{1F6A7} The following warnings occurred during the build: ${context2.result.warnings.map((warning) => warning.text).join("\n")}`, context2.options.config);
1684
+ }
1685
+ _chunkRCE3CC76js.writeSuccess.call(void 0, ` \u{1F4E6} The ${context2.options.name} build completed successfully`, context2.options.config);
1686
+ }
1687
+ }
1688
+ _chunkJ5SB6L2Ljs.__name.call(void 0, reportResults, "reportResults");
1689
+ async function dependencyCheck(options) {
1690
+ if (process.env.DEV === "true") {
1691
+ return void 0;
1692
+ }
1693
+ if (process.env.CI && !process.env.BUILDKITE) {
1694
+ return void 0;
1695
+ }
1696
+ const buildPromise = esbuild2.build({
1697
+ entryPoints: _globby.globbySync.call(void 0, "**/*.{j,t}s", {
1698
+ // We don't check dependencies in ecosystem tests because tests are isolated from the build.
1699
+ ignore: [
1700
+ "./src/__tests__/**/*",
1701
+ "./tests/e2e/**/*",
1702
+ "./dist/**/*"
1703
+ ],
1704
+ gitignore: true
1705
+ }),
1706
+ logLevel: "silent",
1707
+ bundle: true,
1708
+ write: false,
1709
+ outdir: "out",
1710
+ plugins: [
1711
+ depsCheckPlugin(options.bundle)
1712
+ ]
1713
+ });
1714
+ await buildPromise.catch(() => {
1715
+ });
1716
+ return void 0;
1717
+ }
1718
+ _chunkJ5SB6L2Ljs.__name.call(void 0, dependencyCheck, "dependencyCheck");
1719
+ async function cleanOutputPath(context2) {
1720
+ if (context2.options.clean !== false && context2.options.outdir) {
1721
+ await clean(context2.options.name, context2.options.outdir, context2.options.config);
1722
+ }
1723
+ return context2;
1724
+ }
1725
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cleanOutputPath, "cleanOutputPath");
1726
+ async function build3(options) {
1727
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u26A1 Executing Storm ESBuild pipeline`);
1728
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "ESBuild pipeline");
1729
+ try {
1730
+ const opts = Array.isArray(options) ? options : [
1731
+ options
1732
+ ];
1733
+ if (opts.length === 0) {
1734
+ throw new Error("No build options were provided");
1735
+ }
1736
+ void transduce.async(opts, dependencyCheck);
1737
+ await transduce.async(await createOptions(opts), pipe.async(generateContext, cleanOutputPath, generatePackageJson, executeEsBuild, copyBuildAssets, reportResults));
1738
+ _chunkRCE3CC76js.writeSuccess.call(void 0, " \u{1F3C1} ESBuild pipeline build completed successfully");
1739
+ } catch (error) {
1740
+ _chunkRCE3CC76js.writeFatal.call(void 0, " \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
1741
+ throw error;
1742
+ } finally {
1743
+ stopwatch();
1744
+ }
1745
+ }
1746
+ _chunkJ5SB6L2Ljs.__name.call(void 0, build3, "build");
1747
+ var watch = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (context2, options) => {
1748
+ if (!options.watch) {
1749
+ return context2;
1750
+ }
1751
+ const config = {
1752
+ ignoreInitial: true,
1753
+ useFsEvents: true,
1754
+ ignored: [
1755
+ "./src/__tests__/**/*",
1756
+ "./package.json"
1757
+ ]
1758
+ };
1759
+ const changeWatcher = _chokidar.watch.call(void 0, [
1760
+ "./src/**/*"
1761
+ ], config);
1762
+ const fastRebuild = _estoolkit.debounce.call(void 0, async () => {
1763
+ const timeBefore = Date.now();
1764
+ const rebuildResult = await handle.async(() => {
1765
+ return context2.rebuild();
1766
+ });
1767
+ if (rebuildResult instanceof Error) {
1768
+ _chunkRCE3CC76js.writeError.call(void 0, rebuildResult.message);
1769
+ }
1770
+ _chunkRCE3CC76js.writeTrace.call(void 0, `${Date.now() - timeBefore}ms [${_nullishCoalesce(options.name, () => ( ""))}]`);
1771
+ }, 10);
1772
+ changeWatcher.on("change", fastRebuild);
1773
+ return void 0;
1774
+ }, "watch");
1775
+
1776
+ // ../workspace-tools/src/executors/esbuild/executor.ts
1777
+ async function esbuildExecutorFn(options, context2, config) {
1778
+ _chunkRCE3CC76js.writeInfo.call(void 0, "\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
1779
+ if (!_optionalChain([context2, 'access', _89 => _89.projectsConfigurations, 'optionalAccess', _90 => _90.projects]) || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !_optionalChain([context2, 'access', _91 => _91.projectsConfigurations, 'access', _92 => _92.projects, 'access', _93 => _93[context2.projectName], 'optionalAccess', _94 => _94.root])) {
1780
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1781
+ }
1782
+ await build3({
1783
+ ...options,
1784
+ projectRoot: _optionalChain([context2, 'access', _95 => _95.projectsConfigurations, 'access', _96 => _96.projects, 'optionalAccess', _97 => _97[context2.projectName], 'access', _98 => _98.root]),
1785
+ projectName: context2.projectName,
1786
+ sourceRoot: _optionalChain([context2, 'access', _99 => _99.projectsConfigurations, 'access', _100 => _100.projects, 'optionalAccess', _101 => _101[context2.projectName], 'optionalAccess', _102 => _102.sourceRoot]),
1787
+ format: options.format,
1788
+ platform: options.format
1789
+ });
1790
+ return {
1791
+ success: true
1792
+ };
1793
+ }
1794
+ _chunkJ5SB6L2Ljs.__name.call(void 0, esbuildExecutorFn, "esbuildExecutorFn");
1795
+ var executor_default6 = withRunExecutor("Storm ESBuild build", esbuildExecutorFn, {
1796
+ skipReadingConfig: false,
1797
+ hooks: {
1798
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (options, config) => {
1799
+ options.entry ??= [
1800
+ "src/index.ts"
1801
+ ];
1802
+ options.outputPath ??= "dist/{projectRoot}";
1803
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
1804
+ return options;
1805
+ }, "applyDefaultOptions")
1806
+ }
1807
+ });
1808
+
1809
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
1810
+
1811
+ var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
1812
+
1813
+ // ../workspace-tools/src/utils/pnpm-deps-update.ts
1814
+
1815
+
1816
+ var _readyamlfile = require('read-yaml-file'); var _readyamlfile2 = _interopRequireDefault(_readyamlfile);
1817
+
1818
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
1819
+ var LARGE_BUFFER3 = 1024 * 1e6;
1820
+
1821
+ // ../workspace-tools/src/executors/size-limit/executor.ts
1822
+
1823
+ var _esbuild2 = require('@size-limit/esbuild'); var _esbuild3 = _interopRequireDefault(_esbuild2);
1824
+ var _esbuildwhy = require('@size-limit/esbuild-why'); var _esbuildwhy2 = _interopRequireDefault(_esbuildwhy);
1825
+ var _file = require('@size-limit/file'); var _file2 = _interopRequireDefault(_file);
1826
+ var _sizelimit = require('size-limit'); var _sizelimit2 = _interopRequireDefault(_sizelimit);
1827
+ async function sizeLimitExecutorFn(options, context2, config) {
1828
+ if (!_optionalChain([context2, 'optionalAccess', _103 => _103.projectName]) || !_optionalChain([context2, 'access', _104 => _104.projectsConfigurations, 'optionalAccess', _105 => _105.projects]) || !context2.projectsConfigurations.projects[context2.projectName]) {
1829
+ throw new Error("The Size-Limit process failed because the context is not valid. Please run this command from a workspace.");
1830
+ }
1831
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u{1F4CF} Running Size-Limit on ${context2.projectName}`, config);
1832
+ _sizelimit2.default.call(void 0, [
1833
+ _file2.default,
1834
+ _esbuild3.default,
1835
+ _esbuildwhy2.default
1836
+ ], {
1837
+ checks: _nullishCoalesce(_nullishCoalesce(options.entry, () => ( _optionalChain([context2, 'access', _106 => _106.projectsConfigurations, 'access', _107 => _107.projects, 'access', _108 => _108[context2.projectName], 'optionalAccess', _109 => _109.sourceRoot]))), () => ( _devkit.joinPathFragments.call(void 0, _nullishCoalesce(_optionalChain([context2, 'access', _110 => _110.projectsConfigurations, 'access', _111 => _111.projects, 'access', _112 => _112[context2.projectName], 'optionalAccess', _113 => _113.root]), () => ( "./")), "src")))
1838
+ }).then((result) => {
1839
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u{1F4CF} ${context2.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
1840
+ });
1841
+ return {
1842
+ success: true
1843
+ };
1844
+ }
1845
+ _chunkJ5SB6L2Ljs.__name.call(void 0, sizeLimitExecutorFn, "sizeLimitExecutorFn");
1846
+ var executor_default7 = withRunExecutor("Size-Limit Performance Test Executor", sizeLimitExecutorFn, {
1847
+ skipReadingConfig: false,
1848
+ hooks: {
1849
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
1850
+ return options;
1851
+ }, "applyDefaultOptions")
1852
+ }
1853
+ });
1854
+
1855
+ // ../tsdown/src/build.ts
1856
+
1857
+
1858
+
1859
+
1860
+ var _tsdown = require('tsdown');
1861
+
1862
+ // ../tsdown/src/clean.ts
1863
+
1864
+ async function clean2(name = "ESBuild", directory, config) {
1865
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
1866
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${name} output clean`);
1867
+ await _node.hfs.deleteAll(directory);
1868
+ stopwatch();
1869
+ }
1870
+ _chunkJ5SB6L2Ljs.__name.call(void 0, clean2, "clean");
1871
+
1872
+ // ../tsdown/src/config.ts
1873
+ var DEFAULT_BUILD_OPTIONS2 = {
1874
+ platform: "node",
1875
+ target: "node22",
1876
+ format: [
1877
+ "esm",
1878
+ "cjs"
1879
+ ],
1880
+ tsconfig: "tsconfig.json",
1881
+ envName: "production",
1882
+ globalName: "globalThis",
1883
+ unused: {
1884
+ level: "error"
1885
+ },
1886
+ injectShims: true,
1887
+ watch: false,
1888
+ bundle: true,
1889
+ treeshake: true,
1890
+ clean: true,
1891
+ debug: false
1892
+ };
1893
+
1894
+ // ../tsdown/src/build.ts
1895
+ var resolveOptions2 = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (userOptions) => {
1896
+ const projectRoot = userOptions.projectRoot;
1897
+ const workspaceRoot3 = _findworkspaceroot.findWorkspaceRoot.call(void 0, projectRoot);
1898
+ if (!workspaceRoot3) {
1899
+ throw new Error("Cannot find Nx workspace root");
1900
+ }
1901
+ const config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, workspaceRoot3.dir);
1902
+ _chunkRCE3CC76js.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
1903
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Build options resolution");
1904
+ const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
1905
+ exitOnError: true
1906
+ });
1907
+ const projectJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3.dir, projectRoot, "project.json");
1908
+ if (!await _node.hfs.isFile(projectJsonPath)) {
1909
+ throw new Error("Cannot find project.json configuration");
1910
+ }
1911
+ const projectJson = await _node.hfs.json(projectJsonPath);
1912
+ const projectName = projectJson.name;
1913
+ const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
1914
+ if (!_optionalChain([projectConfigurations, 'optionalAccess', _114 => _114.projects, 'optionalAccess', _115 => _115[projectName]])) {
1915
+ 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.");
1916
+ }
1917
+ const options = _defu2.default.call(void 0, userOptions, DEFAULT_BUILD_OPTIONS2);
1918
+ options.name ??= `${projectName}-${options.format}`;
1919
+ options.target ??= DEFAULT_TARGET;
1920
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3.dir, options.projectRoot, "package.json");
1921
+ if (!await _node.hfs.isFile(packageJsonPath)) {
1922
+ throw new Error("Cannot find package.json configuration");
1923
+ }
1924
+ const env = getEnv("tsdown", options);
1925
+ const result = {
1926
+ ...options,
1927
+ config,
1928
+ ...userOptions,
1929
+ tsconfig: _chunkRCE3CC76js.joinPaths.call(void 0, projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
1930
+ format: options.format || "cjs",
1931
+ entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
1932
+ "./src/index.ts"
1933
+ ], userOptions.emitOnAll),
1934
+ outdir: userOptions.outputPath || _chunkRCE3CC76js.joinPaths.call(void 0, "dist", projectRoot),
1935
+ plugins: [],
1936
+ name: userOptions.name || projectName,
1937
+ projectConfigurations,
1938
+ projectName,
1939
+ projectGraph,
1940
+ sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || _chunkRCE3CC76js.joinPaths.call(void 0, projectRoot, "src"),
1941
+ minify: userOptions.minify || !userOptions.debug,
1942
+ verbose: userOptions.verbose || _chunkRCE3CC76js.isVerbose.call(void 0, ) || userOptions.debug === true,
1943
+ includeSrc: userOptions.includeSrc === true,
1944
+ metafile: userOptions.metafile !== false,
1945
+ generatePackageJson: userOptions.generatePackageJson !== false,
1946
+ clean: userOptions.clean !== false,
1947
+ emitOnAll: userOptions.emitOnAll === true,
1948
+ dts: userOptions.emitTypes === true ? {
1949
+ transformer: "oxc"
1950
+ } : userOptions.emitTypes,
1951
+ bundleDts: userOptions.emitTypes,
1952
+ assets: _nullishCoalesce(userOptions.assets, () => ( [])),
1953
+ shims: userOptions.injectShims !== true,
1954
+ bundle: userOptions.bundle !== false,
1955
+ watch: userOptions.watch === true,
1956
+ define: {
1957
+ STORM_FORMAT: JSON.stringify(options.format || "cjs"),
1958
+ ...options.format === "cjs" && options.injectShims ? {
1959
+ "import.meta.url": "importMetaUrl"
1960
+ } : {},
1961
+ ...Object.keys(env || {}).reduce((res, key) => {
1962
+ const value = JSON.stringify(env[key]);
1963
+ return {
1964
+ ...res,
1965
+ [`process.env.${key}`]: value,
1966
+ [`import.meta.env.${key}`]: value
1967
+ };
1968
+ }, {}),
1969
+ ...options.define
1970
+ }
1971
+ };
1972
+ stopwatch();
1973
+ return result;
1974
+ }, "resolveOptions");
1975
+ async function generatePackageJson2(options) {
1976
+ if (options.generatePackageJson !== false && await _node.hfs.isFile(_chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "package.json"))) {
1977
+ _chunkRCE3CC76js.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", options.config);
1978
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Write package.json file");
1979
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "project.json");
1980
+ if (!await _node.hfs.isFile(packageJsonPath)) {
1981
+ throw new Error("Cannot find package.json configuration");
1982
+ }
1983
+ let packageJson = await _node.hfs.json(_chunkRCE3CC76js.joinPaths.call(void 0, options.config.workspaceRoot, options.projectRoot, "package.json"));
1984
+ if (!packageJson) {
1985
+ throw new Error("Cannot find package.json configuration file");
1986
+ }
1987
+ packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
1988
+ packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
1989
+ packageJson.exports ??= {};
1990
+ packageJson.exports["./package.json"] ??= "./package.json";
1991
+ packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot);
1992
+ let entryPoints = [
1993
+ {
1994
+ in: "./src/index.ts",
1995
+ out: "./src/index.ts"
1996
+ }
1997
+ ];
1998
+ if (options.entryPoints) {
1999
+ if (Array.isArray(options.entryPoints)) {
2000
+ entryPoints = options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
2001
+ in: entryPoint,
2002
+ out: entryPoint
2003
+ } : entryPoint);
2004
+ }
2005
+ for (const entryPoint of entryPoints) {
2006
+ const split = entryPoint.out.split(".");
2007
+ split.pop();
2008
+ const entry = split.join(".").replaceAll("\\", "/");
2009
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, options.sourceRoot);
2010
+ }
2011
+ }
2012
+ packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
2013
+ packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
2014
+ packageJson.types = "./dist/index.d.ts";
2015
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
2016
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
2017
+ ret[key.replace("/index", "")] = packageJson.exports[key];
2018
+ }
2019
+ return ret;
2020
+ }, packageJson.exports);
2021
+ await _devkit.writeJsonFile.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, options.outdir, "package.json"), packageJson);
2022
+ stopwatch();
2023
+ }
2024
+ return options;
2025
+ }
2026
+ _chunkJ5SB6L2Ljs.__name.call(void 0, generatePackageJson2, "generatePackageJson");
2027
+ async function executeTSDown(options) {
2028
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F680} Running ${options.name} build`, options.config);
2029
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${options.name} build`);
2030
+ await _tsdown.build.call(void 0, {
2031
+ ...options,
2032
+ entry: options.entryPoints,
2033
+ outDir: options.outdir,
2034
+ config: false
2035
+ });
2036
+ stopwatch();
2037
+ return options;
2038
+ }
2039
+ _chunkJ5SB6L2Ljs.__name.call(void 0, executeTSDown, "executeTSDown");
2040
+ async function copyBuildAssets2(options) {
2041
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
2042
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${options.name} asset copy`);
2043
+ await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outdir, options.projectRoot, options.projectName, options.sourceRoot, true, false);
2044
+ stopwatch();
2045
+ return options;
2046
+ }
2047
+ _chunkJ5SB6L2Ljs.__name.call(void 0, copyBuildAssets2, "copyBuildAssets");
2048
+ async function reportResults2(options) {
2049
+ _chunkRCE3CC76js.writeSuccess.call(void 0, ` \u{1F4E6} The ${options.name} build completed successfully`, options.config);
2050
+ }
2051
+ _chunkJ5SB6L2Ljs.__name.call(void 0, reportResults2, "reportResults");
2052
+ async function cleanOutputPath2(options) {
2053
+ if (options.clean !== false && options.outdir) {
2054
+ await clean2(options.name, options.outdir, options.config);
2055
+ }
2056
+ return options;
2057
+ }
2058
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cleanOutputPath2, "cleanOutputPath");
2059
+ async function build4(options) {
2060
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u26A1 Executing Storm TSDown pipeline`);
2061
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "TSDown pipeline");
2062
+ try {
2063
+ const opts = Array.isArray(options) ? options : [
2064
+ options
2065
+ ];
2066
+ if (opts.length === 0) {
2067
+ throw new Error("No build options were provided");
2068
+ }
2069
+ const resolved = await Promise.all(opts.map(async (opt) => await resolveOptions2(opt)));
2070
+ if (resolved.length > 0) {
2071
+ await cleanOutputPath2(resolved[0]);
2072
+ await generatePackageJson2(resolved[0]);
2073
+ await Promise.all(resolved.map(async (opt) => {
2074
+ await executeTSDown(opt);
2075
+ await copyBuildAssets2(opt);
2076
+ await reportResults2(opt);
2077
+ }));
2078
+ } else {
2079
+ _chunkRCE3CC76js.writeWarning.call(void 0, " \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function.");
2080
+ }
2081
+ _chunkRCE3CC76js.writeSuccess.call(void 0, " \u{1F3C1} TSDown pipeline build completed successfully");
2082
+ } catch (error) {
2083
+ _chunkRCE3CC76js.writeFatal.call(void 0, " \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
2084
+ throw error;
2085
+ } finally {
2086
+ stopwatch();
2087
+ }
2088
+ }
2089
+ _chunkJ5SB6L2Ljs.__name.call(void 0, build4, "build");
2090
+
2091
+ // ../workspace-tools/src/executors/tsdown/executor.ts
2092
+ async function tsdownExecutorFn(options, context2, config) {
2093
+ _chunkRCE3CC76js.writeInfo.call(void 0, "\u{1F4E6} Running Storm TSDown build executor on the workspace", config);
2094
+ if (!_optionalChain([context2, 'access', _116 => _116.projectsConfigurations, 'optionalAccess', _117 => _117.projects]) || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !_optionalChain([context2, 'access', _118 => _118.projectsConfigurations, 'access', _119 => _119.projects, 'access', _120 => _120[context2.projectName], 'optionalAccess', _121 => _121.root])) {
2095
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
2096
+ }
2097
+ await build4({
2098
+ ...options,
2099
+ projectRoot: _optionalChain([context2, 'access', _122 => _122.projectsConfigurations, 'access', _123 => _123.projects, 'optionalAccess', _124 => _124[context2.projectName], 'access', _125 => _125.root]),
2100
+ projectName: context2.projectName,
2101
+ sourceRoot: _optionalChain([context2, 'access', _126 => _126.projectsConfigurations, 'access', _127 => _127.projects, 'optionalAccess', _128 => _128[context2.projectName], 'optionalAccess', _129 => _129.sourceRoot]),
2102
+ format: options.format,
2103
+ platform: options.platform
2104
+ });
2105
+ return {
2106
+ success: true
2107
+ };
2108
+ }
2109
+ _chunkJ5SB6L2Ljs.__name.call(void 0, tsdownExecutorFn, "tsdownExecutorFn");
2110
+ var executor_default8 = withRunExecutor("Storm TSDown build executor", tsdownExecutorFn, {
2111
+ skipReadingConfig: false,
2112
+ hooks: {
2113
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (options, config) => {
2114
+ options.entry ??= [
2115
+ "src/index.ts"
2116
+ ];
2117
+ options.outputPath ??= "dist/{projectRoot}";
2118
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
2119
+ return options;
2120
+ }, "applyDefaultOptions")
2121
+ }
2122
+ });
2123
+
2124
+ // ../workspace-tools/src/executors/typia/executor.ts
2125
+ var _fsextra = require('fs-extra');
2126
+ var _TypiaProgrammerjs = require('typia/lib/programmers/TypiaProgrammer.js');
2127
+ async function typiaExecutorFn(options, _, config) {
2128
+ if (options.clean !== false) {
2129
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u{1F9F9} Cleaning output path: ${options.outputPath}`, config);
2130
+ _fsextra.removeSync.call(void 0, options.outputPath);
2131
+ }
2132
+ await Promise.all(options.entry.map((entry) => {
2133
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u{1F680} Running Typia on entry: ${entry}`, config);
2134
+ return _TypiaProgrammerjs.TypiaProgrammer.build({
2135
+ input: entry,
2136
+ output: options.outputPath,
2137
+ project: options.tsconfig
2138
+ });
2139
+ }));
2140
+ return {
2141
+ success: true
2142
+ };
2143
+ }
2144
+ _chunkJ5SB6L2Ljs.__name.call(void 0, typiaExecutorFn, "typiaExecutorFn");
2145
+ var executor_default9 = withRunExecutor("Typia runtime validation generator", typiaExecutorFn, {
2146
+ skipReadingConfig: false,
2147
+ hooks: {
2148
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
2149
+ options.entry ??= [
2150
+ "{sourceRoot}/index.ts"
2151
+ ];
2152
+ options.outputPath ??= "{sourceRoot}/__generated__/typia";
2153
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
2154
+ options.clean ??= true;
2155
+ return options;
2156
+ }, "applyDefaultOptions")
2157
+ }
2158
+ });
2159
+
2160
+ // ../unbuild/src/build.ts
2161
+
2162
+
2163
+
2164
+
2165
+
2166
+
2167
+
2168
+ var _unbuild = require('unbuild');
2169
+
2170
+ // ../unbuild/src/clean.ts
2171
+
2172
+ async function clean3(name = "Unbuild", directory, config) {
2173
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2174
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${name} output clean`);
2175
+ await _node.hfs.deleteAll(directory);
2176
+ stopwatch();
2177
+ }
2178
+ _chunkJ5SB6L2Ljs.__name.call(void 0, clean3, "clean");
2179
+
2180
+ // ../unbuild/src/plugins/analyze.ts
2181
+ var formatBytes = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (bytes) => {
2182
+ if (bytes === 0) return "0 Byte";
2183
+ const k = 1e3;
2184
+ const dm = 3;
2185
+ const sizes = [
2186
+ "Bytes",
2187
+ "KB",
2188
+ "MB",
2189
+ "GB"
2190
+ ];
2191
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
2192
+ return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
2193
+ }, "formatBytes");
2194
+ var analyzePlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => {
2195
+ return {
2196
+ name: "storm:analyzer",
2197
+ renderChunk(source, chunk) {
2198
+ const sourceBytes = formatBytes(source.length);
2199
+ const fileName = chunk.fileName;
2200
+ _chunkRCE3CC76js.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
2201
+ }
2202
+ };
2203
+ }, "analyzePlugin");
2204
+
2205
+ // ../unbuild/src/plugins/on-error.ts
2206
+ var onErrorPlugin2 = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
2207
+ name: "storm:on-error",
2208
+ buildEnd(error) {
2209
+ if (error) {
2210
+ _chunkRCE3CC76js.writeError.call(void 0, `The following errors occurred during the build:
2211
+ ${error ? error.message : "Unknown build error"}
2212
+
2213
+ `, resolvedOptions.config);
2214
+ throw new Error("Storm unbuild process failed with errors.");
2215
+ }
2216
+ },
2217
+ renderError(error) {
2218
+ _chunkRCE3CC76js.writeError.call(void 0, `The following errors occurred during the build:
2219
+ ${error ? error.message : "Unknown build error"}
2220
+
2221
+ `, resolvedOptions.config);
2222
+ throw new Error("Storm unbuild process failed with errors.");
2223
+ }
2224
+ }), "onErrorPlugin");
2225
+
2226
+ // ../unbuild/src/plugins/swc.ts
2227
+ var swcPlugin = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => {
2228
+ const { transform: transform3 } = _chunkJ5SB6L2Ljs.__require.call(void 0, "@swc/core");
2229
+ return {
2230
+ name: "storm:swc",
2231
+ transform(code, filename) {
2232
+ return transform3(code, {
2233
+ filename,
2234
+ jsc: {
2235
+ transform: {
2236
+ react: {
2237
+ runtime: "automatic"
2238
+ }
2239
+ }
2240
+ }
2241
+ });
2242
+ }
2243
+ };
2244
+ }, "swcPlugin");
2245
+
2246
+ // ../unbuild/src/plugins/tsc.ts
2247
+
2248
+
2249
+ var _compilerhelperdependency = require('@nx/js/src/utils/compiler-helper-dependency');
2250
+ var _rollupplugintypescript2 = require('rollup-plugin-typescript2'); var _rollupplugintypescript22 = _interopRequireDefault(_rollupplugintypescript2);
2251
+
2252
+ // ../unbuild/src/utilities/helpers.ts
2253
+
2254
+
2255
+
2256
+ var _url = require('url');
2257
+ var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
2258
+ async function loadConfig(configPath) {
2259
+ if (!/\.(js|mjs)$/.test(_path.extname.call(void 0, configPath))) {
2260
+ throw new Error("Unsupported config file format");
2261
+ }
2262
+ return Promise.resolve().then(() => _interopRequireWildcard(require(_url.pathToFileURL.call(void 0, configPath).toString()))).then((config) => config.default);
2263
+ }
2264
+ _chunkJ5SB6L2Ljs.__name.call(void 0, loadConfig, "loadConfig");
2265
+ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
2266
+ const tsConfigFile = _typescript2.default.readConfigFile(_devkit.joinPathFragments.call(void 0, config.workspaceRoot, projectRoot, tsConfigPath), _typescript2.default.sys.readFile);
2267
+ const tsConfig = _typescript2.default.parseJsonConfigFileContent(tsConfigFile.config, _typescript2.default.sys, _path.dirname.call(void 0, _devkit.joinPathFragments.call(void 0, config.workspaceRoot, projectRoot, tsConfigPath)));
2268
+ const compilerOptions = {
2269
+ rootDir: projectRoot,
2270
+ declaration: true,
2271
+ paths: _buildablelibsutils.computeCompilerOptionsPaths.call(void 0, tsConfig, _nullishCoalesce(dependencies, () => ( [])))
2272
+ };
2273
+ _chunkRCE3CC76js.writeTrace.call(void 0, compilerOptions, config);
2274
+ return compilerOptions;
2275
+ }
2276
+ _chunkJ5SB6L2Ljs.__name.call(void 0, createTsCompilerOptions, "createTsCompilerOptions");
2277
+
2278
+ // ../unbuild/src/plugins/tsc.ts
2279
+ var tscPlugin2 = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (options, resolvedOptions) => {
2280
+ const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
2281
+ exitOnError: true
2282
+ });
2283
+ const result = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
2284
+ let dependencies = result.dependencies;
2285
+ const tsLibDependency = _compilerhelperdependency.getHelperDependency.call(void 0, _compilerhelperdependency.HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
2286
+ if (tsLibDependency) {
2287
+ dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
2288
+ dependencies.push(tsLibDependency);
2289
+ }
2290
+ return _rollupplugintypescript22.default.call(void 0, {
2291
+ check: options.emitTypes !== false,
2292
+ tsconfig: resolvedOptions.tsconfig,
2293
+ tsconfigOverride: {
2294
+ compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
2295
+ }
2296
+ });
2297
+ }, "tscPlugin");
2298
+
2299
+ // ../unbuild/src/plugins/type-definitions.ts
2300
+
2301
+ var typeDefinitions = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options, resolvedOptions) => ({
2302
+ name: "storm:dts-bundle",
2303
+ async generateBundle(_opts, bundle) {
2304
+ for (const file of Object.values(bundle)) {
2305
+ if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
2306
+ continue;
2307
+ }
2308
+ const hasDefaultExport = file.exports.includes("default");
2309
+ const entrySourceFileName = _path.relative.call(void 0, options.projectRoot, file.facadeModuleId);
2310
+ const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
2311
+ const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
2312
+ const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
2313
+ const dtsFileSource = hasDefaultExport ? `
2314
+ export * from ${relativeSourceDtsName};
2315
+ export { default } from ${relativeSourceDtsName};
2316
+ ` : `export * from ${relativeSourceDtsName};
2317
+ `;
2318
+ this.emitFile({
2319
+ type: "asset",
2320
+ fileName: dtsFileName,
2321
+ source: dtsFileSource
2322
+ });
2323
+ }
2324
+ }
2325
+ }), "typeDefinitions");
2326
+
2327
+ // ../unbuild/src/config.ts
2328
+ var getDefaultBuildPlugins2 = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (options, resolvedOptions) => Promise.all([
2329
+ analyzePlugin(options, resolvedOptions),
2330
+ swcPlugin(options, resolvedOptions),
2331
+ typeDefinitions(options, resolvedOptions),
2332
+ tscPlugin2(options, resolvedOptions),
2333
+ onErrorPlugin2(options, resolvedOptions)
2334
+ ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
2335
+
2336
+ // ../unbuild/src/build.ts
2337
+ async function resolveOptions3(options) {
2338
+ const projectRoot = options.projectRoot;
2339
+ if (!projectRoot) {
2340
+ throw new Error("Cannot find project root");
2341
+ }
2342
+ const outputPath = options.outputPath || _chunkRCE3CC76js.joinPaths.call(void 0, "dist", projectRoot);
2343
+ const workspaceRoot3 = _findworkspaceroot.findWorkspaceRoot.call(void 0, projectRoot);
2344
+ if (!workspaceRoot3) {
2345
+ throw new Error("Cannot find workspace root");
2346
+ }
2347
+ const config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, workspaceRoot3.dir);
2348
+ _chunkRCE3CC76js.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
2349
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Build options resolution");
2350
+ if (options.configPath) {
2351
+ const configFile = await loadConfig(options.configPath);
2352
+ if (configFile) {
2353
+ options = _defu2.default.call(void 0, options, configFile);
2354
+ }
2355
+ }
2356
+ const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
2357
+ exitOnError: true
2358
+ });
2359
+ const projectJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, projectRoot, "project.json");
2360
+ if (!await _node.hfs.isFile(projectJsonPath)) {
2361
+ throw new Error("Cannot find project.json configuration");
2362
+ }
2363
+ const projectJson = await _node.hfs.json(projectJsonPath);
2364
+ const projectName = projectJson.name;
2365
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3.dir, projectRoot, "package.json");
2366
+ if (!await _node.hfs.isFile(packageJsonPath)) {
2367
+ throw new Error("Cannot find package.json configuration");
2368
+ }
2369
+ const packageJson = await _node.hfs.json(packageJsonPath);
2370
+ let tsconfig = options.tsconfig;
2371
+ if (!tsconfig) {
2372
+ tsconfig = _chunkRCE3CC76js.joinPaths.call(void 0, workspaceRoot3.dir, projectRoot, "tsconfig.json");
2373
+ }
2374
+ if (!await _node.hfs.isFile(tsconfig)) {
2375
+ throw new Error("Cannot find tsconfig.json configuration");
2376
+ }
2377
+ let sourceRoot = projectJson.sourceRoot;
2378
+ if (!sourceRoot) {
2379
+ sourceRoot = _chunkRCE3CC76js.joinPaths.call(void 0, projectRoot, "src");
2380
+ }
2381
+ if (!await _node.hfs.isDirectory(sourceRoot)) {
2382
+ throw new Error("Cannot find sourceRoot directory");
2383
+ }
2384
+ const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
2385
+ if (!_optionalChain([projectConfigurations, 'optionalAccess', _130 => _130.projects, 'optionalAccess', _131 => _131[projectName]])) {
2386
+ 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.");
2387
+ }
2388
+ const result = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, workspaceRoot3.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
2389
+ let dependencies = result.dependencies;
2390
+ const tsLibDependency = _js.getHelperDependency.call(void 0, _js.HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
2391
+ if (tsLibDependency) {
2392
+ dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
2393
+ dependencies.push(tsLibDependency);
2394
+ }
2395
+ const resolvedOptions = {
2396
+ name: projectName,
2397
+ config,
2398
+ projectRoot,
2399
+ sourceRoot,
2400
+ projectName,
2401
+ tsconfig,
2402
+ clean: false,
2403
+ entries: [
2404
+ {
2405
+ builder: "mkdist",
2406
+ input: `.${sourceRoot.replace(projectRoot, "")}`,
2407
+ outDir: _chunkRCE3CC76js.joinPaths.call(void 0, _path.relative.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
2408
+ declaration: options.emitTypes !== false,
2409
+ format: "esm"
2410
+ },
2411
+ {
2412
+ builder: "mkdist",
2413
+ input: `.${sourceRoot.replace(projectRoot, "")}`,
2414
+ outDir: _chunkRCE3CC76js.joinPaths.call(void 0, _path.relative.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, config.workspaceRoot, projectRoot), config.workspaceRoot).replaceAll("\\", "/"), outputPath, "dist").replaceAll("\\", "/"),
2415
+ declaration: options.emitTypes !== false,
2416
+ format: "cjs",
2417
+ ext: "cjs"
2418
+ }
2419
+ ],
2420
+ declaration: options.emitTypes !== false ? "compatible" : false,
2421
+ failOnWarn: false,
2422
+ sourcemap: _nullishCoalesce(options.sourcemap, () => ( !!options.debug)),
2423
+ outDir: outputPath,
2424
+ parallel: true,
2425
+ stub: false,
2426
+ stubOptions: {
2427
+ jiti: {}
2428
+ },
2429
+ externals: _nullishCoalesce(options.external, () => ( [])),
2430
+ dependencies: [],
2431
+ peerDependencies: [],
2432
+ devDependencies: [],
2433
+ hooks: {},
2434
+ alias: {},
2435
+ replace: {},
2436
+ rollup: {
2437
+ replace: {},
2438
+ alias: {},
2439
+ json: {},
2440
+ commonjs: {
2441
+ sourceMap: _nullishCoalesce(options.sourcemap, () => ( true))
2442
+ },
2443
+ emitCJS: true,
2444
+ cjsBridge: true,
2445
+ dts: {
2446
+ respectExternal: true,
2447
+ tsconfig
2448
+ },
2449
+ output: {
2450
+ banner: options.banner || `
2451
+ // \u26A1 Built by Storm Software
2452
+ `,
2453
+ footer: options.footer
2454
+ },
2455
+ resolve: {
2456
+ preferBuiltins: true,
2457
+ extensions: [
2458
+ ".cjs",
2459
+ ".mjs",
2460
+ ".js",
2461
+ ".jsx",
2462
+ ".ts",
2463
+ ".tsx",
2464
+ ".json"
2465
+ ]
2466
+ },
2467
+ esbuild: {
2468
+ minify: !!options.minify,
2469
+ splitting: options.splitting !== false,
2470
+ treeShaking: options.treeShaking !== false,
2471
+ color: true,
2472
+ logLevel: config.logLevel === _chunkRCE3CC76js.LogLevelLabel.FATAL ? _chunkRCE3CC76js.LogLevelLabel.ERROR : _chunkRCE3CC76js.isVerbose.call(void 0, ) ? "verbose" : config.logLevel
2473
+ }
2474
+ }
2475
+ };
2476
+ dependencies = dependencies.filter((dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app");
2477
+ if (dependencies.length > 0) {
2478
+ resolvedOptions.dependencies = dependencies.map((dep) => dep.name);
2479
+ }
2480
+ if (packageJson.devDependencies) {
2481
+ resolvedOptions.devDependencies = Object.keys(packageJson.devDependencies);
2482
+ }
2483
+ if (packageJson.peerDependencies) {
2484
+ resolvedOptions.peerDependencies = Object.keys(packageJson.peerDependencies);
2485
+ }
2486
+ if (options.rollup) {
2487
+ let rollup = {};
2488
+ if (typeof options.rollup === "string") {
2489
+ const rollupFile = await loadConfig(options.rollup);
2490
+ if (rollupFile) {
2491
+ rollup = rollupFile;
2492
+ }
2493
+ } else {
2494
+ rollup = options.rollup;
2495
+ }
2496
+ resolvedOptions.rollup = _defu2.default.call(void 0, _nullishCoalesce(resolvedOptions.rollup, () => ( {})), rollup);
2497
+ }
2498
+ resolvedOptions.hooks = {
2499
+ "rollup:options": /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (ctx, opts) => {
2500
+ opts.plugins = await _asyncNullishCoalesce(options.plugins, async () => ( await getDefaultBuildPlugins2(options, resolvedOptions)));
2501
+ }, "rollup:options")
2502
+ };
2503
+ stopwatch();
2504
+ return resolvedOptions;
2505
+ }
2506
+ _chunkJ5SB6L2Ljs.__name.call(void 0, resolveOptions3, "resolveOptions");
2507
+ async function generatePackageJson3(options) {
2508
+ if (options.generatePackageJson !== false && await _node.hfs.isFile(_chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "package.json"))) {
2509
+ _chunkRCE3CC76js.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", options.config);
2510
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Write package.json file");
2511
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "project.json");
2512
+ if (!await _node.hfs.isFile(packageJsonPath)) {
2513
+ throw new Error("Cannot find package.json configuration");
2514
+ }
2515
+ let packageJson = await _node.hfs.json(_chunkRCE3CC76js.joinPaths.call(void 0, options.config.workspaceRoot, options.projectRoot, "package.json"));
2516
+ if (!packageJson) {
2517
+ throw new Error("Cannot find package.json configuration file");
2518
+ }
2519
+ packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
2520
+ packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
2521
+ packageJson = await addPackageJsonExports(options.sourceRoot, packageJson);
2522
+ await _devkit.writeJsonFile.call(void 0, _chunkRCE3CC76js.joinPaths.call(void 0, options.outDir, "package.json"), packageJson);
2523
+ stopwatch();
2524
+ }
2525
+ return options;
2526
+ }
2527
+ _chunkJ5SB6L2Ljs.__name.call(void 0, generatePackageJson3, "generatePackageJson");
2528
+ async function executeUnbuild(options) {
2529
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
2530
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${options.name} (${options.projectRoot}) build`);
2531
+ try {
2532
+ await _unbuild.build.call(void 0, options.projectRoot, false, {
2533
+ ...options,
2534
+ rootDir: options.projectRoot
2535
+ });
2536
+ } finally {
2537
+ stopwatch();
2538
+ }
2539
+ return options;
2540
+ }
2541
+ _chunkJ5SB6L2Ljs.__name.call(void 0, executeUnbuild, "executeUnbuild");
2542
+ async function copyBuildAssets3(options) {
2543
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
2544
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, `${options.name} asset copy`);
2545
+ await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
2546
+ stopwatch();
2547
+ return options;
2548
+ }
2549
+ _chunkJ5SB6L2Ljs.__name.call(void 0, copyBuildAssets3, "copyBuildAssets");
2550
+ async function cleanOutputPath3(options) {
2551
+ if (options.clean !== false && options.outDir) {
2552
+ await clean3(options.name, options.outDir, options.config);
2553
+ }
2554
+ return options;
2555
+ }
2556
+ _chunkJ5SB6L2Ljs.__name.call(void 0, cleanOutputPath3, "cleanOutputPath");
2557
+ async function build5(options) {
2558
+ _chunkRCE3CC76js.writeDebug.call(void 0, ` \u26A1 Executing Storm Unbuild pipeline`);
2559
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Unbuild pipeline");
2560
+ try {
2561
+ const resolvedOptions = await resolveOptions3(options);
2562
+ await cleanOutputPath3(resolvedOptions);
2563
+ await generatePackageJson3(resolvedOptions);
2564
+ await executeUnbuild(resolvedOptions);
2565
+ await copyBuildAssets3(resolvedOptions);
2566
+ _chunkRCE3CC76js.writeSuccess.call(void 0, ` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, resolvedOptions.config);
2567
+ } catch (error) {
2568
+ _chunkRCE3CC76js.writeFatal.call(void 0, " \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
2569
+ throw error;
2570
+ } finally {
2571
+ stopwatch();
2572
+ }
2573
+ }
2574
+ _chunkJ5SB6L2Ljs.__name.call(void 0, build5, "build");
2575
+
2576
+ // ../workspace-tools/src/executors/unbuild/executor.ts
2577
+
2578
+ async function unbuildExecutorFn(options, context2, config) {
2579
+ _chunkRCE3CC76js.writeInfo.call(void 0, "\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
2580
+ if (!_optionalChain([context2, 'access', _132 => _132.projectsConfigurations, 'optionalAccess', _133 => _133.projects]) || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !_optionalChain([context2, 'access', _134 => _134.projectsConfigurations, 'access', _135 => _135.projects, 'access', _136 => _136[context2.projectName], 'optionalAccess', _137 => _137.root])) {
2581
+ throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
2582
+ }
2583
+ await build5(_defu.defu.call(void 0, {
2584
+ ...options,
2585
+ projectRoot: _optionalChain([context2, 'access', _138 => _138.projectsConfigurations, 'access', _139 => _139.projects, 'optionalAccess', _140 => _140[context2.projectName], 'access', _141 => _141.root]),
2586
+ projectName: context2.projectName,
2587
+ sourceRoot: _optionalChain([context2, 'access', _142 => _142.projectsConfigurations, 'access', _143 => _143.projects, 'optionalAccess', _144 => _144[context2.projectName], 'optionalAccess', _145 => _145.sourceRoot]),
2588
+ platform: options.platform,
2589
+ name: context2.projectName
2590
+ }, {
2591
+ stubOptions: {
2592
+ jiti: {
2593
+ cache: "node_modules/.cache/storm"
2594
+ }
2595
+ },
2596
+ rollup: {
2597
+ emitCJS: true,
2598
+ watch: false,
2599
+ cjsBridge: false,
2600
+ dts: {
2601
+ respectExternal: true
2602
+ },
2603
+ replace: {},
2604
+ alias: {},
2605
+ resolve: {},
2606
+ json: {},
2607
+ commonjs: {},
2608
+ esbuild: {
2609
+ target: options.target,
2610
+ format: "esm",
2611
+ platform: options.platform,
2612
+ minify: options.minify,
2613
+ treeShaking: options.treeShaking
2614
+ }
2615
+ }
2616
+ }));
2617
+ return {
2618
+ success: true
2619
+ };
2620
+ }
2621
+ _chunkJ5SB6L2Ljs.__name.call(void 0, unbuildExecutorFn, "unbuildExecutorFn");
2622
+ var executor_default10 = withRunExecutor("TypeScript Unbuild build", unbuildExecutorFn, {
2623
+ skipReadingConfig: false,
2624
+ hooks: {
2625
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (options, config) => {
2626
+ options.entry ??= [
2627
+ "{sourceRoot}"
2628
+ ];
2629
+ options.outputPath ??= "dist/{projectRoot}";
2630
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
2631
+ return options;
2632
+ }, "applyDefaultOptions")
2633
+ }
2634
+ });
2635
+
2636
+ // ../workspace-tools/src/generators/browser-library/generator.ts
2637
+
2638
+
2639
+ // ../workspace-tools/src/base/base-generator.ts
2640
+ var withRunGenerator = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (name, generatorFn, generatorOptions = {
2641
+ skipReadingConfig: false
2642
+ }) => async (tree, _options) => {
2643
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, name);
2644
+ let options = _options;
2645
+ let config;
2646
+ try {
2647
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u26A1 Running the ${name} generator...
2648
+
2649
+ `, config);
2650
+ const workspaceRoot3 = _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, );
2651
+ if (!generatorOptions.skipReadingConfig) {
2652
+ _chunkRCE3CC76js.writeDebug.call(void 0, `Loading the Storm Config from environment variables and storm.config.js file...
2653
+ - workspaceRoot: ${workspaceRoot3}`, config);
2654
+ config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, workspaceRoot3);
2655
+ }
2656
+ if (_optionalChain([generatorOptions, 'optionalAccess', _146 => _146.hooks, 'optionalAccess', _147 => _147.applyDefaultOptions])) {
2657
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Running the applyDefaultOptions hook...", config);
2658
+ options = await Promise.resolve(generatorOptions.hooks.applyDefaultOptions(options, config));
2659
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Completed the applyDefaultOptions hook", config);
2660
+ }
2661
+ _chunkRCE3CC76js.writeTrace.call(void 0, `Generator schema options \u2699\uFE0F
2662
+ ${Object.keys(_nullishCoalesce(options, () => ( {}))).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`, config);
2663
+ const tokenized = await applyWorkspaceTokens(options, {
2664
+ workspaceRoot: tree.root,
2665
+ config
2666
+ }, applyWorkspaceBaseTokens);
2667
+ if (_optionalChain([generatorOptions, 'optionalAccess', _148 => _148.hooks, 'optionalAccess', _149 => _149.preProcess])) {
2668
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Running the preProcess hook...", config);
2669
+ await Promise.resolve(generatorOptions.hooks.preProcess(tokenized, config));
2670
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Completed the preProcess hook", config);
2671
+ }
2672
+ const result = await Promise.resolve(generatorFn(tree, tokenized, config));
2673
+ if (result) {
2674
+ if (result.success === false || result.error && _optionalChain([result, 'optionalAccess', _150 => _150.error, 'optionalAccess', _151 => _151.message]) && typeof _optionalChain([result, 'optionalAccess', _152 => _152.error, 'optionalAccess', _153 => _153.message]) === "string" && _optionalChain([result, 'optionalAccess', _154 => _154.error, 'optionalAccess', _155 => _155.name]) && typeof _optionalChain([result, 'optionalAccess', _156 => _156.error, 'optionalAccess', _157 => _157.name]) === "string") {
2675
+ throw new Error(`The ${name} generator failed to run`, {
2676
+ cause: _optionalChain([result, 'optionalAccess', _158 => _158.error])
2677
+ });
2678
+ } else if (result.success && result.data) {
2679
+ return result;
2680
+ }
2681
+ }
2682
+ if (_optionalChain([generatorOptions, 'optionalAccess', _159 => _159.hooks, 'optionalAccess', _160 => _160.postProcess])) {
2683
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Running the postProcess hook...", config);
2684
+ await Promise.resolve(generatorOptions.hooks.postProcess(config));
2685
+ _chunkRCE3CC76js.writeDebug.call(void 0, "Completed the postProcess hook", config);
2686
+ }
2687
+ return () => {
2688
+ _chunkRCE3CC76js.writeSuccess.call(void 0, `Completed running the ${name} generator!
2689
+ `, config);
2690
+ };
2691
+ } catch (error) {
2692
+ return () => {
2693
+ _chunkRCE3CC76js.writeFatal.call(void 0, "A fatal error occurred while running the generator - the process was forced to terminate", config);
2694
+ _chunkRCE3CC76js.writeError.call(void 0, `An exception was thrown in the generator's process
2695
+ - Details: ${error.message}
2696
+ - Stacktrace: ${error.stack}`, config);
2697
+ };
2698
+ } finally {
2699
+ stopwatch();
2700
+ }
2701
+ }, "withRunGenerator");
2702
+
2703
+ // ../workspace-tools/src/base/typescript-library-generator.ts
2704
+
2705
+ var _projectnameandrootutils = require('@nx/devkit/src/generators/project-name-and-root-utils');
2706
+
2707
+ var _init = require('@nx/js/src/generators/init/init'); var _init2 = _interopRequireDefault(_init);
2708
+ var _generator = require('@nx/js/src/generators/setup-verdaccio/generator'); var _generator2 = _interopRequireDefault(_generator);
2709
+
2710
+ // ../workspace-tools/src/utils/versions.ts
2711
+ var typesNodeVersion = "20.9.0";
2712
+ var nxVersion = "^18.0.4";
2713
+ var nodeVersion = "20.11.0";
2714
+ var pnpmVersion = "8.10.2";
2715
+
2716
+ // ../workspace-tools/src/base/typescript-library-generator.ts
2717
+ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
2718
+ const options = await normalizeOptions(tree, {
2719
+ ...schema
2720
+ });
2721
+ const tasks = [];
2722
+ tasks.push(await _init2.default.call(void 0, tree, {
2723
+ ...options,
2724
+ tsConfigName: options.rootProject ? "tsconfig.json" : "tsconfig.base.json"
2725
+ }));
2726
+ tasks.push(_devkit.addDependenciesToPackageJson.call(void 0, tree, {}, {
2727
+ "@storm-software/workspace-tools": "latest",
2728
+ "@storm-software/testing-tools": "latest",
2729
+ ..._nullishCoalesce(schema.devDependencies, () => ( {}))
2730
+ }));
2731
+ if (options.publishable) {
2732
+ tasks.push(await _generator2.default.call(void 0, tree, {
2733
+ ...options,
2734
+ skipFormat: true
2735
+ }));
2736
+ }
2737
+ const projectConfig = {
2738
+ root: options.directory,
2739
+ projectType: "library",
2740
+ sourceRoot: _chunkRCE3CC76js.joinPaths.call(void 0, _nullishCoalesce(options.directory, () => ( "")), "src"),
2741
+ targets: {
2742
+ build: {
2743
+ executor: schema.buildExecutor,
2744
+ outputs: [
2745
+ "{options.outputPath}"
2746
+ ],
2747
+ options: {
2748
+ entry: [
2749
+ _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "src", "index.ts")
2750
+ ],
2751
+ outputPath: getOutputPath(options),
2752
+ tsconfig: _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "tsconfig.json"),
2753
+ project: _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "package.json"),
2754
+ defaultConfiguration: "production",
2755
+ platform: "neutral",
2756
+ assets: [
2757
+ {
2758
+ input: options.projectRoot,
2759
+ glob: "*.md",
2760
+ output: "/"
2761
+ },
2762
+ {
2763
+ input: "",
2764
+ glob: "LICENSE",
2765
+ output: "/"
2766
+ }
2767
+ ]
2768
+ },
2769
+ configurations: {
2770
+ production: {
2771
+ debug: false,
2772
+ verbose: false
2773
+ },
2774
+ development: {
2775
+ debug: true,
2776
+ verbose: true
2777
+ }
2778
+ }
2779
+ }
2780
+ }
2781
+ };
2782
+ if (schema.platform) {
2783
+ projectConfig.targets.build.options.platform = schema.platform === "worker" ? "node" : schema.platform;
2784
+ }
2785
+ _chunkVTHBMY4Bjs.addProjectTag.call(void 0, projectConfig, _chunkVTHBMY4Bjs.ProjectTagConstants.Platform.TAG_ID, schema.platform === "node" ? _chunkVTHBMY4Bjs.ProjectTagConstants.Platform.NODE : schema.platform === "worker" ? _chunkVTHBMY4Bjs.ProjectTagConstants.Platform.WORKER : schema.platform === "browser" ? _chunkVTHBMY4Bjs.ProjectTagConstants.Platform.BROWSER : _chunkVTHBMY4Bjs.ProjectTagConstants.Platform.NEUTRAL, {
2786
+ overwrite: false
2787
+ });
2788
+ createProjectTsConfigJson(tree, options);
2789
+ _devkit.addProjectConfiguration.call(void 0, tree, options.name, projectConfig);
2790
+ let repository = {
2791
+ type: "github",
2792
+ url: _optionalChain([config, 'optionalAccess', _161 => _161.repository]) || `https://github.com/${_optionalChain([config, 'optionalAccess', _162 => _162.organization]) || "storm-software"}/${_optionalChain([config, 'optionalAccess', _163 => _163.namespace]) || _optionalChain([config, 'optionalAccess', _164 => _164.name]) || "repository"}.git`
2793
+ };
2794
+ let description = schema.description || "A package developed by Storm Software used to create modern, scalable web applications.";
2795
+ if (tree.exists("package.json")) {
2796
+ const packageJson = _devkit.readJson.call(void 0, tree, "package.json");
2797
+ if (_optionalChain([packageJson, 'optionalAccess', _165 => _165.repository])) {
2798
+ repository = packageJson.repository;
2799
+ }
2800
+ if (_optionalChain([packageJson, 'optionalAccess', _166 => _166.description])) {
2801
+ description = packageJson.description;
2802
+ }
2803
+ }
2804
+ if (!options.importPath) {
2805
+ options.importPath = options.name;
2806
+ }
2807
+ const packageJsonPath = _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "package.json");
2808
+ if (tree.exists(packageJsonPath)) {
2809
+ _devkit.updateJson.call(void 0, tree, packageJsonPath, (json) => {
2810
+ if (!options.importPath) {
2811
+ options.importPath = options.name;
2812
+ }
2813
+ json.name = options.importPath;
2814
+ json.version = "0.0.1";
2815
+ if (json.private && (options.publishable || options.rootProject)) {
2816
+ json.private = void 0;
2817
+ }
2818
+ return {
2819
+ ...json,
2820
+ version: "0.0.1",
2821
+ description,
2822
+ repository: {
2823
+ ...repository,
2824
+ directory: options.projectRoot
2825
+ },
2826
+ type: "module",
2827
+ dependencies: {
2828
+ ...json.dependencies
2829
+ },
2830
+ publishConfig: {
2831
+ access: "public"
2832
+ }
2833
+ };
2834
+ });
2835
+ } else {
2836
+ _devkit.writeJson.call(void 0, tree, packageJsonPath, {
2837
+ name: options.importPath,
2838
+ version: "0.0.1",
2839
+ description,
2840
+ repository: {
2841
+ ...repository,
2842
+ directory: options.projectRoot
2843
+ },
2844
+ private: !options.publishable || options.rootProject,
2845
+ type: "module",
2846
+ publishConfig: {
2847
+ access: "public"
2848
+ }
2849
+ });
2850
+ }
2851
+ if (tree.exists("package.json") && options.importPath) {
2852
+ _devkit.updateJson.call(void 0, tree, "package.json", (json) => ({
2853
+ ...json,
2854
+ pnpm: {
2855
+ ..._optionalChain([json, 'optionalAccess', _167 => _167.pnpm]),
2856
+ overrides: {
2857
+ ..._optionalChain([json, 'optionalAccess', _168 => _168.pnpm, 'optionalAccess', _169 => _169.overrides]),
2858
+ [_nullishCoalesce(options.importPath, () => ( ""))]: "workspace:*"
2859
+ }
2860
+ }
2861
+ }));
2862
+ }
2863
+ _js.addTsConfigPath.call(void 0, tree, options.importPath, [
2864
+ _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "./src", `index.${options.js ? "js" : "ts"}`)
2865
+ ]);
2866
+ _js.addTsConfigPath.call(void 0, tree, _chunkRCE3CC76js.joinPaths.call(void 0, options.importPath, "/*"), [
2867
+ _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "./src", "/*")
2868
+ ]);
2869
+ if (tree.exists("package.json")) {
2870
+ const packageJson = _devkit.readJson.call(void 0, tree, "package.json");
2871
+ if (_optionalChain([packageJson, 'optionalAccess', _170 => _170.repository])) {
2872
+ repository = packageJson.repository;
2873
+ }
2874
+ if (_optionalChain([packageJson, 'optionalAccess', _171 => _171.description])) {
2875
+ description = packageJson.description;
2876
+ }
2877
+ }
2878
+ const tsconfigPath = _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "tsconfig.json");
2879
+ if (tree.exists(tsconfigPath)) {
2880
+ _devkit.updateJson.call(void 0, tree, tsconfigPath, (json) => {
2881
+ json.composite ??= true;
2882
+ return json;
2883
+ });
2884
+ } else {
2885
+ _devkit.writeJson.call(void 0, tree, tsconfigPath, {
2886
+ extends: `${_devkit.offsetFromRoot.call(void 0, options.projectRoot)}tsconfig.base.json`,
2887
+ composite: true,
2888
+ compilerOptions: {
2889
+ outDir: `${_devkit.offsetFromRoot.call(void 0, options.projectRoot)}dist/out-tsc`
2890
+ },
2891
+ files: [],
2892
+ include: [
2893
+ "src/**/*.ts",
2894
+ "src/**/*.js"
2895
+ ],
2896
+ exclude: [
2897
+ "jest.config.ts",
2898
+ "src/**/*.spec.ts",
2899
+ "src/**/*.test.ts"
2900
+ ]
2901
+ });
2902
+ }
2903
+ await _devkit.formatFiles.call(void 0, tree);
2904
+ return null;
2905
+ }
2906
+ _chunkJ5SB6L2Ljs.__name.call(void 0, typeScriptLibraryGeneratorFn, "typeScriptLibraryGeneratorFn");
2907
+ function getOutputPath(options) {
2908
+ const parts = [
2909
+ "dist"
2910
+ ];
2911
+ if (options.projectRoot === ".") {
2912
+ parts.push(options.name);
2913
+ } else {
2914
+ parts.push(options.projectRoot);
2915
+ }
2916
+ return _chunkRCE3CC76js.joinPaths.call(void 0, ...parts);
2917
+ }
2918
+ _chunkJ5SB6L2Ljs.__name.call(void 0, getOutputPath, "getOutputPath");
2919
+ function createProjectTsConfigJson(tree, options) {
2920
+ const tsconfig = {
2921
+ extends: options.rootProject ? void 0 : _js.getRelativePathToRootTsConfig.call(void 0, tree, options.projectRoot),
2922
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _172 => _172.tsconfigOptions]), () => ( {})),
2923
+ compilerOptions: {
2924
+ ...options.rootProject ? _js.tsConfigBaseOptions : {},
2925
+ outDir: _chunkRCE3CC76js.joinPaths.call(void 0, _devkit.offsetFromRoot.call(void 0, options.projectRoot), "dist/out-tsc"),
2926
+ noEmit: true,
2927
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _173 => _173.tsconfigOptions, 'optionalAccess', _174 => _174.compilerOptions]), () => ( {}))
2928
+ },
2929
+ files: [
2930
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _175 => _175.tsconfigOptions, 'optionalAccess', _176 => _176.files]), () => ( []))
2931
+ ],
2932
+ include: [
2933
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _177 => _177.tsconfigOptions, 'optionalAccess', _178 => _178.include]), () => ( [])),
2934
+ "src/**/*.ts",
2935
+ "src/**/*.js",
2936
+ "bin/**/*"
2937
+ ],
2938
+ exclude: [
2939
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _179 => _179.tsconfigOptions, 'optionalAccess', _180 => _180.exclude]), () => ( [])),
2940
+ "jest.config.ts",
2941
+ "src/**/*.spec.ts",
2942
+ "src/**/*.test.ts"
2943
+ ]
2944
+ };
2945
+ _devkit.writeJson.call(void 0, tree, _chunkRCE3CC76js.joinPaths.call(void 0, options.projectRoot, "tsconfig.json"), tsconfig);
2946
+ }
2947
+ _chunkJ5SB6L2Ljs.__name.call(void 0, createProjectTsConfigJson, "createProjectTsConfigJson");
2948
+ async function normalizeOptions(tree, options) {
2949
+ if (options.publishable) {
2950
+ if (!options.importPath) {
2951
+ throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
2952
+ }
2953
+ }
2954
+ let bundler = "tsc";
2955
+ if (options.publishable === false && options.buildable === false) {
2956
+ bundler = "none";
2957
+ }
2958
+ const { Linter } = _devkit.ensurePackage.call(void 0, "@nx/eslint", nxVersion);
2959
+ const { projectName, names: projectNames, projectRoot, importPath } = await _projectnameandrootutils.determineProjectNameAndRootOptions.call(void 0, tree, {
2960
+ name: options.name,
2961
+ projectType: "library",
2962
+ directory: options.directory,
2963
+ importPath: options.importPath,
2964
+ rootProject: options.rootProject
2965
+ });
2966
+ options.rootProject = projectRoot === ".";
2967
+ const normalized = _devkit.names.call(void 0, projectNames.projectFileName);
2968
+ const fileName = normalized.fileName;
2969
+ return {
2970
+ js: false,
2971
+ pascalCaseFiles: false,
2972
+ skipFormat: false,
2973
+ skipTsConfig: false,
2974
+ includeBabelRc: false,
2975
+ unitTestRunner: "jest",
2976
+ linter: Linter.EsLint,
2977
+ testEnvironment: "node",
2978
+ config: "project",
2979
+ compiler: "tsc",
2980
+ bundler,
2981
+ skipTypeCheck: false,
2982
+ minimal: false,
2983
+ hasPlugin: false,
2984
+ isUsingTsSolutionConfig: false,
2985
+ projectPackageManagerWorkspaceState: "included",
2986
+ ...options,
2987
+ fileName,
2988
+ name: projectName,
2989
+ projectNames,
2990
+ projectRoot,
2991
+ parsedTags: options.tags ? options.tags.split(",").map((s) => s.trim()) : [],
2992
+ importPath
2993
+ };
2994
+ }
2995
+ _chunkJ5SB6L2Ljs.__name.call(void 0, normalizeOptions, "normalizeOptions");
2996
+
2997
+ // ../workspace-tools/src/generators/browser-library/generator.ts
2998
+ async function browserLibraryGeneratorFn(tree, schema, config) {
2999
+ const filesDir = _devkit.joinPathFragments.call(void 0, __dirname, "./files");
3000
+ const tsLibraryGeneratorOptions = {
3001
+ buildExecutor: "@storm-software/workspace-tools:unbuild",
3002
+ platform: "browser",
3003
+ devDependencies: {
3004
+ "@types/react": "^18.3.6",
3005
+ "@types/react-dom": "^18.3.0"
3006
+ },
3007
+ peerDependencies: {
3008
+ react: "^18.3.0",
3009
+ "react-dom": "^18.3.0",
3010
+ "react-native": "*"
3011
+ },
3012
+ peerDependenciesMeta: {
3013
+ "react-dom": {
3014
+ optional: true
3015
+ },
3016
+ "react-native": {
3017
+ optional: true
3018
+ }
3019
+ },
3020
+ ...schema,
3021
+ description: schema.description,
3022
+ directory: schema.directory
3023
+ };
3024
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
3025
+ const { className, name, propertyName } = _devkit.names.call(void 0, options.projectNames.projectFileName);
3026
+ _devkit.generateFiles.call(void 0, tree, filesDir, options.projectRoot, {
3027
+ ...schema,
3028
+ dot: ".",
3029
+ className,
3030
+ name,
3031
+ namespace: _nullishCoalesce(process.env.STORM_NAMESPACE, () => ( "storm-software")),
3032
+ description: _nullishCoalesce(schema.description, () => ( "")),
3033
+ propertyName,
3034
+ js: !!options.js,
3035
+ cliCommand: "nx",
3036
+ strict: void 0,
3037
+ tmpl: "",
3038
+ offsetFromRoot: _devkit.offsetFromRoot.call(void 0, options.projectRoot),
3039
+ buildable: options.bundler && options.bundler !== "none",
3040
+ hasUnitTestRunner: options.unitTestRunner !== "none",
3041
+ tsConfigOptions: {
3042
+ compilerOptions: {
3043
+ jsx: "react",
3044
+ types: [
3045
+ "node",
3046
+ "@nx/react/typings/cssmodule.d.ts",
3047
+ "@nx/react/typings/image.d.ts"
3048
+ ]
3049
+ }
3050
+ }
3051
+ });
3052
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
3053
+ await _devkit.formatFiles.call(void 0, tree);
3054
+ return null;
3055
+ }
3056
+ _chunkJ5SB6L2Ljs.__name.call(void 0, browserLibraryGeneratorFn, "browserLibraryGeneratorFn");
3057
+ var generator_default = withRunGenerator("TypeScript Library Creator (Browser Platform)", browserLibraryGeneratorFn, {
3058
+ hooks: {
3059
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
3060
+ options.description ??= "A library used by Storm Software to support browser applications";
3061
+ options.platform ??= "browser";
3062
+ return options;
3063
+ }, "applyDefaultOptions")
3064
+ }
3065
+ });
3066
+
3067
+ // ../workspace-tools/src/generators/config-schema/generator.ts
3068
+
3069
+ var _zodtojsonschema = require('zod-to-json-schema');
3070
+ async function configSchemaGeneratorFn(tree, options, config) {
3071
+ _chunkRCE3CC76js.writeInfo.call(void 0, "\u{1F4E6} Running Storm Configuration JSON Schema generator", config);
3072
+ _chunkRCE3CC76js.writeTrace.call(void 0, `Determining the Storm Configuration JSON Schema...`, config);
3073
+ const jsonSchema = _zodtojsonschema.zodToJsonSchema.call(void 0, _chunkRCE3CC76js.StormConfigSchema, {
3074
+ name: "StormWorkspaceConfiguration"
3075
+ });
3076
+ _chunkRCE3CC76js.writeTrace.call(void 0, jsonSchema, config);
3077
+ const outputPath = options.outputFile.replaceAll("{workspaceRoot}", "").replaceAll(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _181 => _181.workspaceRoot]), () => ( _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, ))), _optionalChain([options, 'access', _182 => _182.outputFile, 'optionalAccess', _183 => _183.startsWith, 'call', _184 => _184("./")]) ? "" : "./");
3078
+ _chunkRCE3CC76js.writeTrace.call(void 0, `\u{1F4DD} Writing Storm Configuration JSON Schema to "${outputPath}"`, config);
3079
+ _devkit.writeJson.call(void 0, tree, outputPath, jsonSchema, {
3080
+ spaces: 2
3081
+ });
3082
+ await _devkit.formatFiles.call(void 0, tree);
3083
+ _chunkRCE3CC76js.writeSuccess.call(void 0, "\u{1F680} Storm Configuration JSON Schema creation has completed successfully!", config);
3084
+ return {
3085
+ success: true
3086
+ };
3087
+ }
3088
+ _chunkJ5SB6L2Ljs.__name.call(void 0, configSchemaGeneratorFn, "configSchemaGeneratorFn");
3089
+ var generator_default2 = withRunGenerator("Configuration Schema Creator", configSchemaGeneratorFn, {
3090
+ hooks: {
3091
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
3092
+ options.outputFile ??= "{workspaceRoot}/storm-workspace.schema.json";
3093
+ return options;
3094
+ }, "applyDefaultOptions")
3095
+ }
3096
+ });
3097
+
3098
+ // ../workspace-tools/src/generators/init/init.ts
3099
+
3100
+
3101
+ // ../workspace-tools/src/generators/neutral-library/generator.ts
3102
+
3103
+ async function neutralLibraryGeneratorFn(tree, schema, config) {
3104
+ const filesDir = _devkit.joinPathFragments.call(void 0, __dirname, "./files");
3105
+ const tsLibraryGeneratorOptions = {
3106
+ ...schema,
3107
+ platform: "neutral",
3108
+ devDependencies: {},
3109
+ buildExecutor: "@storm-software/workspace-tools:unbuild"
3110
+ };
3111
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
3112
+ const { className, name, propertyName } = _devkit.names.call(void 0, options.projectNames.projectFileName);
3113
+ _devkit.generateFiles.call(void 0, tree, filesDir, options.projectRoot, {
3114
+ ...schema,
3115
+ dot: ".",
3116
+ className,
3117
+ name,
3118
+ namespace: _nullishCoalesce(process.env.STORM_NAMESPACE, () => ( "storm-software")),
3119
+ description: _nullishCoalesce(schema.description, () => ( "")),
3120
+ propertyName,
3121
+ js: !!options.js,
3122
+ cliCommand: "nx",
3123
+ strict: void 0,
3124
+ tmpl: "",
3125
+ offsetFromRoot: _devkit.offsetFromRoot.call(void 0, options.projectRoot),
3126
+ buildable: options.bundler && options.bundler !== "none",
3127
+ hasUnitTestRunner: options.unitTestRunner !== "none"
3128
+ });
3129
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
3130
+ await _devkit.formatFiles.call(void 0, tree);
3131
+ return null;
3132
+ }
3133
+ _chunkJ5SB6L2Ljs.__name.call(void 0, neutralLibraryGeneratorFn, "neutralLibraryGeneratorFn");
3134
+ var generator_default3 = withRunGenerator("TypeScript Library Creator (Neutral Platform)", neutralLibraryGeneratorFn, {
3135
+ hooks: {
3136
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
3137
+ options.description ??= "A library used by Storm Software to support either browser or NodeJs applications";
3138
+ options.platform = "neutral";
3139
+ return options;
3140
+ }, "applyDefaultOptions")
3141
+ }
3142
+ });
3143
+
3144
+ // ../workspace-tools/src/generators/node-library/generator.ts
3145
+
3146
+ async function nodeLibraryGeneratorFn(tree, schema, config) {
3147
+ const filesDir = _devkit.joinPathFragments.call(void 0, __dirname, "./files");
3148
+ const tsLibraryGeneratorOptions = {
3149
+ platform: "node",
3150
+ devDependencies: {
3151
+ "@types/node": typesNodeVersion
3152
+ },
3153
+ buildExecutor: "@storm-software/workspace-tools:unbuild",
3154
+ ...schema,
3155
+ directory: schema.directory,
3156
+ description: schema.description
3157
+ };
3158
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
3159
+ const { className, name, propertyName } = _devkit.names.call(void 0, options.name);
3160
+ _devkit.generateFiles.call(void 0, tree, filesDir, options.projectRoot, {
3161
+ ...schema,
3162
+ dot: ".",
3163
+ className,
3164
+ name,
3165
+ namespace: _nullishCoalesce(process.env.STORM_NAMESPACE, () => ( "storm-software")),
3166
+ description: _nullishCoalesce(schema.description, () => ( "")),
3167
+ propertyName,
3168
+ js: !!options.js,
3169
+ cliCommand: "nx",
3170
+ strict: void 0,
3171
+ tmpl: "",
3172
+ offsetFromRoot: _devkit.offsetFromRoot.call(void 0, options.projectRoot),
3173
+ buildable: options.bundler && options.bundler !== "none",
3174
+ hasUnitTestRunner: options.unitTestRunner !== "none"
3175
+ });
3176
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
3177
+ await _devkit.formatFiles.call(void 0, tree);
3178
+ return null;
3179
+ }
3180
+ _chunkJ5SB6L2Ljs.__name.call(void 0, nodeLibraryGeneratorFn, "nodeLibraryGeneratorFn");
3181
+ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Platform)", nodeLibraryGeneratorFn, {
3182
+ hooks: {
3183
+ applyDefaultOptions: /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (options) => {
3184
+ options.description ??= "A library used by Storm Software to support NodeJs applications";
3185
+ options.platform ??= "node";
3186
+ return options;
3187
+ }, "applyDefaultOptions")
3188
+ }
3189
+ });
3190
+
3191
+ // ../workspace-tools/src/generators/preset/generator.ts
3192
+
3193
+
3194
+ async function presetGeneratorFn(tree, options) {
3195
+ const projectRoot = ".";
3196
+ options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
3197
+ options.namespace ??= options.organization;
3198
+ _devkit.addProjectConfiguration.call(void 0, tree, `@${options.namespace}/${options.name}`, {
3199
+ root: projectRoot,
3200
+ projectType: "application",
3201
+ targets: {
3202
+ "local-registry": {
3203
+ executor: "@nx/js:verdaccio",
3204
+ options: {
3205
+ port: 4873,
3206
+ config: ".verdaccio/config.yml",
3207
+ storage: "tmp/local-registry/storage"
3208
+ }
3209
+ }
3210
+ }
3211
+ });
3212
+ _devkit.updateJson.call(void 0, tree, "package.json", (json) => {
3213
+ json.scripts = json.scripts || {};
3214
+ json.version = "0.0.0";
3215
+ json.triggerEmptyDevReleaseByIncrementingThisNumber = 0;
3216
+ json.private = true;
3217
+ json.keywords ??= [
3218
+ options.name,
3219
+ options.namespace,
3220
+ "storm",
3221
+ "storm-stack",
3222
+ "storm-ops",
3223
+ "acidic",
3224
+ "acidic-engine",
3225
+ "cyclone-ui",
3226
+ "rust",
3227
+ "nx",
3228
+ "graphql",
3229
+ "sullivanpj",
3230
+ "monorepo"
3231
+ ];
3232
+ json.homepage ??= "https://stormsoftware.com";
3233
+ json.bugs ??= {
3234
+ url: `https://github.com/${options.organization}/${options.name}/issues`,
3235
+ email: "support@stormsoftware.com"
3236
+ };
3237
+ json.license = "Apache-2.0";
3238
+ json.author ??= {
3239
+ name: "Storm Software",
3240
+ email: "contact@stormsoftware.com",
3241
+ url: "https://stormsoftware.com"
3242
+ };
3243
+ json.maintainers ??= [
3244
+ {
3245
+ "name": "Storm Software",
3246
+ "email": "contact@stormsoftware.com",
3247
+ "url": "https://stormsoftware.com"
3248
+ },
3249
+ {
3250
+ "name": "Pat Sullivan",
3251
+ "email": "admin@stormsoftware.com",
3252
+ "url": "https://patsullivan.org"
3253
+ }
3254
+ ];
3255
+ json.funding ??= {
3256
+ type: "github",
3257
+ url: "https://github.com/sponsors/storm-software"
3258
+ };
3259
+ json.namespace ??= `@${options.namespace}`;
3260
+ json.description ??= options.description;
3261
+ options.repositoryUrl ??= `https://github.com/${options.organization}/${options.name}`;
3262
+ json.repository ??= {
3263
+ type: "github",
3264
+ url: `${options.repositoryUrl}.git`
3265
+ };
3266
+ json.packageManager ??= "pnpm@9.15.2";
3267
+ json.engines ??= {
3268
+ "node": ">=20.11.0",
3269
+ "pnpm": ">=9.15.2"
3270
+ };
3271
+ json.prettier = "@storm-software/prettier/config.json";
3272
+ json.nx ??= {
3273
+ "includedScripts": [
3274
+ "lint-sherif",
3275
+ "lint-knip",
3276
+ "lint-ls",
3277
+ "lint",
3278
+ "format",
3279
+ "format-sherif",
3280
+ "format-readme",
3281
+ "format-prettier",
3282
+ "format-toml",
3283
+ "commit",
3284
+ "release"
3285
+ ]
3286
+ };
3287
+ json.scripts.adr = "pnpm log4brains adr new";
3288
+ json.scripts["adr-preview"] = "pnpm log4brains preview";
3289
+ json.scripts.prepare = "pnpm add lefthook -w && pnpm lefthook install";
3290
+ json.scripts.preinstall = "npx -y only-allow pnpm";
3291
+ json.scripts["install-csb"] = "corepack enable && pnpm install --no-frozen-lockfile";
3292
+ json.scripts.clean = "rimraf dist && rimraf --glob packages/**/dist && rimraf --glob tools/**/dist && rimraf --glob docs/**/dist && rimraf --glob apps/**/dist && rimraf --glob libs/**/dist";
3293
+ json.scripts.nuke = "nx clear-cache && rimraf .nx/cache && rimraf .nx/workspace-data && pnpm clean && rimraf pnpm-lock.yaml && rimraf --glob packages/**/node_modules && rimraf --glob tools/**/node_modules && rimraf node_modules";
3294
+ json.scripts.prebuild = "pnpm clean";
3295
+ json.scripts.build = "nx affected -t build --parallel=5";
3296
+ json.scripts["build-all"] = "nx run-many -t build --all --parallel=5";
3297
+ json.scripts["build-prod"] = "nx run-many -t build --all --prod --parallel=5";
3298
+ json.scripts["build-tools"] = "nx run-many -t build --projects=tools/* --parallel=5";
3299
+ json.scripts["build-docs"] = "nx run-many -t build --projects=docs/* --parallel=5";
3300
+ if (!options.includeApps) {
3301
+ json.scripts["build-packages"] = "nx run-many -t build --projects=packages/* --parallel=5";
3302
+ } else {
3303
+ json.scripts["build-apps"] = "nx run-many -t build --projects=apps/* --parallel=5";
3304
+ json.scripts["build-libs"] = "nx run-many -t build --projects=libs/* --parallel=5";
3305
+ json.scripts["build-storybook"] = "storybook build -s public";
3306
+ }
3307
+ json.scripts.nx = "nx";
3308
+ json.scripts.graph = "nx graph";
3309
+ json.scripts.lint = "pnpm storm-lint all --skip-cspell --skip-alex";
3310
+ if (options.includeApps) {
3311
+ json.scripts.start = "nx serve";
3312
+ json.scripts.storybook = "pnpm storybook dev -p 6006";
3313
+ }
3314
+ json.scripts.help = "nx help";
3315
+ json.scripts["dep-graph"] = "nx dep-graph";
3316
+ json.scripts["local-registry"] = `nx local-registry @${options.namespace}/${options.name}`;
3317
+ json.scripts.e2e = "nx e2e";
3318
+ if (options.includeApps) {
3319
+ json.scripts.test = "nx test && pnpm test-storybook";
3320
+ json.scripts["test-storybook"] = "pnpm test-storybook";
3321
+ } else {
3322
+ json.scripts.test = "nx test";
3323
+ }
3324
+ json.scripts.lint = "pnpm storm-lint all --skip-cspell --skip-alex";
3325
+ json.scripts.commit = "pnpm storm-git commit";
3326
+ json.scripts["api-extractor"] = 'pnpm storm-docs api-extractor --outputPath="docs/api-reference" --clean';
3327
+ json.scripts.release = "pnpm storm-git release";
3328
+ json.scripts.format = "nx format:write";
3329
+ json.scripts["format-sherif"] = "pnpm exec sherif -f -i typescript -i react -i react-dom";
3330
+ json.scripts["format-toml"] = 'pnpm exec taplo format --config="./node_modules/@storm-software/linting-tools/taplo/config.toml" --cache-path="./node_modules/.cache/storm/taplo"';
3331
+ json.scripts["format-readme"] = 'pnpm storm-git readme --templates="tools/readme-templates"';
3332
+ json.scripts["format-prettier"] = "pnpm exec prettier --write --ignore-unknown --no-error-on-unmatched-pattern --cache && git update-index";
3333
+ json.scripts.lint = "pnpm storm-lint all --skip-cspell";
3334
+ json.scripts["lint-knip"] = "pnpm exec knip";
3335
+ json.scripts["lint-sherif"] = "pnpm exec sherif -i typescript -i react -i react-dom";
3336
+ json.scripts["lint-ls"] = 'pnpm exec ls-lint --config="./node_modules/@storm-software/linting-tools/ls-lint/ls-lint.yml"';
3337
+ json.packageManager ??= `pnpm@${pnpmVersion}`;
3338
+ json.engines = {
3339
+ node: `>=${nodeVersion}`,
3340
+ pnpm: `>=${pnpmVersion}`
3341
+ };
3342
+ return json;
3343
+ });
3344
+ _devkit.generateFiles.call(void 0, tree, path6.join(__dirname, "files"), projectRoot, {
3345
+ ...options,
3346
+ pnpmVersion,
3347
+ nodeVersion
3348
+ });
3349
+ await _devkit.formatFiles.call(void 0, tree);
3350
+ let dependencies = {
3351
+ "@ls-lint/ls-lint": "2.2.3",
3352
+ "@ltd/j-toml": "1.38.0",
3353
+ "@nx/devkit": "^20.2.2",
3354
+ "@nx/eslint-plugin": "^20.2.2",
3355
+ "@nx/js": "^20.2.2",
3356
+ "@nx/workspace": "^20.2.2",
3357
+ "@storm-software/config": "latest",
3358
+ "@storm-software/git-tools": "latest",
3359
+ "@storm-software/linting-tools": "latest",
3360
+ "@storm-software/testing-tools": "latest",
3361
+ "@storm-software/workspace-tools": "latest",
3362
+ "@storm-software/eslint": "latest",
3363
+ "@storm-software/cspell": "latest",
3364
+ "@storm-software/prettier": "latest",
3365
+ "@taplo/cli": "0.7.0",
3366
+ "@types/node": "^20.14.10",
3367
+ "copyfiles": "2.4.1",
3368
+ "eslint": "9.5.0",
3369
+ "jest": "29.7.0",
3370
+ "jest-environment-node": "29.7.0",
3371
+ "knip": "5.25.2",
3372
+ "lefthook": "1.6.18",
3373
+ "nx": "^20.2.2",
3374
+ "prettier": "3.3.2",
3375
+ "prettier-plugin-prisma": "5.0.0",
3376
+ "rimraf": "5.0.7",
3377
+ "sherif": "0.10.0",
3378
+ "ts-jest": "29.1.5",
3379
+ "ts-node": "10.9.2",
3380
+ "tslib": "2.6.3",
3381
+ "typescript": "5.5.3",
3382
+ "verdaccio": "5.31.1"
3383
+ };
3384
+ if (options.includeApps) {
3385
+ dependencies = {
3386
+ ...dependencies,
3387
+ react: "latest",
3388
+ "react-dom": "latest",
3389
+ storybook: "latest",
3390
+ "@storybook/addons": "latest",
3391
+ "@nx/react": "latest",
3392
+ "@nx/next": "latest",
3393
+ "@nx/node": "latest",
3394
+ "@nx/storybook": "latest",
3395
+ "jest-environment-jsdom": "29.7.0"
3396
+ };
3397
+ }
3398
+ if (options.includeRust) {
3399
+ dependencies = {
3400
+ ...dependencies,
3401
+ "@monodon/rust": "1.4.0"
3402
+ };
3403
+ }
3404
+ if (options.nxCloud) {
3405
+ dependencies = {
3406
+ ...dependencies,
3407
+ "nx-cloud": "latest"
3408
+ };
3409
+ }
3410
+ await Promise.resolve(_devkit.addDependenciesToPackageJson.call(void 0, tree, dependencies, {}, _devkit.joinPathFragments.call(void 0, projectRoot, "package.json")));
3411
+ return null;
3412
+ }
3413
+ _chunkJ5SB6L2Ljs.__name.call(void 0, presetGeneratorFn, "presetGeneratorFn");
3414
+ var generator_default5 = withRunGenerator("Storm Workspace Preset Generator", presetGeneratorFn);
3415
+
3416
+ // ../workspace-tools/src/generators/release-version/generator.ts
3417
+
3418
+ var _resolvelocalpackagedependencies = require('@nx/js/src/generators/release-version/utils/resolve-local-package-dependencies');
3419
+ var _updatelockfile = require('@nx/js/src/generators/release-version/utils/update-lock-file');
3420
+
3421
+ // ../git-tools/src/types.ts
3422
+ var RuleConfigSeverity;
3423
+ (function(RuleConfigSeverity2) {
3424
+ RuleConfigSeverity2[RuleConfigSeverity2["Disabled"] = 0] = "Disabled";
3425
+ RuleConfigSeverity2[RuleConfigSeverity2["Warning"] = 1] = "Warning";
3426
+ RuleConfigSeverity2[RuleConfigSeverity2["Error"] = 2] = "Error";
3427
+ })(RuleConfigSeverity || (RuleConfigSeverity = {}));
3428
+
3429
+ // ../git-tools/src/release/changelog-renderer.ts
3430
+ var _index = require('nx/release/changelog-renderer/index'); var _index2 = _interopRequireDefault(_index);
3431
+
3432
+ // ../workspace-tools/src/generators/release-version/generator.ts
3433
+
3434
+
3435
+ var _config = require('nx/src/command-line/release/config/config');
3436
+ var _git = require('nx/src/command-line/release/utils/git');
3437
+ var _resolvesemverspecifier = require('nx/src/command-line/release/utils/resolve-semver-specifier');
3438
+ var _semver = require('nx/src/command-line/release/utils/semver');
3439
+ var _version = require('nx/src/command-line/release/version');
3440
+ var _utils = require('nx/src/tasks-runner/utils');
3441
+ var _semver3 = require('semver');
3442
+
3443
+ // ../workspace-tools/src/utils/get-project-configurations.ts
3444
+ var _retrieveworkspacefiles = require('nx/src/project-graph/utils/retrieve-workspace-files');
3445
+
3446
+ // ../workspace-tools/src/utils/lock-file.ts
3447
+
3448
+
3449
+ var _devkitexports = require('nx/src/devkit-exports');
3450
+ var _npmparser = require('nx/src/plugins/js/lock-file/npm-parser');
3451
+ var _pnpmparser = require('nx/src/plugins/js/lock-file/pnpm-parser');
3452
+ var _yarnparser = require('nx/src/plugins/js/lock-file/yarn-parser');
3453
+ var YARN_LOCK_FILE = "yarn.lock";
3454
+ var NPM_LOCK_FILE = "package-lock.json";
3455
+ var PNPM_LOCK_FILE = "pnpm-lock.yaml";
3456
+ var YARN_LOCK_PATH = _path.join.call(void 0, _devkitexports.workspaceRoot, YARN_LOCK_FILE);
3457
+ var NPM_LOCK_PATH = _path.join.call(void 0, _devkitexports.workspaceRoot, NPM_LOCK_FILE);
3458
+ var PNPM_LOCK_PATH = _path.join.call(void 0, _devkitexports.workspaceRoot, PNPM_LOCK_FILE);
3459
+
3460
+ // ../workspace-tools/src/utils/typia-transform.ts
3461
+ var _transform = require('typia/lib/transform'); var _transform2 = _interopRequireDefault(_transform);
3462
+
3463
+
3464
+
3465
+ exports.withRunExecutor = withRunExecutor;