-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vue): vue regular script block exports not being recognized insid…
…e editor (#8998) Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
- Loading branch information
1 parent
e5dc759
commit 2d21b7e
Showing
8 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/vue': patch | ||
--- | ||
|
||
Adds editor support for Vue non setup script blocks and Vue 3.3 generics. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/integrations/vue/test/fixtures/app-entrypoint/src/components/Generics.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script lang="ts" setup generic="T extends 'generic' | 'not-generic'"> | ||
interface GenericComponentProps { | ||
value: T | ||
} | ||
defineProps<GenericComponentProps>() | ||
</script> | ||
|
||
<template> | ||
<div id="generics"> | ||
{{ value }} | ||
</div> | ||
</template> |
18 changes: 18 additions & 0 deletions
18
packages/integrations/vue/test/fixtures/app-entrypoint/src/components/GenericsAndBlocks.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script lang="ts"> | ||
export const customFormatter = (num: number) => `${num * 3}!!!` | ||
export type FormatNumber<T> = (num: T) => string; | ||
</script> | ||
|
||
<script lang="ts" setup generic="T extends number, Formatter extends FormatNumber<T>"> | ||
const props = defineProps<{ | ||
value: T, | ||
formatter: Formatter | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<div id="generics-and-blocks"> | ||
{{ value }} {{ props.formatter(props.value) }} | ||
</div> | ||
</template> |
18 changes: 18 additions & 0 deletions
18
...ges/integrations/vue/test/fixtures/app-entrypoint/src/components/MultipleScriptBlocks.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script lang="ts"> | ||
export const doubleNumber = (num: number) => num * 2 | ||
</script> | ||
|
||
<script lang="ts" setup> | ||
defineProps({ | ||
value: { | ||
type: Number, | ||
required: true | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div id="multiple-script-blocks"> | ||
{{ doubleNumber(value) }} <slot /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters