mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(pages): ignore expression delimiters within quotes (#6033)
* fix(pages): ignore expression delimiters within quotes * perf: use re * test: add test that would have failed
This commit is contained in:
parent
b4b98041f0
commit
8f7b9f904e
@ -98,6 +98,8 @@ const starts = {
|
||||
"'": "'"
|
||||
}
|
||||
|
||||
const QUOTE_RE = /["']/
|
||||
|
||||
function extractObject (code: string) {
|
||||
// Strip comments
|
||||
code = code.replace(/^\s*\/\/.*$/gm, '')
|
||||
@ -107,7 +109,7 @@ function extractObject (code: string) {
|
||||
do {
|
||||
if (stack[0] === code[0] && result.slice(-1) !== '\\') {
|
||||
stack.shift()
|
||||
} else if (code[0] in starts) {
|
||||
} else if (code[0] in starts && !QUOTE_RE.test(stack[0])) {
|
||||
stack.unshift(starts[code[0]])
|
||||
}
|
||||
result += code[0]
|
||||
|
1
test/fixtures/basic/pages/no-auth.vue
vendored
1
test/fixtures/basic/pages/no-auth.vue
vendored
@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
definePageMeta({
|
||||
title: "l'equipe"
|
||||
// middleware: 'inject-auth'
|
||||
})
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user