Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 460a536

Browse files
authored
fix: support well-known HTML void elements (#85)
1 parent 9201736 commit 460a536

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@
5050
"@babel/traverse": "^7.16.3",
5151
"@babel/types": "^7.16.0",
5252
"@rollup/pluginutils": "^4.1.1",
53-
"@vue/compiler-core": "^3.2.25",
53+
"@vue/compiler-core": "^3.2.26",
54+
"@vue/compiler-dom": "^3.2.26",
5455
"@vue/ref-transform": "^3.2.24",
55-
"@vue/shared": "^3.2.24",
56+
"@vue/shared": "^3.2.26",
5657
"defu": "^5.0.0",
5758
"htmlparser2": "5.0.1",
5859
"magic-string": "^0.25.7",
@@ -63,7 +64,6 @@
6364
"@antfu/ni": "^0.12.0",
6465
"@types/node": "^16.11.12",
6566
"@vue/composition-api": "^1.4.1",
66-
"@vue/runtime-dom": "^3.2.25",
6767
"bumpp": "^7.1.1",
6868
"eslint": "^8.4.1",
6969
"esno": "^0.12.1",

pnpm-lock.yaml

+21-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/parseSFC.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {
1010
ExpressionNode,
1111
} from '@vue/compiler-core'
1212
import { baseParse } from '@vue/compiler-core'
13+
import { parserOptions } from '@vue/compiler-dom'
1314
import { camelize } from '@vue/shared'
1415
import type {
1516
ParsedSFC,
@@ -236,8 +237,7 @@ function getFreeVariablesForNode(
236237
}
237238

238239
export function findReferencesForSFC(code: string) {
239-
const rootNode = baseParse(code, {
240-
})
240+
const rootNode = baseParse(code, parserOptions)
241241
const templateChildNodes = rootNode.children.flatMap(node =>
242242
node.type === NodeTypes.ELEMENT && node.tagType === ElementTypes.ELEMENT
243243
? [node]

test/__snapshots__/transform.test.ts.snap

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ exports[`transform > fixtures > test/fixtures/ComponentsDirectives.vue 1`] = `
209209
</FooView>
210210
<button v-else-if=\\"now === 0\\" :[propNamePrefix+propName]=\\"1\\" @[eventPrefix.value+eventName]=\\"console.log($event)\\"></button>
211211
<router-view v-else></router-view>
212+
<img src=\\"https://vuejs.org/images/logo.svg\\">
212213
</div>
213214
</template>
214215

test/fixtures/ComponentsDirectives.vue

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
</FooView>
2727
<button v-else-if="now === 0" :[propNamePrefix+propName]="1" @[eventPrefix.value+eventName]="console.log($event)"></button>
2828
<router-view v-else></router-view>
29+
<img src="https://vuejs.org/images/logo.svg">
2930
</div>
3031
</template>
3132

0 commit comments

Comments
 (0)