@kubb/plugin-react-query 5.8.0-canary.20261027T184247 → 5.8.0-canary.20261028T230157

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
@@ -256,78 +256,37 @@ function resolveSuccessNames(node, resolver) {
256
256
  function resolveStatusCodeNames(node, resolver) {
257
257
  return node.responses.map((response) => resolver.response.status(node, response.statusCode));
258
258
  }
259
- const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
260
- function resolveOperationTypeNames(node, resolver, options = {}) {
261
- const cacheKey = `${node.operationId}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${options.includeParams === false ? "noparams" : ""}\0${(options.exclude ?? []).join(",")}`;
262
- let byResolver = typeNamesByResolver.get(resolver);
263
- if (byResolver) {
264
- const cached = byResolver.get(cacheKey);
265
- if (cached) return cached;
266
- } else {
267
- byResolver = /* @__PURE__ */ new Map();
268
- typeNamesByResolver.set(resolver, byResolver);
269
- }
270
- const { path, query, header } = getOperationParameters(node);
271
- const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
272
- const exclude = new Set(options.exclude ?? []);
273
- const paramNames = options.includeParams === false ? [] : [
274
- ...path.map((param) => resolver.param.path(node, param)),
275
- ...query.map((param) => resolver.param.query(node, param)),
276
- ...header.map((param) => resolver.param.headers(node, param))
277
- ];
278
- const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)];
279
- const result = (options.order === "body-response-first" ? [
280
- ...bodyAndResponseNames,
281
- ...paramNames,
282
- ...responseStatusNames
283
- ] : [
284
- ...paramNames,
285
- ...bodyAndResponseNames,
286
- ...responseStatusNames
287
- ]).filter((name) => Boolean(name) && !exclude.has(name));
288
- byResolver.set(cacheKey, result);
289
- return result;
290
- }
291
- // ../../internals/utils/src/casing.ts
292
- /**
293
- * Shared implementation for camelCase and PascalCase conversion.
294
- * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
295
- * and capitalizes each word according to `pascal`.
296
- *
297
- * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
298
- */
299
- function convert(text, pascal) {
300
- 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) => {
301
- if (word.length > 1 && word === word.toUpperCase()) return word;
302
- return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
303
- }).join("").replace(/[^a-zA-Z0-9]/g, "");
304
- }
305
- const cache = /* @__PURE__ */ new Map();
306
- const cacheLimit = 1e4;
307
- function toCamelOrPascal(text, pascal) {
308
- const key = `${pascal ? "P" : "c"}${text}`;
309
- const cached = cache.get(key);
310
- if (cached !== void 0) return cached;
311
- const result = convert(text, pascal);
312
- if (cache.size >= cacheLimit) cache.clear();
313
- cache.set(key, result);
314
- return result;
315
- }
316
259
  /**
317
- * Converts `text` to camelCase.
318
- *
319
- * @example Word boundaries
320
- * `camelCase('hello-world') // 'helloWorld'`
321
- *
322
- * @example With a prefix
323
- * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
260
+ * Lists the type names an operation's types file declares, computed once per resolver and `options` so every
261
+ * dependent reads the same list.
324
262
  */
325
- function camelCase(text, { prefix = "", suffix = "" } = {}) {
326
- return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
263
+ function resolveOperationTypeNames(node, resolver, options = {}) {
264
+ const key = `${node.operationId}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${options.includeParams === false ? "noparams" : ""}\0${(options.exclude ?? []).join(",")}`;
265
+ return resolver.memo(`operationTypeNames:${key}`, () => {
266
+ const { path, query, header } = getOperationParameters(node);
267
+ const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
268
+ const exclude = new Set(options.exclude ?? []);
269
+ const paramNames = options.includeParams === false ? [] : [
270
+ ...path.map((param) => resolver.param.path(node, param)),
271
+ ...query.map((param) => resolver.param.query(node, param)),
272
+ ...header.map((param) => resolver.param.headers(node, param))
273
+ ];
274
+ const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)];
275
+ return (options.order === "body-response-first" ? [
276
+ ...bodyAndResponseNames,
277
+ ...paramNames,
278
+ ...responseStatusNames
279
+ ] : [
280
+ ...paramNames,
281
+ ...bodyAndResponseNames,
282
+ ...responseStatusNames
283
+ ]).filter((name) => Boolean(name) && !exclude.has(name));
284
+ });
327
285
  }
286
+ // ../../internals/utils/src/casing.ts
328
287
  /**
329
288
  * Uppercases only the first character of `text`, leaving the rest untouched.
330
- * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.
289
+ * Unlike `pascalCase` it never re-splits word boundaries or strips characters.
331
290
  *
332
291
  * @example
333
292
  * `capitalize('getPetById') // 'GetPetById'`
@@ -491,8 +450,11 @@ function getNestedAccessor(param, accessor) {
491
450
  return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
492
451
  }
493
452
  // ../../internals/shared/src/resolver.ts
453
+ /**
454
+ * The shared top-level `name` of the operation plugins, computed once per operation name and build.
455
+ */
494
456
  function resolveOperationName(name) {
495
- return ensureValidVarName(camelCase(name));
457
+ return this.memo(`operation:${name}`, () => ensureValidVarName((0, kubb_kit.camelCase)(name)));
496
458
  }
497
459
  /**
498
460
  * Builds the allocation key for a declaration an operation owns. `scope` names which declaration
@@ -535,7 +497,7 @@ function createGroupConfig(group) {
535
497
  if (!group) return null;
536
498
  const defaultName = (ctx) => {
537
499
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
538
- return camelCase(ctx.group);
500
+ return (0, kubb_kit.camelCase)(ctx.group);
539
501
  };
540
502
  return {
541
503
  ...group,
@@ -548,7 +510,7 @@ var compatibility = {
548
510
  "node": ">=22.22"
549
511
  };
550
512
  // package.json
551
- var version = "5.8.0-canary.20261027T184247";
513
+ var version = "5.8.0-canary.20261028T230157";
552
514
  // ../../internals/client/src/resolveOperationTypes.ts
553
515
  /**
554
516
  * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
@@ -559,6 +521,7 @@ function toZodTypeResolver(resolver) {
559
521
  return {
560
522
  ...resolver,
561
523
  file: resolver.file.bind(resolver),
524
+ memo: (key, compute) => resolver.memo(`zodTypes:${key}`, compute),
562
525
  param: {
563
526
  name: (node, p) => type(resolver.param.name(node, p)),
564
527
  path: (node, p) => type(resolver.param.path(node, p)),