@kubb/plugin-msw 3.0.0-alpha.3 → 3.0.0-alpha.30

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.
Files changed (51) hide show
  1. package/README.md +13 -4
  2. package/dist/chunk-6M2QU6UL.js +22 -0
  3. package/dist/chunk-6M2QU6UL.js.map +1 -0
  4. package/dist/chunk-GODA4G5K.cjs +25 -0
  5. package/dist/chunk-GODA4G5K.cjs.map +1 -0
  6. package/dist/chunk-M3A3J5SW.cjs +139 -0
  7. package/dist/chunk-M3A3J5SW.cjs.map +1 -0
  8. package/dist/chunk-NDX2ITTW.js +130 -0
  9. package/dist/chunk-NDX2ITTW.js.map +1 -0
  10. package/dist/components.cjs +11 -4
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +7 -70
  13. package/dist/components.d.ts +7 -70
  14. package/dist/components.js +2 -8
  15. package/dist/components.js.map +1 -1
  16. package/dist/generators.cjs +17 -0
  17. package/dist/generators.cjs.map +1 -0
  18. package/dist/generators.d.cts +9 -0
  19. package/dist/generators.d.ts +9 -0
  20. package/dist/generators.js +4 -0
  21. package/dist/generators.js.map +1 -0
  22. package/dist/index.cjs +11 -137
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +3 -86
  25. package/dist/index.d.ts +3 -86
  26. package/dist/index.js +3 -142
  27. package/dist/index.js.map +1 -1
  28. package/dist/types-C6GF3XKm.d.cts +64 -0
  29. package/dist/types-C6GF3XKm.d.ts +64 -0
  30. package/package.json +22 -17
  31. package/src/components/Handlers.tsx +19 -0
  32. package/src/components/Mock.tsx +9 -92
  33. package/src/components/index.ts +1 -1
  34. package/src/generators/__snapshots__/createPet.ts +9 -0
  35. package/src/generators/__snapshots__/deletePet.ts +9 -0
  36. package/src/generators/__snapshots__/getPets.ts +9 -0
  37. package/src/generators/__snapshots__/handlers.ts +3 -0
  38. package/src/generators/__snapshots__/showPetById.ts +9 -0
  39. package/src/generators/handlersGenerator.tsx +32 -0
  40. package/src/generators/index.ts +2 -0
  41. package/src/generators/mswGenerator.tsx +38 -0
  42. package/src/plugin.ts +24 -36
  43. package/src/types.ts +14 -39
  44. package/dist/chunk-S4P5XPFN.cjs +0 -105
  45. package/dist/chunk-S4P5XPFN.cjs.map +0 -1
  46. package/dist/chunk-WRIEMCYI.js +0 -105
  47. package/dist/chunk-WRIEMCYI.js.map +0 -1
  48. package/src/OperationGenerator.tsx +0 -66
  49. package/src/components/Operations.tsx +0 -96
  50. package/src/components/__snapshots__/Mock/Pets.ts +0 -7
  51. package/src/components/__snapshots__/Mock/showPetsById.ts +0 -7
