@kubb/plugin-ts 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-3xBQBYqb.d.cts → types-D1T1t1A0.d.ts} +23 -137
- package/dist/{types-CvqW_Qsz.d.ts → types-DEsrThze.d.cts} +23 -137
- package/package.json +16 -11
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginTs, o as OasTypes, r as Schema, s as SchemaObject } from "./types-
|
|
1
|
+
import { n as PluginTs, o as OasTypes, r as Schema, s as SchemaObject } from "./types-DEsrThze.cjs";
|
|
2
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/OasType.d.ts
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginTs, o as OasTypes, r as Schema, s as SchemaObject } from "./types-
|
|
1
|
+
import { n as PluginTs, o as OasTypes, r as Schema, s as SchemaObject } from "./types-D1T1t1A0.js";
|
|
2
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/OasType.d.ts
|
package/dist/generators.d.cts
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
|
+
import ts from "typescript";
|
|
1
3
|
import * as OasTypes from "oas/types";
|
|
2
4
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
3
5
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -5,9 +7,8 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
5
7
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
8
|
import BaseOas from "oas";
|
|
7
9
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
8
|
-
import {
|
|
10
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
11
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
|
-
import ts from "typescript";
|
|
11
12
|
|
|
12
13
|
//#region ../oas/src/types.d.ts
|
|
13
14
|
type contentType = 'application/json' | (string & {});
|
|
@@ -58,121 +59,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
58
59
|
abstract build(...params: unknown[]): unknown;
|
|
59
60
|
}
|
|
60
61
|
//#endregion
|
|
61
|
-
//#region ../core/src/fs/types.d.ts
|
|
62
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
63
|
-
type Import = {
|
|
64
|
-
/**
|
|
65
|
-
* Import name to be used
|
|
66
|
-
* @example ["useState"]
|
|
67
|
-
* @example "React"
|
|
68
|
-
*/
|
|
69
|
-
name: string | Array<string | {
|
|
70
|
-
propertyName: string;
|
|
71
|
-
name?: string;
|
|
72
|
-
}>;
|
|
73
|
-
/**
|
|
74
|
-
* Path for the import
|
|
75
|
-
* @example '@kubb/core'
|
|
76
|
-
*/
|
|
77
|
-
path: string;
|
|
78
|
-
/**
|
|
79
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
80
|
-
*/
|
|
81
|
-
isTypeOnly?: boolean;
|
|
82
|
-
isNameSpace?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
85
|
-
*/
|
|
86
|
-
root?: string;
|
|
87
|
-
};
|
|
88
|
-
type Source = {
|
|
89
|
-
name?: string;
|
|
90
|
-
value?: string;
|
|
91
|
-
isTypeOnly?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Has const or type 'export'
|
|
94
|
-
* @default false
|
|
95
|
-
*/
|
|
96
|
-
isExportable?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* When set, barrel generation will add this
|
|
99
|
-
* @default false
|
|
100
|
-
*/
|
|
101
|
-
isIndexable?: boolean;
|
|
102
|
-
};
|
|
103
|
-
type Export = {
|
|
104
|
-
/**
|
|
105
|
-
* Export name to be used.
|
|
106
|
-
* @example ["useState"]
|
|
107
|
-
* @example "React"
|
|
108
|
-
*/
|
|
109
|
-
name?: string | Array<string>;
|
|
110
|
-
/**
|
|
111
|
-
* Path for the import.
|
|
112
|
-
* @example '@kubb/core'
|
|
113
|
-
*/
|
|
114
|
-
path: string;
|
|
115
|
-
/**
|
|
116
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
117
|
-
*/
|
|
118
|
-
isTypeOnly?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
121
|
-
*/
|
|
122
|
-
asAlias?: boolean;
|
|
123
|
-
};
|
|
124
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
125
|
-
type Mode = 'single' | 'split';
|
|
126
|
-
/**
|
|
127
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
128
|
-
* Based on UNIX basename
|
|
129
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
130
|
-
*/
|
|
131
|
-
type BaseName = `${string}.${string}`;
|
|
132
|
-
/**
|
|
133
|
-
* Path will be full qualified path to a specified file
|
|
134
|
-
*/
|
|
135
|
-
type Path = string;
|
|
136
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
137
|
-
type OptionalPath = Path | undefined | null;
|
|
138
|
-
type File<TMeta extends object = object> = {
|
|
139
|
-
/**
|
|
140
|
-
* Name to be used to create the path
|
|
141
|
-
* Based on UNIX basename, `${name}.extname`
|
|
142
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
143
|
-
*/
|
|
144
|
-
baseName: BaseName;
|
|
145
|
-
/**
|
|
146
|
-
* Path will be full qualified path to a specified file
|
|
147
|
-
*/
|
|
148
|
-
path: AdvancedPath<BaseName> | Path;
|
|
149
|
-
sources: Array<Source>;
|
|
150
|
-
imports?: Array<Import>;
|
|
151
|
-
exports?: Array<Export>;
|
|
152
|
-
/**
|
|
153
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
154
|
-
*/
|
|
155
|
-
meta?: TMeta;
|
|
156
|
-
banner?: string;
|
|
157
|
-
footer?: string;
|
|
158
|
-
};
|
|
159
|
-
type ResolvedImport = Import;
|
|
160
|
-
type ResolvedExport = Export;
|
|
161
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
162
|
-
/**
|
|
163
|
-
* @default object-hash
|
|
164
|
-
*/
|
|
165
|
-
id: string;
|
|
166
|
-
/**
|
|
167
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
168
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
169
|
-
*/
|
|
170
|
-
name: string;
|
|
171
|
-
extname: Extname;
|
|
172
|
-
imports: Array<ResolvedImport>;
|
|
173
|
-
exports: Array<ResolvedExport>;
|
|
174
|
-
};
|
|
175
|
-
//#endregion
|
|
176
62
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
177
63
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
178
64
|
#private;
|
|
@@ -296,7 +182,7 @@ type Config<TInput = Input> = {
|
|
|
296
182
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
297
183
|
* @default { '.ts': '.ts'}
|
|
298
184
|
*/
|
|
299
|
-
extension?: Record<Extname, Extname | ''>;
|
|
185
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
300
186
|
/**
|
|
301
187
|
* Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
|
|
302
188
|
* @default 'named'
|
|
@@ -427,7 +313,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
427
313
|
* @type hookFirst
|
|
428
314
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
429
315
|
*/
|
|
430
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
316
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
431
317
|
/**
|
|
432
318
|
* Resolve to a name based on a string.
|
|
433
319
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -445,8 +331,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
445
331
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
446
332
|
type ResolvePathParams<TOptions = object> = {
|
|
447
333
|
pluginKey?: Plugin['key'];
|
|
448
|
-
baseName: BaseName;
|
|
449
|
-
mode?: Mode;
|
|
334
|
+
baseName: KubbFile.BaseName;
|
|
335
|
+
mode?: KubbFile.Mode;
|
|
450
336
|
/**
|
|
451
337
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
452
338
|
*/
|
|
@@ -471,8 +357,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
471
357
|
*/
|
|
472
358
|
fileManager: FileManager;
|
|
473
359
|
pluginManager: PluginManager;
|
|
474
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
475
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
360
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
361
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
476
362
|
resolveName: (params: ResolveNameParams) => string;
|
|
477
363
|
logger: Logger;
|
|
478
364
|
/**
|
|
@@ -551,8 +437,8 @@ type Events = {
|
|
|
551
437
|
};
|
|
552
438
|
type GetFileProps<TOptions = object> = {
|
|
553
439
|
name: string;
|
|
554
|
-
mode?: Mode;
|
|
555
|
-
extname: Extname;
|
|
440
|
+
mode?: KubbFile.Mode;
|
|
441
|
+
extname: KubbFile.Extname;
|
|
556
442
|
pluginKey: Plugin['key'];
|
|
557
443
|
options?: TOptions;
|
|
558
444
|
};
|
|
@@ -571,10 +457,10 @@ declare class PluginManager {
|
|
|
571
457
|
extname,
|
|
572
458
|
pluginKey,
|
|
573
459
|
options
|
|
574
|
-
}: GetFileProps<TOptions>): File<{
|
|
460
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
575
461
|
pluginKey: Plugin['key'];
|
|
576
462
|
}>;
|
|
577
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
463
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
578
464
|
resolveName: (params: ResolveNameParams) => string;
|
|
579
465
|
/**
|
|
580
466
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -712,9 +598,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
|
|
|
712
598
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
713
599
|
name: string;
|
|
714
600
|
type: 'core';
|
|
715
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
716
|
-
operation: (props: OperationProps<TOptions>) => Promise<File[]>;
|
|
717
|
-
schema: (props: SchemaProps$1<TOptions>) => Promise<File[]>;
|
|
601
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
602
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
603
|
+
schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
|
|
718
604
|
};
|
|
719
605
|
//#endregion
|
|
720
606
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -738,7 +624,7 @@ type ResolvePathOptions = {
|
|
|
738
624
|
type Ref = {
|
|
739
625
|
propertyName: string;
|
|
740
626
|
originalName: string;
|
|
741
|
-
path: OptionalPath;
|
|
627
|
+
path: KubbFile.OptionalPath;
|
|
742
628
|
pluginKey?: Plugin['key'];
|
|
743
629
|
};
|
|
744
630
|
type Refs = Record<string, Ref>;
|
|
@@ -818,7 +704,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
818
704
|
* Current plugin
|
|
819
705
|
*/
|
|
820
706
|
plugin: Plugin<TPluginOptions>;
|
|
821
|
-
mode: Mode;
|
|
707
|
+
mode: KubbFile.Mode;
|
|
822
708
|
};
|
|
823
709
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
824
710
|
#private;
|
|
@@ -832,7 +718,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
832
718
|
method: HttpMethod;
|
|
833
719
|
operation: Operation$1;
|
|
834
720
|
}>>;
|
|
835
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
721
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
836
722
|
}
|
|
837
723
|
//#endregion
|
|
838
724
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -948,7 +834,7 @@ type SchemaKeywordMapper = {
|
|
|
948
834
|
/**
|
|
949
835
|
* Full qualified path.
|
|
950
836
|
*/
|
|
951
|
-
path: OptionalPath;
|
|
837
|
+
path: KubbFile.OptionalPath;
|
|
952
838
|
/**
|
|
953
839
|
* When true `File.Import` will be used.
|
|
954
840
|
* When false a reference will be used inside the current file.
|
|
@@ -1061,7 +947,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1061
947
|
* Current plugin
|
|
1062
948
|
*/
|
|
1063
949
|
plugin: Plugin<TPluginOptions>;
|
|
1064
|
-
mode: Mode;
|
|
950
|
+
mode: KubbFile.Mode;
|
|
1065
951
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1066
952
|
override: Array<Override<TOptions>> | undefined;
|
|
1067
953
|
contentType?: contentType;
|
|
@@ -1109,7 +995,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1109
995
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1110
996
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1111
997
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1112
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
998
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1113
999
|
}
|
|
1114
1000
|
//#endregion
|
|
1115
1001
|
//#region src/types.d.ts
|
|
@@ -1225,4 +1111,4 @@ type PluginTs = PluginFactoryOptions<'plugin-ts', Options$1, ResolvedOptions, {
|
|
|
1225
1111
|
}, ResolvePathOptions>;
|
|
1226
1112
|
//#endregion
|
|
1227
1113
|
export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginTs as n, OasTypes as o, Schema as r, SchemaObject$1 as s, Options$1 as t };
|
|
1228
|
-
//# sourceMappingURL=types-
|
|
1114
|
+
//# sourceMappingURL=types-D1T1t1A0.d.ts.map
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
|
-
import ts from "typescript";
|
|
3
1
|
import * as OasTypes from "oas/types";
|
|
4
2
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
5
3
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -7,7 +5,10 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
7
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
8
6
|
import BaseOas from "oas";
|
|
9
7
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
8
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
10
10
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
11
|
+
import ts from "typescript";
|
|
11
12
|
|
|
12
13
|
//#region ../oas/src/types.d.ts
|
|
13
14
|
type contentType = 'application/json' | (string & {});
|
|
@@ -58,121 +59,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
58
59
|
abstract build(...params: unknown[]): unknown;
|
|
59
60
|
}
|
|
60
61
|
//#endregion
|
|
61
|
-
//#region ../core/src/fs/types.d.ts
|
|
62
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
63
|
-
type Import = {
|
|
64
|
-
/**
|
|
65
|
-
* Import name to be used
|
|
66
|
-
* @example ["useState"]
|
|
67
|
-
* @example "React"
|
|
68
|
-
*/
|
|
69
|
-
name: string | Array<string | {
|
|
70
|
-
propertyName: string;
|
|
71
|
-
name?: string;
|
|
72
|
-
}>;
|
|
73
|
-
/**
|
|
74
|
-
* Path for the import
|
|
75
|
-
* @example '@kubb/core'
|
|
76
|
-
*/
|
|
77
|
-
path: string;
|
|
78
|
-
/**
|
|
79
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
80
|
-
*/
|
|
81
|
-
isTypeOnly?: boolean;
|
|
82
|
-
isNameSpace?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
85
|
-
*/
|
|
86
|
-
root?: string;
|
|
87
|
-
};
|
|
88
|
-
type Source = {
|
|
89
|
-
name?: string;
|
|
90
|
-
value?: string;
|
|
91
|
-
isTypeOnly?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Has const or type 'export'
|
|
94
|
-
* @default false
|
|
95
|
-
*/
|
|
96
|
-
isExportable?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* When set, barrel generation will add this
|
|
99
|
-
* @default false
|
|
100
|
-
*/
|
|
101
|
-
isIndexable?: boolean;
|
|
102
|
-
};
|
|
103
|
-
type Export = {
|
|
104
|
-
/**
|
|
105
|
-
* Export name to be used.
|
|
106
|
-
* @example ["useState"]
|
|
107
|
-
* @example "React"
|
|
108
|
-
*/
|
|
109
|
-
name?: string | Array<string>;
|
|
110
|
-
/**
|
|
111
|
-
* Path for the import.
|
|
112
|
-
* @example '@kubb/core'
|
|
113
|
-
*/
|
|
114
|
-
path: string;
|
|
115
|
-
/**
|
|
116
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
117
|
-
*/
|
|
118
|
-
isTypeOnly?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
121
|
-
*/
|
|
122
|
-
asAlias?: boolean;
|
|
123
|
-
};
|
|
124
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
125
|
-
type Mode = 'single' | 'split';
|
|
126
|
-
/**
|
|
127
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
128
|
-
* Based on UNIX basename
|
|
129
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
130
|
-
*/
|
|
131
|
-
type BaseName = `${string}.${string}`;
|
|
132
|
-
/**
|
|
133
|
-
* Path will be full qualified path to a specified file
|
|
134
|
-
*/
|
|
135
|
-
type Path = string;
|
|
136
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
137
|
-
type OptionalPath = Path | undefined | null;
|
|
138
|
-
type File$1<TMeta extends object = object> = {
|
|
139
|
-
/**
|
|
140
|
-
* Name to be used to create the path
|
|
141
|
-
* Based on UNIX basename, `${name}.extname`
|
|
142
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
143
|
-
*/
|
|
144
|
-
baseName: BaseName;
|
|
145
|
-
/**
|
|
146
|
-
* Path will be full qualified path to a specified file
|
|
147
|
-
*/
|
|
148
|
-
path: AdvancedPath<BaseName> | Path;
|
|
149
|
-
sources: Array<Source>;
|
|
150
|
-
imports?: Array<Import>;
|
|
151
|
-
exports?: Array<Export>;
|
|
152
|
-
/**
|
|
153
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
154
|
-
*/
|
|
155
|
-
meta?: TMeta;
|
|
156
|
-
banner?: string;
|
|
157
|
-
footer?: string;
|
|
158
|
-
};
|
|
159
|
-
type ResolvedImport = Import;
|
|
160
|
-
type ResolvedExport = Export;
|
|
161
|
-
type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
|
|
162
|
-
/**
|
|
163
|
-
* @default object-hash
|
|
164
|
-
*/
|
|
165
|
-
id: string;
|
|
166
|
-
/**
|
|
167
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
168
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
169
|
-
*/
|
|
170
|
-
name: string;
|
|
171
|
-
extname: Extname;
|
|
172
|
-
imports: Array<ResolvedImport>;
|
|
173
|
-
exports: Array<ResolvedExport>;
|
|
174
|
-
};
|
|
175
|
-
//#endregion
|
|
176
62
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
177
63
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
178
64
|
#private;
|
|
@@ -296,7 +182,7 @@ type Config<TInput = Input> = {
|
|
|
296
182
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
297
183
|
* @default { '.ts': '.ts'}
|
|
298
184
|
*/
|
|
299
|
-
extension?: Record<Extname, Extname | ''>;
|
|
185
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
300
186
|
/**
|
|
301
187
|
* Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
|
|
302
188
|
* @default 'named'
|
|
@@ -427,7 +313,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
427
313
|
* @type hookFirst
|
|
428
314
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
429
315
|
*/
|
|
430
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
316
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
431
317
|
/**
|
|
432
318
|
* Resolve to a name based on a string.
|
|
433
319
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -445,8 +331,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
445
331
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
446
332
|
type ResolvePathParams<TOptions = object> = {
|
|
447
333
|
pluginKey?: Plugin['key'];
|
|
448
|
-
baseName: BaseName;
|
|
449
|
-
mode?: Mode;
|
|
334
|
+
baseName: KubbFile.BaseName;
|
|
335
|
+
mode?: KubbFile.Mode;
|
|
450
336
|
/**
|
|
451
337
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
452
338
|
*/
|
|
@@ -471,8 +357,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
471
357
|
*/
|
|
472
358
|
fileManager: FileManager;
|
|
473
359
|
pluginManager: PluginManager;
|
|
474
|
-
addFile: (...file: Array<File
|
|
475
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
360
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
361
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
476
362
|
resolveName: (params: ResolveNameParams) => string;
|
|
477
363
|
logger: Logger;
|
|
478
364
|
/**
|
|
@@ -551,8 +437,8 @@ type Events = {
|
|
|
551
437
|
};
|
|
552
438
|
type GetFileProps<TOptions = object> = {
|
|
553
439
|
name: string;
|
|
554
|
-
mode?: Mode;
|
|
555
|
-
extname: Extname;
|
|
440
|
+
mode?: KubbFile.Mode;
|
|
441
|
+
extname: KubbFile.Extname;
|
|
556
442
|
pluginKey: Plugin['key'];
|
|
557
443
|
options?: TOptions;
|
|
558
444
|
};
|
|
@@ -571,10 +457,10 @@ declare class PluginManager {
|
|
|
571
457
|
extname,
|
|
572
458
|
pluginKey,
|
|
573
459
|
options
|
|
574
|
-
}: GetFileProps<TOptions>): File
|
|
460
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
575
461
|
pluginKey: Plugin['key'];
|
|
576
462
|
}>;
|
|
577
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
463
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
578
464
|
resolveName: (params: ResolveNameParams) => string;
|
|
579
465
|
/**
|
|
580
466
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -712,9 +598,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
|
|
|
712
598
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
713
599
|
name: string;
|
|
714
600
|
type: 'core';
|
|
715
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File
|
|
716
|
-
operation: (props: OperationProps<TOptions>) => Promise<File
|
|
717
|
-
schema: (props: SchemaProps$1<TOptions>) => Promise<File
|
|
601
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
602
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
603
|
+
schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
|
|
718
604
|
};
|
|
719
605
|
//#endregion
|
|
720
606
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -738,7 +624,7 @@ type ResolvePathOptions = {
|
|
|
738
624
|
type Ref = {
|
|
739
625
|
propertyName: string;
|
|
740
626
|
originalName: string;
|
|
741
|
-
path: OptionalPath;
|
|
627
|
+
path: KubbFile.OptionalPath;
|
|
742
628
|
pluginKey?: Plugin['key'];
|
|
743
629
|
};
|
|
744
630
|
type Refs = Record<string, Ref>;
|
|
@@ -818,7 +704,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
818
704
|
* Current plugin
|
|
819
705
|
*/
|
|
820
706
|
plugin: Plugin<TPluginOptions>;
|
|
821
|
-
mode: Mode;
|
|
707
|
+
mode: KubbFile.Mode;
|
|
822
708
|
};
|
|
823
709
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
824
710
|
#private;
|
|
@@ -832,7 +718,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
832
718
|
method: HttpMethod;
|
|
833
719
|
operation: Operation$1;
|
|
834
720
|
}>>;
|
|
835
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
721
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
836
722
|
}
|
|
837
723
|
//#endregion
|
|
838
724
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -948,7 +834,7 @@ type SchemaKeywordMapper = {
|
|
|
948
834
|
/**
|
|
949
835
|
* Full qualified path.
|
|
950
836
|
*/
|
|
951
|
-
path: OptionalPath;
|
|
837
|
+
path: KubbFile.OptionalPath;
|
|
952
838
|
/**
|
|
953
839
|
* When true `File.Import` will be used.
|
|
954
840
|
* When false a reference will be used inside the current file.
|
|
@@ -1061,7 +947,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1061
947
|
* Current plugin
|
|
1062
948
|
*/
|
|
1063
949
|
plugin: Plugin<TPluginOptions>;
|
|
1064
|
-
mode: Mode;
|
|
950
|
+
mode: KubbFile.Mode;
|
|
1065
951
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1066
952
|
override: Array<Override<TOptions>> | undefined;
|
|
1067
953
|
contentType?: contentType;
|
|
@@ -1109,7 +995,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1109
995
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1110
996
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1111
997
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1112
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
998
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1113
999
|
}
|
|
1114
1000
|
//#endregion
|
|
1115
1001
|
//#region src/types.d.ts
|
|
@@ -1225,4 +1111,4 @@ type PluginTs = PluginFactoryOptions<'plugin-ts', Options$1, ResolvedOptions, {
|
|
|
1225
1111
|
}, ResolvePathOptions>;
|
|
1226
1112
|
//#endregion
|
|
1227
1113
|
export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginTs as n, OasTypes as o, Schema as r, SchemaObject$1 as s, Options$1 as t };
|
|
1228
|
-
//# sourceMappingURL=types-
|
|
1114
|
+
//# sourceMappingURL=types-DEsrThze.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -56,22 +56,27 @@
|
|
|
56
56
|
"!/**/**.test.**",
|
|
57
57
|
"!/**/__tests__/**"
|
|
58
58
|
],
|
|
59
|
+
"size-limit": [
|
|
60
|
+
{
|
|
61
|
+
"path": "./dist/*.js",
|
|
62
|
+
"limit": "510 KiB",
|
|
63
|
+
"gzip": true
|
|
64
|
+
}
|
|
65
|
+
],
|
|
59
66
|
"dependencies": {
|
|
60
|
-
"@kubb/fabric-core": "0.2.
|
|
61
|
-
"@kubb/react-fabric": "0.2.
|
|
67
|
+
"@kubb/fabric-core": "0.2.10",
|
|
68
|
+
"@kubb/react-fabric": "0.2.10",
|
|
62
69
|
"remeda": "^2.32.0",
|
|
63
70
|
"typescript": "5.9.3",
|
|
64
|
-
"@kubb/core": "4.4.
|
|
65
|
-
"@kubb/oas": "4.4.
|
|
66
|
-
"@kubb/plugin-oas": "4.4.
|
|
71
|
+
"@kubb/core": "4.4.1",
|
|
72
|
+
"@kubb/oas": "4.4.1",
|
|
73
|
+
"@kubb/plugin-oas": "4.4.1"
|
|
67
74
|
},
|
|
68
75
|
"devDependencies": {
|
|
69
|
-
"
|
|
70
|
-
"typescript": "^5.9.3",
|
|
71
|
-
"@kubb/plugin-oas": "4.4.0"
|
|
76
|
+
"@kubb/plugin-oas": "4.4.1"
|
|
72
77
|
},
|
|
73
78
|
"peerDependencies": {
|
|
74
|
-
"@kubb/react-fabric": "0.2.
|
|
79
|
+
"@kubb/react-fabric": "0.2.10"
|
|
75
80
|
},
|
|
76
81
|
"engines": {
|
|
77
82
|
"node": ">=20"
|
|
@@ -81,7 +86,7 @@
|
|
|
81
86
|
"registry": "https://registry.npmjs.org/"
|
|
82
87
|
},
|
|
83
88
|
"scripts": {
|
|
84
|
-
"build": "tsdown",
|
|
89
|
+
"build": "tsdown && size-limit",
|
|
85
90
|
"clean": "npx rimraf ./dist",
|
|
86
91
|
"lint": "bun biome lint .",
|
|
87
92
|
"lint:fix": "bun biome lint --fix --unsafe .",
|