@kubb/plugin-zod 3.0.0-alpha.6 → 3.0.0-alpha.8

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.
@@ -3,13 +3,13 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkINEB36EJcjs = require('./chunk-INEB36EJ.cjs');
6
+ var _chunkTSJ74266cjs = require('./chunk-TSJ74266.cjs');
7
7
 
8
8
  // src/components/index.ts
9
- _chunkINEB36EJcjs.init_cjs_shims.call(void 0, );
9
+ _chunkTSJ74266cjs.init_cjs_shims.call(void 0, );
10
10
 
11
11
 
12
12
 
13
13
 
14
- exports.OperationSchema = _chunkINEB36EJcjs.OperationSchema; exports.Operations = _chunkINEB36EJcjs.Operations; exports.Schema = _chunkINEB36EJcjs.Schema;
14
+ exports.OperationSchema = _chunkTSJ74266cjs.OperationSchema; exports.Operations = _chunkTSJ74266cjs.Operations; exports.Schema = _chunkTSJ74266cjs.Schema;
15
15
  //# sourceMappingURL=components.cjs.map
@@ -3,7 +3,7 @@ import {
3
3
  Operations,
4
4
  Schema,
5
5
  init_esm_shims
6
- } from "./chunk-PMYJN6KG.js";
6
+ } from "./chunk-CD3EZWBX.js";
7
7
 
8
8
  // src/components/index.ts
9
9
  init_esm_shims();
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkINEB36EJcjs = require('./chunk-INEB36EJ.cjs');
5
+ var _chunkTSJ74266cjs = require('./chunk-TSJ74266.cjs');
6
6
 
7
7
  // src/index.ts
8
- _chunkINEB36EJcjs.init_cjs_shims.call(void 0, );
8
+ _chunkTSJ74266cjs.init_cjs_shims.call(void 0, );
9
9
 
10
10
 
11
11
 
12
- exports.pluginZod = _chunkINEB36EJcjs.pluginZod; exports.pluginZodName = _chunkINEB36EJcjs.pluginZodName;
12
+ exports.pluginZod = _chunkTSJ74266cjs.pluginZod; exports.pluginZodName = _chunkTSJ74266cjs.pluginZodName;
13
13
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  init_esm_shims,
3
3
  pluginZod,
4
4
  pluginZodName
5
- } from "./chunk-PMYJN6KG.js";
5
+ } from "./chunk-CD3EZWBX.js";
6
6
 
7
7
  // src/index.ts
8
8
  init_esm_shims();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-zod",
3
- "version": "3.0.0-alpha.6",
3
+ "version": "3.0.0-alpha.8",
4
4
  "description": "Generator plugin-zod",
5
5
  "keywords": [
6
6
  "typescript",
@@ -56,25 +56,25 @@
56
56
  "!/**/__tests__/**"
57
57
  ],
58
58
  "dependencies": {
59
- "@kubb/core": "3.0.0-alpha.6",
60
- "@kubb/fs": "3.0.0-alpha.6",
61
- "@kubb/oas": "3.0.0-alpha.6",
62
- "@kubb/parser-ts": "3.0.0-alpha.6",
63
- "@kubb/plugin-oas": "3.0.0-alpha.6",
64
- "@kubb/react": "3.0.0-alpha.6",
65
- "@kubb/types": "3.0.0-alpha.6"
59
+ "@kubb/core": "3.0.0-alpha.8",
60
+ "@kubb/fs": "3.0.0-alpha.8",
61
+ "@kubb/oas": "3.0.0-alpha.8",
62
+ "@kubb/parser-ts": "3.0.0-alpha.8",
63
+ "@kubb/plugin-oas": "3.0.0-alpha.8",
64
+ "@kubb/react": "3.0.0-alpha.8",
65
+ "@kubb/types": "3.0.0-alpha.8"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/react": "^18.3.4",
69
69
  "prettier": "^3.3.3",
70
70
  "react": "^18.3.1",
71
71
  "tsup": "^8.2.4",
72
- "@kubb/config-ts": "3.0.0-alpha.6",
73
- "@kubb/config-tsup": "3.0.0-alpha.6",
74
- "@kubb/config-biome": "3.0.0-alpha.6"
72
+ "@kubb/config-biome": "3.0.0-alpha.8",
73
+ "@kubb/config-ts": "3.0.0-alpha.8",
74
+ "@kubb/config-tsup": "3.0.0-alpha.8"
75
75
  },
76
76
  "peerDependencies": {
77
- "@kubb/react": "3.0.0-alpha.6"
77
+ "@kubb/react": "3.0.0-alpha.8"
78
78
  },
