unplugin-kubb 5.0.0-beta.91 → 5.0.0-beta.94

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.
package/dist/astro.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  const require_vite = require("./vite.cjs");
3
3
  //#region src/astro.ts
4
4
  var astro_default = /* @__PURE__ */ require_unpluginFactory.__name((options) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"astro.cjs","names":["vitePlugin"],"sources":["../src/astro.ts"],"sourcesContent":["import type { Options } from './types.ts'\nimport vitePlugin from './vite.ts'\n\nexport default (options: Options): any => ({\n name: 'unplugin-kubb',\n hooks: {\n 'astro:config:setup': async (astro: any) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(vitePlugin(options))\n },\n },\n})\n"],"mappings":";;;AAGA,IAAA,gBAAA,wCAAA,QAAgB,aAA2B;CACzC,MAAM;CACN,OAAO,EACL,sBAAsB,OAAO,UAAe;EAC1C,MAAM,OAAO,KAAK,YAAY,CAAC;EAC/B,MAAM,OAAO,KAAK,QAAQ,KAAKA,aAAW,OAAO,CAAC;CACpD,EACF;AACF,IAAA,SAAA"}
1
+ {"version":3,"file":"astro.cjs","names":["vitePlugin"],"sources":["../src/astro.ts"],"sourcesContent":["import type { Options } from './types.ts'\nimport vitePlugin from './vite.ts'\n\n/**\n * Minimal shape of the params Astro passes to its `astro:config:setup` hook.\n * Kept local rather than depending on `astro` for a single hook signature.\n */\ntype AstroConfigSetupParams = {\n config: {\n vite: {\n plugins?: Array<unknown>\n }\n }\n}\n\ntype AstroIntegration = {\n name: string\n hooks: {\n 'astro:config:setup': (params: AstroConfigSetupParams) => void | Promise<void>\n }\n}\n\nexport default (options: Options): AstroIntegration => ({\n name: 'unplugin-kubb',\n hooks: {\n 'astro:config:setup': async (astro) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(vitePlugin(options))\n },\n },\n})\n"],"mappings":";;;AAsBA,IAAA,gBAAA,wCAAA,QAAgB,aAAwC;CACtD,MAAM;CACN,OAAO,EACL,sBAAsB,OAAO,UAAU;EACrC,MAAM,OAAO,KAAK,YAAY,CAAC;EAC/B,MAAM,OAAO,KAAK,QAAQ,KAAKA,aAAW,OAAO,CAAC;CACpD,EACF;AACF,IAAA,SAAA"}
package/dist/astro.d.ts CHANGED
@@ -2,7 +2,24 @@ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
2
  import { Options } from "./types.js";
3
3
 
4
4
  //#region src/astro.d.ts
5
- declare const _default: (options: Options) => any;
5
+ /**
6
+ * Minimal shape of the params Astro passes to its `astro:config:setup` hook.
7
+ * Kept local rather than depending on `astro` for a single hook signature.
8
+ */
9
+ type AstroConfigSetupParams = {
10
+ config: {
11
+ vite: {
12
+ plugins?: Array<unknown>;
13
+ };
14
+ };
15
+ };
16
+ type AstroIntegration = {
17
+ name: string;
18
+ hooks: {
19
+ 'astro:config:setup': (params: AstroConfigSetupParams) => void | Promise<void>;
20
+ };
21
+ };
22
+ declare const _default: (options: Options) => AstroIntegration;
6
23
  //#endregion
7
24
  export { _default as default };
8
25
  //# sourceMappingURL=astro.d.ts.map
