@kubb/plugin-swr 5.4.4 → 5.4.5

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
@@ -261,12 +261,23 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
261
261
  *
262
262
  * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
263
263
  */
264
- function toCamelOrPascal(text, pascal) {
264
+ function convert(text, pascal) {
265
265
  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) => {
266
266
  if (word.length > 1 && word === word.toUpperCase()) return word;
267
267
  return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
268
268
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
269
269
  }
270
+ const cache = /* @__PURE__ */ new Map();
271
+ const cacheLimit = 1e4;
272
+ function toCamelOrPascal(text, pascal) {
273
+ const key = `${pascal ? "P" : "c"}${text}`;
274
+ const cached = cache.get(key);
275
+ if (cached !== void 0) return cached;
276
+ const result = convert(text, pascal);
277
+ if (cache.size >= cacheLimit) cache.clear();
278
+ cache.set(key, result);
279
+ return result;
280
+ }
270
281
  /**
271
282
  * Converts `text` to camelCase.
272
283
  *
@@ -328,7 +339,7 @@ var compatibility = {
328
339
  };
329
340
  //#endregion
330
341
  //#region package.json
331
- var version = "5.4.4";
342
+ var version = "5.4.5";
332
343
  //#endregion
333
344
  //#region ../../internals/client/src/resolveClient.ts
334
345
  /**