@kubb/cli 4.11.2 → 4.12.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 (52) hide show
  1. package/dist/generate-BujndwJK.cjs +1256 -0
  2. package/dist/generate-BujndwJK.cjs.map +1 -0
  3. package/dist/generate-BvrG5K00.js +1249 -0
  4. package/dist/generate-BvrG5K00.js.map +1 -0
  5. package/dist/index.cjs +9 -35
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.js +7 -30
  8. package/dist/index.js.map +1 -1
  9. package/dist/{mcp-BIRDY8xn.js → mcp-LLlOFV3c.js} +5 -6
  10. package/dist/mcp-LLlOFV3c.js.map +1 -0
  11. package/dist/{mcp-BQjDRDXR.cjs → mcp-N1IVyiXf.cjs} +5 -7
  12. package/dist/mcp-N1IVyiXf.cjs.map +1 -0
  13. package/dist/package-Bhc6C7cQ.js +6 -0
  14. package/dist/package-Bhc6C7cQ.js.map +1 -0
  15. package/dist/package-KuCpJxHt.cjs +12 -0
  16. package/dist/package-KuCpJxHt.cjs.map +1 -0
  17. package/dist/{validate-0i6Q9eIy.js → validate-BptoQ-63.js} +5 -6
  18. package/dist/validate-BptoQ-63.js.map +1 -0
  19. package/dist/{validate-6F-VPZR7.cjs → validate-Dn6hZ7Z4.cjs} +5 -7
  20. package/dist/validate-Dn6hZ7Z4.cjs.map +1 -0
  21. package/package.json +7 -7
  22. package/src/commands/generate.ts +52 -65
  23. package/src/commands/mcp.ts +4 -5
  24. package/src/commands/validate.ts +4 -5
  25. package/src/index.ts +8 -23
  26. package/src/loggers/clackLogger.ts +433 -0
  27. package/src/loggers/envDetection.ts +28 -0
  28. package/src/loggers/fileSystemLogger.ts +79 -0
  29. package/src/loggers/githubActionsLogger.ts +310 -0
  30. package/src/loggers/index.ts +7 -0
  31. package/src/loggers/plainLogger.ts +274 -0
  32. package/src/loggers/types.ts +1 -0
  33. package/src/loggers/utils.ts +49 -0
  34. package/src/runners/generate.ts +196 -208
  35. package/src/utils/Writables.ts +12 -8
  36. package/src/utils/executeHooks.ts +11 -18
  37. package/src/utils/getCosmiConfig.ts +6 -1
  38. package/src/utils/getSummary.ts +20 -42
  39. package/src/utils/randomColour.ts +26 -0
  40. package/src/utils/watcher.ts +2 -4
  41. package/dist/generate-CYBFB3tU.js +0 -221
  42. package/dist/generate-CYBFB3tU.js.map +0 -1
  43. package/dist/generate-CpBJ2Y-n.js +0 -342
  44. package/dist/generate-CpBJ2Y-n.js.map +0 -1
  45. package/dist/generate-DpHvARzf.cjs +0 -345
  46. package/dist/generate-DpHvARzf.cjs.map +0 -1
  47. package/dist/generate-KUqCSnZp.cjs +0 -225
  48. package/dist/generate-KUqCSnZp.cjs.map +0 -1
  49. package/dist/mcp-BIRDY8xn.js.map +0 -1
  50. package/dist/mcp-BQjDRDXR.cjs.map +0 -1
  51. package/dist/validate-0i6Q9eIy.js.map +0 -1
  52. package/dist/validate-6F-VPZR7.cjs.map +0 -1
