@kubb/plugin-swr 5.7.0-canary.20261029T093900 → 5.7.0

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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
1
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "@kubb/kit";
2
2
  import "@kubb/plugin-zod";
3
3
  import { ResolverTs } from "@kubb/plugin-ts";
4
- import "kubb/jsx";
4
+ import "@kubb/renderer-jsx";
5
5
  /**
6
6
  * The client selector accepted by a consumer's `client` option. Each calls a registered contract
7
7
  * client plugin.
@@ -330,7 +330,7 @@ export declare const pluginSwrName = "plugin-swr";
330
330
  * })
331
331
  * ```
332
332
  */
333
- export declare const pluginSwr: import("kubb/kit").PluginFactory<PluginSwr>;
333
+ export declare const pluginSwr: import("@kubb/kit").PluginFactory<PluginSwr>;
334
334
  /**
335
335
  * Default resolver used by `@kubb/plugin-swr`. Decides the names and file paths for every generated
336
336
  * SWR hook (`useFoo`, `useFooMutation`) and its companion helpers (`fooQueryKey`, `fooQueryOptions`,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
1
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "@kubb/kit";
2
2
  import "@kubb/plugin-zod";
3
3
  import { ResolverTs } from "@kubb/plugin-ts";
4
- import "kubb/jsx";
4
+ import "@kubb/renderer-jsx";
5
5
  /**
6
6
  * The client selector accepted by a consumer's `client` option. Each calls a registered contract
7
7
  * client plugin.
@@ -330,7 +330,7 @@ export declare const pluginSwrName = "plugin-swr";
330
330
  * })
331
331
  * ```
332
332
  */
333
- export declare const pluginSwr: import("kubb/kit").PluginFactory<PluginSwr>;
333
+ export declare const pluginSwr: import("@kubb/kit").PluginFactory<PluginSwr>;
334
334
  /**
335
335
  * Default resolver used by `@kubb/plugin-swr`. Decides the names and file paths for every generated
336
336
  * SWR hook (`useFoo`, `useFooMutation`) and its companion helpers (`fooQueryKey`, `fooQueryOptions`,
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { Diagnostics, Resolver, Url, addGenerator, ast, camelCase, createResolver, defineExtension, defineGenerator, setMacros, setResolver, useConfig } from "kubb/kit";
1
+ import { Diagnostics, Resolver, Url, addGenerator, ast, camelCase, createResolver, defineExtension, defineGenerator, setMacros, setResolver, useConfig } from "@kubb/kit";
2
2
  import path from "node:path";
3
3
  import { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
4
4
  import { pluginZodName } from "@kubb/plugin-zod";
5
- import { File, Function, Type, jsxRenderer } from "kubb/jsx";
6
- import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
5
+ import { File, Function, Type, jsxRenderer } from "@kubb/renderer-jsx";
6
+ import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
7
7
  // ../../internals/shared/src/operation.ts
8
8
  /**
9
9
  * Builds the `ResolverFileParams` every operation generator passes to
@@ -25,19 +25,19 @@ function operationFileEntry(node, name, extname = ".ts") {
25
25
  };
26
26
  }
27
27
  /**
28
- * Resolves a dependency plugin's generated file for `node.operationId`, cached in `cache` (the
29
- * current node's `ctx.cache`) under the resolver's own plugin name. Several dependents reading the
28
+ * Resolves a dependency plugin's generated file for `node.operationId`, cached in `memo` (the
29
+ * build's `ctx.memo`) under the resolver's own plugin name and the operation. Several dependents reading the
30
30
  * same dependency for the same operation in one pass (a query plugin's several hook generators, the
31
31
  * MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.
32
32
  *
33
33
  * @example Cache `plugin-ts`'s file for the current operation
34
34
  * ```ts
35
- * const fileTs = resolveDependencyOperationFile({ cache: ctx.cache, node, resolver: tsResolver, root, output })
35
+ * const fileTs = resolveDependencyOperationFile({ memo: ctx.memo, node, resolver: tsResolver, root, output })
36
36
  * ```
37
37
  */
38
38
  function resolveDependencyOperationFile(options) {
39
- const { cache, node, resolver, root, output, group } = options;
40
- return cache.ensureItem(`${resolver.pluginName}:operationFile`, () => resolver.file({
39
+ const { memo, node, resolver, root, output, group } = options;
40
+ return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => resolver.file({
41
41
  ...operationFileEntry(node, node.operationId),
42
42
  root,
43
43
  output,
@@ -466,7 +466,7 @@ var compatibility = {
466
466
  "node": ">=22.22"
467
467
  };
468
468
  // package.json
469
- var version = "5.7.0-canary.20261029T093900";
469
+ var version = "5.7.0";
470
470
  // ../../internals/client/src/resolveOperationTypes.ts
471
471
  /**
472
472
  * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
@@ -663,7 +663,7 @@ function resolveImportPath(options) {
663
663
  * output root, the same path consumers read `RequestConfig` / `ResponseErrorConfig` from.
664
664
  * With plugin-client they come from the user's `importPath` module instead.
665
665
  *
666
- * The result is cached in the current node's `cache` (`ctx.cache`) under the client plugin's name,
666
+ * The result is cached in `memo` (the build's `ctx.memo`) under the client plugin's name and the operation,
667
667
  * so several dependents reading the same client plugin for one operation in a single pass
668
668
  * (react-query's query/mutation/infinite generators, vue-query, swr, the MCP handler, ...) share
669
669
  * one computed result instead of each re-deriving the name and path.
@@ -673,9 +673,9 @@ function resolveImportPath(options) {
673
673
  * and import path therefore match the `<op>` actually emitted, even when an `override` changes it.
674
674
  */
675
675
  function resolveClientOperation(options) {
676
- const { clientPlugin, driver, node, root, output, cache } = options;
676
+ const { clientPlugin, driver, node, root, output, memo } = options;
677
677
  if (!clientPlugin) return null;
678
- return cache.ensureItem(`${clientPlugin.pluginName}:clientOperation`, () => {
678
+ return memo(`${clientPlugin.pluginName}:clientOperation:${node.operationId}`, () => {
679
679
  const resolver = driver.getResolver(clientPlugin.pluginName);
680
680
  const pluginOptions = driver.getPlugin(clientPlugin.pluginName)?.options ?? {};
681
681
  const { exclude, include, override } = pluginOptions;
@@ -726,7 +726,7 @@ function resolveHookFile(node, ctx, options) {
726
726
  group: group ?? void 0
727
727
  });
728
728
  const fileTs = resolveDependencyOperationFile({
729
- cache: ctx.cache,
729
+ memo: ctx.memo,
730
730
  node,
731
731
  resolver: tsResolver,
732
732
  root,
@@ -1312,7 +1312,7 @@ const mutationGenerator = defineGenerator({
1312
1312
  node,
1313
1313
  root,
1314
1314
  output,
1315
- cache: ctx.cache
1315
+ memo: ctx.memo
1316
1316
  });
1317
1317
  if (!contractOp) return null;
1318
1318
  const mutationHookName = resolver.mutation.name(node);
@@ -1461,7 +1461,7 @@ const queryGenerator = defineGenerator({
1461
1461
  node,
1462
1462
  root,
1463
1463
  output,
1464
- cache: ctx.cache
1464
+ memo: ctx.memo
1465
1465
  });
1466
1466
  if (!contractOp) return null;
1467
1467
  const queryName = resolver.query.name(node);