@kubb/swagger-ts 2.0.0-alpha.7 → 2.0.0-alpha.9
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/index.cjs +5 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -9
- package/src/index.ts +1 -2
- package/src/plugin.ts +6 -2
- package/src/types.ts +4 -3
- package/dist/hooks.cjs +0 -723
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.d.cts +0 -6
- package/dist/hooks.d.ts +0 -6
- package/dist/hooks.js +0 -701
- package/dist/hooks.js.map +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useResolve.ts +0 -10
- package/src/resolve.ts +0 -9
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kubb/swagger-ts",
|
3
|
-
"version": "2.0.0-alpha.
|
3
|
+
"version": "2.0.0-alpha.9",
|
4
4
|
"description": "Generator swagger-ts",
|
5
5
|
"keywords": [
|
6
6
|
"typescript",
|
@@ -25,11 +25,6 @@
|
|
25
25
|
"require": "./dist/index.cjs",
|
26
26
|
"default": "./dist/index.cjs"
|
27
27
|
},
|
28
|
-
"./hooks": {
|
29
|
-
"import": "./dist/hooks.js",
|
30
|
-
"require": "./dist/hooks.cjs",
|
31
|
-
"default": "./dist/hooks.cjs"
|
32
|
-
},
|
33
28
|
"./package.json": "./package.json",
|
34
29
|
"./*": "./*"
|
35
30
|
},
|
@@ -45,9 +40,9 @@
|
|
45
40
|
"dependencies": {
|
46
41
|
"change-case": "^4.1.2",
|
47
42
|
"typescript": "rc",
|
48
|
-
"@kubb/core": "2.0.0-alpha.
|
49
|
-
"@kubb/swagger": "2.0.0-alpha.
|
50
|
-
"@kubb/parser": "2.0.0-alpha.
|
43
|
+
"@kubb/core": "2.0.0-alpha.9",
|
44
|
+
"@kubb/swagger": "2.0.0-alpha.9",
|
45
|
+
"@kubb/parser": "2.0.0-alpha.9"
|
51
46
|
},
|
52
47
|
"devDependencies": {
|
53
48
|
"eslint": "^8.53.0",
|
package/src/index.ts
CHANGED
package/src/plugin.ts
CHANGED
@@ -61,10 +61,14 @@ export const definePlugin = createPlugin<PluginOptions>((options) => {
|
|
61
61
|
|
62
62
|
return path.resolve(root, output, baseName)
|
63
63
|
},
|
64
|
-
resolveName(name) {
|
64
|
+
resolveName(name, type) {
|
65
65
|
const resolvedName = pascalCase(name, { delimiter: '', stripRegexp: /[^A-Z0-9$]/gi, transform: pascalCaseTransformMerge })
|
66
66
|
|
67
|
-
|
67
|
+
if (type) {
|
68
|
+
return transformers?.name?.(resolvedName, type) || resolvedName
|
69
|
+
}
|
70
|
+
|
71
|
+
return resolvedName
|
68
72
|
},
|
69
73
|
async writeFile(source, writePath) {
|
70
74
|
if (!writePath.endsWith('.ts') || !source) {
|
package/src/types.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { KubbPlugin, PluginFactoryOptions } from '@kubb/core'
|
1
|
+
import type { KubbPlugin, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
2
2
|
import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/swagger'
|
3
3
|
|
4
4
|
export type Options = {
|
@@ -61,14 +61,15 @@ export type Options = {
|
|
61
61
|
optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'
|
62
62
|
transformers?: {
|
63
63
|
/**
|
64
|
-
*
|
64
|
+
* Customize the names based on the type that is provided by the plugin.
|
65
65
|
*/
|
66
|
-
name?: (name:
|
66
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
70
70
|
export type FileMeta = {
|
71
71
|
pluginKey?: KubbPlugin['key']
|
72
|
+
name?: string
|
72
73
|
tag?: string
|
73
74
|
}
|
74
75
|
|