@@ -1,345 +0,0 @@
1
- const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- let node_path = require("node:path");
3
- node_path = require_chunk.__toESM(node_path);
4
- let node_process = require("node:process");
5
- node_process = require_chunk.__toESM(node_process);
6
- let __kubb_core = require("@kubb/core");
7
- let __kubb_core_logger = require("@kubb/core/logger");
8
- let picocolors = require("picocolors");
9
- picocolors = require_chunk.__toESM(picocolors);
10
- let cli_progress = require("cli-progress");
11
- let execa = require("execa");
12
- let string_argv = require("string-argv");
13
- let node_stream = require("node:stream");
14
-
15
- //#region src/utils/Writables.ts
16
- var ConsolaWritable = class extends node_stream.Writable {
17
- consola;
18
- command;
19
- constructor(consola, command, opts) {
20
- super(opts);
21
- this.command = command;
22
- this.consola = consola;
23
- }
24
- _write(chunk, _encoding, callback) {
25
- node_process.stdout.write(`${picocolors.default.dim(chunk?.toString())}`);
26
- callback();
27
- }
28
- };
29
-
30
- //#endregion
31
- //#region src/utils/executeHooks.ts
32
- async function executeHooks({ hooks, logger }) {
33
- const commands = Array.isArray(hooks.done) ? hooks.done : [hooks.done].filter(Boolean);
34
- for (const command of commands) {
35
- const consolaWritable = new ConsolaWritable(logger.consola, command);
36
- const [cmd, ..._args] = [...(0, string_argv.parseArgsStringToArgv)(command)];
37
- if (!cmd) continue;
38
- logger?.emit("start", `Executing hook ${logger.logLevel !== __kubb_core_logger.LogMapper.silent ? picocolors.default.dim(command) : ""}`);
39
- await (0, execa.execa)(cmd, _args, {
40
- detached: true,
41
- stdout: logger?.logLevel === __kubb_core_logger.LogMapper.silent ? void 0 : ["pipe", consolaWritable],
42
- stripFinalNewline: true
43
- });
44
- logger?.emit("success", `Executed hook ${logger.logLevel !== __kubb_core_logger.LogMapper.silent ? picocolors.default.dim(command) : ""}`);
45
- }
46
- logger?.emit("success", "Executed hooks");
47
- }
48
-
49
- //#endregion
50
- //#region src/utils/parseHrtimeToSeconds.ts
51
- function parseHrtimeToSeconds(hrtime) {
52
- return (hrtime[0] + hrtime[1] / 1e9).toFixed(3);
53
- }
54
-
55
- //#endregion
56
- //#region src/utils/getSummary.ts
57
- function getSummary({ failedPlugins, filesCreated, status, hrStart, config, pluginTimings }) {
58
- const logs = /* @__PURE__ */ new Set();
59
- const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrStart));
60
- const pluginsCount = config.plugins?.length || 0;
61
- const successCount = pluginsCount - failedPlugins.size;
62
- const meta = {
63
- plugins: status === "success" ? `${picocolors.default.green(`${successCount} successful`)}, ${pluginsCount} total` : `${picocolors.default.green(`${successCount} successful`)}, ${picocolors.default.red(`${failedPlugins.size} failed`)}, ${pluginsCount} total`,
64
- pluginsFailed: status === "failed" ? [...failedPlugins]?.map(({ plugin }) => (0, __kubb_core_logger.randomCliColour)(plugin.name))?.join(", ") : void 0,
65
- filesCreated,
66
- time: `${picocolors.default.yellow(`${elapsedSeconds}s`)}`,
67
- output: node_path.default.isAbsolute(config.root) ? node_path.default.resolve(config.root, config.output.path) : config.root
68
- };
69
- const labels = {
70
- plugins: "Plugins:",
71
- failed: "Failed:",
72
- generated: "Generated:",
73
- output: "Output:"
74
- };
75
- const maxLabelLength = Math.max(...Object.values(labels).map((l) => l.length));
76
- const summaryLines = [
77
- [`${picocolors.default.bold(labels.plugins.padEnd(maxLabelLength))} ${meta.plugins}`, true],
78
- [`${picocolors.default.dim(labels.failed.padEnd(maxLabelLength))} ${meta.pluginsFailed || "none"}`, !!meta.pluginsFailed],
79
- [`${picocolors.default.bold(labels.generated.padEnd(maxLabelLength))} ${meta.filesCreated} files in ${meta.time}`, true]
80
- ];
81
- if (pluginTimings && pluginTimings.size > 0) {
82
- const MAX_TOP_PLUGINS = 5;
83
- const TIME_SCALE_DIVISOR = 100;
84
- const MAX_BAR_LENGTH = 20;
85
- const sortedTimings = Array.from(pluginTimings.entries()).sort((a, b) => b[1] - a[1]).slice(0, MAX_TOP_PLUGINS);
86
- if (sortedTimings.length > 0) {
87
- summaryLines.push(["Plugin Timings:", true]);
88
- const maxNameLength = Math.max(...sortedTimings.map(([name]) => name.length));
89
- const indent = " ".repeat(maxLabelLength + 1);
90
- sortedTimings.forEach(([name, time]) => {
91
- const timeStr = time >= 1e3 ? `${(time / 1e3).toFixed(2)}s` : `${Math.round(time)}ms`;
92
- const barLength = Math.min(Math.ceil(time / TIME_SCALE_DIVISOR), MAX_BAR_LENGTH);
93
- const bar = "█".repeat(barLength);
94
- const paddedName = name.padStart(maxNameLength, " ");
95
- summaryLines.push([`${indent}${(0, __kubb_core_logger.randomCliColour)(paddedName)} ${picocolors.default.dim(bar)} ${picocolors.default.yellow(timeStr)}`, true]);
96
- });
97
- }
98
- }
99
- summaryLines.push([`${picocolors.default.bold(labels.output.padEnd(maxLabelLength))} ${meta.output}`, true]);
100
- logs.add(summaryLines.map((item) => {
101
- if (item.at(1)) return item.at(0);
102
- }).filter(Boolean).join("\n"));
103
- return [...logs];
104
- }
105
-
106
- //#endregion
107
- //#region src/runners/generate.ts
108
- async function generate({ input, config, progressCache, args }) {
109
- const hrStart = node_process.default.hrtime();
110
- const logger = (0, __kubb_core_logger.createLogger)({
111
- logLevel: __kubb_core_logger.LogMapper[args.logLevel] || 3,
112
- name: config.name
113
- });
114
- const { root = node_process.default.cwd(), ...userConfig } = config;
115
- const inputPath = input ?? ("path" in userConfig.input ? userConfig.input.path : void 0);
116
- if (logger.logLevel !== __kubb_core_logger.LogMapper.debug) {
117
- logger.on("progress_start", ({ id, size, message = "" }) => {
118
- logger.consola?.pauseLogs();
119
- const payload = {
120
- id,
121
- message
122
- };
123
- const progressBar = new cli_progress.SingleBar({
124
- format: "{percentage}% {bar} {value}/{total} | {message}",
125
- barsize: 30,
126
- clearOnComplete: true,
127
- emptyOnZero: true
128
- }, cli_progress.Presets.shades_grey);
129
- if (!progressCache.has(id)) {
130
- progressCache.set(id, progressBar);
131
- progressBar.start(size, 1, payload);
132
- }
133
- });
134
- logger.on("progress_stop", ({ id }) => {
135
- progressCache.get(id)?.stop();
136
- logger.consola?.resumeLogs();
137
- });
138
- logger.on("progressed", ({ id, message = "" }) => {
139
- const payload = {
140
- id,
141
- message
142
- };
143
- progressCache.get(id)?.increment(1, payload);
144
- });
145
- }
146
- const definedConfig = {
147
- root,
148
- ...userConfig,
149
- input: inputPath ? {
150
- ...userConfig.input,
151
- path: inputPath
152
- } : userConfig.input,
153
- output: {
154
- write: true,
155
- barrelType: "named",
156
- extension: { ".ts": ".ts" },
157
- format: "prettier",
158
- ...userConfig.output
159
- }
160
- };
161
- const { fabric, pluginManager } = await (0, __kubb_core.setup)({
162
- config: definedConfig,
163
- logger
164
- });
165
- logger.emit("start", `Building ${logger.logLevel !== __kubb_core_logger.LogMapper.silent ? picocolors.default.dim(inputPath) : ""}`);
166
- const { files, failedPlugins, pluginTimings, error } = await (0, __kubb_core.safeBuild)({
167
- config: definedConfig,
168
- logger
169
- }, {
170
- pluginManager,
171
- fabric,
172
- logger
173
- });
174
- if (logger.logLevel >= __kubb_core_logger.LogMapper.debug) {
175
- logger.consola?.start("Writing logs");
176
- await logger.writeLogs();
177
- logger.consola?.success("Written logs");
178
- }
179
- const summary = getSummary({
180
- failedPlugins,
181
- filesCreated: files.length,
182
- config: definedConfig,
183
- status: failedPlugins.size > 0 || error ? "failed" : "success",
184
- hrStart,
185
- pluginTimings: logger.logLevel >= __kubb_core_logger.LogMapper.verbose ? pluginTimings : void 0
186
- });
187
- if ((failedPlugins.size > 0 || error) && logger.consola) {
188
- logger.consola?.resumeLogs();
189
- logger.consola?.log(`✗ Build failed ${logger.logLevel !== __kubb_core_logger.LogMapper.silent ? picocolors.default.dim(inputPath) : ""}`);
190
- [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
191
- if (logger.logLevel >= __kubb_core_logger.LogMapper.debug && err.cause) logger.consola?.error(err.cause);
192
- logger.consola?.error(err);
193
- });
194
- logger.consola?.box({
195
- title: `${config.name || ""}`,
196
- message: summary.join(""),
197
- style: {
198
- padding: 2,
199
- borderColor: "red",
200
- borderStyle: "rounded"
201
- }
202
- });
203
- node_process.default.exit(1);
204
- }
205
- if (config.output.format === "prettier") {
206
- logger?.emit("start", `Formatting with ${config.output.format}`);
207
- logger?.emit("debug", {
208
- date: /* @__PURE__ */ new Date(),
209
- logs: [`Running prettier on ${node_path.default.resolve(definedConfig.root, definedConfig.output.path)}`]
210
- });
211
- try {
212
- await (0, execa.execa)("prettier", [
213
- "--ignore-unknown",
214
- "--write",
215
- node_path.default.resolve(definedConfig.root, definedConfig.output.path)
216
- ]);
217
- logger?.emit("debug", {
218
- date: /* @__PURE__ */ new Date(),
219
- logs: ["Prettier formatting completed successfully"]
220
- });
221
- } catch (e) {
222
- logger.consola?.warn("Prettier not found");
223
- logger.consola?.error(e);
224
- logger?.emit("debug", {
225
- date: /* @__PURE__ */ new Date(),
226
- logs: [`Prettier formatting failed: ${e.message}`]
227
- });
228
- }
229
- logger?.emit("success", `Formatted with ${config.output.format}`);
230
- }
231
- if (config.output.format === "biome") {
232
- logger?.emit("start", `Formatting with ${config.output.format}`);
233
- logger?.emit("debug", {
234
- date: /* @__PURE__ */ new Date(),
235
- logs: [`Running biome format on ${node_path.default.resolve(definedConfig.root, definedConfig.output.path)}`]
236
- });
237
- try {
238
- await (0, execa.execa)("biome", [
239
- "format",
240
- "--write",
241
- node_path.default.resolve(definedConfig.root, definedConfig.output.path)
242
- ]);
243
- logger?.emit("debug", {
244
- date: /* @__PURE__ */ new Date(),
245
- logs: ["Biome formatting completed successfully"]
246
- });
247
- } catch (e) {
248
- logger.consola?.warn("Biome not found");
249
- logger.consola?.error(e);
250
- logger?.emit("debug", {
251
- date: /* @__PURE__ */ new Date(),
252
- logs: [`Biome formatting failed: ${e.message}`]
253
- });
254
- }
255
- logger?.emit("success", `Formatted with ${config.output.format}`);
256
- }
257
- if (config.output.lint === "eslint") {
258
- logger?.emit("start", `Linting with ${config.output.lint}`);
259
- logger?.emit("debug", {
260
- date: /* @__PURE__ */ new Date(),
261
- logs: [`Running eslint on ${node_path.default.resolve(definedConfig.root, definedConfig.output.path)}`]
262
- });
263
- try {
264
- await (0, execa.execa)("eslint", [node_path.default.resolve(definedConfig.root, definedConfig.output.path), "--fix"]);
265
- logger?.emit("debug", {
266
- date: /* @__PURE__ */ new Date(),
267
- logs: ["ESLint linting completed successfully"]
268
- });
269
- } catch (e) {
270
- logger.consola?.warn("Eslint not found");
271
- logger.consola?.error(e);
272
- logger?.emit("debug", {
273
- date: /* @__PURE__ */ new Date(),
274
- logs: [`ESLint linting failed: ${e.message}`]
275
- });
276
- }
277
- logger?.emit("success", `Linted with ${config.output.lint}`);
278
- }
279
- if (config.output.lint === "biome") {
280
- logger?.emit("start", `Linting with ${config.output.lint}`);
281
- logger?.emit("debug", {
282
- date: /* @__PURE__ */ new Date(),
283
- logs: [`Running biome lint on ${node_path.default.resolve(definedConfig.root, definedConfig.output.path)}`]
284
- });
285
- try {
286
- await (0, execa.execa)("biome", [
287
- "lint",
288
- "--fix",
289
- node_path.default.resolve(definedConfig.root, definedConfig.output.path)
290
- ]);
291
- logger?.emit("debug", {
292
- date: /* @__PURE__ */ new Date(),
293
- logs: ["Biome linting completed successfully"]
294
- });
295
- } catch (e) {
296
- logger.consola?.warn("Biome not found");
297
- logger.consola?.error(e);
298
- logger?.emit("debug", {
299
- date: /* @__PURE__ */ new Date(),
300
- logs: [`✗ Biome linting failed: ${e.message}`]
301
- });
302
- }
303
- logger?.emit("success", `Linted with ${config.output.lint}`);
304
- }
305
- if (config.output.lint === "oxlint") {
306
- logger?.emit("start", `Linting with ${config.output.lint}`);
307
- logger?.emit("debug", {
308
- date: /* @__PURE__ */ new Date(),
309
- logs: [`Running oxlint on ${node_path.default.resolve(definedConfig.root, definedConfig.output.path)}`]
310
- });
311
- try {
312
- await (0, execa.execa)("oxlint", ["--fix", node_path.default.resolve(definedConfig.root, definedConfig.output.path)]);
313
- logger?.emit("debug", {
314
- date: /* @__PURE__ */ new Date(),
315
- logs: ["Oxlint linting completed successfully"]
316
- });
317
- } catch (e) {
318
- logger.consola?.warn("Oxlint not found");
319
- logger.consola?.error(e);
320
- logger?.emit("debug", {
321
- date: /* @__PURE__ */ new Date(),
322
- logs: [`✗ Oxlint linting failed: ${e.message}`]
323
- });
324
- }
325
- logger?.emit("success", `Linted with ${config.output.lint}`);
326
- }
327
- if (config.hooks) await executeHooks({
328
- hooks: config.hooks,
329
- logger
330
- });
331
- logger.consola?.log(`⚡ Build completed ${logger.logLevel !== __kubb_core_logger.LogMapper.silent ? picocolors.default.dim(inputPath) : ""}`);
332
- logger.consola?.box({
333
- title: `${config.name || ""}`,
334
- message: summary.join(""),
335
- style: {
336
- padding: 2,
337
- borderColor: "green",
338
- borderStyle: "rounded"
339
- }
340
- });
341
- }
342
-
343
- //#endregion
344
- exports.generate = generate;
345
- //# sourceMappingURL=generate-DpHvARzf.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-DpHvARzf.cjs","names":["Writable","pc","LogMapper","pc","pc","path","summaryLines: Array<[string, boolean]>","process","LogMapper","SingleBar","Presets","definedConfig: Config","pc","path"],"sources":["../src/utils/Writables.ts","../src/utils/executeHooks.ts","../src/utils/parseHrtimeToSeconds.ts","../src/utils/getSummary.ts","../src/runners/generate.ts"],"sourcesContent":["import * as process from 'node:process'\nimport type { WritableOptions } from 'node:stream'\nimport { Writable } from 'node:stream'\nimport type { ConsolaInstance } from 'consola'\nimport pc from 'picocolors'\n\nexport class ConsolaWritable extends Writable {\n consola: ConsolaInstance | undefined\n command: string\n constructor(consola: ConsolaInstance | undefined, command: string, opts?: WritableOptions) {\n super(opts)\n\n this.command = command\n this.consola = consola\n }\n _write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void {\n process.stdout.write(`${pc.dim(chunk?.toString())}`)\n\n callback()\n }\n}\n","import type { Config } from '@kubb/core'\nimport type { Logger } from '@kubb/core/logger'\nimport { LogMapper } from '@kubb/core/logger'\nimport { execa } from 'execa'\nimport pc from 'picocolors'\nimport { parseArgsStringToArgv } from 'string-argv'\nimport { ConsolaWritable } from './Writables.ts'\n\ntype ExecutingHooksProps = {\n hooks: NonNullable<Config['hooks']>\n logger: Logger\n}\n\nexport async function executeHooks({ hooks, logger }: ExecutingHooksProps): Promise<void> {\n const commands = Array.isArray(hooks.done) ? hooks.done : [hooks.done].filter(Boolean)\n\n for (const command of commands) {\n const consolaWritable = new ConsolaWritable(logger.consola!, command)\n const [cmd, ..._args] = [...parseArgsStringToArgv(command)]\n\n if (!cmd) {\n continue\n }\n\n logger?.emit('start', `Executing hook ${logger.logLevel !== LogMapper.silent ? pc.dim(command) : ''}`)\n\n await execa(cmd, _args, {\n detached: true,\n stdout: logger?.logLevel === LogMapper.silent ? undefined : ['pipe', consolaWritable],\n stripFinalNewline: true,\n })\n\n logger?.emit('success', `Executed hook ${logger.logLevel !== LogMapper.silent ? pc.dim(command) : ''}`)\n }\n\n logger?.emit('success', 'Executed hooks')\n}\n","export function parseHrtimeToSeconds(hrtime: [number, number]): string {\n const seconds = (hrtime[0] + hrtime[1] / 1e9).toFixed(3)\n return seconds\n}\n","import path from 'node:path'\nimport type { Config, Plugin } from '@kubb/core'\nimport { randomCliColour } from '@kubb/core/logger'\nimport pc from 'picocolors'\nimport { parseHrtimeToSeconds } from './parseHrtimeToSeconds.ts'\n\ntype SummaryProps = {\n failedPlugins: Set<{ plugin: Plugin; error: Error }>\n status: 'success' | 'failed'\n hrStart: [number, number]\n filesCreated: number\n config: Config\n pluginTimings?: Map<string, number>\n}\n\nexport function getSummary({ failedPlugins, filesCreated, status, hrStart, config, pluginTimings }: SummaryProps): string[] {\n const logs = new Set<string>()\n const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrStart))\n\n const pluginsCount = config.plugins?.length || 0\n const successCount = pluginsCount - failedPlugins.size\n\n const meta = {\n plugins:\n status === 'success'\n ? `${pc.green(`${successCount} successful`)}, ${pluginsCount} total`\n : `${pc.green(`${successCount} successful`)}, ${pc.red(`${failedPlugins.size} failed`)}, ${pluginsCount} total`,\n pluginsFailed: status === 'failed' ? [...failedPlugins]?.map(({ plugin }) => randomCliColour(plugin.name))?.join(', ') : undefined,\n filesCreated: filesCreated,\n time: `${pc.yellow(`${elapsedSeconds}s`)}`,\n output: path.isAbsolute(config.root) ? path.resolve(config.root, config.output.path) : config.root,\n } as const\n\n // Calculate label padding for perfect alignment\n const labels = {\n plugins: 'Plugins:',\n failed: 'Failed:',\n generated: 'Generated:',\n output: 'Output:',\n }\n const maxLabelLength = Math.max(...Object.values(labels).map((l) => l.length))\n\n const summaryLines: Array<[string, boolean]> = [\n [`${pc.bold(labels.plugins.padEnd(maxLabelLength))} ${meta.plugins}`, true],\n [`${pc.dim(labels.failed.padEnd(maxLabelLength))} ${meta.pluginsFailed || 'none'}`, !!meta.pluginsFailed],\n [`${pc.bold(labels.generated.padEnd(maxLabelLength))} ${meta.filesCreated} files in ${meta.time}`, true],\n ]\n\n // Add plugin timing breakdown if available\n if (pluginTimings && pluginTimings.size > 0) {\n const MAX_TOP_PLUGINS = 5\n const TIME_SCALE_DIVISOR = 100 // Each 100ms = 1 bar character\n const MAX_BAR_LENGTH = 20\n\n const sortedTimings = Array.from(pluginTimings.entries())\n .sort((a, b) => b[1] - a[1])\n .slice(0, MAX_TOP_PLUGINS)\n\n if (sortedTimings.length > 0) {\n summaryLines.push(['Plugin Timings:', true])\n\n // Find the longest plugin name for alignment\n const maxNameLength = Math.max(...sortedTimings.map(([name]) => name.length))\n\n // Indent plugin timing bars to align with summary values (e.g., \"7 successful\", \"60 files\")\n const indent = ' '.repeat(maxLabelLength + 1)\n\n sortedTimings.forEach(([name, time]) => {\n const timeStr = time >= 1000 ? `${(time / 1000).toFixed(2)}s` : `${Math.round(time)}ms`\n const barLength = Math.min(Math.ceil(time / TIME_SCALE_DIVISOR), MAX_BAR_LENGTH)\n const bar = '█'.repeat(barLength)\n\n // Right-align plugin names, left-align bars, with consistent spacing\n const paddedName = name.padStart(maxNameLength, ' ')\n summaryLines.push([`${indent}${randomCliColour(paddedName)} ${pc.dim(bar)} ${pc.yellow(timeStr)}`, true])\n })\n }\n }\n\n summaryLines.push([`${pc.bold(labels.output.padEnd(maxLabelLength))} ${meta.output}`, true])\n\n logs.add(\n summaryLines\n .map((item) => {\n if (item.at(1)) {\n return item.at(0)\n }\n return undefined\n })\n .filter(Boolean)\n .join('\\n'),\n )\n\n return [...logs]\n}\n","import path from 'node:path'\nimport process from 'node:process'\nimport { type Config, safeBuild, setup } from '@kubb/core'\nimport { createLogger, LogMapper } from '@kubb/core/logger'\nimport { Presets, SingleBar } from 'cli-progress'\nimport { execa } from 'execa'\nimport pc from 'picocolors'\nimport type { Args } from '../commands/generate.ts'\nimport { executeHooks } from '../utils/executeHooks.ts'\nimport { getSummary } from '../utils/getSummary.ts'\n\ntype GenerateProps = {\n input?: string\n config: Config\n args: Args\n progressCache: Map<string, SingleBar>\n}\n\nexport async function generate({ input, config, progressCache, args }: GenerateProps): Promise<void> {\n const hrStart = process.hrtime()\n const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3\n\n const logger = createLogger({\n logLevel,\n name: config.name,\n })\n\n const { root = process.cwd(), ...userConfig } = config\n const inputPath = input ?? ('path' in userConfig.input ? userConfig.input.path : undefined)\n\n if (logger.logLevel !== LogMapper.debug) {\n logger.on('progress_start', ({ id, size, message = '' }) => {\n logger.consola?.pauseLogs()\n const payload = { id, message }\n const progressBar = new SingleBar(\n {\n format: '{percentage}% {bar} {value}/{total} | {message}',\n barsize: 30,\n clearOnComplete: true,\n emptyOnZero: true,\n },\n Presets.shades_grey,\n )\n\n if (!progressCache.has(id)) {\n progressCache.set(id, progressBar)\n progressBar.start(size, 1, payload)\n }\n })\n\n logger.on('progress_stop', ({ id }) => {\n progressCache.get(id)?.stop()\n logger.consola?.resumeLogs()\n })\n\n logger.on('progressed', ({ id, message = '' }) => {\n const payload = { id, message }\n\n progressCache.get(id)?.increment(1, payload)\n })\n }\n\n const definedConfig: Config = {\n root,\n ...userConfig,\n input: inputPath\n ? {\n ...userConfig.input,\n path: inputPath,\n }\n : userConfig.input,\n output: {\n write: true,\n barrelType: 'named',\n extension: {\n '.ts': '.ts',\n },\n format: 'prettier',\n ...userConfig.output,\n },\n }\n\n const { fabric, pluginManager } = await setup({\n config: definedConfig,\n logger,\n })\n\n logger.emit('start', `Building ${logger.logLevel !== LogMapper.silent ? pc.dim(inputPath!) : ''}`)\n\n const { files, failedPlugins, pluginTimings, error } = await safeBuild(\n {\n config: definedConfig,\n logger,\n },\n { pluginManager, fabric, logger },\n )\n\n if (logger.logLevel >= LogMapper.debug) {\n logger.consola?.start('Writing logs')\n\n await logger.writeLogs()\n\n logger.consola?.success('Written logs')\n }\n\n const summary = getSummary({\n failedPlugins,\n filesCreated: files.length,\n config: definedConfig,\n status: failedPlugins.size > 0 || error ? 'failed' : 'success',\n hrStart,\n pluginTimings: logger.logLevel >= LogMapper.verbose ? pluginTimings : undefined,\n })\n\n // Handle build failures (either from failed plugins or general errors)\n const hasFailures = failedPlugins.size > 0 || error\n\n if (hasFailures && logger.consola) {\n logger.consola?.resumeLogs()\n logger.consola?.log(`✗ Build failed ${logger.logLevel !== LogMapper.silent ? pc.dim(inputPath!) : ''}`)\n\n // Collect all errors from failed plugins and general error\n const allErrors: Error[] = [\n error,\n ...Array.from(failedPlugins)\n .filter((it) => it.error)\n .map((it) => it.error),\n ].filter(Boolean)\n\n allErrors.forEach((err) => {\n // Display error causes in debug mode\n if (logger.logLevel >= LogMapper.debug && err.cause) {\n logger.consola?.error(err.cause)\n }\n\n logger.consola?.error(err)\n })\n\n logger.consola?.box({\n title: `${config.name || ''}`,\n message: summary.join(''),\n style: {\n padding: 2,\n borderColor: 'red',\n borderStyle: 'rounded',\n },\n })\n\n process.exit(1)\n }\n\n // formatting\n if (config.output.format === 'prettier') {\n logger?.emit('start', `Formatting with ${config.output.format}`)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Running prettier on ${path.resolve(definedConfig.root, definedConfig.output.path)}`],\n })\n\n try {\n await execa('prettier', ['--ignore-unknown', '--write', path.resolve(definedConfig.root, definedConfig.output.path)])\n logger?.emit('debug', {\n date: new Date(),\n logs: ['Prettier formatting completed successfully'],\n })\n } catch (e) {\n logger.consola?.warn('Prettier not found')\n logger.consola?.error(e)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Prettier formatting failed: ${(e as Error).message}`],\n })\n }\n\n logger?.emit('success', `Formatted with ${config.output.format}`)\n }\n\n if (config.output.format === 'biome') {\n logger?.emit('start', `Formatting with ${config.output.format}`)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Running biome format on ${path.resolve(definedConfig.root, definedConfig.output.path)}`],\n })\n\n try {\n await execa('biome', ['format', '--write', path.resolve(definedConfig.root, definedConfig.output.path)])\n logger?.emit('debug', {\n date: new Date(),\n logs: ['Biome formatting completed successfully'],\n })\n } catch (e) {\n logger.consola?.warn('Biome not found')\n logger.consola?.error(e)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Biome formatting failed: ${(e as Error).message}`],\n })\n }\n\n logger?.emit('success', `Formatted with ${config.output.format}`)\n }\n\n // linting\n if (config.output.lint === 'eslint') {\n logger?.emit('start', `Linting with ${config.output.lint}`)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Running eslint on ${path.resolve(definedConfig.root, definedConfig.output.path)}`],\n })\n\n try {\n await execa('eslint', [path.resolve(definedConfig.root, definedConfig.output.path), '--fix'])\n logger?.emit('debug', {\n date: new Date(),\n logs: ['ESLint linting completed successfully'],\n })\n } catch (e) {\n logger.consola?.warn('Eslint not found')\n logger.consola?.error(e)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`ESLint linting failed: ${(e as Error).message}`],\n })\n }\n\n logger?.emit('success', `Linted with ${config.output.lint}`)\n }\n\n if (config.output.lint === 'biome') {\n logger?.emit('start', `Linting with ${config.output.lint}`)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Running biome lint on ${path.resolve(definedConfig.root, definedConfig.output.path)}`],\n })\n\n try {\n await execa('biome', ['lint', '--fix', path.resolve(definedConfig.root, definedConfig.output.path)])\n logger?.emit('debug', {\n date: new Date(),\n logs: ['Biome linting completed successfully'],\n })\n } catch (e) {\n logger.consola?.warn('Biome not found')\n logger.consola?.error(e)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`✗ Biome linting failed: ${(e as Error).message}`],\n })\n }\n\n logger?.emit('success', `Linted with ${config.output.lint}`)\n }\n\n if (config.output.lint === 'oxlint') {\n logger?.emit('start', `Linting with ${config.output.lint}`)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`Running oxlint on ${path.resolve(definedConfig.root, definedConfig.output.path)}`],\n })\n\n try {\n await execa('oxlint', ['--fix', path.resolve(definedConfig.root, definedConfig.output.path)])\n logger?.emit('debug', {\n date: new Date(),\n logs: ['Oxlint linting completed successfully'],\n })\n } catch (e) {\n logger.consola?.warn('Oxlint not found')\n logger.consola?.error(e)\n logger?.emit('debug', {\n date: new Date(),\n logs: [`✗ Oxlint linting failed: ${(e as Error).message}`],\n })\n }\n\n logger?.emit('success', `Linted with ${config.output.lint}`)\n }\n\n if (config.hooks) {\n await executeHooks({ hooks: config.hooks, logger })\n }\n\n logger.consola?.log(`⚡ Build completed ${logger.logLevel !== LogMapper.silent ? pc.dim(inputPath!) : ''}`)\n logger.consola?.box({\n title: `${config.name || ''}`,\n message: summary.join(''),\n style: {\n padding: 2,\n borderColor: 'green',\n borderStyle: 'rounded',\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;AAMA,IAAa,kBAAb,cAAqCA,qBAAS;CAC5C;CACA;CACA,YAAY,SAAsC,SAAiB,MAAwB;AACzF,QAAM,KAAK;AAEX,OAAK,UAAU;AACf,OAAK,UAAU;;CAEjB,OAAO,OAAY,WAA2B,UAAgD;AAC5F,eAAQ,OAAO,MAAM,GAAGC,mBAAG,IAAI,OAAO,UAAU,CAAC,GAAG;AAEpD,YAAU;;;;;;ACLd,eAAsB,aAAa,EAAE,OAAO,UAA8C;CACxF,MAAM,WAAW,MAAM,QAAQ,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,MAAM,KAAK,CAAC,OAAO,QAAQ;AAEtF,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,kBAAkB,IAAI,gBAAgB,OAAO,SAAU,QAAQ;EACrE,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,0CAAyB,QAAQ,CAAC;AAE3D,MAAI,CAAC,IACH;AAGF,UAAQ,KAAK,SAAS,kBAAkB,OAAO,aAAaC,6BAAU,SAASC,mBAAG,IAAI,QAAQ,GAAG,KAAK;AAEtG,yBAAY,KAAK,OAAO;GACtB,UAAU;GACV,QAAQ,QAAQ,aAAaD,6BAAU,SAAS,SAAY,CAAC,QAAQ,gBAAgB;GACrF,mBAAmB;GACpB,CAAC;AAEF,UAAQ,KAAK,WAAW,iBAAiB,OAAO,aAAaA,6BAAU,SAASC,mBAAG,IAAI,QAAQ,GAAG,KAAK;;AAGzG,SAAQ,KAAK,WAAW,iBAAiB;;;;;ACnC3C,SAAgB,qBAAqB,QAAkC;AAEr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AU;AACnC,UAAQ,KAAK,SAAS,gBAAgB,OAAO,OAAO,OAAO;AAC3D,UAAQ,KAAK,SAAS;GACpB,sBAAM,IAAI,MAAM;GAChB,MAAM,CAAC,qBAAqBA,kBAAK,QAAQ,cAAc,MAAM,cAAc,OAAO,KAAK,GAAG;GAC3F,CAAC;AAEF,MAAI;AACF,0BAAY,UAAU,CAAC,SAASA,kBAAK,QAAQ,cAAc,MAAM,cAAc,OAAO,KAAK,CAAC,CAAC;AAC7F,WAAQ,KAAK,SAAS;IACpB,sBAAM,IAAI,MAAM;IAChB,MAAM,CAAC,wCAAwC;IAChD,CAAC;WACK,GAAG;AACV,UAAO,SAAS,KAAK,mBAAmB;AACxC,UAAO,SAAS,MAAM,EAAE;AACxB,WAAQ,KAAK,SAAS;IACpB,sBAAM,IAAI,MAAM;IAChB,MAAM,CAAC,4BAA6B,EAAY,UAAU;IAC3D,CAAC;;AAGJ,UAAQ,KAAK,WAAW,eAAe,OAAO,OAAO,OAAO;;AAG9D,KAAI,OAAO,MACT,OAAM,aAAa;EAAE,OAAO,OAAO;EAAO;EAAQ,CAAC;AAGrD,QAAO,SAAS,IAAI,qBAAqB,OAAO,aAAaL,6BAAU,SAASI,mBAAG,IAAI,UAAW,GAAG,KAAK;AAC1G,QAAO,SAAS,IAAI;EAClB,OAAO,GAAG,OAAO,QAAQ;EACzB,SAAS,QAAQ,KAAK,GAAG;EACzB,OAAO;GACL,SAAS;GACT,aAAa;GACb,aAAa;GACd;EACF,CAAC"}
@@ -1,225 +0,0 @@
1
- const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- let citty = require("citty");
3
- let node_path = require("node:path");
4
- node_path = require_chunk.__toESM(node_path);
5
- let node_process = require("node:process");
6
- node_process = require_chunk.__toESM(node_process);
7
- let __kubb_core = require("@kubb/core");
8
- let __kubb_core_logger = require("@kubb/core/logger");
9
- let picocolors = require("picocolors");
10
- picocolors = require_chunk.__toESM(picocolors);
11
- let __kubb_core_utils = require("@kubb/core/utils");
12
- let cosmiconfig = require("cosmiconfig");
13
- let jiti = require("jiti");
14
-
15
- //#region src/utils/getPlugins.ts
16
- function isJSONPlugins(plugins) {
17
- return !!plugins?.some((plugin) => {
18
- return Array.isArray(plugin) && typeof plugin?.at(0) === "string";
19
- });
20
- }
21
- function isObjectPlugins(plugins) {
22
- return plugins instanceof Object && !Array.isArray(plugins);
23
- }
24
- function getPlugins(plugins) {
25
- if (isObjectPlugins(plugins)) throw new Error("Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json");
26
- if (isJSONPlugins(plugins)) throw new Error("JSON plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json");
27
- return Promise.resolve(plugins);
28
- }
29
-
30
- //#endregion
31
- //#region src/utils/getConfig.ts
32
- /**
33
- * Converting UserConfig to Config without a change in the object beside the JSON convert.
34
- */
35
- async function getConfig(result, args) {
36
- const config = result?.config;
37
- let kubbUserConfig = Promise.resolve(config);
38
- if (typeof config === "function") {
39
- const possiblePromise = config(args);
40
- if ((0, __kubb_core_utils.isPromise)(possiblePromise)) kubbUserConfig = possiblePromise;
41
- kubbUserConfig = Promise.resolve(possiblePromise);
42
- }
43
- let JSONConfig = await kubbUserConfig;
44
- if (Array.isArray(JSONConfig)) {
45
- const results = [];
46
- for (const item of JSONConfig) {
47
- const plugins = item.plugins ? await getPlugins(item.plugins) : void 0;
48
- results.push({
49
- ...item,
50
- plugins
51
- });
52
- }
53
- return results;
54
- }
55
- JSONConfig = {
56
- ...JSONConfig,
57
- plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : void 0
58
- };
59
- return JSONConfig;
60
- }
61
-
62
- //#endregion
63
- //#region src/utils/getCosmiConfig.ts
64
- const tsLoader = async (configFile) => {
65
- return await (0, jiti.createJiti)(require("url").pathToFileURL(__filename).href, {
66
- jsx: {
67
- runtime: "automatic",
68
- importSource: "@kubb/react-fabric"
69
- },
70
- sourceMaps: true
71
- }).import(configFile, { default: true });
72
- };
73
- async function getCosmiConfig(moduleName, config) {
74
- const searchPlaces = [
75
- "package.json",
76
- `.${moduleName}rc`,
77
- `.${moduleName}rc.json`,
78
- `.${moduleName}rc.yaml`,
79
- `.${moduleName}rc.yml`,
80
- `.${moduleName}rc.ts`,
81
- `.${moduleName}rc.js`,
82
- `.${moduleName}rc.mjs`,
83
- `.${moduleName}rc.cjs`,
84
- `${moduleName}.config.ts`,
85
- `${moduleName}.config.js`,
86
- `${moduleName}.config.mjs`,
87
- `${moduleName}.config.cjs`
88
- ];
89
- const explorer = (0, cosmiconfig.cosmiconfig)(moduleName, {
90
- cache: false,
91
- searchPlaces: [
92
- ...searchPlaces.map((searchPlace) => {
93
- return `.config/${searchPlace}`;
94
- }),
95
- ...searchPlaces.map((searchPlace) => {
96
- return `configs/${searchPlace}`;
97
- }),
98
- ...searchPlaces
99
- ],
100
- loaders: { ".ts": tsLoader }
101
- });
102
- const result = config ? await explorer.load(config) : await explorer.search();
103
- 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");
104
- return result;
105
- }
106
-
107
- //#endregion
108
- //#region src/utils/watcher.ts
109
- async function startWatcher(path$1, cb) {
110
- const { watch } = await import("chokidar");
111
- const logger = (0, __kubb_core_logger.createLogger)();
112
- watch(path$1, {
113
- ignorePermissionErrors: true,
114
- ignored: "**/{.git,node_modules}/**"
115
- }).on("all", (type, file) => {
116
- logger?.emit("info", picocolors.default.yellow(picocolors.default.bold(`Change detected: ${type} ${file}`)));
117
- try {
118
- cb(path$1);
119
- } catch (_e) {
120
- logger?.emit("warning", picocolors.default.red("Watcher failed"));
121
- }
122
- });
123
- }
124
-
125
- //#endregion
126
- //#region src/commands/generate.ts
127
- const command = (0, citty.defineCommand)({
128
- meta: {
129
- name: "generate",
130
- description: "[input] Generate files based on a 'kubb.config.ts' file"
131
- },
132
- args: {
133
- config: {
134
- type: "string",
135
- description: "Path to the Kubb config",
136
- alias: "c"
137
- },
138
- logLevel: {
139
- type: "string",
140
- description: "Info, silent, verbose or debug",
141
- alias: "l",
142
- default: "info",
143
- valueHint: "silent|info|verbose|debug"
144
- },
145
- watch: {
146
- type: "boolean",
147
- description: "Watch mode based on the input file",
148
- alias: "w",
149
- default: false
150
- },
151
- debug: {
152
- type: "boolean",
153
- description: "Override logLevel to debug",
154
- alias: "d",
155
- default: false
156
- },
157
- verbose: {
158
- type: "boolean",
159
- description: "Override logLevel to verbose",
160
- alias: "v",
161
- default: false
162
- },
163
- help: {
164
- type: "boolean",
165
- description: "Show help",
166
- alias: "h",
167
- default: false
168
- }
169
- },
170
- async run(commandContext) {
171
- const progressCache = /* @__PURE__ */ new Map();
172
- const { args } = commandContext;
173
- const input = args._[0];
174
- if (args.help) return (0, citty.showUsage)(command);
175
- if (args.debug) args.logLevel = "debug";
176
- if (args.verbose) args.logLevel = "verbose";
177
- const logger = (0, __kubb_core_logger.createLogger)({ logLevel: __kubb_core_logger.LogMapper[args.logLevel] || 3 });
178
- const { generate } = await Promise.resolve().then(() => require("./generate-DpHvARzf.cjs"));
179
- logger.emit("start", "Loading config");
180
- const result = await getCosmiConfig("kubb", args.config);
181
- logger.emit("success", `Config loaded(${picocolors.default.dim(node_path.default.relative(node_process.cwd(), result.filepath))})`);
182
- const config = await getConfig(result, args);
183
- const start = async () => {
184
- if (Array.isArray(config)) {
185
- const promiseManager = new __kubb_core.PromiseManager();
186
- const promises = config.map((c) => () => {
187
- progressCache.clear();
188
- return generate({
189
- input,
190
- config: c,
191
- args,
192
- progressCache
193
- });
194
- });
195
- await promiseManager.run("seq", promises);
196
- return;
197
- }
198
- progressCache.clear();
199
- await generate({
200
- input,
201
- config,
202
- progressCache,
203
- args
204
- });
205
- };
206
- if (args.watch) {
207
- if (Array.isArray(config)) throw new Error("Cannot use watcher with multiple Configs(array)");
208
- if ((0, __kubb_core.isInputPath)(config)) return startWatcher([input || config.input.path], async (paths) => {
209
- await start();
210
- logger.emit("start", picocolors.default.yellow(picocolors.default.bold(`Watching for changes in ${paths.join(" and ")}`)));
211
- });
212
- }
213
- await start();
214
- if (globalThis.isDevtoolsEnabled) if (await logger.consola?.prompt("Restart(could be used to validate the profiler)?", {
215
- type: "confirm",
216
- initial: false
217
- })) await start();
218
- else node_process.exit(1);
219
- }
220
- });
221
- var generate_default = command;
222
-
223
- //#endregion
224
- exports.default = generate_default;
225
- //# sourceMappingURL=generate-KUqCSnZp.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-KUqCSnZp.cjs","names":["results: Array<Config>","path","pc","LogMapper","pc","path","process","PromiseManager"],"sources":["../src/utils/getPlugins.ts","../src/utils/getConfig.ts","../src/utils/getCosmiConfig.ts","../src/utils/watcher.ts","../src/commands/generate.ts"],"sourcesContent":["import type { UserConfig } from '@kubb/core'\n\nfunction isJSONPlugins(plugins: UserConfig['plugins']) {\n return !!(plugins as any)?.some((plugin: any) => {\n return Array.isArray(plugin) && typeof plugin?.at(0) === 'string'\n })\n}\n\nfunction isObjectPlugins(plugins: UserConfig['plugins']): plugins is any {\n return plugins instanceof Object && !Array.isArray(plugins)\n}\n\nexport function getPlugins(plugins: UserConfig['plugins']): Promise<UserConfig['plugins']> {\n if (isObjectPlugins(plugins)) {\n throw new Error('Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n if (isJSONPlugins(plugins)) {\n throw new Error('JSON plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n return Promise.resolve(plugins)\n}\n","import type { CLIOptions, Config, UserConfig } from '@kubb/core'\nimport { isPromise } from '@kubb/core/utils'\nimport type { Args } from '../commands/generate.ts'\nimport type { CosmiconfigResult } from './getCosmiConfig.ts'\nimport { getPlugins } from './getPlugins.ts'\n\n/**\n * Converting UserConfig to Config without a change in the object beside the JSON convert.\n */\nexport async function getConfig(result: CosmiconfigResult, args: Args): Promise<Array<Config> | Config> {\n const config = result?.config\n let kubbUserConfig = Promise.resolve(config) as Promise<UserConfig | Array<UserConfig>>\n\n // for ts or js files\n if (typeof config === 'function') {\n const possiblePromise = config(args as CLIOptions)\n if (isPromise(possiblePromise)) {\n kubbUserConfig = possiblePromise\n }\n kubbUserConfig = Promise.resolve(possiblePromise)\n }\n\n let JSONConfig = await kubbUserConfig\n\n if (Array.isArray(JSONConfig)) {\n const results: Array<Config> = []\n\n for (const item of JSONConfig) {\n const plugins = item.plugins ? await getPlugins(item.plugins) : undefined\n\n results.push({\n ...item,\n plugins,\n } as Config)\n }\n\n return results\n }\n\n JSONConfig = {\n ...JSONConfig,\n plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : undefined,\n }\n\n return JSONConfig as Config\n}\n","import type { defineConfig, UserConfig } from '@kubb/core'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { createJiti } from 'jiti'\n\nexport type CosmiconfigResult = {\n filepath: string\n isEmpty?: boolean\n config: ReturnType<typeof defineConfig> | UserConfig\n}\n\nconst tsLoader = async (configFile: string) => {\n const jiti = createJiti(import.meta.url, {\n jsx: {\n runtime: 'automatic',\n importSource: '@kubb/react-fabric',\n },\n sourceMaps: true,\n })\n\n const mod = await jiti.import(configFile, { default: true })\n\n return mod\n}\n\nexport async function getCosmiConfig(moduleName: string, config?: string): Promise<CosmiconfigResult> {\n const searchPlaces = [\n 'package.json',\n `.${moduleName}rc`,\n `.${moduleName}rc.json`,\n `.${moduleName}rc.yaml`,\n `.${moduleName}rc.yml`,\n\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.js`,\n `.${moduleName}rc.mjs`,\n `.${moduleName}rc.cjs`,\n\n `${moduleName}.config.ts`,\n `${moduleName}.config.js`,\n `${moduleName}.config.mjs`,\n `${moduleName}.config.cjs`,\n ]\n const explorer = cosmiconfig(moduleName, {\n cache: false,\n searchPlaces: [\n ...searchPlaces.map((searchPlace) => {\n return `.config/${searchPlace}`\n }),\n ...searchPlaces.map((searchPlace) => {\n return `configs/${searchPlace}`\n }),\n ...searchPlaces,\n ],\n loaders: {\n '.ts': tsLoader,\n },\n })\n\n const result = config ? await explorer.load(config) : await explorer.search()\n\n if (result?.isEmpty || !result || !result.config) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n return result as CosmiconfigResult\n}\n","import { createLogger } from '@kubb/core/logger'\nimport pc from 'picocolors'\n\nexport async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>): Promise<void> {\n const { watch } = await import('chokidar')\n const logger = createLogger()\n\n const ignored = '**/{.git,node_modules}/**'\n\n const watcher = watch(path, {\n ignorePermissionErrors: true,\n ignored,\n })\n watcher.on('all', (type, file) => {\n logger?.emit('info', pc.yellow(pc.bold(`Change detected: ${type} ${file}`)))\n\n try {\n cb(path)\n } catch (_e) {\n logger?.emit('warning', pc.red('Watcher failed'))\n }\n })\n}\n","import path from 'node:path'\nimport * as process from 'node:process'\nimport { isInputPath, PromiseManager } from '@kubb/core'\nimport { createLogger, LogMapper } from '@kubb/core/logger'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport type { SingleBar } from 'cli-progress'\nimport pc from 'picocolors'\nimport { getConfig } from '../utils/getConfig.ts'\nimport { getCosmiConfig } from '../utils/getCosmiConfig.ts'\nimport { startWatcher } from '../utils/watcher.ts'\n\ndeclare global {\n var isDevtoolsEnabled: any\n}\n\nconst args = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n alias: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n alias: 'l',\n default: 'info',\n valueHint: 'silent|info|verbose|debug',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n alias: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n alias: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n alias: 'v',\n default: false,\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'generate',\n description: \"[input] Generate files based on a 'kubb.config.ts' file\",\n },\n args,\n async run(commandContext) {\n const progressCache = new Map<string, SingleBar>()\n\n const { args } = commandContext\n\n const input = args._[0]\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.debug) {\n args.logLevel = 'debug'\n }\n\n if (args.verbose) {\n args.logLevel = 'verbose'\n }\n\n const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3\n const logger = createLogger({\n logLevel,\n })\n const { generate } = await import('../runners/generate.ts')\n\n logger.emit('start', 'Loading config')\n\n const result = await getCosmiConfig('kubb', args.config)\n logger.emit('success', `Config loaded(${pc.dim(path.relative(process.cwd(), result.filepath))})`)\n\n const config = await getConfig(result, args)\n\n const start = async () => {\n if (Array.isArray(config)) {\n const promiseManager = new PromiseManager()\n const promises = config.map((c) => () => {\n progressCache.clear()\n\n return generate({\n input,\n config: c,\n args,\n progressCache,\n })\n })\n\n await promiseManager.run('seq', promises)\n return\n }\n\n progressCache.clear()\n\n await generate({\n input,\n config,\n progressCache,\n args,\n })\n\n return\n }\n\n if (args.watch) {\n if (Array.isArray(config)) {\n throw new Error('Cannot use watcher with multiple Configs(array)')\n }\n\n if (isInputPath(config)) {\n return startWatcher([input || config.input.path], async (paths) => {\n await start()\n logger.emit('start', pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))\n })\n }\n }\n\n await start()\n\n if (globalThis.isDevtoolsEnabled) {\n const canRestart = await logger.consola?.prompt('Restart(could be used to validate the profiler)?', {\n type: 'confirm',\n initial: false,\n })\n\n if (canRestart) {\n await start()\n } else {\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;;;;;AAEA,SAAS,cAAc,SAAgC;AACrD,QAAO,CAAC,CAAE,SAAiB,MAAM,WAAgB;AAC/C,SAAO,MAAM,QAAQ,OAAO,IAAI,OAAO,QAAQ,GAAG,EAAE,KAAK;GACzD;;AAGJ,SAAS,gBAAgB,SAAgD;AACv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AI,WAAW,kBAMb,KALmB,MAAM,OAAO,SAAS,OAAO,oDAAoD;GAClG,MAAM;GACN,SAAS;GACV,CAAC,CAGA,OAAM,OAAO;MAEb,cAAQ,KAAK,EAAE;;CAItB,CAAC;AAEF,uBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-BIRDY8xn.js","names":["mod: any"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport consola from 'consola'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n consola.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n }\n\n const { startServer } = mod\n try {\n consola.start('Starting MCP server...')\n consola.warn(pc.yellow('This feature is still under development — use with caution'))\n await startServer()\n } catch (e) {\n consola.error((e as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;AAMA,MAAM,OAAO,WAAW,OAAO,KAAK,KAAK,EACvC,YAAY,MACb,CAAC;AAaF,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAhBW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,QAAO,UAAU,QAAQ;EAG3B,IAAIA;AACJ,MAAI;AACF,SAAM,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,WAAQ,MAAM,yBAAyB;AACvC,WAAQ,KAAK,GAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,GAAG;AACV,WAAQ,MAAO,GAAa,QAAQ;;;CAGzC,CAAC;AAEF,kBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-BQjDRDXR.cjs","names":["jiti","mod: any","pc"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport consola from 'consola'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n consola.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n }\n\n const { startServer } = mod\n try {\n consola.start('Starting MCP server...')\n consola.warn(pc.yellow('This feature is still under development — use with caution'))\n await startServer()\n } catch (e) {\n consola.error((e as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;AAMA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAaF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAhBW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;EAG3B,IAAIC;AACJ,MAAI;AACF,SAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,mBAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,mBAAQ,MAAM,yBAAyB;AACvC,mBAAQ,KAAKE,mBAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,GAAG;AACV,mBAAQ,MAAO,GAAa,QAAQ;;;CAGzC,CAAC;AAEF,kBAAe"}