@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.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
  *
@@ -1064,7 +1075,8 @@ const STRING_FORMAT_CALLS = /* @__PURE__ */ new Map([
1064
1075
  ["jwt", "z.jwt()"],
1065
1076
  ["ulid", "z.ulid()"],
1066
1077
  ["iban", "z.iban()"],
1067
- ["duration", "z.iso.duration()"]
1078
+ ["duration", "z.iso.duration()"],
1079
+ ["hostname", "z.hostname()"]
1068
1080
  ]);
1069
1081
  /**
1070
1082
  * Marks an inline `oneOf` object strict, so `object()` builds `z.strictObject(...)` and no eager `.shape` read hits a deferred getter.
@@ -2113,7 +2125,7 @@ var compatibility = {
2113
2125
  };
2114
2126
  //#endregion
2115
2127
  //#region package.json
2116
- var version = "5.4.12";
2128
+ var version = "5.4.14";
2117
2129
  //#endregion
2118
2130
  //#region src/resolvers/resolverZod.ts
2119
2131
  /**