@1szx1/vite-plugin-swagger2ts 1.1.0 → 1.1.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/adapters.cjs +2 -0
- package/dist/adapters.d.ts +1 -0
- package/dist/adapters.mjs +2 -0
- package/dist/index.cjs +4 -1
- package/dist/index.mjs +4 -1
- package/package.json +109 -109
package/dist/adapters.cjs
CHANGED
|
@@ -22,6 +22,8 @@ function axiosAdapter(httpInstance) {
|
|
|
22
22
|
|
|
23
23
|
function LuchAdapter(httpInstance) {
|
|
24
24
|
async function request(url, method, param, config) {
|
|
25
|
+
if (config?.path)
|
|
26
|
+
url = mergeUrlParam(url, config.path);
|
|
25
27
|
const response = await httpInstance.middleware({
|
|
26
28
|
url,
|
|
27
29
|
method: method.toUpperCase(),
|
package/dist/adapters.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare function LuchAdapter<T extends Record<string, any>>(httpInstance: Reques
|
|
|
16
16
|
request: <U extends keyof T, M extends string & keyof T[U]>(url: U & string, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (HttpRequestConfig<Request.HttpTask> & {
|
|
17
17
|
data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
|
|
18
18
|
params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
|
|
19
|
+
path?: Get<T[U][M]["param" & keyof T[U][M]], "path"> | undefined;
|
|
19
20
|
}) | undefined) => Promise<T[U][M]["response" & keyof T[U][M]]>;
|
|
20
21
|
upload: <U_1 extends { [K in keyof T]: T[K] extends {
|
|
21
22
|
post: any;
|
package/dist/adapters.mjs
CHANGED
|
@@ -20,6 +20,8 @@ function axiosAdapter(httpInstance) {
|
|
|
20
20
|
|
|
21
21
|
function LuchAdapter(httpInstance) {
|
|
22
22
|
async function request(url, method, param, config) {
|
|
23
|
+
if (config?.path)
|
|
24
|
+
url = mergeUrlParam(url, config.path);
|
|
23
25
|
const response = await httpInstance.middleware({
|
|
24
26
|
url,
|
|
25
27
|
method: method.toUpperCase(),
|
package/dist/index.cjs
CHANGED
|
@@ -239,7 +239,10 @@ function swagger2TsPlugin(userOptions) {
|
|
|
239
239
|
return "";
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
const sources = await fetchUrl(`${swaggerUrl}/swagger-resources`)
|
|
242
|
+
const sources = await fetchUrl(`${swaggerUrl}/swagger-resources`).catch((error) => {
|
|
243
|
+
console.log("vite-plugin-swagger2ts doc error", error);
|
|
244
|
+
return [];
|
|
245
|
+
});
|
|
243
246
|
const code = (await Promise.all(sources.map(genCode))).reduce((a, b) => a + b, "");
|
|
244
247
|
const outputFile = path.resolve(process.cwd(), output);
|
|
245
248
|
fs.writeFileSync(outputFile, code);
|
package/dist/index.mjs
CHANGED
|
@@ -231,7 +231,10 @@ function swagger2TsPlugin(userOptions) {
|
|
|
231
231
|
return "";
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
const sources = await fetchUrl(`${swaggerUrl}/swagger-resources`)
|
|
234
|
+
const sources = await fetchUrl(`${swaggerUrl}/swagger-resources`).catch((error) => {
|
|
235
|
+
console.log("vite-plugin-swagger2ts doc error", error);
|
|
236
|
+
return [];
|
|
237
|
+
});
|
|
235
238
|
const code = (await Promise.all(sources.map(genCode))).reduce((a, b) => a + b, "");
|
|
236
239
|
const outputFile = resolve(process.cwd(), output);
|
|
237
240
|
writeFileSync(outputFile, code);
|
package/package.json
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@1szx1/vite-plugin-swagger2ts",
|
|
3
|
-
"description": "fork for https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
4
|
-
"version": "1.1.
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "1SZX1 <2414126198@qq.com>",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/1SZX1/vite-plugin-swagger2ts"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
12
|
-
"bugs": "https://github.com/1SZX1/vite-plugin-swagger2ts/issues",
|
|
13
|
-
"files": [
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"require": "./dist/index.cjs",
|
|
19
|
-
"import": "./dist/index.mjs",
|
|
20
|
-
"types": "./dist/index.d.ts"
|
|
21
|
-
},
|
|
22
|
-
"./adapters": {
|
|
23
|
-
"require": "./dist/adapters.cjs",
|
|
24
|
-
"import": "./dist/adapters.mjs",
|
|
25
|
-
"types": "./dist/adapters.d.ts"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"main": "dist/index.cjs",
|
|
29
|
-
"module": "dist/index.mjs",
|
|
30
|
-
"types": "dist/index.d.ts",
|
|
31
|
-
"typesVersions": {
|
|
32
|
-
"*": {
|
|
33
|
-
"/": [
|
|
34
|
-
"./dist"
|
|
35
|
-
],
|
|
36
|
-
"adapters": [
|
|
37
|
-
"./dist/adapters"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"bin": {
|
|
42
|
-
"swagger2ts": "./dist/bin.mjs"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "unbuild",
|
|
46
|
-
"stub": "unbuild --stub",
|
|
47
|
-
"prepublishOnly": "pnpm run build",
|
|
48
|
-
"release": "pnpx git-ensure -a && pnpx bumpp --commit --tag --push",
|
|
49
|
-
"demo:dev": "pnpm -C examples/demo run dev",
|
|
50
|
-
"demo:build": "pnpm -C examples/demo run build",
|
|
51
|
-
"demo:preview": "pnpm -C examples/demo run preview",
|
|
52
|
-
"test": "jest",
|
|
53
|
-
"lint": "eslint --fix --ext .ts ./",
|
|
54
|
-
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
|
55
|
-
"preinstall": "npx only-allow pnpm"
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"cross-fetch": "^3.1.5",
|
|
59
|
-
"openapi3-ts": "^2.0.2",
|
|
60
|
-
"swagger2openapi": "^7.0.8",
|
|
61
|
-
"luch-request": "^3.1.0",
|
|
62
|
-
"axios": "^1.4.0",
|
|
63
|
-
"unconfig": "^0.3.9"
|
|
64
|
-
},
|
|
65
|
-
"peerDependencies": {
|
|
66
|
-
"vite": "^2.0.0",
|
|
67
|
-
"luch-request": "^3.1.0",
|
|
68
|
-
"axios": "^1.4.0"
|
|
69
|
-
},
|
|
70
|
-
"devDependencies": {
|
|
71
|
-
"@antfu/eslint-config": "^0.6.6",
|
|
72
|
-
"@commitlint/cli": "^12.1.4",
|
|
73
|
-
"@commitlint/config-conventional": "^12.1.4",
|
|
74
|
-
"@dcloudio/types": "^3.3.3",
|
|
75
|
-
"@types/jest": "^26.0.24",
|
|
76
|
-
"@types/node": "^14.18.12",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
78
|
-
"@typescript-eslint/parser": "^5.14.0",
|
|
79
|
-
"conventional-changelog": "^3.1.25",
|
|
80
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
81
|
-
"eslint": "^7.32.0",
|
|
82
|
-
"husky": "^8.0.3",
|
|
83
|
-
"jest": "^26.6.3",
|
|
84
|
-
"jest-esbuild": "^0.1.6",
|
|
85
|
-
"lint-staged": "^10.5.4",
|
|
86
|
-
"typescript": "^4.7.0",
|
|
87
|
-
"unbuild": "^1.2.1",
|
|
88
|
-
"vite": "^2.8.6"
|
|
89
|
-
},
|
|
90
|
-
"lint-staged": {
|
|
91
|
-
"*.{ts}": "eslint --fix --ext",
|
|
92
|
-
"*.{ts,md}": "prettier --write"
|
|
93
|
-
},
|
|
94
|
-
"husky": {
|
|
95
|
-
"hooks": {
|
|
96
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
97
|
-
"pre-commit": "lint-staged"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"commitlint": {
|
|
101
|
-
"extends": [
|
|
102
|
-
"@commitlint/config-conventional"
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
"config": {
|
|
106
|
-
"commitizen": {
|
|
107
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@1szx1/vite-plugin-swagger2ts",
|
|
3
|
+
"description": "fork for https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
4
|
+
"version": "1.1.1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "1SZX1 <2414126198@qq.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/1SZX1/vite-plugin-swagger2ts"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
12
|
+
"bugs": "https://github.com/1SZX1/vite-plugin-swagger2ts/issues",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"require": "./dist/index.cjs",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./adapters": {
|
|
23
|
+
"require": "./dist/adapters.cjs",
|
|
24
|
+
"import": "./dist/adapters.mjs",
|
|
25
|
+
"types": "./dist/adapters.d.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"main": "dist/index.cjs",
|
|
29
|
+
"module": "dist/index.mjs",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"typesVersions": {
|
|
32
|
+
"*": {
|
|
33
|
+
"/": [
|
|
34
|
+
"./dist"
|
|
35
|
+
],
|
|
36
|
+
"adapters": [
|
|
37
|
+
"./dist/adapters"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"bin": {
|
|
42
|
+
"swagger2ts": "./dist/bin.mjs"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "unbuild",
|
|
46
|
+
"stub": "unbuild --stub",
|
|
47
|
+
"prepublishOnly": "pnpm run build",
|
|
48
|
+
"release": "pnpx git-ensure -a && pnpx bumpp --commit --tag --push",
|
|
49
|
+
"demo:dev": "pnpm -C examples/demo run dev",
|
|
50
|
+
"demo:build": "pnpm -C examples/demo run build",
|
|
51
|
+
"demo:preview": "pnpm -C examples/demo run preview",
|
|
52
|
+
"test": "jest",
|
|
53
|
+
"lint": "eslint --fix --ext .ts ./",
|
|
54
|
+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
|
55
|
+
"preinstall": "npx only-allow pnpm"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"cross-fetch": "^3.1.5",
|
|
59
|
+
"openapi3-ts": "^2.0.2",
|
|
60
|
+
"swagger2openapi": "^7.0.8",
|
|
61
|
+
"luch-request": "^3.1.0",
|
|
62
|
+
"axios": "^1.4.0",
|
|
63
|
+
"unconfig": "^0.3.9"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"vite": "^2.0.0",
|
|
67
|
+
"luch-request": "^3.1.0",
|
|
68
|
+
"axios": "^1.4.0"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@antfu/eslint-config": "^0.6.6",
|
|
72
|
+
"@commitlint/cli": "^12.1.4",
|
|
73
|
+
"@commitlint/config-conventional": "^12.1.4",
|
|
74
|
+
"@dcloudio/types": "^3.3.3",
|
|
75
|
+
"@types/jest": "^26.0.24",
|
|
76
|
+
"@types/node": "^14.18.12",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
78
|
+
"@typescript-eslint/parser": "^5.14.0",
|
|
79
|
+
"conventional-changelog": "^3.1.25",
|
|
80
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
81
|
+
"eslint": "^7.32.0",
|
|
82
|
+
"husky": "^8.0.3",
|
|
83
|
+
"jest": "^26.6.3",
|
|
84
|
+
"jest-esbuild": "^0.1.6",
|
|
85
|
+
"lint-staged": "^10.5.4",
|
|
86
|
+
"typescript": "^4.7.0",
|
|
87
|
+
"unbuild": "^1.2.1",
|
|
88
|
+
"vite": "^2.8.6"
|
|
89
|
+
},
|
|
90
|
+
"lint-staged": {
|
|
91
|
+
"*.{ts}": "eslint --fix --ext",
|
|
92
|
+
"*.{ts,md}": "prettier --write"
|
|
93
|
+
},
|
|
94
|
+
"husky": {
|
|
95
|
+
"hooks": {
|
|
96
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
97
|
+
"pre-commit": "lint-staged"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"commitlint": {
|
|
101
|
+
"extends": [
|
|
102
|
+
"@commitlint/config-conventional"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"config": {
|
|
106
|
+
"commitizen": {
|
|
107
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
110
|
}
|