Skip to content

Commit

Permalink
chore: optimized flawed codes
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Sep 30, 2021
1 parent 109721e commit 4792da3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,10 @@ export function compileVueCode(code: string) {
content = transferSetupPosition(content)
content += '\nexport default _sfc_main\n'

if (scriptSetup.lang === 'ts' || scriptSetup.lang === 'tsx') {
ext = scriptSetup.lang
} else if (!scriptSetup.lang || scriptSetup.lang === 'js'|| scriptSetup.lang === 'jsx') {
ext = scriptSetup.lang || 'js'
}
ext = scriptSetup.lang || 'js'
} else if (script && script.content) {
content = script.content

if (script.lang === 'ts' || script.lang === 'tsx') {
ext = script.lang
} else if (!script.lang || script.lang === 'js' || script.lang === 'jsx') {
ext = script.lang || 'js'
}
ext = script.lang || 'js'
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function dtsPlugin(options: PluginOptions = {}): Plugin {
if (content) {
if (ext === 'js' || ext === 'jsx') hasJsVue = true

project.createSourceFile(id + `.${ext || 'js'}`, content, { overwrite: true })
project.createSourceFile(`${id}.${ext || 'js'}`, content, { overwrite: true })
}
} else if (
!id.includes('.vue?vue') &&
Expand Down

0 comments on commit 4792da3

Please sign in to comment.