@kubb/plugin-fetch 5.5.0 → 5.5.1
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 +1 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -23
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/plugin.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { createFunctionParameter, createFunctionParameters, functionPrinter, plu
|
|
|
5
5
|
import { File, Function, jsxRenderer } from "kubb/jsx";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
|
|
7
7
|
import { pluginZodName } from "@kubb/plugin-zod";
|
|
8
|
-
import { readFileSync } from "node:fs";
|
|
9
8
|
import { fileURLToPath } from "node:url";
|
|
10
9
|
//#region ../../internals/shared/src/params.ts
|
|
11
10
|
/**
|
|
@@ -1395,27 +1394,6 @@ const resolverClient = createResolver({
|
|
|
1395
1394
|
}
|
|
1396
1395
|
});
|
|
1397
1396
|
//#endregion
|
|
1398
|
-
//#region ../../internals/client/src/runtimeTemplate.ts
|
|
1399
|
-
/** Apply the active TypeScript parser's import extension to a copied client runtime. */
|
|
1400
|
-
function runtimeTemplate(path, config) {
|
|
1401
|
-
const parser = config.parsers.find((item) => item.extNames?.includes(".ts"));
|
|
1402
|
-
const probe = ast.factory.createFile({
|
|
1403
|
-
baseName: "probe.ts",
|
|
1404
|
-
path: "probe.ts",
|
|
1405
|
-
imports: [ast.factory.createImport({
|
|
1406
|
-
name: ["KubbRuntimeImport"],
|
|
1407
|
-
path: "/probeDependency.ts",
|
|
1408
|
-
root: "/"
|
|
1409
|
-
})],
|
|
1410
|
-
sources: [ast.factory.createSource({
|
|
1411
|
-
name: "probe",
|
|
1412
|
-
nodes: [ast.factory.createText("KubbRuntimeImport")]
|
|
1413
|
-
})]
|
|
1414
|
-
});
|
|
1415
|
-
const extension = parser?.parse(probe).match(/from ['"]\.\/probeDependency(\.[^'"]+)?['"]/)?.[1] ?? "";
|
|
1416
|
-
return readFileSync(path, "utf8").replace(/(from ['"]\.\/(?:serializers|standardSchema))(?:\.ts|\.js)?(['"])/g, `$1${extension}$2`);
|
|
1417
|
-
}
|
|
1418
|
-
//#endregion
|
|
1419
1397
|
//#region src/generators/clientGenerator.tsx
|
|
1420
1398
|
/**
|
|
1421
1399
|
* Built-in operation generator for `@kubb/plugin-fetch`. Emits one async function per OpenAPI
|
|
@@ -1504,7 +1482,7 @@ const pluginFetch = definePlugin((options) => {
|
|
|
1504
1482
|
ctx.injectFile({
|
|
1505
1483
|
baseName: "client.ts",
|
|
1506
1484
|
path: path.resolve(root, ".kubb/client.ts"),
|
|
1507
|
-
|
|
1485
|
+
copy: fetchClientTemplatePath,
|
|
1508
1486
|
footer: baseURLExpression ? `client.setConfig({ baseURL: ${baseURLExpression} })` : void 0
|
|
1509
1487
|
});
|
|
1510
1488
|
ctx.injectFile({
|