@kubb/plugin-redoc 4.1.3 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,29 +1,29 @@
1
1
  <div align="center">
2
+ <h1>Plugin Redoc</h1>
3
+ <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
+ <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
5
+ </a>
2
6
 
3
- <!-- <img src="assets/logo.png" alt="logo" width="200" height="auto" /> -->
4
- <h1>@kubb/plugin-redoc</h1>
5
-
6
- <p>
7
- Create beautiful docs with Redoc.
8
- </p>
9
- <img src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/banner.png" alt="logo" height="auto" />
10
7
 
11
8
  [![npm version][npm-version-src]][npm-version-href]
12
9
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
13
10
  [![Coverage][coverage-src]][coverage-href]
14
11
  [![License][license-src]][license-href]
15
-
12
+ [![Sponsors][sponsors-src]][sponsors-href]
16
13
  <h4>
17
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
18
- <span> · </span>
19
- <a href="https://kubb.dev/" target="_blank">Documentation</a>
20
- <span> · </span>
21
- <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
22
- <span> · </span>
23
- <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
24
- </h4>
14
+ <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
15
+ <span> · </span>
16
+ <a href="https://kubb.dev/" target="_blank">Documentation</a>
17
+ <span> · </span>
18
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
19
+ <span> · </span>
20
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
21
+ </h4>
25
22
  </div>
26
23
 
24
+ Create beautiful docs with Redoc.
25
+
26
+
27
27
  ## Supporting Kubb
28
28
 
29
29
  Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
@@ -51,3 +51,5 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
51
51
  [minified-href]: https://www.npmjs.com/package/@kubb/plugin-redoc
