unplugin-kubb 4.0.0 → 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 +1 -1
- package/dist/index.d.ts +4 -3
- 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 -3
- 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-BiN2tznZ.cjs +155 -0
- package/dist/src-BiN2tznZ.cjs.map +1 -0
- package/dist/src-CiUcBKSs.js +95 -0
- package/dist/src-CiUcBKSs.js.map +1 -0
- package/dist/{types-D54bCl1u.d.ts → types-C-ZTDGdJ.d.cts} +251 -81
- package/dist/{types-BNmRHGEx.d.cts → types-CUVJ-CBJ.d.ts} +250 -81
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/vite.cjs +8 -3
- 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 -3
- package/dist/vite.js.map +1 -0
- package/dist/webpack.cjs +8 -3
- 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 -3
- package/dist/webpack.js.map +1 -0
- package/package.json +27 -26
- package/src/index.ts +89 -41
- package/dist/chunk-Bwj0kw0m.js +0 -32
- package/dist/src-CV35pUck.cjs +0 -116
- package/dist/src-CV35pUck.cjs.map +0 -1
- package/dist/src-wEqIY2rq.js +0 -65
- package/dist/src-wEqIY2rq.js.map +0 -1
- package/dist/vite-DkSw2hsC.js +0 -9
- package/dist/vite-DkSw2hsC.js.map +0 -1
- package/dist/vite-DruCA3WT.cjs +0 -14
- package/dist/vite-DruCA3WT.cjs.map +0 -1
- package/dist/webpack-NglPEtfi.cjs +0 -14
- package/dist/webpack-NglPEtfi.cjs.map +0 -1
- package/dist/webpack-kTaImLW0.js +0 -9
- package/dist/webpack-kTaImLW0.js.map +0 -1
|
@@ -1,54 +1,238 @@
|
|
|
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
|
-
import { ConsolaInstance, LogLevel } from "consola";
|
|
4
4
|
|
|
5
|
-
//#region ../core/src/
|
|
6
|
-
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
7
|
-
#private;
|
|
8
|
-
constructor();
|
|
9
|
-
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
|
|
10
|
-
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
11
|
-
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
12
|
-
removeAll(): void;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../core/src/logger.d.ts
|
|
5
|
+
//#region ../core/src/Kubb.d.ts
|
|
16
6
|
type DebugEvent = {
|
|
17
7
|
date: Date;
|
|
18
8
|
logs: string[];
|
|
19
9
|
fileName?: string;
|
|
20
10
|
};
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
12
|
+
hookName: H;
|
|
13
|
+
plugins: Array<Plugin>;
|
|
14
|
+
};
|
|
15
|
+
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
16
|
+
hookName: H;
|
|
17
|
+
};
|
|
18
|
+
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
19
|
+
strategy: Strategy;
|
|
20
|
+
hookName: H;
|
|
21
|
+
plugin: Plugin;
|
|
22
|
+
parameters?: unknown[] | undefined;
|
|
23
|
+
output?: unknown;
|
|
24
|
+
};
|
|
25
|
+
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
26
|
+
duration: number;
|
|
27
|
+
strategy: Strategy;
|
|
28
|
+
hookName: H;
|
|
29
|
+
plugin: Plugin;
|
|
30
|
+
parameters?: unknown[] | undefined;
|
|
31
|
+
output?: unknown;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Events emitted during the Kubb code generation lifecycle.
|
|
35
|
+
* These events can be listened to for logging, progress tracking, and custom integrations.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import type { AsyncEventEmitter } from '@kubb/core'
|
|
40
|
+
* import type { KubbEvents } from '@kubb/core'
|
|
41
|
+
*
|
|
42
|
+
* const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
|
|
43
|
+
*
|
|
44
|
+
* events.on('lifecycle:start', () => {
|
|
45
|
+
* console.log('Starting Kubb generation')
|
|
46
|
+
* })
|
|
47
|
+
*
|
|
48
|
+
* events.on('plugin:end', (plugin, { duration }) => {
|
|
49
|
+
* console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
|
|
50
|
+
* })
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
interface KubbEvents {
|
|
54
|
+
/**
|
|
55
|
+
* Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
|
|
56
|
+
*/
|
|
57
|
+
'lifecycle:start': [version: string];
|
|
58
|
+
/**
|
|
59
|
+
* Emitted at the end of the Kubb lifecycle, after all code generation is complete.
|
|
60
|
+
*/
|
|
61
|
+
'lifecycle:end': [];
|
|
62
|
+
/**
|
|
63
|
+
* Emitted when configuration loading starts.
|
|
64
|
+
*/
|
|
65
|
+
'config:start': [];
|
|
66
|
+
/**
|
|
67
|
+
* Emitted when configuration loading is complete.
|
|
68
|
+
*/
|
|
69
|
+
'config:end': [configs: Array<Config>];
|
|
70
|
+
/**
|
|
71
|
+
* Emitted when code generation phase starts.
|
|
72
|
+
*/
|
|
73
|
+
'generation:start': [config: Config];
|
|
74
|
+
/**
|
|
75
|
+
* Emitted when code generation phase completes.
|
|
76
|
+
*/
|
|
77
|
+
'generation:end': [Config: Config];
|
|
78
|
+
/**
|
|
79
|
+
* Emitted with a summary of the generation results.
|
|
80
|
+
* Contains summary lines, title, and success status.
|
|
81
|
+
*/
|
|
82
|
+
'generation:summary': [Config: Config, {
|
|
83
|
+
failedPlugins: Set<{
|
|
84
|
+
plugin: Plugin;
|
|
85
|
+
error: Error;
|
|
86
|
+
}>;
|
|
87
|
+
status: 'success' | 'failed';
|
|
88
|
+
hrStart: [number, number];
|
|
89
|
+
filesCreated: number;
|
|
90
|
+
pluginTimings?: Map<string, number>;
|
|
91
|
+
}];
|
|
92
|
+
/**
|
|
93
|
+
* Emitted when code formatting starts (e.g., running Biome or Prettier).
|
|
94
|
+
*/
|
|
95
|
+
'format:start': [];
|
|
96
|
+
/**
|
|
97
|
+
* Emitted when code formatting completes.
|
|
98
|
+
*/
|
|
99
|
+
'format:end': [];
|
|
100
|
+
/**
|
|
101
|
+
* Emitted when linting starts.
|
|
102
|
+
*/
|
|
103
|
+
'lint:start': [];
|
|
104
|
+
/**
|
|
105
|
+
* Emitted when linting completes.
|
|
106
|
+
*/
|
|
107
|
+
'lint:end': [];
|
|
108
|
+
/**
|
|
109
|
+
* Emitted when plugin hooks execution starts.
|
|
110
|
+
*/
|
|
111
|
+
'hooks:start': [];
|
|
112
|
+
/**
|
|
113
|
+
* Emitted when plugin hooks execution completes.
|
|
114
|
+
*/
|
|
115
|
+
'hooks:end': [];
|
|
116
|
+
/**
|
|
117
|
+
* Emitted when a single hook execution starts. (e.g., format or lint).
|
|
118
|
+
* The callback should be invoked when the command completes.
|
|
119
|
+
*/
|
|
120
|
+
'hook:start': [{
|
|
121
|
+
id?: string;
|
|
122
|
+
command: string;
|
|
123
|
+
args?: readonly string[];
|
|
124
|
+
}];
|
|
125
|
+
/**
|
|
126
|
+
* Emitted when a single hook execution completes.
|
|
127
|
+
*/
|
|
128
|
+
'hook:end': [{
|
|
129
|
+
id?: string;
|
|
130
|
+
command: string;
|
|
131
|
+
args?: readonly string[];
|
|
132
|
+
success: boolean;
|
|
133
|
+
error: Error | null;
|
|
32
134
|
}];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Emitted when a new version of Kubb is available.
|
|
137
|
+
*/
|
|
138
|
+
'version:new': [currentVersion: string, latestVersion: string];
|
|
139
|
+
/**
|
|
140
|
+
* Informational message event.
|
|
141
|
+
*/
|
|
142
|
+
info: [message: string, info?: string];
|
|
143
|
+
/**
|
|
144
|
+
* Error event. Emitted when an error occurs during code generation.
|
|
145
|
+
*/
|
|
146
|
+
error: [error: Error, meta?: Record<string, unknown>];
|
|
147
|
+
/**
|
|
148
|
+
* Success message event.
|
|
149
|
+
*/
|
|
150
|
+
success: [message: string, info?: string];
|
|
151
|
+
/**
|
|
152
|
+
* Warning message event.
|
|
153
|
+
*/
|
|
154
|
+
warn: [message: string, info?: string];
|
|
155
|
+
/**
|
|
156
|
+
* Debug event for detailed logging.
|
|
157
|
+
* Contains timestamp, log messages, and optional filename.
|
|
158
|
+
*/
|
|
159
|
+
debug: [meta: DebugEvent];
|
|
160
|
+
/**
|
|
161
|
+
* Emitted when file processing starts.
|
|
162
|
+
* Contains the list of files to be processed.
|
|
163
|
+
*/
|
|
164
|
+
'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
|
|
165
|
+
/**
|
|
166
|
+
* Emitted for each file being processed, providing progress updates.
|
|
167
|
+
* Contains processed count, total count, percentage, and file details.
|
|
168
|
+
*/
|
|
169
|
+
'file:processing:update': [{
|
|
170
|
+
/** Number of files processed so far */
|
|
171
|
+
processed: number;
|
|
172
|
+
/** Total number of files to process */
|
|
173
|
+
total: number;
|
|
174
|
+
/** Processing percentage (0-100) */
|
|
175
|
+
percentage: number;
|
|
176
|
+
/** Optional source identifier */
|
|
177
|
+
source?: string;
|
|
178
|
+
/** The file being processed */
|
|
179
|
+
file: KubbFile.ResolvedFile;
|
|
180
|
+
/**
|
|
181
|
+
* Kubb configuration (not present in Fabric).
|
|
182
|
+
* Provides access to the current config during file processing.
|
|
183
|
+
*/
|
|
184
|
+
config: Config;
|
|
36
185
|
}];
|
|
37
|
-
|
|
38
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Emitted when file processing completes.
|
|
188
|
+
* Contains the list of processed files.
|
|
189
|
+
*/
|
|
190
|
+
'files:processing:end': [files: KubbFile.ResolvedFile[]];
|
|
191
|
+
/**
|
|
192
|
+
* Emitted when a plugin starts executing.
|
|
193
|
+
*/
|
|
194
|
+
'plugin:start': [plugin: Plugin];
|
|
195
|
+
/**
|
|
196
|
+
* Emitted when a plugin completes execution.
|
|
197
|
+
* Duration in ms
|
|
198
|
+
*/
|
|
199
|
+
'plugin:end': [plugin: Plugin, meta: {
|
|
200
|
+
duration: number;
|
|
201
|
+
success: boolean;
|
|
202
|
+
error?: Error;
|
|
39
203
|
}];
|
|
40
|
-
};
|
|
41
|
-
type Logger = {
|
|
42
204
|
/**
|
|
43
|
-
*
|
|
205
|
+
* Emitted when plugin hook progress tracking starts.
|
|
206
|
+
* Contains the hook name and list of plugins to execute.
|
|
44
207
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
208
|
+
'plugins:hook:progress:start': [meta: ProgressStartMeta];
|
|
209
|
+
/**
|
|
210
|
+
* Emitted when plugin hook progress tracking ends.
|
|
211
|
+
* Contains the hook name that completed.
|
|
212
|
+
*/
|
|
213
|
+
'plugins:hook:progress:end': [meta: ProgressStopMeta];
|
|
214
|
+
/**
|
|
215
|
+
* Emitted when a plugin hook starts processing.
|
|
216
|
+
* Contains strategy, hook name, plugin, parameters, and output.
|
|
217
|
+
*/
|
|
218
|
+
'plugins:hook:processing:start': [meta: ExecutingMeta];
|
|
219
|
+
/**
|
|
220
|
+
* Emitted when a plugin hook completes processing.
|
|
221
|
+
* Contains duration, strategy, hook name, plugin, parameters, and output.
|
|
222
|
+
*/
|
|
223
|
+
'plugins:hook:processing:end': [meta: ExecutedMeta];
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region ../core/src/utils/AsyncEventEmitter.d.ts
|
|
227
|
+
declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
|
|
228
|
+
#private;
|
|
229
|
+
constructor(maxListener?: number);
|
|
230
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
|
|
231
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
232
|
+
onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
|
|
233
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
234
|
+
removeAll(): void;
|
|
235
|
+
}
|
|
52
236
|
//#endregion
|
|
53
237
|
//#region ../core/src/utils/types.d.ts
|
|
54
238
|
type PossiblePromise<T> = Promise<T> | T;
|
|
@@ -130,22 +314,24 @@ type Config<TInput = Input> = {
|
|
|
130
314
|
* @default prettier
|
|
131
315
|
*
|
|
132
316
|
* Possible values:
|
|
317
|
+
* - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
|
|
133
318
|
* - 'prettier': Uses Prettier for code formatting.
|
|
134
319
|
* - 'biome': Uses Biome for code formatting.
|
|
135
320
|
*
|
|
136
321
|
*/
|
|
137
|
-
format?: 'prettier' | 'biome' | false;
|
|
322
|
+
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
138
323
|
/**
|
|
139
324
|
* Specifies the linter that should be used to analyze the code.
|
|
140
325
|
* The accepted values indicate different linting tools.
|
|
141
326
|
*
|
|
142
327
|
* Possible values:
|
|
328
|
+
* - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
143
329
|
* - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
|
|
144
330
|
* - 'biome': Represents the Biome linter, a modern tool for code scanning.
|
|
145
331
|
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
146
332
|
*
|
|
147
333
|
*/
|
|
148
|
-
lint?: 'eslint' | 'biome' | 'oxlint' | false;
|
|
334
|
+
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
149
335
|
/**
|
|
150
336
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
151
337
|
* @default { '.ts': '.ts'}
|
|
@@ -163,6 +349,13 @@ type Config<TInput = Input> = {
|
|
|
163
349
|
* @default 'simple'
|
|
164
350
|
*/
|
|
165
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;
|
|
166
359
|
};
|
|
167
360
|
/**
|
|
168
361
|
* An array of Kubb plugins that will be used in the generation.
|
|
@@ -314,8 +507,15 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
314
507
|
fabric: Fabric;
|
|
315
508
|
config: Config;
|
|
316
509
|
pluginManager: PluginManager;
|
|
510
|
+
/**
|
|
511
|
+
* Only add when the file does not exist yet
|
|
512
|
+
*/
|
|
317
513
|
addFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
318
|
-
|
|
514
|
+
/**
|
|
515
|
+
* merging multiple sources into the same output file
|
|
516
|
+
*/
|
|
517
|
+
upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
518
|
+
events: AsyncEventEmitter<KubbEvents>;
|
|
319
519
|
mode: KubbFile.Mode;
|
|
320
520
|
/**
|
|
321
521
|
* Current plugin
|
|
@@ -326,14 +526,6 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
326
526
|
//#region ../core/src/PluginManager.d.ts
|
|
327
527
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
328
528
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
329
|
-
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
330
|
-
message: string;
|
|
331
|
-
strategy: Strategy;
|
|
332
|
-
hookName: H;
|
|
333
|
-
plugin: Plugin;
|
|
334
|
-
parameters?: unknown[] | undefined;
|
|
335
|
-
output?: unknown;
|
|
336
|
-
};
|
|
337
529
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
338
530
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
339
531
|
result: Result;
|
|
@@ -341,17 +533,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
341
533
|
};
|
|
342
534
|
type Options$1 = {
|
|
343
535
|
fabric: Fabric;
|
|
344
|
-
|
|
536
|
+
events: AsyncEventEmitter<KubbEvents>;
|
|
345
537
|
/**
|
|
346
538
|
* @default Number.POSITIVE_INFINITY
|
|
347
539
|
*/
|
|
348
540
|
concurrency?: number;
|
|
349
541
|
};
|
|
350
|
-
type Events = {
|
|
351
|
-
executing: [executer: Executer];
|
|
352
|
-
executed: [executer: Executer];
|
|
353
|
-
error: [error: Error];
|
|
354
|
-
};
|
|
355
542
|
type GetFileProps<TOptions = object> = {
|
|
356
543
|
name: string;
|
|
357
544
|
mode?: KubbFile.Mode;
|
|
@@ -361,12 +548,10 @@ type GetFileProps<TOptions = object> = {
|
|
|
361
548
|
};
|
|
362
549
|
declare class PluginManager {
|
|
363
550
|
#private;
|
|
364
|
-
readonly events: EventEmitter<Events>;
|
|
365
551
|
readonly config: Config;
|
|
366
|
-
readonly executed: Array<Executer>;
|
|
367
|
-
readonly logger: Logger;
|
|
368
552
|
readonly options: Options$1;
|
|
369
553
|
constructor(config: Config, options: Options$1);
|
|
554
|
+
get events(): AsyncEventEmitter<KubbEvents>;
|
|
370
555
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
371
556
|
get plugins(): Array<Plugin>;
|
|
372
557
|
getFile<TOptions = object>({
|
|
@@ -380,23 +565,17 @@ declare class PluginManager {
|
|
|
380
565
|
}>;
|
|
381
566
|
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
|
|
382
567
|
resolveName: (params: ResolveNameParams) => string;
|
|
383
|
-
/**
|
|
384
|
-
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
385
|
-
*/
|
|
386
|
-
on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
|
|
387
568
|
/**
|
|
388
569
|
* Run a specific hookName for plugin x.
|
|
389
570
|
*/
|
|
390
571
|
hookForPlugin<H extends PluginLifecycleHooks>({
|
|
391
572
|
pluginKey,
|
|
392
573
|
hookName,
|
|
393
|
-
parameters
|
|
394
|
-
message
|
|
574
|
+
parameters
|
|
395
575
|
}: {
|
|
396
576
|
pluginKey: Plugin['key'];
|
|
397
577
|
hookName: H;
|
|
398
578
|
parameters: PluginParameter<H>;
|
|
399
|
-
message: string;
|
|
400
579
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>>;
|
|
401
580
|
/**
|
|
402
581
|
* Run a specific hookName for plugin x.
|
|
@@ -404,13 +583,11 @@ declare class PluginManager {
|
|
|
404
583
|
hookForPluginSync<H extends PluginLifecycleHooks>({
|
|
405
584
|
pluginKey,
|
|
406
585
|
hookName,
|
|
407
|
-
parameters
|
|
408
|
-
message
|
|
586
|
+
parameters
|
|
409
587
|
}: {
|
|
410
588
|
pluginKey: Plugin['key'];
|
|
411
589
|
hookName: H;
|
|
412
590
|
parameters: PluginParameter<H>;
|
|
413
|
-
message: string;
|
|
414
591
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
415
592
|
/**
|
|
416
593
|
* First non-null result stops and will return it's value.
|
|
@@ -418,13 +595,11 @@ declare class PluginManager {
|
|
|
418
595
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
419
596
|
hookName,
|
|
420
597
|
parameters,
|
|
421
|
-
skipped
|
|
422
|
-
message
|
|
598
|
+
skipped
|
|
423
599
|
}: {
|
|
424
600
|
hookName: H;
|
|
425
601
|
parameters: PluginParameter<H>;
|
|
426
602
|
skipped?: ReadonlySet<Plugin> | null;
|
|
427
|
-
message: string;
|
|
428
603
|
}): Promise<SafeParseResult<H>>;
|
|
429
604
|
/**
|
|
430
605
|
* First non-null result stops and will return it's value.
|
|
@@ -432,37 +607,31 @@ declare class PluginManager {
|
|
|
432
607
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
433
608
|
hookName,
|
|
434
609
|
parameters,
|
|
435
|
-
skipped
|
|
436
|
-
message
|
|
610
|
+
skipped
|
|
437
611
|
}: {
|
|
438
612
|
hookName: H;
|
|
439
613
|
parameters: PluginParameter<H>;
|
|
440
614
|
skipped?: ReadonlySet<Plugin> | null;
|
|
441
|
-
message: string;
|
|
442
615
|
}): SafeParseResult<H>;
|
|
443
616
|
/**
|
|
444
617
|
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
445
618
|
*/
|
|
446
619
|
hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
|
|
447
620
|
hookName,
|
|
448
|
-
parameters
|
|
449
|
-
message
|
|
621
|
+
parameters
|
|
450
622
|
}: {
|
|
451
623
|
hookName: H;
|
|
452
624
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
453
|
-
message: string;
|
|
454
625
|
}): Promise<Awaited<TOuput>[]>;
|
|
455
626
|
/**
|
|
456
627
|
* Chains plugins
|
|
457
628
|
*/
|
|
458
629
|
hookSeq<H extends PluginLifecycleHooks>({
|
|
459
630
|
hookName,
|
|
460
|
-
parameters
|
|
461
|
-
message
|
|
631
|
+
parameters
|
|
462
632
|
}: {
|
|
463
633
|
hookName: H;
|
|
464
634
|
parameters?: PluginParameter<H>;
|
|
465
|
-
message: string;
|
|
466
635
|
}): Promise<void>;
|
|
467
636
|
getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
|
|
468
637
|
getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
|
|
@@ -477,4 +646,4 @@ type Options = {
|
|
|
477
646
|
};
|
|
478
647
|
//#endregion
|
|
479
648
|
export { Options as t };
|
|
480
|
-
//# 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,4 +1,9 @@
|
|
|
1
|
-
require('./src-
|
|
2
|
-
|
|
1
|
+
const require_src = require('./src-BiN2tznZ.cjs');
|
|
2
|
+
let unplugin = require("unplugin");
|
|
3
3
|
|
|
4
|
-
|
|
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,4 +1,9 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import {
|
|
1
|
+
import { r as unpluginFactory } from "./src-CiUcBKSs.js";
|
|
2
|
+
import { createVitePlugin } from "unplugin";
|
|
3
3
|
|
|
4
|
-
|
|
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,4 +1,9 @@
|
|
|
1
|
-
require('./src-
|
|
2
|
-
|
|
1
|
+
const require_src = require('./src-BiN2tznZ.cjs');
|
|
2
|
+
let unplugin = require("unplugin");
|
|
3
3
|
|
|
4
|
-
|
|
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,4 +1,9 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import {
|
|
1
|
+
import { r as unpluginFactory } from "./src-CiUcBKSs.js";
|
|
2
|
+
import { createWebpackPlugin } from "unplugin";
|
|
3
3
|
|
|
4
|
-
|
|
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"}
|