@kubb/plugin-ts 3.0.0-alpha.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-ts/dist/chunk-XCNZFEPR.cjs","../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OasType.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/components/Schema.tsx","../src/parser/index.ts","../src/index.ts"],"names":["Template","transformers","jsxs","jsx"],"mappings":"AAAA;ACAA,wEAAiB;AAEjB,kCAAyD;AACzD,mHAAsC;AACtC,yCAA+B;AAC/B,6CAA8B;ADC9B;AACA;AEPA;AACA,yDAAoB;AACpB,oCAAgC;AFShC;AACA;AGZA;AACA,+CAAuB;AAiBnB,qDAAA;AAFJ,SAAS,QAAA,CAAS,EAAE,IAAA,EAAM,QAAA,EAAU,IAAI,CAAA,EAA6B;AACnE,EAAA,uBACE,8BAAA,oBAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,CAAA,aAAA,EAAgB,IAAI,CAAA,GAAA,EAAM,IAAA,CAAK,SAAA,CAAU,GAAA,EAAK,KAAA,CAAA,EAAW,CAAC,CAAC,CAAA,SAAA,CAAA;AAAA,oBAC5D,6BAAA,IAAC,EAAA,CAAA,CAAG,CAAA;AAAA,oBACJ,6BAAA,WAAC,EAAA,EAAK,IAAA,EAAM,QAAA,EAAU,MAAA,EAAM,IAAA,EACzB,QAAA,EAAA,CAAA,aAAA,EAAgB,IAAI,CAAA,CAAA,EAAA,CACvB;AAAA,EAAA,EAAA,CACF,CAAA;AAEJ;AAEA,IAAM,iBAAA,EAAmB,EAAE,OAAA,EAAS,SAAS,CAAA;AAWtC,SAAS,OAAA,CAAQ,EAAE,IAAA,EAAM,QAAA,EAAU,QAAA,EAAAA,UAAAA,EAAW,gBAAA,CAAiB,QAAQ,CAAA,EAAqB;AACjG,EAAA,MAAM,IAA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C,MAAA;AACrE,QAAA;AACoB,QAAA;AACP,QAAA;AACkB,QAAA;AAC/B,QAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AAEqD,MAAA;AAClB,MAAA;AACtC,IAAA;AACiB,IAAA;AACyB,MAAA;AACtC,QAAA;AACF,MAAA;AAEmE,MAAA;AAEjC,MAAA;AAChC,QAAA;AACA,QAAA;AACmC,QAAA;AACtB,QAAA;AACd,MAAA;AACH,IAAA;AACF,EAAA;AACD;ADod2F;AACA;AQtlBhE;AAIA;AAEb;ARolB6E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/plugin-ts/dist/chunk-XCNZFEPR.cjs","sourcesContent":[null,"import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n mapper = {},\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginTsName,\n options: {\n extName: output.extName,\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 (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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 writeFile(path, source) {\n if (!path.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(path, source, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.api.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.api.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\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.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\n})\n","import { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { OasType } from './components/OasType.tsx'\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={this}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>\n </App>,\n )\n\n return root.files\n }\n\n async operation(operation: Operation, options: PluginTs['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import { Parser, File, Type, useApp } from '@kubb/react'\nimport { useOas } from '@kubb/plugin-oas/hooks'\n\nimport type { OasTypes } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({ name, typeName, api }: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({ name, typeName, Template = defaultTemplates.default }: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function ({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const {\n pluginManager,\n plugin: { key: pluginKey },\n } = useApp<PluginTs>()\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['Infer']} path=\"@kubb/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Parser>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { File, Parser, useApp } from '@kubb/react'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { PluginManager } from '@kubb/core'\nimport type { Operation } from '@kubb/oas'\nimport type { ts } from '@kubb/parser-ts'\nimport type { OperationSchema as OperationSchemaType } from '@kubb/plugin-oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginTs } from '../types.ts'\nimport { Schema } from './Schema.tsx'\n\nfunction printCombinedSchema({\n name,\n operation,\n schemas,\n pluginManager,\n}: { name: string; operation: Operation; schemas: OperationSchemas; pluginManager: PluginManager }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n const identifier = pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['response'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\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: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\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\ntype Props = {\n description?: string\n keysToOmit?: string[]\n}\n\nexport function OperationSchema({ keysToOmit, description }: Props): ReactNode {\n return <Schema keysToOmit={keysToOmit} description={description} />\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager, plugin, mode, fileManager } = useApp<PluginTs>()\n const oas = useOas()\n const { getSchemas, getFile, getName } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const factoryName = getName(operation, { type: 'type' })\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema, description, keysToOmit, ...options }: OperationSchemaType, i: number) => {\n const tree = generator.parse({ schema, name })\n\n return (\n <Oas.Schema key={i} name={name} value={schema} tree={tree}>\n {mode === 'split' && <Oas.Schema.Imports extName={plugin.options.extName} isTypeOnly />}\n <File.Source>\n <OperationSchema description={description} keysToOmit={keysToOmit} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {items.map(mapItem)}\n\n <File.Source>{printCombinedSchema({ name: factoryName, operation, schemas, pluginManager })}</File.Source>\n </File>\n </Parser>\n )\n}\n","import type { SchemaObject } from '@kubb/oas'\nimport { SchemaGenerator as Generator } from '@kubb/plugin-oas'\nimport type { SchemaMethodResult } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport { Schema } from './components/Schema.tsx'\nimport type { FileMeta, PluginTs } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginTs['resolvedOptions'], PluginTs> {\n async schema(name: string, schema: SchemaObject, options: PluginTs['resolvedOptions']): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const tree = this.parse({ schema, name })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={name} value={schema} tree={tree}>\n <Schema.File />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import { Oas } from '@kubb/plugin-oas/components'\nimport { File, useApp } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport { print, type ts } from '@kubb/parser-ts'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { useSchema } from '@kubb/plugin-oas/hooks'\nimport type { ReactNode } from 'react'\nimport { parse, typeKeywordMapper } from '../parser/index.ts'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Schema(props: Props): ReactNode {\n const { keysToOmit, description } = props\n const { tree, name } = useSchema()\n const {\n pluginManager,\n plugin: {\n options: { mapper, enumType, optionalType },\n },\n } = useApp<PluginTs>()\n\n // all checks are also inside this.schema(React)\n const resolvedName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n const typeName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const nodes: ts.Node[] = []\n const extraNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\n\n let type =\n (tree\n .map((schema) => parse(undefined, schema, { name: resolvedName, typeName, description, keysToOmit, optionalType, enumType, mapper }))\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: resolvedName,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n })\n\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n if (enumSchemas) {\n enumSchemas.forEach((enumSchema) => {\n extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumSchema.args.name),\n typeName: enumSchema.args.typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as [string, string][],\n type: enumType,\n }),\n )\n })\n }\n\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }),\n )\n\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return print([...extraNodes, ...filterdNodes])\n}\n\ntype FileProps = {}\n\nSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager } = useApp<PluginTs>()\n const { schema } = useSchema()\n\n return (\n <Oas.Schema.File output={pluginManager.config.output.path}>\n <File.Source>\n <Schema description={schema?.description} />\n </File.Source>\n </Oas.Schema.File>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport * as factory from '@kubb/parser-ts/factory'\nimport { isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { ts } from '@kubb/parser-ts'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number, format?: 'string' | 'number') => {\n if (!name) {\n return undefined\n }\n\n if (format === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: undefined,\n url: undefined,\n strict: undefined,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: undefined,\n email: undefined,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n} satisfies SchemaMapper<ts.Node | null | undefined>\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n keysToOmit?: string[]\n mapper?: Record<string, ts.PropertySignature>\n}\n\nexport function parse(parent: Schema | undefined, current: Schema, options: ParserOptions): ts.Node | null | undefined {\n const value = typeKeywordMapper[current.keyword as keyof typeof typeKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return typeKeywordMapper.union(current.args.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return typeKeywordMapper.and(current.args.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return typeKeywordMapper.array(current.args.items.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return typeKeywordMapper.enum(current.args.typeName)\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return typeKeywordMapper.ref(current.args.name)\n }\n\n if (isKeyword(current, schemaKeywords.blob)) {\n return value()\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return typeKeywordMapper.tuple(current.args.items.map((schema) => parse(current, schema, options)).filter(Boolean) as ts.TypeNode[])\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n return typeKeywordMapper.const(current.args.name, current.args.format)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return options.mapper?.[mappedName]\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n\n let type = schemas.map((schema) => parse(current, schema, options)).filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertySignature = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? factory.createIndexSignature(\n current.args.additionalProperties\n .map((schema) => parse(current, schema, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode,\n )\n : undefined\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return typeKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return typeKeywordMapper.date(current.args.type)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return typeKeywordMapper.time(current.args.type)\n }\n\n if (current.keyword in typeKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import { pluginTs } from './plugin.ts'\n\nexport { pluginTs, pluginTsName } from './plugin.ts'\nexport type { PluginTs } from './types.ts'\n\n/**\n * @deprecated Use `import { pluginTs } from '@kubb/plugin-ts'` instead\n */\nconst definePluginDefault = pluginTs\n/**\n * @deprecated Use `import { pluginTs } from '@kubb/plugin-ts'` instead\n */\nexport const definePlugin = pluginTs\n\nexport default definePluginDefault\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkXCNZFEPRcjs = require('./chunk-XCNZFEPR.cjs');
6
+
7
+
8
+
9
+
10
+ exports.OasType = _chunkXCNZFEPRcjs.OasType; exports.OperationSchema = _chunkXCNZFEPRcjs.OperationSchema; exports.Schema = _chunkXCNZFEPRcjs.Schema;
11
+ //# sourceMappingURL=components.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-ts/dist/components.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,oJAAC","file":"/home/runner/work/kubb/kubb/packages/plugin-ts/dist/components.cjs"}
@@ -0,0 +1,60 @@
1
+ import { OasTypes } from '@kubb/oas';
2
+ import { ReactNode } from 'react';
3
+
4
+ type TemplateProps = {
5
+ /**
6
+ * Name of the function
7
+ */
8
+ name: string;
9
+ typeName: string;
10
+ api: OasTypes.OASDocument;
11
+ };
12
+ declare function Template({ name, typeName, api }: TemplateProps): ReactNode;
13
+ declare const defaultTemplates: {
14
+ readonly default: typeof Template;
15
+ };
16
+ type Props$2 = {
17
+ name: string;
18
+ typeName: string;
19
+ /**
20
+ * This will make it possible to override the default behaviour.
21
+ */
22
+ Template?: React.ComponentType<React.ComponentProps<typeof Template>>;
23
+ };
24
+ declare function OasType({ name, typeName, Template }: Props$2): ReactNode;
25
+ declare namespace OasType {
26
+ var File: ({ name, typeName, templates }: FileProps$2) => ReactNode;
27
+ var templates: {
28
+ readonly default: typeof Template;
29
+ };
30
+ }
31
+ type FileProps$2 = {
32
+ name: string;
33
+ typeName: string;
34
+ /**
35
+ * This will make it possible to override the default behaviour.
36
+ */
37
+ templates?: typeof defaultTemplates;
38
+ };
39
+
40
+ type Props$1 = {
41
+ description?: string;
42
+ keysToOmit?: string[];
43
+ };
44
+ declare function OperationSchema({ keysToOmit, description }: Props$1): ReactNode;
45
+ declare namespace OperationSchema {
46
+ var File: ({}: FileProps$1) => ReactNode;
47
+ }
48
+ type FileProps$1 = {};
49
+
50
+ type Props = {
51
+ description?: string;
52
+ keysToOmit?: string[];
53
+ };
54
+ declare function Schema(props: Props): ReactNode;
55
+ declare namespace Schema {
56
+ var File: ({}: FileProps) => ReactNode;
57
+ }
58
+ type FileProps = {};
59
+
60
+ export { OasType, OperationSchema, Schema };
@@ -0,0 +1,60 @@
1
+ import { OasTypes } from '@kubb/oas';
2
+ import { ReactNode } from 'react';
3
+
4
+ type TemplateProps = {
5
+ /**
6
+ * Name of the function
7
+ */
8
+ name: string;
9
+ typeName: string;
10
+ api: OasTypes.OASDocument;
11
+ };
12
+ declare function Template({ name, typeName, api }: TemplateProps): ReactNode;
13
+ declare const defaultTemplates: {
14
+ readonly default: typeof Template;
15
+ };
16
+ type Props$2 = {
17
+ name: string;
18
+ typeName: string;
19
+ /**
20
+ * This will make it possible to override the default behaviour.
21
+ */
22
+ Template?: React.ComponentType<React.ComponentProps<typeof Template>>;
23
+ };
24
+ declare function OasType({ name, typeName, Template }: Props$2): ReactNode;
25
+ declare namespace OasType {
26
+ var File: ({ name, typeName, templates }: FileProps$2) => ReactNode;
27
+ var templates: {
28
+ readonly default: typeof Template;
29
+ };
30
+ }
31
+ type FileProps$2 = {
32
+ name: string;
33
+ typeName: string;
34
+ /**
35
+ * This will make it possible to override the default behaviour.
36
+ */
37
+ templates?: typeof defaultTemplates;
38
+ };
39
+
40
+ type Props$1 = {
41
+ description?: string;
42
+ keysToOmit?: string[];
43
+ };
44
+ declare function OperationSchema({ keysToOmit, description }: Props$1): ReactNode;
45
+ declare namespace OperationSchema {
46
+ var File: ({}: FileProps$1) => ReactNode;
47
+ }
48
+ type FileProps$1 = {};
49
+
50
+ type Props = {
51
+ description?: string;
52
+ keysToOmit?: string[];
53
+ };
54
+ declare function Schema(props: Props): ReactNode;
55
+ declare namespace Schema {
56
+ var File: ({}: FileProps) => ReactNode;
57
+ }
58
+ type FileProps = {};
59
+
60
+ export { OasType, OperationSchema, Schema };
@@ -0,0 +1,11 @@
1
+ import {
2
+ OasType,
3
+ OperationSchema,
4
+ Schema
5
+ } from "./chunk-WOQIHEJC.js";
6
+ export {
7
+ OasType,
8
+ OperationSchema,
9
+ Schema
10
+ };
11
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.cjs ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkXCNZFEPRcjs = require('./chunk-XCNZFEPR.cjs');
7
+
8
+
9
+
10
+
11
+
12
+ exports.default = _chunkXCNZFEPRcjs.src_default; exports.definePlugin = _chunkXCNZFEPRcjs.definePlugin; exports.pluginTs = _chunkXCNZFEPRcjs.pluginTs; exports.pluginTsName = _chunkXCNZFEPRcjs.pluginTsName;
13
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-ts/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,6MAAC","file":"/home/runner/work/kubb/kubb/packages/plugin-ts/dist/index.cjs"}
@@ -0,0 +1,141 @@
1
+ import * as _kubb_core from '@kubb/core';
2
+ import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
3
+ import * as KubbFile from '@kubb/fs/types';
4
+ import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
5
+ import { ts } from '@kubb/parser-ts';
6
+
7
+ type Options = {
8
+ output?: {
9
+ /**
10
+ * Relative path to save the TypeScript types.
11
+ * When output is a file it will save all models inside that file else it will create a file per schema item.
12
+ * @default 'types'
13
+ */
14
+ path: string;
15
+ /**
16
+ * Name to be used for the `export * as {{exportAs}} from './'`
17
+ */
18
+ exportAs?: string;
19
+ /**
20
+ * Add an extension to the generated imports and exports, default it will not use an extension
21
+ */
22
+ extName?: KubbFile.Extname;
23
+ /**
24
+ * Define what needs to exported, here you can also disable the export of barrel files
25
+ * @default `'barrel'`
26
+ */
27
+ exportType?: 'barrel' | 'barrelNamed' | false;
28
+ };
29
+ /**
30
+ * Group the TypeScript types based on the provided name.
31
+ */
32
+ group?: {
33
+ /**
34
+ * Tag will group based on the operation tag inside the Swagger file.
35
+ */
36
+ type: 'tag';
37
+ /**
38
+ * Relative path to save the grouped TypeScript Types.
39
+ *
40
+ * `{{tag}}` will be replaced by the current tagName.
41
+ * @example `${output}/{{tag}}Controller` => `models/PetController`
42
+ * @default `${output}/{{tag}}Controller`
43
+ */
44
+ output?: string;
45
+ };
46
+ /**
47
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
48
+ */
49
+ exclude?: Array<Exclude>;
50
+ /**
51
+ * Array containing include parameters to include tags/operations/methods/paths.
52
+ */
53
+ include?: Array<Include>;
54
+ /**
55
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
56
+ */
57
+ override?: Array<Override<ResolvedOptions>>;
58
+ /**
59
+ * Choose to use `enum` or `as const` for enums
60
+ * @default 'asConst'
61
+ */
62
+ enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
63
+ /**
64
+ * Set a suffix for the generated enums.
65
+ * @default ''
66
+ * Default will be `'enum'` in version 3 of Kubb
67
+ */
68
+ enumSuffix?: string;
69
+ /**
70
+ * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
71
+ * @default 'string'
72
+ */
73
+ dateType?: 'string' | 'date';
74
+ /**
75
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
76
+ * @default 'any'
77
+ */
78
+ unknownType?: 'any' | 'unknown';
79
+ /**
80
+ * Choose what to use as mode for an optional value.
81
+ * @examples 'questionToken': type?: string
82
+ * @examples 'undefined': type: string | undefined
83
+ * @examples 'questionTokenAndUndefined': type?: string | undefined
84
+ * @default 'questionToken'
85
+ */
86
+ optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
87
+ transformers?: {
88
+ /**
89
+ * Customize the names based on the type that is provided by the plugin.
90
+ */
91
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
92
+ };
93
+ /**
94
+ * Export an Oas object as Oas type with `import type { Infer } from '@kubb/oas'`
95
+ */
96
+ oasType?: 'infer' | false;
97
+ /**
98
+ * @example
99
+ * Use https://ts-ast-viewer.com to generate factory code(see createPropertySignature)
100
+ * category: factory.createPropertySignature(
101
+ * undefined,
102
+ * factory.createIdentifier("category"),
103
+ * factory.createToken(ts.SyntaxKind.QuestionToken),
104
+ * factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
105
+ * )
106
+ */
107
+ mapper?: Record<string, ts.PropertySignature>;
108
+ };
109
+ type ResolvedOptions = {
110
+ extName: KubbFile.Extname | undefined;
111
+ enumType: NonNullable<Options['enumType']>;
112
+ enumSuffix: NonNullable<Options['enumSuffix']>;
113
+ dateType: NonNullable<Options['dateType']>;
114
+ unknownType: NonNullable<Options['unknownType']>;
115
+ optionalType: NonNullable<Options['optionalType']>;
116
+ override: NonNullable<Options['override']>;
117
+ transformers: NonNullable<Options['transformers']>;
118
+ oasType: NonNullable<Options['oasType']>;
119
+ usedEnumNames: Record<string, number>;
120
+ mapper: Record<string, any>;
121
+ };
122
+ type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
123
+ declare module '@kubb/core' {
124
+ interface _Register {
125
+ ['@kubb/plugin-ts']: PluginTs;
126
+ }
127
+ }
128
+
129
+ declare const pluginTsName = "plugin-ts";
130
+ declare const pluginTs: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
131
+
132
+ /**
133
+ * @deprecated Use `import { pluginTs } from '@kubb/plugin-ts'` instead
134
+ */
135
+ declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
136
+ /**
137
+ * @deprecated Use `import { pluginTs } from '@kubb/plugin-ts'` instead
138
+ */
139
+ declare const definePlugin: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
140
+
141
+ export { type PluginTs, definePluginDefault as default, definePlugin, pluginTs, pluginTsName };
@@ -0,0 +1,141 @@
1
+ import * as _kubb_core from '@kubb/core';
2
+ import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
3
+ import * as KubbFile from '@kubb/fs/types';
4
+ import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
5
+ import { ts } from '@kubb/parser-ts';
6
+
7
+ type Options = {
8
+ output?: {
9
+ /**
10
+ * Relative path to save the TypeScript types.
11
+ * When output is a file it will save all models inside that file else it will create a file per schema item.
12
+ * @default 'types'
13
+ */
14
+ path: string;
15
+ /**
16
+ * Name to be used for the `export * as {{exportAs}} from './'`
17
+ */
18
+ exportAs?: string;
19
+ /**
20
+ * Add an extension to the generated imports and exports, default it will not use an extension
21
+ */
22
+ extName?: KubbFile.Extname;
23
+ /**
24
+ * Define what needs to exported, here you can also disable the export of barrel files
25
+ * @default `'barrel'`
26
+ */
27
+ exportType?: 'barrel' | 'barrelNamed' | false;
28
+ };
29
+ /**
30
+ * Group the TypeScript types based on the provided name.
31
+ */
32
+ group?: {
33
+ /**
34
+ * Tag will group based on the operation tag inside the Swagger file.
35
+ */
36
+ type: 'tag';
37
+ /**
38
+ * Relative path to save the grouped TypeScript Types.
39
+ *
40
+ * `{{tag}}` will be replaced by the current tagName.
41
+ * @example `${output}/{{tag}}Controller` => `models/PetController`
42
+ * @default `${output}/{{tag}}Controller`
43
+ */
44
+ output?: string;
45
+ };
46
+ /**
47
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
48
+ */
49
+ exclude?: Array<Exclude>;
50
+ /**
51
+ * Array containing include parameters to include tags/operations/methods/paths.
52
+ */
53
+ include?: Array<Include>;
54
+ /**
55
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
56
+ */
57
+ override?: Array<Override<ResolvedOptions>>;
58
+ /**
59
+ * Choose to use `enum` or `as const` for enums
60
+ * @default 'asConst'
61
+ */
62
+ enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
63
+ /**
64
+ * Set a suffix for the generated enums.
65
+ * @default ''
66
+ * Default will be `'enum'` in version 3 of Kubb
67
+ */
68
+ enumSuffix?: string;
69
+ /**
70
+ * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
71
+ * @default 'string'
72
+ */
73
+ dateType?: 'string' | 'date';
74
+ /**
75
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
76
+ * @default 'any'
77
+ */
78
+ unknownType?: 'any' | 'unknown';
79
+ /**
80
+ * Choose what to use as mode for an optional value.
81
+ * @examples 'questionToken': type?: string
82
+ * @examples 'undefined': type: string | undefined
83
+ * @examples 'questionTokenAndUndefined': type?: string | undefined
84
+ * @default 'questionToken'
85
+ */
86
+ optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
87
+ transformers?: {
88
+ /**
89
+ * Customize the names based on the type that is provided by the plugin.
90
+ */
91
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
92
+ };
93
+ /**
94
+ * Export an Oas object as Oas type with `import type { Infer } from '@kubb/oas'`
95
+ */
96
+ oasType?: 'infer' | false;
97
+ /**
98
+ * @example
99
+ * Use https://ts-ast-viewer.com to generate factory code(see createPropertySignature)
100
+ * category: factory.createPropertySignature(
101
+ * undefined,
102
+ * factory.createIdentifier("category"),
103
+ * factory.createToken(ts.SyntaxKind.QuestionToken),
104
+ * factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
105
+ * )
106
+ */
107
+ mapper?: Record<string, ts.PropertySignature>;
108
+ };
109
+ type ResolvedOptions = {
110
+ extName: KubbFile.Extname | undefined;
111
+ enumType: NonNullable<Options['enumType']>;
112
+ enumSuffix: NonNullable<Options['enumSuffix']>;
113
+ dateType: NonNullable<Options['dateType']>;
114
+ unknownType: NonNullable<Options['unknownType']>;
115
+ optionalType: NonNullable<Options['optionalType']>;
116
+ override: NonNullable<Options['override']>;
117
+ transformers: NonNullable<Options['transformers']>;
118
+ oasType: NonNullable<Options['oasType']>;
119
+ usedEnumNames: Record<string, number>;
120
+ mapper: Record<string, any>;
121
+ };
122
+ type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
123
+ declare module '@kubb/core' {
124
+ interface _Register {
125
+ ['@kubb/plugin-ts']: PluginTs;
126
+ }
127
+ }
128
+
129
+ declare const pluginTsName = "plugin-ts";
130
+ declare const pluginTs: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
131
+
132
+ /**
133
+ * @deprecated Use `import { pluginTs } from '@kubb/plugin-ts'` instead
134
+ */
135
+ declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
136
+ /**
137
+ * @deprecated Use `import { pluginTs } from '@kubb/plugin-ts'` instead
138
+ */
139
+ declare const definePlugin: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginTs>;
140
+
141
+ export { type PluginTs, definePluginDefault as default, definePlugin, pluginTs, pluginTsName };
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import {
2
+ definePlugin,
3
+ pluginTs,
4
+ pluginTsName,
5
+ src_default
6
+ } from "./chunk-WOQIHEJC.js";
7
+ export {
8
+ src_default as default,
9
+ definePlugin,
10
+ pluginTs,
11
+ pluginTsName
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/oas.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=oas.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/plugin-ts/dist/oas.cjs"],"names":[],"mappings":"AAAA","file":"/home/runner/work/kubb/kubb/packages/plugin-ts/dist/oas.cjs"}
package/dist/oas.d.cts ADDED
@@ -0,0 +1 @@
1
+ export { Infer, Model, RequestParams, Response } from '@kubb/oas';
package/dist/oas.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { Infer, Model, RequestParams, Response } from '@kubb/oas';
package/dist/oas.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=oas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}