@kubb/plugin-redoc 4.20.3 → 4.20.5

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { KubbFile } from "@kubb/fabric-core/types";
2
- import { Fabric } from "@kubb/react-fabric";
1
+ import * as _kubb_core0 from "@kubb/core";
2
+ import { Output, PluginFactoryOptions } from "@kubb/core";
3
3
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
4
4
  import BaseOas from "oas";
5
5
  import { Operation } from "oas/operation";
@@ -7,658 +7,6 @@ import { DiscriminatorObject, OASDocument, SchemaObject } from "oas/types";
7
7
 
8
8
  //#region rolldown:runtime
9
9
  //#endregion
10
- //#region ../core/src/Kubb.d.ts
11
- type DebugEvent = {
12
- date: Date;
13
- logs: string[];
14
- fileName?: string;
15
- };
16
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
17
- hookName: H;
18
- plugins: Array<Plugin>;
19
- };
20
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
21
- hookName: H;
22
- };
23
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
24
- strategy: Strategy;
25
- hookName: H;
26
- plugin: Plugin;
27
- parameters?: unknown[] | undefined;
28
- output?: unknown;
29
- };
30
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
31
- duration: number;
32
- strategy: Strategy;
33
- hookName: H;
34
- plugin: Plugin;
35
- parameters?: unknown[] | undefined;
36
- output?: unknown;
37
- };
38
- /**
39
- * Events emitted during the Kubb code generation lifecycle.
40
- * These events can be listened to for logging, progress tracking, and custom integrations.
41
- *
42
- * @example
43
- * ```typescript
44
- * import type { AsyncEventEmitter } from '@kubb/core'
45
- * import type { KubbEvents } from '@kubb/core'
46
- *
47
- * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
48
- *
49
- * events.on('lifecycle:start', () => {
50
- * console.log('Starting Kubb generation')
51
- * })
52
- *
53
- * events.on('plugin:end', (plugin, { duration }) => {
54
- * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
55
- * })
56
- * ```
57
- */
58
- interface KubbEvents {
59
- /**
60
- * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
61
- */
62
- 'lifecycle:start': [version: string];
63
- /**
64
- * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
65
- */
66
- 'lifecycle:end': [];
67
- /**
68
- * Emitted when configuration loading starts.
69
- */
70
- 'config:start': [];
71
- /**
72
- * Emitted when configuration loading is complete.
73
- */
74
- 'config:end': [configs: Array<Config>];
75
- /**
76
- * Emitted when code generation phase starts.
77
- */
78
- 'generation:start': [config: Config];
79
- /**
80
- * Emitted when code generation phase completes.
81
- */
82
- 'generation:end': [Config: Config];
83
- /**
84
- * Emitted with a summary of the generation results.
85
- * Contains summary lines, title, and success status.
86
- */
87
- 'generation:summary': [Config: Config, {
88
- failedPlugins: Set<{
89
- plugin: Plugin;
90
- error: Error;
91
- }>;
92
- status: 'success' | 'failed';
93
- hrStart: [number, number];
94
- filesCreated: number;
95
- pluginTimings?: Map<string, number>;
96
- }];
97
- /**
98
- * Emitted when code formatting starts (e.g., running Biome or Prettier).
99
- */
100
- 'format:start': [];
101
- /**
102
- * Emitted when code formatting completes.
103
- */
104
- 'format:end': [];
105
- /**
106
- * Emitted when linting starts.
107
- */
108
- 'lint:start': [];
109
- /**
110
- * Emitted when linting completes.
111
- */
112
- 'lint:end': [];
113
- /**
114
- * Emitted when plugin hooks execution starts.
115
- */
116
- 'hooks:start': [];
117
- /**
118
- * Emitted when plugin hooks execution completes.
119
- */
120
- 'hooks:end': [];
121
- /**
122
- * Emitted when a single hook execution starts. (e.g., format or lint).
123
- * The callback should be invoked when the command completes.
124
- */
125
- 'hook:start': [{
126
- id?: string;
127
- command: string;
128
- args?: readonly string[];
129
- }];
130
- /**
131
- * Emitted when a single hook execution completes.
132
- */
133
- 'hook:end': [{
134
- id?: string;
135
- command: string;
136
- args?: readonly string[];
137
- success: boolean;
138
- error: Error | null;
139
- }];
140
- /**
141
- * Emitted when a new version of Kubb is available.
142
- */
143
- 'version:new': [currentVersion: string, latestVersion: string];
144
- /**
145
- * Informational message event.
146
- */
147
- info: [message: string, info?: string];
148
- /**
149
- * Error event. Emitted when an error occurs during code generation.
150
- */
151
- error: [error: Error, meta?: Record<string, unknown>];
152
- /**
153
- * Success message event.
154
- */
155
- success: [message: string, info?: string];
156
- /**
157
- * Warning message event.
158
- */
159
- warn: [message: string, info?: string];
160
- /**
161
- * Debug event for detailed logging.
162
- * Contains timestamp, log messages, and optional filename.
163
- */
164
- debug: [meta: DebugEvent];
165
- /**
166
- * Emitted when file processing starts.
167
- * Contains the list of files to be processed.
168
- */
169
- 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
170
- /**
171
- * Emitted for each file being processed, providing progress updates.
172
- * Contains processed count, total count, percentage, and file details.
173
- */
174
- 'file:processing:update': [{
175
- /** Number of files processed so far */
176
- processed: number;
177
- /** Total number of files to process */
178
- total: number;
179
- /** Processing percentage (0-100) */
180
- percentage: number;
181
- /** Optional source identifier */
182
- source?: string;
183
- /** The file being processed */
184
- file: KubbFile.ResolvedFile;
185
- /**
186
- * Kubb configuration (not present in Fabric).
187
- * Provides access to the current config during file processing.
188
- */
189
- config: Config;
190
- }];
191
- /**
192
- * Emitted when file processing completes.
193
- * Contains the list of processed files.
194
- */
195
- 'files:processing:end': [files: KubbFile.ResolvedFile[]];
196
- /**
197
- * Emitted when a plugin starts executing.
198
- */
199
- 'plugin:start': [plugin: Plugin];
200
- /**
201
- * Emitted when a plugin completes execution.
202
- * Duration in ms
203
- */
204
- 'plugin:end': [plugin: Plugin, meta: {
205
- duration: number;
206
- success: boolean;
207
- error?: Error;
208
- }];
209
- /**
210
- * Emitted when plugin hook progress tracking starts.
211
- * Contains the hook name and list of plugins to execute.
212
- */
213
- 'plugins:hook:progress:start': [meta: ProgressStartMeta];
214
- /**
215
- * Emitted when plugin hook progress tracking ends.
216
- * Contains the hook name that completed.
217
- */
218
- 'plugins:hook:progress:end': [meta: ProgressStopMeta];
219
- /**
220
- * Emitted when a plugin hook starts processing.
221
- * Contains strategy, hook name, plugin, parameters, and output.
222
- */
223
- 'plugins:hook:processing:start': [meta: ExecutingMeta];
224
- /**
225
- * Emitted when a plugin hook completes processing.
226
- * Contains duration, strategy, hook name, plugin, parameters, and output.
227
- */
228
- 'plugins:hook:processing:end': [meta: ExecutedMeta];
229
- }
230
- //#endregion
231
- //#region ../core/src/utils/AsyncEventEmitter.d.ts
232
- declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
233
- #private;
234
- constructor(maxListener?: number);
235
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
236
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
237
- onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
238
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
239
- removeAll(): void;
240
- }
241
- //#endregion
242
- //#region ../core/src/utils/types.d.ts
243
- type PossiblePromise<T> = Promise<T> | T;
244
- //#endregion
245
- //#region ../core/src/types.d.ts
246
- declare global {
247
- namespace Kubb {
248
- interface PluginContext {}
249
- }
250
- }
251
- /**
252
- * Config used in `kubb.config.ts`
253
- *
254
- * @example
255
- * import { defineConfig } from '@kubb/core'
256
- * export default defineConfig({
257
- * ...
258
- * })
259
- */
260
-
261
- type InputPath = {
262
- /**
263
- * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.
264
- */
265
- path: string;
266
- };
267
- type InputData = {
268
- /**
269
- * A `string` or `object` that contains your Swagger/OpenAPI data.
270
- */
271
- data: string | unknown;
272
- };
273
- type Input = InputPath | InputData | Array<InputPath>;
274
- type BarrelType = 'all' | 'named' | 'propagate';
275
- /**
276
- * @private
277
- */
278
- type Config<TInput = Input> = {
279
- /**
280
- * The name to display in the CLI output.
281
- */
282
- name?: string;
283
- /**
284
- * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.
285
- * @default process.cwd()
286
- */
287
- root: string;
288
- /**
289
- * You can use either `input.path` or `input.data`, depending on your specific needs.
290
- */
291
- input: TInput;
292
- output: {
293
- /**
294
- * The path where all generated files receives exported.
295
- * This can be an absolute path or a path relative to the specified root option.
296
- */
297
- path: string;
298
- /**
299
- * Clean the output directory before each build.
300
- */
301
- clean?: boolean;
302
- /**
303
- * Save files to the file system.
304
- * @default true
305
- */
306
- write?: boolean;
307
- /**
308
- * Specifies the formatting tool to be used.
309
- * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
310
- * - 'prettier' uses Prettier for code formatting.
311
- * - 'biome' uses Biome for code formatting.
312
- * - 'oxfmt' uses Oxfmt for code formatting.
313
- * - false disables code formatting.
314
- * @default 'prettier'
315
- */
316
- format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
317
- /**
318
- * Specifies the linter that should be used to analyze the code.
319
- * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
320
- * - 'eslint' uses ESLint for linting.
321
- * - 'biome' uses Biome for linting.
322
- * - 'oxlint' uses Oxlint for linting.
323
- * - false disables linting.
324
- * @default 'auto'
325
- */
326
- lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
327
- /**
328
- * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
329
- * @default { '.ts': '.ts'}
330
- */
331
- extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
332
- /**
333
- * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
334
- * @default 'named'
335
- */
336
- barrelType?: Exclude<BarrelType, 'propagate'> | false;
337
- /**
338
- * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
339
- * - 'simple' adds banner with link to Kubb.
340
- * - 'full' adds source, title, description, and OpenAPI version.
341
- * - false disables banner generation.
342
- * @default 'simple'
343
- */
344
- defaultBanner?: 'simple' | 'full' | false;
345
- /**
346
- * Whether to override existing external files if they already exist.
347
- * When setting the option in the global configuration, all plugins inherit the same behavior by default.
348
- * However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.
349
- * @default false
350
- */
351
- override?: boolean;
352
- };
353
- /**
354
- * An array of Kubb plugins that used in the generation.
355
- * Each plugin may include additional configurable options(defined in the plugin itself).
356
- * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
357
- */
358
- plugins?: Array<Plugin>;
359
- /**
360
- * Hooks triggered when a specific action occurs in Kubb.
361
- */
362
- hooks?: {
363
- /**
364
- * Hook that triggers at the end of all executions.
365
- * Useful for running Prettier or ESLint to format/lint your code.
366
- */
367
- done?: string | Array<string>;
368
- };
369
- };
370
- type PluginFactoryOptions<
371
- /**
372
- * Name to be used for the plugin, this will also be used for they key.
373
- */
374
- TName extends string = string,
375
- /**
376
- * Options of the plugin.
377
- */
378
- TOptions extends object = object,
379
- /**
380
- * Options of the plugin that can be used later on, see `options` inside your plugin config.
381
- */
382
- TResolvedOptions extends object = TOptions,
383
- /**
384
- * Context that you want to expose to other plugins.
385
- */
386
- TContext = any,
387
- /**
388
- * When calling `resolvePath` you can specify better types.
389
- */
390
- TResolvePathOptions extends object = object> = {
391
- name: TName;
392
- /**
393
- * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
394
- */
395
- key: PluginKey<TName | string>;
396
- options: TOptions;
397
- resolvedOptions: TResolvedOptions;
398
- context: TContext;
399
- resolvePathOptions: TResolvePathOptions;
400
- };
401
- type PluginKey<TName> = [name: TName, identifier?: string | number];
402
- type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
403
- /**
404
- * Unique name used for the plugin
405
- * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
406
- * @example @kubb/typescript
407
- */
408
- name: TOptions['name'];
409
- /**
410
- * Options set for a specific plugin(see kubb.config.js), passthrough of options.
411
- */
412
- options: TOptions['resolvedOptions'];
413
- /**
414
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
415
- * Can be used to validate dependent plugins.
416
- */
417
- pre?: Array<string>;
418
- /**
419
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
420
- */
421
- post?: Array<string>;
422
- inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
423
- };
424
- type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
425
- type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
426
- /**
427
- * Unique name used for the plugin
428
- * @example @kubb/typescript
429
- */
430
- name: TOptions['name'];
431
- /**
432
- * Internal key used when a developer uses more than one of the same plugin
433
- * @private
434
- */
435
- key: TOptions['key'];
436
- /**
437
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
438
- * Can be used to validate dependent plugins.
439
- */
440
- pre?: Array<string>;
441
- /**
442
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
443
- */
444
- post?: Array<string>;
445
- /**
446
- * Options set for a specific plugin(see kubb.config.js), passthrough of options.
447
- */
448
- options: TOptions['resolvedOptions'];
449
- install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
450
- /**
451
- * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
452
- */
453
- inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
454
- };
455
- type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
456
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
457
- /**
458
- * Start of the lifecycle of a plugin.
459
- * @type hookParallel
460
- */
461
- install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
462
- /**
463
- * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
464
- * Options can als be included.
465
- * @type hookFirst
466
- * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
467
- */
468
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
469
- /**
470
- * Resolve to a name based on a string.
471
- * Useful when converting to PascalCase or camelCase.
472
- * @type hookFirst
473
- * @example ('pet') => 'Pet'
474
- */
475
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
476
- };
477
- type PluginLifecycleHooks = keyof PluginLifecycle;
478
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
479
- type ResolvePathParams<TOptions = object> = {
480
- pluginKey?: Plugin['key'];
481
- baseName: KubbFile.BaseName;
482
- mode?: KubbFile.Mode;
483
- /**
484
- * Options to be passed to 'resolvePath' 3th parameter
485
- */
486
- options?: TOptions;
487
- };
488
- type ResolveNameParams = {
489
- name: string;
490
- pluginKey?: Plugin['key'];
491
- /**
492
- * Specifies the type of entity being named.
493
- * - 'file' customizes the name of the created file (uses camelCase).
494
- * - 'function' customizes the exported function names (uses camelCase).
495
- * - 'type' customizes TypeScript types (uses PascalCase).
496
- * - 'const' customizes variable names (uses camelCase).
497
- * @default undefined
498
- */
499
- type?: 'file' | 'function' | 'type' | 'const';
500
- };
501
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
502
- fabric: Fabric;
503
- config: Config;
504
- pluginManager: PluginManager;
505
- /**
506
- * Only add when the file does not exist yet
507
- */
508
- addFile: (...file: Array<KubbFile.File>) => Promise<void>;
509
- /**
510
- * merging multiple sources into the same output file
511
- */
512
- upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
513
- events: AsyncEventEmitter<KubbEvents>;
514
- mode: KubbFile.Mode;
515
- /**
516
- * Current plugin
517
- */
518
- plugin: Plugin<TOptions>;
519
- } & Kubb.PluginContext;
520
- /**
521
- * Specify the export location for the files and define the behavior of the output
522
- */
523
- type Output<TOptions> = {
524
- /**
525
- * Path to the output folder or file that will contain the generated code
526
- */
527
- path: string;
528
- /**
529
- * Define what needs to be exported, here you can also disable the export of barrel files
530
- * @default 'named'
531
- */
532
- barrelType?: BarrelType | false;
533
- /**
534
- * Add a banner text in the beginning of every file
535
- */
536
- banner?: string | ((options: TOptions) => string);
537
- /**
538
- * Add a footer text in the beginning of every file
539
- */
540
- footer?: string | ((options: TOptions) => string);
541
- /**
542
- * Whether to override existing external files if they already exist.
543
- * @default false
544
- */
545
- override?: boolean;
546
- };
547
- //#endregion
548
- //#region ../core/src/PluginManager.d.ts
549
- type RequiredPluginLifecycle = Required<PluginLifecycle>;
550
- type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
551
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
552
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
553
- result: Result;
554
- plugin: Plugin;
555
- };
556
- type Options$1 = {
557
- fabric: Fabric;
558
- events: AsyncEventEmitter<KubbEvents>;
559
- /**
560
- * @default Number.POSITIVE_INFINITY
561
- */
562
- concurrency?: number;
563
- };
564
- type GetFileProps<TOptions = object> = {
565
- name: string;
566
- mode?: KubbFile.Mode;
567
- extname: KubbFile.Extname;
568
- pluginKey: Plugin['key'];
569
- options?: TOptions;
570
- };
571
- declare class PluginManager {
572
- #private;
573
- readonly config: Config;
574
- readonly options: Options$1;
575
- constructor(config: Config, options: Options$1);
576
- get events(): AsyncEventEmitter<KubbEvents>;
577
- getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
578
- get plugins(): Array<Plugin>;
579
- getFile<TOptions = object>({
580
- name,
581
- mode,
582
- extname,
583
- pluginKey,
584
- options
585
- }: GetFileProps<TOptions>): KubbFile.File<{
586
- pluginKey: Plugin['key'];
587
- }>;
588
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
589
- resolveName: (params: ResolveNameParams) => string;
590
- /**
591
- * Run a specific hookName for plugin x.
592
- */
593
- hookForPlugin<H extends PluginLifecycleHooks>({
594
- pluginKey,
595
- hookName,
596
- parameters
597
- }: {
598
- pluginKey: Plugin['key'];
599
- hookName: H;
600
- parameters: PluginParameter<H>;
601
- }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
602
- /**
603
- * Run a specific hookName for plugin x.
604
- */
605
- hookForPluginSync<H extends PluginLifecycleHooks>({
606
- pluginKey,
607
- hookName,
608
- parameters
609
- }: {
610
- pluginKey: Plugin['key'];
611
- hookName: H;
612
- parameters: PluginParameter<H>;
613
- }): Array<ReturnType<ParseResult<H>>> | null;
614
- /**
615
- * Returns the first non-null result.
616
- */
617
- hookFirst<H extends PluginLifecycleHooks>({
618
- hookName,
619
- parameters,
620
- skipped
621
- }: {
622
- hookName: H;
623
- parameters: PluginParameter<H>;
624
- skipped?: ReadonlySet<Plugin> | null;
625
- }): Promise<SafeParseResult<H>>;
626
- /**
627
- * Returns the first non-null result.
628
- */
629
- hookFirstSync<H extends PluginLifecycleHooks>({
630
- hookName,
631
- parameters,
632
- skipped
633
- }: {
634
- hookName: H;
635
- parameters: PluginParameter<H>;
636
- skipped?: ReadonlySet<Plugin> | null;
637
- }): SafeParseResult<H>;
638
- /**
639
- * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
640
- */
641
- hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
642
- hookName,
643
- parameters
644
- }: {
645
- hookName: H;
646
- parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
647
- }): Promise<Awaited<TOutput>[]>;
648
- /**
649
- * Chains plugins
650
- */
651
- hookSeq<H extends PluginLifecycleHooks>({
652
- hookName,
653
- parameters
654
- }: {
655
- hookName: H;
656
- parameters?: PluginParameter<H>;
657
- }): Promise<void>;
658
- getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
659
- getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
660
- }
661
- //#endregion
662
10
  //#region ../oas/src/types.d.ts
