mirror of https://github.com/vuejs/core.git
Merge branch 'main' into edison/fix/13661
This commit is contained in:
commit
ceca3bde0c
10
package.json
10
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.5.17",
|
"version": "3.5.17",
|
||||||
"packageManager": "pnpm@10.12.4",
|
"packageManager": "pnpm@10.13.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/dev.js",
|
"dev": "node scripts/dev.js",
|
||||||
|
@ -69,9 +69,9 @@
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
"@rollup/plugin-replace": "5.0.4",
|
"@rollup/plugin-replace": "5.0.4",
|
||||||
"@swc/core": "^1.12.11",
|
"@swc/core": "^1.13.1",
|
||||||
"@types/hash-sum": "^1.0.2",
|
"@types/hash-sum": "^1.0.2",
|
||||||
"@types/node": "^22.16.0",
|
"@types/node": "^22.16.5",
|
||||||
"@types/semver": "^7.7.0",
|
"@types/semver": "^7.7.0",
|
||||||
"@types/serve-handler": "^6.1.4",
|
"@types/serve-handler": "^6.1.4",
|
||||||
"@vitest/coverage-v8": "^3.1.4",
|
"@vitest/coverage-v8": "^3.1.4",
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
"@vue/consolidate": "1.0.0",
|
"@vue/consolidate": "1.0.0",
|
||||||
"conventional-changelog-cli": "^5.0.0",
|
"conventional-changelog-cli": "^5.0.0",
|
||||||
"enquirer": "^2.4.1",
|
"enquirer": "^2.4.1",
|
||||||
"esbuild": "^0.25.6",
|
"esbuild": "^0.25.8",
|
||||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||||
"eslint": "^9.27.0",
|
"eslint": "^9.27.0",
|
||||||
"eslint-plugin-import-x": "^4.13.1",
|
"eslint-plugin-import-x": "^4.13.1",
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
"pug": "^3.0.3",
|
"pug": "^3.0.3",
|
||||||
"puppeteer": "~24.9.0",
|
"puppeteer": "~24.9.0",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.44.2",
|
"rollup": "^4.45.1",
|
||||||
"rollup-plugin-dts": "^6.2.1",
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
"rollup-plugin-esbuild": "^6.2.1",
|
"rollup-plugin-esbuild": "^6.2.1",
|
||||||
"rollup-plugin-polyfill-node": "^0.13.0",
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"vite": "catalog:"
|
"vite": "catalog:"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/repl": "^4.6.1",
|
"@vue/repl": "^4.6.2",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"vue": "workspace:*"
|
"vue": "workspace:*"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import Header from './Header.vue'
|
import Header from './Header.vue'
|
||||||
import { Repl, useStore, SFCOptions, useVueImportMap } from '@vue/repl'
|
import { Repl, useStore, SFCOptions, useVueImportMap } from '@vue/repl'
|
||||||
import Monaco from '@vue/repl/monaco-editor'
|
import Monaco from '@vue/repl/monaco-editor'
|
||||||
import { ref, watchEffect, onMounted, computed } from 'vue'
|
import { ref, watchEffect, onMounted, computed, watch } from 'vue'
|
||||||
|
|
||||||
const replRef = ref<InstanceType<typeof Repl>>()
|
const replRef = ref<InstanceType<typeof Repl>>()
|
||||||
|
|
||||||
|
@ -115,6 +115,34 @@ onMounted(() => {
|
||||||
// @ts-expect-error process shim for old versions of @vue/compiler-sfc dependency
|
// @ts-expect-error process shim for old versions of @vue/compiler-sfc dependency
|
||||||
window.process = { env: {} }
|
window.process = { env: {} }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isVaporSupported = ref(false)
|
||||||
|
watch(
|
||||||
|
() => store.vueVersion,
|
||||||
|
(version, oldVersion) => {
|
||||||
|
const [major, minor] = (version || store.compiler.version)
|
||||||
|
.split('.')
|
||||||
|
.map((v: string) => parseInt(v, 10))
|
||||||
|
isVaporSupported.value = major > 3 || (major === 3 && minor >= 6)
|
||||||
|
if (oldVersion) reloadPage()
|
||||||
|
},
|
||||||
|
{ immediate: true, flush: 'pre' },
|
||||||
|
)
|
||||||
|
|
||||||
|
const previewOptions = computed(() => ({
|
||||||
|
customCode: {
|
||||||
|
importCode: `import { initCustomFormatter${isVaporSupported.value ? ', vaporInteropPlugin' : ''} } from 'vue'`,
|
||||||
|
useCode: `
|
||||||
|
${isVaporSupported.value ? 'app.use(vaporInteropPlugin)' : ''}
|
||||||
|
if (window.devtoolsFormatters) {
|
||||||
|
const index = window.devtoolsFormatters.findIndex((v) => v.__vue_custom_formatter)
|
||||||
|
window.devtoolsFormatters.splice(index, 1)
|
||||||
|
initCustomFormatter()
|
||||||
|
} else {
|
||||||
|
initCustomFormatter()
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
}))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -145,18 +173,7 @@ onMounted(() => {
|
||||||
:showOpenSourceMap="true"
|
:showOpenSourceMap="true"
|
||||||
:autoResize="true"
|
:autoResize="true"
|
||||||
:clearConsole="false"
|
:clearConsole="false"
|
||||||
:preview-options="{
|
:preview-options="previewOptions"
|
||||||
customCode: {
|
|
||||||
importCode: `import { initCustomFormatter } from 'vue'`,
|
|
||||||
useCode: `if (window.devtoolsFormatters) {
|
|
||||||
const index = window.devtoolsFormatters.findIndex((v) => v.__vue_custom_formatter)
|
|
||||||
window.devtoolsFormatters.splice(index, 1)
|
|
||||||
initCustomFormatter()
|
|
||||||
} else {
|
|
||||||
initCustomFormatter()
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ import {
|
||||||
isCoreComponent,
|
isCoreComponent,
|
||||||
isSimpleIdentifier,
|
isSimpleIdentifier,
|
||||||
isStaticArgOf,
|
isStaticArgOf,
|
||||||
|
isVPre,
|
||||||
} from './utils'
|
} from './utils'
|
||||||
import { decodeHTML } from 'entities/lib/decode.js'
|
import { decodeHTML } from 'entities/lib/decode.js'
|
||||||
import {
|
import {
|
||||||
|
@ -246,7 +247,7 @@ const tokenizer = new Tokenizer(stack, {
|
||||||
ondirarg(start, end) {
|
ondirarg(start, end) {
|
||||||
if (start === end) return
|
if (start === end) return
|
||||||
const arg = getSlice(start, end)
|
const arg = getSlice(start, end)
|
||||||
if (inVPre) {
|
if (inVPre && !isVPre(currentProp!)) {
|
||||||
;(currentProp as AttributeNode).name += arg
|
;(currentProp as AttributeNode).name += arg
|
||||||
setLocEnd((currentProp as AttributeNode).nameLoc, end)
|
setLocEnd((currentProp as AttributeNode).nameLoc, end)
|
||||||
} else {
|
} else {
|
||||||
|
@ -262,7 +263,7 @@ const tokenizer = new Tokenizer(stack, {
|
||||||
|
|
||||||
ondirmodifier(start, end) {
|
ondirmodifier(start, end) {
|
||||||
const mod = getSlice(start, end)
|
const mod = getSlice(start, end)
|
||||||
if (inVPre) {
|
if (inVPre && !isVPre(currentProp!)) {
|
||||||
;(currentProp as AttributeNode).name += '.' + mod
|
;(currentProp as AttributeNode).name += '.' + mod
|
||||||
setLocEnd((currentProp as AttributeNode).nameLoc, end)
|
setLocEnd((currentProp as AttributeNode).nameLoc, end)
|
||||||
} else if ((currentProp as DirectiveNode).name === 'slot') {
|
} else if ((currentProp as DirectiveNode).name === 'slot') {
|
||||||
|
|
|
@ -65,7 +65,7 @@ export const transformBind: DirectiveTransform = (dir, _node, context) => {
|
||||||
arg.children.unshift(`(`)
|
arg.children.unshift(`(`)
|
||||||
arg.children.push(`) || ""`)
|
arg.children.push(`) || ""`)
|
||||||
} else if (!arg.isStatic) {
|
} else if (!arg.isStatic) {
|
||||||
arg.content = `${arg.content} || ""`
|
arg.content = arg.content ? `${arg.content} || ""` : `""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// .sync is replaced by v-model:arg
|
// .sync is replaced by v-model:arg
|
||||||
|
|
|
@ -63,7 +63,7 @@ export function isCoreComponent(tag: string): symbol | void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/
|
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/
|
||||||
export const isSimpleIdentifier = (name: string): boolean =>
|
export const isSimpleIdentifier = (name: string): boolean =>
|
||||||
!nonIdentifierRE.test(name)
|
!nonIdentifierRE.test(name)
|
||||||
|
|
||||||
|
@ -343,6 +343,10 @@ export function isText(
|
||||||
return node.type === NodeTypes.INTERPOLATION || node.type === NodeTypes.TEXT
|
return node.type === NodeTypes.INTERPOLATION || node.type === NodeTypes.TEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isVPre(p: ElementNode['props'][0]): p is DirectiveNode {
|
||||||
|
return p.type === NodeTypes.DIRECTIVE && p.name === 'pre'
|
||||||
|
}
|
||||||
|
|
||||||
export function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode {
|
export function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode {
|
||||||
return p.type === NodeTypes.DIRECTIVE && p.name === 'slot'
|
return p.type === NodeTypes.DIRECTIVE && p.name === 'slot'
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ if (__TEST__) {
|
||||||
if (DOMErrorCodes.X_V_HTML_NO_EXPRESSION < ErrorCodes.__EXTEND_POINT__) {
|
if (DOMErrorCodes.X_V_HTML_NO_EXPRESSION < ErrorCodes.__EXTEND_POINT__) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`DOMErrorCodes need to be updated to ${
|
`DOMErrorCodes need to be updated to ${
|
||||||
ErrorCodes.__EXTEND_POINT__ + 1
|
ErrorCodes.__EXTEND_POINT__
|
||||||
} to match extension point from core ErrorCodes.`,
|
} to match extension point from core ErrorCodes.`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ if (__TEST__) {
|
||||||
if (SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME < DOMErrorCodes.__EXTEND_POINT__) {
|
if (SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME < DOMErrorCodes.__EXTEND_POINT__) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`SSRErrorCodes need to be updated to ${
|
`SSRErrorCodes need to be updated to ${
|
||||||
DOMErrorCodes.__EXTEND_POINT__ + 1
|
DOMErrorCodes.__EXTEND_POINT__
|
||||||
} to match extension point from core DOMErrorCodes.`,
|
} to match extension point from core DOMErrorCodes.`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
664
pnpm-lock.yaml
664
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@ packages:
|
||||||
|
|
||||||
catalog:
|
catalog:
|
||||||
'@babel/parser': ^7.28.0
|
'@babel/parser': ^7.28.0
|
||||||
'@babel/types': ^7.28.0
|
'@babel/types': ^7.28.1
|
||||||
'estree-walker': ^2.0.2
|
'estree-walker': ^2.0.2
|
||||||
'magic-string': ^0.30.17
|
'magic-string': ^0.30.17
|
||||||
'source-map-js': ^1.2.1
|
'source-map-js': ^1.2.1
|
||||||
|
|
Loading…
Reference in New Issue