@kubb/cli 4.12.5 → 4.12.7

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 (39) hide show
  1. package/dist/{generate-DKUIRxiL.js → generate--x91ECr5.js} +137 -71
  2. package/dist/generate--x91ECr5.js.map +1 -0
  3. package/dist/{generate-BGEmIdHW.cjs → generate-7e5eF2O-.cjs} +136 -70
  4. package/dist/generate-7e5eF2O-.cjs.map +1 -0
  5. package/dist/index.cjs +5 -5
  6. package/dist/index.js +5 -5
  7. package/dist/{mcp-LLlOFV3c.js → mcp-B5FWDVjp.js} +3 -3
  8. package/dist/mcp-B5FWDVjp.js.map +1 -0
  9. package/dist/{mcp-N1IVyiXf.cjs → mcp-D7d_8Bma.cjs} +3 -3
  10. package/dist/mcp-D7d_8Bma.cjs.map +1 -0
  11. package/dist/{package-ChTBCRJt.cjs → package-CrqsFX0R.cjs} +2 -2
  12. package/dist/package-CrqsFX0R.cjs.map +1 -0
  13. package/dist/package-V7YSB1bN.js +6 -0
  14. package/dist/package-V7YSB1bN.js.map +1 -0
  15. package/dist/{validate-BptoQ-63.js → validate-Bt922JN-.js} +3 -3
  16. package/dist/validate-Bt922JN-.js.map +1 -0
  17. package/dist/{validate-Dn6hZ7Z4.cjs → validate-D9LPzg3-.cjs} +3 -3
  18. package/dist/validate-D9LPzg3-.cjs.map +1 -0
  19. package/package.json +4 -4
  20. package/src/commands/generate.ts +2 -2
  21. package/src/commands/mcp.ts +3 -5
  22. package/src/commands/validate.ts +3 -5
  23. package/src/loggers/clackLogger.ts +85 -25
  24. package/src/loggers/githubActionsLogger.ts +94 -20
  25. package/src/loggers/plainLogger.ts +4 -3
  26. package/src/runners/generate.ts +10 -10
  27. package/src/utils/Writables.ts +0 -8
  28. package/src/utils/getCosmiConfig.ts +2 -2
  29. package/src/utils/getSummary.ts +3 -3
  30. package/dist/generate-BGEmIdHW.cjs.map +0 -1
  31. package/dist/generate-DKUIRxiL.js.map +0 -1
  32. package/dist/mcp-LLlOFV3c.js.map +0 -1
  33. package/dist/mcp-N1IVyiXf.cjs.map +0 -1
  34. package/dist/package-BqxUFXm-.js +0 -6
  35. package/dist/package-BqxUFXm-.js.map +0 -1
  36. package/dist/package-ChTBCRJt.cjs.map +0 -1
  37. package/dist/validate-BptoQ-63.js.map +0 -1
  38. package/dist/validate-Dn6hZ7Z4.cjs.map +0 -1
  39. package/src/utils/parseHrtimeToSeconds.ts +0 -4
@@ -1,11 +1,11 @@
1
- import { t as version } from "./package-BqxUFXm-.js";
1
+ import { t as version } from "./package-V7YSB1bN.js";
2
2
  import { defineCommand, showUsage } from "citty";
3
3
  import path, { relative, resolve } from "node:path";
4
4
  import * as process$2 from "node:process";
5
5
  import process$1 from "node:process";
6
6
  import * as clack from "@clack/prompts";
7
7
  import { LogLevel, PromiseManager, defineLogger, isInputPath, safeBuild, setup } from "@kubb/core";
8
- import { AsyncEventEmitter, isPromise } from "@kubb/core/utils";
8
+ import { AsyncEventEmitter, formatHrtime, formatMs, isPromise } from "@kubb/core/utils";
9
9
  import getLatestVersion from "latest-version";
10
10
  import pc from "picocolors";
