unplugin-kubb 5.0.0-beta.7 → 5.0.0-beta.71

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-BE8J68DF.js → unpluginFactory-C1Wjp2uf.js} +63 -44
  45. package/dist/unpluginFactory-C1Wjp2uf.js.map +1 -0
  46. package/dist/{unpluginFactory-D905egzB.cjs → unpluginFactory-eSez3Ud9.cjs} +61 -48
  47. package/dist/unpluginFactory-eSez3Ud9.cjs.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 +15 -15
  62. package/dist/unpluginFactory-BE8J68DF.js.map +0 -1
  63. package/dist/unpluginFactory-D905egzB.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 -170
  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
@@ -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) {
@@ -116,6 +119,24 @@ var AsyncEventEmitter = class {
116
119
  return this.#emitter.listenerCount(eventName);
117
120
  }
118
121
  /**
122
+ * Raises or lowers the per-event listener ceiling before Node warns about a memory leak.
123
+ * Set this above the expected listener count when many listeners attach by design.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * emitter.setMaxListeners(40)
128
+ * ```
129
+ */
130
+ setMaxListeners(max) {
131
+ this.#emitter.setMaxListeners(max);
132
+ }
133
+ /**
134
+ * Returns the current per-event listener ceiling.
135
+ */
136
+ getMaxListeners() {
137
+ return this.#emitter.getMaxListeners();
138
+ }
139
+ /**
119
140
  * Removes all listeners from every event channel.
120
141
  *
121
142
  * @example
@@ -129,9 +150,16 @@ var AsyncEventEmitter = class {
129
150
  };
130
151
  //#endregion
131
152
  //#region package.json
132
- var version = "5.0.0-beta.7";
153
+ var version = "5.0.0-beta.71";
133
154
  //#endregion
134
155
  //#region src/unpluginFactory.ts
156
+ /**
157
+ * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).
158
+ *
159
+ * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs
160
+ * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS
161
+ * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.
162
+ */
135
163
  const unpluginFactory = (options, meta) => {
136
164
  const name = "unplugin-kubb";
137
165
  const hooks = new AsyncEventEmitter();
@@ -158,72 +186,63 @@ const unpluginFactory = (options, meta) => {
158
186
  hooks.on("kubb:files:processing:end", () => {
159
187
  console.log("✓ Files written successfully");
160
188
  });
161
- hooks.on("kubb:generation:end", ({ config }) => {
189
+ hooks.on("kubb:generation:end", ({ config, status, diagnostics }) => {
162
190
  console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
163
- });
164
- hooks.on("kubb:generation:summary", ({ config, status, failedPlugins }) => {
191
+ if (!diagnostics || !status) return;
192
+ const failedCount = Diagnostics.failedPlugins(diagnostics).length;
165
193
  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`);
194
+ const successCount = pluginsCount - failedCount;
195
+ console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`);
168
196
  });
169
197
  async function runBuild(ctx) {
170
198
  if (!options?.config) {
171
- if (ctx.error) ctx.error?.(`[${name}] Config is not set`);
172
- else console.error(`[${name}] Config is not set`);
199
+ (ctx.error ?? console.error)(`[${name}] Config is not set`);
173
200
  return;
174
201
  }
175
- const middleware = options.config.middleware?.length ? options.config.middleware : [middlewareBarrel()];
176
- const hasBarrelMiddleware = middleware.some((m) => m.name === middlewareBarrelName);
202
+ const plugins = options.config.plugins?.some((p) => p.name === pluginBarrelName) ? options.config.plugins ?? [] : [...options.config.plugins ?? [], pluginBarrel()];
203
+ const hasBarrelPlugin = plugins.some((p) => p.name === pluginBarrelName);
177
204
  const output = { ...options.config.output };
178
- if (hasBarrelMiddleware && output.barrel === void 0) output.barrel = { type: "named" };
205
+ if (hasBarrelPlugin && output.barrel === void 0) output.barrel = { type: "named" };
179
206
  if (output.format === void 0) output.format = false;
180
207
  if (output.lint === void 0) output.lint = false;
181
208
  const config = {
182
209
  ...options.config,
183
210
  adapter: options.config.adapter ?? adapterOas(),
184
211
  parsers: options.config.parsers?.length ? options.config.parsers : [parserTs, parserTsx],
185
- middleware,
212
+ plugins,
186
213
  output
187
214
  };
188
215
  const hrStart = process.hrtime();
189
216
  await hooks.emit("kubb:lifecycle:start", { version });
190
- const userConfig = config;
191
- const kubb = createKubb({
192
- ...userConfig,
193
- output: {
194
- write: true,
195
- ...userConfig.output
196
- }
197
- }, { hooks });
217
+ const kubb = createKubb(config, { hooks });
198
218
  await kubb.setup();
199
- const resolvedConfig = kubb.config ?? userConfig;
200
- await hooks.emit("kubb:generation:start", { config: resolvedConfig });
201
- const { error, failedPlugins, pluginTimings, files, sources } = await kubb.safeBuild();
202
- const hasFailures = failedPlugins.size > 0 || error;
203
- if (hasFailures) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
204
- hooks.emit("kubb:error", { error: err });
205
- });
219
+ await hooks.emit("kubb:generation:start", { config: kubb.config });
220
+ const { diagnostics, files, storage } = await kubb.safeBuild();
221
+ const hasFailures = Diagnostics.hasError(diagnostics);
222
+ for (const diagnostic of diagnostics) {
223
+ if (!Diagnostics.isProblem(diagnostic)) continue;
224
+ if (diagnostic.severity === "error") hooks.emit("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
225
+ else if (diagnostic.severity === "warning") hooks.emit("kubb:warn", { message: diagnostic.message });
226
+ else hooks.emit("kubb:info", { message: diagnostic.message });
227
+ }
206
228
  await hooks.emit("kubb:generation:end", {
207
- config: resolvedConfig,
208
- files,
209
- sources
210
- });
211
- await hooks.emit("kubb:generation:summary", {
212
- config: resolvedConfig,
213
- failedPlugins,
229
+ config: kubb.config,
230
+ storage,
231
+ diagnostics,
214
232
  filesCreated: files.length,
215
- status: failedPlugins.size > 0 || error ? "failed" : "success",
216
- hrStart,
217
- pluginTimings
233
+ status: hasFailures ? "failed" : "success",
234
+ hrStart
218
235
  });
219
236
  await hooks.emit("kubb:lifecycle:end");
220
237
  if (hasFailures) {
221
- const message = error?.message ?? `Build Error with ${failedPlugins.size} failed plugins`;
238
+ const failedCount = Diagnostics.failedPlugins(diagnostics).length;
239
+ const firstError = diagnostics.filter(Diagnostics.isProblem).find((diagnostic) => diagnostic.severity === "error");
240
+ const message = failedCount > 0 ? `Build Error with ${failedCount} failed plugins` : firstError?.message ?? "Build failed";
222
241
  if (ctx.error) {
223
242
  ctx.error(`[${name}] ${message}`);
224
243
  return;
225
244
  }
226
- throw new Error(`[${name}] ${message}`, { cause: error });
245
+ throw new Error(`[${name}] ${message}`, { cause: firstError?.cause });
227
246
  }
228
247
  }
229
248
  return {
@@ -239,4 +258,4 @@ const unpluginFactory = (options, meta) => {
239
258
  //#endregion
240
259
  export { unpluginFactory as t };
241
260
 
242
- //# sourceMappingURL=unpluginFactory-BE8J68DF.js.map
261
+ //# sourceMappingURL=unpluginFactory-C1Wjp2uf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpluginFactory-C1Wjp2uf.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 * Registers a one-shot listener that removes itself after the first invocation.\n *\n * @example\n * ```ts\n * emitter.onOnce('build', async (name) => { console.log(name) })\n * ```\n */\n onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n const wrapper: AsyncListener<TEvents[TEventName]> = (...args) => {\n this.off(eventName, wrapper)\n return handler(...args)\n }\n this.on(eventName, wrapper)\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 * Returns the current per-event listener ceiling.\n */\n getMaxListeners(): number {\n return this.#emitter.getMaxListeners()\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,MAA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C,QAAQ,KAAK;GACb;GACA;GACA,cAAc,MAAM;GACpB,QAAQ,cAAc,WAAW;GACjC;EACF,CAAC;EAED,MAAM,MAAM,KAAK,oBAAoB;EAErC,IAAI,aAAa;GACf,MAAM,cAAc,YAAY,cAAc,WAAW,CAAC,CAAC;GAC3D,MAAM,aAAa,YAAY,OAAO,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"}
@@ -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) {
@@ -142,6 +145,24 @@ var AsyncEventEmitter = class {
142
145
  return this.#emitter.listenerCount(eventName);
143
146
  }
144
147
  /**
148
+ * Raises or lowers the per-event listener ceiling before Node warns about a memory leak.
149
+ * Set this above the expected listener count when many listeners attach by design.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * emitter.setMaxListeners(40)
154
+ * ```
155
+ */
156
+ setMaxListeners(max) {
157
+ this.#emitter.setMaxListeners(max);
158
+ }
159
+ /**
160
+ * Returns the current per-event listener ceiling.
161
+ */
162
+ getMaxListeners() {
163
+ return this.#emitter.getMaxListeners();
164
+ }
165
+ /**
145
166
  * Removes all listeners from every event channel.
146
167
  *
147
168
  * @example
@@ -155,9 +176,16 @@ var AsyncEventEmitter = class {
155
176
  };
156
177
  //#endregion
157
178
  //#region package.json
158
- var version = "5.0.0-beta.7";
179
+ var version = "5.0.0-beta.71";
159
180
  //#endregion
160
181
  //#region src/unpluginFactory.ts
182
+ /**
183
+ * Builds the Kubb unplugin for any unplugin-supported bundler (Vite, Rollup, Webpack, esbuild).
184
+ *
185
+ * Registers hook handlers that log lifecycle, diagnostics, and a per-plugin summary, then runs
186
+ * the Kubb build during `buildStart`. When the config omits them, it fills in defaults: the OAS
187
+ * adapter, the TS and TSX parsers, and a barrel plugin. Under Vite it only applies during `build`.
188
+ */
161
189
  const unpluginFactory = (options, meta) => {
162
190
  const name = "unplugin-kubb";
163
191
  const hooks = new AsyncEventEmitter();
@@ -184,72 +212,63 @@ const unpluginFactory = (options, meta) => {
184
212
  hooks.on("kubb:files:processing:end", () => {
185
213
  console.log("✓ Files written successfully");
186
214
  });
187
- hooks.on("kubb:generation:end", ({ config }) => {
215
+ hooks.on("kubb:generation:end", ({ config, status, diagnostics }) => {
188
216
  console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
189
- });
190
- hooks.on("kubb:generation:summary", ({ config, status, failedPlugins }) => {
217
+ if (!diagnostics || !status) return;
218
+ const failedCount = _kubb_core.Diagnostics.failedPlugins(diagnostics).length;
191
219
  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`);
220
+ const successCount = pluginsCount - failedCount;
221
+ console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`);
194
222
  });
195
223
  async function runBuild(ctx) {
196
224
  if (!options?.config) {
197
- if (ctx.error) ctx.error?.(`[${name}] Config is not set`);
198
- else console.error(`[${name}] Config is not set`);
225
+ (ctx.error ?? console.error)(`[${name}] Config is not set`);
199
226
  return;
200
227
  }
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);
228
+ const plugins = options.config.plugins?.some((p) => p.name === _kubb_plugin_barrel.pluginBarrelName) ? options.config.plugins ?? [] : [...options.config.plugins ?? [], (0, _kubb_plugin_barrel.pluginBarrel)()];
229
+ const hasBarrelPlugin = plugins.some((p) => p.name === _kubb_plugin_barrel.pluginBarrelName);
203
230
  const output = { ...options.config.output };
204
- if (hasBarrelMiddleware && output.barrel === void 0) output.barrel = { type: "named" };
231
+ if (hasBarrelPlugin && output.barrel === void 0) output.barrel = { type: "named" };
205
232
  if (output.format === void 0) output.format = false;
206
233
  if (output.lint === void 0) output.lint = false;
207
234
  const config = {
208
235
  ...options.config,
209
236
  adapter: options.config.adapter ?? (0, _kubb_adapter_oas.adapterOas)(),
210
237
  parsers: options.config.parsers?.length ? options.config.parsers : [_kubb_parser_ts.parserTs, _kubb_parser_ts.parserTsx],
211
- middleware,
238
+ plugins,
212
239
  output
213
240
  };
214
241
  const hrStart = node_process.default.hrtime();
215
242
  await hooks.emit("kubb:lifecycle:start", { version });
216
- const userConfig = config;
217
- const kubb = (0, _kubb_core.createKubb)({
218
- ...userConfig,
219
- output: {
220
- write: true,
221
- ...userConfig.output
222
- }
223
- }, { hooks });
243
+ const kubb = (0, _kubb_core.createKubb)(config, { hooks });
224
244
  await kubb.setup();
225
- const resolvedConfig = kubb.config ?? userConfig;
226
- await hooks.emit("kubb:generation:start", { config: resolvedConfig });
227
- const { error, failedPlugins, pluginTimings, files, sources } = await kubb.safeBuild();
228
- const hasFailures = failedPlugins.size > 0 || error;
229
- if (hasFailures) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
230
- hooks.emit("kubb:error", { error: err });
231
- });
245
+ await hooks.emit("kubb:generation:start", { config: kubb.config });
246
+ const { diagnostics, files, storage } = await kubb.safeBuild();
247
+ const hasFailures = _kubb_core.Diagnostics.hasError(diagnostics);
248
+ for (const diagnostic of diagnostics) {
249
+ if (!_kubb_core.Diagnostics.isProblem(diagnostic)) continue;
250
+ if (diagnostic.severity === "error") hooks.emit("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
251
+ else if (diagnostic.severity === "warning") hooks.emit("kubb:warn", { message: diagnostic.message });
252
+ else hooks.emit("kubb:info", { message: diagnostic.message });
253
+ }
232
254
  await hooks.emit("kubb:generation:end", {
233
- config: resolvedConfig,
234
- files,
235
- sources
236
- });
237
- await hooks.emit("kubb:generation:summary", {
238
- config: resolvedConfig,
239
- failedPlugins,
255
+ config: kubb.config,
256
+ storage,
257
+ diagnostics,
240
258
  filesCreated: files.length,
241
- status: failedPlugins.size > 0 || error ? "failed" : "success",
242
- hrStart,
243
- pluginTimings
259
+ status: hasFailures ? "failed" : "success",
260
+ hrStart
244
261
  });
245
262
  await hooks.emit("kubb:lifecycle:end");
246
263
  if (hasFailures) {
247
- const message = error?.message ?? `Build Error with ${failedPlugins.size} failed plugins`;
264
+ const failedCount = _kubb_core.Diagnostics.failedPlugins(diagnostics).length;
265
+ const firstError = diagnostics.filter(_kubb_core.Diagnostics.isProblem).find((diagnostic) => diagnostic.severity === "error");
266
+ const message = failedCount > 0 ? `Build Error with ${failedCount} failed plugins` : firstError?.message ?? "Build failed";
248
267
  if (ctx.error) {
249
268
  ctx.error(`[${name}] ${message}`);
250
269
  return;
251
270
  }
252
- throw new Error(`[${name}] ${message}`, { cause: error });
271
+ throw new Error(`[${name}] ${message}`, { cause: firstError?.cause });
253
272
  }
254
273
  }
255
274
  return {
@@ -269,12 +288,6 @@ Object.defineProperty(exports, "__name", {
269
288
  return __name;
270
289
  }
271
290
  });
272
- Object.defineProperty(exports, "__toESM", {
273
- enumerable: true,
274
- get: function() {
275
- return __toESM;
276
- }
277
- });
278
291
  Object.defineProperty(exports, "unpluginFactory", {
279
292
  enumerable: true,
280
293
  get: function() {
@@ -282,4 +295,4 @@ Object.defineProperty(exports, "unpluginFactory", {
282
295
  }
283
296
  });
284
297
 
285
- //# sourceMappingURL=unpluginFactory-D905egzB.cjs.map
298
+ //# sourceMappingURL=unpluginFactory-eSez3Ud9.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpluginFactory-eSez3Ud9.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 * Registers a one-shot listener that removes itself after the first invocation.\n *\n * @example\n * ```ts\n * emitter.onOnce('build', async (name) => { console.log(name) })\n * ```\n */\n onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n const wrapper: AsyncListener<TEvents[TEventName]> = (...args) => {\n this.off(eventName, wrapper)\n return handler(...args)\n }\n this.on(eventName, wrapper)\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 * Returns the current per-event listener ceiling.\n */\n getMaxListeners(): number {\n return this.#emitter.getMaxListeners()\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,YAAAA,aAAiB;;;;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;QAChF,IAAI,WAAW,aAAa,WACjC,MAAM,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,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_unpluginFactory = require("./unpluginFactory-D905egzB.cjs");
2
+ const require_unpluginFactory = require("./unpluginFactory-eSez3Ud9.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-BE8J68DF.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-C1Wjp2uf.js";
2
2
  export { unpluginFactory };
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-D905egzB.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-eSez3Ud9.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-BE8J68DF.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-C1Wjp2uf.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-D905egzB.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-eSez3Ud9.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-BE8J68DF.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-C1Wjp2uf.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.7",
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.71",
4
+ "description": "Universal build integration for Kubb. Plug code generation into Vite, Webpack, Rollup, esbuild, Rspack, Nuxt, and Astro as part of your regular build pipeline.",
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__/**",
@@ -101,20 +100,20 @@
101
100
  },
102
101
  "dependencies": {
103
102
  "unplugin": "^3.0.0",
104
- "@kubb/adapter-oas": "5.0.0-beta.7",
105
- "@kubb/core": "5.0.0-beta.7",
106
- "@kubb/parser-ts": "5.0.0-beta.7",
107
- "@kubb/middleware-barrel": "5.0.0-beta.7"
103
+ "@kubb/adapter-oas": "5.0.0-beta.71",
104
+ "@kubb/parser-ts": "5.0.0-beta.71",
105
+ "@kubb/core": "5.0.0-beta.71",
106
+ "@kubb/plugin-barrel": "5.0.0-beta.71"
108
107
  },
109
108
  "devDependencies": {
110
109
  "@farmfe/core": "^1.7.11",
111
- "@nuxt/kit": "^4.4.5",
112
- "@nuxt/schema": "^4.4.5",
113
- "esbuild": "^0.28.0",
114
- "rolldown": "1.0.0-rc.16",
115
- "rollup": "^4.60.3",
116
- "vite": "^8.0.12",
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.1",
114
+ "rollup": "^4.62.0",
115
+ "vite": "^8.0.16",
116
+ "webpack": "^5.107.2",
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"