@kubb/plugin-redoc 4.3.0 → 4.4.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.
@@ -0,0 +1,27 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
25
+
26
+ //#endregion
27
+ export { };
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Fabric, FileManager } from "@kubb/react-fabric";
1
2
  import { ConsolaInstance, LogLevel } from "consola";
2
- import { FileManager } from "@kubb/fabric-core";
3
3
  import * as OasTypes from "oas/types";
4
4
  import { OASDocument, SchemaObject, User } from "oas/types";
5
5
  import { Operation } from "oas/operation";
@@ -284,11 +284,11 @@ TName extends string = string,
284
284
  /**
285
285
  * Options of the plugin.
286
286
  */
287
- TOptions$1 extends object = object,
287
+ TOptions extends object = object,
288
288
  /**
289
289
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
290
290
  */
291
- TResolvedOptions extends object = TOptions$1,
291
+ TResolvedOptions extends object = TOptions,
292
292
  /**
293
293
  * Context that you want to expose to other plugins.
294
294
  */
@@ -302,23 +302,23 @@ TResolvePathOptions extends object = object> = {
302
302
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
303
303
  */
304
304
  key: PluginKey<TName | string>;
305
- options: TOptions$1;
305
+ options: TOptions;
306
306
  resolvedOptions: TResolvedOptions;
307
307
  context: TContext;
308
308
  resolvePathOptions: TResolvePathOptions;
309
309
  };
310
310
  type PluginKey<TName> = [name: TName, identifier?: string | number];
311
- type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
311
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
312
312
  /**
313
313
  * Unique name used for the plugin
314
314
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
315
315
  * @example @kubb/typescript
316
316
  */
317
- name: TOptions$1['name'];
317
+ name: TOptions['name'];
318
318
  /**
319
319
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
320
320
  */
321
- options: TOptions$1['resolvedOptions'];
321
+ options: TOptions['resolvedOptions'];
322
322
  /**
323
323
  * 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.
324
324
  * Can be used to validate dependent plugins.
@@ -328,23 +328,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
328
328
  * 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.
329
329
  */
330
330
  post?: Array<string>;
331
- } & (TOptions$1['context'] extends never ? {
331
+ } & (TOptions['context'] extends never ? {
332
332
  context?: never;
333
333
  } : {
334
- context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
334
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
335
335
  });
336
- type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
337
- type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
336
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
337
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
338
338
  /**
339
339
  * Unique name used for the plugin
340
340
  * @example @kubb/typescript
341
341
  */
342
- name: TOptions$1['name'];
342
+ name: TOptions['name'];
343
343
  /**
344
344
  * Internal key used when a developer uses more than one of the same plugin
345
345
  * @private
346
346
  */
347
- key: TOptions$1['key'];
347
+ key: TOptions['key'];
348
348
  /**
349
349
  * 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.
350
350
  * Can be used to validate dependent plugins.
@@ -357,49 +357,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
357
357
  /**
358
358
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
359
359
  */
360
- options: TOptions$1['resolvedOptions'];
361
- } & (TOptions$1['context'] extends never ? {
360
+ options: TOptions['resolvedOptions'];
361
+ } & (TOptions['context'] extends never ? {
362
362
  context?: never;
363
363
  } : {
364
- context: TOptions$1['context'];
364
+ context: TOptions['context'];
365
365
  });
366
- type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
367
- type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
366
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
367
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
368
368
  /**
369
369
  * Start of the lifecycle of a plugin.
370
370
  * @type hookParallel
371
371
  */
372
- buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
372
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
373
373
  /**
374
374
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
375
375
  * Options can als be included.
376
376
  * @type hookFirst
377
377
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
378
378
  */
379
- resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
379
+ resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
380
380
  /**
381
381
  * Resolve to a name based on a string.
382
382
  * Useful when converting to PascalCase or camelCase.
383
383
  * @type hookFirst
384
384
  * @example ('pet') => 'Pet'
385
385
  */
386
- resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
386
+ resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
387
387
  /**
388
388
  * End of the plugin lifecycle.
389
389
  * @type hookParallel
390
390
  */
391
- buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
391
+ buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
392
392
  };
393
393
  type PluginLifecycleHooks = keyof PluginLifecycle;
394
- type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
395
- type ResolvePathParams<TOptions$1 = object> = {
394
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
395
+ type ResolvePathParams<TOptions = object> = {
396
396
  pluginKey?: Plugin['key'];
397
397
  baseName: BaseName;
398
398
  mode?: Mode;
399
399
  /**
400
400
  * Options to be passed to 'resolvePath' 3th parameter
401
401
  */
402
- options?: TOptions$1;
402
+ options?: TOptions;
403
403
  };
404
404
  type ResolveNameParams = {
405
405
  name: string;
@@ -412,7 +412,8 @@ type ResolveNameParams = {
412
412
  */
413
413
  type?: 'file' | 'function' | 'type' | 'const';
414
414
  };
415
- type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
415
+ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
416
+ fabric: Fabric;
416
417
  config: Config;
417
418
  /**
418
419
  * @deprecated
@@ -420,7 +421,7 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
420
421
  fileManager: FileManager;
421
422
  pluginManager: PluginManager;
422
423
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
423
- resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
424
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
424
425
  resolveName: (params: ResolveNameParams) => string;
425
426
  logger: Logger;
426
427
  /**
@@ -430,12 +431,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
430
431
  /**
431
432
  * Current plugin
432
433
  */
433
- plugin: Plugin<TOptions$1>;
434
+ plugin: Plugin<TOptions>;
434
435
  };
435
436
  /**
436
437
  * Specify the export location for the files and define the behavior of the output
437
438
  */
438
- type Output<TOptions$1> = {
439
+ type Output<TOptions> = {
439
440
  /**
440
441
  * Path to the output folder or file that will contain the generated code
441
442
  */
@@ -448,30 +449,31 @@ type Output<TOptions$1> = {
448
449
  /**
449
450
  * Add a banner text in the beginning of every file
450
451
  */
451
- banner?: string | ((options: TOptions$1) => string);
452
+ banner?: string | ((options: TOptions) => string);
452
453
  /**
453
454
  * Add a footer text in the beginning of every file
454
455
  */
455
- footer?: string | ((options: TOptions$1) => string);
456
+ footer?: string | ((options: TOptions) => string);
456
457
  };
457
458
  //#endregion
458
459
  //#region ../core/src/PluginManager.d.ts
459
460
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
460
461
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
461
- type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
462
+ type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
462
463
  message: string;
463
464
  strategy: Strategy;
464
- hookName: H$1;
465
+ hookName: H;
465
466
  plugin: Plugin;
466
467
  parameters?: unknown[] | undefined;
467
468
  output?: unknown;
468
469
  };
469
- type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
470
- type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
470
+ type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
471
+ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
471
472
  result: Result;
472
473
  plugin: Plugin;
473
474
  };
474
475
  type Options$2 = {
476
+ fabric: Fabric;
475
477
  logger: Logger;
476
478
  /**
477
479
  * @default Number.POSITIVE_INFINITY
@@ -483,20 +485,16 @@ type Events = {
483
485
  executed: [executer: Executer];
484
486
  error: [error: Error];
485
487
  };
486
- type GetFileProps<TOptions$1 = object> = {
488
+ type GetFileProps<TOptions = object> = {
487
489
  name: string;
488
490
  mode?: Mode;
489
491
  extname: Extname;
490
492
  pluginKey: Plugin['key'];
491
- options?: TOptions$1;
493
+ options?: TOptions;
492
494
  };
493
495
  declare class PluginManager {
494
496
  #private;
495
497
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
496
- /**
497
- * @deprecated do not use from pluginManager
498
- */
499
- readonly fileManager: FileManager;
500
498
  readonly events: EventEmitter<Events>;
501
499
  readonly config: Config;
502
500
  readonly executed: Array<Executer>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Fabric, FileManager } from "@kubb/react-fabric";
1
2
  import { ConsolaInstance, LogLevel } from "consola";
2
- import { FileManager } from "@kubb/fabric-core";
3
3
  import * as OasTypes from "oas/types";
4
4
  import { OASDocument, SchemaObject, User } from "oas/types";
5
5
  import { Operation } from "oas/operation";
@@ -284,11 +284,11 @@ TName extends string = string,
284
284
  /**
285
285
  * Options of the plugin.
286
286
  */
287
- TOptions$1 extends object = object,
287
+ TOptions extends object = object,
288
288
  /**
289
289
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
290
290
  */
291
- TResolvedOptions extends object = TOptions$1,
291
+ TResolvedOptions extends object = TOptions,
292
292
  /**
293
293
  * Context that you want to expose to other plugins.
294
294
  */
@@ -302,23 +302,23 @@ TResolvePathOptions extends object = object> = {
302
302
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
303
303
  */
304
304
  key: PluginKey<TName | string>;
305
- options: TOptions$1;
305
+ options: TOptions;
306
306
  resolvedOptions: TResolvedOptions;
307
307
  context: TContext;
308
308
  resolvePathOptions: TResolvePathOptions;
309
309
  };
310
310
  type PluginKey<TName> = [name: TName, identifier?: string | number];
311
- type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
311
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
312
312
  /**
313
313
  * Unique name used for the plugin
314
314
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
315
315
  * @example @kubb/typescript
316
316
  */
317
- name: TOptions$1['name'];
317
+ name: TOptions['name'];
318
318
  /**
319
319
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
320
320
  */
321
- options: TOptions$1['resolvedOptions'];
321
+ options: TOptions['resolvedOptions'];
322
322
  /**
323
323
  * 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.
324
324
  * Can be used to validate dependent plugins.
@@ -328,23 +328,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
328
328
  * 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.
329
329
  */
330
330
  post?: Array<string>;
331
- } & (TOptions$1['context'] extends never ? {
331
+ } & (TOptions['context'] extends never ? {
332
332
  context?: never;
333
333
  } : {
334
- context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
334
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
335
335
  });
336
- type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
337
- type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
336
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
337
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
338
338
  /**
339
339
  * Unique name used for the plugin
340
340
  * @example @kubb/typescript
341
341
  */
342
- name: TOptions$1['name'];
342
+ name: TOptions['name'];
343
343
  /**
344
344
  * Internal key used when a developer uses more than one of the same plugin
345
345
  * @private
346
346
  */
347
- key: TOptions$1['key'];
347
+ key: TOptions['key'];
348
348
  /**
349
349
  * 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.
350
350
  * Can be used to validate dependent plugins.
@@ -357,49 +357,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
357
357
  /**
358
358
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
359
359
  */
360
- options: TOptions$1['resolvedOptions'];
361
- } & (TOptions$1['context'] extends never ? {
360
+ options: TOptions['resolvedOptions'];
361
+ } & (TOptions['context'] extends never ? {
362
362
  context?: never;
363
363
  } : {
364
- context: TOptions$1['context'];
364
+ context: TOptions['context'];
365
365
  });
366
- type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
367
- type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
366
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
367
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
368
368
  /**
369
369
  * Start of the lifecycle of a plugin.
370
370
  * @type hookParallel
371
371
  */
372
- buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
372
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
373
373
  /**
374
374
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
375
375
  * Options can als be included.
376
376
  * @type hookFirst
377
377
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
378
378
  */
379
- resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
379
+ resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
380
380
  /**
381
381
  * Resolve to a name based on a string.
382
382
  * Useful when converting to PascalCase or camelCase.
383
383
  * @type hookFirst
384
384
  * @example ('pet') => 'Pet'
385
385
  */
386
- resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
386
+ resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
387
387
  /**
388
388
  * End of the plugin lifecycle.
389
389
  * @type hookParallel
390
390
  */
391
- buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
391
+ buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
392
392
  };
393
393
  type PluginLifecycleHooks = keyof PluginLifecycle;
394
- type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
395
- type ResolvePathParams<TOptions$1 = object> = {
394
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
395
+ type ResolvePathParams<TOptions = object> = {
396
396
  pluginKey?: Plugin['key'];
397
397
  baseName: BaseName;
398
398
  mode?: Mode;
399
399
  /**
400
400
  * Options to be passed to 'resolvePath' 3th parameter
401
401
  */
402
- options?: TOptions$1;
402
+ options?: TOptions;
403
403
  };
404
404
  type ResolveNameParams = {
405
405
  name: string;
@@ -412,7 +412,8 @@ type ResolveNameParams = {
412
412
  */
413
413
  type?: 'file' | 'function' | 'type' | 'const';
414
414
  };
415
- type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
415
+ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
416
+ fabric: Fabric;
416
417
  config: Config;
417
418
  /**
418
419
  * @deprecated
@@ -420,7 +421,7 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
420
421
  fileManager: FileManager;
421
422
  pluginManager: PluginManager;
422
423
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
423
- resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
424
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
424
425
  resolveName: (params: ResolveNameParams) => string;
425
426
  logger: Logger;
426
427
  /**
@@ -430,12 +431,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
430
431
  /**
431
432
  * Current plugin
432
433
  */
433
- plugin: Plugin<TOptions$1>;
434
+ plugin: Plugin<TOptions>;
434
435
  };
435
436
  /**
436
437
  * Specify the export location for the files and define the behavior of the output
437
438
  */
438
- type Output<TOptions$1> = {
439
+ type Output<TOptions> = {
439
440
  /**
440
441
  * Path to the output folder or file that will contain the generated code
441
442
  */
@@ -448,30 +449,31 @@ type Output<TOptions$1> = {
448
449
  /**
449
450
  * Add a banner text in the beginning of every file
450
451
  */
451
- banner?: string | ((options: TOptions$1) => string);
452
+ banner?: string | ((options: TOptions) => string);
452
453
  /**
453
454
  * Add a footer text in the beginning of every file
454
455
  */
455
- footer?: string | ((options: TOptions$1) => string);
456
+ footer?: string | ((options: TOptions) => string);
456
457
  };
457
458
  //#endregion
458
459
  //#region ../core/src/PluginManager.d.ts
459
460
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
460
461
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
461
- type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
462
+ type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
462
463
  message: string;
463
464
  strategy: Strategy;
464
- hookName: H$1;
465
+ hookName: H;
465
466
  plugin: Plugin;
466
467
  parameters?: unknown[] | undefined;
467
468
  output?: unknown;
468
469
  };
469
- type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
470
- type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
470
+ type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
471
+ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
471
472
  result: Result;
472
473
  plugin: Plugin;
473
474
  };
474
475
  type Options$2 = {
476
+ fabric: Fabric;
475
477
  logger: Logger;
476
478
  /**
477
479
  * @default Number.POSITIVE_INFINITY
@@ -483,20 +485,16 @@ type Events = {
483
485
  executed: [executer: Executer];
484
486
  error: [error: Error];
485
487
  };
486
- type GetFileProps<TOptions$1 = object> = {
488
+ type GetFileProps<TOptions = object> = {
487
489
  name: string;
488
490
  mode?: Mode;
489
491
  extname: Extname;
490
492
  pluginKey: Plugin['key'];
491
- options?: TOptions$1;
493
+ options?: TOptions;
492
494
  };
493
495
  declare class PluginManager {
494
496
  #private;
495
497
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
496
- /**
497
- * @deprecated do not use from pluginManager
498
- */
499
- readonly fileManager: FileManager;
500
498
  readonly events: EventEmitter<Events>;
501
499
  readonly config: Config;
502
500
  readonly executed: Array<Executer>;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import fs from "node:fs";
7
7
  import pkg from "handlebars";
8
8
 
9
- //#region ../../node_modules/.pnpm/tsdown@0.15.9_typescript@5.9.3/node_modules/tsdown/esm-shims.js
9
+ //#region ../../node_modules/.pnpm/tsdown@0.15.11_typescript@5.9.3/node_modules/tsdown/esm-shims.js
10
10
  const getFilename = () => fileURLToPath(import.meta.url);
11
11
  const getDirname = () => path.dirname(getFilename());
12
12
  const __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.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":";;;;;;;;;AAIA,MAAM,oBAAoB,cAAc,OAAO,KAAK,IAAI;AACxD,MAAM,mBAAmB,KAAK,QAAQ,aAAa,CAAC;AAEpD,MAAa,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.11_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":";;;;;;;;;AAIA,MAAM,oBAAoB,cAAc,OAAO,KAAK,IAAI;AACxD,MAAM,mBAAmB,KAAK,QAAQ,aAAa,CAAC;AAEpD,MAAa,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.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "Beautiful docs with Redoc",
5
5
  "keywords": [
6
6
  "typescript",
@@ -39,17 +39,18 @@
39
39
  "!/**/__tests__/**"
40
40
  ],
41
41
  "dependencies": {
42
+ "@kubb/react-fabric": "0.2.8",
42
43
  "handlebars": "^4.7.8",
43
- "@kubb/core": "4.3.0",
44
- "@kubb/oas": "4.3.0",
45
- "@kubb/plugin-oas": "4.3.0"
44
+ "@kubb/core": "4.4.0",
45
+ "@kubb/oas": "4.4.0",
46
+ "@kubb/plugin-oas": "4.4.0"
46
47
  },
47
48
  "devDependencies": {
48
- "tsdown": "^0.15.9",
49
+ "tsdown": "^0.15.11",
49
50
  "typescript": "^5.9.3"
50
51
  },
51
52
  "peerDependencies": {
52
- "@kubb/react": "^4.0.0"
53
+ "@kubb/react-fabric": "0.2.8"
53
54
  },
54
55
  "engines": {
55
56
  "node": ">=20"