79
79
  "engines": {
80
80
  "node": ">=20"
@@ -45,7 +45,7 @@ OperationSchema.File = function ({}: FileProps): ReactNode {
45
45
 
46
46
  return (
47
47
  <Oas.Schema key={i} name={name} value={schema} tree={[...tree, optional ? { keyword: schemaKeywords.optional } : undefined].filter(Boolean)}>
48
- {mode === 'split' && <Oas.Schema.Imports />}
48
+ {mode === 'split' && <Oas.Schema.Imports isTypeOnly={false} />}
49
49
  <OperationSchema description={description} keysToOmit={keysToOmit} />
50
50
  </Oas.Schema>
51
51
  )
@@ -46,12 +46,12 @@ function Template({ operationsName, pathsName, operations }: TemplateProps): Kub
46
46
 
47
47
  return (
48
48
  <>
49
- <File.Source name={operationsName} isExportable>
49
+ <File.Source name={operationsName} isExportable isIndexable>
50
50
  <Const export name={operationsName} asConst>
51
51
  {`{${transformers.stringifyObject(operationsJSON)}}`}
52
52
  </Const>
53
53
  </File.Source>
54
- <File.Source name={pathsName} isExportable>
54
+ <File.Source name={pathsName} isExportable isIndexable>
55
55
  <Const export name={pathsName} asConst>
56
56
  {`{${transformers.stringifyObject(pathsJSON)}}`}
57
57
  </Const>
@@ -46,7 +46,7 @@ export function Schema(props: Props): ReactNode {
46
46
 
47
47
  if (!tree.length) {
48
48
  return (
49
- <File.Source name={resolvedName} isExportable>
49
+ <File.Source name={resolvedName} isExportable isIndexable>
50
50
  <Const
51
51
  name={resolvedName}
52
52
  export
@@ -79,7 +79,7 @@ export function Schema(props: Props): ReactNode {
79
79
 
80
80
  return (
81
81
  <>
82
- <File.Source name={resolvedName} isExportable>
82
+ <File.Source name={resolvedName} isExportable isIndexable>
83
83
  <Const
84
84
  export
85
85
  name={resolvedName}
@@ -97,7 +97,7 @@ export function Schema(props: Props): ReactNode {
97
97
  </Const>
98
98
  </File.Source>
99
99
  {typedSchema && (
100
- <File.Source name={resolvedTypeName} isExportable isTypeOnly>
100
+ <File.Source name={resolvedTypeName} isExportable isIndexable isTypeOnly>
101
101
  <Type export name={resolvedTypeName}>
102
102
  {`z.infer<typeof ${resolvedName}>`}
103
103
  </Type>
@@ -6,8 +6,8 @@ export const operations = {"get_pets-pet-id": {
6
6
  header: undefined
7
7
  },
8
8
  responses: {
9
- 200: GetPetsPetIdQueryResponse,
10
- default: GetPetsPetIdQueryResponse
9
+ 200: getPetsPetIdQueryResponse,
10
+ default: getPetsPetIdQueryResponse
11
11
  },
12
12
  errors: {
13
13
 
@@ -17,27 +17,27 @@ export const operations = {"get_pets-pet-id": {
17
17
  request: undefined,
18
18
  parameters: {
19
19
  path: undefined,
20
- query: ListPetsQueryParams,
20
+ query: listPetsQueryParams,
21
21
  header: undefined
22
22
  },
23
23
  responses: {
24
- 200: ListPetsQueryResponse,
25
- default: ListPetsQueryResponse
24
+ 200: listPetsQueryResponse,
25
+ default: listPetsQueryResponse
26
26
  },
27
27
  errors: {
28
28
 
29
29
  }
30
30
  },
31
31
  "createPets": {
32
- request: CreatePetsMutationRequest,
32
+ request: createPetsMutationRequest,
33
33
  parameters: {
34
34
  path: undefined,
35
35
  query: undefined,
36
36
  header: undefined
37
37
  },
38
38
  responses: {
39
- 201: CreatePetsMutationResponse,
40
- default: CreatePetsMutationResponse
39
+ 201: createPetsMutationResponse,
40
+ default: createPetsMutationResponse
41
41
  },
42
42
  errors: {
43
43
 
package/src/plugin.ts CHANGED
@@ -3,15 +3,15 @@ import path from 'node:path'
3
3
  import { FileManager, PluginManager, createPlugin } from '@kubb/core'
4
4
  import { camelCase, pascalCase } from '@kubb/core/transformers'
5
5
  import { renderTemplate } from '@kubb/core/utils'
6
- import { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'
6
+ import { OperationGenerator, SchemaGenerator, pluginOasName } from '@kubb/plugin-oas'
7
7
 
8
8
  import { pluginTsName } from '@kubb/plugin-ts'
9
9
 
10
10
  import type { Plugin } from '@kubb/core'
11
11
  import type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'
12
+ import { zodParser } from './SchemaGenerator.tsx'
12
13
  import { Operations } from './components/Operations.tsx'
13
14
  import type { PluginZod } from './types.ts'
14
- import { zodParser } from './SchemaGenerator.tsx'
15
15
 
16
16
  export const pluginZodName = 'plugin-zod' satisfies PluginZod['name']
17
17
 
@@ -36,6 +36,10 @@ export const pluginZod = createPlugin<PluginZod>((options) => {
36
36
 
37
37
  return {
38
38
  name: pluginZodName,
39
+ output: {
40
+ exportType: 'barrelNamed',
41
+ ...output,
42
+ },
39
43
  options: {
40
44
  extName: output.extName,
41
45
  transformers,
@@ -126,16 +130,18 @@ export const pluginZod = createPlugin<PluginZod>((options) => {
126
130
  const operationFiles = await operationGenerator.build(zodParser)
127
131
  await this.addFile(...operationFiles)
128
132
 
129
- if (this.config.output.write) {
130
- const indexFiles = await this.fileManager.getIndexFiles({
133
+ if (this.config.output.exportType) {
134
+ const barrelFiles = await this.fileManager.getBarrelFiles({
131
135
  root,
132
136
  output,
133
137
  files: this.fileManager.files,
134
- plugin: this.plugin,
138
+ meta: {
139
+ pluginKey: this.plugin.key,
140
+ },
135
141
  logger: this.logger,
136
142
  })
137
143
 
138
- await this.addFile(...indexFiles)
144
+ await this.addFile(...barrelFiles)
139
145
  }
140
146
  },
141
147
  }