mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +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) {
|
function extractObject (code: string) {
|
||||||
// Strip comments
|
// Strip comments
|
||||||
code = code.replace(/^\s*\/\/.*$/gm, '')
|
code = code.replace(/^\s*\/\/.*$/gm, '')
|
||||||
@ -107,7 +109,7 @@ function extractObject (code: string) {
|
|||||||
do {
|
do {
|
||||||
if (stack[0] === code[0] && result.slice(-1) !== '\\') {
|
if (stack[0] === code[0] && result.slice(-1) !== '\\') {
|
||||||
stack.shift()
|
stack.shift()
|
||||||
} else if (code[0] in starts) {
|
} else if (code[0] in starts && !QUOTE_RE.test(stack[0])) {
|
||||||
stack.unshift(starts[code[0]])
|
stack.unshift(starts[code[0]])
|
||||||
}
|
}
|
||||||
result += 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>
|
<script setup>
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
|
title: "l'equipe"
|
||||||
// middleware: 'inject-auth'
|
// middleware: 'inject-auth'
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user