11
11
  import { lt } from "semver";
@@ -18,12 +18,6 @@ import { parseArgsStringToArgv } from "string-argv";
18
18
  import { cosmiconfig } from "cosmiconfig";
19
19
  import { createJiti } from "jiti";
20
20
 
21
- //#region src/utils/parseHrtimeToSeconds.ts
22
- function parseHrtimeToSeconds(hrtime) {
23
- return (hrtime[0] + hrtime[1] / 1e9).toFixed(3);
24
- }
25
-
26
- //#endregion
27
21
  //#region src/utils/randomColour.ts
28
22
  function randomColour(text) {
29
23
  if (!text) return "white";
@@ -51,14 +45,14 @@ function randomCliColour(text) {
51
45
  //#endregion
52
46
  //#region src/utils/getSummary.ts
53
47
  function getSummary({ failedPlugins, filesCreated, status, hrStart, config, pluginTimings }) {
54
- const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrStart));
48
+ const duration = formatHrtime(hrStart);
55
49
  const pluginsCount = config.plugins?.length || 0;
56
50
  const successCount = pluginsCount - failedPlugins.size;
57
51
  const meta = {
58
52
  plugins: status === "success" ? `${pc.green(`${successCount} successful`)}, ${pluginsCount} total` : `${pc.green(`${successCount} successful`)}, ${pc.red(`${failedPlugins.size} failed`)}, ${pluginsCount} total`,
59
53
  pluginsFailed: status === "failed" ? [...failedPlugins]?.map(({ plugin }) => randomCliColour(plugin.name))?.join(", ") : void 0,
60
54
  filesCreated,
61
- time: `${elapsedSeconds}s`,
55
+ time: pc.green(duration),
62
56
  output: path.isAbsolute(config.root) ? path.resolve(config.root, config.output.path) : config.root
63
57
  };
64
58
  const labels = {
@@ -115,9 +109,31 @@ const clackLogger = defineLogger({
115
109
  name: "clack",
116
110
  install(context, options) {
117
111
  const logLevel = options?.logLevel || LogLevel.info;
118
- const activeProgress = /* @__PURE__ */ new Map();
119
- const spinner = clack.spinner();
120
- let isSpinning = false;
112
+ const state = {
113
+ totalPlugins: 0,
114
+ completedPlugins: 0,
115
+ failedPlugins: 0,
116
+ totalFiles: 0,
117
+ processedFiles: 0,
118
+ hrStart: process$1.hrtime(),
119
+ spinner: clack.spinner(),
120
+ isSpinning: false,
121
+ activeProgress: /* @__PURE__ */ new Map()
122
+ };
123
+ function showProgressStep() {
124
+ if (logLevel <= LogLevel.silent) return;
125
+ const parts = [];
126
+ const duration = formatHrtime(state.hrStart);
127
+ if (state.totalPlugins > 0) {
128
+ const pluginStr = state.failedPlugins > 0 ? `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins} ${pc.red(`(${state.failedPlugins} failed)`)}` : `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins}`;
129
+ parts.push(pluginStr);
130
+ }
131
+ if (state.totalFiles > 0) parts.push(`Files ${pc.green(state.processedFiles.toString())}/${state.totalFiles}`);
132
+ if (parts.length > 0) {
133
+ parts.push(pc.green(duration));
134
+ clack.log.step(parts.join(pc.dim(" | ")));
135
+ }
136
+ }
121
137
  function getMessage(message) {
122
138
  if (logLevel >= LogLevel.verbose) {
123
139
  const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
@@ -131,12 +147,12 @@ const clackLogger = defineLogger({
131
147
  return message;
132
148
  }
133
149
  function startSpinner(text) {
134
- spinner.start(text);
135
- isSpinning = true;
150
+ state.spinner.start(text);
151
+ state.isSpinning = true;
136
152
  }
137
153
  function stopSpinner(text) {
138
- spinner.stop(text);
139
- isSpinning = false;
154
+ state.spinner.stop(text);
155
+ state.isSpinning = false;
140
156
  }
141
157
  context.on("info", (message, info = "") => {
142
158
  if (logLevel <= LogLevel.silent) return;
@@ -145,7 +161,7 @@ const clackLogger = defineLogger({
145
161
  message,
146
162
  pc.dim(info)
147
163
  ].join(" "));
148
- if (isSpinning) spinner.message(text);
164
+ if (state.isSpinning) state.spinner.message(text);
149
165
  else clack.log.info(text);
150
166
  });
151
167
  context.on("success", (message, info = "") => {
@@ -155,7 +171,7 @@ const clackLogger = defineLogger({
155
171
  message,
156
172
  logLevel >= LogLevel.info ? pc.dim(info) : void 0
157
173
  ].filter(Boolean).join(" "));
158
- if (isSpinning) stopSpinner(text);
174
+ if (state.isSpinning) stopSpinner(text);
159
175
  else clack.log.success(text);
160
176
  });
161
177
  context.on("warn", (message, info) => {
@@ -170,7 +186,7 @@ const clackLogger = defineLogger({
170
186
  context.on("error", (error) => {
171
187
  const caused = error.cause;
172
188
  const text = [pc.red("✗"), error.message].join(" ");
173
- if (isSpinning) stopSpinner(getMessage(text));
189
+ if (state.isSpinning) stopSpinner(getMessage(text));
174
190
  else clack.log.error(getMessage(text));
175
191
  if (logLevel >= LogLevel.debug && error.stack) {
176
192
  const frames = error.stack.split("\n").slice(1, 4);
@@ -207,12 +223,16 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
207
223
  clack.intro(text);
208
224
  startSpinner(getMessage("Configuration loading"));
209
225
  });
210
- context.on("config:end", () => {
226
+ context.on("config:end", (_configs) => {
211
227
  if (logLevel <= LogLevel.silent) return;
212
228
  const text = getMessage("Configuration completed");
213
229
  clack.outro(text);
214
230
  });
215
231
  context.on("generation:start", (config) => {
232
+ state.totalPlugins = config.plugins?.length || 0;
233
+ state.completedPlugins = 0;
234
+ state.failedPlugins = 0;
235
+ state.hrStart = process$1.hrtime();
216
236
  const text = getMessage(["Generation started", config.name ? `for ${pc.dim(config.name)}` : void 0].filter(Boolean).join(" "));
217
237
  clack.intro(text);
218
238
  });
@@ -229,24 +249,29 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
229
249
  const interval = setInterval(() => {
230
250
  progressBar.advance();
231
251
  }, 50);
232
- activeProgress.set(plugin.name, {
252
+ state.activeProgress.set(plugin.name, {
233
253
  progressBar,
234
254
  interval
235
255
  });
236
256
  });
237
- context.on("plugin:end", (plugin, duration) => {
257
+ context.on("plugin:end", (plugin, { duration, success }) => {
238
258
  stopSpinner();
239
- const active = activeProgress.get(plugin.name);
259
+ const active = state.activeProgress.get(plugin.name);
240
260
  if (!active || logLevel === LogLevel.silent) return;
241
261
  clearInterval(active.interval);
242
- const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
243
- const text = getMessage(`${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}`);
262
+ if (success) state.completedPlugins++;
263
+ else state.failedPlugins++;
264
+ const durationStr = formatMs(duration);
265
+ const text = getMessage(success ? `${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}` : `${pc.bold(plugin.name)} failed in ${pc.red(durationStr)}`);
244
266
  active.progressBar.stop(text);
245
- activeProgress.delete(plugin.name);
267
+ state.activeProgress.delete(plugin.name);
268
+ showProgressStep();
246
269
  });
247
270
  context.on("files:processing:start", (files) => {
248
271
  if (logLevel <= LogLevel.silent) return;
249
272
  stopSpinner();
273
+ state.totalFiles = files.length;
274
+ state.processedFiles = 0;
250
275
  const text = `Writing ${files.length} files`;
251
276
  const progressBar = clack.progress({
252
277
  style: "block",
@@ -255,13 +280,14 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
255
280
  });
256
281
  context.emit("info", text);
257
282
  progressBar.start(getMessage(text));
258
- activeProgress.set("files", { progressBar });
283
+ state.activeProgress.set("files", { progressBar });
259
284
  });
260
285
  context.on("file:processing:update", ({ file, config }) => {
261
286
  if (logLevel <= LogLevel.silent) return;
262
287
  stopSpinner();
288
+ state.processedFiles++;
263
289
  const text = `Writing ${relative(config.root, file.path)}`;
264
- const active = activeProgress.get("files");
290
+ const active = state.activeProgress.get("files");
265
291
  if (!active) return;
266
292
  active.progressBar.advance(void 0, text);
267
293
  });
@@ -269,10 +295,11 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
269
295
  if (logLevel <= LogLevel.silent) return;
270
296
  stopSpinner();
271
297
  const text = getMessage("Files written successfully");
272
- const active = activeProgress.get("files");
298
+ const active = state.activeProgress.get("files");
273
299
  if (!active) return;
274
300
  active.progressBar.stop(text);
275
- activeProgress.delete("files");
301
+ state.activeProgress.delete("files");
302
+ showProgressStep();
276
303
  });
277
304
  context.on("generation:end", (config) => {
278
305
  const text = getMessage(config.name ? `Generation completed for ${pc.dim(config.name)}` : "Generation completed");
@@ -386,11 +413,11 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
386
413
  });
387
414
  });
388
415
  context.on("lifecycle:end", () => {
389
- for (const [_key, active] of activeProgress) {
416
+ for (const [_key, active] of state.activeProgress) {
390
417
  if (active.interval) clearInterval(active.interval);
391
418
  active.progressBar?.stop();
392
419
  }
393
- activeProgress.clear();
420
+ state.activeProgress.clear();
394
421
  });
395
422
  }
396
423
  });
@@ -475,7 +502,29 @@ const githubActionsLogger = defineLogger({
475
502
  name: "github-actions",
476
503
  install(context, options) {
477
504
  const logLevel = options?.logLevel || LogLevel.info;
478
- let currentConfigs = [];
505
+ const state = {
506
+ totalPlugins: 0,
507
+ completedPlugins: 0,
508
+ failedPlugins: 0,
509
+ totalFiles: 0,
510
+ processedFiles: 0,
511
+ hrStart: process.hrtime(),
512
+ currentConfigs: []
513
+ };
514
+ function showProgressStep() {
515
+ if (logLevel <= LogLevel.silent) return;
516
+ const parts = [];
517
+ const duration = formatHrtime(state.hrStart);
518
+ if (state.totalPlugins > 0) {
519
+ const pluginStr = state.failedPlugins > 0 ? `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins} ${pc.red(`(${state.failedPlugins} failed)`)}` : `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins}`;
520
+ parts.push(pluginStr);
521
+ }
522
+ if (state.totalFiles > 0) parts.push(`Files ${pc.green(state.processedFiles.toString())}/${state.totalFiles}`);
523
+ if (parts.length > 0) {
524
+ parts.push(pc.green(duration));
525
+ console.log(parts.join(pc.dim(" | ")));
526
+ }
527
+ }
479
528
  function getMessage(message) {
480
529
  if (logLevel >= LogLevel.verbose) {
481
530
  const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
@@ -536,34 +585,43 @@ const githubActionsLogger = defineLogger({
536
585
  console.log(text);
537
586
  });
538
587
  context.on("config:end", (configs) => {
539
- currentConfigs = configs;
588
+ state.currentConfigs = configs;
540
589
  if (logLevel <= LogLevel.silent) return;
541
590
  const text = getMessage("Configuration completed");
542
591
  console.log(text);
543
592
  closeGroup("Configuration");
544
593
  });
545
594
  context.on("generation:start", (config) => {
595
+ state.totalPlugins = config.plugins?.length || 0;
596
+ state.completedPlugins = 0;
597
+ state.failedPlugins = 0;
598
+ state.hrStart = process.hrtime();
546
599
  const text = config.name ? `Generation for ${pc.bold(config.name)}` : "Generation";
547
- if (currentConfigs.length > 1) openGroup(text);
548
- if (currentConfigs.length === 1) console.log(getMessage(text));
600
+ if (state.currentConfigs.length > 1) openGroup(text);
601
+ if (state.currentConfigs.length === 1) console.log(getMessage(text));
549
602
  });
550
603
  context.on("plugin:start", (plugin) => {
551
604
  if (logLevel <= LogLevel.silent) return;
552
605
  const text = getMessage(`Generating ${pc.bold(plugin.name)}`);
553
- if (currentConfigs.length === 1) openGroup(`Plugin: ${plugin.name}`);
606
+ if (state.currentConfigs.length === 1) openGroup(`Plugin: ${plugin.name}`);
554
607
  console.log(text);
555
608
  });
556
- context.on("plugin:end", (plugin, duration) => {
609
+ context.on("plugin:end", (plugin, { duration, success }) => {
557
610
  if (logLevel <= LogLevel.silent) return;
558
- const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
559
- const text = getMessage(`${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}`);
611
+ if (success) state.completedPlugins++;
612
+ else state.failedPlugins++;
613
+ const durationStr = formatMs(duration);
614
+ const text = getMessage(success ? `${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}` : `${pc.bold(plugin.name)} failed in ${pc.red(durationStr)}`);
560
615
  console.log(text);
561
- if (currentConfigs.length > 1) console.log(" ");
562
- if (currentConfigs.length === 1) closeGroup(`Plugin: ${plugin.name}`);
616
+ if (state.currentConfigs.length > 1) console.log(" ");
617
+ if (state.currentConfigs.length === 1) closeGroup(`Plugin: ${plugin.name}`);
618
+ showProgressStep();
563
619
  });
564
620
  context.on("files:processing:start", (files) => {
565
621
  if (logLevel <= LogLevel.silent) return;
566
- if (currentConfigs.length === 1) openGroup("File Generation");
622
+ state.totalFiles = files.length;
623
+ state.processedFiles = 0;
624
+ if (state.currentConfigs.length === 1) openGroup("File Generation");
567
625
  const text = getMessage(`Writing ${files.length} files`);
568
626
  console.log(text);
569
627
  });
@@ -571,7 +629,15 @@ const githubActionsLogger = defineLogger({
571
629
  if (logLevel <= LogLevel.silent) return;
572
630
  const text = getMessage("Files written successfully");
573
631
  console.log(text);
574
- if (currentConfigs.length === 1) closeGroup("File Generation");
632
+ if (state.currentConfigs.length === 1) closeGroup("File Generation");
633
+ });
634
+ context.on("file:processing:update", () => {
635
+ if (logLevel <= LogLevel.silent) return;
636
+ state.processedFiles++;
637
+ });
638
+ context.on("files:processing:end", () => {
639
+ if (logLevel <= LogLevel.silent) return;
640
+ showProgressStep();
575
641
  });
576
642
  context.on("generation:end", (config) => {
577
643
  const text = getMessage(config.name ? `${pc.blue("✓")} Generation completed for ${pc.dim(config.name)}` : `${pc.blue("✓")} Generation completed`);
@@ -602,45 +668,45 @@ const githubActionsLogger = defineLogger({
602
668
  context.on("format:start", () => {
603
669
  if (logLevel <= LogLevel.silent) return;
604
670
  const text = getMessage("Format started");
605
- if (currentConfigs.length === 1) openGroup("Formatting");
671
+ if (state.currentConfigs.length === 1) openGroup("Formatting");
606
672
  console.log(text);
607
673
  });
608
674
  context.on("format:end", () => {
609
675
  if (logLevel <= LogLevel.silent) return;
610
676
  const text = getMessage("Format completed");
611
677
  console.log(text);
612
- if (currentConfigs.length === 1) closeGroup("Formatting");
678
+ if (state.currentConfigs.length === 1) closeGroup("Formatting");
613
679
  });
614
680
  context.on("lint:start", () => {
615
681
  if (logLevel <= LogLevel.silent) return;
616
682
  const text = getMessage("Lint started");
617
- if (currentConfigs.length === 1) openGroup("Linting");
683
+ if (state.currentConfigs.length === 1) openGroup("Linting");
618
684
  console.log(text);
619
685
  });
620
686
  context.on("lint:end", () => {
621
687
  if (logLevel <= LogLevel.silent) return;
622
688
  const text = getMessage("Lint completed");
623
689
  console.log(text);
624
- if (currentConfigs.length === 1) closeGroup("Linting");
690
+ if (state.currentConfigs.length === 1) closeGroup("Linting");
625
691
  });
626
692
  context.on("hook:start", (command$1) => {
627
693
  if (logLevel <= LogLevel.silent) return;
628
694
  const text = getMessage(`Hook ${pc.dim(command$1)} started`);
629
- if (currentConfigs.length === 1) openGroup(`Hook ${command$1}`);
695
+ if (state.currentConfigs.length === 1) openGroup(`Hook ${command$1}`);
630
696
  console.log(text);
631
697
  });
632
698
  context.on("hook:end", (command$1) => {
633
699
  if (logLevel <= LogLevel.silent) return;
634
700
  const text = getMessage(`Hook ${pc.dim(command$1)} completed`);
635
701
  console.log(text);
636
- if (currentConfigs.length === 1) closeGroup(`Hook ${command$1}`);
702
+ if (state.currentConfigs.length === 1) closeGroup(`Hook ${command$1}`);
637
703
  });
638
704
  context.on("generation:summary", (config, { status, failedPlugins }) => {
639
705
  const pluginsCount = config.plugins?.length || 0;
640
706
  const successCount = pluginsCount - failedPlugins.size;
641
- if (currentConfigs.length > 1) console.log(" ");
707
+ if (state.currentConfigs.length > 1) console.log(" ");
642
708
  console.log(status === "success" ? `Kubb Summary: ${pc.blue("✓")} ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ${pc.blue("✓")} ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`);
643
- if (currentConfigs.length > 1) closeGroup(config.name ? `Generation for ${pc.bold(config.name)}` : "Generation");
709
+ if (state.currentConfigs.length > 1) closeGroup(config.name ? `Generation for ${pc.bold(config.name)}` : "Generation");
644
710
  });
645
711
  }
646
712
  });
@@ -727,10 +793,10 @@ const plainLogger = defineLogger({
727
793
  const text = getMessage(`Generating ${plugin.name}`);
728
794
  console.log(text);
729
795
  });
730
- context.on("plugin:end", (plugin, duration) => {
796
+ context.on("plugin:end", (plugin, { duration, success }) => {
731
797
  if (logLevel <= LogLevel.silent) return;
732
- const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
733
- const text = getMessage(`${plugin.name} completed in ${durationStr}`);
798
+ const durationStr = formatMs(duration);
799
+ const text = getMessage(success ? `${plugin.name} completed in ${durationStr}` : `${plugin.name} failed in ${durationStr}`);
734
800
  console.log(text);
735
801
  });
736
802
  context.on("files:processing:start", (files) => {
@@ -931,8 +997,8 @@ async function generate({ input, config, events, logLevel }) {
931
997
  "successfully"
932
998
  ].filter(Boolean).join(" "));
933
999
  });
934
- } catch (e) {
935
- await events.emit("error", e);
1000
+ } catch (caughtError) {
1001
+ await events.emit("error", caughtError);
936
1002
  }
937
1003
  await events.emit("success", `Formatted with ${config.output.format}`);
938
1004
  }
@@ -951,9 +1017,9 @@ async function generate({ input, config, events, logLevel }) {
951
1017
  "successfully"
952
1018
  ].filter(Boolean).join(" "));
953
1019
  });
954
- } catch (e) {
1020
+ } catch (caughtError) {
955
1021
  const error$1 = /* @__PURE__ */ new Error("Biome not found");
956
- error$1.cause = e;
1022
+ error$1.cause = caughtError;
957
1023
  await events.emit("error", error$1);
958
1024
  }
959
1025
  await events.emit("format:end");
@@ -972,9 +1038,9 @@ async function generate({ input, config, events, logLevel }) {
972
1038
  "successfully"
973
1039
  ].filter(Boolean).join(" "));
974
1040
  });
975
- } catch (e) {
1041
+ } catch (caughtError) {
976
1042
  const error$1 = /* @__PURE__ */ new Error("Eslint not found");
977
- error$1.cause = e;
1043
+ error$1.cause = caughtError;
978
1044
  await events.emit("error", error$1);
979
1045
  }
980
1046
  if (config.output.lint === "biome") try {
@@ -992,9 +1058,9 @@ async function generate({ input, config, events, logLevel }) {
992
1058
  "successfully"
993
1059
  ].filter(Boolean).join(" "));
994
1060
  });
995
- } catch (e) {
1061
+ } catch (caughtError) {
996
1062
  const error$1 = /* @__PURE__ */ new Error("Biome not found");
997
- error$1.cause = e;
1063
+ error$1.cause = caughtError;
998
1064
  await events.emit("error", error$1);
999
1065
  }
1000
1066
  if (config.output.lint === "oxlint") try {
@@ -1008,9 +1074,9 @@ async function generate({ input, config, events, logLevel }) {
1008
1074
  "successfully"
1009
1075
  ].filter(Boolean).join(" "));
1010
1076
  });
1011
- } catch (e) {
1077
+ } catch (caughtError) {
1012
1078
  const error$1 = /* @__PURE__ */ new Error("Oxlint not found");
1013
- error$1.cause = e;
1079
+ error$1.cause = caughtError;
1014
1080
  await events.emit("error", error$1);
1015
1081
  }
1016
1082
  await events.emit("lint:end");
@@ -1123,8 +1189,8 @@ async function getCosmiConfig(moduleName, config) {
1123
1189
  });
1124
1190
  try {
1125
1191
  result = config ? await explorer.load(config) : await explorer.search();
1126
- } catch (e) {
1127
- throw new Error("Config failed loading", { cause: e });
1192
+ } catch (error) {
1193
+ throw new Error("Config failed loading", { cause: error });
1128
1194
  }
1129
1195
  if (result?.isEmpty || !result || !result.config) throw new Error("Config not defined, create a kubb.config.js or pass through your config with the option --config");
1130
1196
  return result;
@@ -1237,8 +1303,8 @@ const command = defineCommand({
1237
1303
  });
1238
1304
  await promiseManager.run("seq", promises);
1239
1305
  await events.emit("lifecycle:end");
1240
- } catch (e) {
1241
- await events.emit("error", e);
1306
+ } catch (error) {
1307
+ await events.emit("error", error);
1242
1308
  }
1243
1309
  }
1244
1310
  });
@@ -1246,4 +1312,4 @@ var generate_default = command;
1246
1312
 
1247
1313
  //#endregion
1248
1314
  export { generate_default as default };
1249
- //# sourceMappingURL=generate-DKUIRxiL.js.map
1315
+ //# sourceMappingURL=generate--x91ECr5.js.map