663
11
  type contentType = 'application/json' | (string & {});
664
12
  type SchemaObject$1 = SchemaObject & {
@@ -726,7 +74,7 @@ type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions,
726
74
  //#endregion
727
75
  //#region src/plugin.d.ts
728
76
  declare const pluginRedocName = "plugin-redoc";
729
- declare const pluginRedoc: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginRedoc>;
77
+ declare const pluginRedoc: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginRedoc>;
730
78
  //#endregion
731
79
  export { type PluginRedoc, pluginRedoc, pluginRedocName };
732
80
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,663 +1,11 @@
1
1
  import { t as __name } from "./chunk-jHaXqnEa.js";
2
- import { KubbFile } from "@kubb/fabric-core/types";
3
- import { Fabric } from "@kubb/react-fabric";
2
+ import * as _kubb_core0 from "@kubb/core";
3
+ import { Output, PluginFactoryOptions } from "@kubb/core";
4
4
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
5
5
  import BaseOas from "oas";
6
6
  import { Operation } from "oas/operation";
7
7
  import { DiscriminatorObject, OASDocument, SchemaObject } from "oas/types";
8
8
 
9
- //#region ../core/src/Kubb.d.ts
10
- type DebugEvent = {
11
- date: Date;
12
- logs: string[];
13
- fileName?: string;
14
- };
15
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
16
- hookName: H;
17
- plugins: Array<Plugin>;
18
- };
19
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
20
- hookName: H;
21
- };
22
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
23
- strategy: Strategy;
24
- hookName: H;
25
- plugin: Plugin;
26
- parameters?: unknown[] | undefined;
27
- output?: unknown;
28
- };
29
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
30
- duration: number;
31
- strategy: Strategy;
32
- hookName: H;
33
- plugin: Plugin;
34
- parameters?: unknown[] | undefined;
35
- output?: unknown;
36
- };
37
- /**
38
- * Events emitted during the Kubb code generation lifecycle.
39
- * These events can be listened to for logging, progress tracking, and custom integrations.
40
- *
41
- * @example
42
- * ```typescript
43
- * import type { AsyncEventEmitter } from '@kubb/core'
44
- * import type { KubbEvents } from '@kubb/core'
45
- *
46
- * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
47
- *
48
- * events.on('lifecycle:start', () => {
49
- * console.log('Starting Kubb generation')
50
- * })
51
- *
52
- * events.on('plugin:end', (plugin, { duration }) => {
53
- * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
54
- * })
55
- * ```
56
- */
57
- interface KubbEvents {
58
- /**
59
- * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
60
- */
61
- 'lifecycle:start': [version: string];
62
- /**
63
- * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
64
- */
65
- 'lifecycle:end': [];
66
- /**
67
- * Emitted when configuration loading starts.
68
- */
69
- 'config:start': [];
70
- /**
71
- * Emitted when configuration loading is complete.
72
- */
73
- 'config:end': [configs: Array<Config>];
74
- /**
75
- * Emitted when code generation phase starts.
76
- */
77
- 'generation:start': [config: Config];
78
- /**
79
- * Emitted when code generation phase completes.
80
- */
81
- 'generation:end': [Config: Config];
82
- /**
83
- * Emitted with a summary of the generation results.
84
- * Contains summary lines, title, and success status.
85
- */
86
- 'generation:summary': [Config: Config, {
87
- failedPlugins: Set<{
88
- plugin: Plugin;
89
- error: Error;
90
- }>;
91
- status: 'success' | 'failed';
92
- hrStart: [number, number];
93
- filesCreated: number;
94
- pluginTimings?: Map<string, number>;
95
- }];
96
- /**
97
- * Emitted when code formatting starts (e.g., running Biome or Prettier).
98
- */
99
- 'format:start': [];
100
- /**
101
- * Emitted when code formatting completes.
102
- */
103
- 'format:end': [];
104
- /**
105
- * Emitted when linting starts.
106
- */
107
- 'lint:start': [];
108
- /**
109
- * Emitted when linting completes.
110
- */
111
- 'lint:end': [];
112
- /**
113
- * Emitted when plugin hooks execution starts.
114
- */
115
- 'hooks:start': [];
116
- /**
117
- * Emitted when plugin hooks execution completes.
118
- */
119
- 'hooks:end': [];
120
- /**
121
- * Emitted when a single hook execution starts. (e.g., format or lint).
122
- * The callback should be invoked when the command completes.
123
- */
124
- 'hook:start': [{
125
- id?: string;
126
- command: string;
127
- args?: readonly string[];
128
- }];
129
- /**
130
- * Emitted when a single hook execution completes.
131
- */
132
- 'hook:end': [{
133
- id?: string;
134
- command: string;
135
- args?: readonly string[];
136
- success: boolean;
137
- error: Error | null;
138
- }];
139
- /**
140
- * Emitted when a new version of Kubb is available.
141
- */
142
- 'version:new': [currentVersion: string, latestVersion: string];
143
- /**
144
- * Informational message event.
145
- */
146
- info: [message: string, info?: string];
147
- /**
148
- * Error event. Emitted when an error occurs during code generation.
149
- */
150
- error: [error: Error, meta?: Record<string, unknown>];
151
- /**
152
- * Success message event.
153
- */
154
- success: [message: string, info?: string];
155
- /**
156
- * Warning message event.
157
- */
158
- warn: [message: string, info?: string];
159
- /**
160
- * Debug event for detailed logging.
161
- * Contains timestamp, log messages, and optional filename.
162
- */
163
- debug: [meta: DebugEvent];
164
- /**
165
- * Emitted when file processing starts.
166
- * Contains the list of files to be processed.
167
- */
168
- 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
169
- /**
170
- * Emitted for each file being processed, providing progress updates.
171
- * Contains processed count, total count, percentage, and file details.
172
- */
173
- 'file:processing:update': [{
174
- /** Number of files processed so far */
175
- processed: number;
176
- /** Total number of files to process */
177
- total: number;
178
- /** Processing percentage (0-100) */
179
- percentage: number;
180
- /** Optional source identifier */
181
- source?: string;
182
- /** The file being processed */
183
- file: KubbFile.ResolvedFile;
184
- /**
185
- * Kubb configuration (not present in Fabric).
186
- * Provides access to the current config during file processing.
187
- */
188
- config: Config;
189
- }];
190
- /**
191
- * Emitted when file processing completes.
192
- * Contains the list of processed files.
193
- */
194
- 'files:processing:end': [files: KubbFile.ResolvedFile[]];
195
- /**
196
- * Emitted when a plugin starts executing.
197
- */
198
- 'plugin:start': [plugin: Plugin];
199
- /**
200
- * Emitted when a plugin completes execution.
201
- * Duration in ms
202
- */
203
- 'plugin:end': [plugin: Plugin, meta: {
204
- duration: number;
205
- success: boolean;
206
- error?: Error;
207
- }];
208
- /**
209
- * Emitted when plugin hook progress tracking starts.
210
- * Contains the hook name and list of plugins to execute.
211
- */
212
- 'plugins:hook:progress:start': [meta: ProgressStartMeta];
213
- /**
214
- * Emitted when plugin hook progress tracking ends.
215
- * Contains the hook name that completed.
216
- */
217
- 'plugins:hook:progress:end': [meta: ProgressStopMeta];
218
- /**
219
- * Emitted when a plugin hook starts processing.
220
- * Contains strategy, hook name, plugin, parameters, and output.
221
- */
222
- 'plugins:hook:processing:start': [meta: ExecutingMeta];
223
- /**
224
- * Emitted when a plugin hook completes processing.
225
- * Contains duration, strategy, hook name, plugin, parameters, and output.
226
- */
227
- 'plugins:hook:processing:end': [meta: ExecutedMeta];
228
- }
229
- //#endregion
230
- //#region ../core/src/utils/AsyncEventEmitter.d.ts
231
- declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
232
- #private;
233
- constructor(maxListener?: number);
234
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
235
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
236
- onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
237
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
238
- removeAll(): void;
239
- }
240
- //#endregion
241
- //#region ../core/src/utils/types.d.ts
242
- type PossiblePromise<T> = Promise<T> | T;
243
- //#endregion
244
- //#region ../core/src/types.d.ts
245
- declare global {
246
- namespace Kubb {
247
- interface PluginContext {}
248
- }
249
- }
250
- /**
251
- * Config used in `kubb.config.ts`
252
- *
253
- * @example
254
- * import { defineConfig } from '@kubb/core'
255
- * export default defineConfig({
256
- * ...
257
- * })
258
- */
259
-
260
- type InputPath = {
261
- /**
262
- * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.
263
- */
264
- path: string;
265
- };
266
- type InputData = {
267
- /**
268
- * A `string` or `object` that contains your Swagger/OpenAPI data.
269
- */
270
- data: string | unknown;
271
- };
272
- type Input = InputPath | InputData | Array<InputPath>;
273
- type BarrelType = 'all' | 'named' | 'propagate';
274
- /**
275
- * @private
276
- */
277
- type Config<TInput = Input> = {
278
- /**
279
- * The name to display in the CLI output.
280
- */
281
- name?: string;
282
- /**
283
- * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.
284
- * @default process.cwd()
285
- */
286
- root: string;
287
- /**
288
- * You can use either `input.path` or `input.data`, depending on your specific needs.
289
- */
290
- input: TInput;
291
- output: {
292
- /**
293
- * The path where all generated files receives exported.
294
- * This can be an absolute path or a path relative to the specified root option.
295
- */
296
- path: string;
297
- /**
298
- * Clean the output directory before each build.
299
- */
300
- clean?: boolean;
301
- /**
302
- * Save files to the file system.
303
- * @default true
304
- */
305
- write?: boolean;
306
- /**
307
- * Specifies the formatting tool to be used.
308
- * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
309
- * - 'prettier' uses Prettier for code formatting.
310
- * - 'biome' uses Biome for code formatting.
311
- * - 'oxfmt' uses Oxfmt for code formatting.
312
- * - false disables code formatting.
313
- * @default 'prettier'
314
- */
315
- format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
316
- /**
317
- * Specifies the linter that should be used to analyze the code.
318
- * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
319
- * - 'eslint' uses ESLint for linting.
320
- * - 'biome' uses Biome for linting.
321
- * - 'oxlint' uses Oxlint for linting.
322
- * - false disables linting.
323
- * @default 'auto'
324
- */
325
- lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
326
- /**
327
- * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
328
- * @default { '.ts': '.ts'}
329
- */
330
- extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
331
- /**
332
- * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
333
- * @default 'named'
334
- */
335
- barrelType?: Exclude<BarrelType, 'propagate'> | false;
336
- /**
337
- * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
338
- * - 'simple' adds banner with link to Kubb.
339
- * - 'full' adds source, title, description, and OpenAPI version.
340
- * - false disables banner generation.
341
- * @default 'simple'
342
- */
343
- defaultBanner?: 'simple' | 'full' | false;
344
- /**
345
- * Whether to override existing external files if they already exist.
346
- * When setting the option in the global configuration, all plugins inherit the same behavior by default.
347
- * However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.
348
- * @default false
349
- */
350
- override?: boolean;
351
- };
352
- /**
353
- * An array of Kubb plugins that used in the generation.
354
- * Each plugin may include additional configurable options(defined in the plugin itself).
355
- * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
356
- */
357
- plugins?: Array<Plugin>;
358
- /**
359
- * Hooks triggered when a specific action occurs in Kubb.
360
- */
361
- hooks?: {
362
- /**
363
- * Hook that triggers at the end of all executions.
364
- * Useful for running Prettier or ESLint to format/lint your code.
365
- */
366
- done?: string | Array<string>;
367
- };
368
- };
369
- type PluginFactoryOptions<
370
- /**
371
- * Name to be used for the plugin, this will also be used for they key.
372
- */
373
- TName extends string = string,
374
- /**
375
- * Options of the plugin.
376
- */
377
- TOptions extends object = object,
378
- /**
379
- * Options of the plugin that can be used later on, see `options` inside your plugin config.
380
- */
381
- TResolvedOptions extends object = TOptions,
382
- /**
383
- * Context that you want to expose to other plugins.
384
- */
385
- TContext = any,
386
- /**
387
- * When calling `resolvePath` you can specify better types.
388
- */
389
- TResolvePathOptions extends object = object> = {
390
- name: TName;
391
- /**
392
- * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
393
- */
394
- key: PluginKey<TName | string>;
395
- options: TOptions;
396
- resolvedOptions: TResolvedOptions;
397
- context: TContext;
398
- resolvePathOptions: TResolvePathOptions;
399
- };
400
- type PluginKey<TName> = [name: TName, identifier?: string | number];
401
- type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
402
- /**
403
- * Unique name used for the plugin
404
- * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
405
- * @example @kubb/typescript
406
- */
407
- name: TOptions['name'];
408
- /**
409
- * Options set for a specific plugin(see kubb.config.js), passthrough of options.
410
- */
411
- options: TOptions['resolvedOptions'];
412
- /**
413
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
414
- * Can be used to validate dependent plugins.
415
- */
416
- pre?: Array<string>;
417
- /**
418
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
419
- */
420
- post?: Array<string>;
421
- inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
422
- };
423
- type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
424
- type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
425
- /**
426
- * Unique name used for the plugin
427
- * @example @kubb/typescript
428
- */
429
- name: TOptions['name'];
430
- /**
431
- * Internal key used when a developer uses more than one of the same plugin
432
- * @private
433
- */
434
- key: TOptions['key'];
435
- /**
436
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
437
- * Can be used to validate dependent plugins.
438
- */
439
- pre?: Array<string>;
440
- /**
441
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
442
- */
443
- post?: Array<string>;
444
- /**
445
- * Options set for a specific plugin(see kubb.config.js), passthrough of options.
446
- */
447
- options: TOptions['resolvedOptions'];
448
- install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
449
- /**
450
- * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
451
- */
452
- inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
453
- };
454
- type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
455
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
456
- /**
457
- * Start of the lifecycle of a plugin.
458
- * @type hookParallel
459
- */
460
- install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
461
- /**
462
- * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
463
- * Options can als be included.
464
- * @type hookFirst
465
- * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
466
- */
467
- resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
468
- /**
469
- * Resolve to a name based on a string.
470
- * Useful when converting to PascalCase or camelCase.
471
- * @type hookFirst
472
- * @example ('pet') => 'Pet'
473
- */
474
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
475
- };
476
- type PluginLifecycleHooks = keyof PluginLifecycle;
477
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
478
- type ResolvePathParams<TOptions = object> = {
479
- pluginKey?: Plugin['key'];
480
- baseName: KubbFile.BaseName;
481
- mode?: KubbFile.Mode;
482
- /**
483
- * Options to be passed to 'resolvePath' 3th parameter
484
- */
485
- options?: TOptions;
486
- };
487
- type ResolveNameParams = {
488
- name: string;
489
- pluginKey?: Plugin['key'];
490
- /**
491
- * Specifies the type of entity being named.
492
- * - 'file' customizes the name of the created file (uses camelCase).
493
- * - 'function' customizes the exported function names (uses camelCase).
494
- * - 'type' customizes TypeScript types (uses PascalCase).
495
- * - 'const' customizes variable names (uses camelCase).
496
- * @default undefined
497
- */
498
- type?: 'file' | 'function' | 'type' | 'const';
499
- };
500
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
501
- fabric: Fabric;
502
- config: Config;
503
- pluginManager: PluginManager;
504
- /**
505
- * Only add when the file does not exist yet
506
- */
507
- addFile: (...file: Array<KubbFile.File>) => Promise<void>;
508
- /**
509
- * merging multiple sources into the same output file
510
- */
511
- upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
512
- events: AsyncEventEmitter<KubbEvents>;
513
- mode: KubbFile.Mode;
514
- /**
515
- * Current plugin
516
- */
517
- plugin: Plugin<TOptions>;
518
- } & Kubb.PluginContext;
519
- /**
520
- * Specify the export location for the files and define the behavior of the output
521
- */
522
- type Output<TOptions> = {
523
- /**
524
- * Path to the output folder or file that will contain the generated code
525
- */
526
- path: string;
527
- /**
528
- * Define what needs to be exported, here you can also disable the export of barrel files
529
- * @default 'named'
530
- */
531
- barrelType?: BarrelType | false;
532
- /**
533
- * Add a banner text in the beginning of every file
534
- */
535
- banner?: string | ((options: TOptions) => string);
536
- /**
537
- * Add a footer text in the beginning of every file
538
- */
539
- footer?: string | ((options: TOptions) => string);
540
- /**
541
- * Whether to override existing external files if they already exist.
542
- * @default false
543
- */
544
- override?: boolean;
545
- };
546
- //#endregion
547
- //#region ../core/src/PluginManager.d.ts
548
- type RequiredPluginLifecycle = Required<PluginLifecycle>;
549
- type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
550
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
551
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
552
- result: Result;
553
- plugin: Plugin;
554
- };
555
- type Options$1 = {
556
- fabric: Fabric;
557
- events: AsyncEventEmitter<KubbEvents>;
558
- /**
559
- * @default Number.POSITIVE_INFINITY
560
- */
561
- concurrency?: number;
562
- };
563
- type GetFileProps<TOptions = object> = {
564
- name: string;
565
- mode?: KubbFile.Mode;
566
- extname: KubbFile.Extname;
567
- pluginKey: Plugin['key'];
568
- options?: TOptions;
569
- };
570
- declare class PluginManager {
571
- #private;
572
- readonly config: Config;
573
- readonly options: Options$1;
574
- constructor(config: Config, options: Options$1);
575
- get events(): AsyncEventEmitter<KubbEvents>;
576
- getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
577
- get plugins(): Array<Plugin>;
578
- getFile<TOptions = object>({
579
- name,
580
- mode,
581
- extname,
582
- pluginKey,
583
- options
584
- }: GetFileProps<TOptions>): KubbFile.File<{
585
- pluginKey: Plugin['key'];
586
- }>;
587
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
588
- resolveName: (params: ResolveNameParams) => string;
589
- /**
590
- * Run a specific hookName for plugin x.
591
- */
592
- hookForPlugin<H extends PluginLifecycleHooks>({
593
- pluginKey,
594
- hookName,
595
- parameters
596
- }: {
597
- pluginKey: Plugin['key'];
598
- hookName: H;
599
- parameters: PluginParameter<H>;
600
- }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
601
- /**
602
- * Run a specific hookName for plugin x.
603
- */
604
- hookForPluginSync<H extends PluginLifecycleHooks>({
605
- pluginKey,
606
- hookName,
607
- parameters
608
- }: {
609
- pluginKey: Plugin['key'];
610
- hookName: H;
611
- parameters: PluginParameter<H>;
612
- }): Array<ReturnType<ParseResult<H>>> | null;
613
- /**
614
- * Returns the first non-null result.
615
- */
616
- hookFirst<H extends PluginLifecycleHooks>({
617
- hookName,
618
- parameters,
619
- skipped
620
- }: {
621
- hookName: H;
622
- parameters: PluginParameter<H>;
623
- skipped?: ReadonlySet<Plugin> | null;
624
- }): Promise<SafeParseResult<H>>;
625
- /**
626
- * Returns the first non-null result.
627
- */
628
- hookFirstSync<H extends PluginLifecycleHooks>({
629
- hookName,
630
- parameters,
631
- skipped
632
- }: {
633
- hookName: H;
634
- parameters: PluginParameter<H>;
635
- skipped?: ReadonlySet<Plugin> | null;
636
- }): SafeParseResult<H>;
637
- /**
638
- * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
639
- */
640
- hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
641
- hookName,
642
- parameters
643
- }: {
644
- hookName: H;
645
- parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
646
- }): Promise<Awaited<TOutput>[]>;
647
- /**
648
- * Chains plugins
649
- */
650
- hookSeq<H extends PluginLifecycleHooks>({
651
- hookName,
652
- parameters
653
- }: {
654
- hookName: H;
655
- parameters?: PluginParameter<H>;
656
- }): Promise<void>;
657
- getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
658
- getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
659
- }
660
- //#endregion
661
9
  //#region ../oas/src/types.d.ts
