@kubb/plugin-ts 3.16.2 → 3.16.4

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 (39) hide show
  1. package/dist/components-6F5RoYuJ.js +2240 -0
  2. package/dist/components-6F5RoYuJ.js.map +1 -0
  3. package/dist/components-B-Jx1kI5.cjs +2256 -0
  4. package/dist/components-B-Jx1kI5.cjs.map +1 -0
  5. package/dist/components.cjs +3 -15
  6. package/dist/components.d.cts +40 -26
  7. package/dist/components.d.ts +40 -26
  8. package/dist/components.js +3 -3
  9. package/dist/generators.cjs +4 -16
  10. package/dist/generators.d.cts +8 -9
  11. package/dist/generators.d.ts +8 -9
  12. package/dist/generators.js +4 -4
  13. package/dist/index.cjs +4 -17
  14. package/dist/index.d.cts +6 -8
  15. package/dist/index.d.ts +6 -8
  16. package/dist/index.js +3 -6
  17. package/dist/plugin-BXxI6FcR.cjs +378 -0
  18. package/dist/plugin-BXxI6FcR.cjs.map +1 -0
  19. package/dist/plugin-DXUISuTd.js +355 -0
  20. package/dist/plugin-DXUISuTd.js.map +1 -0
  21. package/dist/types-BL0qEGbB.d.cts +1223 -0
  22. package/dist/types-DFDnGwpy.d.ts +1223 -0
  23. package/package.json +22 -27
  24. package/dist/chunk-AUYOLJ62.js +0 -358
  25. package/dist/chunk-AUYOLJ62.js.map +0 -1
  26. package/dist/chunk-NAZDWNS6.cjs +0 -387
  27. package/dist/chunk-NAZDWNS6.cjs.map +0 -1
  28. package/dist/chunk-NDI35YW5.cjs +0 -2611
  29. package/dist/chunk-NDI35YW5.cjs.map +0 -1
  30. package/dist/chunk-V4C2DOV5.js +0 -2585
  31. package/dist/chunk-V4C2DOV5.js.map +0 -1
  32. package/dist/components.cjs.map +0 -1
  33. package/dist/components.js.map +0 -1
  34. package/dist/generators.cjs.map +0 -1
  35. package/dist/generators.js.map +0 -1
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/types-DkvPgLAK.d.cts +0 -116
  39. package/dist/types-DkvPgLAK.d.ts +0 -116
