@kubb/plugin-react-query 5.8.0-canary.20261029T124214 → 5.8.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.cjs +102 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
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.
|
|
@@ -553,7 +553,7 @@ export declare const pluginReactQueryName = "plugin-react-query";
|
|
|
553
553
|
* })
|
|
554
554
|
* ```
|
|
555
555
|
*/
|
|
556
|
-
export declare const pluginReactQuery: import("kubb/kit").PluginFactory<PluginReactQuery>;
|
|
556
|
+
export declare const pluginReactQuery: import("@kubb/kit").PluginFactory<PluginReactQuery>;
|
|
557
557
|
/**
|
|
558
558
|
* Default resolver used by `@kubb/plugin-react-query`. Decides the names and
|
|
559
559
|
* file paths for every generated TanStack Query hook (`useFoo`,
|
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.
|
|
@@ -553,7 +553,7 @@ export declare const pluginReactQueryName = "plugin-react-query";
|
|
|
553
553
|
* })
|
|
554
554
|
* ```
|
|
555
555
|
*/
|
|
556
|
-
export declare const pluginReactQuery: import("kubb/kit").PluginFactory<PluginReactQuery>;
|
|
556
|
+
export declare const pluginReactQuery: import("@kubb/kit").PluginFactory<PluginReactQuery>;
|
|
557
557
|
/**
|
|
558
558
|
* Default resolver used by `@kubb/plugin-react-query`. Decides the names and
|
|
559
559
|
* file paths for every generated TanStack Query hook (`useFoo`,
|
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 { pluginZodName } from "@kubb/plugin-zod";
|
|
4
|
-
import { File, Function, Type, jsxRenderer } from "kubb/jsx";
|
|
4
|
+
import { File, Function, Type, jsxRenderer } from "@kubb/renderer-jsx";
|
|
5
5
|
import { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
// ../../internals/shared/src/operation.ts
|
|
9
9
|
/**
|
|
@@ -26,19 +26,19 @@ function operationFileEntry(node, name, extname = ".ts") {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Resolves a dependency plugin's generated file for `node.operationId`, cached in `
|
|
30
|
-
*
|
|
29
|
+
* Resolves a dependency plugin's generated file for `node.operationId`, cached in `memo` (the
|
|
30
|
+
* build's `ctx.memo`) under the resolver's own plugin name and the operation. Several dependents reading the
|
|
31
31
|
* same dependency for the same operation in one pass (a query plugin's several hook generators, the
|
|
32
32
|
* MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.
|
|
33
33
|
*
|
|
34
34
|
* @example Cache `plugin-ts`'s file for the current operation
|
|
35
35
|
* ```ts
|
|
36
|
-
* const fileTs = resolveDependencyOperationFile({
|
|
36
|
+
* const fileTs = resolveDependencyOperationFile({ memo: ctx.memo, node, resolver: tsResolver, root, output })
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
function resolveDependencyOperationFile(options) {
|
|
40
|
-
const {
|
|
41
|
-
return
|
|
40
|
+
const { memo, node, resolver, root, output, group } = options;
|
|
41
|
+
return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => resolver.file({
|
|
42
42
|
...operationFileEntry(node, node.operationId),
|
|
43
43
|
root,
|
|
44
44
|
output,
|
|
@@ -483,7 +483,7 @@ var compatibility = {
|
|
|
483
483
|
"node": ">=22.22"
|
|
484
484
|
};
|
|
485
485
|
// package.json
|
|
486
|
-
var version = "5.8.0
|
|
486
|
+
var version = "5.8.0";
|
|
487
487
|
// ../../internals/client/src/resolveOperationTypes.ts
|
|
488
488
|
/**
|
|
489
489
|
* A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
|
|
@@ -680,7 +680,7 @@ function resolveImportPath(options) {
|
|
|
680
680
|
* output root, the same path consumers read `RequestConfig` / `ResponseErrorConfig` from.
|
|
681
681
|
* With plugin-client they come from the user's `importPath` module instead.
|
|
682
682
|
*
|
|
683
|
-
* The result is cached in the
|
|
683
|
+
* The result is cached in `memo` (the build's `ctx.memo`) under the client plugin's name and the operation,
|
|
684
684
|
* so several dependents reading the same client plugin for one operation in a single pass
|
|
685
685
|
* (react-query's query/mutation/infinite generators, vue-query, swr, the MCP handler, ...) share
|
|
686
686
|
* one computed result instead of each re-deriving the name and path.
|
|
@@ -690,9 +690,9 @@ function resolveImportPath(options) {
|
|
|
690
690
|
* and import path therefore match the `<op>` actually emitted, even when an `override` changes it.
|
|
691
691
|
*/
|
|
692
692
|
function resolveClientOperation(options) {
|
|
693
|
-
const { clientPlugin, driver, node, root, output,
|
|
693
|
+
const { clientPlugin, driver, node, root, output, memo } = options;
|
|
694
694
|
if (!clientPlugin) return null;
|
|
695
|
-
return
|
|
695
|
+
return memo(`${clientPlugin.pluginName}:clientOperation:${node.operationId}`, () => {
|
|
696
696
|
const resolver = driver.getResolver(clientPlugin.pluginName);
|
|
697
697
|
const pluginOptions = driver.getPlugin(clientPlugin.pluginName)?.options ?? {};
|
|
698
698
|
const { exclude, include, override } = pluginOptions;
|
|
@@ -743,7 +743,7 @@ function resolveHookFile(node, ctx, options) {
|
|
|
743
743
|
group: group ?? void 0
|
|
744
744
|
});
|
|
745
745
|
const fileTs = resolveDependencyOperationFile({
|
|
746
|
-
|
|
746
|
+
memo: ctx.memo,
|
|
747
747
|
node,
|
|
748
748
|
resolver: tsResolver,
|
|
749
749
|
root,
|
|
@@ -1829,7 +1829,7 @@ function createQueryGenerator({ name, variant }) {
|
|
|
1829
1829
|
node,
|
|
1830
1830
|
root,
|
|
1831
1831
|
output,
|
|
1832
|
-
|
|
1832
|
+
memo: ctx.memo
|
|
1833
1833
|
});
|
|
1834
1834
|
if (!contractOp) return null;
|
|
1835
1835
|
const importPath = query ? query.importPath : "@tanstack/react-query";
|
|
@@ -2086,7 +2086,7 @@ const mutationGenerator = defineGenerator({
|
|
|
2086
2086
|
node,
|
|
2087
2087
|
root,
|
|
2088
2088
|
output,
|
|
2089
|
-
|
|
2089
|
+
memo: ctx.memo
|
|
2090
2090
|
});
|
|
2091
2091
|
if (!contractOp) return null;
|
|
2092
2092
|
const mutationHookName = resolver.mutation.name(node);
|