@1szx1/vite-plugin-swagger2ts 1.0.7 → 1.0.8
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/adapters/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
|
2
2
|
|
|
3
3
|
type Get<T, K> = T[K & keyof T];
|
|
4
4
|
|
|
5
|
-
declare function
|
|
5
|
+
declare function axiosAdapter<T>(httpInstance: AxiosInstance): {
|
|
6
6
|
request: <U extends string & keyof T, M extends string & keyof T[U]>(url: U, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (AxiosRequestConfig<any> & {
|
|
7
7
|
data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
|
|
8
8
|
params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
|
|
@@ -10,4 +10,4 @@ declare function useRequest<T>(httpInstance: AxiosInstance): {
|
|
|
10
10
|
}) | undefined) => Promise<T[U][M]["response" & keyof T[U][M]]>;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export {
|
|
13
|
+
export { axiosAdapter };
|
package/dist/adapters/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/adapters/index.ts
|
|
21
21
|
var adapters_exports = {};
|
|
22
22
|
__export(adapters_exports, {
|
|
23
|
-
|
|
23
|
+
axiosAdapter: () => axiosAdapter
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(adapters_exports);
|
|
26
26
|
|
|
@@ -30,7 +30,7 @@ function mergeUrlParam(url, paths) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// src/adapters/axios.ts
|
|
33
|
-
function
|
|
33
|
+
function axiosAdapter(httpInstance) {
|
|
34
34
|
async function request(url, method, param, config) {
|
|
35
35
|
if (config?.path)
|
|
36
36
|
url = mergeUrlParam(url, config.path);
|
|
@@ -47,5 +47,5 @@ function useRequest(httpInstance) {
|
|
|
47
47
|
}
|
|
48
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
49
|
0 && (module.exports = {
|
|
50
|
-
|
|
50
|
+
axiosAdapter
|
|
51
51
|
});
|
package/dist/adapters/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ function mergeUrlParam(url, paths) {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
// src/adapters/axios.ts
|
|
9
|
-
function
|
|
9
|
+
function axiosAdapter(httpInstance) {
|
|
10
10
|
async function request(url, method, param, config) {
|
|
11
11
|
if (config?.path)
|
|
12
12
|
url = mergeUrlParam(url, config.path);
|
|
@@ -22,5 +22,5 @@ function useRequest(httpInstance) {
|
|
|
22
22
|
return { request };
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
axiosAdapter
|
|
26
26
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1szx1/vite-plugin-swagger2ts",
|
|
3
3
|
"description": "fork for https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.8",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -18,6 +18,18 @@
|
|
|
18
18
|
"src",
|
|
19
19
|
"index.d.ts"
|
|
20
20
|
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"require": "./dist/index.js",
|
|
25
|
+
"import": "./dist/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./adapters": {
|
|
28
|
+
"types": "./dist/adapters/index.d.ts",
|
|
29
|
+
"require": "./dist/adapters/index.js",
|
|
30
|
+
"import": "./dist/adapters/index.mjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
21
33
|
"scripts": {
|
|
22
34
|
"dev": "pnpm run build -- --watch --ignore-watch examples",
|
|
23
35
|
"build": "tsup src/index.ts src/adapters/index.ts --dts --format cjs,esm",
|
package/src/adapters/axios.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AxiosInstance, AxiosRequestConfig } from 'axios'
|
|
2
2
|
import {Get, mergeUrlParam} from './utils'
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function axiosAdapter<T>(httpInstance: AxiosInstance) {
|
|
5
5
|
type UrlKey = string & keyof T
|
|
6
6
|
type MethodKey<U extends UrlKey> = string & keyof T[U]
|
|
7
7
|
|
|
@@ -38,4 +38,4 @@ function useRequest<T>(httpInstance: AxiosInstance) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
export {
|
|
41
|
+
export { axiosAdapter }
|