@1szx1/vite-plugin-swagger2ts 1.3.15 → 1.3.16

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 CHANGED
@@ -315,7 +315,7 @@ async function loadSwaggerSource(options) {
315
315
  return a;
316
316
  }, "");
317
317
  const outputFile = path.resolve(process.cwd(), output);
318
- fs.writeFileSync(outputFile, await prettier.format(CODE_PREFIX + code + suffix, { parser: "typescript" }));
318
+ fs.writeFileSync(outputFile, CODE_PREFIX + await prettier.format(code + suffix, { parser: "typescript" }));
319
319
  return { sources, interfaces };
320
320
  }
321
321
  async function loadGlobTypes({ glob, output }) {
@@ -324,7 +324,7 @@ async function loadGlobTypes({ glob, output }) {
324
324
  const outputFile = path.resolve(process.cwd(), glob.output || "auto-types.d.ts");
325
325
  const importPath = path.relative(outputFile, output).replaceAll("\\", "/").replace(/^\.\.\//, "./");
326
326
  const intersection = getPathsName("_Intersection");
327
- const code = `${CODE_PREFIX}import { ${intersection} } from '${importPath}'
327
+ const code = `import { ${intersection} } from '${importPath}'
328
328
 
329
329
  type FilterOptional<Source, Condition> = Pick<
330
330
  Source,
@@ -338,7 +338,7 @@ declare global {
338
338
  ${generatorMethodType(intersection)}
339
339
  }
340
340
  }`;
341
- fs.writeFileSync(outputFile, await prettier.format(code, { parser: "typescript" }));
341
+ fs.writeFileSync(outputFile, await prettier.format(CODE_PREFIX + code, { parser: "typescript" }));
342
342
  }
343
343
  function swagger2TsPlugin(userOptions) {
344
344
  (async () => {
package/dist/index.mjs CHANGED
@@ -306,7 +306,7 @@ async function loadSwaggerSource(options) {
306
306
  return a;
307
307
  }, "");
308
308
  const outputFile = resolve(process.cwd(), output);
309
- writeFileSync(outputFile, await format(CODE_PREFIX + code + suffix, { parser: "typescript" }));
309
+ writeFileSync(outputFile, CODE_PREFIX + await format(code + suffix, { parser: "typescript" }));
310
310
  return { sources, interfaces };
311
311
  }
312
312
  async function loadGlobTypes({ glob, output }) {
@@ -315,7 +315,7 @@ async function loadGlobTypes({ glob, output }) {
315
315
  const outputFile = resolve(process.cwd(), glob.output || "auto-types.d.ts");
316
316
  const importPath = relative(outputFile, output).replaceAll("\\", "/").replace(/^\.\.\//, "./");
317
317
  const intersection = getPathsName("_Intersection");
318
- const code = `${CODE_PREFIX}import { ${intersection} } from '${importPath}'
318
+ const code = `import { ${intersection} } from '${importPath}'
319
319
 
320
320
  type FilterOptional<Source, Condition> = Pick<
321
321
  Source,
@@ -329,7 +329,7 @@ declare global {
329
329
  ${generatorMethodType(intersection)}
330
330
  }
331
331
  }`;
332
- writeFileSync(outputFile, await format(code, { parser: "typescript" }));
332
+ writeFileSync(outputFile, await format(CODE_PREFIX + code, { parser: "typescript" }));
333
333
  }
334
334
  function swagger2TsPlugin(userOptions) {
335
335
  (async () => {
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.15",
4
+ "version": "1.3.16",
5
5
  "license": "MIT",
6
6
  "author": "1SZX1 <2414126198@qq.com>",
7
7
  "repository": {