@1szx1/vite-plugin-swagger2ts 1.3.1 → 1.3.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/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +5 -2
package/dist/index.cjs
CHANGED
|
@@ -233,14 +233,14 @@ function convertObjPromise(docs) {
|
|
|
233
233
|
async function loadSwaggerSource(options) {
|
|
234
234
|
const { swaggerUrl, jsonUrl, jsonPath, output, formatDocs, formatSchema } = options;
|
|
235
235
|
async function genInterface(docs, docsName) {
|
|
236
|
-
|
|
237
|
-
if (!("openapi" in
|
|
236
|
+
docs = formatDocs ? formatDocs(docs) : docs;
|
|
237
|
+
if (!("openapi" in docs)) {
|
|
238
238
|
if (docs.swagger)
|
|
239
|
-
|
|
239
|
+
docs = await convertObjPromise(docs);
|
|
240
240
|
else
|
|
241
241
|
throw new Error(JSON.stringify(docs));
|
|
242
242
|
}
|
|
243
|
-
return generateDocs(
|
|
243
|
+
return generateDocs(docs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
|
|
244
244
|
}
|
|
245
245
|
async function genResourcesCode(source) {
|
|
246
246
|
const { url, name } = source;
|
package/dist/index.mjs
CHANGED
|
@@ -224,14 +224,14 @@ function convertObjPromise(docs) {
|
|
|
224
224
|
async function loadSwaggerSource(options) {
|
|
225
225
|
const { swaggerUrl, jsonUrl, jsonPath, output, formatDocs, formatSchema } = options;
|
|
226
226
|
async function genInterface(docs, docsName) {
|
|
227
|
-
|
|
228
|
-
if (!("openapi" in
|
|
227
|
+
docs = formatDocs ? formatDocs(docs) : docs;
|
|
228
|
+
if (!("openapi" in docs)) {
|
|
229
229
|
if (docs.swagger)
|
|
230
|
-
|
|
230
|
+
docs = await convertObjPromise(docs);
|
|
231
231
|
else
|
|
232
232
|
throw new Error(JSON.stringify(docs));
|
|
233
233
|
}
|
|
234
|
-
return generateDocs(
|
|
234
|
+
return generateDocs(docs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
|
|
235
235
|
}
|
|
236
236
|
async function genResourcesCode(source) {
|
|
237
237
|
const { url, name } = source;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1szx1/vite-plugin-swagger2ts",
|
|
3
3
|
"description": "forked from https://github.com/morelearn1990/vite-plugin-swagger2ts",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "1SZX1 <2414126198@qq.com>",
|
|
7
7
|
"repository": {
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
12
12
|
"bugs": "https://github.com/1SZX1/vite-plugin-swagger2ts/issues",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"registry": "https://registry.npmjs.org"
|
|
15
|
+
},
|
|
13
16
|
"files": [
|
|
14
17
|
"dist"
|
|
15
18
|
],
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
},
|
|
54
57
|
"dependencies": {
|
|
55
58
|
"axios": "^1.4.0",
|
|
59
|
+
"chalk": "^4.1.2",
|
|
56
60
|
"cross-fetch": "^3.1.5",
|
|
57
61
|
"luch-request": "^3.1.0",
|
|
58
62
|
"openapi3-ts": "^2.0.2",
|
|
@@ -62,7 +66,6 @@
|
|
|
62
66
|
"peerDependencies": {
|
|
63
67
|
"axios": "^1.4.0",
|
|
64
68
|
"luch-request": "^3.1.0",
|
|
65
|
-
"chalk": "^5.3.0",
|
|
66
69
|
"vite": "^2.0.0"
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|