unplugin-kubb 5.0.0-beta.8 → 5.0.0-beta.80

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 (76) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +26 -22
  3. package/dist/astro.cjs +1 -1
  4. package/dist/astro.cjs.map +1 -1
  5. package/dist/astro.d.ts +1 -1
  6. package/dist/astro.js +1 -1
  7. package/dist/astro.js.map +1 -1
  8. package/dist/esbuild.cjs +1 -1
  9. package/dist/esbuild.cjs.map +1 -1
  10. package/dist/esbuild.d.ts +2 -3
  11. package/dist/esbuild.js +1 -1
  12. package/dist/esbuild.js.map +1 -1
  13. package/dist/farm.cjs +1 -1
  14. package/dist/farm.cjs.map +1 -1
  15. package/dist/farm.d.ts +2 -3
  16. package/dist/farm.js +1 -1
  17. package/dist/farm.js.map +1 -1
  18. package/dist/index.cjs +2 -2
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +3 -4
  21. package/dist/index.js +2 -2
  22. package/dist/index.js.map +1 -1
  23. package/dist/nuxt.cjs +1 -1
  24. package/dist/nuxt.cjs.map +1 -1
  25. package/dist/nuxt.d.ts +2 -4
  26. package/dist/nuxt.js +1 -1
  27. package/dist/nuxt.js.map +1 -1
  28. package/dist/rolldown.cjs +1 -1
  29. package/dist/rolldown.cjs.map +1 -1
  30. package/dist/rolldown.d.ts +2 -3
  31. package/dist/rolldown.js +1 -1
  32. package/dist/rolldown.js.map +1 -1
  33. package/dist/rollup.cjs +1 -1
  34. package/dist/rollup.cjs.map +1 -1
  35. package/dist/rollup.d.ts +2 -3
  36. package/dist/rollup.js +1 -1
  37. package/dist/rollup.js.map +1 -1
  38. package/dist/rspack.cjs +1 -1
  39. package/dist/rspack.cjs.map +1 -1
  40. package/dist/rspack.d.ts +1 -1
  41. package/dist/rspack.js +1 -1
  42. package/dist/rspack.js.map +1 -1
  43. package/dist/types.d.ts +1 -1
  44. package/dist/{unpluginFactory-C6bn1VpG.cjs → unpluginFactory-Be74tpl2.cjs} +55 -57
  45. package/dist/unpluginFactory-Be74tpl2.cjs.map +1 -0
  46. package/dist/{unpluginFactory-BfKlC2IE.js → unpluginFactory-DmtZbrGb.js} +57 -53
  47. package/dist/unpluginFactory-DmtZbrGb.js.map +1 -0
  48. package/dist/unpluginFactory.cjs +1 -1
  49. package/dist/unpluginFactory.d.ts +8 -1
  50. package/dist/unpluginFactory.js +1 -1
  51. package/dist/vite.cjs +1 -1
  52. package/dist/vite.cjs.map +1 -1
  53. package/dist/vite.d.ts +2 -3
  54. package/dist/vite.js +1 -1
  55. package/dist/vite.js.map +1 -1
  56. package/dist/webpack.cjs +1 -1
  57. package/dist/webpack.cjs.map +1 -1
  58. package/dist/webpack.d.ts +1 -1
  59. package/dist/webpack.js +1 -1
  60. package/dist/webpack.js.map +1 -1
  61. package/package.json +16 -16
  62. package/dist/unpluginFactory-BfKlC2IE.js.map +0 -1
  63. package/dist/unpluginFactory-C6bn1VpG.cjs.map +0 -1
  64. package/src/astro.ts +0 -12
  65. package/src/esbuild.ts +0 -5
  66. package/src/farm.ts +0 -5
  67. package/src/index.ts +0 -10
  68. package/src/nuxt.ts +0 -20
  69. package/src/rolldown.ts +0 -5
  70. package/src/rollup.ts +0 -5
  71. package/src/rspack.ts +0 -5
  72. package/src/types.ts +0 -8
  73. package/src/unpluginFactory.ts +0 -164
  74. package/src/vite.ts +0 -5
  75. package/src/webpack.ts +0 -7
  76. /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
@@ -29,7 +29,7 @@ node_process = __toESM(node_process, 1);
29
29
  let node_events = require("node:events");
30
30
  let _kubb_adapter_oas = require("@kubb/adapter-oas");
31
31
  let _kubb_core = require("@kubb/core");
32
- let _kubb_middleware_barrel = require("@kubb/middleware-barrel");
32
+ let _kubb_plugin_barrel = require("@kubb/plugin-barrel");
33
33
  let _kubb_parser_ts = require("@kubb/parser-ts");
34
34
  //#region ../../internals/utils/src/errors.ts
35
35
  /**
@@ -77,9 +77,12 @@ var AsyncEventEmitter = class {
77
77
  * await emitter.emit('build', 'petstore')
78
78
  * ```
79
79
  */
