@kubb/plugin-zod 5.4.12 → 5.4.14

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.js CHANGED
@@ -235,12 +235,23 @@ function getOasAdapter(adapter) {
235
235
  *
236
236
  * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
237
237
  */
238
- function toCamelOrPascal(text, pascal) {
238
+ function convert(text, pascal) {
239
239
  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) => {
240
240
  if (word.length > 1 && word === word.toUpperCase()) return word;
241
241
  return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
242
242
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
243
243
  }
244
+ const cache = /* @__PURE__ */ new Map();
245
+ const cacheLimit = 1e4;
246
+ function toCamelOrPascal(text, pascal) {
247
+ const key = `${pascal ? "P" : "c"}${text}`;
248
+ const cached = cache.get(key);
249
+ if (cached !== void 0) return cached;
250
+ const result = convert(text, pascal);
251
+ if (cache.size >= cacheLimit) cache.clear();
252
+ cache.set(key, result);
253
+ return result;
254
+ }
244
255
  /**
245
256
  * Converts `text` to camelCase.
246
257
  *
@@ -1060,7 +1071,8 @@ const STRING_FORMAT_CALLS = /* @__PURE__ */ new Map([
1060
1071
  ["jwt", "z.jwt()"],
1061
1072
  ["ulid", "z.ulid()"],
1062
1073
  ["iban", "z.iban()"],
1063
- ["duration", "z.iso.duration()"]
1074
+ ["duration", "z.iso.duration()"],
1075
+ ["hostname", "z.hostname()"]
1064
1076
  ]);
1065
1077
  /**
1066
1078
  * Marks an inline `oneOf` object strict, so `object()` builds `z.strictObject(...)` and no eager `.shape` read hits a deferred getter.
@@ -2109,7 +2121,7 @@ var compatibility = {
2109
2121
  };
2110
2122
  //#endregion
2111
2123
  //#region package.json
2112
- var version = "5.4.12";
2124
+ var version = "5.4.14";
2113
2125
  //#endregion
2114
2126
  //#region src/resolvers/resolverZod.ts
2115
2127
  /**