Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler): resolve inner content for incomplete SFC root tag #12271

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

KazariEX
Copy link
Contributor

@KazariEX KazariEX commented Oct 26, 2024

When <template> is the last SFC block, if the document ends with an incorrect or incomplete closing tag, the parser will completely ignore that tag. This means that we cannot obtain the complete inner content of the <template> based on the locs of the child nodes. Due to language tools parsing the inner content of each SFC block to handle errors, we need correct inner content resolving.

image

image

This PR attempts to fix the issue by setting the end position of innerLoc to the end of the document when the last SFC block is not properly closed.

Copy link

github-actions bot commented Oct 26, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 38 kB 34.2 kB
vue.global.prod.js 159 kB (+180 B) 58 kB (+63 B) 51.5 kB (+46 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.9 kB 18.3 kB 16.7 kB
createApp 55 kB 21.3 kB 19.4 kB
createSSRApp 59 kB 23 kB 20.9 kB
defineCustomElement 59.8 kB 22.8 kB 20.8 kB
overall 68.7 kB 26.3 kB 24 kB

Copy link

pkg-pr-new bot commented Oct 26, 2024

Open in Stackblitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@12271

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@12271

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@12271

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@12271

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@12271

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@12271

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@12271

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@12271

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@12271

vue

pnpm add https://pkg.pr.new/vue@12271

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@12271

commit: 32b7b16

@edison1105
Copy link
Member

In this scenario, perhaps an error should be thrown.

@edison1105 edison1105 added 🧹 p1-chore Priority 1: this doesn't change code behavior. ready for review This PR requires more reviews 🔩 p2-edge-case and removed 🧹 p1-chore Priority 1: this doesn't change code behavior. labels Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔩 p2-edge-case ready for review This PR requires more reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants