@kubb/plugin-ts 3.0.0-beta.1 → 3.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XKDPQUXZ.cjs → chunk-D5MO3NRN.cjs} +21 -18
- package/dist/chunk-D5MO3NRN.cjs.map +1 -0
- package/dist/{chunk-NAVZH2YU.cjs → chunk-F3CKG7QJ.cjs} +39 -21
- package/dist/chunk-F3CKG7QJ.cjs.map +1 -0
- package/dist/{chunk-ERE4SAAA.js → chunk-RTZKXLOS.js} +13 -10
- package/dist/chunk-RTZKXLOS.js.map +1 -0
- package/dist/{chunk-ZD6JQXPK.js → chunk-ULU76MB6.js} +39 -21
- package/dist/chunk-ULU76MB6.js.map +1 -0
- package/dist/components.cjs +3 -3
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{types-DoCOabdx.d.cts → types-zQCmVvxv.d.cts} +1 -2
- package/dist/{types-DoCOabdx.d.ts → types-zQCmVvxv.d.ts} +1 -2
- package/package.json +13 -13
- package/src/components/Type.tsx +19 -11
- package/src/generators/__snapshots__/createPet.ts +3 -10
- package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +3 -10
- package/src/generators/__snapshots__/deletePet.ts +4 -2
- package/src/generators/__snapshots__/getPets.ts +5 -6
- package/src/generators/__snapshots__/showPetById.ts +5 -6
- package/src/generators/typeGenerator.tsx +12 -7
- package/src/parser/index.ts +14 -8
- package/src/plugin.ts +1 -2
- package/src/types.ts +1 -2
- package/dist/chunk-ERE4SAAA.js.map +0 -1
- package/dist/chunk-NAVZH2YU.cjs.map +0 -1
- package/dist/chunk-XKDPQUXZ.cjs.map +0 -1
- package/dist/chunk-ZD6JQXPK.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkF3CKG7QJ_cjs = require('./chunk-F3CKG7QJ.cjs');
|
|
4
4
|
var transformers = require('@kubb/core/transformers');
|
|
5
5
|
var parserTs = require('@kubb/parser-ts');
|
|
6
6
|
var factory = require('@kubb/parser-ts/factory');
|
|
@@ -9,7 +9,6 @@ var components = require('@kubb/plugin-oas/components');
|
|
|
9
9
|
var hooks = require('@kubb/plugin-oas/hooks');
|
|
10
10
|
var path = require('path');
|
|
11
11
|
var core = require('@kubb/core');
|
|
12
|
-
require('@kubb/core/utils');
|
|
13
12
|
var react = require('@kubb/react');
|
|
14
13
|
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
15
14
|
|
|
@@ -38,16 +37,16 @@ var factory__namespace = /*#__PURE__*/_interopNamespace(factory);
|
|
|
38
37
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
39
38
|
|
|
40
39
|
// src/generators/index.ts
|
|
41
|
-
|
|
40
|
+
chunkF3CKG7QJ_cjs.init_cjs_shims();
|
|
42
41
|
|
|
43
42
|
// src/generators/typeGenerator.tsx
|
|
44
|
-
|
|
43
|
+
chunkF3CKG7QJ_cjs.init_cjs_shims();
|
|
45
44
|
|
|
46
45
|
// src/index.ts
|
|
47
|
-
|
|
46
|
+
chunkF3CKG7QJ_cjs.init_cjs_shims();
|
|
48
47
|
|
|
49
48
|
// src/plugin.ts
|
|
50
|
-
|
|
49
|
+
chunkF3CKG7QJ_cjs.init_cjs_shims();
|
|
51
50
|
var pluginTsName = "plugin-ts";
|
|
52
51
|
var pluginTs = core.createPlugin((options) => {
|
|
53
52
|
const {
|
|
@@ -57,7 +56,7 @@ var pluginTs = core.createPlugin((options) => {
|
|
|
57
56
|
include,
|
|
58
57
|
override = [],
|
|
59
58
|
enumType = "asConst",
|
|
60
|
-
enumSuffix = "",
|
|
59
|
+
enumSuffix = "enum",
|
|
61
60
|
dateType = "string",
|
|
62
61
|
unknownType = "any",
|
|
63
62
|
optionalType = "questionToken",
|
|
@@ -148,12 +147,16 @@ var pluginTs = core.createPlugin((options) => {
|
|
|
148
147
|
function printCombinedSchema({ name, schemas, pluginManager }) {
|
|
149
148
|
const properties = {};
|
|
150
149
|
if (schemas.response) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
properties["response"] = factory__namespace.createUnionDeclaration({
|
|
151
|
+
nodes: schemas.responses.map((res) => {
|
|
152
|
+
const identifier = pluginManager.resolveName({
|
|
153
|
+
name: res.name,
|
|
154
|
+
pluginKey: [pluginTsName],
|
|
155
|
+
type: "function"
|
|
156
|
+
});
|
|
157
|
+
return factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
|
|
158
|
+
})
|
|
155
159
|
});
|
|
156
|
-
properties["response"] = factory__namespace.createTypeReferenceNode(factory__namespace.createIdentifier(identifier), void 0);
|
|
157
160
|
}
|
|
158
161
|
if (schemas.request) {
|
|
159
162
|
const identifier = pluginManager.resolveName({
|
|
@@ -248,7 +251,7 @@ var typeGenerator = pluginOas.createReactGenerator({
|
|
|
248
251
|
return /* @__PURE__ */ jsxRuntime.jsxs(components.Oas.Schema, { name, value: schema, tree, children: [
|
|
249
252
|
mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
|
|
250
253
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
251
|
-
|
|
254
|
+
chunkF3CKG7QJ_cjs.Type,
|
|
252
255
|
{
|
|
253
256
|
name: type2.name,
|
|
254
257
|
typedName: type2.typedName,
|
|
@@ -288,7 +291,7 @@ var typeGenerator = pluginOas.createReactGenerator({
|
|
|
288
291
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
289
292
|
mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: type.file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
|
|
290
293
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
-
|
|
294
|
+
chunkF3CKG7QJ_cjs.Type,
|
|
292
295
|
{
|
|
293
296
|
name: type.name,
|
|
294
297
|
typedName: type.typedName,
|
|
@@ -304,7 +307,7 @@ var typeGenerator = pluginOas.createReactGenerator({
|
|
|
304
307
|
});
|
|
305
308
|
|
|
306
309
|
// src/generators/oasGenerator.tsx
|
|
307
|
-
|
|
310
|
+
chunkF3CKG7QJ_cjs.init_cjs_shims();
|
|
308
311
|
var oasGenerator = pluginOas.createReactGenerator({
|
|
309
312
|
name: "oas",
|
|
310
313
|
Operations() {
|
|
@@ -319,7 +322,7 @@ var oasGenerator = pluginOas.createReactGenerator({
|
|
|
319
322
|
const file = pluginManager.getFile({ name: "oas", extname: ".ts", pluginKey });
|
|
320
323
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
321
324
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["Infer"], path: "@kubb/oas", isTypeOnly: true }),
|
|
322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
325
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkF3CKG7QJ_cjs.OasType, { name: "oas", typeName: "Oas", api: oas.api })
|
|
323
326
|
] });
|
|
324
327
|
}
|
|
325
328
|
});
|
|
@@ -328,5 +331,5 @@ exports.oasGenerator = oasGenerator;
|
|
|
328
331
|
exports.pluginTs = pluginTs;
|
|
329
332
|
exports.pluginTsName = pluginTsName;
|
|
330
333
|
exports.typeGenerator = typeGenerator;
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
334
|
+
//# sourceMappingURL=chunk-D5MO3NRN.cjs.map
|
|
335
|
+
//# sourceMappingURL=chunk-D5MO3NRN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generators/index.ts","../src/generators/typeGenerator.tsx","../src/index.ts","../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","OasType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,gCAAA,EAAA;;;ACAAA,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,YAAA,EAAAC,gBAAe,EAAC;AAAA,IAChB,OAAU,GAAA,KAAA;AAAA,IACV,SAAS,EAAC;AAAA,IACV,UAAA,GAAa,CAAC,aAAe,EAAA,OAAA,KAAY,UAAU,YAAe,GAAA,KAAA,CAAS,CAAE,CAAA,MAAA,CAAO,OAAO;AAAA,GACzF,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,YAAA;AAAA,IAC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ACF,EAAA,CAAA;AAAA;AAGN,CAAC;;;AG5MDvB,gCAAA,EAAA;AAMO,IAAM,eAAec,8BAA+B,CAAA;AAAA,EACzD,IAAM,EAAA,KAAA;AAAA,EACN,UAAa,GAAA;AACX,IAAM,MAAA;AAAA,MACJ,aAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,OAAA,EAAS,EAAE,MAAO,EAAA;AAAA,QAClB,GAAK,EAAA;AAAA;AACP,QACEC,YAAiB,EAAA;AACrB,IAAA,MAAM,MAAMC,YAAO,EAAA;AAEnB,IAAM,MAAA,IAAA,GAAO,cAAc,OAAQ,CAAA,EAAE,MAAM,KAAO,EAAA,OAAA,EAAS,KAAO,EAAA,SAAA,EAAW,CAAA;AAE7E,IAAA,uBACEQ,eAACF,CAAAA,UAAAA,EAAA,EAAK,QAAU,EAAA,IAAA,CAAK,UAAU,IAAM,EAAA,IAAA,CAAK,IAAM,EAAA,IAAA,EAAM,KAAK,IAAM,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA,MAAA,EAAQ,QAAQ,MACvG,EAAA,QAAA,EAAA;AAAA,sBAAAD,cAAAA,CAACC,UAAK,CAAA,MAAA,EAAL,EAAY,IAAA,EAAM,CAAC,OAAO,CAAG,EAAA,IAAA,EAAK,WAAY,EAAA,UAAA,EAAU,IAAC,EAAA,CAAA;AAAA,sBAE1DD,eAACI,yBAAQ,EAAA,EAAA,IAAA,EAAM,OAAO,QAAU,EAAA,KAAA,EAAO,GAAK,EAAA,GAAA,CAAI,GAAK,EAAA;AAAA,KACvD,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-D5MO3NRN.cjs","sourcesContent":["export { typeGenerator } from './typeGenerator.tsx'\nexport { oasGenerator } from './oasGenerator.tsx'\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 { createPropertySignature, modifiers } from '@kubb/parser-ts/factory'\nimport { type OperationSchema as OperationSchemaType, type OperationSchemas, SchemaGenerator, createReactGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\nimport type ts from 'typescript'\nimport { Type } from '../components'\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, optionalType } = options\n\n const { plugin, pluginManager, mode } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = 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, description, keysToOmit, ...options }: OperationSchemaType, i: number) => {\n const tree = schemaGenerator.parse({ schema, name })\n const imports = schemaManager.getImports(tree)\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, { tag: options.operation?.getTags()[0]?.name }),\n }\n\n return (\n <Oas.Schema key={i} name={name} value={schema} tree={tree}>\n {mode === 'split' && imports.map((imp, index) => <File.Import key={index} root={file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n keysToOmit={keysToOmit}\n />\n </Oas.Schema>\n )\n }\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={plugin.options.output?.banner} footer={plugin.options.output?.footer}>\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, optionalType } = options\n const {\n mode,\n plugin: {\n options: { output },\n },\n } = useApp<PluginTs>()\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 baseName={type.file.baseName} path={type.file.path} meta={type.file.meta} banner={output?.banner} footer={output?.footer}>\n {mode === 'split' && imports.map((imp, index) => <File.Import key={index} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={schema.value.description}\n tree={schema.tree}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n />\n </File>\n )\n },\n})\n","export { pluginTs, pluginTsName } from './plugin.ts'\nexport type { PluginTs } from './types.ts'\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 transformers = {},\n oasType = false,\n mapper = {},\n generators = [typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean),\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 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 (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\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 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: swaggerPlugin.context.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: swaggerPlugin.context.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 files: this.fileManager.files,\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 { 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 baseName={file.baseName} path={file.path} meta={file.meta} banner={output?.banner} footer={output?.footer}>\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"]}
|
|
@@ -59,9 +59,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
59
|
mod
|
|
60
60
|
));
|
|
61
61
|
|
|
62
|
-
// ../../node_modules/.pnpm/tsup@8.3.
|
|
62
|
+
// ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.47.11_@types+node@20.17.3__@swc+core@1.7.22_jiti@2.3.3__njwlryiwvpy37iky3y3g2bvfku/node_modules/tsup/assets/cjs_shims.js
|
|
63
63
|
var init_cjs_shims = __esm({
|
|
64
|
-
"../../node_modules/.pnpm/tsup@8.3.
|
|
64
|
+
"../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.47.11_@types+node@20.17.3__@swc+core@1.7.22_jiti@2.3.3__njwlryiwvpy37iky3y3g2bvfku/node_modules/tsup/assets/cjs_shims.js"() {
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
@@ -2342,19 +2342,23 @@ var typeKeywordMapper = {
|
|
|
2342
2342
|
catchall: void 0,
|
|
2343
2343
|
name: void 0
|
|
2344
2344
|
};
|
|
2345
|
-
function parse(parent, current, options) {
|
|
2345
|
+
function parse({ parent, current, siblings }, options) {
|
|
2346
2346
|
const value = typeKeywordMapper[current.keyword];
|
|
2347
2347
|
if (!value) {
|
|
2348
2348
|
return void 0;
|
|
2349
2349
|
}
|
|
2350
2350
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.union)) {
|
|
2351
|
-
return typeKeywordMapper.union(
|
|
2351
|
+
return typeKeywordMapper.union(
|
|
2352
|
+
current.args.map((schema) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean)
|
|
2353
|
+
);
|
|
2352
2354
|
}
|
|
2353
2355
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.and)) {
|
|
2354
|
-
return typeKeywordMapper.and(current.args.map((schema) => parse(current, schema, options)).filter(Boolean));
|
|
2356
|
+
return typeKeywordMapper.and(current.args.map((schema) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean));
|
|
2355
2357
|
}
|
|
2356
2358
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.array)) {
|
|
2357
|
-
return typeKeywordMapper.array(
|
|
2359
|
+
return typeKeywordMapper.array(
|
|
2360
|
+
current.args.items.map((schema) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean)
|
|
2361
|
+
);
|
|
2358
2362
|
}
|
|
2359
2363
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.enum)) {
|
|
2360
2364
|
return typeKeywordMapper.enum(current.args.typeName);
|
|
@@ -2366,7 +2370,9 @@ function parse(parent, current, options) {
|
|
|
2366
2370
|
return value();
|
|
2367
2371
|
}
|
|
2368
2372
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.tuple)) {
|
|
2369
|
-
return typeKeywordMapper.tuple(
|
|
2373
|
+
return typeKeywordMapper.tuple(
|
|
2374
|
+
current.args.items.map((schema) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean)
|
|
2375
|
+
);
|
|
2370
2376
|
}
|
|
2371
2377
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.const)) {
|
|
2372
2378
|
return typeKeywordMapper.const(current.args.name, current.args.format);
|
|
@@ -2390,7 +2396,7 @@ function parse(parent, current, options) {
|
|
|
2390
2396
|
const defaultSchema = schemas.find((schema) => schema.keyword === pluginOas.schemaKeywords.default);
|
|
2391
2397
|
const exampleSchema = schemas.find((schema) => schema.keyword === pluginOas.schemaKeywords.example);
|
|
2392
2398
|
const schemaSchema = schemas.find((schema) => schema.keyword === pluginOas.schemaKeywords.schema);
|
|
2393
|
-
let type = schemas.map((schema) => parse(current, schema, options)).filter(Boolean)[0];
|
|
2399
|
+
let type = schemas.map((schema) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean)[0];
|
|
2394
2400
|
if (isNullable) {
|
|
2395
2401
|
type = factory__namespace.createUnionDeclaration({
|
|
2396
2402
|
nodes: [type, factory__namespace.keywordTypeNodes.null]
|
|
@@ -2424,7 +2430,7 @@ function parse(parent, current, options) {
|
|
|
2424
2430
|
});
|
|
2425
2431
|
});
|
|
2426
2432
|
const additionalProperties = current.args?.additionalProperties?.length ? factory__namespace.createIndexSignature(
|
|
2427
|
-
current.args.additionalProperties.map((schema) => parse(current, schema, options)).filter(Boolean).at(0)
|
|
2433
|
+
current.args.additionalProperties.map((schema) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean).at(0)
|
|
2428
2434
|
) : void 0;
|
|
2429
2435
|
return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean));
|
|
2430
2436
|
}
|
|
@@ -2451,15 +2457,18 @@ function Type2({ name, typedName, tree, keysToOmit, optionalType, enumType, mapp
|
|
|
2451
2457
|
const isNullable = tree.some((item) => item.keyword === pluginOas.schemaKeywords.nullable);
|
|
2452
2458
|
const isOptional = tree.some((item) => item.keyword === pluginOas.schemaKeywords.optional);
|
|
2453
2459
|
let type = tree.map(
|
|
2454
|
-
(schema) => parse(
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2460
|
+
(schema, _index, siblings) => parse(
|
|
2461
|
+
{ parent: void 0, current: schema, siblings },
|
|
2462
|
+
{
|
|
2463
|
+
name,
|
|
2464
|
+
typeName: typedName,
|
|
2465
|
+
description,
|
|
2466
|
+
keysToOmit,
|
|
2467
|
+
optionalType,
|
|
2468
|
+
enumType,
|
|
2469
|
+
mapper
|
|
2470
|
+
}
|
|
2471
|
+
)
|
|
2463
2472
|
).filter(Boolean).at(0) || typeKeywordMapper.undefined();
|
|
2464
2473
|
if (isNullable) {
|
|
2465
2474
|
type = factory__namespace.createUnionDeclaration({
|
|
@@ -2511,7 +2520,16 @@ function Type2({ name, typedName, tree, keysToOmit, optionalType, enumType, mapp
|
|
|
2511
2520
|
return /* @__PURE__ */ jsxRuntime.jsxs(import_react3.Fragment, { children: [
|
|
2512
2521
|
enums.map(({ name: name2, nameNode, typeName, typeNode }, index) => /* @__PURE__ */ jsxRuntime.jsxs(import_react3.Fragment, { children: [
|
|
2513
2522
|
nameNode && /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: name2, isExportable: true, isIndexable: true, children: parserTs.print([nameNode]) }),
|
|
2514
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2523
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2524
|
+
react.File.Source,
|
|
2525
|
+
{
|
|
2526
|
+
name: typeName,
|
|
2527
|
+
isIndexable: true,
|
|
2528
|
+
isExportable: ["enum", "asConst", "constEnum", "literal", void 0].includes(enumType),
|
|
2529
|
+
isTypeOnly: ["asConst", "constEnum", "literal", void 0].includes(enumType),
|
|
2530
|
+
children: parserTs.print([typeNode])
|
|
2531
|
+
}
|
|
2532
|
+
)
|
|
2515
2533
|
] }, [name2, nameNode].join("-"))),
|
|
2516
2534
|
enums.every((item) => item.typeName !== name) && /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: typedName, isTypeOnly: true, isExportable: true, isIndexable: true, children: parserTs.print(typeNodes) })
|
|
2517
2535
|
] });
|
|
@@ -2544,5 +2562,5 @@ react/cjs/react.development.js:
|
|
|
2544
2562
|
exports.OasType = OasType;
|
|
2545
2563
|
exports.Type = Type2;
|
|
2546
2564
|
exports.init_cjs_shims = init_cjs_shims;
|
|
2547
|
-
//# sourceMappingURL=chunk-
|
|
2548
|
-
//# sourceMappingURL=chunk-
|
|
2565
|
+
//# sourceMappingURL=chunk-F3CKG7QJ.cjs.map
|
|
2566
|
+
//# sourceMappingURL=chunk-F3CKG7QJ.cjs.map
|