@@ -0,0 +1,64 @@
1
+ import { PluginFactoryOptions, Output, ResolveNameParams } from '@kubb/core';
2
+ import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
3
+
4
+ type Options = {
5
+ /**
6
+ * @default 'mocks'
7
+ */
8
+ output?: Output;
9
+ /**
10
+ * Group the MSW mocks based on the provided name.
11
+ */
12
+ group?: {
13
+ /**
14
+ * Tag will group based on the operation tag inside the Swagger file
15
+ */
16
+ type: 'tag';
17
+ /**
18
+ * Relative path to save the grouped MSW mocks.
19
+ *
20
+ * `{{tag}}` will be replaced by the current tagName.
21
+ * @example `${output}/{{tag}}Controller` => `mocks/PetController`
22
+ * @default `${output}/{{tag}}Controller`
23
+ */
24
+ output?: string;
25
+ /**
26
+ * Name to be used for the `export * as {{exportAs}} from './`
27
+ * @default `"{{tag}}Handlers"`
28
+ */
29
+ exportAs?: string;
30
+ };
31
+ /**
32
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
33
+ */
34
+ exclude?: Array<Exclude>;
35
+ /**
36
+ * Array containing include parameters to include tags/operations/methods/paths.
37
+ */
38
+ include?: Array<Include>;
39
+ /**
40
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
41
+ */
42
+ override?: Array<Override<ResolvedOptions>>;
43
+ transformers?: {
44
+ /**
45
+ * Customize the names based on the type that is provided by the plugin.
46
+ */
47
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
48
+ };
49
+ /**
50
+ * Create `handlers.ts` file with all handlers for all mocks.
51
+ * @default `false`
52
+ */
53
+ handlers?: boolean;
54
+ /**
55
+ * Define some generators next to the msw generators
56
+ */
57
+ generators?: Array<Generator<PluginMsw>>;
58
+ };
59
+ type ResolvedOptions = {
60
+ output: Output;
61
+ };
62
+ type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
63
+
64
+ export type { Options as O, PluginMsw as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-msw",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.30",
4
4
  "description": "Generator swagger",
5
5
  "keywords": [
6
6
  "typescript",
@@ -40,6 +40,11 @@
40
40
  "require": "./dist/components.cjs",
41
41
  "default": "./dist/components.cjs"
42
42
  },
43
+ "./generators": {
44
+ "import": "./dist/generators.js",
45
+ "require": "./dist/generators.cjs",
46
+ "default": "./dist/generators.cjs"
47
+ },
43
48
  "./package.json": "./package.json",
44
49
  "./*": "./*"
45
50
  },
@@ -56,6 +61,9 @@
56
61
  ],
57
62
  "components": [
58
63
  "./dist/components.d.ts"
64
+ ],
65
+ "generators": [
66
+ "./dist/generators.d.ts"
59
67
  ]
60
68
  }
61
69
  },
@@ -66,27 +74,24 @@
66
74
  "!/**/__tests__/**"
67
75
  ],
68
76
  "dependencies": {
69
- "@kubb/core": "3.0.0-alpha.3",
70
- "@kubb/fs": "3.0.0-alpha.3",
71
- "@kubb/oas": "3.0.0-alpha.3",
72
- "@kubb/parser-ts": "3.0.0-alpha.3",
73
- "@kubb/plugin-faker": "3.0.0-alpha.3",
74
- "@kubb/plugin-oas": "3.0.0-alpha.3",
75
- "@kubb/plugin-ts": "3.0.0-alpha.3",
76
- "@kubb/react": "3.0.0-alpha.3"
77
+ "@kubb/core": "3.0.0-alpha.30",
78
+ "@kubb/fs": "3.0.0-alpha.30",
79
+ "@kubb/oas": "3.0.0-alpha.30",
80
+ "@kubb/plugin-faker": "3.0.0-alpha.30",
81
+ "@kubb/plugin-oas": "3.0.0-alpha.30",
82
+ "@kubb/plugin-ts": "3.0.0-alpha.30",
83
+ "@kubb/react": "3.0.0-alpha.30"
77
84
  },
78
85
  "devDependencies": {
79
- "@types/react": "^18.3.4",
80
- "@types/react-dom": "^18.3.0",
86
+ "@types/react": "^18.3.10",
81
87
  "react": "^18.3.1",
82
- "tsup": "^8.2.4",
83
- "typescript": "^5.5.4",
84
- "@kubb/config-biome": "3.0.0-alpha.3",
85
- "@kubb/config-ts": "3.0.0-alpha.3",
86
- "@kubb/config-tsup": "3.0.0-alpha.3"
88
+ "tsup": "^8.3.0",
89
+ "typescript": "^5.6.2",
90
+ "@kubb/config-ts": "3.0.0-alpha.30",
91
+ "@kubb/config-tsup": "3.0.0-alpha.30"
87
92
  },
88
93
  "peerDependencies": {
89
- "@kubb/react": "3.0.0-alpha.3"
94
+ "@kubb/react": "3.0.0-alpha.30"
90
95
  },
