@kubb/plugin-oas 3.0.0-alpha.6 → 3.0.0-alpha.8
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/{OperationGenerator-Dzs1oRvm.d.ts → OperationGenerator-DeXrfGDC.d.ts} +2 -2
- package/dist/{OperationGenerator-Do52cvD0.d.cts → OperationGenerator-DhJ0MBKc.d.cts} +2 -2
- package/dist/{Schema-C90zFdkU.d.ts → Schema-B1vcPGiK.d.ts} +2 -4
- package/dist/{Schema-DDVEcNcu.d.cts → Schema-DoSFh7Qd.d.cts} +2 -4
- package/dist/{SchemaMapper-BM1IGWqD.d.cts → SchemaMapper-sGcY1xL5.d.cts} +0 -1
- package/dist/{SchemaMapper-BM1IGWqD.d.ts → SchemaMapper-sGcY1xL5.d.ts} +0 -1
- package/dist/chunk-75BIOXB7.cjs +7 -0
- package/dist/{chunk-7KIEQOVZ.cjs.map → chunk-75BIOXB7.cjs.map} +1 -1
- package/dist/{chunk-UJNAXXVE.js → chunk-MUI5DWM3.js} +458 -465
- package/dist/{chunk-UJNAXXVE.js.map → chunk-MUI5DWM3.js.map} +1 -1
- package/dist/{chunk-Y4V7HHX7.js → chunk-N7EEVJA6.js} +3 -3
- package/dist/{chunk-P42X362U.cjs → chunk-NU4F7G47.cjs} +4 -16
- package/dist/chunk-NU4F7G47.cjs.map +1 -0
- package/dist/{chunk-QLJIL3U5.cjs → chunk-O76YQFZB.cjs} +3 -3
- package/dist/{chunk-QLJIL3U5.cjs.map → chunk-O76YQFZB.cjs.map} +1 -1
- package/dist/{chunk-TWKZEVSM.js → chunk-SQ64ESS4.js} +2 -2
- package/dist/{chunk-UB552H4J.js → chunk-SZDO532A.js} +3 -15
- package/dist/{chunk-UB552H4J.js.map → chunk-SZDO532A.js.map} +1 -1
- package/dist/{chunk-RQZBFORW.cjs → chunk-VSVVTCQB.cjs} +481 -488
- package/dist/chunk-VSVVTCQB.cjs.map +1 -0
- package/dist/components.cjs +4 -4
- package/dist/components.d.cts +4 -4
- package/dist/components.d.ts +4 -4
- package/dist/components.js +3 -3
- package/dist/hooks.cjs +12 -12
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -3
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +2 -2
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +112 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +83 -86
- package/dist/index.js.map +1 -1
- package/dist/{types-C2RXaY0_.d.cts → types-CZTUCaE5.d.cts} +2 -0
- package/dist/{types-C2RXaY0_.d.ts → types-CZTUCaE5.d.ts} +2 -0
- package/dist/utils.cjs +9 -54
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +5 -35
- package/dist/utils.d.ts +5 -35
- package/dist/utils.js +2 -47
- package/dist/utils.js.map +1 -1
- package/package.json +9 -9
- package/src/SchemaGenerator.ts +2 -2
- package/src/SchemaMapper.ts +1 -1
- package/src/components/Schema.tsx +8 -4
- package/src/hooks/useOperationManager.ts +1 -0
- package/src/plugin.ts +11 -0
- package/src/types.ts +2 -0
- package/src/utils/index.ts +0 -1
- package/dist/chunk-7KIEQOVZ.cjs +0 -7
- package/dist/chunk-P42X362U.cjs.map +0 -1
- package/dist/chunk-RQZBFORW.cjs.map +0 -1
- package/src/utils/getGroupedByTagFiles.ts +0 -84
- /package/dist/{chunk-Y4V7HHX7.js.map → chunk-N7EEVJA6.js.map} +0 -0
- /package/dist/{chunk-TWKZEVSM.js.map → chunk-SQ64ESS4.js.map} +0 -0
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path'
|
|
2
|
-
|
|
3
|
-
import { FileManager } from '@kubb/core'
|
|
4
|
-
import transformers from '@kubb/core/transformers'
|
|
5
|
-
import { renderTemplate } from '@kubb/core/utils'
|
|
6
|
-
import { getRelativePath } from '@kubb/fs'
|
|
7
|
-
|
|
8
|
-
import type { Plugin } from '@kubb/core'
|
|
9
|
-
import type { Logger } from '@kubb/core/logger'
|
|
10
|
-
import type * as KubbFile from '@kubb/fs/types'
|
|
11
|
-
|
|
12
|
-
type Options = {
|
|
13
|
-
logger: Logger
|
|
14
|
-
files: Array<KubbFile.File<FileMeta>>
|
|
15
|
-
plugin: Plugin
|
|
16
|
-
template: string
|
|
17
|
-
exportAs: string
|
|
18
|
-
/**
|
|
19
|
-
* Root based on root and output.path specified in the config
|
|
20
|
-
*/
|
|
21
|
-
root: string
|
|
22
|
-
/**
|
|
23
|
-
* Output for plugin
|
|
24
|
-
*/
|
|
25
|
-
output: {
|
|
26
|
-
path: string
|
|
27
|
-
exportAs?: string
|
|
28
|
-
extName?: KubbFile.Extname
|
|
29
|
-
exportType?: 'barrel' | 'barrelNamed' | false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type FileMeta = {
|
|
34
|
-
pluginKey?: Plugin['key']
|
|
35
|
-
tag?: string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated //TODO replace by getIndexFiles?
|
|
40
|
-
*/
|
|
41
|
-
export async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }: Options): Promise<KubbFile.File<FileMeta>[]> {
|
|
42
|
-
const { path, exportType = 'barrel' } = output
|
|
43
|
-
const mode = FileManager.getMode(resolve(root, path))
|
|
44
|
-
|
|
45
|
-
if (mode === 'single' || exportType === false) {
|
|
46
|
-
return []
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return files
|
|
50
|
-
.filter((file) => {
|
|
51
|
-
const name = file.meta?.pluginKey?.[0]
|
|
52
|
-
return name === plugin.name
|
|
53
|
-
})
|
|
54
|
-
.map((file: KubbFile.File<FileMeta>) => {
|
|
55
|
-
if (!file.meta?.tag) {
|
|
56
|
-
logger?.emit('debug', { logs: [`Could not find a tagName for ${JSON.stringify(file, undefined, 2)}`] })
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const tag = file.meta?.tag && transformers.camelCase(file.meta.tag)
|
|
62
|
-
const tagPath = getRelativePath(resolve(root, output.path), resolve(root, renderTemplate(template, { tag })))
|
|
63
|
-
const tagName = renderTemplate(exportAs, { tag })
|
|
64
|
-
|
|
65
|
-
if (tagName) {
|
|
66
|
-
return {
|
|
67
|
-
baseName: 'index.ts' as const,
|
|
68
|
-
path: resolve(root, output.path, 'index.ts'),
|
|
69
|
-
exports: [
|
|
70
|
-
{
|
|
71
|
-
path: output.extName ? `${tagPath}/index${output.extName}` : `${tagPath}/index`,
|
|
72
|
-
asAlias: true,
|
|
73
|
-
name: tagName,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
meta: {
|
|
77
|
-
pluginKey: plugin.key,
|
|
78
|
-
},
|
|
79
|
-
sources: [],
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
.filter(Boolean)
|
|
84
|
-
}
|
|
File without changes
|
|
File without changes
|