Skip to content

Commit

Permalink
feat: improve dts generation
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 16, 2023
1 parent ee65fc6 commit 13b6102
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/core/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ export function createContext(options: Options = {}, root = process.cwd()) {
resolversAddon(resolvers),
{
declaration(dts) {
if (!dts.endsWith('\n'))
dts += '\n'
return `/* eslint-disable */\n/* prettier-ignore */\n// Generated by 'unplugin-auto-import'\n${dts}`
return `${`
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
${dts}`.trim()}\n`
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion test/__snapshots__/dts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
exports[`dts 1`] = `
"/* eslint-disable */
/* prettier-ignore */
// Generated by 'unplugin-auto-import'
// @ts-nocheck
// Generated by unplugin-auto-import
export {}
declare global {
const $$: typeof import('vue/macros')['$$']
Expand Down

0 comments on commit 13b6102

Please sign in to comment.