@kubb/plugin-ts 5.0.0-alpha.8 → 5.0.0-beta.3

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 (42) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +1 -3
  3. package/dist/index.cjs +1452 -4
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +574 -4
  6. package/dist/index.js +1418 -2
  7. package/dist/index.js.map +1 -0
  8. package/package.json +44 -64
  9. package/src/components/{v2/Enum.tsx → Enum.tsx} +33 -17
  10. package/src/components/Type.tsx +31 -161
  11. package/src/constants.ts +15 -5
  12. package/src/factory.ts +283 -35
  13. package/src/generators/typeGenerator.tsx +189 -424
  14. package/src/index.ts +9 -2
  15. package/src/plugin.ts +67 -205
  16. package/src/printers/functionPrinter.ts +197 -0
  17. package/src/printers/printerTs.ts +325 -0
  18. package/src/resolvers/resolverTs.ts +66 -0
  19. package/src/types.ts +238 -94
  20. package/src/utils.ts +130 -0
  21. package/dist/components-CRu8IKY3.js +0 -729
  22. package/dist/components-CRu8IKY3.js.map +0 -1
  23. package/dist/components-DeNDKlzf.cjs +0 -982
  24. package/dist/components-DeNDKlzf.cjs.map +0 -1
  25. package/dist/components.cjs +0 -3
  26. package/dist/components.d.ts +0 -36
  27. package/dist/components.js +0 -2
  28. package/dist/generators.cjs +0 -4
  29. package/dist/generators.d.ts +0 -480
  30. package/dist/generators.js +0 -2
  31. package/dist/plugin-D5NGPj0v.js +0 -1232
  32. package/dist/plugin-D5NGPj0v.js.map +0 -1
  33. package/dist/plugin-MLTxoa8p.cjs +0 -1279
  34. package/dist/plugin-MLTxoa8p.cjs.map +0 -1
  35. package/dist/types-CsvB6X5Y.d.ts +0 -167
  36. package/src/components/index.ts +0 -1
  37. package/src/components/v2/Type.tsx +0 -59
  38. package/src/generators/index.ts +0 -2
  39. package/src/generators/v2/typeGenerator.tsx +0 -171
  40. package/src/generators/v2/utils.ts +0 -140
  41. package/src/parser.ts +0 -389
  42. package/src/printer.ts +0 -368
package/dist/index.d.ts CHANGED
@@ -1,10 +1,580 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { n as PluginTs, t as Options } from "./types-CsvB6X5Y.js";
3
- import * as _kubb_core0 from "@kubb/core";
2
+ import * as _$_kubb_core0 from "@kubb/core";
3
+ import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
4
+ import ts from "typescript";
5
+ import { KubbReactNode } from "@kubb/renderer-jsx/types";
4
6
 
