@kubb/plugin-ts 3.8.0 → 3.9.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.
- package/dist/{chunk-VBEBZKJX.cjs → chunk-26E4KLQS.cjs} +53 -32
- package/dist/chunk-26E4KLQS.cjs.map +1 -0
- package/dist/{chunk-YCJCRZF6.js → chunk-6V4TF2LT.js} +4 -4
- package/dist/{chunk-YCJCRZF6.js.map → chunk-6V4TF2LT.js.map} +1 -1
- package/dist/{chunk-OJLHIBYC.js → chunk-LYH2R6JZ.js} +47 -26
- package/dist/chunk-LYH2R6JZ.js.map +1 -0
- package/dist/{chunk-OFELQKSZ.cjs → chunk-REQQ6E5S.cjs} +4 -4
- package/dist/{chunk-OFELQKSZ.cjs.map → chunk-REQQ6E5S.cjs.map} +1 -1
- package/dist/components.cjs +3 -3
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +2 -2
- package/package.json +9 -9
- package/src/generators/__snapshots__/bodyUploadFileApiAssetsPost.ts +5 -0
- package/src/generators/__snapshots__/catTypeAsConst.ts +5 -0
- package/src/generators/__snapshots__/createPet.ts +5 -0
- package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +5 -0
- package/src/generators/__snapshots__/createPetWithUnknownTypeVoid.ts +5 -0
- package/src/generators/__snapshots__/deletePet.ts +5 -0
- package/src/generators/__snapshots__/dogTypeAsConst.ts +5 -0
- package/src/generators/__snapshots__/enumAllOf.ts +5 -0
- package/src/generators/__snapshots__/enumArray.ts +5 -0
- package/src/generators/__snapshots__/enumArray20.ts +5 -0
- package/src/generators/__snapshots__/enumInObject.ts +5 -0
- package/src/generators/__snapshots__/enumItems.ts +5 -0
- package/src/generators/__snapshots__/enumNames.ts +5 -0
- package/src/generators/__snapshots__/enumNamesConst.ts +5 -0
- package/src/generators/__snapshots__/enumNamesLiteral.ts +5 -0
- package/src/generators/__snapshots__/enumNamesPascalConst.ts +5 -0
- package/src/generators/__snapshots__/enumNamesType.ts +5 -0
- package/src/generators/__snapshots__/enumNullableMember.ts +5 -0
- package/src/generators/__snapshots__/enumNullableType.ts +5 -0
- package/src/generators/__snapshots__/enumString.ts +5 -0
- package/src/generators/__snapshots__/enumVarNamesType.ts +5 -0
- package/src/generators/__snapshots__/fooBase.ts +5 -0
- package/src/generators/__snapshots__/fooNumber.ts +5 -0
- package/src/generators/__snapshots__/getPets.ts +5 -0
- package/src/generators/__snapshots__/mixedValueTypeConst.ts +5 -0
- package/src/generators/__snapshots__/nullConstNull.ts +5 -0
- package/src/generators/__snapshots__/numberValueConst.ts +5 -0
- package/src/generators/__snapshots__/petMapper.ts +5 -0
- package/src/generators/__snapshots__/petQuestionToken.ts +5 -0
- package/src/generators/__snapshots__/petQuestionTokenAndUndefined.ts +5 -0
- package/src/generators/__snapshots__/petUndefined.ts +5 -0
- package/src/generators/__snapshots__/pets.ts +5 -0
- package/src/generators/__snapshots__/petsInterface.ts +5 -0
- package/src/generators/__snapshots__/petsStoreAdvancedDiscriminator.ts +5 -0
- package/src/generators/__snapshots__/petsStoreDiscriminator.ts +5 -0
- package/src/generators/__snapshots__/petsStoreRef.ts +5 -0
- package/src/generators/__snapshots__/plainDateDate.ts +5 -0
- package/src/generators/__snapshots__/plainDateString.ts +5 -0
- package/src/generators/__snapshots__/plainEmail.ts +5 -0
- package/src/generators/__snapshots__/plainFile.ts +5 -0
- package/src/generators/__snapshots__/plainTimeDate.ts +5 -0
- package/src/generators/__snapshots__/plainUuid.ts +5 -0
- package/src/generators/__snapshots__/readOnly.ts +5 -0
- package/src/generators/__snapshots__/showPetById.ts +5 -0
- package/src/generators/__snapshots__/stringValueConst.ts +5 -0
- package/src/generators/oasGenerator.tsx +7 -1
- package/src/generators/typeGenerator.tsx +9 -2
- package/src/parser.ts +1 -1
- package/dist/chunk-OJLHIBYC.js.map +0 -1
- package/dist/chunk-VBEBZKJX.cjs.map +0 -1
package/dist/components.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkREQQ6E5S_cjs = require('./chunk-REQQ6E5S.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "OasType", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkREQQ6E5S_cjs.OasType; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "Type", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkREQQ6E5S_cjs.Type; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=components.cjs.map
|
|
16
16
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.js
CHANGED
package/dist/generators.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk26E4KLQS_cjs = require('./chunk-26E4KLQS.cjs');
|
|
4
|
+
require('./chunk-REQQ6E5S.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "oasGenerator", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk26E4KLQS_cjs.oasGenerator; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "typeGenerator", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk26E4KLQS_cjs.typeGenerator; }
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=generators.cjs.map
|
|
17
17
|
//# sourceMappingURL=generators.cjs.map
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { oasGenerator, typeGenerator } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { oasGenerator, typeGenerator } from './chunk-LYH2R6JZ.js';
|
|
2
|
+
import './chunk-6V4TF2LT.js';
|
|
3
3
|
//# sourceMappingURL=generators.js.map
|
|
4
4
|
//# sourceMappingURL=generators.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk26E4KLQS_cjs = require('./chunk-26E4KLQS.cjs');
|
|
4
|
+
require('./chunk-REQQ6E5S.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "pluginTs", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk26E4KLQS_cjs.pluginTs; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "pluginTsName", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk26E4KLQS_cjs.pluginTsName; }
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=index.cjs.map
|
|
17
17
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Generator plugin-ts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"!/**/__tests__/**"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@kubb/core": "3.
|
|
62
|
-
"@kubb/fs": "3.
|
|
63
|
-
"@kubb/oas": "3.
|
|
64
|
-
"@kubb/parser-ts": "3.
|
|
65
|
-
"@kubb/plugin-oas": "3.
|
|
66
|
-
"@kubb/react": "3.
|
|
61
|
+
"@kubb/core": "3.9.0",
|
|
62
|
+
"@kubb/fs": "3.9.0",
|
|
63
|
+
"@kubb/oas": "3.9.0",
|
|
64
|
+
"@kubb/parser-ts": "3.9.0",
|
|
65
|
+
"@kubb/plugin-oas": "3.9.0",
|
|
66
|
+
"@kubb/react": "3.9.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/react": "^18.3.20",
|
|
70
70
|
"react": "^18.3.1",
|
|
71
71
|
"tsup": "^8.4.0",
|
|
72
72
|
"typescript": "^5.8.3",
|
|
73
|
-
"@kubb/config-ts": "3.
|
|
74
|
-
"@kubb/config-tsup": "3.
|
|
73
|
+
"@kubb/config-ts": "3.9.0",
|
|
74
|
+
"@kubb/config-tsup": "3.9.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@kubb/react": "^3.0.0"
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* @description The value of this keyword MAY be null.\nUse of this keyword is functionally equivalent to an \"enum\" (Section 6.1.2) with a single value.\nAn instance validates successfully against this keyword if its value is equal to the value of the keyword.\n
|
|
3
8
|
*/
|
|
@@ -20,7 +20,13 @@ export const oasGenerator = createReactGenerator<PluginTs>({
|
|
|
20
20
|
const file = pluginManager.getFile({ name: 'oas', extname: '.ts', pluginKey })
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<File
|
|
23
|
+
<File
|
|
24
|
+
baseName={file.baseName}
|
|
25
|
+
path={file.path}
|
|
26
|
+
meta={file.meta}
|
|
27
|
+
banner={getBanner({ oas, output, config: pluginManager.config })}
|
|
28
|
+
footer={getFooter({ oas, output })}
|
|
29
|
+
>
|
|
24
30
|
<File.Import name={['Infer']} path="@kubb/oas" isTypeOnly />
|
|
25
31
|
|
|
26
32
|
<OasType name={'oas'} typeName={'Oas'} api={oas.api} />
|
|
@@ -163,7 +163,7 @@ export const typeGenerator = createReactGenerator<PluginTs>({
|
|
|
163
163
|
baseName={file.baseName}
|
|
164
164
|
path={file.path}
|
|
165
165
|
meta={file.meta}
|
|
166
|
-
banner={getBanner({ oas, output: plugin.options.output })}
|
|
166
|
+
banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}
|
|
167
167
|
footer={getFooter({ oas, output: plugin.options.output })}
|
|
168
168
|
>
|
|
169
169
|
{operationSchemas.map(mapOperationSchema)}
|
|
@@ -181,6 +181,7 @@ export const typeGenerator = createReactGenerator<PluginTs>({
|
|
|
181
181
|
plugin: {
|
|
182
182
|
options: { output },
|
|
183
183
|
},
|
|
184
|
+
pluginManager,
|
|
184
185
|
} = useApp<PluginTs>()
|
|
185
186
|
const oas = useOas()
|
|
186
187
|
|
|
@@ -198,7 +199,13 @@ export const typeGenerator = createReactGenerator<PluginTs>({
|
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
return (
|
|
201
|
-
<File
|
|
202
|
+
<File
|
|
203
|
+
baseName={type.file.baseName}
|
|
204
|
+
path={type.file.path}
|
|
205
|
+
meta={type.file.meta}
|
|
206
|
+
banner={getBanner({ oas, output, config: pluginManager.config })}
|
|
207
|
+
footer={getFooter({ oas, output })}
|
|
208
|
+
>
|
|
202
209
|
{mode === 'split' && imports.map((imp, index) => <File.Import key={index} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />)}
|
|
203
210
|
<Type
|
|
204
211
|
name={type.name}
|
package/src/parser.ts
CHANGED
|
@@ -81,7 +81,6 @@ export const typeKeywordMapper = {
|
|
|
81
81
|
type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),
|
|
82
82
|
uuid: () => factory.keywordTypeNodes.string,
|
|
83
83
|
url: () => factory.keywordTypeNodes.string,
|
|
84
|
-
strict: undefined,
|
|
85
84
|
default: undefined,
|
|
86
85
|
and: (nodes?: ts.TypeNode[]) => {
|
|
87
86
|
if (!nodes) {
|
|
@@ -118,6 +117,7 @@ export const typeKeywordMapper = {
|
|
|
118
117
|
schema: undefined,
|
|
119
118
|
catchall: undefined,
|
|
120
119
|
name: undefined,
|
|
120
|
+
interface: undefined,
|
|
121
121
|
} satisfies SchemaMapper<ts.Node | null | undefined>
|
|
122
122
|
|
|
123
123
|
type ParserOptions = {
|