@kubb/plugin-ts 4.1.4 → 4.2.1
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/components-Cf7RuPmU.cjs +580 -0
- package/dist/components-Cf7RuPmU.cjs.map +1 -0
- package/dist/components-Wl2A-qA2.js +491 -0
- package/dist/components-Wl2A-qA2.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +2 -3
- package/dist/components.d.ts +2 -3
- package/dist/components.js +1 -1
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{plugin--SAE5fJd.cjs → plugin--YEvuFfE.cjs} +30 -26
- package/dist/plugin--YEvuFfE.cjs.map +1 -0
- package/dist/{plugin-C6Jg0eqz.js → plugin-BafrBt4Q.js} +31 -27
- package/dist/plugin-BafrBt4Q.js.map +1 -0
- package/dist/{types-C7OjrC1J.d.ts → types-DpBnlY1n.d.cts} +78 -122
- package/dist/{types-BLgrg7-y.d.cts → types-gqUseg33.d.ts} +79 -123
- package/package.json +10 -10
- package/src/components/Type.tsx +8 -10
- package/src/factory.ts +578 -0
- package/src/generators/oasGenerator.tsx +6 -7
- package/src/generators/typeGenerator.tsx +21 -12
- package/src/parser.ts +1 -1
- package/src/plugin.ts +5 -8
- package/dist/components-3SwDb74W.cjs +0 -1962
- package/dist/components-3SwDb74W.cjs.map +0 -1
- package/dist/components-CSEFpzdz.js +0 -1940
- package/dist/components-CSEFpzdz.js.map +0 -1
- package/dist/plugin--SAE5fJd.cjs.map +0 -1
- package/dist/plugin-C6Jg0eqz.js.map +0 -1
package/src/plugin.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
|
-
|
|
3
|
-
import { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'
|
|
2
|
+
import { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'
|
|
4
3
|
import { camelCase, pascalCase } from '@kubb/core/transformers'
|
|
5
|
-
import { OperationGenerator, SchemaGenerator, pluginOasName } from '@kubb/plugin-oas'
|
|
6
|
-
|
|
7
|
-
import type { Plugin } from '@kubb/core'
|
|
8
4
|
import type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'
|
|
5
|
+
import { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'
|
|
9
6
|
import { oasGenerator, typeGenerator } from './generators'
|
|
10
7
|
import type { PluginTs } from './types.ts'
|
|
11
8
|
|
|
@@ -57,7 +54,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
|
57
54
|
pre: [pluginOasName],
|
|
58
55
|
resolvePath(baseName, pathMode, options) {
|
|
59
56
|
const root = path.resolve(this.config.root, this.config.output.path)
|
|
60
|
-
const mode = pathMode ??
|
|
57
|
+
const mode = pathMode ?? getMode(path.resolve(root, output.path))
|
|
61
58
|
|
|
62
59
|
if (mode === 'single') {
|
|
63
60
|
/**
|
|
@@ -103,7 +100,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
|
103
100
|
|
|
104
101
|
const oas = await swaggerPlugin.context.getOas()
|
|
105
102
|
const root = path.resolve(this.config.root, this.config.output.path)
|
|
106
|
-
const mode =
|
|
103
|
+
const mode = getMode(path.resolve(root, output.path))
|
|
107
104
|
|
|
108
105
|
const schemaGenerator = new SchemaGenerator(this.plugin.options, {
|
|
109
106
|
oas,
|
|
@@ -133,7 +130,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
|
133
130
|
const operationFiles = await operationGenerator.build(...generators)
|
|
134
131
|
await this.addFile(...operationFiles)
|
|
135
132
|
|
|
136
|
-
const barrelFiles = await this.fileManager.
|
|
133
|
+
const barrelFiles = await getBarrelFiles(this.fileManager.files, {
|
|
137
134
|
type: output.barrelType ?? 'named',
|
|
138
135
|
root,
|
|
139
136
|
output,
|