7
+ //#region src/printers/printerTs.d.ts
8
+ /**
9
+ * Partial map of node-type overrides for the TypeScript printer.
10
+ *
11
+ * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function
12
+ * replaces the built-in handler for that node type. Use `this.transform` to
13
+ * recurse into nested schema nodes, and `this.options` to read printer options.
14
+ *
15
+ * @example Override the `date` handler
16
+ * ```ts
17
+ * pluginTs({
18
+ * printer: {
19
+ * nodes: {
20
+ * date(node) {
21
+ * return ts.factory.createTypeReferenceNode('Date', [])
22
+ * },
23
+ * },
24
+ * },
25
+ * })
26
+ * ```
27
+ */
28
+ type PrinterTsNodes = ast.PrinterPartial<ts.TypeNode, PrinterTsOptions>;
29
+ type PrinterTsOptions = {
30
+ /**
31
+ * Mark parameters as optional with `?` or `| undefined`.
32
+ * - `'questionToken'` adds `?` to properties
33
+ * - `'undefined'` adds `| undefined` to types
34
+ *
35
+ * @default `'questionToken'`
36
+ */
37
+ optionalType: PluginTs['resolvedOptions']['optionalType'];
38
+ /**
39
+ * Array representation style.
40
+ * - `'array'` uses bracket notation (`T[]`)
41
+ * - `'generic'` uses generic syntax (`Array<T>`)
42
+ *
43
+ * @default `'array'`
44
+ */
45
+ arrayType: PluginTs['resolvedOptions']['arrayType'];
46
+ /**
47
+ * Enum output format.
48
+ * - `'inlineLiteral'` embeds literal unions inline
49
+ * - `'asPascalConst'` generates named const unions
50
+ * - `'asConst'` generates as const declarations
51
+ *
52
+ * @default `'inlineLiteral'`
53
+ */
54
+ enumType: PluginTs['resolvedOptions']['enumType'];
55
+ /**
56
+ * Suffix appended to enum key reference names.
57
+ *
58
+ * @example Enum key naming
59
+ * `StatusKey` when `enumType` is `'asConst'`
60
+ *
61
+ * @default `'Key'`
62
+ */
63
+ enumTypeSuffix?: PluginTs['resolvedOptions']['enumTypeSuffix'];
64
+ /**
65
+ * Syntax for generated declarations.
66
+ * - `'type'` generates type aliases
67
+ * - `'interface'` generates interface declarations
68
+ *
69
+ * @default `'type'`
70
+ */
71
+ syntaxType?: PluginTs['resolvedOptions']['syntaxType'];
72
+ /**
73
+ * Exported name for the type declaration.
74
+ * When omitted, returns only the raw type node.
75
+ */
76
+ name?: string;
77
+ /**
78
+ * JSDoc comment to attach to the generated type.
79
+ */
80
+ description?: string;
81
+ /**
82
+ * Properties to exclude using `Omit<Type, Keys>`.
83
+ * Forces type alias syntax regardless of `syntaxType` setting.
84
+ */
85
+ keysToOmit?: Array<string>;
86
+ /**
87
+ * Transforms raw schema names into valid TypeScript identifiers.
88
+ */
89
+ resolver: ResolverTs;
90
+ /**
91
+ * Schema names that represent enums for suffixed key references.
92
+ */
93
+ enumSchemaNames?: Set<string>;
94
+ /**
95
+ * Custom handler map for node type overrides.
96
+ */
97
+ nodes?: PrinterTsNodes;
98
+ };
99
+ /**
100
+ * TypeScript printer factory options: maps `SchemaNode` → `ts.TypeNode` (raw) or `ts.Node` (full declaration).
101
+ */
102
+ type PrinterTsFactory = ast.PrinterFactoryOptions<'typescript', PrinterTsOptions, ts.TypeNode, string>;
103
+ /**
104
+ * TypeScript type printer built with `definePrinter`.
105
+ *
106
+ * Converts a `SchemaNode` AST node into a TypeScript AST node:
107
+ * - **`printer.print(node)`** — when `options.typeName` is set, returns a full
108
+ * `type Name = …` or `interface Name { … }` declaration (`ts.Node`).
109
+ * Without `typeName`, returns the raw `ts.TypeNode` for the schema.
110
+ *
111
+ * Dispatches on `node.type` to the appropriate handler in `nodes`. Options are closed
112
+ * over per printer instance, so each call to `printerTs(options)` produces an independent printer.
113
+ *
114
+ * @example Raw type node (no `typeName`)
115
+ * ```ts
116
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral' })
117
+ * const typeNode = printer.print(schemaNode) // ts.TypeNode
118
+ * ```
119
+ *
120
+ * @example Full declaration (with `typeName`)
121
+ * ```ts
122
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral', typeName: 'MyType' })
123
+ * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration
124
+ * ```
125
+ */
126
+ declare const printerTs: (options?: PrinterTsOptions | undefined) => ast.Printer<PrinterTsFactory>;
127
+ //#endregion
128
+ //#region src/types.d.ts
129
+ /**
130
+ * The concrete resolver type for `@kubb/plugin-ts`.
131
+ * Extends the base `Resolver` (which provides `default` and `resolveOptions`) with
132
+ * plugin-specific naming helpers for operations, parameters, responses, and schemas.
133
+ */
134
+ type ResolverTs = Resolver & ast.OperationParamsResolver & {
135
+ /**
136
+ * Resolves the name for a given raw name (equivalent to `default(name, 'function')`).
137
+ * Since TypeScript only emits types, this is the canonical naming method.
138
+ *
139
+ * @example Resolving type names
140
+ * `resolver.resolveName('list pets status 200') // → 'ListPetsStatus200'`
141
+ */
142
+ resolveTypeName(name: string): string;
143
+ /**
144
+ * Resolves the file/path name for a given identifier using PascalCase.
145
+ *
146
+ * @example Resolving path names
147
+ * `resolver.resolvePathName('list pets', 'file') // → 'ListPets'`
148
+ */
149
+ resolvePathName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string;
150
+ /**
151
+ * Resolves the request body type name for an operation (required on ResolverTs).
152
+ */
153
+ resolveDataName(node: ast.OperationNode): string;
154
+ /**
155
+ * Resolves the name for an operation response by status code.
156
+ * Encapsulates the `<operationId> Status <statusCode>` template with PascalCase applied to the result.
157
+ *
158
+ * @example Response status names
159
+ * `resolver.resolveResponseStatusName(node, 200) // → 'ListPetsStatus200'`
160
+ */
161
+ resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string;
162
+ /**
163
+ * Resolves the name for an operation's request config (`RequestConfig`).
164
+ *
165
+ * @example Request config names
166
+ * `resolver.resolveRequestConfigName(node) // → 'ListPetsRequestConfig'`
167
+ */
168
+ resolveRequestConfigName(node: ast.OperationNode): string;
169
+ /**
170
+ * Resolves the name for the collection of all operation responses (`Responses`).
171
+ *
172
+ * @example Responses collection names
173
+ * `resolver.resolveResponsesName(node) // → 'ListPetsResponses'`
174
+ */
175
+ resolveResponsesName(node: ast.OperationNode): string;
176
+ /**
177
+ * Resolves the name for the union of all operation responses (`Response`).
178
+ *
179
+ * @example Response union names
180
+ * `resolver.resolveResponseName(node) // → 'ListPetsResponse'`
181
+ */
182
+ resolveResponseName(node: ast.OperationNode): string;
183
+ /**
184
+ * Resolves the TypeScript type alias name for an enum schema's key variant.
185
+ * Appends `enumTypeSuffix` (default `'Key'`) after applying the default naming convention.
186
+ *
187
+ * @example Enum key names with different suffixes
188
+ * ```ts
189
+ * resolver.resolveEnumKeyName(node, 'Key') // → 'PetStatusKey'
190
+ * resolver.resolveEnumKeyName(node, 'Value') // → 'PetStatusValue'
191
+ * resolver.resolveEnumKeyName(node, '') // → 'PetStatus'
192
+ * ```
193
+ */
194
+ resolveEnumKeyName(node: {
195
+ name?: string | null;
196
+ }, enumTypeSuffix: string): string;
197
+ /**
198
+ * Resolves the name for an operation's grouped path parameters type.
199
+ *
200
+ * @example Path parameters names
201
+ * `resolver.resolvePathParamsName(node, param) // → 'GetPetByIdPathParams'`
202
+ */
203
+ resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
204
+ /**
205
+ * Resolves the name for an operation's grouped query parameters type.
206
+ *
207
+ * @example Query parameters names
208
+ * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`
209
+ */
210
+ resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
211
+ /**
212
+ * Resolves the name for an operation's grouped header parameters type.
213
+ *
214
+ * @example Header parameters names
215
+ * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`
216
+ */
217
+ resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
218
+ };
219
+ type EnumKeyCasing = 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none';
220
+ /**
221
+ * Discriminated union that ties `enumTypeSuffix` and `enumKeyCasing` to the enum types that actually use them.
222
+ *
223
+ * - `'asConst'` / `'asPascalConst'` — emit a `const` object; both `enumTypeSuffix` (type-alias suffix) and
224
+ * `enumKeyCasing` (key formatting) are meaningful.
225
+ * - `'enum'` / `'constEnum'` — emit a TypeScript enum; `enumKeyCasing` applies to member names,
226
+ * but there is no separate type alias so `enumTypeSuffix` is not used.
227
+ * - `'literal'` / `'inlineLiteral'` — emit only union literals; keys are discarded entirely,
228
+ * so neither `enumTypeSuffix` nor `enumKeyCasing` have any effect.
229
+ */
230
+ type EnumTypeOptions = {
231
+ /**
232
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
233
+ * - 'asConst' generates const objects with camelCase names and as const assertion.
234
+ * - 'asPascalConst' generates const objects with PascalCase names and as const assertion.
235
+ * @default 'asConst'
236
+ */
237
+ enumType?: 'asConst' | 'asPascalConst';
238
+ /**
239
+ * Suffix appended to the generated type alias name.
240
+ *
241
+ * Only affects the type alias — the const object name is unchanged.
242
+ *
243
+ * @default 'Key'
244
+ * @example enumTypeSuffix: 'Value' → `export type PetStatusValue = …`
245
+ */
246
+ enumTypeSuffix?: string;
247
+ /**
248
+ * Choose the casing for enum key names.
249
+ * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
250
+ * - 'snakeCase' generates keys in snake_case format.
251
+ * - 'pascalCase' generates keys in PascalCase format.
252
+ * - 'camelCase' generates keys in camelCase format.
253
+ * - 'none' uses the enum value as-is without transformation.
254
+ * @default 'none'
255
+ */
256
+ enumKeyCasing?: EnumKeyCasing;
257
+ } | {
258
+ /**
259
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
260
+ * - 'enum' generates TypeScript enum declarations.
261
+ * - 'constEnum' generates TypeScript const enum declarations.
262
+ * @default 'asConst'
263
+ */
264
+ enumType?: 'enum' | 'constEnum';
265
+ /**
266
+ * `enumTypeSuffix` has no effect for this `enumType`.
267
+ * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
268
+ */
269
+ enumTypeSuffix?: never;
270
+ /**
271
+ * Choose the casing for enum key names.
272
+ * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
273
+ * - 'snakeCase' generates keys in snake_case format.
274
+ * - 'pascalCase' generates keys in PascalCase format.
275
+ * - 'camelCase' generates keys in camelCase format.
276
+ * - 'none' uses the enum value as-is without transformation.
277
+ * @default 'none'
278
+ */
279
+ enumKeyCasing?: EnumKeyCasing;
280
+ } | {
281
+ /**
282
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
283
+ * - 'literal' generates literal union types.
284
+ * - 'inlineLiteral' will inline enum values directly into the type (default in v5).
285
+ * @default 'asConst'
286
+ * @note In Kubb v5, 'inlineLiteral' becomes the default.
287
+ */
288
+ enumType?: 'literal' | 'inlineLiteral';
289
+ /**
290
+ * `enumTypeSuffix` has no effect for this `enumType`.
291
+ * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
292
+ */
293
+ enumTypeSuffix?: never;
294
+ /**
295
+ * `enumKeyCasing` has no effect for this `enumType`.
296
+ * Literal and inlineLiteral modes emit only values — keys are discarded entirely.
297
+ */
298
+ enumKeyCasing?: never;
299
+ };
300
+ type Options = {
301
+ /**
302
+ * Specify the export location for the files and define the behavior of the output
303
+ * @default { path: 'types', barrelType: 'named' }
304
+ */
305
+ output?: Output;
306
+ /**
307
+ * Define which contentType should be used.
308
+ * By default, uses the first valid JSON media type.
309
+ */
310
+ contentType?: 'application/json' | (string & {});
311
+ /**
312
+ * Group the clients based on the provided name.
313
+ */
314
+ group?: Group;
315
+ /**
316
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
317
+ */
318
+ exclude?: Array<Exclude>;
319
+ /**
320
+ * Array containing include parameters to include tags/operations/methods/paths.
321
+ */
322
+ include?: Array<Include>;
323
+ /**
324
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
325
+ */
326
+ override?: Array<Override<ResolvedOptions>>;
327
+ /**
328
+ * Switch between type or interface for creating TypeScript types.
329
+ * - 'type' generates type alias declarations.
330
+ * - 'interface' generates interface declarations.
331
+ * @default 'type'
332
+ */
333
+ syntaxType?: 'type' | 'interface';
334
+ /**
335
+ * Choose what to use as mode for an optional value.
336
+ * - 'questionToken' marks the property as optional with ? (e.g., type?: string).
337
+ * - 'undefined' adds undefined to the type union (e.g., type: string | undefined).
338
+ * - 'questionTokenAndUndefined' combines both approaches (e.g., type?: string | undefined).
339
+ * @default 'questionToken'
340
+ */
341
+ optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
342
+ /**
343
+ * Choose between Array<string> or string[] for array types.
344
+ * - 'generic' generates Array<Type> syntax.
345
+ * - 'array' generates Type[] syntax.
346
+ * @default 'array'
347
+ */
348
+ arrayType?: 'generic' | 'array';
349
+ /**
350
+ * How to style your params, by default no casing is applied
351
+ * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams property names
352
+ * @default undefined
353
+ * @note response types (data/body) are NOT affected by this option
354
+ */
355
+ paramsCasing?: 'camelcase';
356
+ /**
357
+ * Define some generators next to the ts generators
358
+ */
359
+ generators?: Array<Generator<PluginTs>>;
360
+ /**
361
+ * Override naming conventions. When a method returns `null` or `undefined`, the preset
362
+ * resolver (`resolverTs`) is used as fallback.
363
+ */
364
+ resolver?: Partial<ResolverTs> & ThisType<ResolverTs>;
365
+ /**
366
+ * AST visitor applied to each schema/operation node before printing.
367
+ * Returning `null` or `undefined` from a visitor method falls back to the preset transformer.
368
+ *
369
+ * @example Remove writeOnly properties from response types
370
+ * ```ts
371
+ * transformer: {
372
+ * property(node) {
373
+ * if (node.schema.writeOnly) return undefined
374
+ * }
375
+ * }
376
+ * ```
377
+ */
378
+ transformer?: ast.Visitor;
379
+ /**
380
+ * Override individual printer node handlers to customize rendering of specific schema types.
381
+ *
382
+ * Each key is a `SchemaType` (e.g. `'date'`, `'string'`). The function replaces the
383
+ * built-in handler for that type. Use `this.transform` to recurse into nested schema nodes.
384
+ *
385
+ * @example Override the `date` node to use the `Date` object type
386
+ * ```ts
387
+ * import ts from 'typescript'
388
+ * pluginTs({
389
+ * printer: {
390
+ * nodes: {
391
+ * date(node) {
392
+ * return ts.factory.createTypeReferenceNode('Date', [])
393
+ * },
394
+ * },
395
+ * },
396
+ * })
397
+ * ```
398
+ */
399
+ printer?: {
400
+ nodes?: PrinterTsNodes;
401
+ };
402
+ } & EnumTypeOptions;
403
+ type ResolvedOptions = {
404
+ output: Output;
405
+ exclude: Array<Exclude>;
406
+ include: Array<Include> | undefined;
407
+ override: Array<Override<ResolvedOptions>>;
408
+ group: Group | undefined;
409
+ enumType: NonNullable<Options['enumType']>;
410
+ enumTypeSuffix: NonNullable<Options['enumTypeSuffix']>;
411
+ enumKeyCasing: EnumKeyCasing;
412
+ optionalType: NonNullable<Options['optionalType']>;
413
+ arrayType: NonNullable<Options['arrayType']>;
414
+ syntaxType: NonNullable<Options['syntaxType']>;
415
+ paramsCasing: Options['paramsCasing'];
416
+ printer: Options['printer'];
417
+ };
418
+ type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, ResolverTs>;
419
+ declare global {
420
+ namespace Kubb {
421
+ interface PluginRegistry {
422
+ 'plugin-ts': PluginTs;
423
+ }
424
+ }
425
+ }
426
+ //#endregion
427
+ //#region src/components/Enum.d.ts
428
+ type Props$1 = {
429
+ node: ast.EnumSchemaNode;
430
+ enumType: PluginTs['resolvedOptions']['enumType'];
431
+ enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
432
+ enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
433
+ resolver: ResolverTs;
434
+ key?: string | number | null;
435
+ };
436
+ /**
437
+ * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.
438
+ *
439
+ * The raw `node.name` may be a YAML key such as `"enumNames.Type"` which is not a
440
+ * valid TypeScript identifier. The resolver normalizes it; for inline enum
441
+ * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
442
+ */
443
+ /**
444
+ * Renders the enum declaration(s) for a single named `EnumSchemaNode`.
445
+ *
446
+ * Depending on `enumType` this may emit:
447
+ * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias
448
+ * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)
449
+ * - A union literal type alias (`literal`)
450
+ *
451
+ * The emitted `File.Source` nodes carry the resolved names so that the barrel
452
+ * index picks up the correct export identifiers.
453
+ */
454
+ declare function Enum({
455
+ node,
456
+ enumType,
457
+ enumTypeSuffix,
458
+ enumKeyCasing,
459
+ resolver
460
+ }: Props$1): KubbReactNode;
461
+ //#endregion
462
+ //#region src/components/Type.d.ts
463
+ type Props = {
464
+ name: string;
465
+ node: ast.SchemaNode;
466
+ /**
467
+ * Pre-configured printer instance created by the generator.
468
+ * Created with `printerTs({ ..., nodes: options.printer?.nodes })`.
469
+ */
470
+ printer: ast.Printer<PrinterTsFactory>;
471
+ enumType: PluginTs['resolvedOptions']['enumType'];
472
+ enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
473
+ enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
474
+ resolver: ResolverTs;
475
+ };
476
+ declare function Type({
477
+ name,
478
+ node,
479
+ printer,
480
+ enumType,
481
+ enumTypeSuffix,
482
+ enumKeyCasing,
483
+ resolver
484
+ }: Props): KubbReactNode;
485
+ //#endregion
486
+ //#region src/generators/typeGenerator.d.ts
487
+ declare const typeGenerator: _$_kubb_core0.Generator<PluginTs, unknown>;
488
+ //#endregion
5
489
  //#region src/plugin.d.ts
