@kubb/plugin-ts 5.0.0-alpha.11 → 5.0.0-alpha.12
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-CRu8IKY3.js → Type-CX1HRooG.js} +377 -365
- package/dist/Type-CX1HRooG.js.map +1 -0
- package/dist/Type-Cat0_htq.cjs +808 -0
- package/dist/Type-Cat0_htq.cjs.map +1 -0
- package/dist/components.cjs +3 -2
- package/dist/components.d.ts +40 -9
- package/dist/components.js +2 -2
- package/dist/generators-CLuCmfUz.js +532 -0
- package/dist/generators-CLuCmfUz.js.map +1 -0
- package/dist/generators-DWBU-MuW.cjs +536 -0
- package/dist/generators-DWBU-MuW.cjs.map +1 -0
- package/dist/generators.cjs +2 -3
- package/dist/generators.d.ts +3 -503
- package/dist/generators.js +2 -2
- package/dist/index.cjs +308 -4
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +26 -21
- package/dist/index.js +305 -2
- package/dist/index.js.map +1 -0
- package/dist/{types-mSXmB8WU.d.ts → types-BA1ZCQ5p.d.ts} +73 -57
- package/package.json +5 -5
- package/src/components/{v2/Enum.tsx → Enum.tsx} +27 -11
- package/src/components/Type.tsx +23 -141
- package/src/components/index.ts +1 -0
- package/src/generators/index.ts +0 -1
- package/src/generators/typeGenerator.tsx +189 -413
- package/src/generators/utils.ts +298 -0
- package/src/index.ts +1 -1
- package/src/plugin.ts +80 -126
- package/src/printer.ts +15 -4
- package/src/resolverTs.ts +109 -1
- package/src/types.ts +68 -52
- package/dist/components-CRu8IKY3.js.map +0 -1
- package/dist/components-DeNDKlzf.cjs +0 -982
- package/dist/components-DeNDKlzf.cjs.map +0 -1
- package/dist/plugin-CJ29AwE2.cjs +0 -1320
- package/dist/plugin-CJ29AwE2.cjs.map +0 -1
- package/dist/plugin-D60XNJSD.js +0 -1267
- package/dist/plugin-D60XNJSD.js.map +0 -1
- package/src/components/v2/Type.tsx +0 -59
- package/src/generators/v2/typeGenerator.tsx +0 -167
- package/src/generators/v2/utils.ts +0 -140
- package/src/parser.ts +0 -389
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,309 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const require_Type = require("./Type-Cat0_htq.cjs");
|
|
3
|
+
const require_generators = require("./generators-DWBU-MuW.cjs");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_Type.__toESM(node_path);
|
|
6
|
+
let _kubb_ast = require("@kubb/ast");
|
|
7
|
+
let _kubb_core = require("@kubb/core");
|
|
8
|
+
//#region src/resolverTs.ts
|
|
9
|
+
function resolveName(name, type) {
|
|
10
|
+
return require_Type.pascalCase(name, { isFile: type === "file" });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
|
|
14
|
+
* helpers used by the plugin. Import this in other plugins to resolve the exact names and
|
|
15
|
+
* paths that `plugin-ts` generates without hardcoding the conventions.
|
|
16
|
+
*
|
|
17
|
+
* The `default` method is automatically injected by `defineResolver` — it uses `camelCase`
|
|
18
|
+
* for identifiers/files and `pascalCase` for type names.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { resolver } from '@kubb/plugin-ts'
|
|
23
|
+
*
|
|
24
|
+
* resolver.default('list pets', 'type') // → 'ListPets'
|
|
25
|
+
* resolver.resolveName('list pets status 200') // → 'listPetsStatus200'
|
|
26
|
+
* resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'
|
|
27
|
+
* resolver.resolvePathName('list pets', 'file') // → 'listPets'
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
const resolverTs = (0, _kubb_core.defineResolver)(() => {
|
|
31
|
+
return {
|
|
32
|
+
default(name, type) {
|
|
33
|
+
return resolveName(name, type);
|
|
34
|
+
},
|
|
35
|
+
resolveName(name) {
|
|
36
|
+
return this.default(name, "function");
|
|
37
|
+
},
|
|
38
|
+
resolveTypedName(name) {
|
|
39
|
+
return this.default(name, "type");
|
|
40
|
+
},
|
|
41
|
+
resolvePathName(name, type) {
|
|
42
|
+
return this.default(name, type);
|
|
43
|
+
},
|
|
44
|
+
resolveParamName(node, param) {
|
|
45
|
+
return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`);
|
|
46
|
+
},
|
|
47
|
+
resolveParamTypedName(node, param) {
|
|
48
|
+
return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`);
|
|
49
|
+
},
|
|
50
|
+
resolveResponseStatusName(node, statusCode) {
|
|
51
|
+
return this.resolveName(`${node.operationId} Status ${statusCode}`);
|
|
52
|
+
},
|
|
53
|
+
resolveResponseStatusTypedName(node, statusCode) {
|
|
54
|
+
return this.resolveTypedName(`${node.operationId} Status ${statusCode}`);
|
|
55
|
+
},
|
|
56
|
+
resolveDataName(node) {
|
|
57
|
+
return this.resolveName(`${node.operationId} Data`);
|
|
58
|
+
},
|
|
59
|
+
resolveDataTypedName(node) {
|
|
60
|
+
return this.resolveTypedName(`${node.operationId} Data`);
|
|
61
|
+
},
|
|
62
|
+
resolveRequestConfigName(node) {
|
|
63
|
+
return this.resolveName(`${node.operationId} RequestConfig`);
|
|
64
|
+
},
|
|
65
|
+
resolveRequestConfigTypedName(node) {
|
|
66
|
+
return this.resolveTypedName(`${node.operationId} RequestConfig`);
|
|
67
|
+
},
|
|
68
|
+
resolveResponsesName(node) {
|
|
69
|
+
return this.resolveName(`${node.operationId} Responses`);
|
|
70
|
+
},
|
|
71
|
+
resolveResponsesTypedName(node) {
|
|
72
|
+
return this.resolveTypedName(`${node.operationId} Responses`);
|
|
73
|
+
},
|
|
74
|
+
resolveResponseName(node) {
|
|
75
|
+
return this.resolveName(`${node.operationId} Response`);
|
|
76
|
+
},
|
|
77
|
+
resolveResponseTypedName(node) {
|
|
78
|
+
return this.resolveTypedName(`${node.operationId} Response`);
|
|
79
|
+
},
|
|
80
|
+
resolveEnumKeyTypedName(node) {
|
|
81
|
+
return `${this.resolveTypedName(node.name ?? "")}Key`;
|
|
82
|
+
},
|
|
83
|
+
resolvePathParamsName(_node) {
|
|
84
|
+
throw new Error("resolvePathParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.");
|
|
85
|
+
},
|
|
86
|
+
resolvePathParamsTypedName(_node) {
|
|
87
|
+
throw new Error("resolvePathParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.");
|
|
88
|
+
},
|
|
89
|
+
resolveQueryParamsName(_node) {
|
|
90
|
+
throw new Error("resolveQueryParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.");
|
|
91
|
+
},
|
|
92
|
+
resolveQueryParamsTypedName(_node) {
|
|
93
|
+
throw new Error("resolveQueryParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.");
|
|
94
|
+
},
|
|
95
|
+
resolveHeaderParamsName(_node) {
|
|
96
|
+
throw new Error("resolveHeaderParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.");
|
|
97
|
+
},
|
|
98
|
+
resolveHeaderParamsTypedName(_node) {
|
|
99
|
+
throw new Error("resolveHeaderParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.");
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions
|
|
105
|
+
* used before the v2 resolver refactor. Enable via `legacy: true` in plugin options.
|
|
106
|
+
*
|
|
107
|
+
* Key differences from the default resolver:
|
|
108
|
+
* - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`
|
|
109
|
+
* - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`
|
|
110
|
+
* - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)
|
|
111
|
+
* - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`
|
|
112
|
+
* - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* import { resolverTsLegacy } from '@kubb/plugin-ts'
|
|
117
|
+
*
|
|
118
|
+
* resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'
|
|
119
|
+
* resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'
|
|
120
|
+
* resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)
|
|
121
|
+
* resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)
|
|
122
|
+
* resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
const resolverTsLegacy = (0, _kubb_core.defineResolver)(() => {
|
|
126
|
+
return {
|
|
127
|
+
...resolverTs,
|
|
128
|
+
resolveResponseStatusName(node, statusCode) {
|
|
129
|
+
if (statusCode === "default") return this.resolveName(`${node.operationId} Error`);
|
|
130
|
+
return this.resolveName(`${node.operationId} ${statusCode}`);
|
|
131
|
+
},
|
|
132
|
+
resolveResponseStatusTypedName(node, statusCode) {
|
|
133
|
+
if (statusCode === "default") return this.resolveTypedName(`${node.operationId} Error`);
|
|
134
|
+
return this.resolveTypedName(`${node.operationId} ${statusCode}`);
|
|
135
|
+
},
|
|
136
|
+
resolveDataName(node) {
|
|
137
|
+
const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
|
|
138
|
+
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
139
|
+
},
|
|
140
|
+
resolveDataTypedName(node) {
|
|
141
|
+
const suffix = node.method === "GET" ? "QueryRequest" : "MutationRequest";
|
|
142
|
+
return this.resolveTypedName(`${node.operationId} ${suffix}`);
|
|
143
|
+
},
|
|
144
|
+
resolveResponsesName(node) {
|
|
145
|
+
const suffix = node.method === "GET" ? "Query" : "Mutation";
|
|
146
|
+
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
147
|
+
},
|
|
148
|
+
resolveResponsesTypedName(node) {
|
|
149
|
+
const suffix = node.method === "GET" ? "Query" : "Mutation";
|
|
150
|
+
return this.resolveTypedName(`${node.operationId} ${suffix}`);
|
|
151
|
+
},
|
|
152
|
+
resolveResponseName(node) {
|
|
153
|
+
const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
|
|
154
|
+
return this.resolveName(`${node.operationId} ${suffix}`);
|
|
155
|
+
},
|
|
156
|
+
resolveResponseTypedName(node) {
|
|
157
|
+
const suffix = node.method === "GET" ? "QueryResponse" : "MutationResponse";
|
|
158
|
+
return this.resolveTypedName(`${node.operationId} ${suffix}`);
|
|
159
|
+
},
|
|
160
|
+
resolvePathParamsName(node) {
|
|
161
|
+
return this.resolveName(`${node.operationId} PathParams`);
|
|
162
|
+
},
|
|
163
|
+
resolvePathParamsTypedName(node) {
|
|
164
|
+
return this.resolveTypedName(`${node.operationId} PathParams`);
|
|
165
|
+
},
|
|
166
|
+
resolveQueryParamsName(node) {
|
|
167
|
+
return this.resolveName(`${node.operationId} QueryParams`);
|
|
168
|
+
},
|
|
169
|
+
resolveQueryParamsTypedName(node) {
|
|
170
|
+
return this.resolveTypedName(`${node.operationId} QueryParams`);
|
|
171
|
+
},
|
|
172
|
+
resolveHeaderParamsName(node) {
|
|
173
|
+
return this.resolveName(`${node.operationId} HeaderParams`);
|
|
174
|
+
},
|
|
175
|
+
resolveHeaderParamsTypedName(node) {
|
|
176
|
+
return this.resolveTypedName(`${node.operationId} HeaderParams`);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/plugin.ts
|
|
182
|
+
const pluginTsName = "plugin-ts";
|
|
183
|
+
const pluginTs = (0, _kubb_core.createPlugin)((options) => {
|
|
184
|
+
const { output = {
|
|
185
|
+
path: "types",
|
|
186
|
+
barrelType: "named"
|
|
187
|
+
}, group, exclude = [], include, override = [], enumType = "asConst", enumKeyCasing = "none", optionalType = "questionToken", arrayType = "array", syntaxType = "type", transformers = {}, paramsCasing, generators = [require_generators.typeGenerator].filter(Boolean), legacy = false } = options;
|
|
188
|
+
const baseResolver = legacy ? resolverTsLegacy : resolverTs;
|
|
189
|
+
const resolver = transformers?.name ? {
|
|
190
|
+
...baseResolver,
|
|
191
|
+
default(name, type) {
|
|
192
|
+
const resolved = baseResolver.default(name, type);
|
|
193
|
+
return transformers.name(resolved, type) || resolved;
|
|
194
|
+
}
|
|
195
|
+
} : baseResolver;
|
|
196
|
+
let resolveNameWarning = false;
|
|
197
|
+
return {
|
|
198
|
+
name: pluginTsName,
|
|
199
|
+
options: {
|
|
200
|
+
output,
|
|
201
|
+
transformers,
|
|
202
|
+
optionalType,
|
|
203
|
+
arrayType,
|
|
204
|
+
enumType,
|
|
205
|
+
enumKeyCasing,
|
|
206
|
+
syntaxType,
|
|
207
|
+
group,
|
|
208
|
+
override,
|
|
209
|
+
paramsCasing,
|
|
210
|
+
legacy,
|
|
211
|
+
resolver
|
|
212
|
+
},
|
|
213
|
+
resolvePath(baseName, pathMode, options) {
|
|
214
|
+
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
215
|
+
if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
|
|
216
|
+
/**
|
|
217
|
+
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
218
|
+
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
219
|
+
*/
|
|
220
|
+
return node_path.default.resolve(root, output.path);
|
|
221
|
+
if (group && (options?.group?.path || options?.group?.tag)) {
|
|
222
|
+
const groupName = group?.name ? group.name : (ctx) => {
|
|
223
|
+
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
224
|
+
return `${require_Type.camelCase(ctx.group)}Controller`;
|
|
225
|
+
};
|
|
226
|
+
return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
|
|
227
|
+
}
|
|
228
|
+
return node_path.default.resolve(root, output.path, baseName);
|
|
229
|
+
},
|
|
230
|
+
resolveName(name, type) {
|
|
231
|
+
if (!resolveNameWarning) {
|
|
232
|
+
this.driver.events.emit("warn", "Do not use resolveName for pluginTs, use resolverTs instead");
|
|
233
|
+
resolveNameWarning = true;
|
|
234
|
+
}
|
|
235
|
+
return resolver.default(name, type);
|
|
236
|
+
},
|
|
237
|
+
async install() {
|
|
238
|
+
const { config, fabric, plugin, adapter, rootNode, driver, openInStudio } = this;
|
|
239
|
+
const root = node_path.default.resolve(config.root, config.output.path);
|
|
240
|
+
const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
|
|
241
|
+
if (!adapter) throw new Error("Plugin cannot work without adapter being set");
|
|
242
|
+
await openInStudio({ ast: true });
|
|
243
|
+
await (0, _kubb_ast.walk)(rootNode, {
|
|
244
|
+
async schema(schemaNode) {
|
|
245
|
+
const writeTasks = generators.map(async (generator) => {
|
|
246
|
+
if (generator.type === "react" && generator.version === "2") {
|
|
247
|
+
const options = resolver.resolveOptions(schemaNode, {
|
|
248
|
+
options: plugin.options,
|
|
249
|
+
exclude,
|
|
250
|
+
include,
|
|
251
|
+
override
|
|
252
|
+
});
|
|
253
|
+
if (options === null) return;
|
|
254
|
+
await (0, _kubb_core.renderSchema)(schemaNode, {
|
|
255
|
+
options,
|
|
256
|
+
adapter,
|
|
257
|
+
config,
|
|
258
|
+
fabric,
|
|
259
|
+
Component: generator.Schema,
|
|
260
|
+
plugin,
|
|
261
|
+
driver,
|
|
262
|
+
mode
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
await Promise.all(writeTasks);
|
|
267
|
+
},
|
|
268
|
+
async operation(operationNode) {
|
|
269
|
+
const writeTasks = generators.map(async (generator) => {
|
|
270
|
+
if (generator.type === "react" && generator.version === "2") {
|
|
271
|
+
const options = resolver.resolveOptions(operationNode, {
|
|
272
|
+
options: plugin.options,
|
|
273
|
+
exclude,
|
|
274
|
+
include,
|
|
275
|
+
override
|
|
276
|
+
});
|
|
277
|
+
if (options === null) return;
|
|
278
|
+
await (0, _kubb_core.renderOperation)(operationNode, {
|
|
279
|
+
options,
|
|
280
|
+
adapter,
|
|
281
|
+
config,
|
|
282
|
+
fabric,
|
|
283
|
+
Component: generator.Operation,
|
|
284
|
+
plugin,
|
|
285
|
+
driver,
|
|
286
|
+
mode
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
await Promise.all(writeTasks);
|
|
291
|
+
}
|
|
292
|
+
}, { depth: "shallow" });
|
|
293
|
+
const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
|
|
294
|
+
type: output.barrelType ?? "named",
|
|
295
|
+
root,
|
|
296
|
+
output,
|
|
297
|
+
meta: { pluginName: this.plugin.name }
|
|
298
|
+
});
|
|
299
|
+
await this.upsertFile(...barrelFiles);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
//#endregion
|
|
304
|
+
exports.pluginTs = pluginTs;
|
|
305
|
+
exports.pluginTsName = pluginTsName;
|
|
306
|
+
exports.resolverTs = resolverTs;
|
|
307
|
+
exports.resolverTsLegacy = resolverTsLegacy;
|
|
308
|
+
|
|
309
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["pascalCase","typeGenerator","path","camelCase"],"sources":["../src/resolverTs.ts","../src/plugin.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginTs } from './types.ts'\n\nfunction resolveName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string {\n return pascalCase(name, { isFile: type === 'file' })\n}\n\n/**\n * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution\n * helpers used by the plugin. Import this in other plugins to resolve the exact names and\n * paths that `plugin-ts` generates without hardcoding the conventions.\n *\n * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`\n * for identifiers/files and `pascalCase` for type names.\n *\n * @example\n * ```ts\n * import { resolver } from '@kubb/plugin-ts'\n *\n * resolver.default('list pets', 'type') // → 'ListPets'\n * resolver.resolveName('list pets status 200') // → 'listPetsStatus200'\n * resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'\n * resolver.resolvePathName('list pets', 'file') // → 'listPets'\n * ```\n */\nexport const resolverTs = defineResolver<PluginTs>(() => {\n return {\n default(name, type) {\n return resolveName(name, type)\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolveTypedName(name) {\n return this.default(name, 'type')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveParamTypedName(node, param) {\n return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveName(`${node.operationId} Status ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n return this.resolveTypedName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveName(`${node.operationId} Data`)\n },\n resolveDataTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Data`)\n },\n resolveRequestConfigName(node) {\n return this.resolveName(`${node.operationId} RequestConfig`)\n },\n resolveRequestConfigTypedName(node) {\n return this.resolveTypedName(`${node.operationId} RequestConfig`)\n },\n resolveResponsesName(node) {\n return this.resolveName(`${node.operationId} Responses`)\n },\n resolveResponsesTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveName(`${node.operationId} Response`)\n },\n resolveResponseTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Response`)\n },\n resolveEnumKeyTypedName(node) {\n return `${this.resolveTypedName(node.name ?? '')}Key`\n },\n resolvePathParamsName(_node) {\n throw new Error('resolvePathParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.')\n },\n resolvePathParamsTypedName(_node) {\n throw new Error('resolvePathParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.')\n },\n resolveQueryParamsName(_node) {\n throw new Error('resolveQueryParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.')\n },\n resolveQueryParamsTypedName(_node) {\n throw new Error(\n 'resolveQueryParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.',\n )\n },\n resolveHeaderParamsName(_node) {\n throw new Error('resolveHeaderParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.')\n },\n resolveHeaderParamsTypedName(_node) {\n throw new Error(\n 'resolveHeaderParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.',\n )\n },\n }\n})\n\n/**\n * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions\n * used before the v2 resolver refactor. Enable via `legacy: true` in plugin options.\n *\n * Key differences from the default resolver:\n * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`\n * - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`\n * - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)\n * - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`\n * - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`\n *\n * @example\n * ```ts\n * import { resolverTsLegacy } from '@kubb/plugin-ts'\n *\n * resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'\n * resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'\n * resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)\n * resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)\n * resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)\n * ```\n */\nexport const resolverTsLegacy = defineResolver<PluginTs>(() => {\n return {\n ...resolverTs,\n resolveResponseStatusName(node, statusCode) {\n if (statusCode === 'default') {\n return this.resolveName(`${node.operationId} Error`)\n }\n return this.resolveName(`${node.operationId} ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n if (statusCode === 'default') {\n return this.resolveTypedName(`${node.operationId} Error`)\n }\n return this.resolveTypedName(`${node.operationId} ${statusCode}`)\n },\n resolveDataName(node) {\n const suffix = node.method === 'GET' ? 'QueryRequest' : 'MutationRequest'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveDataTypedName(node) {\n const suffix = node.method === 'GET' ? 'QueryRequest' : 'MutationRequest'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolveResponsesName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveResponsesTypedName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolveResponseName(node) {\n const suffix = node.method === 'GET' ? 'QueryResponse' : 'MutationResponse'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveResponseTypedName(node) {\n const suffix = node.method === 'GET' ? 'QueryResponse' : 'MutationResponse'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolvePathParamsName(node) {\n return this.resolveName(`${node.operationId} PathParams`)\n },\n resolvePathParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} PathParams`)\n },\n resolveQueryParamsName(node) {\n return this.resolveName(`${node.operationId} QueryParams`)\n },\n resolveQueryParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} QueryParams`)\n },\n resolveHeaderParamsName(node) {\n return this.resolveName(`${node.operationId} HeaderParams`)\n },\n resolveHeaderParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} HeaderParams`)\n },\n }\n})\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { walk } from '@kubb/ast'\nimport { createPlugin, type Group, getBarrelFiles, getMode, renderOperation, renderSchema } from '@kubb/core'\nimport { typeGenerator } from './generators'\nimport { resolverTs, resolverTsLegacy } from './resolverTs.ts'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = createPlugin<PluginTs>((options) => {\n const {\n output = { path: 'types', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumKeyCasing = 'none',\n optionalType = 'questionToken',\n arrayType = 'array',\n syntaxType = 'type',\n transformers = {},\n paramsCasing,\n generators = [typeGenerator].filter(Boolean),\n legacy = false,\n } = options\n\n const baseResolver = legacy ? resolverTsLegacy : resolverTs\n\n // When a `transformers.name` callback is provided, wrap the resolver so that\n // every name produced by `default()` (and therefore by every helper that calls\n // `this.default(...)`) flows through the user's transformer.\n const resolver: typeof baseResolver = transformers?.name\n ? {\n ...baseResolver,\n default(name, type) {\n const resolved = baseResolver.default(name, type)\n\n return transformers.name!(resolved, type) || resolved\n },\n }\n : baseResolver\n\n let resolveNameWarning = false\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n optionalType,\n arrayType,\n enumType,\n enumKeyCasing,\n syntaxType,\n group,\n override,\n paramsCasing,\n legacy,\n resolver,\n },\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n if (!resolveNameWarning) {\n this.driver.events.emit('warn', 'Do not use resolveName for pluginTs, use resolverTs instead')\n resolveNameWarning = true\n }\n\n return resolver.default(name, type)\n },\n async install() {\n const { config, fabric, plugin, adapter, rootNode, driver, openInStudio } = this\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n if (!adapter) {\n throw new Error('Plugin cannot work without adapter being set')\n }\n\n await openInStudio({ ast: true })\n\n await walk(\n rootNode,\n {\n async schema(schemaNode) {\n const writeTasks = generators.map(async (generator) => {\n if (generator.type === 'react' && generator.version === '2') {\n const options = resolver.resolveOptions(schemaNode, { options: plugin.options, exclude, include, override })\n\n if (options === null) {\n return\n }\n\n await renderSchema(schemaNode, {\n options,\n adapter,\n config,\n fabric,\n Component: generator.Schema,\n plugin,\n driver,\n mode,\n })\n }\n })\n\n await Promise.all(writeTasks)\n },\n async operation(operationNode) {\n const writeTasks = generators.map(async (generator) => {\n if (generator.type === 'react' && generator.version === '2') {\n const options = resolver.resolveOptions(operationNode, { options: plugin.options, exclude, include, override })\n\n if (options === null) {\n return\n }\n\n await renderOperation(operationNode, {\n options,\n adapter,\n config,\n fabric,\n Component: generator.Operation,\n plugin,\n driver,\n mode,\n })\n }\n })\n\n await Promise.all(writeTasks)\n },\n },\n { depth: 'shallow' },\n )\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;AAIA,SAAS,YAAY,MAAc,MAAuD;AACx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F,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { n as PluginTs, t as Options } from "./types-
|
|
2
|
+
import { n as PluginTs, r as ResolverTs, t as Options } from "./types-BA1ZCQ5p.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
|
-
import * as _kubb_ast_types0 from "@kubb/ast/types";
|
|
5
4
|
|
|
6
5
|
//#region src/plugin.d.ts
|
|
7
6
|
declare const pluginTsName = "plugin-ts";
|
|
@@ -26,24 +25,30 @@ declare const pluginTs: (options?: Options | undefined) => _kubb_core0.UserPlugi
|
|
|
26
25
|
* resolver.resolvePathName('list pets', 'file') // → 'listPets'
|
|
27
26
|
* ```
|
|
28
27
|
*/
|
|
29
|
-
declare const resolverTs:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
declare const resolverTs: ResolverTs;
|
|
29
|
+
/**
|
|
30
|
+
* Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions
|
|
31
|
+
* used before the v2 resolver refactor. Enable via `legacy: true` in plugin options.
|
|
32
|
+
*
|
|
33
|
+
* Key differences from the default resolver:
|
|
34
|
+
* - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`
|
|
35
|
+
* - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`
|
|
36
|
+
* - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)
|
|
37
|
+
* - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`
|
|
38
|
+
* - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { resolverTsLegacy } from '@kubb/plugin-ts'
|
|
43
|
+
*
|
|
44
|
+
* resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'
|
|
45
|
+
* resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'
|
|
46
|
+
* resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)
|
|
47
|
+
* resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)
|
|
48
|
+
* resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const resolverTsLegacy: ResolverTs;
|
|
47
52
|
//#endregion
|
|
48
|
-
export { type PluginTs, pluginTs, pluginTsName, resolverTs };
|
|
53
|
+
export { type PluginTs, pluginTs, pluginTsName, resolverTs, resolverTsLegacy };
|
|
49
54
|
//# sourceMappingURL=index.d.ts.map
|