@@ -1,387 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkNDI35YW5_cjs = require('./chunk-NDI35YW5.cjs');
4
- var transformers = require('@kubb/core/transformers');
5
- var parserTs = require('@kubb/parser-ts');
6
- var factory = require('@kubb/parser-ts/factory');
7
- var pluginOas = require('@kubb/plugin-oas');
8
- var components = require('@kubb/plugin-oas/components');
9
- var hooks = require('@kubb/plugin-oas/hooks');
10
- var utils = require('@kubb/plugin-oas/utils');
11
- var react = require('@kubb/react');
12
- var path = require('path');
13
- var core = require('@kubb/core');
14
- var jsxRuntime = require('@kubb/react/jsx-runtime');
15
-
16
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
-
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
20
- var n = Object.create(null);
21
- if (e) {
22
- Object.keys(e).forEach(function (k) {
23
- if (k !== 'default') {
24
- var d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () { return e[k]; }
28
- });
29
- }
30
- });
31
- }
32
- n.default = e;
33
- return Object.freeze(n);
34
- }
35
-
36
- var transformers__default = /*#__PURE__*/_interopDefault(transformers);
37
- var factory__namespace = /*#__PURE__*/_interopNamespace(factory);
38
- var path__default = /*#__PURE__*/_interopDefault(path);
39
-
40
- // src/generators/index.ts
41
- chunkNDI35YW5_cjs.init_cjs_shims();
42
-
43
- // src/generators/typeGenerator.tsx
44
- chunkNDI35YW5_cjs.init_cjs_shims();
45
-
46
- // src/plugin.ts
47
- chunkNDI35YW5_cjs.init_cjs_shims();
48
- var pluginTsName = "plugin-ts";
49
- var pluginTs = core.createPlugin((options) => {
50
- const {
51
- output = { path: "types", barrelType: "named" },
52
- group,
53
- exclude = [],
54
- include,
55
- override = [],
56
- enumType = "asConst",
57
- enumSuffix = "enum",
58
- dateType = "string",
59
- unknownType = "any",
60
- optionalType = "questionToken",
61
- emptySchemaType = unknownType,
62
- syntaxType = "type",
63
- transformers: transformers2 = {},
64
- oasType = false,
65
- mapper = {},
66
- generators = [typeGenerator, oasType === "infer" ? oasGenerator : void 0].filter(Boolean),
67
- contentType
68
- } = options;
69
- return {
70
- name: pluginTsName,
71
- options: {
72
- output,
73
- transformers: transformers2,
74
- dateType,
75
- optionalType,
76
- oasType,
77
- enumType,
78
- enumSuffix,
79
- // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey)
80
- usedEnumNames: {},
81
- unknownType,
82
- emptySchemaType,
83
- syntaxType,
84
- group,
85
- override,
86
- mapper
87
- },
88
- pre: [pluginOas.pluginOasName],
89
- resolvePath(baseName, pathMode, options2) {
90
- const root = path__default.default.resolve(this.config.root, this.config.output.path);
91
- const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path));
92
- if (mode === "single") {
93
- return path__default.default.resolve(root, output.path);
94
- }
95
- if (group && (options2?.group?.path || options2?.group?.tag)) {
96
- const groupName = group?.name ? group.name : (ctx) => {
97
- if (group?.type === "path") {
98
- return `${ctx.group.split("/")[1]}`;
99
- }
100
- return `${transformers.camelCase(ctx.group)}Controller`;
101
- };
102
- return path__default.default.resolve(
103
- root,
104
- output.path,
105
- groupName({
106
- group: group.type === "path" ? options2.group.path : options2.group.tag
107
- }),
108
- baseName
109
- );
110
- }
111
- return path__default.default.resolve(root, output.path, baseName);
112
- },
113
- resolveName(name, type) {
114
- const resolvedName = transformers.pascalCase(name, { isFile: type === "file" });
115
- if (type) {
116
- return transformers2?.name?.(resolvedName, type) || resolvedName;
117
- }
118
- return resolvedName;
119
- },
120
- async buildStart() {
121
- const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]);
122
- const oas = await swaggerPlugin.context.getOas();
123
- const root = path__default.default.resolve(this.config.root, this.config.output.path);
124
- const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
125
- const schemaGenerator = new pluginOas.SchemaGenerator(this.plugin.options, {
126
- oas,
127
- pluginManager: this.pluginManager,
128
- plugin: this.plugin,
129
- contentType,
130
- include: void 0,
131
- override,
132
- mode,
133
- output: output.path
134
- });
135
- const schemaFiles = await schemaGenerator.build(...generators);
136
- await this.addFile(...schemaFiles);
137
- const operationGenerator = new pluginOas.OperationGenerator(this.plugin.options, {
138
- oas,
139
- pluginManager: this.pluginManager,
140
- plugin: this.plugin,
141
- contentType,
142
- exclude,
143
- include,
144
- override,
145
- mode
146
- });
147
- const operationFiles = await operationGenerator.build(...generators);
148
- await this.addFile(...operationFiles);
149
- const barrelFiles = await this.fileManager.getBarrelFiles({
150
- type: output.barrelType ?? "named",
151
- root,
152
- output,
153
- meta: {
154
- pluginKey: this.plugin.key
155
- },
156
- logger: this.logger
157
- });
158
- await this.addFile(...barrelFiles);
159
- }
160
- };
161
- });
162
- function printCombinedSchema({ name, schemas, pluginManager }) {
163
- const properties = {};
164
- if (schemas.response) {
165
- properties["response"] = factory__namespace.createUnionDeclaration({
166
- nodes: schemas.responses.map((res) => {
167
- const identifier = pluginManager.resolveName({
168
- name: res.name,
169
- pluginKey: [pluginTsName],
170
- type: "function"
171
- });
172
- return factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
173
- })
174
- });
175
- }
176
- if (schemas.request) {
177
- const identifier = pluginManager.resolveName({
178
- name: schemas.request.name,
179
- pluginKey: [pluginTsName],
180
- type: "function"
181
- });
182
- properties["request"] = factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
183
- }
184
- if (schemas.pathParams) {
185
- const identifier = pluginManager.resolveName({
186
- name: schemas.pathParams.name,
187
- pluginKey: [pluginTsName],
188
- type: "function"
189
- });
190
- properties["pathParams"] = factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
191
- }
192
- if (schemas.queryParams) {
193
- const identifier = pluginManager.resolveName({
194
- name: schemas.queryParams.name,
195
- pluginKey: [pluginTsName],
196
- type: "function"
197
- });
198
- properties["queryParams"] = factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
199
- }
200
- if (schemas.headerParams) {
201
- const identifier = pluginManager.resolveName({
202
- name: schemas.headerParams.name,
203
- pluginKey: [pluginTsName],
204
- type: "function"
205
- });
206
- properties["headerParams"] = factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
207
- }
208
- if (schemas.errors) {
209
- properties["errors"] = factory__namespace.createUnionDeclaration({
210
- nodes: schemas.errors.map((error) => {
211
- const identifier = pluginManager.resolveName({
212
- name: error.name,
213
- pluginKey: [pluginTsName],
214
- type: "function"
215
- });
216
- return factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
217
- })
218
- });
219
- }
220
- const namespaceNode = factory__namespace.createTypeAliasDeclaration({
221
- name,
222
- type: factory__namespace.createTypeLiteralNode(
223
- Object.keys(properties).map((key) => {
224
- const type = properties[key];
225
- if (!type) {
226
- return void 0;
227
- }
228
- return factory__namespace.createPropertySignature({
229
- name: transformers__default.default.pascalCase(key),
230
- type
231
- });
232
- }).filter(Boolean)
233
- ),
234
- modifiers: [factory__namespace.modifiers.export]
235
- });
236
- return parserTs.print([namespaceNode]);
237
- }
238
- var typeGenerator = pluginOas.createReactGenerator({
239
- name: "typescript",
240
- Operation({ operation, options }) {
241
- const { mapper, enumType, syntaxType, optionalType } = options;
242
- const { plugin, pluginManager, mode } = react.useApp();
243
- const oas = hooks.useOas();
244
- const { getSchemas, getFile, getName, getGroup } = hooks.useOperationManager();
245
- const schemaManager = hooks.useSchemaManager();
246
- const file = getFile(operation);
247
- const schemas = getSchemas(operation);
248
- const type = getName(operation, { type: "function", pluginKey: [pluginTsName] });
249
- const combinedSchemaName = operation.method === "get" ? `${type}Query` : `${type}Mutation`;
250
- const schemaGenerator = new pluginOas.SchemaGenerator(options, {
251
- oas,
252
- plugin,
253
- pluginManager,
254
- mode,
255
- override: options.override
256
- });
257
- const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean);
258
- const mapOperationSchema = ({ name, schema: schemaObject, description, keysToOmit, ...options2 }) => {
259
- const tree = schemaGenerator.parse({ schemaObject, name });
260
- const imports = schemaManager.getImports(tree);
261
- const group = options2.operation ? getGroup(options2.operation) : void 0;
262
- const type2 = {
263
- name: schemaManager.getName(name, { type: "type" }),
264
- typedName: schemaManager.getName(name, { type: "type" }),
265
- file: schemaManager.getFile(options2.operationName || name, { group })
266
- };
267
- return /* @__PURE__ */ jsxRuntime.jsxs(components.Oas.Schema, { name, schemaObject, tree, children: [
268
- mode === "split" && imports.map((imp) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: file.path, path: imp.path, name: imp.name, isTypeOnly: true }, [name, imp.name, imp.path, imp.isTypeOnly].join("-"))),
269
- /* @__PURE__ */ jsxRuntime.jsx(
270
- chunkNDI35YW5_cjs.Type,
271
- {
272
- name: type2.name,
273
- typedName: type2.typedName,
274
- description,
275
- tree,
276
- schema: schemaObject,
277
- mapper,
278
- enumType,
279
- optionalType,
280
- keysToOmit,
281
- syntaxType
282
- }
283
- )
284
- ] }, [name, schemaObject.$ref].join("-"));
285
- };
286
- return /* @__PURE__ */ jsxRuntime.jsxs(
287
- react.File,
288
- {
289
- baseName: file.baseName,
290
- path: file.path,
291
- meta: file.meta,
292
- banner: utils.getBanner({ oas, output: plugin.options.output, config: pluginManager.config }),
293
- footer: utils.getFooter({ oas, output: plugin.options.output }),
294
- children: [
295
- operationSchemas.map(mapOperationSchema),
296
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: combinedSchemaName, isExportable: true, isIndexable: true, isTypeOnly: true, children: printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager }) })
297
- ]
298
- }
299
- );
300
- },
301
- Schema({ schema, options }) {
302
- const { mapper, enumType, syntaxType, optionalType } = options;
303
- const {
304
- mode,
305
- plugin: {
306
- options: { output }
307
- },
308
- pluginManager
309
- } = react.useApp();
310
- const oas = hooks.useOas();
311
- const { getName, getImports, getFile } = hooks.useSchemaManager();
312
- const imports = getImports(schema.tree);
313
- if (enumType === "asPascalConst") {
314
- console.warn(`enumType '${enumType}' is deprecated`);
315
- }
316
- const type = {
317
- name: getName(schema.name, { type: "function" }),
318
- typedName: getName(schema.name, { type: "type" }),
319
- file: getFile(schema.name)
320
- };
321
- return /* @__PURE__ */ jsxRuntime.jsxs(
322
- react.File,
323
- {
324
- baseName: type.file.baseName,
325
- path: type.file.path,
326
- meta: type.file.meta,
327
- banner: utils.getBanner({ oas, output, config: pluginManager.config }),
328
- footer: utils.getFooter({ oas, output }),
329
- children: [
330
- mode === "split" && imports.map((imp) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: type.file.path, path: imp.path, name: imp.name, isTypeOnly: true }, [schema.name, imp.path, imp.isTypeOnly].join("-"))),
331
- /* @__PURE__ */ jsxRuntime.jsx(
332
- chunkNDI35YW5_cjs.Type,
333
- {
334
- name: type.name,
335
- typedName: type.typedName,
336
- description: schema.value.description,
337
- tree: schema.tree,
338
- schema: schema.value,
339
- mapper,
340
- enumType,
341
- optionalType,
342
- syntaxType
343
- }
344
- )
345
- ]
346
- }
347
- );
348
- }
349
- });
350
-
351
- // src/generators/oasGenerator.tsx
352
- chunkNDI35YW5_cjs.init_cjs_shims();
353
- var oasGenerator = pluginOas.createReactGenerator({
354
- name: "oas",
355
- Operations() {
356
- const {
357
- pluginManager,
358
- plugin: {
359
- options: { output },
360
- key: pluginKey
361
- }
362
- } = react.useApp();
363
- const oas = hooks.useOas();
364
- const file = pluginManager.getFile({ name: "oas", extname: ".ts", pluginKey });
365
- return /* @__PURE__ */ jsxRuntime.jsxs(
366
- react.File,
367
- {
368
- baseName: file.baseName,
369
- path: file.path,
370
- meta: file.meta,
371
- banner: utils.getBanner({ oas, output, config: pluginManager.config }),
372
- footer: utils.getFooter({ oas, output }),
373
- children: [
374
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["Infer"], path: "@kubb/oas", isTypeOnly: true }),
375
- /* @__PURE__ */ jsxRuntime.jsx(chunkNDI35YW5_cjs.OasType, { name: "oas", typeName: "Oas", api: oas.api })
376
- ]
377
- }
378
- );
379
- }
380
- });
381
-
382
- exports.oasGenerator = oasGenerator;
383
- exports.pluginTs = pluginTs;
384
- exports.pluginTsName = pluginTsName;
385
- exports.typeGenerator = typeGenerator;
386
- //# sourceMappingURL=chunk-NAZDWNS6.cjs.map
387
- //# sourceMappingURL=chunk-NAZDWNS6.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/generators/index.ts","../src/generators/typeGenerator.tsx","../src/plugin.ts","../src/generators/oasGenerator.tsx"],"names":["init_cjs_shims","createPlugin","transformers","pluginOasName","options","path","FileManager","camelCase","pascalCase","PluginManager","SchemaGenerator","OperationGenerator","factory","print","createReactGenerator","useApp","useOas","useOperationManager","useSchemaManager","type","Oas","jsx","File","Type","jsxs","getBanner","getFooter","OasType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,gCAAA,EAAA;;;ACAAA,gCAAA,EAAA;;;ACAAA,gCAAA,EAAA;AAWO,IAAM,YAAe,GAAA;AAEf,IAAA,QAAA,GAAWC,iBAAuB,CAAA,CAAC,OAAY,KAAA;AAC1D,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,QAAW,GAAA,SAAA;AAAA,IACX,UAAa,GAAA,MAAA;AAAA,IACb,QAAW,GAAA,QAAA;AAAA,IACX,WAAc,GAAA,KAAA;AAAA,IACd,YAAe,GAAA,eAAA;AAAA,IACf,eAAkB,GAAA,WAAA;AAAA,IAClB,UAAa,GAAA,MAAA;AAAA,IACb,YAAA,EAAAC,gBAAe,EAAC;AA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n","import type { PluginManager } from '@kubb/core'\nimport transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { createReactGenerator, type OperationSchemas, type OperationSchema as OperationSchemaType, SchemaGenerator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport type ts from 'typescript'\nimport { Type } from '../components'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types'\n\nfunction printCombinedSchema({ name, schemas, pluginManager }: { name: string; schemas: OperationSchemas; pluginManager: PluginManager }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createUnionDeclaration({\n nodes: schemas.responses.map((res) => {\n const identifier = pluginManager.resolveName({\n name: res.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n if (schemas.request) {\n const identifier = pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.pathParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.queryParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.headerParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n const identifier = pluginManager.resolveName({\n name: error.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(\n Object.keys(properties)\n .map((key) => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature({\n name: transformers.pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print([namespaceNode])\n}\n\nexport const typeGenerator = createReactGenerator<PluginTs>({\n name: 'typescript',\n Operation({ operation, options }) {\n const { mapper, enumType, syntaxType, optionalType } = options\n\n const { plugin, pluginManager, mode } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName, getGroup } = useOperationManager()\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const type = getName(operation, { type: 'function', pluginKey: [pluginTsName] })\n const combinedSchemaName = operation.method === 'get' ? `${type}Query` : `${type}Mutation`\n const schemaGenerator = new SchemaGenerator(options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaObject, description, keysToOmit, ...options }: OperationSchemaType) => {\n const tree = schemaGenerator.parse({ schemaObject, name })\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const type = {\n name: schemaManager.getName(name, { type: 'type' }),\n typedName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(options.operationName || name, { group }),\n }\n\n return (\n <Oas.Schema key={[name, schemaObject.$ref].join('-')} name={name} schemaObject={schemaObject} tree={tree}>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[name, imp.name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n keysToOmit={keysToOmit}\n syntaxType={syntaxType}\n />\n </Oas.Schema>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {operationSchemas.map(mapOperationSchema)}\n\n <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>\n {printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager })}\n </File.Source>\n </File>\n )\n },\n Schema({ schema, options }) {\n const { mapper, enumType, syntaxType, optionalType } = options\n const {\n mode,\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginTs>()\n const oas = useOas()\n\n const { getName, getImports, getFile } = useSchemaManager()\n const imports = getImports(schema.tree)\n\n if (enumType === 'asPascalConst') {\n console.warn(`enumType '${enumType}' is deprecated`)\n }\n\n const type = {\n name: getName(schema.name, { type: 'function' }),\n typedName: getName(schema.name, { type: 'type' }),\n file: getFile(schema.name),\n }\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[schema.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n syntaxType={syntaxType}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, SchemaGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { oasGenerator, typeGenerator } from './generators'\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 enumSuffix = 'enum',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n emptySchemaType = unknownType,\n syntaxType = 'type',\n transformers = {},\n oasType = false,\n mapper = {},\n generators = [typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean),\n contentType,\n } = options\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n dateType,\n optionalType,\n oasType,\n enumType,\n enumSuffix,\n // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n emptySchemaType,\n syntaxType,\n group,\n override,\n mapper,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.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 const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.addFile(...operationFiles)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n","import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport { OasType } from '../components'\nimport type { PluginTs } from '../types.ts'\n\nexport const oasGenerator = createReactGenerator<PluginTs>({\n name: 'oas',\n Operations() {\n const {\n pluginManager,\n plugin: {\n options: { output },\n key: pluginKey,\n },\n } = useApp<PluginTs>()\n const oas = useOas()\n\n const file = pluginManager.getFile({ name: 'oas', extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['Infer']} path=\"@kubb/oas\" isTypeOnly />\n\n <OasType name={'oas'} typeName={'Oas'} api={oas.api} />\n </File>\n )\n },\n})\n"]}