490
+ /**
491
+ * Canonical plugin name for `@kubb/plugin-ts`, used to identify the plugin in driver lookups and warnings.
492
+ */
6
493
  declare const pluginTsName = "plugin-ts";
7
- declare const pluginTs: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginTs>;
494
+ /**
495
+ * The `@kubb/plugin-ts` plugin factory.
496
+ *
497
+ * Generates TypeScript type declarations from an OpenAPI/AST `RootNode`.
498
+ * Walks schemas and operations, delegates rendering to the active generators,
499
+ * and writes barrel files based on `output.barrelType`.
500
+ *
501
+ * @example
502
+ * ```ts
503
+ * import pluginTs from '@kubb/plugin-ts'
504
+ *
505
+ * export default defineConfig({
506
+ * plugins: [pluginTs({ output: { path: 'types' }, enumType: 'asConst' })],
507
+ * })
508
+ * ```
509
+ */
510
+ declare const pluginTs: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginTs>;
511
+ //#endregion
512
+ //#region src/printers/functionPrinter.d.ts
513
+ type FunctionPrinterOptions = {
514
+ /**
515
+ * Rendering modes supported by `functionPrinter`.
516
+ *
517
+ * | Mode | Output example | Use case |
518
+ * |---------------|---------------------------------------------|---------------------------------|
519
+ * | `declaration` | `id: string, config: Config = {}` | Function parameter declaration |
520
+ * | `call` | `id, { method, url }` | Function call arguments |
521
+ * | `keys` | `{ id, config }` | Key names only (destructuring) |
522
+ * | `values` | `{ id: id, config: config }` | Key/value object entries |
523
+ */
524
+ mode: 'declaration' | 'call' | 'keys' | 'values';
525
+ /**
526
+ * Optional transformation applied to every parameter name before printing.
527
+ */
528
+ transformName?: (name: string) => string;
529
+ /**
530
+ * Optional transformation applied to every type string before printing.
531
+ */
532
+ transformType?: (type: string) => string;
533
+ };
534
+ /**
535
+ * Default function-signature printer.
536
+ * Covers the four standard output modes used across Kubb plugins.
537
+ *
538
+ * @example
539
+ * ```ts
540
+ * const printer = functionPrinter({ mode: 'declaration' })
541
+ *
542
+ * const sig = createFunctionParameters({
543
+ * params: [
544
+ * createFunctionParameter({ name: 'petId', type: 'string', optional: false }),
545
+ * createFunctionParameter({ name: 'config', type: 'Config', optional: false, default: '{}' }),
546
+ * ],
547
+ * })
548
+ *
549
+ * printer.print(sig) // → "petId: string, config: Config = {}"
550
+ * ```
551
+ */
552
+ declare const functionPrinter: (options?: FunctionPrinterOptions | undefined) => {
553
+ name: "functionParameters";
554
+ options: FunctionPrinterOptions;
555
+ transform: (node: ast.FunctionParamNode) => string | null | undefined;
556
+ print: (node: ast.FunctionParamNode) => string | null | undefined;
557
+ };
558
+ //#endregion
559
+ //#region src/resolvers/resolverTs.d.ts
560
+ /**
561
+ * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
562
+ * helpers used by the plugin. Import this in other plugins to resolve the exact names and
563
+ * paths that `plugin-ts` generates without hardcoding the conventions.
564
+ *
565
+ * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`
566
+ * for identifiers/files and `pascalCase` for type names.
567
+ *
568
+ * @example
569
+ * ```ts
570
+ * import { resolver } from '@kubb/plugin-ts'
571
+ *
572
+ * resolver.default('list pets', 'type') // → 'ListPets'
573
+ * resolver.resolveName('list pets status 200') // → 'ListPetsStatus200'
574
+ * resolver.resolvePathName('list pets', 'file') // → 'listPets'
575
+ * ```
576
+ */
577
+ declare const resolverTs: ResolverTs;
8
578
  //#endregion
9
- export { type PluginTs, pluginTs, pluginTsName };
579
+ export { Enum, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, Type, pluginTs as default, pluginTs, functionPrinter, pluginTsName, printerTs, resolverTs, typeGenerator };
10
580
  //# sourceMappingURL=index.d.ts.map