@kubb/plugin-zod 5.4.12 → 5.4.13
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 +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +30 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -239,12 +239,23 @@ function getOasAdapter(adapter) {
|
|
|
239
239
|
*
|
|
240
240
|
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
241
241
|
*/
|
|
242
|
-
function
|
|
242
|
+
function convert(text, pascal) {
|
|
243
243
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
244
244
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
245
245
|
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
246
246
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
247
247
|
}
|
|
248
|
+
const cache = /* @__PURE__ */ new Map();
|
|
249
|
+
const cacheLimit = 1e4;
|
|
250
|
+
function toCamelOrPascal(text, pascal) {
|
|
251
|
+
const key = `${pascal ? "P" : "c"}${text}`;
|
|
252
|
+
const cached = cache.get(key);
|
|
253
|
+
if (cached !== void 0) return cached;
|
|
254
|
+
const result = convert(text, pascal);
|
|
255
|
+
if (cache.size >= cacheLimit) cache.clear();
|
|
256
|
+
cache.set(key, result);
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
248
259
|
/**
|
|
249
260
|
* Converts `text` to camelCase.
|
|
250
261
|
*
|
|
@@ -2113,7 +2124,7 @@ var compatibility = {
|
|
|
2113
2124
|
};
|
|
2114
2125
|
//#endregion
|
|
2115
2126
|
//#region package.json
|
|
2116
|
-
var version = "5.4.
|
|
2127
|
+
var version = "5.4.13";
|
|
2117
2128
|
//#endregion
|
|
2118
2129
|
//#region src/resolvers/resolverZod.ts
|
|
2119
2130
|
/**
|