unplugin-kubb 4.0.2 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -17
- package/dist/astro.cjs +7 -8
- package/dist/astro.cjs.map +1 -1
- package/dist/astro.d.ts +3 -8
- package/dist/astro.js +7 -9
- package/dist/astro.js.map +1 -1
- package/dist/{chunk-CIm-hhu7.js → chunk--u3MIqq1.js} +2 -3
- package/dist/esbuild.cjs +3 -5
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.d.ts +4 -4
- package/dist/esbuild.js +2 -3
- package/dist/esbuild.js.map +1 -1
- package/dist/farm.cjs +7 -0
- package/dist/farm.cjs.map +1 -0
- package/dist/farm.d.ts +9 -0
- package/dist/farm.js +8 -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 -7
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -0
- package/dist/nuxt.cjs +8 -9
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +4 -5
- package/dist/nuxt.js.map +1 -1
- package/dist/rolldown.cjs +7 -0
- package/dist/rolldown.cjs.map +1 -0
- package/dist/rolldown.d.ts +9 -0
- package/dist/rolldown.js +8 -0
- package/dist/rolldown.js.map +1 -0
- package/dist/rollup.cjs +3 -5
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.ts +4 -4
- package/dist/rollup.js +2 -3
- package/dist/rollup.js.map +1 -1
- package/dist/rspack.cjs +3 -5
- package/dist/rspack.cjs.map +1 -1
- package/dist/rspack.d.ts +2 -2
- package/dist/rspack.js +2 -3
- package/dist/rspack.js.map +1 -1
- package/dist/types.d.ts +13 -2
- package/dist/types.js +1 -1
- package/dist/unpluginFactory-0sYXb5x6.js +157 -0
- package/dist/unpluginFactory-0sYXb5x6.js.map +1 -0
- package/dist/unpluginFactory-BpZ2psBF.cjs +200 -0
- package/dist/unpluginFactory-BpZ2psBF.cjs.map +1 -0
- package/dist/unpluginFactory.cjs +3 -0
- package/dist/unpluginFactory.d.ts +9 -0
- package/dist/unpluginFactory.js +2 -0
- package/dist/vite.cjs +3 -5
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.ts +4 -4
- package/dist/vite.js +2 -3
- package/dist/vite.js.map +1 -1
- package/dist/webpack.cjs +3 -5
- package/dist/webpack.cjs.map +1 -1
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +2 -3
- package/dist/webpack.js.map +1 -1
- package/package.json +69 -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-BiN2tznZ.cjs +0 -155
- package/dist/src-BiN2tznZ.cjs.map +0 -1
- package/dist/src-CiUcBKSs.js +0 -95
- package/dist/src-CiUcBKSs.js.map +0 -1
- package/dist/types-C-ZTDGdJ.d.cts +0 -650
- package/dist/types-CUVJ-CBJ.d.ts +0 -649
- package/dist/types.d.cts +0 -2
- package/dist/vite.d.cts +0 -7
- package/dist/webpack.d.cts +0 -8
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
import { safeBuild } from "@kubb/core";
|
|
5
|
+
//#region ../../internals/utils/src/errors.ts
|
|
6
|
+
/**
|
|
7
|
+
* Coerces an unknown thrown value to an `Error` instance.
|
|
8
|
+
* When the value is already an `Error` it is returned as-is;
|
|
9
|
+
* otherwise a new `Error` is created whose message is `String(value)`.
|
|
10
|
+
*/
|
|
11
|
+
function toError(value) {
|
|
12
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ../../internals/utils/src/asyncEventEmitter.ts
|
|
16
|
+
/**
|
|
17
|
+
* A typed EventEmitter that awaits all async listeners before resolving.
|
|
18
|
+
* Wraps Node's `EventEmitter` with full TypeScript event-map inference.
|
|
19
|
+
*/
|
|
20
|
+
var AsyncEventEmitter = class {
|
|
21
|
+
/**
|
|
22
|
+
* `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.
|
|
23
|
+
* @default 10
|
|
24
|
+
*/
|
|
25
|
+
constructor(maxListener = 10) {
|
|
26
|
+
this.#emitter.setMaxListeners(maxListener);
|
|
27
|
+
}
|
|
28
|
+
#emitter = new EventEmitter();
|
|
29
|
+
/**
|
|
30
|
+
* Emits an event and awaits all registered listeners in parallel.
|
|
31
|
+
* Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
|
|
32
|
+
*/
|
|
33
|
+
async emit(eventName, ...eventArgs) {
|
|
34
|
+
const listeners = this.#emitter.listeners(eventName);
|
|
35
|
+
if (listeners.length === 0) return;
|
|
36
|
+
await Promise.all(listeners.map(async (listener) => {
|
|
37
|
+
try {
|
|
38
|
+
return await listener(...eventArgs);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
let serializedArgs;
|
|
41
|
+
try {
|
|
42
|
+
serializedArgs = JSON.stringify(eventArgs);
|
|
43
|
+
} catch {
|
|
44
|
+
serializedArgs = String(eventArgs);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`Error in async listener for "${eventName}" with eventArgs ${serializedArgs}`, { cause: toError(err) });
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
/** Registers a persistent listener for the given event. */
|
|
51
|
+
on(eventName, handler) {
|
|
52
|
+
this.#emitter.on(eventName, handler);
|
|
53
|
+
}
|
|
54
|
+
/** Registers a one-shot listener that removes itself after the first invocation. */
|
|
55
|
+
onOnce(eventName, handler) {
|
|
56
|
+
const wrapper = (...args) => {
|
|
57
|
+
this.off(eventName, wrapper);
|
|
58
|
+
return handler(...args);
|
|
59
|
+
};
|
|
60
|
+
this.on(eventName, wrapper);
|
|
61
|
+
}
|
|
62
|
+
/** Removes a previously registered listener. */
|
|
63
|
+
off(eventName, handler) {
|
|
64
|
+
this.#emitter.off(eventName, handler);
|
|
65
|
+
}
|
|
66
|
+
/** Removes all listeners from every event channel. */
|
|
67
|
+
removeAll() {
|
|
68
|
+
this.#emitter.removeAllListeners();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region package.json
|
|
73
|
+
var version = "5.0.1";
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/unpluginFactory.ts
|
|
76
|
+
const unpluginFactory = (options, meta) => {
|
|
77
|
+
const name = "unplugin-kubb";
|
|
78
|
+
const events = new AsyncEventEmitter();
|
|
79
|
+
const isVite = meta.framework === "vite";
|
|
80
|
+
const hrStart = process.hrtime();
|
|
81
|
+
async function runBuild(ctx) {
|
|
82
|
+
if (!options?.config) {
|
|
83
|
+
if (ctx.error) ctx.error?.(`[${name}] Config is not set`);
|
|
84
|
+
else console.error(`[${name}] Config is not set`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
events.on("lifecycle:start", (version) => {
|
|
88
|
+
console.log(`Kubb Unplugin ${version} 🧩`);
|
|
89
|
+
});
|
|
90
|
+
events.on("error", (error) => {
|
|
91
|
+
console.error(`✗ ${error?.message || "failed"}`);
|
|
92
|
+
});
|
|
93
|
+
events.on("warn", (message) => {
|
|
94
|
+
console.warn(`⚠ ${message}`);
|
|
95
|
+
});
|
|
96
|
+
events.on("info", (message) => {
|
|
97
|
+
console.info(`ℹ ${message}`);
|
|
98
|
+
});
|
|
99
|
+
events.on("success", (message) => {
|
|
100
|
+
console.log(`✓ ${message}`);
|
|
101
|
+
});
|
|
102
|
+
events.on("plugin:end", (plugin, { duration }) => {
|
|
103
|
+
const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
|
|
104
|
+
console.log(`✓ ${plugin.name} completed in ${durationStr}`);
|
|
105
|
+
});
|
|
106
|
+
events.on("files:processing:end", () => {
|
|
107
|
+
console.log("✓ Files written successfully");
|
|
108
|
+
});
|
|
109
|
+
events.on("generation:end", (config) => {
|
|
110
|
+
console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
|
|
111
|
+
});
|
|
112
|
+
events.on("generation:summary", (config, { status, failedPlugins }) => {
|
|
113
|
+
const pluginsCount = config.plugins?.length || 0;
|
|
114
|
+
const successCount = pluginsCount - failedPlugins.size;
|
|
115
|
+
console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`);
|
|
116
|
+
});
|
|
117
|
+
await events.emit("lifecycle:start", version);
|
|
118
|
+
const { root: _root, ...userConfig } = options.config;
|
|
119
|
+
await events.emit("generation:start", options.config);
|
|
120
|
+
const { error, failedPlugins, pluginTimings, files, sources } = await safeBuild({
|
|
121
|
+
config: {
|
|
122
|
+
root: process.cwd(),
|
|
123
|
+
...userConfig,
|
|
124
|
+
output: {
|
|
125
|
+
write: true,
|
|
126
|
+
...userConfig.output
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
events
|
|
130
|
+
});
|
|
131
|
+
if (failedPlugins.size > 0 || error) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
|
|
132
|
+
events.emit("error", err);
|
|
133
|
+
});
|
|
134
|
+
await events.emit("generation:end", options.config, files, sources);
|
|
135
|
+
await events.emit("generation:summary", options.config, {
|
|
136
|
+
failedPlugins,
|
|
137
|
+
filesCreated: files.length,
|
|
138
|
+
status: failedPlugins.size > 0 || error ? "failed" : "success",
|
|
139
|
+
hrStart,
|
|
140
|
+
pluginTimings
|
|
141
|
+
});
|
|
142
|
+
await events.emit("lifecycle:end");
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
name,
|
|
146
|
+
enforce: "pre",
|
|
147
|
+
apply: isVite ? "build" : void 0,
|
|
148
|
+
async buildStart() {
|
|
149
|
+
await runBuild(this);
|
|
150
|
+
},
|
|
151
|
+
vite: {}
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
export { unpluginFactory as t };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=unpluginFactory-0sYXb5x6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpluginFactory-0sYXb5x6.js","names":["#emitter","NodeEventEmitter","unpluginVersion"],"sources":["../../../internals/utils/src/errors.ts","../../../internals/utils/src/asyncEventEmitter.ts","../package.json","../src/unpluginFactory.ts"],"sourcesContent":["/** Thrown when a plugin's configuration or input fails validation. */\nexport class ValidationPluginError extends Error {}\n\n/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * When the value is already an `Error` it is returned as-is;\n * otherwise a new `Error` is created whose message is `String(value)`.\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Safely extracts a human-readable message from any thrown value.\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error | undefined`.\n * Returns `undefined` when the cause is absent or is not an `Error`.\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n","import { EventEmitter as NodeEventEmitter } from 'node:events'\nimport { toError } from './errors.ts'\n\n/** A function that can be registered as an event listener, synchronous or async. */\ntype AsyncListener<TArgs extends unknown[]> = (...args: TArgs) => void | Promise<void>\n\n/**\n * A typed EventEmitter that awaits all async listeners before resolving.\n * Wraps Node's `EventEmitter` with full TypeScript event-map inference.\n */\nexport class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[] }> {\n /**\n * `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.\n * @default 10\n */\n constructor(maxListener = 10) {\n this.#emitter.setMaxListeners(maxListener)\n }\n\n #emitter = new NodeEventEmitter()\n\n /**\n * Emits an event and awaits all registered listeners in parallel.\n * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.\n */\n async emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> {\n const listeners = this.#emitter.listeners(eventName) as Array<AsyncListener<TEvents[TEventName]>>\n\n if (listeners.length === 0) {\n return undefined\n }\n\n await Promise.all(\n listeners.map(async (listener) => {\n try {\n return await listener(...eventArgs)\n } catch (err) {\n let serializedArgs: string\n try {\n serializedArgs = JSON.stringify(eventArgs)\n } catch {\n serializedArgs = String(eventArgs)\n }\n throw new Error(`Error in async listener for \"${eventName}\" with eventArgs ${serializedArgs}`, { cause: toError(err) })\n }\n }),\n )\n }\n\n /** Registers a persistent listener for the given event. */\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.on(eventName, handler as AsyncListener<unknown[]>)\n }\n\n /** Registers a one-shot listener that removes itself after the first invocation. */\n onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n const wrapper: AsyncListener<TEvents[TEventName]> = (...args) => {\n this.off(eventName, wrapper)\n return handler(...args)\n }\n this.on(eventName, wrapper)\n }\n\n /** Removes a previously registered listener. */\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.off(eventName, handler as AsyncListener<unknown[]>)\n }\n\n /** Removes all listeners from every event channel. */\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n","","import process from 'node:process'\nimport { AsyncEventEmitter } from '@internals/utils'\nimport { type Config, type KubbEvents, safeBuild } from '@kubb/core'\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":";;;;;;;;;;AAsBA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;ACblE,IAAa,oBAAb,MAAoF;;;;;CAKlF,YAAY,cAAc,IAAI;AAC5B,QAAA,QAAc,gBAAgB,YAAY;;CAG5C,WAAW,IAAIC,cAAkB;;;;;CAMjC,MAAM,KAAgD,WAAuB,GAAG,WAA+C;EAC7H,MAAM,YAAY,MAAA,QAAc,UAAU,UAAU;AAEpD,MAAI,UAAU,WAAW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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,KAAA;EAC1B,MAAM,aAAa;AACjB,SAAM,SAAS,KAAiC;;EAGlD,MAAM,EAAE;EACT"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
let node_process = require("node:process");
|
|
28
|
+
node_process = __toESM(node_process);
|
|
29
|
+
let node_events = require("node:events");
|
|
30
|
+
let _kubb_core = require("@kubb/core");
|
|
31
|
+
//#region ../../internals/utils/src/errors.ts
|
|
32
|
+
/**
|
|
33
|
+
* Coerces an unknown thrown value to an `Error` instance.
|
|
34
|
+
* When the value is already an `Error` it is returned as-is;
|
|
35
|
+
* otherwise a new `Error` is created whose message is `String(value)`.
|
|
36
|
+
*/
|
|
37
|
+
function toError(value) {
|
|
38
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../../internals/utils/src/asyncEventEmitter.ts
|
|
42
|
+
/**
|
|
43
|
+
* A typed EventEmitter that awaits all async listeners before resolving.
|
|
44
|
+
* Wraps Node's `EventEmitter` with full TypeScript event-map inference.
|
|
45
|
+
*/
|
|
46
|
+
var AsyncEventEmitter = class {
|
|
47
|
+
/**
|
|
48
|
+
* `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.
|
|
49
|
+
* @default 10
|
|
50
|
+
*/
|
|
51
|
+
constructor(maxListener = 10) {
|
|
52
|
+
this.#emitter.setMaxListeners(maxListener);
|
|
53
|
+
}
|
|
54
|
+
#emitter = new node_events.EventEmitter();
|
|
55
|
+
/**
|
|
56
|
+
* Emits an event and awaits all registered listeners in parallel.
|
|
57
|
+
* Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
|
|
58
|
+
*/
|
|
59
|
+
async emit(eventName, ...eventArgs) {
|
|
60
|
+
const listeners = this.#emitter.listeners(eventName);
|
|
61
|
+
if (listeners.length === 0) return;
|
|
62
|
+
await Promise.all(listeners.map(async (listener) => {
|
|
63
|
+
try {
|
|
64
|
+
return await listener(...eventArgs);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
let serializedArgs;
|
|
67
|
+
try {
|
|
68
|
+
serializedArgs = JSON.stringify(eventArgs);
|
|
69
|
+
} catch {
|
|
70
|
+
serializedArgs = String(eventArgs);
|
|
71
|
+
}
|
|
72
|
+
throw new Error(`Error in async listener for "${eventName}" with eventArgs ${serializedArgs}`, { cause: toError(err) });
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
/** Registers a persistent listener for the given event. */
|
|
77
|
+
on(eventName, handler) {
|
|
78
|
+
this.#emitter.on(eventName, handler);
|
|
79
|
+
}
|
|
80
|
+
/** Registers a one-shot listener that removes itself after the first invocation. */
|
|
81
|
+
onOnce(eventName, handler) {
|
|
82
|
+
const wrapper = (...args) => {
|
|
83
|
+
this.off(eventName, wrapper);
|
|
84
|
+
return handler(...args);
|
|
85
|
+
};
|
|
86
|
+
this.on(eventName, wrapper);
|
|
87
|
+
}
|
|
88
|
+
/** Removes a previously registered listener. */
|
|
89
|
+
off(eventName, handler) {
|
|
90
|
+
this.#emitter.off(eventName, handler);
|
|
91
|
+
}
|
|
92
|
+
/** Removes all listeners from every event channel. */
|
|
93
|
+
removeAll() {
|
|
94
|
+
this.#emitter.removeAllListeners();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region package.json
|
|
99
|
+
var version = "5.0.1";
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/unpluginFactory.ts
|
|
102
|
+
const unpluginFactory = (options, meta) => {
|
|
103
|
+
const name = "unplugin-kubb";
|
|
104
|
+
const events = new AsyncEventEmitter();
|
|
105
|
+
const isVite = meta.framework === "vite";
|
|
106
|
+
const hrStart = node_process.default.hrtime();
|
|
107
|
+
async function runBuild(ctx) {
|
|
108
|
+
if (!options?.config) {
|
|
109
|
+
if (ctx.error) ctx.error?.(`[${name}] Config is not set`);
|
|
110
|
+
else console.error(`[${name}] Config is not set`);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
events.on("lifecycle:start", (version) => {
|
|
114
|
+
console.log(`Kubb Unplugin ${version} 🧩`);
|
|
115
|
+
});
|
|
116
|
+
events.on("error", (error) => {
|
|
117
|
+
console.error(`✗ ${error?.message || "failed"}`);
|
|
118
|
+
});
|
|
119
|
+
events.on("warn", (message) => {
|
|
120
|
+
console.warn(`⚠ ${message}`);
|
|
121
|
+
});
|
|
122
|
+
events.on("info", (message) => {
|
|
123
|
+
console.info(`ℹ ${message}`);
|
|
124
|
+
});
|
|
125
|
+
events.on("success", (message) => {
|
|
126
|
+
console.log(`✓ ${message}`);
|
|
127
|
+
});
|
|
128
|
+
events.on("plugin:end", (plugin, { duration }) => {
|
|
129
|
+
const durationStr = duration >= 1e3 ? `${(duration / 1e3).toFixed(2)}s` : `${duration}ms`;
|
|
130
|
+
console.log(`✓ ${plugin.name} completed in ${durationStr}`);
|
|
131
|
+
});
|
|
132
|
+
events.on("files:processing:end", () => {
|
|
133
|
+
console.log("✓ Files written successfully");
|
|
134
|
+
});
|
|
135
|
+
events.on("generation:end", (config) => {
|
|
136
|
+
console.log(config.name ? `✓ Generation completed for ${config.name}` : "✓ Generation completed");
|
|
137
|
+
});
|
|
138
|
+
events.on("generation:summary", (config, { status, failedPlugins }) => {
|
|
139
|
+
const pluginsCount = config.plugins?.length || 0;
|
|
140
|
+
const successCount = pluginsCount - failedPlugins.size;
|
|
141
|
+
console.log(status === "success" ? `Kubb Summary: ✓ ${`${successCount} successful`}, ${pluginsCount} total` : `Kubb Summary: ✓ ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`);
|
|
142
|
+
});
|
|
143
|
+
await events.emit("lifecycle:start", version);
|
|
144
|
+
const { root: _root, ...userConfig } = options.config;
|
|
145
|
+
await events.emit("generation:start", options.config);
|
|
146
|
+
const { error, failedPlugins, pluginTimings, files, sources } = await (0, _kubb_core.safeBuild)({
|
|
147
|
+
config: {
|
|
148
|
+
root: node_process.default.cwd(),
|
|
149
|
+
...userConfig,
|
|
150
|
+
output: {
|
|
151
|
+
write: true,
|
|
152
|
+
...userConfig.output
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
events
|
|
156
|
+
});
|
|
157
|
+
if (failedPlugins.size > 0 || error) [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean).forEach((err) => {
|
|
158
|
+
events.emit("error", err);
|
|
159
|
+
});
|
|
160
|
+
await events.emit("generation:end", options.config, files, sources);
|
|
161
|
+
await events.emit("generation:summary", options.config, {
|
|
162
|
+
failedPlugins,
|
|
163
|
+
filesCreated: files.length,
|
|
164
|
+
status: failedPlugins.size > 0 || error ? "failed" : "success",
|
|
165
|
+
hrStart,
|
|
166
|
+
pluginTimings
|
|
167
|
+
});
|
|
168
|
+
await events.emit("lifecycle:end");
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
name,
|
|
172
|
+
enforce: "pre",
|
|
173
|
+
apply: isVite ? "build" : void 0,
|
|
174
|
+
async buildStart() {
|
|
175
|
+
await runBuild(this);
|
|
176
|
+
},
|
|
177
|
+
vite: {}
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
//#endregion
|
|
181
|
+
Object.defineProperty(exports, "__name", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function() {
|
|
184
|
+
return __name;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, "__toESM", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function() {
|
|
190
|
+
return __toESM;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(exports, "unpluginFactory", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function() {
|
|
196
|
+
return unpluginFactory;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=unpluginFactory-BpZ2psBF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpluginFactory-BpZ2psBF.cjs","names":["#emitter","NodeEventEmitter","process","unpluginVersion"],"sources":["../../../internals/utils/src/errors.ts","../../../internals/utils/src/asyncEventEmitter.ts","../package.json","../src/unpluginFactory.ts"],"sourcesContent":["/** Thrown when a plugin's configuration or input fails validation. */\nexport class ValidationPluginError extends Error {}\n\n/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * When the value is already an `Error` it is returned as-is;\n * otherwise a new `Error` is created whose message is `String(value)`.\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Safely extracts a human-readable message from any thrown value.\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error | undefined`.\n * Returns `undefined` when the cause is absent or is not an `Error`.\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n","import { EventEmitter as NodeEventEmitter } from 'node:events'\nimport { toError } from './errors.ts'\n\n/** A function that can be registered as an event listener, synchronous or async. */\ntype AsyncListener<TArgs extends unknown[]> = (...args: TArgs) => void | Promise<void>\n\n/**\n * A typed EventEmitter that awaits all async listeners before resolving.\n * Wraps Node's `EventEmitter` with full TypeScript event-map inference.\n */\nexport class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[] }> {\n /**\n * `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.\n * @default 10\n */\n constructor(maxListener = 10) {\n this.#emitter.setMaxListeners(maxListener)\n }\n\n #emitter = new NodeEventEmitter()\n\n /**\n * Emits an event and awaits all registered listeners in parallel.\n * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.\n */\n async emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> {\n const listeners = this.#emitter.listeners(eventName) as Array<AsyncListener<TEvents[TEventName]>>\n\n if (listeners.length === 0) {\n return undefined\n }\n\n await Promise.all(\n listeners.map(async (listener) => {\n try {\n return await listener(...eventArgs)\n } catch (err) {\n let serializedArgs: string\n try {\n serializedArgs = JSON.stringify(eventArgs)\n } catch {\n serializedArgs = String(eventArgs)\n }\n throw new Error(`Error in async listener for \"${eventName}\" with eventArgs ${serializedArgs}`, { cause: toError(err) })\n }\n }),\n )\n }\n\n /** Registers a persistent listener for the given event. */\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.on(eventName, handler as AsyncListener<unknown[]>)\n }\n\n /** Registers a one-shot listener that removes itself after the first invocation. */\n onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n const wrapper: AsyncListener<TEvents[TEventName]> = (...args) => {\n this.off(eventName, wrapper)\n return handler(...args)\n }\n this.on(eventName, wrapper)\n }\n\n /** Removes a previously registered listener. */\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void {\n this.#emitter.off(eventName, handler as AsyncListener<unknown[]>)\n }\n\n /** Removes all listeners from every event channel. */\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n","","import process from 'node:process'\nimport { AsyncEventEmitter } from '@internals/utils'\nimport { type Config, type KubbEvents, safeBuild } from '@kubb/core'\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;ACblE,IAAa,oBAAb,MAAoF;;;;;CAKlF,YAAY,cAAc,IAAI;AAC5B,QAAA,QAAc,gBAAgB,YAAY;;CAG5C,WAAW,IAAIC,YAAAA,cAAkB;;;;;CAMjC,MAAM,KAAgD,WAAuB,GAAG,WAA+C;EAC7H,MAAM,YAAY,MAAA,QAAc,UAAU,UAAU;AAEpD,MAAI,UAAU,WAAW,EACvB;AAGF,QAAM,QAAQ,IACZ,UAAU,IAAI,OAAO,aAAa;AAChC,OAAI;AACF,WAAO,MAAM,SAAS,GAAG,UAAU;YAC5B,KAAK;IACZ,IAAI;AACJ,QAAI;AACF,sBAAiB,KAAK,UAAU,UAAU;YACpC;AACN,sBAAiB,OAAO,UAAU;;AAEpC,UAAM,IAAI,MAAM,gCAAgC,UAAU,mBAAmB,kBAAkB,EAAE,OAAO,QAAQ,IAAI,EAAE,CAAC;;IAEzH,CACH;;;CAIH,GAA8C,WAAuB,SAAmD;AACtH,QAAA,QAAc,GAAG,WAAW,QAAoC;;;CAIlE,OAAkD,WAAuB,SAAmD;EAC1H,MAAM,WAA+C,GAAG,SAAS;AAC/D,QAAK,IAAI,WAAW,QAAQ;AAC5B,UAAO,QAAQ,GAAG,KAAK;;AAEzB,OAAK,GAAG,WAAW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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
|
package/dist/vite.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
let unplugin = require("unplugin");
|
|
3
|
-
|
|
1
|
+
const require_unpluginFactory = require("./unpluginFactory-BpZ2psBF.cjs");
|
|
4
2
|
//#region src/vite.ts
|
|
5
|
-
var vite_default = (0, unplugin.createVitePlugin)(
|
|
6
|
-
|
|
3
|
+
var vite_default = (0, require("unplugin").createVitePlugin)(require_unpluginFactory.unpluginFactory);
|
|
7
4
|
//#endregion
|
|
8
5
|
module.exports = vite_default;
|
|
6
|
+
|
|
9
7
|
//# sourceMappingURL=vite.cjs.map
|
package/dist/vite.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './
|
|
1
|
+
{"version":3,"file":"vite.cjs","names":["unpluginFactory"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;AAIA,IAAA,gBAAA,uBAAA,kBAAgCA,wBAAAA,gBAAgB"}
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __name } from "./chunk
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { Options } from "./types.js";
|
|
3
|
+
import * as vite from "vite";
|
|
4
4
|
|
|
5
5
|
//#region src/vite.d.ts
|
|
6
|
-
declare const _default: (options?: Options | undefined) =>
|
|
6
|
+
declare const _default: (options?: Options | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
7
7
|
//#endregion
|
|
8
8
|
export { _default as default };
|
|
9
9
|
//# sourceMappingURL=vite.d.ts.map
|
package/dist/vite.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as unpluginFactory } from "./unpluginFactory-0sYXb5x6.js";
|
|
2
2
|
import { createVitePlugin } from "unplugin";
|
|
3
|
-
|
|
4
3
|
//#region src/vite.ts
|
|
5
4
|
var vite_default = createVitePlugin(unpluginFactory);
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
6
|
export { vite_default as default };
|
|
7
|
+
|
|
9
8
|
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createVitePlugin(unpluginFactory)\n"],"mappings":";;;AAIA,IAAA,eAAe,iBAAiB,gBAAgB"}
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
let unplugin = require("unplugin");
|
|
3
|
-
|
|
1
|
+
const require_unpluginFactory = require("./unpluginFactory-BpZ2psBF.cjs");
|
|
4
2
|
//#region src/webpack.ts
|
|
5
|
-
var webpack_default = (0, unplugin.createWebpackPlugin)(
|
|
6
|
-
|
|
3
|
+
var webpack_default = (0, require("unplugin").createWebpackPlugin)(require_unpluginFactory.unpluginFactory);
|
|
7
4
|
//#endregion
|
|
8
5
|
module.exports = webpack_default;
|
|
6
|
+
|
|
9
7
|
//# sourceMappingURL=webpack.cjs.map
|
package/dist/webpack.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport {
|
|
1
|
+
{"version":3,"file":"webpack.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;AAMA,IAAA,mBAAA,uBAAA,qBAAmCA,wBAAAA,gBAAgB"}
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __name } from "./chunk
|
|
2
|
-
import {
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { Options } from "./types.js";
|
|
3
3
|
import { UnpluginFactoryOutput } from "unplugin";
|
|
4
4
|
import { WebpackPluginInstance } from "webpack";
|
|
5
5
|
|
package/dist/webpack.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as unpluginFactory } from "./unpluginFactory-0sYXb5x6.js";
|
|
2
2
|
import { createWebpackPlugin } from "unplugin";
|
|
3
|
-
|
|
4
3
|
//#region src/webpack.ts
|
|
5
4
|
var webpack_default = createWebpackPlugin(unpluginFactory);
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
6
|
export { webpack_default as default };
|
|
7
|
+
|
|
9
8
|
//# sourceMappingURL=webpack.js.map
|
package/dist/webpack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport {
|
|
1
|
+
{"version":3,"file":"webpack.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport type { Options } from './types.ts'\nimport { unpluginFactory } from './unpluginFactory.ts'\n\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;AAMA,IAAA,kBAAe,oBAAoB,gBAAgB"}
|