@kubb/plugin-react-query 5.11.0-canary.20261110T080439 → 5.11.0-canary.20261110T135754
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 +40 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -15
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -52,24 +52,49 @@ function operationFileEntry(node, name, extname = ".ts") {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Resolves a
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes
|
|
56
|
+
* `node` to, cached in `ctx.memo` under the resolver's plugin name and the
|
|
57
|
+
* operation. The plugin itself and every plugin that imports from it call this, so they all get
|
|
58
|
+
* the same path.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
60
|
+
* When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name
|
|
61
|
+
* gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.
|
|
62
|
+
* Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.
|
|
63
|
+
* Only the file name changes. The declarations keep their names.
|
|
64
|
+
*
|
|
65
|
+
* @example Resolve `plugin-ts`'s file for the current operation
|
|
61
66
|
* ```ts
|
|
62
|
-
* const fileTs =
|
|
67
|
+
* const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })
|
|
63
68
|
* ```
|
|
64
69
|
*/
|
|
65
|
-
function
|
|
66
|
-
const {
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
function resolveOperationFile(options) {
|
|
71
|
+
const { ctx, node, resolver, root, output } = options;
|
|
72
|
+
const { memo } = ctx;
|
|
73
|
+
const location = {
|
|
69
74
|
root,
|
|
70
75
|
output,
|
|
71
|
-
group: group ?? void 0
|
|
72
|
-
}
|
|
76
|
+
group: options.group ?? void 0
|
|
77
|
+
};
|
|
78
|
+
return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {
|
|
79
|
+
const schemaPaths = memo(`${resolver.pluginName}:schemaFilePaths`, () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => schema.name ? [resolver.file({
|
|
80
|
+
name: schema.name,
|
|
81
|
+
extname: ".ts",
|
|
82
|
+
...location
|
|
83
|
+
}).path.toLowerCase()] : [])));
|
|
84
|
+
let file = resolver.file({
|
|
85
|
+
...operationFileEntry(node, node.operationId),
|
|
86
|
+
...location
|
|
87
|
+
});
|
|
88
|
+
for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += "Operation") {
|
|
89
|
+
const next = resolver.file({
|
|
90
|
+
...operationFileEntry(node, name),
|
|
91
|
+
...location
|
|
92
|
+
});
|
|
93
|
+
if (next.path === file.path) break;
|
|
94
|
+
file = next;
|
|
95
|
+
}
|
|
96
|
+
return file;
|
|
97
|
+
});
|
|
73
98
|
}
|
|
74
99
|
/**
|
|
75
100
|
* The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.
|
|
@@ -550,7 +575,7 @@ var compatibility = {
|
|
|
550
575
|
"node": ">=22.22"
|
|
551
576
|
};
|
|
552
577
|
// package.json
|
|
553
|
-
var version = "5.11.0-canary.
|
|
578
|
+
var version = "5.11.0-canary.20261110T135754";
|
|
554
579
|
// ../../internals/client/src/resolveClient.ts
|
|
555
580
|
/**
|
|
556
581
|
* Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
|
|
@@ -819,8 +844,8 @@ function resolveHookFile(node, ctx, options) {
|
|
|
819
844
|
output,
|
|
820
845
|
group: group ?? void 0
|
|
821
846
|
});
|
|
822
|
-
const fileTs =
|
|
823
|
-
|
|
847
|
+
const fileTs = resolveOperationFile({
|
|
848
|
+
ctx,
|
|
824
849
|
node,
|
|
825
850
|
resolver: tsResolver,
|
|
826
851
|
root,
|