@kubb/plugin-ts 5.0.0-alpha.15 → 5.0.0-alpha.17

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 (45) hide show
  1. package/dist/{Type-C8EHVKjc.js → Type-CEYpKTNb.js} +9 -6
  2. package/dist/Type-CEYpKTNb.js.map +1 -0
  3. package/dist/{Type-DrOq6-nh.cjs → Type-DQjV9V0o.cjs} +8 -5
  4. package/dist/Type-DQjV9V0o.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +1 -1
  7. package/dist/components.js +1 -1
  8. package/dist/{generators-B6JGhHkV.cjs → generators-SVexNxhl.cjs} +16 -13
  9. package/dist/generators-SVexNxhl.cjs.map +1 -0
  10. package/dist/{generators-BTTcjgbY.js → generators-huxvj9y4.js} +17 -14
  11. package/dist/generators-huxvj9y4.js.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +1 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +23 -9
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +2 -3
  18. package/dist/index.js +27 -10
  19. package/dist/index.js.map +1 -1
  20. package/dist/{resolvers-C_vYX56l.js → resolvers-DsKabI0F.js} +7 -6
  21. package/dist/resolvers-DsKabI0F.js.map +1 -0
  22. package/dist/{resolvers-DDZC7d43.cjs → resolvers-YIpeP5YD.cjs} +7 -6
  23. package/dist/resolvers-YIpeP5YD.cjs.map +1 -0
  24. package/dist/resolvers.cjs +1 -1
  25. package/dist/resolvers.d.ts +52 -2
  26. package/dist/resolvers.js +1 -1
  27. package/dist/{types-D9zzvE0V.d.ts → types-zqLMbIqZ.d.ts} +20 -18
  28. package/package.json +5 -5
  29. package/src/components/Type.tsx +3 -2
  30. package/src/generators/typeGenerator.tsx +24 -10
  31. package/src/generators/utils.ts +3 -2
  32. package/src/index.ts +0 -1
  33. package/src/plugin.ts +10 -8
  34. package/src/presets.ts +23 -0
  35. package/src/printer.ts +7 -4
  36. package/src/resolvers/resolverTs.ts +6 -4
  37. package/src/resolvers/resolverTsLegacy.ts +2 -1
  38. package/src/types.ts +19 -17
  39. package/dist/Type-C8EHVKjc.js.map +0 -1
  40. package/dist/Type-DrOq6-nh.cjs.map +0 -1
  41. package/dist/generators-B6JGhHkV.cjs.map +0 -1
  42. package/dist/generators-BTTcjgbY.js.map +0 -1
  43. package/dist/index-B5pSjbZv.d.ts +0 -51
  44. package/dist/resolvers-C_vYX56l.js.map +0 -1
  45. package/dist/resolvers-DDZC7d43.cjs.map +0 -1
@@ -77,10 +77,10 @@ const resolverTs = (0, _kubb_core.defineResolver)(() => {
77
77
  return `${this.resolveTypedName(node.name ?? "")}Key`;
78
78
  },
79
79
  resolvePathParamsName(_node) {
80
- throw new Error("resolvePathParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.");
80
+ throw new Error("resolvePathParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.");
81
81
  },
82
82
  resolvePathParamsTypedName(_node) {
83
- throw new Error("resolvePathParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.");
83
+ throw new Error("resolvePathParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.");
84
84
  },
85
85
  resolveQueryParamsName(node) {
86
86
  return this.resolveName(`${node.operationId} QueryParams`);
@@ -89,10 +89,10 @@ const resolverTs = (0, _kubb_core.defineResolver)(() => {
89
89
  return this.resolveTypedName(`${node.operationId} QueryParams`);
90
90
  },
91
91
  resolveHeaderParamsName(_node) {
92
- throw new Error("resolveHeaderParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.");
92
+ throw new Error("resolveHeaderParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.");
93
93
  },
94
94
  resolveHeaderParamsTypedName(_node) {
95
- throw new Error("resolveHeaderParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.");
95
+ throw new Error("resolveHeaderParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.");
96
96
  }
97
97
  };
98
98
  });
@@ -100,7 +100,8 @@ const resolverTs = (0, _kubb_core.defineResolver)(() => {
100
100
  //#region src/resolvers/resolverTsLegacy.ts
101
101
  /**
102
102
  * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions
103
- * used before the v2 resolver refactor. Enable via `legacy: true` in plugin options.
103
+ * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`
104
+ * (or by composing this resolver manually).
104
105
  *
105
106
  * Key differences from the default resolver:
106
107
  * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`
@@ -190,4 +191,4 @@ Object.defineProperty(exports, "resolverTsLegacy", {
190
191
  }
191
192
  });
192
193
 
193
- //# sourceMappingURL=resolvers-DDZC7d43.cjs.map
194
+ //# sourceMappingURL=resolvers-YIpeP5YD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvers-YIpeP5YD.cjs","names":["pascalCase"],"sources":["../src/resolvers/resolverTs.ts","../src/resolvers/resolverTsLegacy.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 name: 'default',\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 with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.\")\n },\n resolvePathParamsTypedName(_node) {\n throw new Error(\n \"resolvePathParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.\",\n )\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 throw new Error(\"resolveHeaderParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.\")\n },\n resolveHeaderParamsTypedName(_node) {\n throw new Error(\n \"resolveHeaderParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.\",\n )\n },\n }\n})\n","import { defineResolver } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\nimport { resolverTs } from './resolverTs.ts'\n\n/**\n * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions\n * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`\n * (or by composing this resolver manually).\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 name: 'legacy',\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.default(node.operationId, 'function')}${suffix}`\n },\n resolveResponsesTypedName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return `${this.default(node.operationId, 'type')}${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"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_resolvers = require("./resolvers-DDZC7d43.cjs");
2
+ const require_resolvers = require("./resolvers-YIpeP5YD.cjs");
3
3
  exports.resolverTs = require_resolvers.resolverTs;
4
4
  exports.resolverTsLegacy = require_resolvers.resolverTsLegacy;
@@ -1,2 +1,52 @@
1
- import { n as resolverTs, t as resolverTsLegacy } from "./index-B5pSjbZv.js";
2
- export { resolverTs, resolverTsLegacy };
1
+ import { t as __name } from "./chunk--u3MIqq1.js";
2
+ import { r as ResolverTs } from "./types-zqLMbIqZ.js";
3
+
4
+ //#region src/resolvers/resolverTs.d.ts
5
+ /**
6
+ * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
7
+ * helpers used by the plugin. Import this in other plugins to resolve the exact names and
8
+ * paths that `plugin-ts` generates without hardcoding the conventions.
9
+ *
10
+ * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`
11
+ * for identifiers/files and `pascalCase` for type names.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { resolver } from '@kubb/plugin-ts'
16
+ *
17
+ * resolver.default('list pets', 'type') // → 'ListPets'
18
+ * resolver.resolveName('list pets status 200') // → 'listPetsStatus200'
19
+ * resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'
20
+ * resolver.resolvePathName('list pets', 'file') // → 'listPets'
21
+ * ```
22
+ */
23
+ declare const resolverTs: ResolverTs;
24
+ //#endregion
25
+ //#region src/resolvers/resolverTsLegacy.d.ts
26
+ /**
27
+ * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions
28
+ * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`
29
+ * (or by composing this resolver manually).
30
+ *
31
+ * Key differences from the default resolver:
32
+ * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`
33
+ * - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`
34
+ * - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)
35
+ * - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`
36
+ * - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { resolverTsLegacy } from '@kubb/plugin-ts'
41
+ *
42
+ * resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'
43
+ * resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'
44
+ * resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)
45
+ * resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)
46
+ * resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)
47
+ * ```
48
+ */
49
+ declare const resolverTsLegacy: ResolverTs;
50
+ //#endregion
51
+ export { resolverTs, resolverTsLegacy };
52
+ //# sourceMappingURL=resolvers.d.ts.map
package/dist/resolvers.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as resolverTs, t as resolverTsLegacy } from "./resolvers-C_vYX56l.js";
1
+ import { n as resolverTs, t as resolverTsLegacy } from "./resolvers-DsKabI0F.js";
2
2
  export { resolverTs, resolverTsLegacy };
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { Group, Output, PluginFactoryOptions, Resolver } from "@kubb/core";
2
+ import { CompatibilityPreset, Group, Output, PluginFactoryOptions, Resolver } from "@kubb/core";
3
3
  import { OperationNode, ParameterNode, SchemaNode, StatusCode, Visitor } from "@kubb/ast/types";
4
4
  import { Oas, contentType } from "@kubb/oas";
5
5
  import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
@@ -137,54 +137,54 @@ type ResolverTs = Resolver & {
137
137
  resolveEnumKeyTypedName(node: SchemaNode): string;
138
138
  /**
139
139
  * Resolves the variable/function name for an operation's grouped path parameters type.
140
- * Only available in legacy mode (`legacy: true`).
140
+ * Only available with `compatibilityPreset: 'kubbV4'`.
141
141
  *
142
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamName` per individual parameter instead.
142
+ * @deprecated Kubb v4 compatibility only — use `resolveParamName` per individual parameter instead.
143
143
  * @example
144
144
  * resolver.resolvePathParamsName(node) // → 'GetPetByIdPathParams'
145
145
  */
146
146
  resolvePathParamsName?(node: OperationNode): string;
147
147
  /**
148
148
  * Resolves the TypeScript type alias name for an operation's grouped path parameters type.
149
- * Only available in legacy mode (`legacy: true`).
149
+ * Only available with `compatibilityPreset: 'kubbV4'`.
150
150
  *
151
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamTypedName` per individual parameter instead.
151
+ * @deprecated Kubb v4 compatibility only — use `resolveParamTypedName` per individual parameter instead.
152
152
  * @example
153
153
  * resolver.resolvePathParamsTypedName(node) // → 'GetPetByIdPathParams'
154
154
  */
155
155
  resolvePathParamsTypedName?(node: OperationNode): string;
156
156
  /**
157
157
  * Resolves the variable/function name for an operation's grouped query parameters type.
158
- * Only available in legacy mode (`legacy: true`).
158
+ * Only available with `compatibilityPreset: 'kubbV4'`.
159
159
  *
160
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamName` per individual parameter instead.
160
+ * @deprecated Kubb v4 compatibility only — use `resolveParamName` per individual parameter instead.
161
161
  * @example
162
162
  * resolver.resolveQueryParamsName(node) // → 'FindPetsByStatusQueryParams'
163
163
  */
164
164
  resolveQueryParamsName?(node: OperationNode): string;
165
165
  /**
166
166
  * Resolves the TypeScript type alias name for an operation's grouped query parameters type.
167
- * Only available in legacy mode (`legacy: true`).
167
+ * Only available with `compatibilityPreset: 'kubbV4'`.
168
168
  *
169
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamTypedName` per individual parameter instead.
169
+ * @deprecated Kubb v4 compatibility only — use `resolveParamTypedName` per individual parameter instead.
170
170
  * @example
171
171
  * resolver.resolveQueryParamsTypedName(node) // → 'FindPetsByStatusQueryParams'
172
172
  */
173
173
  resolveQueryParamsTypedName?(node: OperationNode): string;
174
174
  /**
175
175
  * Resolves the variable/function name for an operation's grouped header parameters type.
176
- * Only available in legacy mode (`legacy: true`).
176
+ * Only available with `compatibilityPreset: 'kubbV4'`.
177
177
  *
178
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamName` per individual parameter instead.
178
+ * @deprecated Kubb v4 compatibility only — use `resolveParamName` per individual parameter instead.
179
179
  * @example
180
180
  * resolver.resolveHeaderParamsName(node) // → 'DeletePetHeaderParams'
181
181
  */
182
182
  resolveHeaderParamsName?(node: OperationNode): string;
183
183
  /**
184
184
  * Resolves the TypeScript type alias name for an operation's grouped header parameters type.
185
- * Only available in legacy mode (`legacy: true`).
185
+ * Only available with `compatibilityPreset: 'kubbV4'`.
186
186
  *
187
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamTypedName` per individual parameter instead.
187
+ * @deprecated Kubb v4 compatibility only — use `resolveParamTypedName` per individual parameter instead.
188
188
  * @example
189
189
  * resolver.resolveHeaderParamsTypedName(node) // → 'DeletePetHeaderParams'
190
190
  */
@@ -277,10 +277,12 @@ type Options = {
277
277
  */
278
278
  UNSTABLE_NAMING?: true;
279
279
  /**
280
- * Enable legacy naming conventions for backwards compatibility.
281
- * @default false
280
+ * Apply a compatibility naming preset.
281
+ * Use `kubbV4` for strict v4 type-generation compatibility.
282
+ * You can further customize naming with `resolvers`.
283
+ * @default 'default'
282
284
  */
283
- legacy?: boolean;
285
+ compatibilityPreset?: CompatibilityPreset;
284
286
  /**
285
287
  * Array of named resolvers that control naming conventions.
286
288
  * Later entries override earlier ones (last wins).
@@ -322,7 +324,7 @@ type ResolvedOptions = {
322
324
  arrayType: NonNullable<Options['arrayType']>;
323
325
  syntaxType: NonNullable<Options['syntaxType']>;
324
326
  paramsCasing: Options['paramsCasing'];
325
- legacy: NonNullable<Options['legacy']>;
327
+ compatibilityPreset: NonNullable<CompatibilityPreset>;
326
328
  resolver: ResolverTs;
327
329
  /**
328
330
  * The resolver without user naming overrides applied.
@@ -335,4 +337,4 @@ type ResolvedOptions = {
335
337
  type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions, ResolverTs>;
336
338
  //#endregion
337
339
  export { PluginTs as n, ResolverTs as r, Options as t };
338
- //# sourceMappingURL=types-D9zzvE0V.d.ts.map
340
+ //# sourceMappingURL=types-zqLMbIqZ.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-ts",
3
- "version": "5.0.0-alpha.15",
3
+ "version": "5.0.0-alpha.17",
4
4
  "description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -78,10 +78,10 @@
78
78
  "@kubb/react-fabric": "0.14.0",
79
79
  "remeda": "^2.33.6",
80
80
  "typescript": "5.9.3",
81
- "@kubb/core": "5.0.0-alpha.15",
82
- "@kubb/oas": "5.0.0-alpha.15",
83
- "@kubb/ast": "5.0.0-alpha.15",
84
- "@kubb/plugin-oas": "5.0.0-alpha.15"
81
+ "@kubb/ast": "5.0.0-alpha.17",
82
+ "@kubb/oas": "5.0.0-alpha.17",
83
+ "@kubb/core": "5.0.0-alpha.17",
84
+ "@kubb/plugin-oas": "5.0.0-alpha.17"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@kubb/react-fabric": "0.14.0"
@@ -1,4 +1,4 @@
1
- import { collect } from '@kubb/ast'
1
+ import { collect, narrowSchema, schemaTypes } from '@kubb/ast'
2
2
  import type { EnumSchemaNode, SchemaNode } from '@kubb/ast/types'
3
3
  import { safePrint } from '@kubb/fabric-core/parsers/typescript'
4
4
  import { File } from '@kubb/react-fabric'
@@ -38,7 +38,8 @@ export function Type({
38
38
  const resolvedDescription = description || node?.description
39
39
  const enumSchemaNodes = collect<EnumSchemaNode>(node, {
40
40
  schema(n): EnumSchemaNode | undefined {
41
- if (n.type === 'enum' && n.name) return n as EnumSchemaNode
41
+ const enumNode = narrowSchema(n, schemaTypes.enum)
42
+ if (enumNode?.name) return enumNode
42
43
  },
43
44
  })
44
45
 
@@ -1,4 +1,4 @@
1
- import { applyParamsCasing, composeTransformers, transform } from '@kubb/ast'
1
+ import { caseParams, composeTransformers, narrowSchema, schemaTypes, transform } from '@kubb/ast'
2
2
  import type { SchemaNode } from '@kubb/ast/types'
3
3
  import { defineGenerator } from '@kubb/core'
4
4
  import { useKubb } from '@kubb/core/hooks'
@@ -21,7 +21,20 @@ export const typeGenerator = defineGenerator<PluginTs>({
21
21
  name: 'typescript',
22
22
  type: 'react',
23
23
  Operation({ node, adapter, options }) {
24
- const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy, transformers = [] } = options
24
+ const {
25
+ enumType,
26
+ enumKeyCasing,
27
+ optionalType,
28
+ arrayType,
29
+ syntaxType,
30
+ paramsCasing,
31
+ group,
32
+ resolver,
33
+ baseResolver,
34
+ compatibilityPreset,
35
+ transformers = [],
36
+ } = options
37
+ const isKubbV4Compatibility = compatibilityPreset === 'kubbV4'
25
38
  const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()
26
39
 
27
40
  const file = getFile({
@@ -32,7 +45,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
32
45
  group: group ? (group.type === 'tag' ? { tag: node.tags[0] ?? 'default' } : { path: node.path }) : undefined,
33
46
  },
34
47
  })
35
- const params = applyParamsCasing(node.parameters, paramsCasing)
48
+ const params = caseParams(node.parameters, paramsCasing)
36
49
 
37
50
  function renderSchemaType({
38
51
  node: schemaNode,
@@ -74,13 +87,13 @@ export const typeGenerator = defineGenerator<PluginTs>({
74
87
  syntaxType={syntaxType}
75
88
  resolver={resolver}
76
89
  keysToOmit={keysToOmit}
77
- legacy={legacy}
90
+ legacy={isKubbV4Compatibility}
78
91
  />
79
92
  </>
80
93
  )
81
94
  }
82
95
 
83
- const responseTypes = legacy
96
+ const responseTypes = isKubbV4Compatibility
84
97
  ? node.responses.map((res) => {
85
98
  const responseName = resolver.resolveResponseStatusName(node, res.statusCode)
86
99
  const baseResponseName = baseResolver.resolveResponseStatusName(node, res.statusCode)
@@ -105,7 +118,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
105
118
 
106
119
  const requestType = node.requestBody?.schema
107
120
  ? renderSchemaType({
108
- node: legacy ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(node)) : node.requestBody.schema,
121
+ node: isKubbV4Compatibility ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(node)) : node.requestBody.schema,
109
122
  name: resolver.resolveDataName(node),
110
123
  typedName: resolver.resolveDataTypedName(node),
111
124
  description: node.requestBody.description ?? node.requestBody.schema.description,
@@ -113,7 +126,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
113
126
  })
114
127
  : null
115
128
 
116
- if (legacy) {
129
+ if (isKubbV4Compatibility) {
117
130
  const pathParams = params.filter((p) => p.in === 'path')
118
131
  const queryParams = params.filter((p) => p.in === 'query')
119
132
  const headerParams = params.filter((p) => p.in === 'header')
@@ -215,7 +228,8 @@ export const typeGenerator = defineGenerator<PluginTs>({
215
228
  )
216
229
  },
217
230
  Schema({ node, adapter, options }) {
218
- const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy, transformers = [] } = options
231
+ const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, compatibilityPreset, transformers = [] } = options
232
+ const isKubbV4Compatibility = compatibilityPreset === 'kubbV4'
219
233
  const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()
220
234
 
221
235
  if (!node.name) {
@@ -229,7 +243,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
229
243
  path: getFile({ name: schemaName, extname: '.ts', mode }).path,
230
244
  }))
231
245
 
232
- const isEnumSchema = node.type === 'enum'
246
+ const isEnumSchema = !!narrowSchema(node, schemaTypes.enum)
233
247
 
234
248
  const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : resolver.resolveTypedName(node.name)
235
249
 
@@ -255,7 +269,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
255
269
  arrayType={arrayType}
256
270
  syntaxType={syntaxType}
257
271
  resolver={resolver}
258
- legacy={legacy}
272
+ legacy={isKubbV4Compatibility}
259
273
  />
260
274
  </File>
261
275
  )
@@ -288,8 +288,9 @@ export function buildLegacyResponseUnionSchemaNode({ node, resolver }: BuildOper
288
288
  export function nameUnnamedEnums(node: SchemaNode, parentName: string): SchemaNode {
289
289
  return transform(node, {
290
290
  schema(n) {
291
- if (n.type === 'enum' && !n.name) {
292
- return { ...n, name: pascalCase([parentName, 'enum'].join(' ')) }
291
+ const enumNode = narrowSchema(n, 'enum')
292
+ if (enumNode && !enumNode.name) {
293
+ return { ...enumNode, name: pascalCase([parentName, 'enum'].join(' ')) }
293
294
  }
294
295
  return undefined
295
296
  },
package/src/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { pluginTs, pluginTsName } from './plugin.ts'
2
- export { resolverTs, resolverTsLegacy } from './resolvers/index.ts'
3
2
  export type { PluginTs, ResolverTs } from './types.ts'
package/src/plugin.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase } from '@internals/utils'
3
3
  import { walk } from '@kubb/ast'
4
- import { createPlugin, type Group, getBarrelFiles, getMode, mergeResolvers, renderOperation, renderSchema } from '@kubb/core'
4
+ import { createPlugin, type Group, getBarrelFiles, getMode, renderOperation, renderSchema } from '@kubb/core'
5
5
  import { typeGenerator } from './generators/index.ts'
6
- import { resolverTs, resolverTsLegacy } from './resolvers/index.ts'
6
+ import { getPreset } from './presets.ts'
7
7
  import type { PluginTs } from './types.ts'
8
8
 
9
9
  export const pluginTsName = 'plugin-ts' satisfies PluginTs['name']
@@ -22,13 +22,15 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
22
22
  syntaxType = 'type',
23
23
  paramsCasing,
24
24
  generators = [typeGenerator].filter(Boolean),
25
- legacy = false,
25
+ compatibilityPreset = 'default',
26
26
  resolvers: userResolvers,
27
- transformers = [],
27
+ transformers: userTransformers = [],
28
28
  } = options
29
29
 
30
- const baseResolver = legacy ? resolverTsLegacy : resolverTs
31
- const resolver = mergeResolvers(...(userResolvers ?? [baseResolver]))
30
+ const { baseResolver, resolver, transformers } = getPreset(compatibilityPreset, {
31
+ resolvers: userResolvers,
32
+ transformers: userTransformers,
33
+ })
32
34
 
33
35
  let resolveNameWarning = false
34
36
 
@@ -44,9 +46,9 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
44
46
  group,
45
47
  override,
46
48
  paramsCasing,
47
- legacy,
48
- resolver,
49
+ compatibilityPreset,
49
50
  baseResolver,
51
+ resolver,
50
52
  transformers,
51
53
  },
52
54
  resolvePath(baseName, pathMode, options) {
package/src/presets.ts ADDED
@@ -0,0 +1,23 @@
1
+ import type { Visitor } from '@kubb/ast/types'
2
+ import { type CompatibilityPreset, definePreset, definePresets, getPreset as getCorePreset } from '@kubb/core'
3
+ import { resolverTs, resolverTsLegacy } from './resolvers/index.ts'
4
+ import type { ResolverTs } from './types.ts'
5
+
6
+ export const presets = definePresets<ResolverTs>({
7
+ default: definePreset('default', { resolvers: [resolverTs] }),
8
+ kubbV4: definePreset('kubbV4', { resolvers: [resolverTsLegacy] }),
9
+ })
10
+
11
+ type GetPresetOptions = {
12
+ resolvers?: Array<ResolverTs>
13
+ transformers?: Array<Visitor>
14
+ }
15
+
16
+ export function getPreset(preset: CompatibilityPreset, { resolvers, transformers }: GetPresetOptions = {}) {
17
+ return getCorePreset({
18
+ preset,
19
+ presets,
20
+ resolvers: [resolverTs, ...(resolvers ?? [])],
21
+ transformers,
22
+ })
23
+ }
package/src/printer.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsStringEscape, stringify } from '@internals/utils'
2
- import { isPlainStringType } from '@kubb/ast'
2
+ import { isStringType, narrowSchema, schemaTypes } from '@kubb/ast'
3
3
  import type { ArraySchemaNode, SchemaNode } from '@kubb/ast/types'
4
4
  import type { PrinterFactoryOptions } from '@kubb/core'
5
5
  import { definePrinter } from '@kubb/core'
@@ -271,13 +271,16 @@ export const printerTs = definePrinter<TsPrinter>((options) => {
271
271
  union(node) {
272
272
  const members = node.members ?? []
273
273
 
274
- const hasStringLiteral = members.some((m) => m.type === 'enum' && (m.enumType === 'string' || m.primitive === 'string'))
275
- const hasPlainString = members.some((m) => isPlainStringType(m))
274
+ const hasStringLiteral = members.some((m) => {
275
+ const enumNode = narrowSchema(m, schemaTypes.enum)
276
+ return enumNode?.primitive === 'string'
277
+ })
278
+ const hasPlainString = members.some((m) => isStringType(m))
276
279
 
277
280
  if (hasStringLiteral && hasPlainString) {
278
281
  const memberNodes = members
279
282
  .map((m) => {
280
- if (isPlainStringType(m)) {
283
+ if (isStringType(m)) {
281
284
  return factory.createIntersectionDeclaration({
282
285
  nodes: [factory.keywordTypeNodes.string, factory.createTypeLiteralNode([])],
283
286
  withParentheses: true,
@@ -79,10 +79,12 @@ export const resolverTs = defineResolver<PluginTs>(() => {
79
79
  return `${this.resolveTypedName(node.name ?? '')}Key`
80
80
  },
81
81
  resolvePathParamsName(_node) {
82
- throw new Error('resolvePathParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.')
82
+ throw new Error("resolvePathParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.")
83
83
  },
84
84
  resolvePathParamsTypedName(_node) {
85
- throw new Error('resolvePathParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.')
85
+ throw new Error(
86
+ "resolvePathParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.",
87
+ )
86
88
  },
87
89
  resolveQueryParamsName(node) {
88
90
  return this.resolveName(`${node.operationId} QueryParams`)
@@ -91,11 +93,11 @@ export const resolverTs = defineResolver<PluginTs>(() => {
91
93
  return this.resolveTypedName(`${node.operationId} QueryParams`)
92
94
  },
93
95
  resolveHeaderParamsName(_node) {
94
- throw new Error('resolveHeaderParamsName is only available in legacy mode (legacy: true). Use resolveParamName per individual parameter instead.')
96
+ throw new Error("resolveHeaderParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.")
95
97
  },
96
98
  resolveHeaderParamsTypedName(_node) {
97
99
  throw new Error(
98
- 'resolveHeaderParamsTypedName is only available in legacy mode (legacy: true). Use resolveParamTypedName per individual parameter instead.',
100
+ "resolveHeaderParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.",
99
101
  )
100
102
  },
101
103
  }
@@ -4,7 +4,8 @@ import { resolverTs } from './resolverTs.ts'
4
4
 
5
5
  /**
6
6
  * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions
7
- * used before the v2 resolver refactor. Enable via `legacy: true` in plugin options.
7
+ * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`
8
+ * (or by composing this resolver manually).
8
9
  *
9
10
  * Key differences from the default resolver:
10
11
  * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { OperationNode, ParameterNode, SchemaNode, StatusCode, Visitor } from '@kubb/ast/types'
2
- import type { Group, Output, PluginFactoryOptions, Resolver } from '@kubb/core'
2
+ import type { CompatibilityPreset, Group, Output, PluginFactoryOptions, Resolver } from '@kubb/core'
3
3
  import type { contentType, Oas } from '@kubb/oas'
4
4
  import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
5
5
  import type { Generator } from '@kubb/plugin-oas/generators'
@@ -135,54 +135,54 @@ export type ResolverTs = Resolver & {
135
135
  resolveEnumKeyTypedName(node: SchemaNode): string
136
136
  /**
137
137
  * Resolves the variable/function name for an operation's grouped path parameters type.
138
- * Only available in legacy mode (`legacy: true`).
138
+ * Only available with `compatibilityPreset: 'kubbV4'`.
139
139
  *
140
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamName` per individual parameter instead.
140
+ * @deprecated Kubb v4 compatibility only — use `resolveParamName` per individual parameter instead.
141
141
  * @example
142
142
  * resolver.resolvePathParamsName(node) // → 'GetPetByIdPathParams'
143
143
  */
144
144
  resolvePathParamsName?(node: OperationNode): string
145
145
  /**
146
146
  * Resolves the TypeScript type alias name for an operation's grouped path parameters type.
147
- * Only available in legacy mode (`legacy: true`).
147
+ * Only available with `compatibilityPreset: 'kubbV4'`.
148
148
  *
149
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamTypedName` per individual parameter instead.
149
+ * @deprecated Kubb v4 compatibility only — use `resolveParamTypedName` per individual parameter instead.
150
150
  * @example
151
151
  * resolver.resolvePathParamsTypedName(node) // → 'GetPetByIdPathParams'
152
152
  */
153
153
  resolvePathParamsTypedName?(node: OperationNode): string
154
154
  /**
155
155
  * Resolves the variable/function name for an operation's grouped query parameters type.
156
- * Only available in legacy mode (`legacy: true`).
156
+ * Only available with `compatibilityPreset: 'kubbV4'`.
157
157
  *
158
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamName` per individual parameter instead.
158
+ * @deprecated Kubb v4 compatibility only — use `resolveParamName` per individual parameter instead.
159
159
  * @example
160
160
  * resolver.resolveQueryParamsName(node) // → 'FindPetsByStatusQueryParams'
161
161
  */
162
162
  resolveQueryParamsName?(node: OperationNode): string
163
163
  /**
164
164
  * Resolves the TypeScript type alias name for an operation's grouped query parameters type.
165
- * Only available in legacy mode (`legacy: true`).
165
+ * Only available with `compatibilityPreset: 'kubbV4'`.
166
166
  *
167
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamTypedName` per individual parameter instead.
167
+ * @deprecated Kubb v4 compatibility only — use `resolveParamTypedName` per individual parameter instead.
168
168
  * @example
169
169
  * resolver.resolveQueryParamsTypedName(node) // → 'FindPetsByStatusQueryParams'
170
170
  */
171
171
  resolveQueryParamsTypedName?(node: OperationNode): string
172
172
  /**
173
173
  * Resolves the variable/function name for an operation's grouped header parameters type.
174
- * Only available in legacy mode (`legacy: true`).
174
+ * Only available with `compatibilityPreset: 'kubbV4'`.
175
175
  *
176
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamName` per individual parameter instead.
176
+ * @deprecated Kubb v4 compatibility only — use `resolveParamName` per individual parameter instead.
177
177
  * @example
178
178
  * resolver.resolveHeaderParamsName(node) // → 'DeletePetHeaderParams'
179
179
  */
180
180
  resolveHeaderParamsName?(node: OperationNode): string
181
181
  /**
182
182
  * Resolves the TypeScript type alias name for an operation's grouped header parameters type.
183
- * Only available in legacy mode (`legacy: true`).
183
+ * Only available with `compatibilityPreset: 'kubbV4'`.
184
184
  *
185
- * @deprecated Legacy only — will be removed in v6. Use `resolveParamTypedName` per individual parameter instead.
185
+ * @deprecated Kubb v4 compatibility only — use `resolveParamTypedName` per individual parameter instead.
186
186
  * @example
187
187
  * resolver.resolveHeaderParamsTypedName(node) // → 'DeletePetHeaderParams'
188
188
  */
@@ -276,10 +276,12 @@ export type Options = {
276
276
  */
277
277
  UNSTABLE_NAMING?: true
278
278
  /**
279
- * Enable legacy naming conventions for backwards compatibility.
280
- * @default false
279
+ * Apply a compatibility naming preset.
280
+ * Use `kubbV4` for strict v4 type-generation compatibility.
281
+ * You can further customize naming with `resolvers`.
282
+ * @default 'default'
281
283
  */
282
- legacy?: boolean
284
+ compatibilityPreset?: CompatibilityPreset
283
285
  /**
284
286
  * Array of named resolvers that control naming conventions.
285
287
  * Later entries override earlier ones (last wins).
@@ -322,7 +324,7 @@ type ResolvedOptions = {
322
324
  arrayType: NonNullable<Options['arrayType']>
323
325
  syntaxType: NonNullable<Options['syntaxType']>
324
326
  paramsCasing: Options['paramsCasing']
325
- legacy: NonNullable<Options['legacy']>
327
+ compatibilityPreset: NonNullable<CompatibilityPreset>
326
328
  resolver: ResolverTs
327
329
  /**
328
330
  * The resolver without user naming overrides applied.