@1szx1/vite-plugin-swagger2ts 1.0.18 → 1.0.19

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.js CHANGED
@@ -236,7 +236,12 @@ function convertObjPromise(docs) {
236
236
  function swagger2TsPlugin(userOptions) {
237
237
  const { swaggerUrl, output, formatDocs, formatSchema } = resolveOptions(userOptions);
238
238
  async function loadSwaggerSource() {
239
- const sources = await fetchUrl(`${swaggerUrl}/swagger-resources`);
239
+ let sources = [];
240
+ try {
241
+ sources = await fetchUrl(`${swaggerUrl}/swagger-resources`);
242
+ } catch (error) {
243
+ console.log("vite-plugin-swagger2ts doc error", error);
244
+ }
240
245
  let code = "";
241
246
  for (let i = 0; i < sources.length; i++) {
242
247
  const { url, name: docsName } = sources[i];
@@ -252,6 +257,7 @@ function swagger2TsPlugin(userOptions) {
252
257
  const apistrings = generateDocs(openapiDocs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
253
258
  code += apistrings;
254
259
  } catch (error) {
260
+ console.log("vite-plugin-swagger2ts convert error", error);
255
261
  }
256
262
  }
257
263
  const outputFile = (0, import_path2.resolve)(process.cwd(), output);
package/dist/index.mjs CHANGED
@@ -202,7 +202,12 @@ function convertObjPromise(docs) {
202
202
  function swagger2TsPlugin(userOptions) {
203
203
  const { swaggerUrl, output, formatDocs, formatSchema } = resolveOptions(userOptions);
204
204
  async function loadSwaggerSource() {
205
- const sources = await fetchUrl(`${swaggerUrl}/swagger-resources`);
205
+ let sources = [];
206
+ try {
207
+ sources = await fetchUrl(`${swaggerUrl}/swagger-resources`);
208
+ } catch (error) {
209
+ console.log("vite-plugin-swagger2ts doc error", error);
210
+ }
206
211
  let code = "";
207
212
  for (let i = 0; i < sources.length; i++) {
208
213
  const { url, name: docsName } = sources[i];
@@ -218,6 +223,7 @@ function swagger2TsPlugin(userOptions) {
218
223
  const apistrings = generateDocs(openapiDocs, { docsName, baseUrl: docs.basePath ?? "", formatSchema });
219
224
  code += apistrings;
220
225
  } catch (error) {
226
+ console.log("vite-plugin-swagger2ts convert error", error);
221
227
  }
222
228
  }
223
229
  const outputFile = resolve2(process.cwd(), output);
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.18",
4
+ "version": "1.0.19",
5
5
  "license": "MIT",
6
6
  "author": "1SZX1 <2414126198@qq.com>",
7
7
  "repository": {