@kubb/plugin-swr 5.2.1 → 5.2.3
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/OVERVIEW.md +16 -0
- package/dist/index.cjs +41 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -35
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +193 -0
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { Resolver, Url, ast, createResolver, defineGenerator, definePlugin } from "kubb/kit";
|
|
2
|
+
import { Resolver, Url, addGenerator, ast, createResolver, defineGenerator, definePlugin, setMacros, setResolver, useConfig } from "kubb/kit";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
|
|
5
5
|
import { File, Function, Type, jsxRenderer } from "kubb/jsx";
|
|
@@ -305,6 +305,15 @@ function createGroupConfig(group) {
|
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
//#endregion
|
|
308
|
+
//#region kubb-extension.json
|
|
309
|
+
var compatibility = {
|
|
310
|
+
"kubb": ">=5.8.0",
|
|
311
|
+
"node": ">=22"
|
|
312
|
+
};
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region package.json
|
|
315
|
+
var version = "5.2.3";
|
|
316
|
+
//#endregion
|
|
308
317
|
//#region ../../internals/client/src/resolveClient.ts
|
|
309
318
|
/**
|
|
310
319
|
* Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
|
|
@@ -1267,41 +1276,39 @@ const pluginSwrName = "plugin-swr";
|
|
|
1267
1276
|
* })
|
|
1268
1277
|
* ```
|
|
1269
1278
|
*/
|
|
1270
|
-
const pluginSwr = definePlugin(
|
|
1271
|
-
|
|
1272
|
-
path: "hooks",
|
|
1273
|
-
barrel: { type: "named" }
|
|
1274
|
-
}, group, exclude = [], include, override = [], mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, client, resolver: userResolver, macros: userMacros } = options;
|
|
1275
|
-
const selectedGenerators = [queryGenerator, mutationGenerator];
|
|
1276
|
-
const groupConfig = createGroupConfig(group) ?? void 0;
|
|
1277
|
-
return {
|
|
1279
|
+
const pluginSwr = definePlugin({
|
|
1280
|
+
meta: {
|
|
1278
1281
|
name: pluginSwrName,
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
})
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1282
|
+
version,
|
|
1283
|
+
compatibility
|
|
1284
|
+
},
|
|
1285
|
+
dependencies: { [pluginTsName]: {} },
|
|
1286
|
+
setup(options) {
|
|
1287
|
+
const { output = {
|
|
1288
|
+
path: "hooks",
|
|
1289
|
+
barrel: { type: "named" }
|
|
1290
|
+
}, group, exclude = [], include, override = [], mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, client, resolver: userResolver, macros: userMacros } = options;
|
|
1291
|
+
const resolver = userResolver ? Resolver.merge(resolverSwr, userResolver) : resolverSwr;
|
|
1292
|
+
setResolver(resolver);
|
|
1293
|
+
if (userMacros?.length) setMacros(userMacros);
|
|
1294
|
+
addGenerator(queryGenerator, mutationGenerator);
|
|
1295
|
+
return {
|
|
1296
|
+
output,
|
|
1297
|
+
client: resolveContractClient({
|
|
1298
|
+
client,
|
|
1299
|
+
plugins: useConfig().plugins
|
|
1300
|
+
}),
|
|
1301
|
+
queryKey,
|
|
1302
|
+
query: resolveQueryConfig(query, { importPath: "swr" }),
|
|
1303
|
+
mutationKey,
|
|
1304
|
+
mutation: resolveMutationConfig(mutation, { importPath: "swr/mutation" }),
|
|
1305
|
+
group: createGroupConfig(group) ?? void 0,
|
|
1306
|
+
exclude,
|
|
1307
|
+
include,
|
|
1308
|
+
override,
|
|
1309
|
+
resolver
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1305
1312
|
});
|
|
1306
1313
|
//#endregion
|
|
1307
1314
|
export { pluginSwr as default, pluginSwr, pluginSwrName, resolverSwr };
|