52
52
  [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
53
53
  [coverage-href]: https://www.npmjs.com/package/@kubb/plugin-redoc
54
+ [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
55
+ [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
package/dist/index.d.cts CHANGED
@@ -7,7 +7,7 @@ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
7
  import BaseOas from "oas";
8
8
 
9
9
  //#region ../core/src/fs/types.d.ts
10
- type BasePath<T extends string = string> = `${T}/`;
10
+ type BasePath<T$1 extends string = string> = `${T$1}/`;
11
11
  type Import = {
12
12
  /**
13
13
  * Import name to be used
@@ -81,7 +81,7 @@ type BaseName = `${string}.${string}`;
81
81
  * Path will be full qualified path to a specified file
82
82
  */
83
83
  type Path = string;
84
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
84
+ type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
85
85
  type OptionalPath = Path | undefined | null;
86
86
  type File<TMeta extends object = object> = {
87
87
  /**
@@ -170,9 +170,9 @@ type Logger = {
170
170
  };
171
171
  //#endregion
172
172
  //#region ../core/src/utils/types.d.ts
173
- type PossiblePromise<T> = Promise<T> | T;
174
- type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
175
- type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
173
+ type PossiblePromise<T$1> = Promise<T$1> | T$1;
174
+ type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
175
+ type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
176
176
  //#endregion
177
177
  //#region ../core/src/types.d.ts
178
178
  type InputPath = {
@@ -285,11 +285,11 @@ TName extends string = string,
285
285
  /**
286
286
  * Options of the plugin.
287
287
  */
288
- TOptions extends object = object,
288
+ TOptions$1 extends object = object,
289
289
  /**
290
290
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
291
291
  */
292
- TResolvedOptions extends object = TOptions,
292
+ TResolvedOptions extends object = TOptions$1,
293
293
  /**
294
294
  * Context that you want to expose to other plugins.
295
295
  */
@@ -303,23 +303,23 @@ TResolvePathOptions extends object = object> = {
303
303
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
304
304
  */
305
305
  key: PluginKey<TName | string>;
306
- options: TOptions;
306
+ options: TOptions$1;
307
307
  resolvedOptions: TResolvedOptions;
308
308
  context: TContext;
309
309
  resolvePathOptions: TResolvePathOptions;
310
310
  };
311
311
  type PluginKey<TName> = [name: TName, identifier?: string | number];
312
- type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
312
+ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
313
313
  /**
314
314
  * Unique name used for the plugin
315
315
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
316
316
  * @example @kubb/typescript
317
317
  */
318
- name: TOptions['name'];
318
+ name: TOptions$1['name'];
319
319
  /**
320
320
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
321
321
  */
322
- options: TOptions['resolvedOptions'];
322
+ options: TOptions$1['resolvedOptions'];
323
323
  /**
324
324
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
325
325
  * Can be used to validate dependent plugins.
@@ -329,23 +329,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
329
329
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
330
330
  */
331
331
  post?: Array<string>;
332
- } & (TOptions['context'] extends never ? {
332
+ } & (TOptions$1['context'] extends never ? {
333
333
  context?: never;
334
334
  } : {
335
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
335
+ context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
336
336
  });
337
- type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
338
- type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
337
+ type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
338
+ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
339
339
  /**
340
340
  * Unique name used for the plugin
341
341
  * @example @kubb/typescript
342
342
  */
343
- name: TOptions['name'];
343
+ name: TOptions$1['name'];
344
344
  /**
345
345
  * Internal key used when a developer uses more than one of the same plugin
346
346
  * @private
347
347
  */
348
- key: TOptions['key'];
348
+ key: TOptions$1['key'];
349
349
  /**
350
350
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
351
351
  * Can be used to validate dependent plugins.
@@ -358,49 +358,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
358
358
  /**
359
359
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
360
360
  */
361
- options: TOptions['resolvedOptions'];
362
- } & (TOptions['context'] extends never ? {
361
+ options: TOptions$1['resolvedOptions'];
362
+ } & (TOptions$1['context'] extends never ? {
363
363
  context?: never;
364
364
  } : {
365
- context: TOptions['context'];
365
+ context: TOptions$1['context'];
366
366
  });
367
- type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
368
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
367
+ type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
368
+ type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
369
369
  /**
370
370
  * Start of the lifecycle of a plugin.
371
371
  * @type hookParallel
372
372
  */
373
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
373
+ buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
374
374
  /**
375
375
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
376
376
  * Options can als be included.
377
377
  * @type hookFirst
378
378
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
379
379
  */
380
- resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
380
+ resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
381
381
  /**
382
382
  * Resolve to a name based on a string.
383
383
  * Useful when converting to PascalCase or camelCase.
384
384
  * @type hookFirst
385
385
  * @example ('pet') => 'Pet'
386
386
  */
387
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
387
+ resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
388
388
  /**
389
389
  * End of the plugin lifecycle.
390
390
  * @type hookParallel
391
391
  */
392
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
392
+ buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
393
393
  };
394
394
  type PluginLifecycleHooks = keyof PluginLifecycle;
395
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
396
- type ResolvePathParams<TOptions = object> = {
395
+ type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
396
+ type ResolvePathParams<TOptions$1 = object> = {
397
397
  pluginKey?: Plugin['key'];
398
398
  baseName: BaseName;
399
399
  mode?: Mode;
400
400
  /**
401
401
  * Options to be passed to 'resolvePath' 3th parameter
402
402
  */
403
- options?: TOptions;
403
+ options?: TOptions$1;
404
404
  };
405
405
  type ResolveNameParams = {
406
406
  name: string;
@@ -413,12 +413,12 @@ type ResolveNameParams = {
413
413
  */
414
414
  type?: 'file' | 'function' | 'type' | 'const';
415
415
  };
416
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
416
+ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
417
417
  config: Config;
418
418
  fileManager: FileManager;
419
419
  pluginManager: PluginManager;
420
420
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
421
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
421
+ resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
422
422
  resolveName: (params: ResolveNameParams) => string;
423
423
  logger: Logger;
424
424
  /**
@@ -428,12 +428,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
428
428
  /**
429
429
  * Current plugin
430
430
  */
431
- plugin: Plugin<TOptions>;
431
+ plugin: Plugin<TOptions$1>;
432
432
  };
433
433
  /**
434
434
  * Specify the export location for the files and define the behavior of the output
435
435
  */
436
- type Output<TOptions> = {
436
+ type Output<TOptions$1> = {
437
437
  /**
438
438
  * Path to the output folder or file that will contain the generated code
439
439
  */
@@ -446,18 +446,18 @@ type Output<TOptions> = {
446
446
  /**
447
447
  * Add a banner text in the beginning of every file
448
448
  */
449
- banner?: string | ((options: TOptions) => string);
449
+ banner?: string | ((options: TOptions$1) => string);
450
450
  /**
451
451
  * Add a footer text in the beginning of every file
452
452
  */
453
- footer?: string | ((options: TOptions) => string);
453
+ footer?: string | ((options: TOptions$1) => string);
454
454
  };
455
455
  //#endregion
456
456
  //#region ../core/src/FileManager.d.ts
457
457
  type FileMetaBase = {
458
458
  pluginKey?: Plugin['key'];
459
459
  };
460
- type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
460
+ type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
461
461
  type AddIndexesProps = {
462
462
  type: BarrelType | false | undefined;
463
463
  /**
@@ -510,16 +510,16 @@ declare class FileManager {
510
510
  //#region ../core/src/PluginManager.d.ts
511
511
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
512
512
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
513
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
513
+ type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
514
514
  message: string;
515
515
  strategy: Strategy;
516
- hookName: H;
516
+ hookName: H$1;
517
517
  plugin: Plugin;
518
518
  parameters?: unknown[] | undefined;
519
519
  output?: unknown;
520
520
  };
521
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
522
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
521
+ type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
522
+ type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
523
523
  result: Result;
524
524
  plugin: Plugin;
525
525
  };
@@ -535,12 +535,12 @@ type Events = {
535
535
  executed: [executer: Executer];
536
536
  error: [error: Error];
537
537
  };
538
- type GetFileProps<TOptions = object> = {
538
+ type GetFileProps<TOptions$1 = object> = {
539
539
  name: string;
540
540
  mode?: Mode;
541
541
  extname: Extname;
542
542
  pluginKey: Plugin['key'];
543
- options?: TOptions;
543
+ options?: TOptions$1;
544
544
  };
545
545
  declare class PluginManager {
546
546
  #private;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
7
  import BaseOas from "oas";
8
8
 
9
9
  //#region ../core/src/fs/types.d.ts
10
- type BasePath<T extends string = string> = `${T}/`;
10
+ type BasePath<T$1 extends string = string> = `${T$1}/`;
11
11
  type Import = {
12
12
  /**
13
13
  * Import name to be used
@@ -81,7 +81,7 @@ type BaseName = `${string}.${string}`;
81
81
  * Path will be full qualified path to a specified file
82
82
  */
83
83
  type Path = string;
84
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
84
+ type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
85
85
  type OptionalPath = Path | undefined | null;
86
86
  type File<TMeta extends object = object> = {
87
87
  /**
@@ -170,9 +170,9 @@ type Logger = {
170
170
  };
171
171
  //#endregion
172
172
  //#region ../core/src/utils/types.d.ts
173
- type PossiblePromise<T> = Promise<T> | T;
174
- type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
175
- type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
173
+ type PossiblePromise<T$1> = Promise<T$1> | T$1;
174
+ type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
175
+ type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
176
176
  //#endregion
177
177
  //#region ../core/src/types.d.ts
178
178
  type InputPath = {
@@ -285,11 +285,11 @@ TName extends string = string,
285
285
  /**
286
286
  * Options of the plugin.
287
287
  */
288
- TOptions extends object = object,
288
+ TOptions$1 extends object = object,
289
289
  /**
290
290
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
291
291
  */
292
- TResolvedOptions extends object = TOptions,
292
+ TResolvedOptions extends object = TOptions$1,
293
293
  /**
294
294
  * Context that you want to expose to other plugins.
295
295
  */
@@ -303,23 +303,23 @@ TResolvePathOptions extends object = object> = {
303
303
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
304
304
  */
305
305
  key: PluginKey<TName | string>;
306
- options: TOptions;
306
+ options: TOptions$1;
307
307
  resolvedOptions: TResolvedOptions;
308
308
  context: TContext;
309
309
  resolvePathOptions: TResolvePathOptions;
310
310
  };
311
311
  type PluginKey<TName> = [name: TName, identifier?: string | number];
312
- type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
312
+ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
313
313
  /**
314
314
  * Unique name used for the plugin
315
315
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
316
316
  * @example @kubb/typescript
317
317
  */
318
- name: TOptions['name'];
318
+ name: TOptions$1['name'];
319
319
  /**
320
320
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
321
321
  */
322
- options: TOptions['resolvedOptions'];
322
+ options: TOptions$1['resolvedOptions'];
323
323
  /**
324
324
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
325
325
  * Can be used to validate dependent plugins.
@@ -329,23 +329,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
329
329
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
330
330
  */
331
331
  post?: Array<string>;
332
- } & (TOptions['context'] extends never ? {
332
+ } & (TOptions$1['context'] extends never ? {
333
333
  context?: never;
334
334
  } : {
335
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
335
+ context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
336
336
  });
337
- type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
338
- type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
337
+ type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
338
+ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
339
339
  /**
340
340
  * Unique name used for the plugin
341
341
  * @example @kubb/typescript
342
342
  */
343
- name: TOptions['name'];
343
+ name: TOptions$1['name'];
344
344
  /**
345
345
  * Internal key used when a developer uses more than one of the same plugin
346
346
  * @private
347
347
  */
348
- key: TOptions['key'];
348
+ key: TOptions$1['key'];
349
349
  /**
350
350
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
351
351
  * Can be used to validate dependent plugins.
@@ -358,49 +358,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
358
358
  /**
359
359
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
360
360
  */
361
- options: TOptions['resolvedOptions'];
362
- } & (TOptions['context'] extends never ? {
361
+ options: TOptions$1['resolvedOptions'];
362
+ } & (TOptions$1['context'] extends never ? {
363
363
  context?: never;
364
364
  } : {
365
- context: TOptions['context'];
365
+ context: TOptions$1['context'];
366
366
  });
367
- type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
368
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
367
+ type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
368
+ type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
369
369
  /**
370
370
  * Start of the lifecycle of a plugin.
371
371
  * @type hookParallel
372
372
  */
373
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
373
+ buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
374
374
  /**
375
375
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
376
376
  * Options can als be included.
377
377
  * @type hookFirst
378
378
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
379
379
  */
380
- resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
380
+ resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
381
381
  /**
382
382
  * Resolve to a name based on a string.
383
383
  * Useful when converting to PascalCase or camelCase.
384
384
  * @type hookFirst
385
385
  * @example ('pet') => 'Pet'
386
386
  */
387
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
387
+ resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
388
388
  /**
389
389
  * End of the plugin lifecycle.
390
390
  * @type hookParallel
391
391
  */
392
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
392
+ buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
393
393
  };
394
394
  type PluginLifecycleHooks = keyof PluginLifecycle;
395
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
396
- type ResolvePathParams<TOptions = object> = {
395
+ type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
396
+ type ResolvePathParams<TOptions$1 = object> = {
397
397
  pluginKey?: Plugin['key'];
398
398
  baseName: BaseName;
399
399
  mode?: Mode;
400
400
  /**
401
401
  * Options to be passed to 'resolvePath' 3th parameter
402
402
  */
403
- options?: TOptions;
403
+ options?: TOptions$1;
404
404
  };
405
405
  type ResolveNameParams = {
406
406
  name: string;
@@ -413,12 +413,12 @@ type ResolveNameParams = {
413
413
  */
414
414
  type?: 'file' | 'function' | 'type' | 'const';
415
415
  };
416
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
416
+ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
417
417
  config: Config;
418
418
  fileManager: FileManager;
419
419
  pluginManager: PluginManager;
420
420
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
421
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
421
+ resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
422
422
  resolveName: (params: ResolveNameParams) => string;
423
423
  logger: Logger;
424
424
  /**
@@ -428,12 +428,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
428
428
  /**
429
429
  * Current plugin
430
430
  */
431
- plugin: Plugin<TOptions>;
431
+ plugin: Plugin<TOptions$1>;
432
432
  };
433
433
  /**
434
434
  * Specify the export location for the files and define the behavior of the output
435
435
  */
436
- type Output<TOptions> = {
436
+ type Output<TOptions$1> = {
437
437
  /**
438
438
  * Path to the output folder or file that will contain the generated code
439
439
  */
@@ -446,18 +446,18 @@ type Output<TOptions> = {
446
446
  /**
447
447
  * Add a banner text in the beginning of every file
448
448
  */
449
- banner?: string | ((options: TOptions) => string);
449
+ banner?: string | ((options: TOptions$1) => string);
450
450
  /**
451
451
  * Add a footer text in the beginning of every file
452
452
  */
453
- footer?: string | ((options: TOptions) => string);
453
+ footer?: string | ((options: TOptions$1) => string);
454
454
  };
455
455
  //#endregion
456
456
  //#region ../core/src/FileManager.d.ts
457
457
  type FileMetaBase = {
458
458
  pluginKey?: Plugin['key'];
459
459
  };
460
- type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
460
+ type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
461
461
  type AddIndexesProps = {
462
462
  type: BarrelType | false | undefined;
463
463
  /**
@@ -510,16 +510,16 @@ declare class FileManager {
510
510
  //#region ../core/src/PluginManager.d.ts
511
511
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
512
512
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
513
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
513
+ type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
514
514
  message: string;
515
515
  strategy: Strategy;
516
- hookName: H;
516
+ hookName: H$1;
517
517
  plugin: Plugin;
518
518
  parameters?: unknown[] | undefined;
519
519
  output?: unknown;
520
520
  };
521
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
522
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
521
+ type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
522
+ type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
523
523
  result: Result;
524
524
  plugin: Plugin;
525
525
  };
@@ -535,12 +535,12 @@ type Events = {
535
535
  executed: [executer: Executer];
536
536
  error: [error: Error];
537
537
  };
538
- type GetFileProps<TOptions = object> = {
538
+ type GetFileProps<TOptions$1 = object> = {
539
539
  name: string;
540
540
  mode?: Mode;
541
541
  extname: Extname;
542
542
  pluginKey: Plugin['key'];
543
- options?: TOptions;
543
+ options?: TOptions$1;
544
544
  };
545
545
  declare class PluginManager {
546
546
  #private;
package/dist/index.js CHANGED
@@ -13,9 +13,9 @@ var __esm = (fn, res) => function() {
13
13
  };
14
14
 
15
15
  //#endregion
16
- //#region ../../node_modules/.pnpm/tsdown@0.15.7_typescript@5.9.3/node_modules/tsdown/esm-shims.js
16
+ //#region ../../node_modules/.pnpm/tsdown@0.15.9_typescript@5.9.3/node_modules/tsdown/esm-shims.js
17
17
  var getFilename, getDirname, __dirname;
18
- var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.7_typescript@5.9.3/node_modules/tsdown/esm-shims.js": (() => {
18
+ var init_esm_shims = __esm({ "../../node_modules/.pnpm/tsdown@0.15.9_typescript@5.9.3/node_modules/tsdown/esm-shims.js": (() => {
19
19
  getFilename = () => fileURLToPath(import.meta.url);
20
20
  getDirname = () => path.dirname(getFilename());
21
21
  __dirname = /* @__PURE__ */ getDirname();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../node_modules/.pnpm/tsdown@0.15.7_typescript@5.9.3/node_modules/tsdown/esm-shims.js","../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\n\ntype BuildDocsOptions = {\n title?: string\n disableGoogleFont?: boolean\n templateOptions?: any\n}\n\nexport async function getPageHTML(api: OasTypes.OASDocument, { title, disableGoogleFont, templateOptions }: BuildDocsOptions = {}) {\n const templateFileName = path.join(__dirname, '../static/redoc.hbs')\n const template = pkg.compile(fs.readFileSync(templateFileName).toString())\n return template({\n title: title || api.info.title || 'ReDoc documentation',\n redocHTML: `\n <script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"> </script>\n <div id=\"redoc-container\"></div>\n <script>\n const data = ${JSON.stringify(api, null, 2)};\n Redoc.init(data, {\n \"expandResponses\": \"200,400\"\n }, document.getElementById('redoc-container'))\n </script>\n `,\n disableGoogleFont,\n templateOptions,\n })\n}\n","import path from 'node:path'\n\nimport { PluginManager, createPlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport { trimExtName, write } from '@kubb/core/fs'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = createPlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n options: {\n output,\n name: trimExtName(output.path),\n },\n pre: [pluginOasName],\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n const oas = await swaggerPlugin.context.getOas()\n\n await oas.dereference()\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(oas.api)\n\n await write(path.resolve(root, output.path || './docs.html'), pageHTML)\n },\n }\n})\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;CAIM,oBAAoB,cAAc,OAAO,KAAK,IAAI;CAClD,mBAAmB,KAAK,QAAQ,aAAa,CAAC;CAEvC,YAA4B,4BAAY;;;;;;ACIrD,eAAsB,YAAY,KAA2B,EAAE,OAAO,mBAAmB,oBAAsC,EAAE,EAAE;CACjI,MAAM,mBAAmB,KAAK,KAAK,WAAW,sBAAsB;AAEpE,QADiB,IAAI,QAAQ,GAAG,aAAa,iBAAiB,CAAC,UAAU,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;;ACjBJ,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC/B;EACD,KAAK,CAAC,cAAc;EACpB,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAsC,cAAc,mBAA8B,KAAK,SAAS,CAAC,cAAc,CAAC;GACvH,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;AAEhD,SAAM,IAAI,aAAa;GAEvB,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,WAAW,MAAM,YAAY,IAAI,IAAI;AAE3C,SAAM,MAAM,KAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc,EAAE,SAAS;;EAE1E;EACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../node_modules/.pnpm/tsdown@0.15.9_typescript@5.9.3/node_modules/tsdown/esm-shims.js","../src/redoc.tsx","../src/plugin.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport type { OasTypes } from '@kubb/oas'\nimport pkg from 'handlebars'\n\ntype BuildDocsOptions = {\n title?: string\n disableGoogleFont?: boolean\n templateOptions?: any\n}\n\nexport async function getPageHTML(api: OasTypes.OASDocument, { title, disableGoogleFont, templateOptions }: BuildDocsOptions = {}) {\n const templateFileName = path.join(__dirname, '../static/redoc.hbs')\n const template = pkg.compile(fs.readFileSync(templateFileName).toString())\n return template({\n title: title || api.info.title || 'ReDoc documentation',\n redocHTML: `\n <script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"> </script>\n <div id=\"redoc-container\"></div>\n <script>\n const data = ${JSON.stringify(api, null, 2)};\n Redoc.init(data, {\n \"expandResponses\": \"200,400\"\n }, document.getElementById('redoc-container'))\n </script>\n `,\n disableGoogleFont,\n templateOptions,\n })\n}\n","import path from 'node:path'\n\nimport { PluginManager, createPlugin } from '@kubb/core'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport { trimExtName, write } from '@kubb/core/fs'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { getPageHTML } from './redoc.tsx'\nimport type { PluginRedoc } from './types.ts'\n\nexport const pluginRedocName = 'plugin-redoc' satisfies PluginRedoc['name']\n\nexport const pluginRedoc = createPlugin<PluginRedoc>((options) => {\n const { output = { path: 'docs.html' } } = options\n\n return {\n name: pluginRedocName,\n options: {\n output,\n name: trimExtName(output.path),\n },\n pre: [pluginOasName],\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n const oas = await swaggerPlugin.context.getOas()\n\n await oas.dereference()\n\n const root = path.resolve(this.config.root, this.config.output.path)\n const pageHTML = await getPageHTML(oas.api)\n\n await write(path.resolve(root, output.path || './docs.html'), pageHTML)\n },\n }\n})\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;CAIM,oBAAoB,cAAc,OAAO,KAAK,IAAI;CAClD,mBAAmB,KAAK,QAAQ,aAAa,CAAC;CAEvC,YAA4B,4BAAY;;;;;;ACIrD,eAAsB,YAAY,KAA2B,EAAE,OAAO,mBAAmB,oBAAsC,EAAE,EAAE;CACjI,MAAM,mBAAmB,KAAK,KAAK,WAAW,sBAAsB;AAEpE,QADiB,IAAI,QAAQ,GAAG,aAAa,iBAAiB,CAAC,UAAU,CAAC,CAC1D;EACd,OAAO,SAAS,IAAI,KAAK,SAAS;EAClC,WAAW;;;;kBAIG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC;;;;;;EAM3C;EACA;EACD,CAAC;;;;;ACjBJ,MAAa,kBAAkB;AAE/B,MAAa,cAAc,cAA2B,YAAY;CAChE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,KAAK;AAE3C,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,MAAM,YAAY,OAAO,KAAK;GAC/B;EACD,KAAK,CAAC,cAAc;EACpB,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAsC,cAAc,mBAA8B,KAAK,SAAS,CAAC,cAAc,CAAC;GACvH,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;AAEhD,SAAM,IAAI,aAAa;GAEvB,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,WAAW,MAAM,YAAY,IAAI,IAAI;AAE3C,SAAM,MAAM,KAAK,QAAQ,MAAM,OAAO,QAAQ,cAAc,EAAE,SAAS;;EAE1E;EACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-redoc",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "Beautiful docs with Redoc",
5
5
  "keywords": [
6
6
  "typescript",
@@ -40,12 +40,12 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "handlebars": "^4.7.8",
43
- "@kubb/core": "4.1.3",
44
- "@kubb/oas": "4.1.3",
45
- "@kubb/plugin-oas": "4.1.3"
43
+ "@kubb/oas": "4.2.0",
44
+ "@kubb/plugin-oas": "4.2.0",
45
+ "@kubb/core": "4.2.0"
46
46
  },
47
47
  "devDependencies": {
48
- "tsdown": "^0.15.7",
48
+ "tsdown": "^0.15.9",
49
49
  "typescript": "^5.9.3"
50
50
  },
51
51
  "peerDependencies": {