unplugin-kubb 3.2.0 → 3.2.1

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 (57) hide show
  1. package/dist/astro.cjs +1 -1
  2. package/dist/astro.d.cts +1 -1
  3. package/dist/astro.d.ts +1 -1
  4. package/dist/astro.js +1 -1
  5. package/dist/{chunk-BybIe9x4.js → chunk-Bwj0kw0m.js} +10 -6
  6. package/dist/esbuild.cjs +1 -2
  7. package/dist/esbuild.cjs.map +1 -1
  8. package/dist/esbuild.d.cts +1 -1
  9. package/dist/esbuild.d.ts +1 -1
  10. package/dist/esbuild.js +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.js +1 -1
  15. package/dist/nuxt.cjs +3 -4
  16. package/dist/nuxt.cjs.map +1 -1
  17. package/dist/nuxt.d.cts +1 -1
  18. package/dist/nuxt.d.ts +1 -1
  19. package/dist/nuxt.js +3 -3
  20. package/dist/rollup.cjs +1 -2
  21. package/dist/rollup.cjs.map +1 -1
  22. package/dist/rollup.d.cts +1 -1
  23. package/dist/rollup.d.ts +1 -1
  24. package/dist/rollup.js +1 -1
  25. package/dist/rspack.cjs +1 -2
  26. package/dist/rspack.cjs.map +1 -1
  27. package/dist/rspack.d.cts +1 -1
  28. package/dist/rspack.d.ts +1 -1
  29. package/dist/rspack.js +1 -1
  30. package/dist/{src-INEri0Ub.cjs → src-6M-KdHiM.cjs} +3 -35
  31. package/dist/src-6M-KdHiM.cjs.map +1 -0
  32. package/dist/{src-Dn-CzqNK.js → src-CN9jIyH0.js} +3 -3
  33. package/dist/src-CN9jIyH0.js.map +1 -0
  34. package/dist/{types-Bt9ZCbPy.d.ts → types-BNmRHGEx.d.cts} +24 -36
  35. package/dist/{types-DpTGv8q2.d.cts → types-D54bCl1u.d.ts} +24 -36
  36. package/dist/types.d.cts +1 -1
  37. package/dist/types.d.ts +1 -1
  38. package/dist/{vite-CEW_QLtL.js → vite-CZqCD2RF.js} +2 -2
  39. package/dist/{vite-CEW_QLtL.js.map → vite-CZqCD2RF.js.map} +1 -1
  40. package/dist/{vite-Df2FT-jf.cjs → vite-DO7vdmOO.cjs} +2 -3
  41. package/dist/{vite-Df2FT-jf.cjs.map → vite-DO7vdmOO.cjs.map} +1 -1
  42. package/dist/vite.cjs +2 -2
  43. package/dist/vite.d.cts +1 -1
  44. package/dist/vite.d.ts +1 -1
  45. package/dist/vite.js +2 -2
  46. package/dist/{webpack-gtaz7qKH.js → webpack-BPXrZfNl.js} +2 -2
  47. package/dist/{webpack-gtaz7qKH.js.map → webpack-BPXrZfNl.js.map} +1 -1
  48. package/dist/{webpack-D2VoiCsm.cjs → webpack-DwzhnPfl.cjs} +2 -3
  49. package/dist/{webpack-D2VoiCsm.cjs.map → webpack-DwzhnPfl.cjs.map} +1 -1
  50. package/dist/webpack.cjs +2 -2
  51. package/dist/webpack.d.cts +1 -1
  52. package/dist/webpack.d.ts +1 -1
  53. package/dist/webpack.js +2 -2
  54. package/package.json +7 -7
  55. package/src/index.ts +1 -1
  56. package/dist/src-Dn-CzqNK.js.map +0 -1
  57. package/dist/src-INEri0Ub.cjs.map +0 -1
package/dist/astro.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
1
+ const require_src = require('./src-6M-KdHiM.cjs');
2
2
 
3
3
  //#region src/astro.ts