package/dist/astro.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"astro.js","names":["vitePlugin"],"sources":["../src/astro.ts"],"sourcesContent":["import type { Options } from './types.ts'\nimport vitePlugin from './vite.ts'\n\nexport default (options: Options): any => ({\n name: 'unplugin-kubb',\n hooks: {\n 'astro:config:setup': async (astro: any) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(vitePlugin(options))\n },\n },\n})\n"],"mappings":";;;AAGA,IAAA,gBAAA,wBAAgB,aAA2B;CACzC,MAAM;CACN,OAAO,EACL,sBAAsB,OAAO,UAAe;EAC1C,MAAM,OAAO,KAAK,YAAY,CAAC;EAC/B,MAAM,OAAO,KAAK,QAAQ,KAAKA,aAAW,OAAO,CAAC;CACpD,EACF;AACF,IAAA,SAAA"}
1
+ {"version":3,"file":"astro.js","names":["vitePlugin"],"sources":["../src/astro.ts"],"sourcesContent":["import type { Options } from './types.ts'\nimport vitePlugin from './vite.ts'\n\n/**\n * Minimal shape of the params Astro passes to its `astro:config:setup` hook.\n * Kept local rather than depending on `astro` for a single hook signature.\n */\ntype AstroConfigSetupParams = {\n config: {\n vite: {\n plugins?: Array<unknown>\n }\n }\n}\n\ntype AstroIntegration = {\n name: string\n hooks: {\n 'astro:config:setup': (params: AstroConfigSetupParams) => void | Promise<void>\n }\n}\n\nexport default (options: Options): AstroIntegration => ({\n name: 'unplugin-kubb',\n hooks: {\n 'astro:config:setup': async (astro) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(vitePlugin(options))\n },\n },\n})\n"],"mappings":";;;AAsBA,IAAA,gBAAA,wBAAgB,aAAwC;CACtD,MAAM;CACN,OAAO,EACL,sBAAsB,OAAO,UAAU;EACrC,MAAM,OAAO,KAAK,YAAY,CAAC;EAC/B,MAAM,OAAO,KAAK,QAAQ,KAAKA,aAAW,OAAO,CAAC;CACpD,EACF;AACF,IAAA,SAAA"}
package/dist/esbuild.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  //#region src/esbuild.ts
3
3
  var esbuild_default = (0, require("unplugin").createEsbuildPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createEsbuildPlugin } from "unplugin";
3
3
  //#region src/esbuild.ts
4
4
  var esbuild_default = createEsbuildPlugin(unpluginFactory);
package/dist/farm.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  //#region src/farm.ts
3
3
  var farm_default = (0, require("unplugin").createFarmPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/farm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createFarmPlugin } from "unplugin";
3
3
  //#region src/farm.ts
4
4
  var farm_default = createFarmPlugin(unpluginFactory);
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
5
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
6
6
  //#region src/index.ts
7
7
  const plugin = /* #__PURE__ */ (0, require("unplugin").createUnplugin)(require_unpluginFactory.unpluginFactory);
8
8
  //#endregion
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createUnplugin } from "unplugin";
3
3
  //#region src/index.ts
4
4
  const plugin = /* #__PURE__ */ createUnplugin(unpluginFactory);
package/dist/nuxt.cjs CHANGED
@@ -1,4 +1,4 @@
1
- require("./unpluginFactory-65RF6Gbg.cjs");
1
+ require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  const require_vite = require("./vite.cjs");
3
3
  const require_webpack = require("./webpack.cjs");
4
4
  let _nuxt_kit = require("@nuxt/kit");
package/dist/rolldown.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  //#region src/rolldown.ts
3
3
  var rolldown_default = (0, require("unplugin").createRolldownPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/rolldown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createRolldownPlugin } from "unplugin";
3
3
  //#region src/rolldown.ts
4
4
  var rolldown_default = createRolldownPlugin(unpluginFactory);
package/dist/rollup.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  //#region src/rollup.ts
3
3
  var rollup_default = (0, require("unplugin").createRollupPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createRollupPlugin } from "unplugin";
3
3
  //#region src/rollup.ts
4
4
  var rollup_default = createRollupPlugin(unpluginFactory);
package/dist/rspack.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  //#region src/rspack.ts
3
3
  var rspack_default = (0, require("unplugin").createRspackPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/rspack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createRspackPlugin } from "unplugin";
3
3
  //#region src/rspack.ts
4
4
  var rspack_default = createRspackPlugin(unpluginFactory);
@@ -5,7 +5,7 @@ import { Diagnostics, Hookable, applyConfigDefaults, createKubb } from "@kubb/co
5
5
  import { pluginBarrel, pluginBarrelName } from "@kubb/plugin-barrel";
6
6
  import { parserTs, parserTsx } from "@kubb/parser-ts";
7
7
  //#region package.json
8
- var version = "5.0.0-beta.91";
8
+ var version = "5.0.0-beta.94";
9
9
  //#endregion
10
10
  //#region src/unpluginFactory.ts
