unplugin-kubb 4.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro.cjs +6 -5
- package/dist/astro.cjs.map +1 -1
- package/dist/astro.d.ts +4 -9
- package/dist/astro.js +6 -5
- package/dist/astro.js.map +1 -1
- package/dist/chunk-DKWOrOAv.js +9 -0
- package/dist/esbuild.cjs +3 -2
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.d.ts +5 -5
- package/dist/esbuild.js +1 -1
- package/dist/esbuild.js.map +1 -1
- package/dist/farm.cjs +10 -0
- package/dist/farm.cjs.map +1 -0
- package/dist/farm.d.ts +8 -0
- package/dist/farm.js +9 -0
- package/dist/farm.js.map +1 -0
- package/dist/index.cjs +12 -5
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -0
- package/dist/nuxt.cjs +9 -9
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.ts +2 -1
- package/dist/nuxt.js +5 -4
- package/dist/nuxt.js.map +1 -1
- package/dist/package-ClLHpgT2.js +6 -0
- package/dist/package-ClLHpgT2.js.map +1 -0
- package/dist/package-uutExRPO.cjs +55 -0
- package/dist/package-uutExRPO.cjs.map +1 -0
- package/dist/rolldown.cjs +10 -0
- package/dist/rolldown.cjs.map +1 -0
- package/dist/rolldown.d.ts +8 -0
- package/dist/rolldown.js +9 -0
- package/dist/rolldown.js.map +1 -0
- package/dist/rollup.cjs +3 -2
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.ts +5 -5
- package/dist/rollup.js +1 -1
- package/dist/rollup.js.map +1 -1
- package/dist/rspack.cjs +3 -2
- package/dist/rspack.cjs.map +1 -1
- package/dist/rspack.d.ts +3 -3
- package/dist/rspack.js +1 -1
- package/dist/rspack.js.map +1 -1
- package/dist/types.d.ts +13 -2
- package/dist/unpluginFactory.cjs +90 -0
- package/dist/unpluginFactory.cjs.map +1 -0
- package/dist/unpluginFactory.d.ts +9 -0
- package/dist/{src-y2za6sAo.js → unpluginFactory.js} +15 -20
- package/dist/unpluginFactory.js.map +1 -0
- package/dist/vite.cjs +9 -2
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.ts +5 -5
- package/dist/vite.js +8 -2
- package/dist/vite.js.map +1 -0
- package/dist/webpack.cjs +9 -2
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.d.ts +4 -4
- package/dist/webpack.js +8 -2
- package/dist/webpack.js.map +1 -0
- package/package.json +68 -42
- package/src/astro.ts +4 -5
- package/src/esbuild.ts +1 -1
- package/src/farm.ts +5 -0
- package/src/index.ts +6 -133
- package/src/nuxt.ts +2 -2
- package/src/rolldown.ts +5 -0
- package/src/rollup.ts +1 -1
- package/src/rspack.ts +1 -1
- package/src/unpluginFactory.ts +132 -0
- package/src/vite.ts +1 -1
- package/src/webpack.ts +1 -2
- package/dist/astro.d.cts +0 -11
- package/dist/esbuild.d.cts +0 -7
- package/dist/index.d.cts +0 -10
- package/dist/nuxt.d.cts +0 -9
- package/dist/rollup.d.cts +0 -7
- package/dist/rspack.d.cts +0 -6
- package/dist/src-7pFd4t48.cjs +0 -145
- package/dist/src-7pFd4t48.cjs.map +0 -1
- package/dist/src-y2za6sAo.js.map +0 -1
- package/dist/types-BWfxOttU.d.ts +0 -631
- package/dist/types-BgPPdoLi.d.cts +0 -631
- package/dist/types.d.cts +0 -2
- package/dist/vite-DXcgbm9H.js +0 -9
- package/dist/vite-DXcgbm9H.js.map +0 -1
- package/dist/vite-HDFFF5rj.cjs +0 -14
- package/dist/vite-HDFFF5rj.cjs.map +0 -1
- package/dist/vite.d.cts +0 -7
- package/dist/webpack-BqG9Y2kv.js +0 -9
- package/dist/webpack-BqG9Y2kv.js.map +0 -1
- package/dist/webpack-D1dzppyE.cjs +0 -14
- package/dist/webpack-D1dzppyE.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpluginFactory.cjs","names":["AsyncEventEmitter","process","unpluginVersion"],"sources":["../src/unpluginFactory.ts"],"sourcesContent":["import process from 'node:process'\nimport { type Config, type KubbEvents, safeBuild } from '@kubb/core'\nimport { AsyncEventEmitter } from '@kubb/core/utils'\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\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options, meta) => {\n const name = 'unplugin-kubb' as const\n const events = new AsyncEventEmitter<KubbEvents>()\n const isVite = meta.framework === 'vite'\n const hrStart = process.hrtime()\n\n async function runBuild(ctx: RollupContext) {\n if (!options?.config) {\n if (ctx.error) {\n ctx.error?.(`[${name}] Config is not set`)\n } else {\n console.error(`[${name}] Config is not set`)\n }\n return\n }\n\n events.on('lifecycle:start', (version) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n events.on('error', (error) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n events.on('warn', (message) => {\n console.warn(`⚠ ${message}`)\n })\n\n events.on('info', (message) => {\n console.info(`ℹ ${message}`)\n })\n\n events.on('success', (message) => {\n console.log(`✓ ${message}`)\n })\n\n events.on('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 events.on('files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n events.on('generation:end', (config) => {\n console.log(config.name ? `✓ Generation completed for ${config.name}` : '✓ Generation completed')\n })\n\n events.on('generation:summary', (config, { status, failedPlugins }) => {\n const pluginsCount = config.plugins?.length || 0\n const successCount = pluginsCount - failedPlugins.size\n\n console.log(\n status === 'success'\n ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total`\n : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`,\n )\n })\n\n await events.emit('lifecycle:start', unpluginVersion)\n\n const { root: _root, ...userConfig } = options.config as Config\n\n await events.emit('generation:start', options.config as Config)\n\n const { error, failedPlugins, pluginTimings, files, sources } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n events,\n })\n\n const hasFailures = failedPlugins.size > 0 || error\n if (hasFailures) {\n // Collect all errors from failed plugins and general error\n const allErrors: Error[] = [\n error,\n ...Array.from(failedPlugins)\n .filter((it) => it.error)\n .map((it) => it.error),\n ].filter(Boolean)\n\n allErrors.forEach((err) => {\n events.emit('error', err)\n })\n }\n\n await events.emit('generation:end', options.config as Config, files, sources)\n await events.emit('generation:summary', options.config as Config, {\n failedPlugins,\n filesCreated: files.length,\n status: failedPlugins.size > 0 || error ? 'failed' : 'success',\n hrStart,\n pluginTimings,\n })\n\n await events.emit('lifecycle:end')\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\n vite: {},\n }\n}\n"],"mappings":";;;;;;;;AAaA,MAAa,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,SAAS,IAAIA,oCAA+B;CAClD,MAAM,SAAS,KAAK,cAAc;CAClC,MAAM,UAAUC,qBAAQ,QAAQ;CAEhC,eAAe,SAAS,KAAoB;AAC1C,MAAI,CAAC,SAAS,QAAQ;AACpB,OAAI,IAAI,MACN,KAAI,QAAQ,IAAI,KAAK,qBAAqB;OAE1C,SAAQ,MAAM,IAAI,KAAK,qBAAqB;AAE9C;;AAGF,SAAO,GAAG,oBAAoB,YAAY;AACxC,WAAQ,IAAI,iBAAiB,QAAQ,KAAK;IAC1C;AAEF,SAAO,GAAG,UAAU,UAAU;AAC5B,WAAQ,MAAM,KAAK,OAAO,WAAW,WAAW;IAChD;AAEF,SAAO,GAAG,SAAS,YAAY;AAC7B,WAAQ,KAAK,KAAK,UAAU;IAC5B;AAEF,SAAO,GAAG,SAAS,YAAY;AAC7B,WAAQ,KAAK,KAAK,UAAU;IAC5B;AAEF,SAAO,GAAG,YAAY,YAAY;AAChC,WAAQ,IAAI,KAAK,UAAU;IAC3B;AAEF,SAAO,GAAG,eAAe,QAAQ,EAAE,eAAe;GAChD,MAAM,cAAc,YAAY,MAAO,IAAI,WAAW,KAAM,QAAQ,EAAE,CAAC,KAAK,GAAG,SAAS;AAExF,WAAQ,IAAI,KAAK,OAAO,KAAK,gBAAgB,cAAc;IAC3D;AAEF,SAAO,GAAG,8BAA8B;AAGtC,WAAQ,IAFK,+BAEI;IACjB;AAEF,SAAO,GAAG,mBAAmB,WAAW;AACtC,WAAQ,IAAI,OAAO,OAAO,8BAA8B,OAAO,SAAS,yBAAyB;IACjG;AAEF,SAAO,GAAG,uBAAuB,QAAQ,EAAE,QAAQ,oBAAoB;GACrE,MAAM,eAAe,OAAO,SAAS,UAAU;GAC/C,MAAM,eAAe,eAAe,cAAc;AAElD,WAAQ,IACN,WAAW,YACP,mBAAmB,GAAG,aAAa,aAAa,IAAI,aAAa,UACjE,mBAAmB,GAAG,aAAa,aAAa,MAAM,GAAG,cAAc,KAAK,SAAS,IAAI,aAAa,QAC3G;IACD;AAEF,QAAM,OAAO,KAAK,mBAAmBC,wBAAgB;EAErD,MAAM,EAAE,MAAM,OAAO,GAAG,eAAe,QAAQ;AAE/C,QAAM,OAAO,KAAK,oBAAoB,QAAQ,OAAiB;EAE/D,MAAM,EAAE,OAAO,eAAe,eAAe,OAAO,YAAY,gCAAgB;GAC9E,QAAQ;IACN,MAAMD,qBAAQ,KAAK;IACnB,GAAG;IACH,QAAQ;KACN,OAAO;KACP,GAAG,WAAW;KACf;IACF;GACD;GACD,CAAC;AAGF,MADoB,cAAc,OAAO,KAAK,MAU5C,CAP2B,CACzB,OACA,GAAG,MAAM,KAAK,cAAc,CACzB,QAAQ,OAAO,GAAG,MAAM,CACxB,KAAK,OAAO,GAAG,MAAM,CACzB,CAAC,OAAO,QAAQ,CAEP,SAAS,QAAQ;AACzB,UAAO,KAAK,SAAS,IAAI;IACzB;AAGJ,QAAM,OAAO,KAAK,kBAAkB,QAAQ,QAAkB,OAAO,QAAQ;AAC7E,QAAM,OAAO,KAAK,sBAAsB,QAAQ,QAAkB;GAChE;GACA,cAAc,MAAM;GACpB,QAAQ,cAAc,OAAO,KAAK,QAAQ,WAAW;GACrD;GACA;GACD,CAAC;AAEF,QAAM,OAAO,KAAK,gBAAgB;;AAGpC,QAAO;EACL;EACA,SAAS;EACT,OAAO,SAAS,UAAU;EAC1B,MAAM,aAAa;AACjB,SAAM,SAAS,KAAiC;;EAGlD,MAAM,EAAE;EACT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
+
import { Options } from "./types.js";
|
|
3
|
+
import { UnpluginFactory } from "unplugin";
|
|
4
|
+
|
|
5
|
+
//#region src/unpluginFactory.d.ts
|
|
6
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { unpluginFactory };
|
|
9
|
+
//# sourceMappingURL=unpluginFactory.d.ts.map
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { t as version } from "./package-ClLHpgT2.js";
|
|
1
3
|
import process from "node:process";
|
|
2
4
|
import { safeBuild } from "@kubb/core";
|
|
3
5
|
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
4
|
-
import { createUnplugin } from "unplugin";
|
|
5
6
|
|
|
6
|
-
//#region
|
|
7
|
-
var version = "4.0.1";
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/index.ts
|
|
7
|
+
//#region src/unpluginFactory.ts
|
|
11
8
|
const unpluginFactory = (options, meta) => {
|
|
12
9
|
const name = "unplugin-kubb";
|
|
13
10
|
const events = new AsyncEventEmitter();
|
|
@@ -19,11 +16,11 @@ const unpluginFactory = (options, meta) => {
|
|
|
19
16
|
else console.error(`[${name}] Config is not set`);
|
|
20
17
|
return;
|
|
21
18
|
}
|
|
22
|
-
events.on("lifecycle:start", (version
|
|
23
|
-
console.log(`Kubb Unplugin ${version
|
|
19
|
+
events.on("lifecycle:start", (version) => {
|
|
20
|
+
console.log(`Kubb Unplugin ${version} 🧩`);
|
|
24
21
|
});
|
|
25
|
-
events.on("error", (error
|
|
26
|
-
console.error(`✗ ${error
|
|
22
|
+
events.on("error", (error) => {
|
|
23
|
+
console.error(`✗ ${error?.message || "failed"}`);
|
|
27
24
|
});
|
|
28
25
|
events.on("warn", (message) => {
|
|
29
26
|
console.warn(`⚠ ${message}`);
|
|
@@ -34,7 +31,7 @@ const unpluginFactory = (options, meta) => {
|
|
|
34
31
|
events.on("success", (message) => {
|
|
35
32
|
console.log(`✓ ${message}`);
|
|
36
33
|
});
|
|
37
|
-
events.on("plugin:end", (plugin, duration) => {
|
|
34
|
+
events.on("plugin:end", (plugin, { duration }) => {
|
|
38
35
|
const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
|
|
39
36
|
console.log(`✓ ${plugin.name} completed in ${durationStr}`);
|
|
40
37
|
});
|
|
@@ -44,15 +41,15 @@ const unpluginFactory = (options, meta) => {
|
|
|
44
41
|
events.on("generation:end", (config) => {
|
|
45
42
|
console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
|
|
46
43
|
});
|
|
47
|
-
events.on("generation:summary", (config, { status, failedPlugins
|
|
44
|
+
events.on("generation:summary", (config, { status, failedPlugins }) => {
|
|
48
45
|
const pluginsCount = config.plugins?.length || 0;
|
|
49
|
-
const successCount = pluginsCount - failedPlugins
|
|
50
|
-
console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins
|
|
46
|
+
const successCount = pluginsCount - failedPlugins.size;
|
|
47
|
+
console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`);
|
|
51
48
|
});
|
|
52
49
|
await events.emit("lifecycle:start", version);
|
|
53
50
|
const { root: _root, ...userConfig } = options.config;
|
|
54
51
|
await events.emit("generation:start", options.config);
|
|
55
|
-
const { error, failedPlugins, pluginTimings, files } = await safeBuild({
|
|
52
|
+
const { error, failedPlugins, pluginTimings, files, sources } = await safeBuild({
|
|
56
53
|
config: {
|
|
57
54
|
root: process.cwd(),
|
|
58
55
|
...userConfig,
|
|
@@ -66,7 +63,7 @@ const unpluginFactory = (options, meta) => {
|
|
|
66
63
|
if (failedPlugins.size > 0 || error) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
|
|
67
64
|
events.emit("error", err);
|
|
68
65
|
});
|
|
69
|
-
await events.emit("generation:end", options.config);
|
|
66
|
+
await events.emit("generation:end", options.config, files, sources);
|
|
70
67
|
await events.emit("generation:summary", options.config, {
|
|
71
68
|
failedPlugins,
|
|
72
69
|
filesCreated: files.length,
|
|
@@ -86,9 +83,7 @@ const unpluginFactory = (options, meta) => {
|
|
|
86
83
|
vite: {}
|
|
87
84
|
};
|
|
88
85
|
};
|
|
89
|
-
const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
90
|
-
var src_default = unplugin;
|
|
91
86
|
|
|
92
87
|
//#endregion
|
|
93
|
-
export {
|
|
94
|
-
//# sourceMappingURL=
|
|
88
|
+
export { unpluginFactory };
|
|
89
|
+
//# sourceMappingURL=unpluginFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpluginFactory.js","names":["unpluginVersion"],"sources":["../src/unpluginFactory.ts"],"sourcesContent":["import process from 'node:process'\nimport { type Config, type KubbEvents, safeBuild } from '@kubb/core'\nimport { AsyncEventEmitter } from '@kubb/core/utils'\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\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options, meta) => {\n const name = 'unplugin-kubb' as const\n const events = new AsyncEventEmitter<KubbEvents>()\n const isVite = meta.framework === 'vite'\n const hrStart = process.hrtime()\n\n async function runBuild(ctx: RollupContext) {\n if (!options?.config) {\n if (ctx.error) {\n ctx.error?.(`[${name}] Config is not set`)\n } else {\n console.error(`[${name}] Config is not set`)\n }\n return\n }\n\n events.on('lifecycle:start', (version) => {\n console.log(`Kubb Unplugin ${version} 🧩`)\n })\n\n events.on('error', (error) => {\n console.error(`✗ ${error?.message || 'failed'}`)\n })\n\n events.on('warn', (message) => {\n console.warn(`⚠ ${message}`)\n })\n\n events.on('info', (message) => {\n console.info(`ℹ ${message}`)\n })\n\n events.on('success', (message) => {\n console.log(`✓ ${message}`)\n })\n\n events.on('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 events.on('files:processing:end', () => {\n const text = '✓ Files written successfully'\n\n console.log(text)\n })\n\n events.on('generation:end', (config) => {\n console.log(config.name ? `✓ Generation completed for ${config.name}` : '✓ Generation completed')\n })\n\n events.on('generation:summary', (config, { status, failedPlugins }) => {\n const pluginsCount = config.plugins?.length || 0\n const successCount = pluginsCount - failedPlugins.size\n\n console.log(\n status === 'success'\n ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total`\n : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`,\n )\n })\n\n await events.emit('lifecycle:start', unpluginVersion)\n\n const { root: _root, ...userConfig } = options.config as Config\n\n await events.emit('generation:start', options.config as Config)\n\n const { error, failedPlugins, pluginTimings, files, sources } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n events,\n })\n\n const hasFailures = failedPlugins.size > 0 || error\n if (hasFailures) {\n // Collect all errors from failed plugins and general error\n const allErrors: Error[] = [\n error,\n ...Array.from(failedPlugins)\n .filter((it) => it.error)\n .map((it) => it.error),\n ].filter(Boolean)\n\n allErrors.forEach((err) => {\n events.emit('error', err)\n })\n }\n\n await events.emit('generation:end', options.config as Config, files, sources)\n await events.emit('generation:summary', options.config as Config, {\n failedPlugins,\n filesCreated: files.length,\n status: failedPlugins.size > 0 || error ? 'failed' : 'success',\n hrStart,\n pluginTimings,\n })\n\n await events.emit('lifecycle:end')\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\n vite: {},\n }\n}\n"],"mappings":";;;;;;;AAaA,MAAa,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,SAAS,IAAI,mBAA+B;CAClD,MAAM,SAAS,KAAK,cAAc;CAClC,MAAM,UAAU,QAAQ,QAAQ;CAEhC,eAAe,SAAS,KAAoB;AAC1C,MAAI,CAAC,SAAS,QAAQ;AACpB,OAAI,IAAI,MACN,KAAI,QAAQ,IAAI,KAAK,qBAAqB;OAE1C,SAAQ,MAAM,IAAI,KAAK,qBAAqB;AAE9C;;AAGF,SAAO,GAAG,oBAAoB,YAAY;AACxC,WAAQ,IAAI,iBAAiB,QAAQ,KAAK;IAC1C;AAEF,SAAO,GAAG,UAAU,UAAU;AAC5B,WAAQ,MAAM,KAAK,OAAO,WAAW,WAAW;IAChD;AAEF,SAAO,GAAG,SAAS,YAAY;AAC7B,WAAQ,KAAK,KAAK,UAAU;IAC5B;AAEF,SAAO,GAAG,SAAS,YAAY;AAC7B,WAAQ,KAAK,KAAK,UAAU;IAC5B;AAEF,SAAO,GAAG,YAAY,YAAY;AAChC,WAAQ,IAAI,KAAK,UAAU;IAC3B;AAEF,SAAO,GAAG,eAAe,QAAQ,EAAE,eAAe;GAChD,MAAM,cAAc,YAAY,MAAO,IAAI,WAAW,KAAM,QAAQ,EAAE,CAAC,KAAK,GAAG,SAAS;AAExF,WAAQ,IAAI,KAAK,OAAO,KAAK,gBAAgB,cAAc;IAC3D;AAEF,SAAO,GAAG,8BAA8B;AAGtC,WAAQ,IAFK,+BAEI;IACjB;AAEF,SAAO,GAAG,mBAAmB,WAAW;AACtC,WAAQ,IAAI,OAAO,OAAO,8BAA8B,OAAO,SAAS,yBAAyB;IACjG;AAEF,SAAO,GAAG,uBAAuB,QAAQ,EAAE,QAAQ,oBAAoB;GACrE,MAAM,eAAe,OAAO,SAAS,UAAU;GAC/C,MAAM,eAAe,eAAe,cAAc;AAElD,WAAQ,IACN,WAAW,YACP,mBAAmB,GAAG,aAAa,aAAa,IAAI,aAAa,UACjE,mBAAmB,GAAG,aAAa,aAAa,MAAM,GAAG,cAAc,KAAK,SAAS,IAAI,aAAa,QAC3G;IACD;AAEF,QAAM,OAAO,KAAK,mBAAmBA,QAAgB;EAErD,MAAM,EAAE,MAAM,OAAO,GAAG,eAAe,QAAQ;AAE/C,QAAM,OAAO,KAAK,oBAAoB,QAAQ,OAAiB;EAE/D,MAAM,EAAE,OAAO,eAAe,eAAe,OAAO,YAAY,MAAM,UAAU;GAC9E,QAAQ;IACN,MAAM,QAAQ,KAAK;IACnB,GAAG;IACH,QAAQ;KACN,OAAO;KACP,GAAG,WAAW;KACf;IACF;GACD;GACD,CAAC;AAGF,MADoB,cAAc,OAAO,KAAK,MAU5C,CAP2B,CACzB,OACA,GAAG,MAAM,KAAK,cAAc,CACzB,QAAQ,OAAO,GAAG,MAAM,CACxB,KAAK,OAAO,GAAG,MAAM,CACzB,CAAC,OAAO,QAAQ,CAEP,SAAS,QAAQ;AACzB,UAAO,KAAK,SAAS,IAAI;IACzB;AAGJ,QAAM,OAAO,KAAK,kBAAkB,QAAQ,QAAkB,OAAO,QAAQ;AAC7E,QAAM,OAAO,KAAK,sBAAsB,QAAQ,QAAkB;GAChE;GACA,cAAc,MAAM;GACpB,QAAQ,cAAc,OAAO,KAAK,QAAQ,WAAW;GACrD;GACA;GACD,CAAC;AAEF,QAAM,OAAO,KAAK,gBAAgB;;AAGpC,QAAO;EACL;EACA,SAAS;EACT,OAAO,SAAS,UAAU;EAC1B,MAAM,aAAa;AACjB,SAAM,SAAS,KAAiC;;EAGlD,MAAM,EAAE;EACT"}
|
package/dist/vite.cjs
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_package = require('./package-uutExRPO.cjs');
|
|
2
|
+
const require_unpluginFactory = require('./unpluginFactory.cjs');
|
|
3
|
+
let unplugin = require("unplugin");
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
//#region src/vite.ts
|
|
6
|
+
var vite_default = (0, unplugin.createVitePlugin)(require_unpluginFactory.unpluginFactory);
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = vite_default;
|
|
10
|
+
//# sourceMappingURL=vite.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;;AAIA,kDAAgCA,wCAAgB"}
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
+
import { Options } from "./types.js";
|
|
3
|
+
import * as vite from "vite";
|
|
3
4
|
|
|
4
5
|
//#region src/vite.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
6
|
-
|
|
7
|
-
export { _default as default };
|
|
6
|
+
declare const _default: (options?: Options | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
7
|
+
export = _default;
|
|
8
8
|
//# sourceMappingURL=vite.d.ts.map
|
package/dist/vite.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unpluginFactory } from "./unpluginFactory.js";
|
|
2
|
+
import { createVitePlugin } from "unplugin";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/vite.ts
|
|
5
|
+
var vite_default = createVitePlugin(unpluginFactory);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { vite_default as default };
|
|
9
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,mBAAe,iBAAiB,gBAAgB"}
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_package = require('./package-uutExRPO.cjs');
|
|
2
|
+
const require_unpluginFactory = require('./unpluginFactory.cjs');
|
|
3
|
+
let unplugin = require("unplugin");
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
//#region src/webpack.ts
|
|
6
|
+
var webpack_default = (0, unplugin.createWebpackPlugin)(require_unpluginFactory.unpluginFactory);
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = webpack_default;
|
|
10
|
+
//# sourceMappingURL=webpack.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;;AAMA,wDAAmCA,wCAAgB"}
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
+
import { Options } from "./types.js";
|
|
2
3
|
import { UnpluginFactoryOutput } from "unplugin";
|
|
3
4
|
import { WebpackPluginInstance } from "webpack";
|
|
4
5
|
|
|
5
6
|
//#region src/webpack.d.ts
|
|
6
7
|
declare const _default: UnpluginFactoryOutput<Options, WebpackPluginInstance>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=webpack.d.ts.map
|
|
8
|
+
export = _default;
|
|
9
|
+
//# sourceMappingURL=webpack.d.ts.mapppingURL=webpack.d.ts.map
|
package/dist/webpack.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unpluginFactory } from "./unpluginFactory.js";
|
|
2
|
+
import { createWebpackPlugin } from "unplugin";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/webpack.ts
|
|
5
|
+
var webpack_default = createWebpackPlugin(unpluginFactory);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { webpack_default as default };
|
|
9
|
+
//# sourceMappingURL=webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;AAMA,sBAAe,oBAAoB,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-kubb",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "Universal build plugin for Kubb, integrating OpenAPI code generation into Vite, Webpack, Rollup, esbuild, Rspack, Nuxt, and Astro build processes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unplugin",
|
|
7
7
|
"vite",
|
|
8
8
|
"webpack",
|
|
9
9
|
"rollup",
|
|
10
|
-
"
|
|
11
|
-
"astro",
|
|
12
|
-
"kubb",
|
|
13
|
-
"swagger",
|
|
14
|
-
"OpenAPI",
|
|
10
|
+
"esbuild",
|
|
15
11
|
"rspack",
|
|
16
12
|
"nuxt",
|
|
17
|
-
"
|
|
13
|
+
"astro",
|
|
14
|
+
"build-tool",
|
|
15
|
+
"bundler",
|
|
16
|
+
"transform",
|
|
17
|
+
"openapi",
|
|
18
|
+
"swagger",
|
|
19
|
+
"code-generator",
|
|
20
|
+
"typescript",
|
|
21
|
+
"kubb"
|
|
18
22
|
],
|
|
19
23
|
"repository": {
|
|
20
24
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/kubb-labs/kubb.git",
|
|
25
|
+
"url": "git+https://github.com/kubb-labs/kubb.git",
|
|
22
26
|
"directory": "packages/unplugin"
|
|
23
27
|
},
|
|
24
28
|
"license": "MIT",
|
|
@@ -27,46 +31,56 @@
|
|
|
27
31
|
"type": "module",
|
|
28
32
|
"exports": {
|
|
29
33
|
".": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
34
|
+
"import": "./dist/index.js",
|
|
35
|
+
"require": "./dist/index.cjs"
|
|
32
36
|
},
|
|
33
37
|
"./astro": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
38
|
+
"import": "./dist/astro.js",
|
|
39
|
+
"require": "./dist/astro.cjs"
|
|
36
40
|
},
|
|
37
41
|
"./esbuild": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
42
|
+
"import": "./dist/esbuild.js",
|
|
43
|
+
"require": "./dist/esbuild.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./farm": {
|
|
46
|
+
"import": "./dist/farm.js",
|
|
47
|
+
"require": "./dist/farm.cjs"
|
|
40
48
|
},
|
|
41
49
|
"./nuxt": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
50
|
+
"import": "./dist/nuxt.js",
|
|
51
|
+
"require": "./dist/nuxt.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./rolldown": {
|
|
54
|
+
"import": "./dist/rolldown.js",
|
|
55
|
+
"require": "./dist/rolldown.cjs"
|
|
44
56
|
},
|
|
45
57
|
"./rollup": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
58
|
+
"import": "./dist/rollup.js",
|
|
59
|
+
"require": "./dist/rollup.cjs"
|
|
48
60
|
},
|
|
49
61
|
"./rspack": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
62
|
+
"import": "./dist/rspack.js",
|
|
63
|
+
"require": "./dist/rspack.cjs"
|
|
52
64
|
},
|
|
53
65
|
"./types": {
|
|
54
|
-
"
|
|
55
|
-
"
|
|
66
|
+
"import": "./dist/types.js",
|
|
67
|
+
"require": "./dist/types.cjs"
|
|
68
|
+
},
|
|
69
|
+
"./unpluginFactory": {
|
|
70
|
+
"import": "./dist/unpluginFactory.js",
|
|
71
|
+
"require": "./dist/unpluginFactory.cjs"
|
|
56
72
|
},
|
|
57
73
|
"./vite": {
|
|
58
|
-
"
|
|
59
|
-
"
|
|
74
|
+
"import": "./dist/vite.js",
|
|
75
|
+
"require": "./dist/vite.cjs"
|
|
60
76
|
},
|
|
61
77
|
"./webpack": {
|
|
62
|
-
"
|
|
63
|
-
"
|
|
78
|
+
"import": "./dist/webpack.js",
|
|
79
|
+
"require": "./dist/webpack.cjs"
|
|
64
80
|
},
|
|
65
81
|
"./package.json": "./package.json"
|
|
66
82
|
},
|
|
67
|
-
"
|
|
68
|
-
"module": "./dist/index.js",
|
|
69
|
-
"types": "./dist/index.d.cts",
|
|
83
|
+
"types": "./dist/index.d.ts",
|
|
70
84
|
"typesVersions": {
|
|
71
85
|
"*": {
|
|
72
86
|
"*": [
|
|
@@ -82,27 +96,34 @@
|
|
|
82
96
|
"!/**/__tests__/**"
|
|
83
97
|
],
|
|
84
98
|
"dependencies": {
|
|
85
|
-
"unplugin": "^
|
|
99
|
+
"unplugin": "^3.0.0"
|
|
86
100
|
},
|
|
87
101
|
"devDependencies": {
|
|
88
|
-
"@
|
|
89
|
-
"@nuxt/
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
102
|
+
"@farmfe/core": "^1.7.11",
|
|
103
|
+
"@nuxt/kit": "^4.3.1",
|
|
104
|
+
"@nuxt/schema": "^4.3.1",
|
|
105
|
+
"esbuild": "*",
|
|
106
|
+
"rolldown": "~1.0.0-rc.5",
|
|
107
|
+
"rollup": "^4.59.0",
|
|
108
|
+
"vite": "^7.3.1",
|
|
109
|
+
"webpack": "^5.105.2",
|
|
110
|
+
"@kubb/core": "4.29.0"
|
|
95
111
|
},
|
|
96
112
|
"peerDependencies": {
|
|
113
|
+
"@farmfe/core": "^1.7.0",
|
|
97
114
|
"@kubb/core": "^4.0.0",
|
|
98
|
-
"@nuxt/kit": "^3",
|
|
99
|
-
"@nuxt/schema": "^3",
|
|
115
|
+
"@nuxt/kit": "^3 || ^4",
|
|
116
|
+
"@nuxt/schema": "^3 || ^4",
|
|
100
117
|
"esbuild": "*",
|
|
101
|
-
"
|
|
118
|
+
"rolldown": ">=1",
|
|
119
|
+
"rollup": "^3 || ^4",
|
|
102
120
|
"vite": ">=3",
|
|
103
121
|
"webpack": "^5"
|
|
104
122
|
},
|
|
105
123
|
"peerDependenciesMeta": {
|
|
124
|
+
"@farmfe/core": {
|
|
125
|
+
"optional": true
|
|
126
|
+
},
|
|
106
127
|
"@nuxt/kit": {
|
|
107
128
|
"optional": true
|
|
108
129
|
},
|
|
@@ -112,6 +133,9 @@
|
|
|
112
133
|
"esbuild": {
|
|
113
134
|
"optional": true
|
|
114
135
|
},
|
|
136
|
+
"rolldown": {
|
|
137
|
+
"optional": true
|
|
138
|
+
},
|
|
115
139
|
"rollup": {
|
|
116
140
|
"optional": true
|
|
117
141
|
},
|
|
@@ -129,9 +153,11 @@
|
|
|
129
153
|
"access": "public",
|
|
130
154
|
"registry": "https://registry.npmjs.org/"
|
|
131
155
|
},
|
|
156
|
+
"main": "./dist/index.cjs",
|
|
157
|
+
"module": "./dist/index.js",
|
|
132
158
|
"scripts": {
|
|
133
159
|
"build": "tsdown",
|
|
134
|
-
"clean": "
|
|
160
|
+
"clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
|
|
135
161
|
"lint": "bun biome lint .",
|
|
136
162
|
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
137
163
|
"release": "pnpm publish --no-git-check",
|
package/src/astro.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import unplugin from './index.ts'
|
|
2
|
-
|
|
3
1
|
import type { Options } from './types.ts'
|
|
2
|
+
import vitePlugin from './vite.ts'
|
|
4
3
|
|
|
5
|
-
export default (options: Options) => ({
|
|
6
|
-
name: 'unplugin-
|
|
4
|
+
export default (options: Options): any => ({
|
|
5
|
+
name: 'unplugin-kubb',
|
|
7
6
|
hooks: {
|
|
8
7
|
'astro:config:setup': async (astro: any) => {
|
|
9
8
|
astro.config.vite.plugins ||= []
|
|
10
|
-
astro.config.vite.plugins.push(
|
|
9
|
+
astro.config.vite.plugins.push(vitePlugin(options))
|
|
11
10
|
},
|
|
12
11
|
},
|
|
13
12
|
})
|
package/src/esbuild.ts
CHANGED
package/src/farm.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -1,137 +1,10 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { type Config, type KubbEvents, safeBuild } from '@kubb/core'
|
|
3
|
-
import { AsyncEventEmitter } from '@kubb/core/utils'
|
|
4
|
-
import type { UnpluginFactory } from 'unplugin'
|
|
5
1
|
import { createUnplugin } from 'unplugin'
|
|
6
|
-
import {
|
|
7
|
-
import type { Options } from './types.ts'
|
|
2
|
+
import { unpluginFactory } from './unpluginFactory.ts'
|
|
8
3
|
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
warn?: (message: string) => void
|
|
12
|
-
error?: (message: string) => void
|
|
13
|
-
}
|
|
4
|
+
export type { Options } from './types.ts'
|
|
5
|
+
export { unpluginFactory } from './unpluginFactory.ts'
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
const name = 'unplugin-kubb' as const
|
|
17
|
-
const events = new AsyncEventEmitter<KubbEvents>()
|
|
18
|
-
const isVite = meta.framework === 'vite'
|
|
19
|
-
const hrStart = process.hrtime()
|
|
7
|
+
const plugin = /* #__PURE__ */ createUnplugin(unpluginFactory)
|
|
20
8
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (ctx.error) {
|
|
24
|
-
ctx.error?.(`[${name}] Config is not set`)
|
|
25
|
-
} else {
|
|
26
|
-
console.error(`[${name}] Config is not set`)
|
|
27
|
-
}
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
events.on('lifecycle:start', (version) => {
|
|
32
|
-
console.log(`Kubb Unplugin ${version} 🧩`)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
events.on('error', (error) => {
|
|
36
|
-
console.error(`✗ ${error?.message || 'failed'}`)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
events.on('warn', (message) => {
|
|
40
|
-
console.warn(`⚠ ${message}`)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
events.on('info', (message) => {
|
|
44
|
-
console.info(`ℹ ${message}`)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
events.on('success', (message) => {
|
|
48
|
-
console.log(`✓ ${message}`)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
events.on('plugin:end', (plugin, duration) => {
|
|
52
|
-
const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`
|
|
53
|
-
|
|
54
|
-
console.log(`✓ ${plugin.name} completed in ${durationStr}`)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
events.on('files:processing:end', () => {
|
|
58
|
-
const text = '✓ Files written successfully'
|
|
59
|
-
|
|
60
|
-
console.log(text)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
events.on('generation:end', (config) => {
|
|
64
|
-
console.log(config.name ? `✓ Generation completed for ${config.name}` : '✓ Generation completed')
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
events.on('generation:summary', (config, { status, failedPlugins }) => {
|
|
68
|
-
const pluginsCount = config.plugins?.length || 0
|
|
69
|
-
const successCount = pluginsCount - failedPlugins.size
|
|
70
|
-
|
|
71
|
-
console.log(
|
|
72
|
-
status === 'success'
|
|
73
|
-
? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total`
|
|
74
|
-
: `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`,
|
|
75
|
-
)
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
await events.emit('lifecycle:start', unpluginVersion)
|
|
79
|
-
|
|
80
|
-
const { root: _root, ...userConfig } = options.config as Config
|
|
81
|
-
|
|
82
|
-
await events.emit('generation:start', options.config as Config)
|
|
83
|
-
|
|
84
|
-
const { error, failedPlugins, pluginTimings, files } = await safeBuild({
|
|
85
|
-
config: {
|
|
86
|
-
root: process.cwd(),
|
|
87
|
-
...userConfig,
|
|
88
|
-
output: {
|
|
89
|
-
write: true,
|
|
90
|
-
...userConfig.output,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
events,
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
const hasFailures = failedPlugins.size > 0 || error
|
|
97
|
-
if (hasFailures) {
|
|
98
|
-
// Collect all errors from failed plugins and general error
|
|
99
|
-
const allErrors: Error[] = [
|
|
100
|
-
error,
|
|
101
|
-
...Array.from(failedPlugins)
|
|
102
|
-
.filter((it) => it.error)
|
|
103
|
-
.map((it) => it.error),
|
|
104
|
-
].filter(Boolean)
|
|
105
|
-
|
|
106
|
-
allErrors.forEach((err) => {
|
|
107
|
-
events.emit('error', err)
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
await events.emit('generation:end', options.config as Config)
|
|
112
|
-
await events.emit('generation:summary', options.config as Config, {
|
|
113
|
-
failedPlugins,
|
|
114
|
-
filesCreated: files.length,
|
|
115
|
-
status: failedPlugins.size > 0 || error ? 'failed' : 'success',
|
|
116
|
-
hrStart,
|
|
117
|
-
pluginTimings,
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
await events.emit('lifecycle:end')
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
name,
|
|
125
|
-
enforce: 'pre',
|
|
126
|
-
apply: isVite ? 'build' : undefined,
|
|
127
|
-
async buildStart() {
|
|
128
|
-
await runBuild(this as unknown as RollupContext)
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
vite: {},
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)
|
|
136
|
-
|
|
137
|
-
export default unplugin
|
|
9
|
+
export { plugin as unplugin }
|
|
10
|
+
export { plugin as default }
|
package/src/nuxt.ts
CHANGED
|
@@ -9,8 +9,8 @@ export interface ModuleOptions extends Options {}
|
|
|
9
9
|
|
|
10
10
|
export default defineNuxtModule<ModuleOptions>({
|
|
11
11
|
meta: {
|
|
12
|
-
name: 'nuxt-unplugin-
|
|
13
|
-
configKey: '
|
|
12
|
+
name: 'nuxt-unplugin-kubb',
|
|
13
|
+
configKey: 'unpluginKubb',
|
|
14
14
|
},
|
|
15
15
|
defaults: undefined,
|
|
16
16
|
setup(options, _nuxt) {
|
package/src/rolldown.ts
ADDED
package/src/rollup.ts
CHANGED
package/src/rspack.ts
CHANGED