@kubb/plugin-ts 5.0.0-alpha.20 → 5.0.0-alpha.22
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/Type-Bf8raoQX.cjs +124 -0
- package/dist/Type-Bf8raoQX.cjs.map +1 -0
- package/dist/Type-BpXxT4l_.js +113 -0
- package/dist/Type-BpXxT4l_.js.map +1 -0
- package/dist/builderTs-COUg3xtQ.cjs +135 -0
- package/dist/builderTs-COUg3xtQ.cjs.map +1 -0
- package/dist/builderTs-DPpkJKd1.js +131 -0
- package/dist/builderTs-DPpkJKd1.js.map +1 -0
- package/dist/builders.cjs +3 -0
- package/dist/builders.d.ts +23 -0
- package/dist/builders.js +2 -0
- package/dist/{casing-Cp-jbC_k.js → casing-BJHFg-zZ.js} +1 -1
- package/dist/{casing-Cp-jbC_k.js.map → casing-BJHFg-zZ.js.map} +1 -1
- package/dist/{casing-D2uQKLWS.cjs → casing-DHfdqpLi.cjs} +2 -39
- package/dist/{casing-D2uQKLWS.cjs.map → casing-DHfdqpLi.cjs.map} +1 -1
- package/dist/chunk-ByKO4r7w.cjs +38 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +5 -2
- package/dist/components.js +1 -1
- package/dist/generators-DFDut8o-.js +555 -0
- package/dist/generators-DFDut8o-.js.map +1 -0
- package/dist/{generators-xHWQCNd9.cjs → generators-DKd7MYbx.cjs} +300 -293
- package/dist/generators-DKd7MYbx.cjs.map +1 -0
- package/dist/generators.cjs +2 -1
- package/dist/generators.d.ts +5 -2
- package/dist/generators.js +2 -2
- package/dist/index.cjs +75 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -2
- package/dist/index.js +73 -35
- package/dist/index.js.map +1 -1
- package/dist/{Type-B70QnSzH.cjs → printerTs-BcHudagv.cjs} +41 -135
- package/dist/printerTs-BcHudagv.cjs.map +1 -0
- package/dist/{Type-CMC7L-38.js → printerTs-CMBCOuqd.js} +19 -132
- package/dist/printerTs-CMBCOuqd.js.map +1 -0
- package/dist/printers.cjs +3 -0
- package/dist/printers.d.ts +81 -0
- package/dist/printers.js +2 -0
- package/dist/{resolvers-DsKabI0F.js → resolverTsLegacy-CPiqqsO6.js} +10 -9
- package/dist/resolverTsLegacy-CPiqqsO6.js.map +1 -0
- package/dist/{resolvers-YIpeP5YD.cjs → resolverTsLegacy-CuR9XbKk.cjs} +11 -9
- package/dist/resolverTsLegacy-CuR9XbKk.cjs.map +1 -0
- package/dist/resolvers.cjs +3 -3
- package/dist/resolvers.d.ts +1 -1
- package/dist/resolvers.js +1 -1
- package/dist/{types-zqLMbIqZ.d.ts → types-CRtcZOCz.d.ts} +59 -25
- package/package.json +17 -5
- package/src/builders/builderTs.ts +107 -0
- package/src/builders/index.ts +1 -0
- package/src/components/Enum.tsx +15 -11
- package/src/components/Type.tsx +20 -9
- package/src/factory.ts +0 -32
- package/src/generators/index.ts +1 -0
- package/src/generators/typeGenerator.tsx +53 -141
- package/src/generators/typeGeneratorLegacy.tsx +348 -0
- package/src/index.ts +1 -1
- package/src/plugin.ts +36 -44
- package/src/presets.ts +27 -7
- package/src/printers/index.ts +1 -0
- package/src/{printer.ts → printers/printerTs.ts} +31 -19
- package/src/resolvers/resolverTs.ts +9 -6
- package/src/resolvers/resolverTsLegacy.ts +1 -1
- package/src/types.ts +72 -24
- package/dist/Type-B70QnSzH.cjs.map +0 -1
- package/dist/Type-CMC7L-38.js.map +0 -1
- package/dist/generators-BFkr7ecU.js +0 -556
- package/dist/generators-BFkr7ecU.js.map +0 -1
- package/dist/generators-xHWQCNd9.cjs.map +0 -1
- package/dist/resolvers-DsKabI0F.js.map +0 -1
- package/dist/resolvers-YIpeP5YD.cjs.map +0 -1
- package/src/generators/utils.ts +0 -308
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
-
value,
|
|
6
|
-
configurable: true
|
|
7
|
-
});
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
-
key = keys[i];
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: ((k) => from[k]).bind(null, key),
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
//#endregion
|
|
1
|
+
require("./chunk-ByKO4r7w.cjs");
|
|
27
2
|
//#region ../../internals/utils/src/casing.ts
|
|
28
3
|
/**
|
|
29
4
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -104,18 +79,6 @@ function screamingSnakeCase(text, { prefix = "", suffix = "" } = {}) {
|
|
|
104
79
|
}).toUpperCase();
|
|
105
80
|
}
|
|
106
81
|
//#endregion
|
|
107
|
-
Object.defineProperty(exports, "__name", {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function() {
|
|
110
|
-
return __name;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
Object.defineProperty(exports, "__toESM", {
|
|
114
|
-
enumerable: true,
|
|
115
|
-
get: function() {
|
|
116
|
-
return __toESM;
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
82
|
Object.defineProperty(exports, "camelCase", {
|
|
120
83
|
enumerable: true,
|
|
121
84
|
get: function() {
|
|
@@ -141,4 +104,4 @@ Object.defineProperty(exports, "snakeCase", {
|
|
|
141
104
|
}
|
|
142
105
|
});
|
|
143
106
|
|
|
144
|
-
//# sourceMappingURL=casing-
|
|
107
|
+
//# sourceMappingURL=casing-DHfdqpLi.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"casing-
|
|
1
|
+
{"version":3,"file":"casing-DHfdqpLi.cjs","names":[],"sources":["../../../internals/utils/src/casing.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAAK,CAAC,OAAQ,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;AAC3E,SAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;AAC1C,QAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;AAClG,KAAI,OACF,QAAO,iBAAiB,OAAO,MAAM,WAAW,UAAU,MAAM,SAAS;EAAE;EAAQ;EAAQ,GAAG,EAAE,CAAC,CAAC;AAGpG,QAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,MAAM;;;;;;;;;;AAW9D,SAAgB,WAAW,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;AACnG,KAAI,OACF,QAAO,iBAAiB,OAAO,MAAM,WAAY,SAAS,WAAW,MAAM;EAAE;EAAQ;EAAQ,CAAC,GAAG,UAAU,KAAK,CAAE;AAGpH,QAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,KAAK;;;;;;;;;AAU7D,SAAgB,UAAU,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgC,EAAE,EAAU;AAE1G,QADkB,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,MAAM,CAEnD,QAAQ,mBAAmB,QAAQ,CACnC,QAAQ,aAAa,IAAI,CACzB,QAAQ,kBAAkB,GAAG,CAC7B,aAAa,CACb,MAAM,IAAI,CACV,OAAO,QAAQ,CACf,KAAK,IAAI;;;;;;;;AASd,SAAgB,mBAAmB,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgC,EAAE,EAAU;AACnH,QAAO,UAAU,MAAM;EAAE;EAAQ;EAAQ,CAAC,CAAC,aAAa"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
Object.defineProperty(exports, "__name", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return __name;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "__toESM", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return __toESM;
|
|
37
|
+
}
|
|
38
|
+
});
|
package/dist/components.cjs
CHANGED
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as ResolverTs, r as PluginTs } from "./types-CRtcZOCz.js";
|
|
3
3
|
import { EnumSchemaNode, SchemaNode } from "@kubb/ast/types";
|
|
4
4
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@ import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
|
7
7
|
type Props$1 = {
|
|
8
8
|
node: EnumSchemaNode;
|
|
9
9
|
enumType: PluginTs['resolvedOptions']['enumType'];
|
|
10
|
+
enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
|
|
10
11
|
enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
|
|
11
12
|
resolver: ResolverTs;
|
|
12
13
|
};
|
|
@@ -31,6 +32,7 @@ type Props$1 = {
|
|
|
31
32
|
declare function Enum({
|
|
32
33
|
node,
|
|
33
34
|
enumType,
|
|
35
|
+
enumTypeSuffix,
|
|
34
36
|
enumKeyCasing,
|
|
35
37
|
resolver
|
|
36
38
|
}: Props$1): FabricReactNode;
|
|
@@ -43,10 +45,10 @@ type Props = {
|
|
|
43
45
|
optionalType: PluginTs['resolvedOptions']['optionalType'];
|
|
44
46
|
arrayType: PluginTs['resolvedOptions']['arrayType'];
|
|
45
47
|
enumType: PluginTs['resolvedOptions']['enumType'];
|
|
48
|
+
enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
|
|
46
49
|
enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
|
|
47
50
|
syntaxType: PluginTs['resolvedOptions']['syntaxType'];
|
|
48
51
|
resolver: PluginTs['resolvedOptions']['resolver'];
|
|
49
|
-
legacy?: boolean;
|
|
50
52
|
description?: string;
|
|
51
53
|
keysToOmit?: string[];
|
|
52
54
|
};
|
|
@@ -59,6 +61,7 @@ declare function Type({
|
|
|
59
61
|
arrayType,
|
|
60
62
|
syntaxType,
|
|
61
63
|
enumType,
|
|
64
|
+
enumTypeSuffix,
|
|
62
65
|
enumKeyCasing,
|
|
63
66
|
description,
|
|
64
67
|
resolver
|
package/dist/components.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Enum, t as Type } from "./Type-
|
|
1
|
+
import { n as Enum, t as Type } from "./Type-BpXxT4l_.js";
|
|
2
2
|
export { Enum, Type };
|