11
11
  /**
@@ -47,7 +47,7 @@ const unpluginFactory = (options, meta) => {
47
47
  const failedCount = Diagnostics.failedPlugins(diagnostics).length;
48
48
  const pluginsCount = config.plugins.length;
49
49
  const successCount = pluginsCount - failedCount;
50
- console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`);
50
+ console.log(status === "success" ? `Kubb Summary: ✓ ${successCount} successful, ${pluginsCount} total` : `Kubb Summary: ✓ ${successCount} successful, ✗ ${failedCount} failed, ${pluginsCount} total`);
51
51
  });
52
52
  async function runBuild(ctx) {
53
53
  if (!options?.config) {
@@ -80,9 +80,9 @@ const unpluginFactory = (options, meta) => {
80
80
  const hasFailures = Diagnostics.hasError(diagnostics);
81
81
  for (const diagnostic of diagnostics) {
82
82
  if (!Diagnostics.isProblem(diagnostic)) continue;
83
- if (diagnostic.severity === "error") hooks.callHook("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
84
- else if (diagnostic.severity === "warning") hooks.callHook("kubb:warn", { message: diagnostic.message });
85
- else hooks.callHook("kubb:info", { message: diagnostic.message });
83
+ if (diagnostic.severity === "error") await hooks.callHook("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
84
+ else if (diagnostic.severity === "warning") await hooks.callHook("kubb:warn", { message: diagnostic.message });
85
+ else await hooks.callHook("kubb:info", { message: diagnostic.message });
86
86
  }
87
87
  await hooks.callHook("kubb:generation:end", {
88
88
  config: kubb.config,
@@ -117,4 +117,4 @@ const unpluginFactory = (options, meta) => {
117
117
  //#endregion
118
118
  export { unpluginFactory as t };
119
119
 
120
- //# sourceMappingURL=unpluginFactory-E2XDRtLl.js.map
120
+ //# sourceMappingURL=unpluginFactory-B0idEzM-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpluginFactory-B0idEzM-.js","names":["unpluginVersion","userConfig"],"sources":["../package.json","../src/unpluginFactory.ts"],"sourcesContent":["","import process from 'node:process'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport { applyConfigDefaults, type Config, createKubb, Diagnostics, type KubbHooks, Hookable } 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 Hookable<KubbHooks>()\n const isVite = meta.framework === 'vite'\n\n hooks.hook('kubb:lifecycle:start', ({ version }) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n hooks.hook('kubb:error', ({ error }) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n hooks.hook('kubb:warn', ({ message }) => {\n console.warn(`⚠ ${message}`)\n })\n\n hooks.hook('kubb:info', ({ message }) => {\n console.info(`ℹ ${message}`)\n })\n\n hooks.hook('kubb:success', ({ message }) => {\n console.log(`✓ ${message}`)\n })\n\n hooks.hook('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.hook('kubb:files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n hooks.hook('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 { adapter, output, plugins } = applyConfigDefaults(options.config, {\n defaultAdapter: adapterOas(),\n barrelPlugin: pluginBarrel(),\n barrelPluginName: pluginBarrelName,\n defaultOutput: { barrel: { type: 'named' }, format: false, lint: false },\n })\n\n const config = {\n ...options.config,\n adapter,\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.callHook('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.callHook('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 await hooks.callHook('kubb:error', { error: diagnostic.cause ?? new Error(diagnostic.message) })\n } else if (diagnostic.severity === 'warning') {\n await hooks.callHook('kubb:warn', { message: diagnostic.message })\n } else {\n await hooks.callHook('kubb:info', { message: diagnostic.message })\n }\n }\n\n await hooks.callHook('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.callHook('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":";;;;;;;;;;;;;;;;;ACsBA,MAAa,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,QAAQ,IAAI,SAAoB;CACtC,MAAM,SAAS,KAAK,cAAc;CAElC,MAAM,KAAK,yBAAyB,EAAE,cAAc;EAClD,QAAQ,IAAI,iBAAiB,QAAQ,IAAI;CAC3C,CAAC;CAED,MAAM,KAAK,eAAe,EAAE,YAAY;EACtC,QAAQ,MAAM,KAAK,OAAO,WAAW,UAAU;CACjD,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,iBAAiB,EAAE,cA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IAAgC;EACjD;EACA,MAAM,CAAC;CACT;AACF"}
@@ -31,7 +31,7 @@ let _kubb_core = require("@kubb/core");
31
31
  let _kubb_plugin_barrel = require("@kubb/plugin-barrel");
32
32
  let _kubb_parser_ts = require("@kubb/parser-ts");
33
33
  //#region package.json
34
- var version = "5.0.0-beta.91";
34
+ var version = "5.0.0-beta.94";
35
35
  //#endregion
36
36
  //#region src/unpluginFactory.ts
37
37
  /**
@@ -73,7 +73,7 @@ const unpluginFactory = (options, meta) => {
73
73
  const failedCount = _kubb_core.Diagnostics.failedPlugins(diagnostics).length;
74
74
  const pluginsCount = config.plugins.length;
75
75
  const successCount = pluginsCount - failedCount;
76
- console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedCount} failed`}, ${pluginsCount} total`);
76
+ console.log(status === "success" ? `Kubb Summary: ✓ ${successCount} successful, ${pluginsCount} total` : `Kubb Summary: ✓ ${successCount} successful, ✗ ${failedCount} failed, ${pluginsCount} total`);
77
77
  });
78
78
  async function runBuild(ctx) {
79
79
  if (!options?.config) {
@@ -106,9 +106,9 @@ const unpluginFactory = (options, meta) => {
106
106
  const hasFailures = _kubb_core.Diagnostics.hasError(diagnostics);
107
107
  for (const diagnostic of diagnostics) {
108
108
  if (!_kubb_core.Diagnostics.isProblem(diagnostic)) continue;
109
- if (diagnostic.severity === "error") hooks.callHook("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
110
- else if (diagnostic.severity === "warning") hooks.callHook("kubb:warn", { message: diagnostic.message });
111
- else hooks.callHook("kubb:info", { message: diagnostic.message });
109
+ if (diagnostic.severity === "error") await hooks.callHook("kubb:error", { error: diagnostic.cause ?? new Error(diagnostic.message) });
110
+ else if (diagnostic.severity === "warning") await hooks.callHook("kubb:warn", { message: diagnostic.message });
111
+ else await hooks.callHook("kubb:info", { message: diagnostic.message });
112
112
  }
113
113
  await hooks.callHook("kubb:generation:end", {
114
114
  config: kubb.config,
@@ -154,4 +154,4 @@ Object.defineProperty(exports, "unpluginFactory", {
154
154
  }
155
155
  });
156
156
 
157
- //# sourceMappingURL=unpluginFactory-65RF6Gbg.cjs.map
157
+ //# sourceMappingURL=unpluginFactory-DIbTBw9Q.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpluginFactory-DIbTBw9Q.cjs","names":["Hookable","Diagnostics","pluginBarrelName","process","unpluginVersion","userConfig"],"sources":["../package.json","../src/unpluginFactory.ts"],"sourcesContent":["","import process from 'node:process'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport { applyConfigDefaults, type Config, createKubb, Diagnostics, type KubbHooks, Hookable } 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 Hookable<KubbHooks>()\n const isVite = meta.framework === 'vite'\n\n hooks.hook('kubb:lifecycle:start', ({ version }) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n hooks.hook('kubb:error', ({ error }) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n hooks.hook('kubb:warn', ({ message }) => {\n console.warn(`⚠ ${message}`)\n })\n\n hooks.hook('kubb:info', ({ message }) => {\n console.info(`ℹ ${message}`)\n })\n\n hooks.hook('kubb:success', ({ message }) => {\n console.log(`✓ ${message}`)\n })\n\n hooks.hook('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.hook('kubb:files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n hooks.hook('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 { adapter, output, plugins } = applyConfigDefaults(options.config, {\n defaultAdapter: adapterOas(),\n barrelPlugin: pluginBarrel(),\n barrelPluginName: pluginBarrelName,\n defaultOutput: { barrel: { type: 'named' }, format: false, lint: false },\n })\n\n const config = {\n ...options.config,\n adapter,\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.callHook('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.callHook('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 await hooks.callHook('kubb:error', { error: diagnostic.cause ?? new Error(diagnostic.message) })\n } else if (diagnostic.severity === 'warning') {\n await hooks.callHook('kubb:warn', { message: diagnostic.message })\n } else {\n await hooks.callHook('kubb:info', { message: diagnostic.message })\n }\n }\n\n await hooks.callHook('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.callHook('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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACsBA,MAAa,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,QAAQ,IAAIA,WAAAA,SAAoB;CACtC,MAAM,SAAS,KAAK,cAAc;CAElC,MAAM,KAAK,yBAAyB,EAAE,cAAc;EAClD,QAAQ,IAAI,iBAAiB,QAAQ,IAAI;CAC3C,CAAC;CAED,MAAM,KAAK,eAAe,EAAE,YAAY;EACtC,QAAQ,MAAM,KAAK,OAAO,WAAW,UAAU;CACjD,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SA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I,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-65RF6Gbg.cjs");
2
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
3
3
  exports.unpluginFactory = require_unpluginFactory.unpluginFactory;
@@ -1,2 +1,2 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  export { unpluginFactory };
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
  //#region src/vite.ts
4
4
  var vite_default = createVitePlugin(unpluginFactory);
package/dist/webpack.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unpluginFactory = require("./unpluginFactory-65RF6Gbg.cjs");
1
+ const require_unpluginFactory = require("./unpluginFactory-DIbTBw9Q.cjs");
2
2
  //#region src/webpack.ts
3
3
  var webpack_default = (0, require("unplugin").createWebpackPlugin)(require_unpluginFactory.unpluginFactory);
4
4
  //#endregion
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unpluginFactory } from "./unpluginFactory-E2XDRtLl.js";
1
+ import { t as unpluginFactory } from "./unpluginFactory-B0idEzM-.js";
2
2
  import { createWebpackPlugin } from "unplugin";
3
3
  //#region src/webpack.ts
4
4
  var webpack_default = createWebpackPlugin(unpluginFactory);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-kubb",
3
- "version": "5.0.0-beta.91",
3
+ "version": "5.0.0-beta.94",
4
4
  "description": "Integration of Kubb for Vite, Webpack, Rollup, esbuild, Rspack, Nuxt, and Astro.",
5
5
  "keywords": [
6
6
  "astro",
@@ -100,10 +100,10 @@
100
100
  },
101
101
  "dependencies": {
102
102
  "unplugin": "^3.3.0",
103
- "@kubb/core": "5.0.0-beta.91",
104
- "@kubb/plugin-barrel": "5.0.0-beta.91",
105
- "@kubb/adapter-oas": "5.0.0-beta.91",
106
- "@kubb/parser-ts": "5.0.0-beta.91"
103
+ "@kubb/adapter-oas": "5.0.0-beta.94",
104
+ "@kubb/core": "5.0.0-beta.94",
105
+ "@kubb/parser-ts": "5.0.0-beta.94",
106
+ "@kubb/plugin-barrel": "5.0.0-beta.94"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@farmfe/core": "^1.7.11",
@@ -114,7 +114,7 @@
114
114
  "rollup": "^4.62.2",
115
115
  "vite": "^8.1.3",
116
116
  "webpack": "^5.108.4",
117
- "@kubb/ast": "5.0.0-beta.91"
117
+ "@kubb/ast": "5.0.0-beta.94"
118
118
  },
119
119
  "peerDependencies": {
120
120
  "@farmfe/core": "^1.7.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"unpluginFactory-65RF6Gbg.cjs","names":["Hookable","Diagnostics","pluginBarrelName","process","unpluginVersion","userConfig"],"sources":["../package.json","../src/unpluginFactory.ts"],"sourcesContent":["","import process from 'node:process'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport { applyConfigDefaults, type Config, createKubb, Diagnostics, type KubbHooks, Hookable } 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 Hookable<KubbHooks>()\n const isVite = meta.framework === 'vite'\n\n hooks.hook('kubb:lifecycle:start', ({ version }) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n hooks.hook('kubb:error', ({ error }) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n hooks.hook('kubb:warn', ({ message }) => {\n console.warn(`⚠ ${message}`)\n })\n\n hooks.hook('kubb:info', ({ message }) => {\n console.info(`ℹ ${message}`)\n })\n\n hooks.hook('kubb:success', ({ message }) => {\n console.log(`✓ ${message}`)\n })\n\n hooks.hook('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.hook('kubb:files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n hooks.hook('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 { adapter, output, plugins } = applyConfigDefaults(options.config, {\n defaultAdapter: adapterOas(),\n barrelPlugin: pluginBarrel(),\n barrelPluginName: pluginBarrelName,\n defaultOutput: { barrel: { type: 'named' }, format: false, lint: false },\n })\n\n const config = {\n ...options.config,\n adapter,\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.callHook('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.callHook('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.callHook('kubb:error', { error: diagnostic.cause ?? new Error(diagnostic.message) })\n } else if (diagnostic.severity === 'warning') {\n hooks.callHook('kubb:warn', { message: diagnostic.message })\n } else {\n hooks.callHook('kubb:info', { message: diagnostic.message })\n }\n }\n\n await hooks.callHook('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.callHook('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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACsBA,MAAa,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,QAAQ,IAAIA,WAAAA,SAAoB;CACtC,MAAM,SAAS,KAAK,cAAc;CAElC,MAAM,KAAK,yBAAyB,EAAE,cAAc;EAClD,QAAQ,IAAI,iBAAiB,QAAQ,IAAI;CAC3C,CAAC;CAED,MAAM,KAAK,eAAe,EAAE,YAAY;EACtC,QAAQ,MAAM,KAAK,OAAO,WAAW,UAAU;CACjD,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,iBAAiB,EAAE,cAAc;EAC1C,QAAQ,IAAI,KAAK,SAAS;CAC5B,CAAC;CAED,MAAM,KAAK,oBAAoB,EAAE,QAAQ,eAAe;EACtD,MAAM,cAAc,YAAY,MAAO,IAAI,WAAW,IAAA,CAAM,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS;EAExF,QAAQ,IAAI,KAAK,OAAO,KAAK,gBAAgB,aAAa;CAC5D,CAAC;CAED,MAAM,KAAK,mCAAmC;EAG5C,QAAQ,IAAI,8BAAI;CAClB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sources":["../package.json","../src/unpluginFactory.ts"],"sourcesContent":["","import process from 'node:process'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport { applyConfigDefaults, type Config, createKubb, Diagnostics, type KubbHooks, Hookable } 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 Hookable<KubbHooks>()\n const isVite = meta.framework === 'vite'\n\n hooks.hook('kubb:lifecycle:start', ({ version }) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n hooks.hook('kubb:error', ({ error }) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n hooks.hook('kubb:warn', ({ message }) => {\n console.warn(`⚠ ${message}`)\n })\n\n hooks.hook('kubb:info', ({ message }) => {\n console.info(`ℹ ${message}`)\n })\n\n hooks.hook('kubb:success', ({ message }) => {\n console.log(`✓ ${message}`)\n })\n\n hooks.hook('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.hook('kubb:files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n hooks.hook('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 { adapter, output, plugins } = applyConfigDefaults(options.config, {\n defaultAdapter: adapterOas(),\n barrelPlugin: pluginBarrel(),\n barrelPluginName: pluginBarrelName,\n defaultOutput: { barrel: { type: 'named' }, format: false, lint: false },\n })\n\n const config = {\n ...options.config,\n adapter,\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.callHook('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.callHook('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.callHook('kubb:error', { error: diagnostic.cause ?? new Error(diagnostic.message) })\n } else if (diagnostic.severity === 'warning') {\n hooks.callHook('kubb:warn', { message: diagnostic.message })\n } else {\n hooks.callHook('kubb:info', { message: diagnostic.message })\n }\n }\n\n await hooks.callHook('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.callHook('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":";;;;;;;;;;;;;;;;;ACsBA,MAAa,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,QAAQ,IAAI,SAAoB;CACtC,MAAM,SAAS,KAAK,cAAc;CAElC,MAAM,KAAK,yBAAyB,EAAE,cAAc;EAClD,QAAQ,IAAI,iBAAiB,QAAQ,IAAI;CAC3C,CAAC;CAED,MAAM,KAAK,eAAe,EAAE,YAAY;EACtC,QAAQ,MAAM,KAAK,OAAO,WAAW,UAAU;CACjD,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,cAAc,EAAE,cAAc;EACvC,QAAQ,KAAK,KAAK,SAAS;CAC7B,CAAC;CAED,MAAM,KAAK,iBAAiB,EAAE,cAAc;EAC1C,QAAQ,IAAI,KAAK,SAAS;CAC5B,CAAC;CAED,MAAM,KAAK,oBAAoB,EAAE,QAAQ,eAAe;EACtD,MAAM,cAAc,YAAY,MAAO,IAAI,WAAW,IAAA,CAAM,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS;EAExF,QAAQ,IAAI,KAAK,OAAO,KAAK,gBAAgB,aAAa;CAC5D,CAAC;CAED,MAAM,KAAK,mCAAmC;E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