@kubb/plugin-msw 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/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-8ZXwr93_.cjs";
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-CvyuqqRp.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/mswGenerator.d.ts
|
|
5
5
|
declare const mswGenerator: ReactGenerator<PluginMsw>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-D0JuaurR.js";
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-BKFpz20w.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/mswGenerator.d.ts
|
|
5
5
|
declare const mswGenerator: ReactGenerator<PluginMsw>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-8ZXwr93_.cjs";
|
|
2
|
-
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-
|
|
2
|
+
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-CvyuqqRp.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-D0JuaurR.js";
|
|
2
|
-
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-
|
|
2
|
+
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-BKFpz20w.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
|
@@ -6,6 +6,7 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
6
6
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
7
|
import BaseOas from "oas";
|
|
8
8
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
9
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
10
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
11
|
|
|
11
12
|
//#region ../oas/src/Oas.d.ts
|
|
@@ -50,121 +51,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
50
51
|
abstract build(...params: unknown[]): unknown;
|
|
51
52
|
}
|
|
52
53
|
//#endregion
|
|
53
|
-
//#region ../core/src/fs/types.d.ts
|
|
54
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
55
|
-
type Import = {
|
|
56
|
-
/**
|
|
57
|
-
* Import name to be used
|
|
58
|
-
* @example ["useState"]
|
|
59
|
-
* @example "React"
|
|
60
|
-
*/
|
|
61
|
-
name: string | Array<string | {
|
|
62
|
-
propertyName: string;
|
|
63
|
-
name?: string;
|
|
64
|
-
}>;
|
|
65
|
-
/**
|
|
66
|
-
* Path for the import
|
|
67
|
-
* @example '@kubb/core'
|
|
68
|
-
*/
|
|
69
|
-
path: string;
|
|
70
|
-
/**
|
|
71
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
72
|
-
*/
|
|
73
|
-
isTypeOnly?: boolean;
|
|
74
|
-
isNameSpace?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
77
|
-
*/
|
|
78
|
-
root?: string;
|
|
79
|
-
};
|
|
80
|
-
type Source = {
|
|
81
|
-
name?: string;
|
|
82
|
-
value?: string;
|
|
83
|
-
isTypeOnly?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Has const or type 'export'
|
|
86
|
-
* @default false
|
|
87
|
-
*/
|
|
88
|
-
isExportable?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* When set, barrel generation will add this
|
|
91
|
-
* @default false
|
|
92
|
-
*/
|
|
93
|
-
isIndexable?: boolean;
|
|
94
|
-
};
|
|
95
|
-
type Export = {
|
|
96
|
-
/**
|
|
97
|
-
* Export name to be used.
|
|
98
|
-
* @example ["useState"]
|
|
99
|
-
* @example "React"
|
|
100
|
-
*/
|
|
101
|
-
name?: string | Array<string>;
|
|
102
|
-
/**
|
|
103
|
-
* Path for the import.
|
|
104
|
-
* @example '@kubb/core'
|
|
105
|
-
*/
|
|
106
|
-
path: string;
|
|
107
|
-
/**
|
|
108
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
109
|
-
*/
|
|
110
|
-
isTypeOnly?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
113
|
-
*/
|
|
114
|
-
asAlias?: boolean;
|
|
115
|
-
};
|
|
116
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
117
|
-
type Mode = 'single' | 'split';
|
|
118
|
-
/**
|
|
119
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
120
|
-
* Based on UNIX basename
|
|
121
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
122
|
-
*/
|
|
123
|
-
type BaseName = `${string}.${string}`;
|
|
124
|
-
/**
|
|
125
|
-
* Path will be full qualified path to a specified file
|
|
126
|
-
*/
|
|
127
|
-
type Path = string;
|
|
128
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
129
|
-
type OptionalPath = Path | undefined | null;
|
|
130
|
-
type File$1<TMeta extends object = object> = {
|
|
131
|
-
/**
|
|
132
|
-
* Name to be used to create the path
|
|
133
|
-
* Based on UNIX basename, `${name}.extname`
|
|
134
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
135
|
-
*/
|
|
136
|
-
baseName: BaseName;
|
|
137
|
-
/**
|
|
138
|
-
* Path will be full qualified path to a specified file
|
|
139
|
-
*/
|
|
140
|
-
path: AdvancedPath<BaseName> | Path;
|
|
141
|
-
sources: Array<Source>;
|
|
142
|
-
imports?: Array<Import>;
|
|
143
|
-
exports?: Array<Export>;
|
|
144
|
-
/**
|
|
145
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
146
|
-
*/
|
|
147
|
-
meta?: TMeta;
|
|
148
|
-
banner?: string;
|
|
149
|
-
footer?: string;
|
|
150
|
-
};
|
|
151
|
-
type ResolvedImport = Import;
|
|
152
|
-
type ResolvedExport = Export;
|
|
153
|
-
type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
|
|
154
|
-
/**
|
|
155
|
-
* @default object-hash
|
|
156
|
-
*/
|
|
157
|
-
id: string;
|
|
158
|
-
/**
|
|
159
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
160
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
161
|
-
*/
|
|
162
|
-
name: string;
|
|
163
|
-
extname: Extname;
|
|
164
|
-
imports: Array<ResolvedImport>;
|
|
165
|
-
exports: Array<ResolvedExport>;
|
|
166
|
-
};
|
|
167
|
-
//#endregion
|
|
168
54
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
169
55
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
170
56
|
#private;
|
|
@@ -288,7 +174,7 @@ type Config<TInput = Input> = {
|
|
|
288
174
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
289
175
|
* @default { '.ts': '.ts'}
|
|
290
176
|
*/
|
|
291
|
-
extension?: Record<Extname, Extname | ''>;
|
|
177
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
292
178
|
/**
|
|
293
179
|
* 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`.
|
|
294
180
|
* @default 'named'
|
|
@@ -419,7 +305,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
419
305
|
* @type hookFirst
|
|
420
306
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
421
307
|
*/
|
|
422
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
308
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
423
309
|
/**
|
|
424
310
|
* Resolve to a name based on a string.
|
|
425
311
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -437,8 +323,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
437
323
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
438
324
|
type ResolvePathParams<TOptions = object> = {
|
|
439
325
|
pluginKey?: Plugin['key'];
|
|
440
|
-
baseName: BaseName;
|
|
441
|
-
mode?: Mode;
|
|
326
|
+
baseName: KubbFile.BaseName;
|
|
327
|
+
mode?: KubbFile.Mode;
|
|
442
328
|
/**
|
|
443
329
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
444
330
|
*/
|
|
@@ -463,8 +349,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
463
349
|
*/
|
|
464
350
|
fileManager: FileManager;
|
|
465
351
|
pluginManager: PluginManager;
|
|
466
|
-
addFile: (...file: Array<File
|
|
467
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
352
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
353
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
468
354
|
resolveName: (params: ResolveNameParams) => string;
|
|
469
355
|
logger: Logger;
|
|
470
356
|
/**
|
|
@@ -543,8 +429,8 @@ type Events = {
|
|
|
543
429
|
};
|
|
544
430
|
type GetFileProps<TOptions = object> = {
|
|
545
431
|
name: string;
|
|
546
|
-
mode?: Mode;
|
|
547
|
-
extname: Extname;
|
|
432
|
+
mode?: KubbFile.Mode;
|
|
433
|
+
extname: KubbFile.Extname;
|
|
548
434
|
pluginKey: Plugin['key'];
|
|
549
435
|
options?: TOptions;
|
|
550
436
|
};
|
|
@@ -563,10 +449,10 @@ declare class PluginManager {
|
|
|
563
449
|
extname,
|
|
564
450
|
pluginKey,
|
|
565
451
|
options
|
|
566
|
-
}: GetFileProps<TOptions>): File
|
|
452
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
567
453
|
pluginKey: Plugin['key'];
|
|
568
454
|
}>;
|
|
569
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
455
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
570
456
|
resolveName: (params: ResolveNameParams) => string;
|
|
571
457
|
/**
|
|
572
458
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -667,9 +553,9 @@ type FileMetaBase = {
|
|
|
667
553
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
668
554
|
name: string;
|
|
669
555
|
type: 'core';
|
|
670
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File
|
|
671
|
-
operation: (props: OperationProps<TOptions>) => Promise<File
|
|
672
|
-
schema: (props: SchemaProps<TOptions>) => Promise<File
|
|
556
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
557
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
558
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
673
559
|
};
|
|
674
560
|
//#endregion
|
|
675
561
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -693,7 +579,7 @@ type ResolvePathOptions = {
|
|
|
693
579
|
type Ref = {
|
|
694
580
|
propertyName: string;
|
|
695
581
|
originalName: string;
|
|
696
|
-
path: OptionalPath;
|
|
582
|
+
path: KubbFile.OptionalPath;
|
|
697
583
|
pluginKey?: Plugin['key'];
|
|
698
584
|
};
|
|
699
585
|
type Refs = Record<string, Ref>;
|
|
@@ -773,7 +659,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
773
659
|
* Current plugin
|
|
774
660
|
*/
|
|
775
661
|
plugin: Plugin<TPluginOptions>;
|
|
776
|
-
mode: Mode;
|
|
662
|
+
mode: KubbFile.Mode;
|
|
777
663
|
};
|
|
778
664
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
779
665
|
#private;
|
|
@@ -787,7 +673,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
787
673
|
method: HttpMethod;
|
|
788
674
|
operation: Operation$1;
|
|
789
675
|
}>>;
|
|
790
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
676
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
791
677
|
}
|
|
792
678
|
//#endregion
|
|
793
679
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -903,7 +789,7 @@ type SchemaKeywordMapper = {
|
|
|
903
789
|
/**
|
|
904
790
|
* Full qualified path.
|
|
905
791
|
*/
|
|
906
|
-
path: OptionalPath;
|
|
792
|
+
path: KubbFile.OptionalPath;
|
|
907
793
|
/**
|
|
908
794
|
* When true `File.Import` will be used.
|
|
909
795
|
* When false a reference will be used inside the current file.
|
|
@@ -1016,7 +902,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1016
902
|
* Current plugin
|
|
1017
903
|
*/
|
|
1018
904
|
plugin: Plugin<TPluginOptions>;
|
|
1019
|
-
mode: Mode;
|
|
905
|
+
mode: KubbFile.Mode;
|
|
1020
906
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1021
907
|
override: Array<Override<TOptions>> | undefined;
|
|
1022
908
|
contentType?: contentType;
|
|
@@ -1064,7 +950,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1064
950
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1065
951
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1066
952
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1067
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
953
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1068
954
|
}
|
|
1069
955
|
//#endregion
|
|
1070
956
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1165,4 +1051,4 @@ type ResolvedOptions = {
|
|
|
1165
1051
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1166
1052
|
//#endregion
|
|
1167
1053
|
export { UserPluginWithLifeCycle as i, PluginMsw as n, ReactGenerator as r, Options$1 as t };
|
|
1168
|
-
//# sourceMappingURL=types-
|
|
1054
|
+
//# sourceMappingURL=types-BKFpz20w.d.ts.map
|
|
@@ -5,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
5
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
6
|
import BaseOas from "oas";
|
|
7
7
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
8
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
9
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
9
10
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
11
|
|
|
@@ -50,121 +51,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
50
51
|
abstract build(...params: unknown[]): unknown;
|
|
51
52
|
}
|
|
52
53
|
//#endregion
|
|
53
|
-
//#region ../core/src/fs/types.d.ts
|
|
54
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
55
|
-
type Import = {
|
|
56
|
-
/**
|
|
57
|
-
* Import name to be used
|
|
58
|
-
* @example ["useState"]
|
|
59
|
-
* @example "React"
|
|
60
|
-
*/
|
|
61
|
-
name: string | Array<string | {
|
|
62
|
-
propertyName: string;
|
|
63
|
-
name?: string;
|
|
64
|
-
}>;
|
|
65
|
-
/**
|
|
66
|
-
* Path for the import
|
|
67
|
-
* @example '@kubb/core'
|
|
68
|
-
*/
|
|
69
|
-
path: string;
|
|
70
|
-
/**
|
|
71
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
72
|
-
*/
|
|
73
|
-
isTypeOnly?: boolean;
|
|
74
|
-
isNameSpace?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
77
|
-
*/
|
|
78
|
-
root?: string;
|
|
79
|
-
};
|
|
80
|
-
type Source = {
|
|
81
|
-
name?: string;
|
|
82
|
-
value?: string;
|
|
83
|
-
isTypeOnly?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Has const or type 'export'
|
|
86
|
-
* @default false
|
|
87
|
-
*/
|
|
88
|
-
isExportable?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* When set, barrel generation will add this
|
|
91
|
-
* @default false
|
|
92
|
-
*/
|
|
93
|
-
isIndexable?: boolean;
|
|
94
|
-
};
|
|
95
|
-
type Export = {
|
|
96
|
-
/**
|
|
97
|
-
* Export name to be used.
|
|
98
|
-
* @example ["useState"]
|
|
99
|
-
* @example "React"
|
|
100
|
-
*/
|
|
101
|
-
name?: string | Array<string>;
|
|
102
|
-
/**
|
|
103
|
-
* Path for the import.
|
|
104
|
-
* @example '@kubb/core'
|
|
105
|
-
*/
|
|
106
|
-
path: string;
|
|
107
|
-
/**
|
|
108
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
109
|
-
*/
|
|
110
|
-
isTypeOnly?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
113
|
-
*/
|
|
114
|
-
asAlias?: boolean;
|
|
115
|
-
};
|
|
116
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
117
|
-
type Mode = 'single' | 'split';
|
|
118
|
-
/**
|
|
119
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
120
|
-
* Based on UNIX basename
|
|
121
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
122
|
-
*/
|
|
123
|
-
type BaseName = `${string}.${string}`;
|
|
124
|
-
/**
|
|
125
|
-
* Path will be full qualified path to a specified file
|
|
126
|
-
*/
|
|
127
|
-
type Path = string;
|
|
128
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
129
|
-
type OptionalPath = Path | undefined | null;
|
|
130
|
-
type File<TMeta extends object = object> = {
|
|
131
|
-
/**
|
|
132
|
-
* Name to be used to create the path
|
|
133
|
-
* Based on UNIX basename, `${name}.extname`
|
|
134
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
135
|
-
*/
|
|
136
|
-
baseName: BaseName;
|
|
137
|
-
/**
|
|
138
|
-
* Path will be full qualified path to a specified file
|
|
139
|
-
*/
|
|
140
|
-
path: AdvancedPath<BaseName> | Path;
|
|
141
|
-
sources: Array<Source>;
|
|
142
|
-
imports?: Array<Import>;
|
|
143
|
-
exports?: Array<Export>;
|
|
144
|
-
/**
|
|
145
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
146
|
-
*/
|
|
147
|
-
meta?: TMeta;
|
|
148
|
-
banner?: string;
|
|
149
|
-
footer?: string;
|
|
150
|
-
};
|
|
151
|
-
type ResolvedImport = Import;
|
|
152
|
-
type ResolvedExport = Export;
|
|
153
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
154
|
-
/**
|
|
155
|
-
* @default object-hash
|
|
156
|
-
*/
|
|
157
|
-
id: string;
|
|
158
|
-
/**
|
|
159
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
160
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
161
|
-
*/
|
|
162
|
-
name: string;
|
|
163
|
-
extname: Extname;
|
|
164
|
-
imports: Array<ResolvedImport>;
|
|
165
|
-
exports: Array<ResolvedExport>;
|
|
166
|
-
};
|
|
167
|
-
//#endregion
|
|
168
54
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
169
55
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
170
56
|
#private;
|
|
@@ -288,7 +174,7 @@ type Config<TInput = Input> = {
|
|
|
288
174
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
289
175
|
* @default { '.ts': '.ts'}
|
|
290
176
|
*/
|
|
291
|
-
extension?: Record<Extname, Extname | ''>;
|
|
177
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
292
178
|
/**
|
|
293
179
|
* 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`.
|
|
294
180
|
* @default 'named'
|
|
@@ -419,7 +305,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
419
305
|
* @type hookFirst
|
|
420
306
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
421
307
|
*/
|
|
422
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
308
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
423
309
|
/**
|
|
424
310
|
* Resolve to a name based on a string.
|
|
425
311
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -437,8 +323,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
437
323
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
438
324
|
type ResolvePathParams<TOptions = object> = {
|
|
439
325
|
pluginKey?: Plugin['key'];
|
|
440
|
-
baseName: BaseName;
|
|
441
|
-
mode?: Mode;
|
|
326
|
+
baseName: KubbFile.BaseName;
|
|
327
|
+
mode?: KubbFile.Mode;
|
|
442
328
|
/**
|
|
443
329
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
444
330
|
*/
|
|
@@ -463,8 +349,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
463
349
|
*/
|
|
464
350
|
fileManager: FileManager;
|
|
465
351
|
pluginManager: PluginManager;
|
|
466
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
467
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
352
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
353
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
468
354
|
resolveName: (params: ResolveNameParams) => string;
|
|
469
355
|
logger: Logger;
|
|
470
356
|
/**
|
|
@@ -543,8 +429,8 @@ type Events = {
|
|
|
543
429
|
};
|
|
544
430
|
type GetFileProps<TOptions = object> = {
|
|
545
431
|
name: string;
|
|
546
|
-
mode?: Mode;
|
|
547
|
-
extname: Extname;
|
|
432
|
+
mode?: KubbFile.Mode;
|
|
433
|
+
extname: KubbFile.Extname;
|
|
548
434
|
pluginKey: Plugin['key'];
|
|
549
435
|
options?: TOptions;
|
|
550
436
|
};
|
|
@@ -563,10 +449,10 @@ declare class PluginManager {
|
|
|
563
449
|
extname,
|
|
564
450
|
pluginKey,
|
|
565
451
|
options
|
|
566
|
-
}: GetFileProps<TOptions>): File<{
|
|
452
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
567
453
|
pluginKey: Plugin['key'];
|
|
568
454
|
}>;
|
|
569
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
455
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
570
456
|
resolveName: (params: ResolveNameParams) => string;
|
|
571
457
|
/**
|
|
572
458
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -667,9 +553,9 @@ type FileMetaBase = {
|
|
|
667
553
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
668
554
|
name: string;
|
|
669
555
|
type: 'core';
|
|
670
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
671
|
-
operation: (props: OperationProps<TOptions>) => Promise<File[]>;
|
|
672
|
-
schema: (props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
556
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
557
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
558
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
673
559
|
};
|
|
674
560
|
//#endregion
|
|
675
561
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -693,7 +579,7 @@ type ResolvePathOptions = {
|
|
|
693
579
|
type Ref = {
|
|
694
580
|
propertyName: string;
|
|
695
581
|
originalName: string;
|
|
696
|
-
path: OptionalPath;
|
|
582
|
+
path: KubbFile.OptionalPath;
|
|
697
583
|
pluginKey?: Plugin['key'];
|
|
698
584
|
};
|
|
699
585
|
type Refs = Record<string, Ref>;
|
|
@@ -773,7 +659,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
773
659
|
* Current plugin
|
|
774
660
|
*/
|
|
775
661
|
plugin: Plugin<TPluginOptions>;
|
|
776
|
-
mode: Mode;
|
|
662
|
+
mode: KubbFile.Mode;
|
|
777
663
|
};
|
|
778
664
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
779
665
|
#private;
|
|
@@ -787,7 +673,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
787
673
|
method: HttpMethod;
|
|
788
674
|
operation: Operation$1;
|
|
789
675
|
}>>;
|
|
790
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
676
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
791
677
|
}
|
|
792
678
|
//#endregion
|
|
793
679
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -903,7 +789,7 @@ type SchemaKeywordMapper = {
|
|
|
903
789
|
/**
|
|
904
790
|
* Full qualified path.
|
|
905
791
|
*/
|
|
906
|
-
path: OptionalPath;
|
|
792
|
+
path: KubbFile.OptionalPath;
|
|
907
793
|
/**
|
|
908
794
|
* When true `File.Import` will be used.
|
|
909
795
|
* When false a reference will be used inside the current file.
|
|
@@ -1016,7 +902,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1016
902
|
* Current plugin
|
|
1017
903
|
*/
|
|
1018
904
|
plugin: Plugin<TPluginOptions>;
|
|
1019
|
-
mode: Mode;
|
|
905
|
+
mode: KubbFile.Mode;
|
|
1020
906
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1021
907
|
override: Array<Override<TOptions>> | undefined;
|
|
1022
908
|
contentType?: contentType;
|
|
@@ -1064,7 +950,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1064
950
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1065
951
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1066
952
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1067
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
953
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1068
954
|
}
|
|
1069
955
|
//#endregion
|
|
1070
956
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1165,4 +1051,4 @@ type ResolvedOptions = {
|
|
|
1165
1051
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1166
1052
|
//#endregion
|
|
1167
1053
|
export { UserPluginWithLifeCycle as i, PluginMsw as n, ReactGenerator as r, Options$1 as t };
|
|
1168
|
-
//# sourceMappingURL=types-
|
|
1054
|
+
//# sourceMappingURL=types-CvyuqqRp.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-msw",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Mock Service Worker (MSW) handlers generator plugin for Kubb, creating API mocks from OpenAPI specifications for frontend development and testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"msw",
|
|
@@ -65,20 +65,24 @@
|
|
|
65
65
|
"!/**/**.test.**",
|
|
66
66
|
"!/**/__tests__/**"
|
|
67
67
|
],
|
|
68
|
+
"size-limit": [
|
|
69
|
+
{
|
|
70
|
+
"path": "./dist/*.js",
|
|
71
|
+
"limit": "510 KiB",
|
|
72
|
+
"gzip": true
|
|
73
|
+
}
|
|
74
|
+
],
|
|
68
75
|
"dependencies": {
|
|
69
|
-
"@kubb/react-fabric": "0.2.
|
|
70
|
-
"@kubb/core": "4.4.
|
|
71
|
-
"@kubb/oas": "4.4.
|
|
72
|
-
"@kubb/plugin-faker": "4.4.
|
|
73
|
-
"@kubb/plugin-oas": "4.4.
|
|
74
|
-
"@kubb/plugin-ts": "4.4.
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"tsdown": "^0.15.11",
|
|
78
|
-
"typescript": "^5.9.3"
|
|
76
|
+
"@kubb/react-fabric": "0.2.10",
|
|
77
|
+
"@kubb/core": "4.4.1",
|
|
78
|
+
"@kubb/oas": "4.4.1",
|
|
79
|
+
"@kubb/plugin-faker": "4.4.1",
|
|
80
|
+
"@kubb/plugin-oas": "4.4.1",
|
|
81
|
+
"@kubb/plugin-ts": "4.4.1"
|
|
79
82
|
},
|
|
83
|
+
"devDependencies": {},
|
|
80
84
|
"peerDependencies": {
|
|
81
|
-
"@kubb/react-fabric": "0.2.
|
|
85
|
+
"@kubb/react-fabric": "0.2.10"
|
|
82
86
|
},
|
|
83
87
|
"engines": {
|
|
84
88
|
"node": ">=20"
|
|
@@ -88,7 +92,7 @@
|
|
|
88
92
|
"registry": "https://registry.npmjs.org/"
|
|
89
93
|
},
|
|
90
94
|
"scripts": {
|
|
91
|
-
"build": "tsdown",
|
|
95
|
+
"build": "tsdown && size-limit",
|
|
92
96
|
"clean": "npx rimraf ./dist",
|
|
93
97
|
"lint": "bun biome lint .",
|
|
94
98
|
"lint:fix": "bun biome lint --fix --unsafe .",
|