91
96
  "engines": {
92
97
  "node": ">=20"
@@ -0,0 +1,19 @@
1
+ import { File } from '@kubb/react'
2
+ import type { ReactNode } from 'react'
3
+
4
+ type HandlersProps = {
5
+ /**
6
+ * Name of the function
7
+ */
8
+ name: string
9
+ // custom
10
+ handlers: string[]
11
+ }
12
+
13
+ export function Handlers({ name, handlers }: HandlersProps): ReactNode {
14
+ return (
15
+ <File.Source name={name} isIndexable isExportable>
16
+ {`export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, '')} as const`}
17
+ </File.Source>
18
+ )
19
+ }
@@ -1,113 +1,30 @@
1
- import { PackageManager } from '@kubb/core'
2
- import { URLPath } from '@kubb/core/utils'
3
- import { Parser, File, useApp } from '@kubb/react'
4
- import { pluginFakerName } from '@kubb/plugin-faker'
5
- import { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
1
+ import { File } from '@kubb/react'
6
2
 
7
3
  import type { HttpMethod } from '@kubb/oas'
8
4
  import type { ReactNode } from 'react'
9
- import type { FileMeta, PluginMsw } from '../types.ts'
10
5
 
11
- type TemplateProps = {
6
+ type Props = {
12
7
  /**
13
8
  * Name of the function
14
9
  */
15
10
  name: string
16
- /**
17
- * Method of the current operation, see useOperation.
18
- */
11
+ fakerName: string
12
+ url: string
19
13
  method: HttpMethod
20
- /**
21
- * Path of the mock
22
- */
23
- path: URLPath
24
- /**
25
- * Name of the import for the mock(this is a function).
26
- * @example createPet
27
- */
28
- responseName: string
29
14
  }
30
15
 
31
- function Template({ name, method, path, responseName }: TemplateProps): ReactNode {
16
+ export function Mock({ name, fakerName, url, method }: Props): ReactNode {
32
17
  return (
33
- <>
18
+ <File.Source name={name} isIndexable isExportable>
34
19
  {`
35
- export const ${name} = http.${method}('*${path.toURLPath()}', function handler(info) {
36
- return new Response(JSON.stringify(${responseName}()), {
20
+ export const ${name} = http.${method}('*${url}', function handler(info) {
21
+ return new Response(JSON.stringify(${fakerName}()), {
37
22
  headers: {
38
23
  'Content-Type': 'application/json',
39
24
  },
40
25
  })
41
26
  })
42
27
  `}
43
- </>
28
+ </File.Source>
44
29
  )
45
30
  }
46
-
47
- const defaultTemplates = { default: Template } as const
48
-
49
- type Props = {
50
- /**
51
- * This will make it possible to override the default behaviour.
52
- */
53
- Template?: React.ComponentType<React.ComponentProps<typeof Template>>
54
- }
55
-
56
- export function Mock({ Template = defaultTemplates.default }: Props): ReactNode {
57
- const { pluginManager } = useApp<PluginMsw>()
58
- const { getSchemas, getName } = useOperationManager()
59
- const operation = useOperation()
60
-
61
- const schemas = getSchemas(operation)
62
- const name = getName(operation, { type: 'function' })
63
- const responseName = pluginManager.resolveName({
64
- pluginKey: [pluginFakerName],
65
- name: schemas.response.name,
66
- type: 'type',
67
- })
68
-
69
- return <Template name={name} responseName={responseName} method={operation.method} path={new URLPath(operation.path)} />
70
- }
71
-
72
- type FileProps = {
73
- /**
74
- * This will make it possible to override the default behaviour.
75
- */
76
- templates?: typeof defaultTemplates
77
- }
78
-
79
- Mock.File = function ({ templates = defaultTemplates }: FileProps): ReactNode {
80
- const {
81
- pluginManager,
82
- plugin: {
83
- options: { extName },
84
- },
85
- } = useApp<PluginMsw>()
86
- const { getSchemas, getFile } = useOperationManager()
87
- const operation = useOperation()
88
-
89
- const schemas = getSchemas(operation)
90
- const file = getFile(operation)
91
- const fileFaker = getFile(operation, { pluginKey: [pluginFakerName] })
92
- const responseName = pluginManager.resolveName({
93
- pluginKey: [pluginFakerName],
94
- name: schemas.response.name,
95
- type: 'function',
96
- })
97
-
98
- const Template = templates.default
99
-
100
- return (
101
- <Parser language="typescript">
102
- <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
103
- <File.Import name={['http']} path={'msw'} />
104
- {fileFaker && responseName && <File.Import extName={extName} name={[responseName]} root={file.path} path={fileFaker.path} />}
105
- <File.Source>
106
- <Mock Template={Template} />
107
- </File.Source>
108
- </File>
109
- </Parser>
110
- )
111
- }
112
-
113
- Mock.templates = defaultTemplates
@@ -1,2 +1,2 @@
1
1
  export { Mock } from './Mock.tsx'
2
- export { Operations } from './Operations.tsx'
2
+ export { Handlers } from './Handlers.tsx'
@@ -0,0 +1,9 @@
1
+ import { http } from "msw";
2
+
3
+ export const createPets = http.post("*/pets", function handler(info) {
4
+ return new Response(JSON.stringify(createPetsMutationResponse()), {
5
+ headers: {
6
+ "Content-Type": "application/json",
7
+ },
8
+ });
9
+ });
@@ -0,0 +1,9 @@
1
+ import { http } from "msw";
2
+
3
+ export const deletePetsPetid = http.delete("*/pets/:petId", function handler(info) {
4
+ return new Response(JSON.stringify(deletePetsPetidMutationResponse()), {
5
+ headers: {
6
+ "Content-Type": "application/json",
7
+ },
8
+ });
9
+ });
@@ -0,0 +1,9 @@
1
+ import { http } from "msw";
2
+
3
+ export const listPets = http.get("*/pets", function handler(info) {
4
+ return new Response(JSON.stringify(listPetsQueryResponse()), {
5
+ headers: {
6
+ "Content-Type": "application/json",
7
+ },
8
+ });
9
+ });
@@ -0,0 +1,3 @@
1
+ import { listPets, createPets, showPetById } from "./findByTags";
2
+
3
+ export const handlers = [listPets, createPets, showPetById] as const;
@@ -0,0 +1,9 @@
1
+ import { http } from "msw";
2
+
3
+ export const showPetById = http.get("*/pets/:petId", function handler(info) {
4
+ return new Response(JSON.stringify(showPetByIdQueryResponse()), {
5
+ headers: {
6
+ "Content-Type": "application/json",
7
+ },
8
+ });
9
+ });
@@ -0,0 +1,32 @@
1
+ import { createReactGenerator } from '@kubb/plugin-oas'
2
+ import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
+ import { File, useApp } from '@kubb/react'
4
+ import { Handlers } from '../components/Handlers.tsx'
5
+ import { pluginMswName } from '../plugin.ts'
6
+ import type { PluginMsw } from '../types'
7
+
8
+ export const handlersGenerator = createReactGenerator<PluginMsw>({
9
+ name: 'plugin-msw',
10
+ Operations({ operations }) {
11
+ const { pluginManager, plugin } = useApp<PluginMsw>()
12
+ const { getName, getFile } = useOperationManager()
13
+
14
+ const file = pluginManager.getFile({ name: 'handlers', extname: '.ts', pluginKey: [pluginMswName] })
15
+
16
+ const imports = operations.map((operation) => {
17
+ const operationFile = getFile(operation, { pluginKey: [pluginMswName] })
18
+ const operationName = getName(operation, { pluginKey: [pluginMswName], type: 'function' })
19
+
20
+ return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />
21
+ })
22
+
23
+ const handlers = operations.map((operation) => getName(operation, { type: 'function', pluginKey: [pluginMswName] }))
24
+
25
+ return (
26
+ <File baseName={file.baseName} path={file.path} meta={file.meta} banner={plugin.options.output?.banner} footer={plugin.options.output?.footer}>
27
+ {imports}
28
+ <Handlers name={'handlers'} handlers={handlers} />
29
+ </File>
30
+ )
31
+ },
32
+ })
@@ -0,0 +1,2 @@
1
+ export { mswGenerator } from './mswGenerator.tsx'
2
+ export { handlersGenerator } from './handlersGenerator.tsx'
@@ -0,0 +1,38 @@
1
+ import { URLPath } from '@kubb/core/utils'
2
+ import { pluginFakerName } from '@kubb/plugin-faker'
3
+ import { createReactGenerator } from '@kubb/plugin-oas'
4
+ import { useOperationManager } from '@kubb/plugin-oas/hooks'
5
+ import { File, useApp } from '@kubb/react'
6
+ import { Mock } from '../components'
7
+ import type { PluginMsw } from '../types'
8
+
9
+ export const mswGenerator = createReactGenerator<PluginMsw>({
10
+ name: 'msw',
11
+ Operation({ operation }) {
12
+ const {
13
+ plugin: {
14
+ options: { output },
15
+ },
16
+ } = useApp<PluginMsw>()
17
+ const { getSchemaName, getName, getFile } = useOperationManager()
18
+
19
+ const mock = {
20
+ name: getName(operation, { type: 'function' }),
21
+ file: getFile(operation),
22
+ }
23
+
24
+ const faker = {
25
+ name: getSchemaName(operation, 'response', { pluginKey: [pluginFakerName], type: 'function' }),
26
+ file: getFile(operation, { pluginKey: [pluginFakerName] }),
27
+ }
28
+
29
+ return (
30
+ <File baseName={mock.file.baseName} path={mock.file.path} meta={mock.file.meta} banner={output?.banner} footer={output?.footer}>
31
+ <File.Import name={['http']} path={'msw'} />
32
+ {faker.file && faker.name && <File.Import name={[faker.name]} root={mock.file.path} path={faker.file.path} />}
33
+
34
+ <Mock name={mock.name} fakerName={faker.name} method={operation.method} url={new URLPath(operation.path).toURLPath()} />
35
+ </File>
36
+ )
37
+ },
38
+ })
package/src/plugin.ts CHANGED
@@ -3,33 +3,35 @@ import path from 'node:path'
3
3
  import { FileManager, PluginManager, createPlugin } from '@kubb/core'
4
4
  import { camelCase } from '@kubb/core/transformers'
5
5
  import { renderTemplate } from '@kubb/core/utils'
6
- import { pluginOasName } from '@kubb/plugin-oas'
7
- import { getGroupedByTagFiles } from '@kubb/plugin-oas/utils'
6
+ import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
7
+
8
8
  import { pluginFakerName } from '@kubb/plugin-faker'
9
9
  import { pluginTsName } from '@kubb/plugin-ts'
10
10
 
11
- import { OperationGenerator } from './OperationGenerator.tsx'
12
- import { Mock, Operations } from './components/index.ts'
13
-
14
11
  import type { Plugin } from '@kubb/core'
15
12
  import type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'
13
+ import { handlersGenerator, mswGenerator } from './generators'
16
14
  import type { PluginMsw } from './types.ts'
17
15
 
18
16
  export const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']
19
17
 
20
18
  export const pluginMsw = createPlugin<PluginMsw>((options) => {
21
- const { output = { path: 'handlers' }, group, exclude = [], include, override = [], transformers = {}, templates } = options
19
+ const {
20
+ output = { path: 'handlers', barrelType: 'named' },
21
+ group,
22
+ exclude = [],
23
+ include,
24
+ override = [],
25
+ transformers = {},
26
+ handlers = false,
27
+ generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),
28
+ } = options
22
29
  const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`
23
30
 
24
31
  return {
25
32
  name: pluginMswName,
26
33
  options: {
27
- extName: output.extName,
28
- templates: {
29
- operations: Operations.templates,
30
- mock: Mock.templates,
31
- ...templates,
32
- },
34
+ output,
33
35
  },
34
36
  pre: [pluginOasName, pluginTsName, pluginFakerName],
35
37
  resolvePath(baseName, pathMode, options) {
@@ -57,6 +59,7 @@ export const pluginMsw = createPlugin<PluginMsw>((options) => {
57
59
  suffix: type ? 'handler' : undefined,
58
60
  isFile: type === 'file',
59
61
  })
62
+
60
63
  if (type) {
61
64
  return transformers?.name?.(resolvedName, type) || resolvedName
62
65
  }
@@ -81,36 +84,21 @@ export const pluginMsw = createPlugin<PluginMsw>((options) => {
81
84
  mode,
82
85
  })
83
86
 
84
- const files = await operationGenerator.build()
87
+ const files = await operationGenerator.build(...generators)
85
88
  await this.addFile(...files)
86
- },
87
- async buildEnd() {
88
- if (this.config.output.write === false) {
89
- return
90
- }
91
89
 
92
- const root = path.resolve(this.config.root, this.config.output.path)
93
-
94
- if (group?.type === 'tag') {
95
- const rootFiles = await getGroupedByTagFiles({
96
- logger: this.logger,
97
- files: this.fileManager.files,
98
- plugin: this.plugin,
99
- template,
100
- exportAs: group.exportAs || '{{tag}}Handlers',
101
- root,
102
- output,
103
- })
104
-
105
- await this.addFile(...rootFiles)
106
- }
107
-
108
- await this.fileManager.addIndexes({
90
+ const barrelFiles = await this.fileManager.getBarrelFiles({
91
+ type: output.barrelType ?? 'named',
109
92
  root,
110
93
  output,
111
- meta: { pluginKey: this.plugin.key },
94
+ files: this.fileManager.files,
95
+ meta: {
96
+ pluginKey: this.plugin.key,
97
+ },
112
98
  logger: this.logger,
113
99
  })
100
+
101
+ await this.addFile(...barrelFiles)
114
102
  },
115
103
  }
116
104
  })
package/src/types.ts CHANGED
@@ -1,36 +1,12 @@
1
- import type { Plugin, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
- import type * as KubbFile from '@kubb/fs/types'
1
+ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
3
2
 
4
- import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
5
- import type { Mock, Operations } from './components/index.ts'
6
-
7
- type Templates = {
8
- operations?: typeof Operations.templates | false
9
- mock?: typeof Mock.templates | false
10
- }
3
+ import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
11
4
 
12
5
  export type Options = {
13
- output?: {
14
- /**
15
- * Relative path to save the MSW mocks.
16
- * When output is a file it will save all models inside that file else it will create a file per schema item.
17
- * @default 'mocks'
18
- */
19
- path: string
20
- /**
21
- * Name to be used for the `export * as {{exportAs}} from './'`
22
- */
23
- exportAs?: string
24
- /**
25
- * Add an extension to the generated imports and exports, default it will not use an extension
26
- */
27
- extName?: KubbFile.Extname
28
- /**
29
- * Define what needs to exported, here you can also disable the export of barrel files
30
- * @default `'barrel'`
31
- */
32
- exportType?: 'barrel' | 'barrelNamed' | false
33
- }
6
+ /**
7
+ * @default 'mocks'
8
+ */
9
+ output?: Output
34
10
  /**
35
11
  * Group the MSW mocks based on the provided name.
36
12
  */
@@ -72,18 +48,17 @@ export type Options = {
72
48
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string
73
49
  }
74
50
  /**
75
- * Make it possible to override one of the templates
51
+ * Create `handlers.ts` file with all handlers for all mocks.
52
+ * @default `false`
76
53
  */
77
- templates?: Partial<Templates>
54
+ handlers?: boolean
55
+ /**
56
+ * Define some generators next to the msw generators
57
+ */
58
+ generators?: Array<Generator<PluginMsw>>
78
59
  }
79
60
  type ResolvedOptions = {
80
- extName: KubbFile.Extname | undefined
81
- templates: NonNullable<Templates>
82
- }
83
-
84
- export type FileMeta = {
85
- pluginKey?: Plugin['key']
86
- tag?: string
61
+ output: Output
87
62
  }
88
63
 
89
64
  export type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>