Skip to content

Commit

Permalink
Support defineNuxtComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
inouetakuya committed May 6, 2024
1 parent 05833b2 commit 968989c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`snapshot > defineNuxtComponent 1`] = `
"import { defineNuxtComponent, useNuxtApp } from '#imports';
"import { useNuxtApp } from '#imports';
definePageMeta({
name: 'HelloWorld', layout: 'test-layout', middleware: 'test-middleware'
});
Expand Down
13 changes: 7 additions & 6 deletions packages/vue-script-setup-converter/src/lib/convertSrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ export const convertSrc = (input: string) => {
.getStatements()
.filter((state) => !Node.isExportAssignment(state))
.map((x) => {
if (
x.isKind(SyntaxKind.ImportDeclaration) &&
hasNamedImportIdentifier(x, "defineComponent")
) {
removeNamedImportIdentifier(x, "defineComponent");
return x.getText();
if (x.isKind(SyntaxKind.ImportDeclaration)) {
if (hasNamedImportIdentifier(x, "defineComponent")) {
removeNamedImportIdentifier(x, "defineComponent");
}
if (hasNamedImportIdentifier(x, "defineNuxtComponent")) {
removeNamedImportIdentifier(x, "defineNuxtComponent");
}
}
return x.getText();
})
Expand Down

0 comments on commit 968989c

Please sign in to comment.