@kubb/plugin-zod 5.4.10 → 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 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 toCamelOrPascal(text, pascal) {
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
  *
@@ -2109,11 +2120,11 @@ const zodGenerator = (0, kubb_kit.defineGenerator)({
2109
2120
  //#region kubb-extension.json
2110
2121
  var compatibility = {
2111
2122
  "kubb": ">=5.8.3",
2112
- "node": ">=22"
2123
+ "node": ">=22.12"
2113
2124
  };
2114
2125
  //#endregion
2115
2126
  //#region package.json
2116
- var version = "5.4.10";
2127
+ var version = "5.4.13";
2117
2128
  //#endregion
2118
2129
  //#region src/resolvers/resolverZod.ts
2119
2130
  /**