662
10
  type contentType = 'application/json' | (string & {});
663
11
  type SchemaObject$1 = SchemaObject & {
@@ -725,7 +73,7 @@ type PluginRedoc = PluginFactoryOptions<'plugin-redoc', Options, ResolveOptions,
725
73
  //#endregion
726
74
  //#region src/plugin.d.ts
727
75
  declare const pluginRedocName = "plugin-redoc";
728
- declare const pluginRedoc: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginRedoc>;
76
+ declare const pluginRedoc: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginRedoc>;
729
77
  //#endregion
730
78
  export { type PluginRedoc, pluginRedoc, pluginRedocName };
731
79
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-redoc",
3
- "version": "4.20.3",
3
+ "version": "4.20.5",
4
4
  "description": "Redoc documentation generator plugin for Kubb, creating beautiful, interactive API documentation from OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "redoc",
@@ -52,14 +52,14 @@
52
52
  }
53
53
  ],
54
54
  "dependencies": {
55
- "@kubb/react-fabric": "0.12.9",
55
+ "@kubb/react-fabric": "0.12.10",
56
56
  "handlebars": "^4.7.8",
57
- "@kubb/core": "4.20.3",
58
- "@kubb/oas": "4.20.3",
59
- "@kubb/plugin-oas": "4.20.3"
57
+ "@kubb/core": "4.20.5",
58
+ "@kubb/oas": "4.20.5",
59
+ "@kubb/plugin-oas": "4.20.5"
60
60
  },
61
61
  "peerDependencies": {
62
- "@kubb/react-fabric": "0.12.9"
62
+ "@kubb/react-fabric": "0.12.10"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=20"