@kubb/plugin-fetch 5.0.0-beta.80 → 5.0.0-beta.81
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 +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/plugin.ts +2 -1
- package/templates/fetch.ts +179 -128
package/dist/index.cjs
CHANGED
|
@@ -1479,6 +1479,7 @@ const pluginFetch = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1479
1479
|
ctx.setMacros([...defaultMacros, ...options.macros ?? []]);
|
|
1480
1480
|
ctx.addGenerator(...selectedGenerators);
|
|
1481
1481
|
const root = node_path.default.resolve(ctx.config.root, ctx.config.output.path);
|
|
1482
|
+
const baseURLExpression = baseURL ? baseURL.includes("${") ? `\`${baseURL.replaceAll("`", "\\`")}\`` : JSON.stringify(baseURL) : void 0;
|
|
1482
1483
|
ctx.injectFile({
|
|
1483
1484
|
baseName: "serializers.ts",
|
|
1484
1485
|
path: node_path.default.resolve(root, ".kubb/serializers.ts"),
|
|
@@ -1488,7 +1489,7 @@ const pluginFetch = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1488
1489
|
baseName: "client.ts",
|
|
1489
1490
|
path: node_path.default.resolve(root, ".kubb/client.ts"),
|
|
1490
1491
|
copy: fetchClientTemplatePath,
|
|
1491
|
-
footer:
|
|
1492
|
+
footer: baseURLExpression ? `client.setConfig({ baseURL: ${baseURLExpression} })` : void 0
|
|
1492
1493
|
});
|
|
1493
1494
|
ctx.injectFile({
|
|
1494
1495
|
baseName: "standardSchema.ts",
|