unplugin-kubb 4.0.1 → 4.0.2
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 +2 -1
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.ts +2 -1
- package/dist/astro.js +3 -1
- package/dist/astro.js.map +1 -1
- package/dist/chunk-CIm-hhu7.js +9 -0
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +2 -1
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/nuxt.cjs +7 -7
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +2 -1
- package/dist/nuxt.js +3 -2
- package/dist/nuxt.js.map +1 -1
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +2 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +2 -1
- package/dist/rspack.js +1 -1
- package/dist/{src-7pFd4t48.cjs → src-BiN2tznZ.cjs} +17 -7
- package/dist/src-BiN2tznZ.cjs.map +1 -0
- package/dist/{src-y2za6sAo.js → src-CiUcBKSs.js} +4 -3
- package/dist/src-CiUcBKSs.js.map +1 -0
- package/dist/{types-BgPPdoLi.d.cts → types-C-ZTDGdJ.d.cts} +34 -15
- package/dist/{types-BWfxOttU.d.ts → types-CUVJ-CBJ.d.ts} +32 -14
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/vite.cjs +8 -2
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +3 -3
- package/dist/vite.d.ts +4 -3
- package/dist/vite.js +8 -2
- package/dist/vite.js.map +1 -0
- package/dist/webpack.cjs +8 -2
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +2 -1
- package/dist/webpack.js +8 -2
- package/dist/webpack.js.map +1 -0
- package/package.json +6 -5
- package/src/index.ts +1 -1
- package/dist/src-7pFd4t48.cjs.map +0 -1
- package/dist/src-y2za6sAo.js.map +0 -1
- 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/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/astro.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_src = require('./src-
|
|
1
|
+
const require_src = require('./src-BiN2tznZ.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/astro.ts
|
|
4
4
|
var astro_default = (options) => ({
|
|
@@ -8,6 +8,7 @@ var astro_default = (options) => ({
|
|
|
8
8
|
astro.config.vite.plugins.push(require_src.src_default.vite(options));
|
|
9
9
|
} }
|
|
10
10
|
});
|
|
11
|
+
require_src.__name(astro_default, "default");
|
|
11
12
|
|
|
12
13
|
//#endregion
|
|
13
14
|
module.exports = astro_default;
|
package/dist/astro.d.cts
CHANGED
package/dist/astro.d.ts
CHANGED
package/dist/astro.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as __name } from "./chunk-CIm-hhu7.js";
|
|
2
|
+
import { t as src_default } from "./src-CiUcBKSs.js";
|
|
2
3
|
|
|
3
4
|
//#region src/astro.ts
|
|
4
5
|
var astro_default = (options) => ({
|
|
@@ -8,6 +9,7 @@ var astro_default = (options) => ({
|
|
|
8
9
|
astro.config.vite.plugins.push(src_default.vite(options));
|
|
9
10
|
} }
|
|
10
11
|
});
|
|
12
|
+
__name(astro_default, "default");
|
|
11
13
|
|
|
12
14
|
//#endregion
|
|
13
15
|
export { astro_default as default };
|
package/dist/astro.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro.js","names":["unplugin"],"sources":["../src/astro.ts"],"sourcesContent":["import unplugin from './index.ts'\n\nimport type { Options } from './types.ts'\n\nexport default (options: Options) => ({\n name: 'unplugin-starter',\n hooks: {\n 'astro:config:setup': async (astro: any) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(unplugin.vite(options))\n },\n },\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"astro.js","names":["unplugin"],"sources":["../src/astro.ts"],"sourcesContent":["import unplugin from './index.ts'\n\nimport type { Options } from './types.ts'\n\nexport default (options: Options) => ({\n name: 'unplugin-starter',\n hooks: {\n 'astro:config:setup': async (astro: any) => {\n astro.config.vite.plugins ||= []\n astro.config.vite.plugins.push(unplugin.vite(options))\n },\n },\n})\n"],"mappings":";;;;AAIA,qBAAgB,aAAsB;CACpC,MAAM;CACN,OAAO,EACL,sBAAsB,OAAO,UAAe;AAC1C,QAAM,OAAO,KAAK,YAAY,EAAE;AAChC,QAAM,OAAO,KAAK,QAAQ,KAAKA,YAAS,KAAK,QAAQ,CAAC;IAEzD;CACF"}
|
package/dist/esbuild.cjs
CHANGED
package/dist/esbuild.d.cts
CHANGED
package/dist/esbuild.d.ts
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as Options } from "./types-
|
|
2
|
-
import * as
|
|
1
|
+
import { n as __name, t as Options } from "./types-C-ZTDGdJ.cjs";
|
|
2
|
+
import * as unplugin0 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:
|
|
7
|
+
declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { unplugin as default, unplugin, unpluginFactory };
|
|
10
10
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const require_src = require('./src-
|
|
2
|
-
const require_vite = require('./vite
|
|
3
|
-
const require_webpack = require('./webpack
|
|
4
|
-
let
|
|
1
|
+
const require_src = require('./src-BiN2tznZ.cjs');
|
|
2
|
+
const require_vite = require('./vite.cjs');
|
|
3
|
+
const require_webpack = require('./webpack.cjs');
|
|
4
|
+
let _nuxt_kit = require("@nuxt/kit");
|
|
5
5
|
require("@nuxt/schema");
|
|
6
6
|
|
|
7
7
|
//#region src/nuxt.ts
|
|
8
|
-
var nuxt_default = (0,
|
|
8
|
+
var nuxt_default = (0, _nuxt_kit.defineNuxtModule)({
|
|
9
9
|
meta: {
|
|
10
10
|
name: "nuxt-unplugin-starter",
|
|
11
11
|
configKey: "unpluginStarter"
|
|
12
12
|
},
|
|
13
13
|
defaults: void 0,
|
|
14
14
|
setup(options, _nuxt) {
|
|
15
|
-
(0,
|
|
16
|
-
(0,
|
|
15
|
+
(0, _nuxt_kit.addVitePlugin)(() => require_vite.default(options));
|
|
16
|
+
(0, _nuxt_kit.addWebpackPlugin)(() => require_webpack.default(options));
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
|
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,
|
|
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,mDAA+C;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,UAAU;CACV,MAAM,SAAS,OAAO;AACpB,qCAAoBA,qBAAK,QAAQ,CAAC;AAClC,wCAAuBC,wBAAQ,QAAQ,CAAC;;CAI3C,CAAC"}
|
package/dist/nuxt.d.cts
CHANGED
package/dist/nuxt.d.ts
CHANGED
package/dist/nuxt.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import
|
|
1
|
+
import { t as __name } from "./chunk-CIm-hhu7.js";
|
|
2
|
+
import vite_default from "./vite.js";
|
|
3
|
+
import webpack_default from "./webpack.js";
|
|
3
4
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
4
5
|
import "@nuxt/schema";
|
|
5
6
|
|
package/dist/nuxt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.js","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":"
|
|
1
|
+
{"version":3,"file":"nuxt.js","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,mBAAe,iBAAgC;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,UAAU;CACV,MAAM,SAAS,OAAO;AACpB,sBAAoBA,aAAK,QAAQ,CAAC;AAClC,yBAAuBC,gBAAQ,QAAQ,CAAC;;CAI3C,CAAC"}
|
package/dist/rollup.cjs
CHANGED
package/dist/rollup.d.cts
CHANGED
package/dist/rollup.d.ts
CHANGED
package/dist/rollup.js
CHANGED
package/dist/rspack.cjs
CHANGED
package/dist/rspack.d.cts
CHANGED
package/dist/rspack.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as __name } from "./chunk-CIm-hhu7.js";
|
|
2
|
+
import { t as Options } from "./types-CUVJ-CBJ.js";
|
|
2
3
|
|
|
3
4
|
//#region src/rspack.d.ts
|
|
4
5
|
declare const _default: (options?: Options | undefined) => RspackPluginInstance;
|
package/dist/rspack.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
4
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -27,18 +31,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
31
|
//#endregion
|
|
28
32
|
let node_process = require("node:process");
|
|
29
33
|
node_process = __toESM(node_process);
|
|
30
|
-
let
|
|
31
|
-
let
|
|
34
|
+
let _kubb_core = require("@kubb/core");
|
|
35
|
+
let _kubb_core_utils = require("@kubb/core/utils");
|
|
32
36
|
let unplugin = require("unplugin");
|
|
33
37
|
|
|
34
38
|
//#region package.json
|
|
35
|
-
var version = "4.0.
|
|
39
|
+
var version = "4.0.2";
|
|
36
40
|
|
|
37
41
|
//#endregion
|
|
38
42
|
//#region src/index.ts
|
|
39
43
|
const unpluginFactory = (options, meta) => {
|
|
40
44
|
const name = "unplugin-kubb";
|
|
41
|
-
const events = new
|
|
45
|
+
const events = new _kubb_core_utils.AsyncEventEmitter();
|
|
42
46
|
const isVite = meta.framework === "vite";
|
|
43
47
|
const hrStart = node_process.default.hrtime();
|
|
44
48
|
async function runBuild(ctx) {
|
|
@@ -62,7 +66,7 @@ const unpluginFactory = (options, meta) => {
|
|
|
62
66
|
events.on("success", (message) => {
|
|
63
67
|
console.log(`✓ ${message}`);
|
|
64
68
|
});
|
|
65
|
-
events.on("plugin:end", (plugin, duration) => {
|
|
69
|
+
events.on("plugin:end", (plugin, { duration }) => {
|
|
66
70
|
const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
|
|
67
71
|
console.log(`✓ ${plugin.name} completed in ${durationStr}`);
|
|
68
72
|
});
|
|
@@ -80,7 +84,7 @@ const unpluginFactory = (options, meta) => {
|
|
|
80
84
|
await events.emit("lifecycle:start", version);
|
|
81
85
|
const { root: _root, ...userConfig } = options.config;
|
|
82
86
|
await events.emit("generation:start", options.config);
|
|
83
|
-
const { error, failedPlugins, pluginTimings, files } = await (0,
|
|
87
|
+
const { error, failedPlugins, pluginTimings, files } = await (0, _kubb_core.safeBuild)({
|
|
84
88
|
config: {
|
|
85
89
|
root: node_process.default.cwd(),
|
|
86
90
|
...userConfig,
|
|
@@ -118,6 +122,12 @@ const unplugin$1 = /* @__PURE__ */ (0, unplugin.createUnplugin)(unpluginFactory)
|
|
|
118
122
|
var src_default = unplugin$1;
|
|
119
123
|
|
|
120
124
|
//#endregion
|
|
125
|
+
Object.defineProperty(exports, '__name', {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function () {
|
|
128
|
+
return __name;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
121
131
|
Object.defineProperty(exports, '__toESM', {
|
|
122
132
|
enumerable: true,
|
|
123
133
|
get: function () {
|
|
@@ -142,4 +152,4 @@ Object.defineProperty(exports, 'unpluginFactory', {
|
|
|
142
152
|
return unpluginFactory;
|
|
143
153
|
}
|
|
144
154
|
});
|
|
145
|
-
//# sourceMappingURL=src-
|
|
155
|
+
//# sourceMappingURL=src-BiN2tznZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-BiN2tznZ.cjs","names":["AsyncEventEmitter","process","version","error","failedPlugins","unpluginVersion","unplugin"],"sources":["../package.json","../src/index.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 { createUnplugin } 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 } = 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)\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\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACcA,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,cAAY;AACxC,WAAQ,IAAI,iBAAiBC,UAAQ,KAAK;IAC1C;AAEF,SAAO,GAAG,UAAU,YAAU;AAC5B,WAAQ,MAAM,KAAKC,SAAO,WAAW,WAAW;IAChD;AAEF,SAAO,GAAG,SAAS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CACxB,KAAK,OAAO,GAAG,MAAM,CACzB,CAAC,OAAO,QAAQ,CAEP,SAAS,QAAQ;AACzB,UAAO,KAAK,SAAS,IAAI;IACzB;AAGJ,QAAM,OAAO,KAAK,kBAAkB,QAAQ,OAAiB;AAC7D,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;;AAGH,MAAaK,aAA2B,6CAAe,gBAAgB;AAEvE,kBAAeA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-CIm-hhu7.js";
|
|
1
2
|
import process from "node:process";
|
|
2
3
|
import { safeBuild } from "@kubb/core";
|
|
3
4
|
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
4
5
|
import { createUnplugin } from "unplugin";
|
|
5
6
|
|
|
6
7
|
//#region package.json
|
|
7
|
-
var version = "4.0.
|
|
8
|
+
var version = "4.0.2";
|
|
8
9
|
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region src/index.ts
|
|
@@ -34,7 +35,7 @@ const unpluginFactory = (options, meta) => {
|
|
|
34
35
|
events.on("success", (message) => {
|
|
35
36
|
console.log(`✓ ${message}`);
|
|
36
37
|
});
|
|
37
|
-
events.on("plugin:end", (plugin, duration) => {
|
|
38
|
+
events.on("plugin:end", (plugin, { duration }) => {
|
|
38
39
|
const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
|
|
39
40
|
console.log(`✓ ${plugin.name} completed in ${durationStr}`);
|
|
40
41
|
});
|
|
@@ -91,4 +92,4 @@ var src_default = unplugin;
|
|
|
91
92
|
|
|
92
93
|
//#endregion
|
|
93
94
|
export { unplugin as n, unpluginFactory as r, src_default as t };
|
|
94
|
-
//# sourceMappingURL=src-
|
|
95
|
+
//# sourceMappingURL=src-CiUcBKSs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-CiUcBKSs.js","names":["version","error","failedPlugins","unpluginVersion"],"sources":["../package.json","../src/index.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 { createUnplugin } 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 } = 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)\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\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;;;;;;;ACcA,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,KA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EAAE,OAAO,eAAe,eAAe,UAAU,MAAM,UAAU;GACrE,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,OAAiB;AAC7D,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;;AAGH,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
2
|
import { Fabric } from "@kubb/react-fabric";
|
|
3
3
|
|
|
4
|
+
//#region rolldown:runtime
|
|
5
|
+
//#endregion
|
|
4
6
|
//#region ../core/src/Kubb.d.ts
|
|
5
7
|
type DebugEvent = {
|
|
6
8
|
date: Date;
|
|
@@ -44,7 +46,7 @@ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
|
44
46
|
* console.log('Starting Kubb generation')
|
|
45
47
|
* })
|
|
46
48
|
*
|
|
47
|
-
* events.on('plugin:end', (plugin, duration) => {
|
|
49
|
+
* events.on('plugin:end', (plugin, { duration }) => {
|
|
48
50
|
* console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
|
|
49
51
|
* })
|
|
50
52
|
* ```
|
|
@@ -113,21 +115,24 @@ interface KubbEvents {
|
|
|
113
115
|
*/
|
|
114
116
|
'hooks:end': [];
|
|
115
117
|
/**
|
|
116
|
-
* Emitted when a single hook execution starts.
|
|
117
|
-
*/
|
|
118
|
-
'hook:start': [command: string];
|
|
119
|
-
/**
|
|
120
|
-
* Emitted to execute a hook command (e.g., format or lint).
|
|
118
|
+
* Emitted when a single hook execution starts. (e.g., format or lint).
|
|
121
119
|
* The callback should be invoked when the command completes.
|
|
122
120
|
*/
|
|
123
|
-
'hook:
|
|
124
|
-
|
|
121
|
+
'hook:start': [{
|
|
122
|
+
id?: string;
|
|
123
|
+
command: string;
|
|
125
124
|
args?: readonly string[];
|
|
126
|
-
}
|
|
125
|
+
}];
|
|
127
126
|
/**
|
|
128
127
|
* Emitted when a single hook execution completes.
|
|
129
128
|
*/
|
|
130
|
-
'hook:end': [
|
|
129
|
+
'hook:end': [{
|
|
130
|
+
id?: string;
|
|
131
|
+
command: string;
|
|
132
|
+
args?: readonly string[];
|
|
133
|
+
success: boolean;
|
|
134
|
+
error: Error | null;
|
|
135
|
+
}];
|
|
131
136
|
/**
|
|
132
137
|
* Emitted when a new version of Kubb is available.
|
|
133
138
|
*/
|
|
@@ -190,8 +195,13 @@ interface KubbEvents {
|
|
|
190
195
|
'plugin:start': [plugin: Plugin];
|
|
191
196
|
/**
|
|
192
197
|
* Emitted when a plugin completes execution.
|
|
198
|
+
* Duration in ms
|
|
193
199
|
*/
|
|
194
|
-
'plugin:end': [plugin: Plugin,
|
|
200
|
+
'plugin:end': [plugin: Plugin, meta: {
|
|
201
|
+
duration: number;
|
|
202
|
+
success: boolean;
|
|
203
|
+
error?: Error;
|
|
204
|
+
}];
|
|
195
205
|
/**
|
|
196
206
|
* Emitted when plugin hook progress tracking starts.
|
|
197
207
|
* Contains the hook name and list of plugins to execute.
|
|
@@ -305,22 +315,24 @@ type Config<TInput = Input> = {
|
|
|
305
315
|
* @default prettier
|
|
306
316
|
*
|
|
307
317
|
* Possible values:
|
|
318
|
+
* - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
|
|
308
319
|
* - 'prettier': Uses Prettier for code formatting.
|
|
309
320
|
* - 'biome': Uses Biome for code formatting.
|
|
310
321
|
*
|
|
311
322
|
*/
|
|
312
|
-
format?: 'prettier' | 'biome' | false;
|
|
323
|
+
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
313
324
|
/**
|
|
314
325
|
* Specifies the linter that should be used to analyze the code.
|
|
315
326
|
* The accepted values indicate different linting tools.
|
|
316
327
|
*
|
|
317
328
|
* Possible values:
|
|
329
|
+
* - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
318
330
|
* - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
|
|
319
331
|
* - 'biome': Represents the Biome linter, a modern tool for code scanning.
|
|
320
332
|
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
321
333
|
*
|
|
322
334
|
*/
|
|
323
|
-
lint?: 'eslint' | 'biome' | 'oxlint' | false;
|
|
335
|
+
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
324
336
|
/**
|
|
325
337
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
326
338
|
* @default { '.ts': '.ts'}
|
|
@@ -338,6 +350,13 @@ type Config<TInput = Input> = {
|
|
|
338
350
|
* @default 'simple'
|
|
339
351
|
*/
|
|
340
352
|
defaultBanner?: 'simple' | 'full' | false;
|
|
353
|
+
/**
|
|
354
|
+
* Whether to override existing external files if they already exist.
|
|
355
|
+
* When setting the option in the global configuration, all plugins inherit the same behavior by default.
|
|
356
|
+
* However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.
|
|
357
|
+
* @default false
|
|
358
|
+
*/
|
|
359
|
+
override?: boolean;
|
|
341
360
|
};
|
|
342
361
|
/**
|
|
343
362
|
* An array of Kubb plugins that will be used in the generation.
|
|
@@ -627,5 +646,5 @@ type Options = {
|
|
|
627
646
|
config?: Omit<UserConfig, 'hooks'>;
|
|
628
647
|
};
|
|
629
648
|
//#endregion
|
|
630
|
-
export { Options as t };
|
|
631
|
-
//# sourceMappingURL=types-
|
|
649
|
+
export { __name as n, Options as t };
|
|
650
|
+
//# sourceMappingURL=types-C-ZTDGdJ.d.cts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-CIm-hhu7.js";
|
|
1
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
3
|
import { Fabric } from "@kubb/react-fabric";
|
|
3
4
|
|
|
@@ -44,7 +45,7 @@ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
|
44
45
|
* console.log('Starting Kubb generation')
|
|
45
46
|
* })
|
|
46
47
|
*
|
|
47
|
-
* events.on('plugin:end', (plugin, duration) => {
|
|
48
|
+
* events.on('plugin:end', (plugin, { duration }) => {
|
|
48
49
|
* console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
|
|
49
50
|
* })
|
|
50
51
|
* ```
|
|
@@ -113,21 +114,24 @@ interface KubbEvents {
|
|
|
113
114
|
*/
|
|
114
115
|
'hooks:end': [];
|
|
115
116
|
/**
|
|
116
|
-
* Emitted when a single hook execution starts.
|
|
117
|
-
*/
|
|
118
|
-
'hook:start': [command: string];
|
|
119
|
-
/**
|
|
120
|
-
* Emitted to execute a hook command (e.g., format or lint).
|
|
117
|
+
* Emitted when a single hook execution starts. (e.g., format or lint).
|
|
121
118
|
* The callback should be invoked when the command completes.
|
|
122
119
|
*/
|
|
123
|
-
'hook:
|
|
124
|
-
|
|
120
|
+
'hook:start': [{
|
|
121
|
+
id?: string;
|
|
122
|
+
command: string;
|
|
125
123
|
args?: readonly string[];
|
|
126
|
-
}
|
|
124
|
+
}];
|
|
127
125
|
/**
|
|
128
126
|
* Emitted when a single hook execution completes.
|
|
129
127
|
*/
|
|
130
|
-
'hook:end': [
|
|
128
|
+
'hook:end': [{
|
|
129
|
+
id?: string;
|
|
130
|
+
command: string;
|
|
131
|
+
args?: readonly string[];
|
|
132
|
+
success: boolean;
|
|
133
|
+
error: Error | null;
|
|
134
|
+
}];
|
|
131
135
|
/**
|
|
132
136
|
* Emitted when a new version of Kubb is available.
|
|
133
137
|
*/
|
|
@@ -190,8 +194,13 @@ interface KubbEvents {
|
|
|
190
194
|
'plugin:start': [plugin: Plugin];
|
|
191
195
|
/**
|
|
192
196
|
* Emitted when a plugin completes execution.
|
|
197
|
+
* Duration in ms
|
|
193
198
|
*/
|
|
194
|
-
'plugin:end': [plugin: Plugin,
|
|
199
|
+
'plugin:end': [plugin: Plugin, meta: {
|
|
200
|
+
duration: number;
|
|
201
|
+
success: boolean;
|
|
202
|
+
error?: Error;
|
|
203
|
+
}];
|
|
195
204
|
/**
|
|
196
205
|
* Emitted when plugin hook progress tracking starts.
|
|
197
206
|
* Contains the hook name and list of plugins to execute.
|
|
@@ -305,22 +314,24 @@ type Config<TInput = Input> = {
|
|
|
305
314
|
* @default prettier
|
|
306
315
|
*
|
|
307
316
|
* Possible values:
|
|
317
|
+
* - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
|
|
308
318
|
* - 'prettier': Uses Prettier for code formatting.
|
|
309
319
|
* - 'biome': Uses Biome for code formatting.
|
|
310
320
|
*
|
|
311
321
|
*/
|
|
312
|
-
format?: 'prettier' | 'biome' | false;
|
|
322
|
+
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
313
323
|
/**
|
|
314
324
|
* Specifies the linter that should be used to analyze the code.
|
|
315
325
|
* The accepted values indicate different linting tools.
|
|
316
326
|
*
|
|
317
327
|
* Possible values:
|
|
328
|
+
* - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
318
329
|
* - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
|
|
319
330
|
* - 'biome': Represents the Biome linter, a modern tool for code scanning.
|
|
320
331
|
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
321
332
|
*
|
|
322
333
|
*/
|
|
323
|
-
lint?: 'eslint' | 'biome' | 'oxlint' | false;
|
|
334
|
+
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
324
335
|
/**
|
|
325
336
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
326
337
|
* @default { '.ts': '.ts'}
|
|
@@ -338,6 +349,13 @@ type Config<TInput = Input> = {
|
|
|
338
349
|
* @default 'simple'
|
|
339
350
|
*/
|
|
340
351
|
defaultBanner?: 'simple' | 'full' | false;
|
|
352
|
+
/**
|
|
353
|
+
* Whether to override existing external files if they already exist.
|
|
354
|
+
* When setting the option in the global configuration, all plugins inherit the same behavior by default.
|
|
355
|
+
* However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.
|
|
356
|
+
* @default false
|
|
357
|
+
*/
|
|
358
|
+
override?: boolean;
|
|
341
359
|
};
|
|
342
360
|
/**
|
|
343
361
|
* An array of Kubb plugins that will be used in the generation.
|
|
@@ -628,4 +646,4 @@ type Options = {
|
|
|
628
646
|
};
|
|
629
647
|
//#endregion
|
|
630
648
|
export { Options as t };
|
|
631
|
-
//# sourceMappingURL=types-
|
|
649
|
+
//# sourceMappingURL=types-CUVJ-CBJ.d.ts.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Options } from "./types-
|
|
1
|
+
import { t as Options } from "./types-C-ZTDGdJ.cjs";
|
|
2
2
|
export { Options };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Options } from "./types-
|
|
1
|
+
import { t as Options } from "./types-CUVJ-CBJ.js";
|
|
2
2
|
export { Options };
|
package/dist/vite.cjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_src = require('./src-BiN2tznZ.cjs');
|
|
2
|
+
let unplugin = require("unplugin");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/vite.ts
|
|
5
|
+
var vite_default = (0, unplugin.createVitePlugin)(require_src.unpluginFactory);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
module.exports = vite_default;
|
|
9
|
+
//# 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 './index.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,kDAAgCA,4BAAgB"}
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as Options } from "./types-
|
|
2
|
-
import * as
|
|
1
|
+
import { n as __name, t as Options } from "./types-C-ZTDGdJ.cjs";
|
|
2
|
+
import * as vite0 from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
5
|
+
declare const _default: (options?: Options | undefined) => vite0.Plugin<any> | vite0.Plugin<any>[];
|
|
6
6
|
export = _default;
|
|
7
7
|
//# sourceMappingURL=vite.d.cts.map
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import
|
|
1
|
+
import { t as __name } from "./chunk-CIm-hhu7.js";
|
|
2
|
+
import { t as Options } from "./types-CUVJ-CBJ.js";
|
|
3
|
+
import * as vite0 from "vite";
|
|
3
4
|
|
|
4
5
|
//#region src/vite.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
6
|
+
declare const _default: (options?: Options | undefined) => vite0.Plugin<any> | vite0.Plugin<any>[];
|
|
6
7
|
//#endregion
|
|
7
8
|
export { _default as default };
|
|
8
9
|
//# sourceMappingURL=vite.d.ts.map
|
package/dist/vite.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as unpluginFactory } from "./src-CiUcBKSs.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 './index.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;;AAIA,mBAAe,iBAAiB,gBAAgB"}
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_src = require('./src-BiN2tznZ.cjs');
|
|
2
|
+
let unplugin = require("unplugin");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/webpack.ts
|
|
5
|
+
var webpack_default = (0, unplugin.createWebpackPlugin)(require_src.unpluginFactory);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
module.exports = webpack_default;
|
|
9
|
+
//# 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 { 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.d.cts
CHANGED
package/dist/webpack.d.ts
CHANGED
package/dist/webpack.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as unpluginFactory } from "./src-CiUcBKSs.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 { 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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-kubb",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Unplugin for Kubb",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unplugin",
|
|
@@ -87,11 +87,12 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@nuxt/kit": "^4.2.2",
|
|
89
89
|
"@nuxt/schema": "^4.2.2",
|
|
90
|
+
"esbuild": "*",
|
|
90
91
|
"rimraf": "^6.1.2",
|
|
91
|
-
"rollup": "^4.
|
|
92
|
-
"vite": "^7.3.
|
|
93
|
-
"webpack": "^5.104.
|
|
94
|
-
"@kubb/core": "4.
|
|
92
|
+
"rollup": "^4.55.2",
|
|
93
|
+
"vite": "^7.3.1",
|
|
94
|
+
"webpack": "^5.104.1",
|
|
95
|
+
"@kubb/core": "4.18.0"
|
|
95
96
|
},
|
|
96
97
|
"peerDependencies": {
|
|
97
98
|
"@kubb/core": "^4.0.0",
|
package/src/index.ts
CHANGED
|
@@ -48,7 +48,7 @@ export const unpluginFactory: UnpluginFactory<Options | undefined> = (options, m
|
|
|
48
48
|
console.log(`✓ ${message}`)
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
events.on('plugin:end', (plugin, duration) => {
|
|
51
|
+
events.on('plugin:end', (plugin, { duration }) => {
|
|
52
52
|
const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`
|
|
53
53
|
|
|
54
54
|
console.log(`✓ ${plugin.name} completed in ${durationStr}`)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-7pFd4t48.cjs","names":["unpluginFactory: UnpluginFactory<Options | undefined>","AsyncEventEmitter","process","version","error","failedPlugins","unpluginVersion","unplugin"],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n\t\"name\": \"unplugin-kubb\",\n\t\"version\": \"4.0.1\",\n\t\"description\": \"Unplugin for Kubb\",\n\t\"keywords\": [\n\t\t\"unplugin\",\n\t\t\"vite\",\n\t\t\"webpack\",\n\t\t\"rollup\",\n\t\t\"transform\",\n\t\t\"astro\",\n\t\t\"kubb\",\n\t\t\"swagger\",\n\t\t\"OpenAPI\",\n\t\t\"rspack\",\n\t\t\"nuxt\",\n\t\t\"esbuild\"\n\t],\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/kubb-labs/kubb.git\",\n\t\t\"directory\": \"packages/unplugin\"\n\t},\n\t\"license\": \"MIT\",\n\t\"author\": \"stijnvanhulle\",\n\t\"sideEffects\": false,\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"require\": \"./dist/index.cjs\",\n\t\t\t\"import\": \"./dist/index.js\"\n\t\t},\n\t\t\"./astro\": {\n\t\t\t\"require\": \"./dist/astro.cjs\",\n\t\t\t\"import\": \"./dist/astro.js\"\n\t\t},\n\t\t\"./esbuild\": {\n\t\t\t\"require\": \"./dist/esbuild.cjs\",\n\t\t\t\"import\": \"./dist/esbuild.js\"\n\t\t},\n\t\t\"./nuxt\": {\n\t\t\t\"require\": \"./dist/nuxt.cjs\",\n\t\t\t\"import\": \"./dist/nuxt.js\"\n\t\t},\n\t\t\"./rollup\": {\n\t\t\t\"require\": \"./dist/rollup.cjs\",\n\t\t\t\"import\": \"./dist/rollup.js\"\n\t\t},\n\t\t\"./rspack\": {\n\t\t\t\"require\": \"./dist/rspack.cjs\",\n\t\t\t\"import\": \"./dist/rspack.js\"\n\t\t},\n\t\t\"./types\": {\n\t\t\t\"require\": \"./dist/types.cjs\",\n\t\t\t\"import\": \"./dist/types.js\"\n\t\t},\n\t\t\"./vite\": {\n\t\t\t\"require\": \"./dist/vite.cjs\",\n\t\t\t\"import\": \"./dist/vite.js\"\n\t\t},\n\t\t\"./webpack\": {\n\t\t\t\"require\": \"./dist/webpack.cjs\",\n\t\t\t\"import\": \"./dist/webpack.js\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.js\",\n\t\"types\": \"./dist/index.d.cts\",\n\t\"typesVersions\": {\n\t\t\"*\": {\n\t\t\t\"*\": [\n\t\t\t\t\"./dist/*\",\n\t\t\t\t\"./*\"\n\t\t\t]\n\t\t}\n\t},\n\t\"files\": [\n\t\t\"src\",\n\t\t\"dist\",\n\t\t\"!/**/**.test.**\",\n\t\t\"!/**/__tests__/**\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"clean\": \"npx rimraf ./dist\",\n\t\t\"lint\": \"bun biome lint .\",\n\t\t\"lint:fix\": \"bun biome lint --fix --unsafe .\",\n\t\t\"release\": \"pnpm publish --no-git-check\",\n\t\t\"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n\t\t\"start\": \"tsdown --watch\",\n\t\t\"test\": \"vitest --passWithNoTests\",\n\t\t\"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n\t},\n\t\"dependencies\": {\n\t\t\"unplugin\": \"^2.3.11\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@kubb/core\": \"workspace:*\",\n\t\t\"@nuxt/kit\": \"^4.2.2\",\n\t\t\"@nuxt/schema\": \"^4.2.2\",\n\t\t\"rimraf\": \"^6.1.2\",\n\t\t\"rollup\": \"^4.53.5\",\n\t\t\"vite\": \"^7.3.0\",\n\t\t\"webpack\": \"^5.104.0\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@kubb/core\": \"^4.0.0\",\n\t\t\"@nuxt/kit\": \"^3\",\n\t\t\"@nuxt/schema\": \"^3\",\n\t\t\"esbuild\": \"*\",\n\t\t\"rollup\": \"^3\",\n\t\t\"vite\": \">=3\",\n\t\t\"webpack\": \"^5\"\n\t},\n\t\"peerDependenciesMeta\": {\n\t\t\"@nuxt/kit\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@nuxt/schema\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"esbuild\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"rollup\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"vite\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"webpack\": {\n\t\t\t\"optional\": true\n\t\t}\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=20\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\",\n\t\t\"registry\": \"https://registry.npmjs.org/\"\n\t}\n}\n","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 { createUnplugin } 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 } = 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)\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\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEY;;;;ACYZ,MAAaA,mBAAyD,SAAS,SAAS;CACtF,MAAM,OAAO;CACb,MAAM,SAAS,IAAIC,qCAA+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,cAAY;AACxC,WAAQ,IAAI,iBAAiBC,UAAQ,KAAK;IAC1C;AAEF,SAAO,GAAG,UAAU,YAAU;AAC5B,WAAQ,MAAM,KAAKC,SAAO,WAAW,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ACzB,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,OAAiB;AAC7D,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;;AAGH,MAAaK,aAA2B,6CAAe,gBAAgB;AAEvE,kBAAeA"}
|
package/dist/src-y2za6sAo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-y2za6sAo.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>","version","error","failedPlugins","unpluginVersion"],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n\t\"name\": \"unplugin-kubb\",\n\t\"version\": \"4.0.1\",\n\t\"description\": \"Unplugin for Kubb\",\n\t\"keywords\": [\n\t\t\"unplugin\",\n\t\t\"vite\",\n\t\t\"webpack\",\n\t\t\"rollup\",\n\t\t\"transform\",\n\t\t\"astro\",\n\t\t\"kubb\",\n\t\t\"swagger\",\n\t\t\"OpenAPI\",\n\t\t\"rspack\",\n\t\t\"nuxt\",\n\t\t\"esbuild\"\n\t],\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/kubb-labs/kubb.git\",\n\t\t\"directory\": \"packages/unplugin\"\n\t},\n\t\"license\": \"MIT\",\n\t\"author\": \"stijnvanhulle\",\n\t\"sideEffects\": false,\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"require\": \"./dist/index.cjs\",\n\t\t\t\"import\": \"./dist/index.js\"\n\t\t},\n\t\t\"./astro\": {\n\t\t\t\"require\": \"./dist/astro.cjs\",\n\t\t\t\"import\": \"./dist/astro.js\"\n\t\t},\n\t\t\"./esbuild\": {\n\t\t\t\"require\": \"./dist/esbuild.cjs\",\n\t\t\t\"import\": \"./dist/esbuild.js\"\n\t\t},\n\t\t\"./nuxt\": {\n\t\t\t\"require\": \"./dist/nuxt.cjs\",\n\t\t\t\"import\": \"./dist/nuxt.js\"\n\t\t},\n\t\t\"./rollup\": {\n\t\t\t\"require\": \"./dist/rollup.cjs\",\n\t\t\t\"import\": \"./dist/rollup.js\"\n\t\t},\n\t\t\"./rspack\": {\n\t\t\t\"require\": \"./dist/rspack.cjs\",\n\t\t\t\"import\": \"./dist/rspack.js\"\n\t\t},\n\t\t\"./types\": {\n\t\t\t\"require\": \"./dist/types.cjs\",\n\t\t\t\"import\": \"./dist/types.js\"\n\t\t},\n\t\t\"./vite\": {\n\t\t\t\"require\": \"./dist/vite.cjs\",\n\t\t\t\"import\": \"./dist/vite.js\"\n\t\t},\n\t\t\"./webpack\": {\n\t\t\t\"require\": \"./dist/webpack.cjs\",\n\t\t\t\"import\": \"./dist/webpack.js\"\n\t\t},\n\t\t\"./package.json\": \"./package.json\"\n\t},\n\t\"main\": \"./dist/index.cjs\",\n\t\"module\": \"./dist/index.js\",\n\t\"types\": \"./dist/index.d.cts\",\n\t\"typesVersions\": {\n\t\t\"*\": {\n\t\t\t\"*\": [\n\t\t\t\t\"./dist/*\",\n\t\t\t\t\"./*\"\n\t\t\t]\n\t\t}\n\t},\n\t\"files\": [\n\t\t\"src\",\n\t\t\"dist\",\n\t\t\"!/**/**.test.**\",\n\t\t\"!/**/__tests__/**\"\n\t],\n\t\"scripts\": {\n\t\t\"build\": \"tsdown\",\n\t\t\"clean\": \"npx rimraf ./dist\",\n\t\t\"lint\": \"bun biome lint .\",\n\t\t\"lint:fix\": \"bun biome lint --fix --unsafe .\",\n\t\t\"release\": \"pnpm publish --no-git-check\",\n\t\t\"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n\t\t\"start\": \"tsdown --watch\",\n\t\t\"test\": \"vitest --passWithNoTests\",\n\t\t\"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n\t},\n\t\"dependencies\": {\n\t\t\"unplugin\": \"^2.3.11\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@kubb/core\": \"workspace:*\",\n\t\t\"@nuxt/kit\": \"^4.2.2\",\n\t\t\"@nuxt/schema\": \"^4.2.2\",\n\t\t\"rimraf\": \"^6.1.2\",\n\t\t\"rollup\": \"^4.53.5\",\n\t\t\"vite\": \"^7.3.0\",\n\t\t\"webpack\": \"^5.104.0\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@kubb/core\": \"^4.0.0\",\n\t\t\"@nuxt/kit\": \"^3\",\n\t\t\"@nuxt/schema\": \"^3\",\n\t\t\"esbuild\": \"*\",\n\t\t\"rollup\": \"^3\",\n\t\t\"vite\": \">=3\",\n\t\t\"webpack\": \"^5\"\n\t},\n\t\"peerDependenciesMeta\": {\n\t\t\"@nuxt/kit\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@nuxt/schema\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"esbuild\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"rollup\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"vite\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"webpack\": {\n\t\t\t\"optional\": true\n\t\t}\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=20\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\",\n\t\t\"registry\": \"https://registry.npmjs.org/\"\n\t}\n}\n","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 { createUnplugin } 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 } = 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)\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\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;;cAEY;;;;ACYZ,MAAaA,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,cAAY;AACxC,WAAQ,IAAI,iBAAiBC,UAAQ,KAAK;IAC1C;AAEF,SAAO,GAAG,UAAU,YAAU;AAC5B,WAAQ,MAAM,KAAKC,SAAO,WAAW,WAAW;IAChD;AAEF,SAAO,GAAG,SAAS,YAAY;AAC7B,WAAQ,KAAK,KAAK,UAAU;IAC5B;AAEF,SAAO,GAAG,SAAS,YAAY;A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AO,KAAK,SAAS,IAAI;IACzB;AAGJ,QAAM,OAAO,KAAK,kBAAkB,QAAQ,OAAiB;AAC7D,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;;AAGH,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
|
package/dist/vite-DXcgbm9H.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-y2za6sAo.js";
|
|
2
|
-
import { createVitePlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/vite.ts
|
|
5
|
-
var vite_default = createVitePlugin(unpluginFactory);
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { vite_default as t };
|
|
9
|
-
//# sourceMappingURL=vite-DXcgbm9H.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-DXcgbm9H.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"}
|
package/dist/vite-HDFFF5rj.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const require_src = require('./src-7pFd4t48.cjs');
|
|
2
|
-
let unplugin = require("unplugin");
|
|
3
|
-
|
|
4
|
-
//#region src/vite.ts
|
|
5
|
-
var vite_default = (0, unplugin.createVitePlugin)(require_src.unpluginFactory);
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
Object.defineProperty(exports, 'vite_default', {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return vite_default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=vite-HDFFF5rj.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-HDFFF5rj.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/webpack-BqG9Y2kv.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-y2za6sAo.js";
|
|
2
|
-
import { createWebpackPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/webpack.ts
|
|
5
|
-
var webpack_default = createWebpackPlugin(unpluginFactory);
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { webpack_default as t };
|
|
9
|
-
//# sourceMappingURL=webpack-BqG9Y2kv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-BqG9Y2kv.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,14 +0,0 @@
|
|
|
1
|
-
const require_src = require('./src-7pFd4t48.cjs');
|
|
2
|
-
let unplugin = require("unplugin");
|
|
3
|
-
|
|
4
|
-
//#region src/webpack.ts
|
|
5
|
-
var webpack_default = (0, unplugin.createWebpackPlugin)(require_src.unpluginFactory);
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
Object.defineProperty(exports, 'webpack_default', {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return webpack_default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=webpack-D1dzppyE.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-D1dzppyE.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"}
|