4
4
  var astro_default = (options) => ({
package/dist/astro.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
 
3
3
  //#region src/astro.d.ts
4
4
  declare const _default: (options: Options) => {
package/dist/astro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
 
3
3
  //#region src/astro.d.ts
4
4
  declare const _default: (options: Options) => {
package/dist/astro.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as src_default } from "./src-Dn-CzqNK.js";
1
+ import { t as src_default } from "./src-CN9jIyH0.js";
2
2
 
3
3
  //#region src/astro.ts
4
4
  var astro_default = (options) => ({
@@ -8,12 +8,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
10
  var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) {
15
+ __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ }
17
21
  }
18
22
  return to;
19
23
  };
package/dist/esbuild.cjs CHANGED
@@ -1,6 +1,5 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
1
+ const require_src = require('./src-6M-KdHiM.cjs');
2
2
  let unplugin = require("unplugin");
3
- unplugin = require_src.__toESM(unplugin);
4
3
 
5
4
  //#region src/esbuild.ts
6
5
  var esbuild_default = (0, unplugin.createEsbuildPlugin)(require_src.unpluginFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.cjs","names":["unpluginFactory"],"sources":["../src/esbuild.ts"],"sourcesContent":["import { createEsbuildPlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createEsbuildPlugin(unpluginFactory)\n"],"mappings":";;;;;AAIA,wDAAmCA,4BAAgB"}
1
+ {"version":3,"file":"esbuild.cjs","names":["unpluginFactory"],"sources":["../src/esbuild.ts"],"sourcesContent":["import { createEsbuildPlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createEsbuildPlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,wDAAmCA,4BAAgB"}
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  import * as esbuild0 from "esbuild";
3
3
 
4
4
  //#region src/esbuild.d.ts
package/dist/esbuild.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
  import * as esbuild0 from "esbuild";
3
3
 
4
4
  //#region src/esbuild.d.ts
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Dn-CzqNK.js";
1
+ import { r as unpluginFactory } from "./src-CN9jIyH0.js";
2
2
  import { createEsbuildPlugin } from "unplugin";
3
3
 
4
4
  //#region src/esbuild.ts
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_src = require('./src-INEri0Ub.cjs');
2
+ const require_src = require('./src-6M-KdHiM.cjs');
3
3
 
4
4
  exports.default = require_src.src_default;
5
5
  exports.unplugin = require_src.unplugin;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  import * as unplugin0 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
2
- import * as unplugin0 from "unplugin";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
+ import * as unplugin1 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
5
5
  //#region src/index.d.ts
6
6
  declare const unpluginFactory: UnpluginFactory<Options | undefined>;
7
- declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
7
+ declare const unplugin: unplugin1.UnpluginInstance<Options | undefined, boolean>;
8
8
  //#endregion
9
9
  export { unplugin as default, unplugin, unpluginFactory };
10
10
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-Dn-CzqNK.js";
1
+ import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-CN9jIyH0.js";
2
2
 
3
3
  export { src_default as default, unplugin, unpluginFactory };
package/dist/nuxt.cjs CHANGED
@@ -1,8 +1,7 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
2
- const require_vite = require('./vite-Df2FT-jf.cjs');
3
- const require_webpack = require('./webpack-D2VoiCsm.cjs');
1
+ require('./src-6M-KdHiM.cjs');
2
+ const require_vite = require('./vite-DO7vdmOO.cjs');
3
+ const require_webpack = require('./webpack-DwzhnPfl.cjs');
4
4
  let __nuxt_kit = require("@nuxt/kit");
5
- __nuxt_kit = require_src.__toESM(__nuxt_kit);
6
5
  require("@nuxt/schema");
7
6
 
8
7
  //#region src/nuxt.ts
package/dist/nuxt.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"nuxt.cjs","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'\nimport '@nuxt/schema'\n\nimport type { Options } from './types.ts'\nimport vite from './vite.ts'\nimport webpack from './webpack.ts'\n\nexport interface ModuleOptions extends Options {}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: 'nuxt-unplugin-starter',\n configKey: 'unpluginStarter',\n },\n defaults: undefined,\n setup(options, _nuxt) {\n addVitePlugin(() => vite(options))\n addWebpackPlugin(() => webpack(options))\n\n // ...\n },\n})\n"],"mappings":";;;;;;;;AASA,oDAA+C;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,UAAU;CACV,MAAM,SAAS,OAAO;AACpB,sCAAoBA,0BAAK,QAAQ,CAAC;AAClC,yCAAuBC,gCAAQ,QAAQ,CAAC;;CAI3C,CAAC"}
1
+ {"version":3,"file":"nuxt.cjs","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'\nimport '@nuxt/schema'\n\nimport type { Options } from './types.ts'\nimport vite from './vite.ts'\nimport webpack from './webpack.ts'\n\nexport interface ModuleOptions extends Options {}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: 'nuxt-unplugin-starter',\n configKey: 'unpluginStarter',\n },\n defaults: undefined,\n setup(options, _nuxt) {\n addVitePlugin(() => vite(options))\n addWebpackPlugin(() => webpack(options))\n\n // ...\n },\n})\n"],"mappings":";;;;;;;AASA,oDAA+C;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,UAAU;CACV,MAAM,SAAS,OAAO;AACpB,sCAAoBA,0BAAK,QAAQ,CAAC;AAClC,yCAAuBC,gCAAQ,QAAQ,CAAC;;CAI3C,CAAC"}
package/dist/nuxt.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  import * as _nuxt_schema0 from "@nuxt/schema";
3
3
 
4
4
  //#region src/nuxt.d.ts
package/dist/nuxt.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
  import * as _nuxt_schema0 from "@nuxt/schema";
3
3
 
4
4
  //#region src/nuxt.d.ts
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./src-Dn-CzqNK.js";
2
- import { t as vite_default } from "./vite-CEW_QLtL.js";
3
- import { t as webpack_default } from "./webpack-gtaz7qKH.js";
1
+ import "./src-CN9jIyH0.js";
2
+ import { t as vite_default } from "./vite-CZqCD2RF.js";
3
+ import { t as webpack_default } from "./webpack-BPXrZfNl.js";
4
4
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
5
5
  import "@nuxt/schema";
6
6
 
package/dist/rollup.cjs CHANGED
@@ -1,6 +1,5 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
1
+ const require_src = require('./src-6M-KdHiM.cjs');
2
2
  let unplugin = require("unplugin");
3
- unplugin = require_src.__toESM(unplugin);
4
3
 
5
4
  //#region src/rollup.ts
6
5
  var rollup_default = (0, unplugin.createRollupPlugin)(require_src.unpluginFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.cjs","names":["unpluginFactory"],"sources":["../src/rollup.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createRollupPlugin(unpluginFactory)\n"],"mappings":";;;;;AAIA,sDAAkCA,4BAAgB"}
1
+ {"version":3,"file":"rollup.cjs","names":["unpluginFactory"],"sources":["../src/rollup.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createRollupPlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,sDAAkCA,4BAAgB"}
package/dist/rollup.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  import * as rollup0 from "rollup";
3
3
 
4
4
  //#region src/rollup.d.ts
package/dist/rollup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
  import * as rollup0 from "rollup";
3
3
 
4
4
  //#region src/rollup.d.ts
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Dn-CzqNK.js";
1
+ import { r as unpluginFactory } from "./src-CN9jIyH0.js";
2
2
  import { createRollupPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rollup.ts
package/dist/rspack.cjs CHANGED
@@ -1,6 +1,5 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
1
+ const require_src = require('./src-6M-KdHiM.cjs');
2
2
  let unplugin = require("unplugin");
3
- unplugin = require_src.__toESM(unplugin);
4
3
 
5
4
  //#region src/rspack.ts
6
5
  var rspack_default = (0, unplugin.createRspackPlugin)(require_src.unpluginFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"rspack.cjs","names":["unpluginFactory"],"sources":["../src/rspack.ts"],"sourcesContent":["import { createRspackPlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createRspackPlugin(unpluginFactory)\n"],"mappings":";;;;;AAIA,sDAAkCA,4BAAgB"}
1
+ {"version":3,"file":"rspack.cjs","names":["unpluginFactory"],"sources":["../src/rspack.ts"],"sourcesContent":["import { createRspackPlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createRspackPlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,sDAAkCA,4BAAgB"}
package/dist/rspack.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
 
3
3
  //#region src/rspack.d.ts
4
4
  declare const _default: (options?: Options | undefined) => RspackPluginInstance;
package/dist/rspack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
 
3
3
  //#region src/rspack.d.ts
4
4
  declare const _default: (options?: Options | undefined) => RspackPluginInstance;
package/dist/rspack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Dn-CzqNK.js";
1
+ import { r as unpluginFactory } from "./src-CN9jIyH0.js";
2
2
  import { createRspackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rspack.ts
@@ -1,32 +1,6 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
1
  let __kubb_core = require("@kubb/core");
25
- __kubb_core = __toESM(__kubb_core);
26
2
  let __kubb_core_logger = require("@kubb/core/logger");
27
- __kubb_core_logger = __toESM(__kubb_core_logger);
28
3
  let unplugin = require("unplugin");
29
- unplugin = __toESM(unplugin);
30
4
 
31
5
  //#region src/index.ts
32
6
  const unpluginFactory = (options) => {
@@ -49,9 +23,9 @@ const unpluginFactory = (options) => {
49
23
  config.logger.info(`${name}: ${message}`);
50
24
  });
51
25
  } },
52
- async buildStart() {
26
+ async install() {
53
27
  if (!options?.config) throw new Error("Config is not set");
54
- const { root: _root,...userConfig } = options.config;
28
+ const { root: _root, ...userConfig } = options.config;
55
29
  logger.emit("start", "Building");
56
30
  const { error } = await (0, __kubb_core.safeBuild)({
57
31
  config: {
@@ -72,12 +46,6 @@ const unplugin$1 = /* @__PURE__ */ (0, unplugin.createUnplugin)(unpluginFactory)
72
46
  var src_default = unplugin$1;
73
47
 
74
48
  //#endregion
75
- Object.defineProperty(exports, '__toESM', {
76
- enumerable: true,
77
- get: function () {
78
- return __toESM;
79
- }
80
- });
81
49
  Object.defineProperty(exports, 'src_default', {
82
50
  enumerable: true,
83
51
  get: function () {
@@ -96,4 +64,4 @@ Object.defineProperty(exports, 'unpluginFactory', {
96
64
  return unpluginFactory;
97
65
  }
98
66
  });
99
- //# sourceMappingURL=src-INEri0Ub.cjs.map
67
+ //# sourceMappingURL=src-6M-KdHiM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-6M-KdHiM.cjs","names":["unpluginFactory: UnpluginFactory<Options | undefined>","unplugin"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from '@kubb/core'\nimport { safeBuild } from '@kubb/core'\nimport { createLogger } from '@kubb/core/logger'\nimport type { UnpluginFactory } from 'unplugin'\nimport { createUnplugin } from 'unplugin'\nimport type { Options } from './types.ts'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {\n const name = 'unplugin-kubb' as const\n const logger = createLogger({\n name,\n })\n\n return {\n name,\n enforce: 'pre',\n vite: {\n configResolved(config) {\n logger.on('start', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('success', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('warning', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('error', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n },\n },\n\n async install() {\n if (!options?.config) {\n throw new Error('Config is not set')\n }\n\n const { root: _root, ...userConfig } = options.config as Config\n\n logger.emit('start', 'Building')\n\n const { error } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n if (error) {\n throw error\n }\n },\n }\n}\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;AAOA,MAAaA,mBAAyD,YAAY;CAChF,MAAM,OAAO;CACb,MAAM,8CAAsB,EAC1B,MACD,CAAC;AAEF,QAAO;EACL;EACA,SAAS;EACT,MAAM,EACJ,eAAe,QAAQ;AACrB,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;KAEL;EAED,MAAM,UAAU;AACd,OAAI,CAAC,SAAS,OACZ,OAAM,IAAI,MAAM,oBAAoB;GAGtC,MAAM,EAAE,MAAM,OAAO,GAAG,eAAe,QAAQ;AAE/C,UAAO,KAAK,SAAS,WAAW;GAEhC,MAAM,EAAE,UAAU,iCAAgB;IAChC,QAAQ;KACN,MAAM,QAAQ,KAAK;KACnB,GAAG;KACH,QAAQ;MACN,OAAO;MACP,GAAG,WAAW;MACf;KACF;IACD;IACD,CAAC;AAEF,OAAI,MACF,OAAM;;EAGX;;AAGH,MAAaC,aAA2B,6CAAe,gBAAgB;AAEvE,kBAAeA"}
@@ -23,9 +23,9 @@ const unpluginFactory = (options) => {
23
23
  config.logger.info(`${name}: ${message}`);
24
24
  });
25
25
  } },
26
- async buildStart() {
26
+ async install() {
27
27
  if (!options?.config) throw new Error("Config is not set");
28
- const { root: _root,...userConfig } = options.config;
28
+ const { root: _root, ...userConfig } = options.config;
29
29
  logger.emit("start", "Building");
30
30
  const { error } = await safeBuild({
31
31
  config: {
@@ -47,4 +47,4 @@ var src_default = unplugin;
47
47
 
48
48
  //#endregion
49
49
  export { unplugin as n, unpluginFactory as r, src_default as t };
50
- //# sourceMappingURL=src-Dn-CzqNK.js.map
50
+ //# sourceMappingURL=src-CN9jIyH0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-CN9jIyH0.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from '@kubb/core'\nimport { safeBuild } from '@kubb/core'\nimport { createLogger } from '@kubb/core/logger'\nimport type { UnpluginFactory } from 'unplugin'\nimport { createUnplugin } from 'unplugin'\nimport type { Options } from './types.ts'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {\n const name = 'unplugin-kubb' as const\n const logger = createLogger({\n name,\n })\n\n return {\n name,\n enforce: 'pre',\n vite: {\n configResolved(config) {\n logger.on('start', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('success', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('warning', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('error', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n },\n },\n\n async install() {\n if (!options?.config) {\n throw new Error('Config is not set')\n }\n\n const { root: _root, ...userConfig } = options.config as Config\n\n logger.emit('start', 'Building')\n\n const { error } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n if (error) {\n throw error\n }\n },\n }\n}\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;AAOA,MAAaA,mBAAyD,YAAY;CAChF,MAAM,OAAO;CACb,MAAM,SAAS,aAAa,EAC1B,MACD,CAAC;AAEF,QAAO;EACL;EACA,SAAS;EACT,MAAM,EACJ,eAAe,QAAQ;AACrB,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;KAEL;EAED,MAAM,UAAU;AACd,OAAI,CAAC,SAAS,OACZ,OAAM,IAAI,MAAM,oBAAoB;GAGtC,MAAM,EAAE,MAAM,OAAO,GAAG,eAAe,QAAQ;AAE/C,UAAO,KAAK,SAAS,WAAW;GAEhC,MAAM,EAAE,UAAU,MAAM,UAAU;IAChC,QAAQ;KACN,MAAM,QAAQ,KAAK;KACnB,GAAG;KACH,QAAQ;MACN,OAAO;MACP,GAAG,WAAW;MACf;KACF;IACD;IACD,CAAC;AAEF,OAAI,MACF,OAAM;;EAGX;;AAGH,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
@@ -1,5 +1,5 @@
1
1
  import { KubbFile } from "@kubb/fabric-core/types";
2
- import { Fabric, FileManager } from "@kubb/react-fabric";
2
+ import { Fabric } from "@kubb/react-fabric";
3
3
  import { ConsolaInstance, LogLevel } from "consola";
4
4
 
5
5
  //#region ../core/src/utils/EventEmitter.d.ts
@@ -54,6 +54,11 @@ type Logger = {
54
54
  type PossiblePromise<T> = Promise<T> | T;
55
55
  //#endregion
56
56
  //#region ../core/src/types.d.ts
57
+ declare global {
58
+ namespace Kubb {
59
+ interface PluginContext {}
60
+ }
61
+ }
57
62
  /**
58
63
  * Config used in `kubb.config.ts`
59
64
  *
@@ -72,7 +77,7 @@ type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {
72
77
  /**
73
78
  * An array of Kubb plugins used for generation. Each plugin may have additional configurable options (defined within the plugin itself). If a plugin relies on another plugin, an error will occur if the required dependency is missing. Refer to “pre” for more details.
74
79
  */
75
- plugins?: Array<Omit<UnknownUserPlugin, 'context'>>;
80
+ plugins?: Array<Omit<UnknownUserPlugin, 'inject'>>;
76
81
  };
77
82
  type InputPath = {
78
83
  /**
@@ -228,11 +233,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
228
233
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
229
234
  */
230
235
  post?: Array<string>;
231
- } & (TOptions['context'] extends never ? {
232
- context?: never;
233
- } : {
234
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
235
- });
236
+ inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
237
+ };
236
238
  type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>;
237
239
  type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
238
240
  /**
@@ -258,25 +260,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
258
260
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
259
261
  */
260
262
  options: TOptions['resolvedOptions'];
261
- } & (TOptions['context'] extends never ? {
262
- context?: never;
263
- } : {
264
- context: TOptions['context'];
265
- });
263
+ install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
264
+ /**
265
+ * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
266
+ */
267
+ inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
268
+ };
266
269
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
267
270
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
268
271
  /**
269
272
  * Start of the lifecycle of a plugin.
270
273
  * @type hookParallel
271
274
  */
272
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
275
+ install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
273
276
  /**
274
277
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
275
278
  * Options can als be included.
276
279
  * @type hookFirst
277
280
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
278
281
  */
279
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
282
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
280
283
  /**
281
284
  * Resolve to a name based on a string.
282
285
  * Useful when converting to PascalCase or camelCase.
@@ -284,11 +287,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
284
287
  * @example ('pet') => 'Pet'
285
288
  */
286
289
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
287
- /**
288
- * End of the plugin lifecycle.
289
- * @type hookParallel
290
- */
291
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
292
290
  };
293
291
  type PluginLifecycleHooks = keyof PluginLifecycle;
294
292
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -315,24 +313,15 @@ type ResolveNameParams = {
315
313
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
316
314
  fabric: Fabric;
317
315
  config: Config;
318
- /**
319
- * @deprecated
320
- */
321
- fileManager: FileManager;
322
316
  pluginManager: PluginManager;
323
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
324
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
325
- resolveName: (params: ResolveNameParams) => string;
317
+ addFile: (...file: Array<KubbFile.File>) => Promise<void>;
326
318
  logger: Logger;
327
- /**
328
- * All plugins
329
- */
330
- plugins: Plugin[];
319
+ mode: KubbFile.Mode;
331
320
  /**
332
321
  * Current plugin
333
322
  */
334
323
  plugin: Plugin<TOptions>;
335
- };
324
+ } & Kubb.PluginContext;
336
325
  //#endregion
337
326
  //#region ../core/src/PluginManager.d.ts
338
327
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
@@ -372,13 +361,14 @@ type GetFileProps<TOptions = object> = {
372
361
  };
373
362
  declare class PluginManager {
374
363
  #private;
375
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
376
364
  readonly events: EventEmitter<Events>;
377
365
  readonly config: Config;
378
366
  readonly executed: Array<Executer>;
379
367
  readonly logger: Logger;
380
368
  readonly options: Options$1;
381
369
  constructor(config: Config, options: Options$1);
370
+ getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
371
+ get plugins(): Array<Plugin>;
382
372
  getFile<TOptions = object>({
383
373
  name,
384
374
  mode,
@@ -388,7 +378,7 @@ declare class PluginManager {
388
378
  }: GetFileProps<TOptions>): KubbFile.File<{
389
379
  pluginKey: Plugin['key'];
390
380
  }>;
391
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
381
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
392
382
  resolveName: (params: ResolveNameParams) => string;
393
383
  /**
394
384
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -476,8 +466,6 @@ declare class PluginManager {
476
466
  }): Promise<void>;
477
467
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
478
468
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
479
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
480
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
481
469
  }
482
470
  //#endregion
483
471
  //#region src/types.d.ts
@@ -489,4 +477,4 @@ type Options = {
489
477
  };
490
478
  //#endregion
491
479
  export { Options as t };
492
- //# sourceMappingURL=types-Bt9ZCbPy.d.ts.map
480
+ //# sourceMappingURL=types-BNmRHGEx.d.cts.map
@@ -1,5 +1,5 @@
1
1
  import { KubbFile } from "@kubb/fabric-core/types";
2
- import { Fabric, FileManager } from "@kubb/react-fabric";
2
+ import { Fabric } from "@kubb/react-fabric";
3
3
  import { ConsolaInstance, LogLevel } from "consola";
4
4
 
5
5
  //#region ../core/src/utils/EventEmitter.d.ts
@@ -54,6 +54,11 @@ type Logger = {
54
54
  type PossiblePromise<T> = Promise<T> | T;
55
55
  //#endregion
56
56
  //#region ../core/src/types.d.ts
57
+ declare global {
58
+ namespace Kubb {
59
+ interface PluginContext {}
60
+ }
61
+ }
57
62
  /**
58
63
  * Config used in `kubb.config.ts`
59
64
  *
@@ -72,7 +77,7 @@ type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {
72
77
  /**
73
78
  * An array of Kubb plugins used for generation. Each plugin may have additional configurable options (defined within the plugin itself). If a plugin relies on another plugin, an error will occur if the required dependency is missing. Refer to “pre” for more details.
74
79
  */
75
- plugins?: Array<Omit<UnknownUserPlugin, 'context'>>;
80
+ plugins?: Array<Omit<UnknownUserPlugin, 'inject'>>;
76
81
  };
77
82
  type InputPath = {
78
83
  /**
@@ -228,11 +233,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
228
233
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
229
234
  */
230
235
  post?: Array<string>;
231
- } & (TOptions['context'] extends never ? {
232
- context?: never;
233
- } : {
234
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
235
- });
236
+ inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
237
+ };
236
238
  type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>;
237
239
  type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
238
240
  /**
@@ -258,25 +260,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
258
260
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
259
261
  */
260
262
  options: TOptions['resolvedOptions'];
261
- } & (TOptions['context'] extends never ? {
262
- context?: never;
263
- } : {
264
- context: TOptions['context'];
265
- });
263
+ install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
264
+ /**
265
+ * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
266
+ */
267
+ inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
268
+ };
266
269
  type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
267
270
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
268
271
  /**
269
272
  * Start of the lifecycle of a plugin.
270
273
  * @type hookParallel
271
274
  */
272
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
275
+ install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
273
276
  /**
274
277
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
275
278
  * Options can als be included.
276
279
  * @type hookFirst
277
280
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
278
281
  */
279
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
282
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
280
283
  /**
281
284
  * Resolve to a name based on a string.
282
285
  * Useful when converting to PascalCase or camelCase.
@@ -284,11 +287,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
284
287
  * @example ('pet') => 'Pet'
285
288
  */
286
289
  resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
287
- /**
288
- * End of the plugin lifecycle.
289
- * @type hookParallel
290
- */
291
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
292
290
  };
293
291
  type PluginLifecycleHooks = keyof PluginLifecycle;
294
292
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -315,24 +313,15 @@ type ResolveNameParams = {
315
313
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
316
314
  fabric: Fabric;
317
315
  config: Config;
318
- /**
319
- * @deprecated
320
- */
321
- fileManager: FileManager;
322
316
  pluginManager: PluginManager;
323
- addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
324
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
325
- resolveName: (params: ResolveNameParams) => string;
317
+ addFile: (...file: Array<KubbFile.File>) => Promise<void>;
326
318
  logger: Logger;
327
- /**
328
- * All plugins
329
- */
330
- plugins: Plugin[];
319
+ mode: KubbFile.Mode;
331
320
  /**
332
321
  * Current plugin
333
322
  */
334
323
  plugin: Plugin<TOptions>;
335
- };
324
+ } & Kubb.PluginContext;
336
325
  //#endregion
337
326
  //#region ../core/src/PluginManager.d.ts
338
327
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
@@ -372,13 +361,14 @@ type GetFileProps<TOptions = object> = {
372
361
  };
373
362
  declare class PluginManager {
374
363
  #private;
375
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
376
364
  readonly events: EventEmitter<Events>;
377
365
  readonly config: Config;
378
366
  readonly executed: Array<Executer>;
379
367
  readonly logger: Logger;
380
368
  readonly options: Options$1;
381
369
  constructor(config: Config, options: Options$1);
370
+ getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
371
+ get plugins(): Array<Plugin>;
382
372
  getFile<TOptions = object>({
383
373
  name,
384
374
  mode,
@@ -388,7 +378,7 @@ declare class PluginManager {
388
378
  }: GetFileProps<TOptions>): KubbFile.File<{
389
379
  pluginKey: Plugin['key'];
390
380
  }>;
391
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
381
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
392
382
  resolveName: (params: ResolveNameParams) => string;
393
383
  /**
394
384
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -476,8 +466,6 @@ declare class PluginManager {
476
466
  }): Promise<void>;
477
467
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
478
468
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
479
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
480
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
481
469
  }
482
470
  //#endregion
483
471
  //#region src/types.d.ts
@@ -489,4 +477,4 @@ type Options = {
489
477
  };
490
478
  //#endregion
491
479
  export { Options as t };
492
- //# sourceMappingURL=types-DpTGv8q2.d.cts.map
480
+ //# sourceMappingURL=types-D54bCl1u.d.ts.map
package/dist/types.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  export { Options };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
  export { Options };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Dn-CzqNK.js";
1
+ import { r as unpluginFactory } from "./src-CN9jIyH0.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
 
4
4
  //#region src/vite.ts
@@ -6,4 +6,4 @@ var vite_default = createVitePlugin(unpluginFactory);
6
6
 
7
7
  //#endregion
8
8
  export { vite_default as t };
9
- //# sourceMappingURL=vite-CEW_QLtL.js.map
9
+ //# sourceMappingURL=vite-CZqCD2RF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-CEW_QLtL.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,mBAAe,iBAAiB,gBAAgB"}
1
+ {"version":3,"file":"vite-CZqCD2RF.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,mBAAe,iBAAiB,gBAAgB"}
@@ -1,6 +1,5 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
1
+ const require_src = require('./src-6M-KdHiM.cjs');
2
2
  let unplugin = require("unplugin");
3
- unplugin = require_src.__toESM(unplugin);
4
3
 
5
4
  //#region src/vite.ts
6
5
  var vite_default = (0, unplugin.createVitePlugin)(require_src.unpluginFactory);
@@ -12,4 +11,4 @@ Object.defineProperty(exports, 'vite_default', {
12
11
  return vite_default;
13
12
  }
14
13
  });
15
- //# sourceMappingURL=vite-Df2FT-jf.cjs.map
14
+ //# sourceMappingURL=vite-DO7vdmOO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-Df2FT-jf.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;;AAIA,kDAAgCA,4BAAgB"}
1
+ {"version":3,"file":"vite-DO7vdmOO.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './index.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,kDAAgCA,4BAAgB"}
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- require('./src-INEri0Ub.cjs');
2
- const require_vite = require('./vite-Df2FT-jf.cjs');
1
+ require('./src-6M-KdHiM.cjs');
2
+ const require_vite = require('./vite-DO7vdmOO.cjs');
3
3
 
4
4
  module.exports = require_vite.vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  import * as unplugin0 from "unplugin";
3
3
 
4
4
  //#region src/vite.d.ts
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
  import * as unplugin0 from "unplugin";
3
3
 
4
4
  //#region src/vite.d.ts
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-Dn-CzqNK.js";
2
- import { t as vite_default } from "./vite-CEW_QLtL.js";
1
+ import "./src-CN9jIyH0.js";
2
+ import { t as vite_default } from "./vite-CZqCD2RF.js";
3
3
 
4
4
  export { vite_default as default };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-Dn-CzqNK.js";
1
+ import { r as unpluginFactory } from "./src-CN9jIyH0.js";
2
2
  import { createWebpackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/webpack.ts
@@ -6,4 +6,4 @@ var webpack_default = createWebpackPlugin(unpluginFactory);
6
6
 
7
7
  //#endregion
8
8
  export { webpack_default as t };
9
- //# sourceMappingURL=webpack-gtaz7qKH.js.map
9
+ //# sourceMappingURL=webpack-BPXrZfNl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack-gtaz7qKH.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport { unpluginFactory } from './index.ts'\nimport type { Options } from './types.ts'\n\n// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;AAOA,sBAAe,oBAAoB,gBAAgB"}
1
+ {"version":3,"file":"webpack-BPXrZfNl.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport { unpluginFactory } from './index.ts'\nimport type { Options } from './types.ts'\n\n// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;AAOA,sBAAe,oBAAoB,gBAAgB"}
@@ -1,6 +1,5 @@
1
- const require_src = require('./src-INEri0Ub.cjs');
1
+ const require_src = require('./src-6M-KdHiM.cjs');
2
2
  let unplugin = require("unplugin");
3
- unplugin = require_src.__toESM(unplugin);
4
3
 
5
4
  //#region src/webpack.ts
6
5
  var webpack_default = (0, unplugin.createWebpackPlugin)(require_src.unpluginFactory);
@@ -12,4 +11,4 @@ Object.defineProperty(exports, 'webpack_default', {
12
11
  return webpack_default;
13
12
  }
14
13
  });
15
- //# sourceMappingURL=webpack-D2VoiCsm.cjs.map
14
+ //# sourceMappingURL=webpack-DwzhnPfl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack-D2VoiCsm.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport { unpluginFactory } from './index.ts'\nimport type { Options } from './types.ts'\n\n// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;;AAOA,wDAAmCA,4BAAgB"}
1
+ {"version":3,"file":"webpack-DwzhnPfl.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport { unpluginFactory } from './index.ts'\nimport type { Options } from './types.ts'\n\n// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;AAOA,wDAAmCA,4BAAgB"}
package/dist/webpack.cjs CHANGED
@@ -1,4 +1,4 @@
1
- require('./src-INEri0Ub.cjs');
2
- const require_webpack = require('./webpack-D2VoiCsm.cjs');
1
+ require('./src-6M-KdHiM.cjs');
2
+ const require_webpack = require('./webpack-DwzhnPfl.cjs');
3
3
 
4
4
  module.exports = require_webpack.webpack_default;
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-DpTGv8q2.cjs";
1
+ import { t as Options } from "./types-BNmRHGEx.cjs";
2
2
  import { UnpluginFactoryOutput } from "unplugin";
3
3
  import { WebpackPluginInstance } from "webpack";
4
4
 
package/dist/webpack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Bt9ZCbPy.js";
1
+ import { t as Options } from "./types-D54bCl1u.js";
2
2
  import { UnpluginFactoryOutput } from "unplugin";
3
3
  import { WebpackPluginInstance } from "webpack";
4
4
 
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-Dn-CzqNK.js";
2
- import { t as webpack_default } from "./webpack-gtaz7qKH.js";
1
+ import "./src-CN9jIyH0.js";
2
+ import { t as webpack_default } from "./webpack-BPXrZfNl.js";
3
3
 
4
4
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-kubb",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Unplugin for Kubb",
5
5
  "keywords": [
6
6
  "unplugin",
@@ -85,13 +85,13 @@
85
85
  "unplugin": "^2.3.10"
86
86
  },
87
87
  "devDependencies": {
88
- "@nuxt/kit": "^3.20.0",
89
- "@nuxt/schema": "^3.20.0",
90
- "rimraf": "^6.1.0",
91
- "rollup": "^4.52.5",
88
+ "@nuxt/kit": "^3.20.1",
89
+ "@nuxt/schema": "^3.20.1",
90
+ "rimraf": "^6.1.2",
91
+ "rollup": "^4.53.3",
92
92
  "vite": "^6.4.1",
93
- "webpack": "^5.102.1",
94
- "@kubb/core": "4.5.0"
93
+ "webpack": "^5.103.0",
94
+ "@kubb/core": "4.5.11"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "@kubb/core": "^4.0.0",
package/src/index.ts CHANGED
@@ -34,7 +34,7 @@ export const unpluginFactory: UnpluginFactory<Options | undefined> = (options) =
34
34
  },
35
35
  },
36
36
 
37
- async buildStart() {
37
+ async install() {
38
38
  if (!options?.config) {
39
39
  throw new Error('Config is not set')
40
40
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-Dn-CzqNK.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from '@kubb/core'\nimport { safeBuild } from '@kubb/core'\nimport { createLogger } from '@kubb/core/logger'\nimport type { UnpluginFactory } from 'unplugin'\nimport { createUnplugin } from 'unplugin'\nimport type { Options } from './types.ts'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {\n const name = 'unplugin-kubb' as const\n const logger = createLogger({\n name,\n })\n\n return {\n name,\n enforce: 'pre',\n vite: {\n configResolved(config) {\n logger.on('start', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('success', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('warning', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('error', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n },\n },\n\n async buildStart() {\n if (!options?.config) {\n throw new Error('Config is not set')\n }\n\n const { root: _root, ...userConfig } = options.config as Config\n\n logger.emit('start', 'Building')\n\n const { error } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n if (error) {\n throw error\n }\n },\n }\n}\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;AAOA,MAAaA,mBAAyD,YAAY;CAChF,MAAM,OAAO;CACb,MAAM,SAAS,aAAa,EAC1B,MACD,CAAC;AAEF,QAAO;EACL;EACA,SAAS;EACT,MAAM,EACJ,eAAe,QAAQ;AACrB,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;KAEL;EAED,MAAM,aAAa;AACjB,OAAI,CAAC,SAAS,OACZ,OAAM,IAAI,MAAM,oBAAoB;GAGtC,MAAM,EAAE,MAAM,MAAO,GAAG,eAAe,QAAQ;AAE/C,UAAO,KAAK,SAAS,WAAW;GAEhC,MAAM,EAAE,UAAU,MAAM,UAAU;IAChC,QAAQ;KACN,MAAM,QAAQ,KAAK;KACnB,GAAG;KACH,QAAQ;MACN,OAAO;MACP,GAAG,WAAW;MACf;KACF;IACD;IACD,CAAC;AAEF,OAAI,MACF,OAAM;;EAGX;;AAGH,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-INEri0Ub.cjs","names":["unpluginFactory: UnpluginFactory<Options | undefined>","unplugin"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from '@kubb/core'\nimport { safeBuild } from '@kubb/core'\nimport { createLogger } from '@kubb/core/logger'\nimport type { UnpluginFactory } from 'unplugin'\nimport { createUnplugin } from 'unplugin'\nimport type { Options } from './types.ts'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {\n const name = 'unplugin-kubb' as const\n const logger = createLogger({\n name,\n })\n\n return {\n name,\n enforce: 'pre',\n vite: {\n configResolved(config) {\n logger.on('start', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('success', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('warning', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('error', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n },\n },\n\n async buildStart() {\n if (!options?.config) {\n throw new Error('Config is not set')\n }\n\n const { root: _root, ...userConfig } = options.config as Config\n\n logger.emit('start', 'Building')\n\n const { error } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n if (error) {\n throw error\n }\n },\n }\n}\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAaA,mBAAyD,YAAY;CAChF,MAAM,OAAO;CACb,MAAM,8CAAsB,EAC1B,MACD,CAAC;AAEF,QAAO;EACL;EACA,SAAS;EACT,MAAM,EACJ,eAAe,QAAQ;AACrB,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;KAEL;EAED,MAAM,aAAa;AACjB,OAAI,CAAC,SAAS,OACZ,OAAM,IAAI,MAAM,oBAAoB;GAGtC,MAAM,EAAE,MAAM,MAAO,GAAG,eAAe,QAAQ;AAE/C,UAAO,KAAK,SAAS,WAAW;GAEhC,MAAM,EAAE,UAAU,iCAAgB;IAChC,QAAQ;KACN,MAAM,QAAQ,KAAK;KACnB,GAAG;KACH,QAAQ;MACN,OAAO;MACP,GAAG,WAAW;MACf;KACF;IACD;IACD,CAAC;AAEF,OAAI,MACF,OAAM;;EAGX;;AAGH,MAAaC,aAA2B,6CAAe,gBAAgB;AAEvE,kBAAeA"}