80
- async emit(eventName, ...eventArgs) {
80
+ emit(eventName, ...eventArgs) {
81
81
  const listeners = this.#emitter.listeners(eventName);
82
82
  if (listeners.length === 0) return;
83
+ return this.#emitAll(eventName, listeners, eventArgs);
84
+ }
85
+ async #emitAll(eventName, listeners, eventArgs) {
83
86
  for (const listener of listeners) try {
84
87
  await listener(...eventArgs);
85
88
  } catch (err) {
@@ -104,21 +107,6 @@ var AsyncEventEmitter = class {
104
107
  this.#emitter.on(eventName, handler);
105
108
  }
106
109
  /**
107
- * Registers a one-shot listener that removes itself after the first invocation.
108
- *
109
- * @example
110
- * ```ts
111
- * emitter.onOnce('build', async (name) => { console.log(name) })
112
- * ```
113
- */
114
- onOnce(eventName, handler) {
115
- const wrapper = (...args) => {
116
- this.off(eventName, wrapper);
117
- return handler(...args);
118
- };
119
- this.on(eventName, wrapper);
120
- }
121
- /**
122
110
  * Removes a previously registered listener.
123
111
  *
124
112
  * @example
@@ -142,6 +130,18 @@ var AsyncEventEmitter = class {
142
130
  return this.#emitter.listenerCount(eventName);
143
131
  }
144
132
  /**
133
+ * Raises or lowers the per-event listener ceiling before Node warns about a memory leak.
134
+ * Set this above the expected listener count when many listeners attach by design.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * emitter.setMaxListeners(40)
139
+ * ```
140
+ */
141
+ setMaxListeners(max) {
142
+ this.#emitter.setMaxListeners(max);
143
+ }
144
+ /**
145
145
  * Removes all listeners from every event channel.
146
146
  *
147
147
  * @example
@@ -155,9 +155,16 @@ var AsyncEventEmitter = class {
155
155
  };
156
156
  //#endregion
157
157
  //#region package.json
158
- var version = "5.0.0-beta.8";
158
+ var version = "5.0.0-beta.80";
159
159
  //#endregion
160
160
  //#region src/unpluginFactory.ts
161
+ /**
162
+ * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).
163
+ *
164
+ * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs
165
+ * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS
166
+ * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.
167
+ */
161
168
  const unpluginFactory = (options, meta) => {
162
169
  const name = "unplugin-kubb";
163
170
  const hooks = new AsyncEventEmitter();
@@ -184,66 +191,63 @@ const unpluginFactory = (options, meta) => {
184
191
  hooks.on("kubb:files:processing:end", () => {
185
192
  console.log("✓ Files written successfully");
186
193
  });
187
- hooks.on("kubb:generation:end", ({ config }) => {
194
+ hooks.on("kubb:generation:end", ({ config, status, diagnostics }) => {
188
195
  console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
189
- });
190
- hooks.on("kubb:generation:summary", ({ config, status, failedPlugins }) => {
196
+ if (!diagnostics || !status) return;
197
+ const failedCount = _kubb_core.Diagnostics.failedPlugins(diagnostics).length;
191
198
  const pluginsCount = config.plugins.length;
192
- const successCount = pluginsCount - failedPlugins.size;
193
- console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`);
199
+ const successCount = pluginsCount - failedCount;
200
+ console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`);
194
201
  });
195
202
  async function runBuild(ctx) {
196
203
  if (!options?.config) {
197
- if (ctx.error) ctx.error?.(`[${name}] Config is not set`);
198
- else console.error(`[${name}] Config is not set`);
204
+ (ctx.error ?? console.error)(`[${name}] Config is not set`);
199
205
  return;
200
206
  }
201
- const middleware = options.config.middleware?.length ? options.config.middleware : [(0, _kubb_middleware_barrel.middlewareBarrel)()];
202
- const hasBarrelMiddleware = middleware.some((m) => m.name === _kubb_middleware_barrel.middlewareBarrelName);
207
+ const plugins = options.config.plugins?.some((p) => p.name === _kubb_plugin_barrel.pluginBarrelName) ? options.config.plugins ?? [] : [...options.config.plugins ?? [], (0, _kubb_plugin_barrel.pluginBarrel)()];
208
+ const hasBarrelPlugin = plugins.some((p) => p.name === _kubb_plugin_barrel.pluginBarrelName);
203
209
  const output = { ...options.config.output };
204
- if (hasBarrelMiddleware && output.barrel === void 0) output.barrel = { type: "named" };
210
+ if (hasBarrelPlugin && output.barrel === void 0) output.barrel = { type: "named" };
205
211
  if (output.format === void 0) output.format = false;
206
212
  if (output.lint === void 0) output.lint = false;
207
213
  const config = {
208
214
  ...options.config,
209
215
  adapter: options.config.adapter ?? (0, _kubb_adapter_oas.adapterOas)(),
210
216
  parsers: options.config.parsers?.length ? options.config.parsers : [_kubb_parser_ts.parserTs, _kubb_parser_ts.parserTsx],
211
- middleware,
217
+ plugins,
212
218
  output
213
219
  };
214
220
  const hrStart = node_process.default.hrtime();
215
221
  await hooks.emit("kubb:lifecycle:start", { version });
216
- const userConfig = config;
217
- const kubb = (0, _kubb_core.createKubb)(userConfig, { hooks });
222
+ const kubb = (0, _kubb_core.createKubb)(config, { hooks });
218
223
  await kubb.setup();
219
- const resolvedConfig = kubb.config ?? userConfig;
220
- await hooks.emit("kubb:generation:start", { config: resolvedConfig });
221
- const { error, failedPlugins, pluginTimings, files, sources } = await kubb.safeBuild();
222
- const hasFailures = failedPlugins.size > 0 || error;
223
- if (hasFailures) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
224
- hooks.emit("kubb:error", { error: err });
225
- });
224
+ await hooks.emit("kubb:generation:start", { config: kubb.config });
225
+ const { diagnostics, files, storage } = await kubb.safeBuild();
226
+ const hasFailures = _kubb_core.Diagnostics.hasError(diagnostics);
227
+ for (const diagnostic of diagnostics) {
228
+ if (!_kubb_core.Diagnostics.isProblem(diagnostic)) continue;
229
+ if (diagnostic.severity === "error") hooks.emit("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
230
+ else if (diagnostic.severity === "warning") hooks.emit("kubb:warn", { message: diagnostic.message });
231
+ else hooks.emit("kubb:info", { message: diagnostic.message });
232
+ }
226
233
  await hooks.emit("kubb:generation:end", {
227
- config: resolvedConfig,
228
- files,
229
- sources
230
- });
231
- await hooks.emit("kubb:generation:summary", {
232
- config: resolvedConfig,
233
- failedPlugins,
234
+ config: kubb.config,
235
+ storage,
236
+ diagnostics,
234
237
  filesCreated: files.length,
235
- status: failedPlugins.size > 0 || error ? "failed" : "success",
236
- hrStart,
237
- pluginTimings
238
+ status: hasFailures ? "failed" : "success",
239
+ hrStart
238
240
  });
239
241
  await hooks.emit("kubb:lifecycle:end");
240
242
  if (hasFailures) {
241
- const message = error?.message ?? `Build Error with ${failedPlugins.size} failed plugins`;
243
+ const failedCount = _kubb_core.Diagnostics.failedPlugins(diagnostics).length;
244
+ const firstError = diagnostics.filter(_kubb_core.Diagnostics.isProblem).find((diagnostic) => diagnostic.severity === "error");
245
+ const message = failedCount > 0 ? `Build Error with ${failedCount} failed plugins` : firstError?.message ?? "Build failed";
242
246
  if (ctx.error) {
243
247
  ctx.error(`[${name}] ${message}`);
244
248
  return;
245
249
  }
246
- throw new Error(`[${name}] ${message}`, { cause: error });
250
+ throw new Error(`[${name}] ${message}`, { cause: firstError?.cause });
247
251
  }
248
252
  }
249
253
  return {
@@ -263,12 +267,6 @@ Object.defineProperty(exports, "__name", {
263
267
  return __name;
264
268
  }
265
269
  });
266
- Object.defineProperty(exports, "__toESM", {
267
- enumerable: true,
268
- get: function() {
269
- return __toESM;
270
- }
271
- });
272
270
  Object.defineProperty(exports, "unpluginFactory", {
273
271
  enumerable: true,
274
272
  get: function() {
@@ -276,4 +274,4 @@ Object.defineProperty(exports, "unpluginFactory", {
276
274
  }
277
275
  });
278
276
 
279
- //# sourceMappingURL=unpluginFactory-C6bn1VpG.cjs.map
277
+ //# sourceMappingURL=unpluginFactory-Be74tpl2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpluginFactory-Be74tpl2.cjs","names":["#emitter","NodeEventEmitter","#emitAll","Diagnostics","pluginBarrelName","parserTs","parserTsx","process","unpluginVersion","userConfig"],"sources":["../../../internals/utils/src/errors.ts","../../../internals/utils/src/asyncEventEmitter.ts","../package.json","../src/unpluginFactory.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n","import { EventEmitter as NodeEventEmitter } from 'node:events'\nimport { toError } from './errors.ts'\n\n/**\n * A function that can be registered as an event listener, synchronous or async.\n */\ntype AsyncListener<TArgs extends Array<unknown>> = (...args: TArgs) => void | Promise<void>\n\n/**\n * Typed `EventEmitter` that awaits all async listeners before resolving.\n * Wraps Node's `EventEmitter` with full TypeScript event-map inference.\n *\n * @example\n * ```ts\n * const emitter = new AsyncEventEmitter<{ build: [name: string] }>()\n * emitter.on('build', async (name) => { console.log(name) })\n * await emitter.emit('build', 'petstore') // all listeners awaited\n * ```\n */\nexport class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: Array<unknown> }> {\n /**\n * Maximum number of listeners per event before Node emits a memory-leak warning.\n * @default 10\n */\n constructor(maxListener = 10) {\n this.#emitter.setMaxListeners(maxListener)\n }\n\n #emitter = new NodeEventEmitter()\n\n /**\n * Emits `eventName` and awaits all registered listeners sequentially.\n * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.\n *\n * @example\n * ```ts\n * await emitter.emit('build', 'petstore')\n * ```\n */\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> | void {\n const listeners = this.#emitter.listeners(eventName) as Array<AsyncListener<TEvents[TEventName]>>\n\n if (listeners.length === 0) {\n return\n }\n\n return this.#emitAll(eventName, listeners, eventArgs)\n }\n\n async #emitAll<TEventName extends keyof TEvents & string>(\n eventName: TEventName,\n listeners: Array<AsyncListener<TEvents[TEventName]>>,\n eventArgs: TEvents[TEventName],\n ): Promise<void> {\n for (const listener of listeners) {\n try {\n await listener(...eventArgs)\n } catch (err) {\n let serializedArgs: string\n try {\n serializedArgs = JSON.stringify(eventArgs)\n } catch {\n serializedArgs = String(eventArgs)\n }\n throw new Error(`Error in async listener for \"${eventName}\" with eventArgs ${serializedArgs}`, { cause: toError(err) })\n }\n }\n }\n\n /**\n * Registers a persistent listener for `eventName`.\n *\n * @example\n * ```ts\n * emitter.on('build', async (name) => { console.log(name) })\n * ```\n */\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.on(eventName, handler as AsyncListener<Array<unknown>>)\n }\n\n /**\n * Removes a previously registered listener.\n *\n * @example\n * ```ts\n * emitter.off('build', handler)\n * ```\n */\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.off(eventName, handler as AsyncListener<Array<unknown>>)\n }\n\n /**\n * Returns the number of listeners registered for `eventName`.\n *\n * @example\n * ```ts\n * emitter.on('build', handler)\n * emitter.listenerCount('build') // 1\n * ```\n */\n listenerCount<TEventName extends keyof TEvents & string>(eventName: TEventName): number {\n return this.#emitter.listenerCount(eventName)\n }\n\n /**\n * Raises or lowers the per-event listener ceiling before Node warns about a memory leak.\n * Set this above the expected listener count when many listeners attach by design.\n *\n * @example\n * ```ts\n * emitter.setMaxListeners(40)\n * ```\n */\n setMaxListeners(max: number): void {\n this.#emitter.setMaxListeners(max)\n }\n\n /**\n * Removes all listeners from every event channel.\n *\n * @example\n * ```ts\n * emitter.removeAll()\n * ```\n */\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n","","import process from 'node:process'\nimport { AsyncEventEmitter } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport { type Config, createKubb, Diagnostics, type KubbHooks } from '@kubb/core'\nimport { pluginBarrel, pluginBarrelName } from '@kubb/plugin-barrel'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\nimport type { UnpluginFactory } from 'unplugin'\nimport { version as unpluginVersion } from '../package.json'\nimport type { Options } from './types.ts'\n\ntype RollupContext = {\n info?: (message: string) => void\n warn?: (message: string) => void\n error?: (message: string) => void\n}\n\n/**\n * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).\n *\n * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs\n * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS\n * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.\n */\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options, meta) => {\n const name = 'unplugin-kubb' as const\n const hooks = new AsyncEventEmitter<KubbHooks>()\n const isVite = meta.framework === 'vite'\n\n hooks.on('kubb:lifecycle:start', ({ version }) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n hooks.on('kubb:error', ({ error }) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n hooks.on('kubb:warn', ({ message }) => {\n console.warn(`⚠ ${message}`)\n })\n\n hooks.on('kubb:info', ({ message }) => {\n console.info(`ℹ ${message}`)\n })\n\n hooks.on('kubb:success', ({ message }) => {\n console.log(`✓ ${message}`)\n })\n\n hooks.on('kubb:plugin:end', ({ plugin, duration }) => {\n const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`\n\n console.log(`✓ ${plugin.name} completed in ${durationStr}`)\n })\n\n hooks.on('kubb:files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n hooks.on('kubb:generation:end', ({ config, status, diagnostics }) => {\n console.log(config.name ? `✓ Generation completed for ${config.name}` : '✓ Generation completed')\n\n if (!diagnostics || !status) return\n\n const failedCount = Diagnostics.failedPlugins(diagnostics).length\n const pluginsCount = config.plugins.length\n const successCount = pluginsCount - failedCount\n\n console.log(\n status === 'success'\n ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total`\n : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`,\n )\n })\n\n async function runBuild(ctx: RollupContext) {\n if (!options?.config) {\n ;(ctx.error ?? console.error)(`[${name}] Config is not set`)\n return\n }\n\n const alreadyHasBarrel = options.config.plugins?.some((p) => p.name === pluginBarrelName)\n const plugins = alreadyHasBarrel ? (options.config.plugins ?? []) : [...(options.config.plugins ?? []), pluginBarrel()]\n const hasBarrelPlugin = plugins.some((p) => p.name === pluginBarrelName)\n const output = { ...options.config.output }\n if (hasBarrelPlugin && output.barrel === undefined) {\n output.barrel = { type: 'named' }\n }\n if (output.format === undefined) {\n output.format = false\n }\n if (output.lint === undefined) {\n output.lint = false\n }\n\n const config = {\n ...options.config,\n adapter: options.config.adapter ?? adapterOas(),\n parsers: options.config.parsers?.length ? options.config.parsers : [parserTs, parserTsx],\n plugins,\n output,\n }\n const hrStart = process.hrtime()\n\n await hooks.emit('kubb:lifecycle:start', { version: unpluginVersion })\n\n const userConfig = config as Config\n\n const kubb = createKubb(userConfig, { hooks })\n await kubb.setup()\n\n await hooks.emit('kubb:generation:start', { config: kubb.config })\n\n const { diagnostics, files, storage } = await kubb.safeBuild()\n\n const hasFailures = Diagnostics.hasError(diagnostics)\n\n // Surface every problem by severity. Unplugin has no diagnostic renderer, so route\n // errors/warnings/info to the channels it does listen on. Non-problem diagnostics are skipped.\n for (const diagnostic of diagnostics) {\n if (!Diagnostics.isProblem(diagnostic)) {\n continue\n }\n if (diagnostic.severity === 'error') {\n hooks.emit('kubb:error', { error: diagnostic.cause ?? new Error(diagnostic.message) })\n } else if (diagnostic.severity === 'warning') {\n hooks.emit('kubb:warn', { message: diagnostic.message })\n } else {\n hooks.emit('kubb:info', { message: diagnostic.message })\n }\n }\n\n await hooks.emit('kubb:generation:end', {\n config: kubb.config,\n storage,\n diagnostics,\n filesCreated: files.length,\n status: hasFailures ? 'failed' : 'success',\n hrStart,\n })\n\n await hooks.emit('kubb:lifecycle:end')\n\n if (hasFailures) {\n const failedCount = Diagnostics.failedPlugins(diagnostics).length\n const firstError = diagnostics.filter(Diagnostics.isProblem).find((diagnostic) => diagnostic.severity === 'error')\n const message = failedCount > 0 ? `Build Error with ${failedCount} failed plugins` : (firstError?.message ?? 'Build failed')\n if (ctx.error) {\n ctx.error(`[${name}] ${message}`)\n return\n }\n\n throw new Error(`[${name}] ${message}`, { cause: firstError?.cause })\n }\n }\n\n return {\n name,\n enforce: 'pre',\n apply: isVite ? 'build' : undefined,\n async buildStart() {\n await runBuild(this as unknown as RollupContext)\n },\n vite: {},\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QA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AAM,KAAK,aAAa,EAAE,SAAS,WAAW,QAAQ,CAAC;QAEvD,MAAM,KAAK,aAAa,EAAE,SAAS,WAAW,QAAQ,CAAC;EAE3D;EAEA,MAAM,MAAM,KAAK,uBAAuB;GACtC,QAAQ,KAAK;GACb;GACA;GACA,cAAc,MAAM;GACpB,QAAQ,cAAc,WAAW;GACjC;EACF,CAAC;EAED,MAAM,MAAM,KAAK,oBAAoB;EAErC,IAAI,aAAa;GACf,MAAM,cAAcA,WAAAA,YAAY,cAAc,WAAW,CAAC,CAAC;GAC3D,MAAM,aAAa,YAAY,OAAOA,WAAAA,YAAY,SAAS,CAAC,CAAC,MAAM,eAAe,WAAW,aAAa,OAAO;GACjH,MAAM,UAAU,cAAc,IAAI,oBAAoB,YAAY,mBAAoB,YAAY,WAAW;GAC7G,IAAI,IAAI,OAAO;IACb,IAAI,MAAM,IAAI,KAAK,IAAI,SAAS;IAChC;GACF;GAEA,MAAM,IAAI,MAAM,IAAI,KAAK,IAAI,WAAW,EAAE,OAAO,YAAY,MAAM,CAAC;EACtE;CACF;CAEA,OAAO;EACL;EACA,SAAS;EACT,OAAO,SAAS,UAAU,KAAA;EAC1B,MAAM,aAAa;GACjB,MAAM,SAAS,IAAgC;EACjD;EACA,MAAM,CAAC;CACT;AACF"}
@@ -1,9 +1,9 @@
1
- import "./chunk--u3MIqq1.js";
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
2
  import process from "node:process";
3
3
  import { EventEmitter } from "node:events";
4
4
  import { adapterOas } from "@kubb/adapter-oas";
5
- import { createKubb } from "@kubb/core";
6
- import { middlewareBarrel, middlewareBarrelName } from "@kubb/middleware-barrel";
5
+ import { Diagnostics, createKubb } from "@kubb/core";
6
+ import { pluginBarrel, pluginBarrelName } from "@kubb/plugin-barrel";
7
7
  import { parserTs, parserTsx } from "@kubb/parser-ts";
8
8
  //#region ../../internals/utils/src/errors.ts
9
9
  /**
@@ -51,9 +51,12 @@ var AsyncEventEmitter = class {
51
51
  * await emitter.emit('build', 'petstore')
52
52
  * ```
53
53
  */
54
- async emit(eventName, ...eventArgs) {
54
+ emit(eventName, ...eventArgs) {
55
55
  const listeners = this.#emitter.listeners(eventName);
56
56
  if (listeners.length === 0) return;
57
+ return this.#emitAll(eventName, listeners, eventArgs);
58
+ }
59
+ async #emitAll(eventName, listeners, eventArgs) {
57
60
  for (const listener of listeners) try {
58
61
  await listener(...eventArgs);
59
62
  } catch (err) {
@@ -78,21 +81,6 @@ var AsyncEventEmitter = class {
78
81
  this.#emitter.on(eventName, handler);
79
82
  }
80
83
  /**
81
- * Registers a one-shot listener that removes itself after the first invocation.
82
- *
83
- * @example
84
- * ```ts
85
- * emitter.onOnce('build', async (name) => { console.log(name) })
86
- * ```
87
- */
88
- onOnce(eventName, handler) {
89
- const wrapper = (...args) => {
90
- this.off(eventName, wrapper);
91
- return handler(...args);
92
- };
93
- this.on(eventName, wrapper);
94
- }
95
- /**
96
84
  * Removes a previously registered listener.
97
85
  *
98
86
  * @example
@@ -116,6 +104,18 @@ var AsyncEventEmitter = class {
116
104
  return this.#emitter.listenerCount(eventName);
117
105
  }
118
106
  /**
107
+ * Raises or lowers the per-event listener ceiling before Node warns about a memory leak.
108
+ * Set this above the expected listener count when many listeners attach by design.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * emitter.setMaxListeners(40)
113
+ * ```
114
+ */
115
+ setMaxListeners(max) {
116
+ this.#emitter.setMaxListeners(max);
117
+ }
118
+ /**
119
119
  * Removes all listeners from every event channel.
120
120
  *
121
121
  * @example
@@ -129,9 +129,16 @@ var AsyncEventEmitter = class {
129
129
  };
130
130
  //#endregion
131
131
  //#region package.json
132
- var version = "5.0.0-beta.8";
132
+ var version = "5.0.0-beta.80";
133
133
  //#endregion
134
134
  //#region src/unpluginFactory.ts
135
+ /**
136
+ * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).
137
+ *
138
+ * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs
139
+ * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS
140
+ * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.
141
+ */
135
142
  const unpluginFactory = (options, meta) => {
136
143
  const name = "unplugin-kubb";
137
144
  const hooks = new AsyncEventEmitter();
@@ -158,66 +165,63 @@ const unpluginFactory = (options, meta) => {
158
165
  hooks.on("kubb:files:processing:end", () => {
159
166
  console.log("✓ Files written successfully");
160
167
  });
161
- hooks.on("kubb:generation:end", ({ config }) => {
168
+ hooks.on("kubb:generation:end", ({ config, status, diagnostics }) => {
162
169
  console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
163
- });
164
- hooks.on("kubb:generation:summary", ({ config, status, failedPlugins }) => {
170
+ if (!diagnostics || !status) return;
171
+ const failedCount = Diagnostics.failedPlugins(diagnostics).length;
165
172
  const pluginsCount = config.plugins.length;
166
- const successCount = pluginsCount - failedPlugins.size;
167
- console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`);
173
+ const successCount = pluginsCount - failedCount;
174
+ console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`);
168
175
  });
169
176
  async function runBuild(ctx) {
170
177
  if (!options?.config) {
171
- if (ctx.error) ctx.error?.(`[${name}] Config is not set`);
172
- else console.error(`[${name}] Config is not set`);
178
+ (ctx.error ?? console.error)(`[${name}] Config is not set`);
173
179
  return;
174
180
  }
175
- const middleware = options.config.middleware?.length ? options.config.middleware : [middlewareBarrel()];
176
- const hasBarrelMiddleware = middleware.some((m) => m.name === middlewareBarrelName);
181
+ const plugins = options.config.plugins?.some((p) => p.name === pluginBarrelName) ? options.config.plugins ?? [] : [...options.config.plugins ?? [], pluginBarrel()];
182
+ const hasBarrelPlugin = plugins.some((p) => p.name === pluginBarrelName);
177
183
  const output = { ...options.config.output };
178
- if (hasBarrelMiddleware && output.barrel === void 0) output.barrel = { type: "named" };
184
+ if (hasBarrelPlugin && output.barrel === void 0) output.barrel = { type: "named" };
179
185
  if (output.format === void 0) output.format = false;
180
186
  if (output.lint === void 0) output.lint = false;
181
187
  const config = {
182
188
  ...options.config,
183
189
  adapter: options.config.adapter ?? adapterOas(),
184
190
  parsers: options.config.parsers?.length ? options.config.parsers : [parserTs, parserTsx],
185
- middleware,
191
+ plugins,
186
192
  output
187
193
  };
188
194
  const hrStart = process.hrtime();
189
195
  await hooks.emit("kubb:lifecycle:start", { version });
190
- const userConfig = config;
191
- const kubb = createKubb(userConfig, { hooks });
196
+ const kubb = createKubb(config, { hooks });
192
197
  await kubb.setup();
193
- const resolvedConfig = kubb.config ?? userConfig;
194
- await hooks.emit("kubb:generation:start", { config: resolvedConfig });
195
- const { error, failedPlugins, pluginTimings, files, sources } = await kubb.safeBuild();
196
- const hasFailures = failedPlugins.size > 0 || error;
197
- if (hasFailures) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
198
- hooks.emit("kubb:error", { error: err });
199
- });
198
+ await hooks.emit("kubb:generation:start", { config: kubb.config });
199
+ const { diagnostics, files, storage } = await kubb.safeBuild();
200
+ const hasFailures = Diagnostics.hasError(diagnostics);
201
+ for (const diagnostic of diagnostics) {
202
+ if (!Diagnostics.isProblem(diagnostic)) continue;
203
+ if (diagnostic.severity === "error") hooks.emit("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
204
+ else if (diagnostic.severity === "warning") hooks.emit("kubb:warn", { message: diagnostic.message });
205
+ else hooks.emit("kubb:info", { message: diagnostic.message });
206
+ }
200
207
  await hooks.emit("kubb:generation:end", {
201
- config: resolvedConfig,
202
- files,
203
- sources
204
- });
205
- await hooks.emit("kubb:generation:summary", {
206
- config: resolvedConfig,
207
- failedPlugins,
208
+ config: kubb.config,
209
+ storage,
210
+ diagnostics,
208
211
  filesCreated: files.length,
209
- status: failedPlugins.size > 0 || error ? "failed" : "success",
210
- hrStart,
211
- pluginTimings
212
+ status: hasFailures ? "failed" : "success",
213
+ hrStart
212
214
  });
213
215
  await hooks.emit("kubb:lifecycle:end");
214
216
  if (hasFailures) {
215
- const message = error?.message ?? `Build Error with ${failedPlugins.size} failed plugins`;
217
+ const failedCount = Diagnostics.failedPlugins(diagnostics).length;
218
+ const firstError = diagnostics.filter(Diagnostics.isProblem).find((diagnostic) => diagnostic.severity === "error");
219
+ const message = failedCount > 0 ? `Build Error with ${failedCount} failed plugins` : firstError?.message ?? "Build failed";
216
220
  if (ctx.error) {
217
221
  ctx.error(`[${name}] ${message}`);
218
222
  return;
219
223
  }
220
- throw new Error(`[${name}] ${message}`, { cause: error });
224
+ throw new Error(`[${name}] ${message}`, { cause: firstError?.cause });
221
225
  }
222
226
  }
223
227
  return {
@@ -233,4 +237,4 @@ const unpluginFactory = (options, meta) => {
233
237
  //#endregion
234
238
  export { unpluginFactory as t };
235
239
 
236
- //# sourceMappingURL=unpluginFactory-BfKlC2IE.js.map
240
+ //# sourceMappingURL=unpluginFactory-DmtZbrGb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpluginFactory-DmtZbrGb.js","names":["#emitter","NodeEventEmitter","#emitAll","unpluginVersion","userConfig"],"sources":["../../../internals/utils/src/errors.ts","../../../internals/utils/src/asyncEventEmitter.ts","../package.json","../src/unpluginFactory.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n","import { EventEmitter as NodeEventEmitter } from 'node:events'\nimport { toError } from './errors.ts'\n\n/**\n * A function that can be registered as an event listener, synchronous or async.\n */\ntype AsyncListener<TArgs extends Array<unknown>> = (...args: TArgs) => void | Promise<void>\n\n/**\n * Typed `EventEmitter` that awaits all async listeners before resolving.\n * Wraps Node's `EventEmitter` with full TypeScript event-map inference.\n *\n * @example\n * ```ts\n * const emitter = new AsyncEventEmitter<{ build: [name: string] }>()\n * emitter.on('build', async (name) => { console.log(name) })\n * await emitter.emit('build', 'petstore') // all listeners awaited\n * ```\n */\nexport class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: Array<unknown> }> {\n /**\n * Maximum number of listeners per event before Node emits a memory-leak warning.\n * @default 10\n */\n constructor(maxListener = 10) {\n this.#emitter.setMaxListeners(maxListener)\n }\n\n #emitter = new NodeEventEmitter()\n\n /**\n * Emits `eventName` and awaits all registered listeners sequentially.\n * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.\n *\n * @example\n * ```ts\n * await emitter.emit('build', 'petstore')\n * ```\n */\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> | void {\n const listeners = this.#emitter.listeners(eventName) as Array<AsyncListener<TEvents[TEventName]>>\n\n if (listeners.length === 0) {\n return\n }\n\n return this.#emitAll(eventName, listeners, eventArgs)\n }\n\n async #emitAll<TEventName extends keyof TEvents & string>(\n eventName: TEventName,\n listeners: Array<AsyncListener<TEvents[TEventName]>>,\n eventArgs: TEvents[TEventName],\n ): Promise<void> {\n for (const listener of listeners) {\n try {\n await listener(...eventArgs)\n } catch (err) {\n let serializedArgs: string\n try {\n serializedArgs = JSON.stringify(eventArgs)\n } catch {\n serializedArgs = String(eventArgs)\n }\n throw new Error(`Error in async listener for \"${eventName}\" with eventArgs ${serializedArgs}`, { cause: toError(err) })\n }\n }\n }\n\n /**\n * Registers a persistent listener for `eventName`.\n *\n * @example\n * ```ts\n * emitter.on('build', async (name) => { console.log(name) })\n * ```\n */\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.on(eventName, handler as AsyncListener<Array<unknown>>)\n }\n\n /**\n * Removes a previously registered listener.\n *\n * @example\n * ```ts\n * emitter.off('build', handler)\n * ```\n */\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.off(eventName, handler as AsyncListener<Array<unknown>>)\n }\n\n /**\n * Returns the number of listeners registered for `eventName`.\n *\n * @example\n * ```ts\n * emitter.on('build', handler)\n * emitter.listenerCount('build') // 1\n * ```\n */\n listenerCount<TEventName extends keyof TEvents & string>(eventName: TEventName): number {\n return this.#emitter.listenerCount(eventName)\n }\n\n /**\n * Raises or lowers the per-event listener ceiling before Node warns about a memory leak.\n * Set this above the expected listener count when many listeners attach by design.\n *\n * @example\n * ```ts\n * emitter.setMaxListeners(40)\n * ```\n */\n setMaxListeners(max: number): void {\n this.#emitter.setMaxListeners(max)\n }\n\n /**\n * Removes all listeners from every event channel.\n *\n * @example\n * ```ts\n * emitter.removeAll()\n * ```\n */\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n","","import process from 'node:process'\nimport { AsyncEventEmitter } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport { type Config, createKubb, Diagnostics, type KubbHooks } from '@kubb/core'\nimport { pluginBarrel, pluginBarrelName } from '@kubb/plugin-barrel'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\nimport type { UnpluginFactory } from 'unplugin'\nimport { version as unpluginVersion } from '../package.json'\nimport type { Options } from './types.ts'\n\ntype RollupContext = {\n info?: (message: string) => void\n warn?: (message: string) => void\n error?: (message: string) => void\n}\n\n/**\n * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).\n *\n * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs\n * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS\n * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.\n */\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options, meta) => {\n const name = 'unplugin-kubb' as const\n const hooks = new AsyncEventEmitter<KubbHooks>()\n const isVite = meta.framework === 'vite'\n\n hooks.on('kubb:lifecycle:start', ({ version }) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n hooks.on('kubb:error', ({ error }) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n hooks.on('kubb:warn', ({ message }) => {\n console.warn(`⚠ ${message}`)\n })\n\n hooks.on('kubb:info', ({ message }) => {\n console.info(`ℹ ${message}`)\n })\n\n hooks.on('kubb:success', ({ message }) => {\n console.log(`✓ ${message}`)\n })\n\n hooks.on('kubb:plugin:end', ({ plugin, duration }) => {\n const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`\n\n console.log(`✓ ${plugin.name} completed in ${durationStr}`)\n })\n\n hooks.on('kubb:files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n hooks.on('kubb:generation:end', ({ config, status, diagnostics }) => {\n console.log(config.name ? `✓ Generation completed for ${config.name}` : '✓ Generation completed')\n\n if (!diagnostics || !status) return\n\n const failedCount = Diagnostics.failedPlugins(diagnostics).length\n const pluginsCount = config.plugins.length\n const successCount = pluginsCount - failedCount\n\n console.log(\n status === 'success'\n ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total`\n : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`,\n )\n })\n\n async function runBuild(ctx: RollupContext) {\n if (!options?.config) {\n ;(ctx.error ?? console.error)(`[${name}] Config is not set`)\n return\n }\n\n const alreadyHasBarrel = options.config.plugins?.some((p) => p.name === pluginBarrelName)\n const plugins = alreadyHasBarrel ? (options.config.plugins ?? []) : [...(options.config.plugins ?? []), pluginBarrel()]\n const hasBarrelPlugin = plugins.some((p) => p.name === pluginBarrelName)\n const output = { ...options.config.output }\n if (hasBarrelPlugin && output.barrel === undefined) {\n output.barrel = { type: 'named' }\n }\n if (output.format === undefined) {\n output.format = false\n }\n if (output.lint === undefined) {\n output.lint = false\n }\n\n const config = {\n ...options.config,\n adapter: options.config.adapter ?? adapterOas(),\n parsers: options.config.parsers?.length ? options.config.parsers : [parserTs, parserTsx],\n plugins,\n output,\n }\n const hrStart = process.hrtime()\n\n await hooks.emit('kubb:lifecycle:start', { version: unpluginVersion })\n\n const userConfig = config as Config\n\n const kubb = createKubb(userConfig, { hooks })\n await kubb.setup()\n\n await hooks.emit('kubb:generation:start', { config: kubb.config })\n\n const { diagnostics, files, storage } = await kubb.safeBuild()\n\n const hasFailures = Diagnostics.hasError(diagnostics)\n\n // Surface every problem by severity. Unplugin has no diagnostic renderer, so route\n // errors/warnings/info to the channels it does listen on. Non-problem diagnostics are skipped.\n for (const diagnostic of diagnostics) {\n if (!Diagnostics.isProblem(diagnostic)) {\n continue\n }\n if (diagnostic.severity === 'error') {\n hooks.emit('kubb:error', { error: diagnostic.cause ?? new Error(diagnostic.message) })\n } else if (diagnostic.severity === 'warning') {\n hooks.emit('kubb:warn', { message: diagnostic.message })\n } else {\n hooks.emit('kubb:info', { message: diagnostic.message })\n }\n }\n\n await hooks.emit('kubb:generation:end', {\n config: kubb.config,\n storage,\n diagnostics,\n filesCreated: files.length,\n status: hasFailures ? 'failed' : 'success',\n hrStart,\n })\n\n await hooks.emit('kubb:lifecycle:end')\n\n if (hasFailures) {\n const failedCount = Diagnostics.failedPlugins(diagnostics).length\n const firstError = diagnostics.filter(Diagnostics.isProblem).find((diagnostic) => diagnostic.severity === 'error')\n const message = failedCount > 0 ? `Build Error with ${failedCount} failed plugins` : (firstError?.message ?? 'Build failed')\n if (ctx.error) {\n ctx.error(`[${name}] ${message}`)\n return\n }\n\n throw new Error(`[${name}] ${message}`, { cause: firstError?.cause })\n }\n }\n\n return {\n name,\n enforce: 'pre',\n apply: isVite ? 'build' : undefined,\n async buildStart() {\n await runBuild(this as unknown as RollupContext)\n },\n vite: {},\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE;;;;;;;;;;;;;;ACbA,IAAa,oBAAb,MAAyF;;;;;CAKvF,YAAY,cAAc,IAAI;EAC5B,KAAKA,SAAS,gBAAgB,WAAW;CAC3C;CAEA,WAAW,IAAIC,aAAiB;;;;;;;;;;CAWhC,KAAgD,WAAuB,GAAG,WAAsD;EAC9H,MAAM,YAAY,KAAKD,SAAS,UAAU,SAAS;EAEnD,IAAI,UAAU,WAAW,GACvB;EAGF,OAAO,KAAKE,SAAS,WAAW,WAAW,SAAS;CACtD;CAEA,MAAMA,SACJ,WACA,WACA,WACe;EACf,KAAK,MAAM,YAAY,WACrB,IAAI;GACF,MAAM,SAAS,GAAG,SAAS;EAC7B,SAAS,KAAK;GACZ,IAAI;GACJ,IAAI;IACF,iBAAiB,KAAK,UAAU,SAAS;GAC3C,QAA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OAAO,SAAS,UAAU,KAAA;EAC1B,MAAM,aAAa;GACjB,MAAM,SAAS,IAAgC;EACjD;EACA,MAAM,CAAC;CACT;AACF"}
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_unpluginFactory = require("./unpluginFactory-C6bn1VpG.cjs");
2
+ const require_unpluginFactory = require("./unpluginFactory-Be74tpl2.cjs");
3
3
  exports.unpluginFactory = require_unpluginFactory.unpluginFactory;
@@ -1,8 +1,15 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
2
  import { Options } from "./types.js";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
5
5
  //#region src/unpluginFactory.d.ts
6
+ /**
7
+ * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).
8
+ *
9
+ * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs
10
+ * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS
11
+ * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.
12
+ */
6
13
  declare const unpluginFactory: UnpluginFactory<Options | undefined>;
7
14
  //#endregion
8
15
  export { unpluginFactory };
@@ -1,2 +1,2 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-BfKlC2IE.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-DmtZbrGb.js";
2
2
  export { unpluginFactory };
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-C6bn1VpG.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-Be74tpl2.cjs");
2
2
  //#region src/vite.ts
3
3
  var vite_default = (0, require("unplugin").createVitePlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/vite.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;AAIA,IAAA,gBAAA,sBAAA,CAAA,kBAAgCA,wBAAAA,gBAAgB"}
1
+ {"version":3,"file":"vite.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;AAIA,IAAA,gBAAA,qBAAA,CAAA,CAAA,iBAAA,CAAgCA,wBAAAA,eAAe"}
package/dist/vite.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
2
  import { Options } from "./types.js";
3
- import * as _$vite from "vite";
4
3
 
5
4
  //#region src/vite.d.ts
6
- declare const _default: (options?: Options | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
7
6
  //#endregion
8
7
  export { _default as default };
9
8
  //# sourceMappingURL=vite.d.ts.map
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-BfKlC2IE.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-DmtZbrGb.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
  //#region src/vite.ts
4
4
  var vite_default = createVitePlugin(unpluginFactory);
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;AAIA,IAAA,eAAe,iBAAiB,gBAAgB"}
1
+ {"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;AAIA,IAAA,eAAe,iBAAiB,eAAe"}
package/dist/webpack.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-C6bn1VpG.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-Be74tpl2.cjs");
2
2
  //#region src/webpack.ts
3
3
  var webpack_default = (0, require("unplugin").createWebpackPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;AAMA,IAAA,mBAAA,sBAAA,CAAA,qBAAmCA,wBAAAA,gBAAgB"}
1
+ {"version":3,"file":"webpack.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;AAMA,IAAA,mBAAA,qBAAA,CAAA,CAAA,oBAAA,CAAmCA,wBAAAA,eAAe"}
package/dist/webpack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
2
  import { Options } from "./types.js";
3
3
  import { UnpluginFactoryOutput } from "unplugin";
4
4
  import { WebpackPluginInstance } from "webpack";
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-BfKlC2IE.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-DmtZbrGb.js";
2
2
  import { createWebpackPlugin } from "unplugin";
3
3
  //#region src/webpack.ts
4
4
  var webpack_default = createWebpackPlugin(unpluginFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;AAMA,IAAA,kBAAe,oBAAoB,gBAAgB"}
1
+ {"version":3,"file":"webpack.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;AAMA,IAAA,kBAAe,oBAAoB,eAAe"}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "unplugin-kubb",
3
- "version": "5.0.0-beta.8",
4
- "description": "Universal build integration for Kubb using unplugin. Plug OpenAPI code generation into Vite, Webpack, Rollup, esbuild, Rspack, Nuxt, and Astro as part of your regular build pipeline.",
3
+ "version": "5.0.0-beta.80",
4
+ "description": "Integration of Kubb for Vite, Webpack, Rollup, esbuild, Rspack, Nuxt, and Astro.",
5
5
  "keywords": [
6
6
  "astro",
7
7
  "codegen",
8
8
  "esbuild",
9
9
  "farm",
10
10
  "kubb",
11
+ "meta-framework",
11
12
  "nuxt",
12
- "openapi",
13
13
  "rollup",
14
14
  "rspack",
15
15
  "typescript",
@@ -25,7 +25,6 @@
25
25
  "directory": "packages/unplugin"
26
26
  },
27
27
  "files": [
28
- "src",
29
28
  "dist",
30
29
  "!/**/**.test.**",
31
30
  "!/**/__tests__/**",
@@ -100,21 +99,21 @@
100
99
  "registry": "https://registry.npmjs.org/"
101
100
  },
102
101
  "dependencies": {
103
- "unplugin": "^3.0.0",
104
- "@kubb/adapter-oas": "5.0.0-beta.8",
105
- "@kubb/core": "5.0.0-beta.8",
106
- "@kubb/parser-ts": "5.0.0-beta.8",
107
- "@kubb/middleware-barrel": "5.0.0-beta.8"
102
+ "unplugin": "^3.3.0",
103
+ "@kubb/adapter-oas": "5.0.0-beta.80",
104
+ "@kubb/core": "5.0.0-beta.80",
105
+ "@kubb/parser-ts": "5.0.0-beta.80",
106
+ "@kubb/plugin-barrel": "5.0.0-beta.80"
108
107
  },
109
108
  "devDependencies": {
110
109
  "@farmfe/core": "^1.7.11",
111
- "@nuxt/kit": "^4.4.4",
112
- "@nuxt/schema": "^4.4.4",
113
- "esbuild": "^0.28.0",
114
- "rolldown": "1.0.0-rc.16",
115
- "rollup": "^4.60.3",
116
- "vite": "^8.0.11",
117
- "webpack": "^5.106.2",
110
+ "@nuxt/kit": "^4.4.8",
111
+ "@nuxt/schema": "^4.4.8",
112
+ "esbuild": "^0.28.1",
113
+ "rolldown": "^1.1.3",
114
+ "rollup": "^4.62.2",
115
+ "vite": "^8.1.0",
116
+ "webpack": "^5.108.1",
118
117
  "@internals/utils": "0.0.0"
119
118
  },
120
119
  "peerDependencies": {
@@ -164,6 +163,7 @@
164
163
  "lint:fix": "oxlint --fix .",
165
164
  "release": "pnpm publish --no-git-check",
166
165
  "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
166
+ "release:stage": "pnpm stage publish --no-git-check",
167
167
  "start": "tsdown --watch",
168
168
  "test": "vitest --passWithNoTests",
169
169
  "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"