mirror of https://github.com/vuejs/core.git
chore: Merge branch 'edison/fix/vdomInteropWithProps' into edison/testVapor
This commit is contained in:
commit
ebd32e68c8
|
@ -290,27 +290,39 @@ This is made possible via several configurations:
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
|
vue["vue"]
|
||||||
compiler-sfc["@vue/compiler-sfc"]
|
compiler-sfc["@vue/compiler-sfc"]
|
||||||
compiler-dom["@vue/compiler-dom"]
|
compiler-dom["@vue/compiler-dom"]
|
||||||
|
compiler-vapor["@vue/compiler-vapor"]
|
||||||
compiler-core["@vue/compiler-core"]
|
compiler-core["@vue/compiler-core"]
|
||||||
vue["vue"]
|
|
||||||
runtime-dom["@vue/runtime-dom"]
|
runtime-dom["@vue/runtime-dom"]
|
||||||
|
runtime-vapor["@vue/runtime-vapor"]
|
||||||
runtime-core["@vue/runtime-core"]
|
runtime-core["@vue/runtime-core"]
|
||||||
reactivity["@vue/reactivity"]
|
reactivity["@vue/reactivity"]
|
||||||
|
|
||||||
subgraph "Runtime Packages"
|
subgraph "Runtime Packages"
|
||||||
runtime-dom --> runtime-core
|
runtime-dom --> runtime-core
|
||||||
|
runtime-vapor --> runtime-core
|
||||||
runtime-core --> reactivity
|
runtime-core --> reactivity
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph "Compiler Packages"
|
subgraph "Compiler Packages"
|
||||||
compiler-sfc --> compiler-core
|
compiler-sfc --> compiler-core
|
||||||
compiler-sfc --> compiler-dom
|
compiler-sfc --> compiler-dom
|
||||||
|
compiler-sfc --> compiler-vapor
|
||||||
compiler-dom --> compiler-core
|
compiler-dom --> compiler-core
|
||||||
|
compiler-vapor --> compiler-core
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vue --> compiler-sfc
|
||||||
vue ---> compiler-dom
|
vue ---> compiler-dom
|
||||||
vue --> runtime-dom
|
vue --> runtime-dom
|
||||||
|
vue --> compiler-vapor
|
||||||
|
vue --> runtime-vapor
|
||||||
|
|
||||||
|
%% Highlight class
|
||||||
|
classDef highlight stroke:#35eb9a,stroke-width:3px;
|
||||||
|
class compiler-vapor,runtime-vapor highlight;
|
||||||
```
|
```
|
||||||
|
|
||||||
There are some rules to follow when importing across package boundaries:
|
There are some rules to follow when importing across package boundaries:
|
||||||
|
|
|
@ -34,7 +34,7 @@ Please make sure to respect issue requirements and use [the new issue helper](ht
|
||||||
|
|
||||||
## Stay In Touch
|
## Stay In Touch
|
||||||
|
|
||||||
- [Twitter](https://twitter.com/vuejs)
|
- [X](https://x.com/vuejs)
|
||||||
- [Blog](https://blog.vuejs.org/)
|
- [Blog](https://blog.vuejs.org/)
|
||||||
- [Job Board](https://vuejobs.com/?ref=vuejs)
|
- [Job Board](https://vuejobs.com/?ref=vuejs)
|
||||||
|
|
||||||
|
|
16
package.json
16
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.5.13",
|
"version": "3.5.13",
|
||||||
"packageManager": "pnpm@10.6.5",
|
"packageManager": "pnpm@10.7.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/dev.js",
|
"dev": "node scripts/dev.js",
|
||||||
|
@ -69,10 +69,10 @@
|
||||||
"@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.11.12",
|
"@swc/core": "^1.11.13",
|
||||||
"@types/hash-sum": "^1.0.2",
|
"@types/hash-sum": "^1.0.2",
|
||||||
"@types/node": "^22.13.13",
|
"@types/node": "^22.13.14",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.7.0",
|
||||||
"@types/serve-handler": "^6.1.4",
|
"@types/serve-handler": "^6.1.4",
|
||||||
"@vitest/ui": "^3.0.2",
|
"@vitest/ui": "^3.0.2",
|
||||||
"@vitest/coverage-v8": "^3.0.9",
|
"@vitest/coverage-v8": "^3.0.9",
|
||||||
|
@ -80,10 +80,10 @@
|
||||||
"@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.1",
|
"esbuild": "^0.25.2",
|
||||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||||
"eslint": "^9.23.0",
|
"eslint": "^9.23.0",
|
||||||
"eslint-plugin-import-x": "^4.9.1",
|
"eslint-plugin-import-x": "^4.9.4",
|
||||||
"estree-walker": "catalog:",
|
"estree-walker": "catalog:",
|
||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
"lint-staged": "^15.5.0",
|
"lint-staged": "^15.5.0",
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
"pug": "^3.0.3",
|
"pug": "^3.0.3",
|
||||||
"puppeteer": "~24.4.0",
|
"puppeteer": "~24.4.0",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.37.0",
|
"rollup": "^4.38.0",
|
||||||
"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",
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
"todomvc-app-css": "^2.4.3",
|
"todomvc-app-css": "^2.4.3",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "~5.6.2",
|
"typescript": "~5.6.2",
|
||||||
"typescript-eslint": "^8.27.0",
|
"typescript-eslint": "^8.28.0",
|
||||||
"vite": "catalog:",
|
"vite": "catalog:",
|
||||||
"vitest": "^3.0.9"
|
"vitest": "^3.0.9"
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"vite": "^6.2.2"
|
"vite": "^6.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ const slotProp = ref('slot prop')
|
||||||
change slot prop
|
change slot prop
|
||||||
</button>
|
</button>
|
||||||
<div class="vdom-slot-in-vapor-default">
|
<div class="vdom-slot-in-vapor-default">
|
||||||
#default: <slot :foo="slotProp" />
|
#default:
|
||||||
|
<slot :foo="slotProp" />
|
||||||
</div>
|
</div>
|
||||||
<div class="vdom-slot-in-vapor-test">
|
<div class="vdom-slot-in-vapor-test">
|
||||||
#test: <slot name="test">fallback content</slot>
|
#test: <slot name="test">fallback content</slot>
|
||||||
|
@ -40,7 +41,7 @@ const slotProp = ref('slot prop')
|
||||||
>
|
>
|
||||||
Toggle default slot to vdom
|
Toggle default slot to vdom
|
||||||
</button>
|
</button>
|
||||||
<VdomComp :msg="msg">
|
<VdomComp :msg="msg" class="foo">
|
||||||
<template #default="{ foo }" v-if="passSlot">
|
<template #default="{ foo }" v-if="passSlot">
|
||||||
<div>slot prop: {{ foo }}</div>
|
<div>slot prop: {{ foo }}</div>
|
||||||
<div>component prop: {{ msg }}</div>
|
<div>component prop: {{ msg }}</div>
|
||||||
|
|
|
@ -388,7 +388,7 @@ const tokenizer = new Tokenizer(stack, {
|
||||||
CompilerDeprecationTypes.COMPILER_V_BIND_SYNC,
|
CompilerDeprecationTypes.COMPILER_V_BIND_SYNC,
|
||||||
currentOptions,
|
currentOptions,
|
||||||
currentProp.loc,
|
currentProp.loc,
|
||||||
currentProp.rawName,
|
currentProp.arg!.loc.source,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
currentProp.name = 'model'
|
currentProp.name = 'model'
|
||||||
|
|
|
@ -115,6 +115,21 @@ export function render(_ctx) {
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`compiler: v-for > object value, key and index 1`] = `
|
||||||
|
"import { child as _child, toDisplayString as _toDisplayString, setText as _setText, renderEffect as _renderEffect, createFor as _createFor, template as _template } from 'vue';
|
||||||
|
const t0 = _template("<div> </div>", true)
|
||||||
|
|
||||||
|
export function render(_ctx) {
|
||||||
|
const n0 = _createFor(() => (_ctx.list), (_for_item0, _for_key0, _for_index0) => {
|
||||||
|
const n2 = t0()
|
||||||
|
const x2 = _child(n2)
|
||||||
|
_renderEffect(() => _setText(x2, _toDisplayString(_for_item0.value + _for_key0.value + _for_index0.value)))
|
||||||
|
return n2
|
||||||
|
}, (value, key, index) => (key))
|
||||||
|
return n0
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`compiler: v-for > v-for aliases w/ complex expressions 1`] = `
|
exports[`compiler: v-for > v-for aliases w/ complex expressions 1`] = `
|
||||||
"import { getDefaultValue as _getDefaultValue, child as _child, toDisplayString as _toDisplayString, setText as _setText, renderEffect as _renderEffect, createFor as _createFor, template as _template } from 'vue';
|
"import { getDefaultValue as _getDefaultValue, child as _child, toDisplayString as _toDisplayString, setText as _setText, renderEffect as _renderEffect, createFor as _createFor, template as _template } from 'vue';
|
||||||
const t0 = _template("<div> </div>", true)
|
const t0 = _template("<div> </div>", true)
|
||||||
|
|
|
@ -119,6 +119,32 @@ describe('compiler: v-for', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('object value, key and index', () => {
|
||||||
|
const { code, ir } = compileWithVFor(
|
||||||
|
`<div v-for="(value, key, index) in list" :key="key">{{ value + key + index }}</div>`,
|
||||||
|
)
|
||||||
|
expect(code).matchSnapshot()
|
||||||
|
expect(ir.block.dynamic.children[0].operation).toMatchObject({
|
||||||
|
type: IRNodeTypes.FOR,
|
||||||
|
source: {
|
||||||
|
type: NodeTypes.SIMPLE_EXPRESSION,
|
||||||
|
content: 'list',
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: NodeTypes.SIMPLE_EXPRESSION,
|
||||||
|
content: 'value',
|
||||||
|
},
|
||||||
|
key: {
|
||||||
|
type: NodeTypes.SIMPLE_EXPRESSION,
|
||||||
|
content: 'key',
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: NodeTypes.SIMPLE_EXPRESSION,
|
||||||
|
content: 'index',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
test('object de-structured value', () => {
|
test('object de-structured value', () => {
|
||||||
const { code, ir } = compileWithVFor(
|
const { code, ir } = compileWithVFor(
|
||||||
'<span v-for="({ id, value }) in items" :key="id">{{ id }}{{ value }}</span>',
|
'<span v-for="({ id, value }) in items" :key="id">{{ id }}{{ value }}</span>',
|
||||||
|
|
|
@ -119,12 +119,6 @@ export class ComputedRefImpl<T = any> implements Dependency, Subscriber {
|
||||||
// dev only
|
// dev only
|
||||||
onTrigger?: (event: DebuggerEvent) => void
|
onTrigger?: (event: DebuggerEvent) => void
|
||||||
|
|
||||||
/**
|
|
||||||
* Dev only
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
_warnRecursive?: boolean
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public fn: ComputedGetter<T>,
|
public fn: ComputedGetter<T>,
|
||||||
private readonly setter: ComputedSetter<T> | undefined,
|
private readonly setter: ComputedSetter<T> | undefined,
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
import { type ComputedRefImpl, computed as _computed } from '@vue/reactivity'
|
import { computed as _computed } from '@vue/reactivity'
|
||||||
import { getCurrentInstance, isInSSRComponentSetup } from './component'
|
import { isInSSRComponentSetup } from './component'
|
||||||
|
|
||||||
export const computed: typeof _computed = (
|
export const computed: typeof _computed = (
|
||||||
getterOrOptions: any,
|
getterOrOptions: any,
|
||||||
debugOptions?: any,
|
debugOptions?: any,
|
||||||
) => {
|
) => {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const c = _computed(getterOrOptions, debugOptions, isInSSRComponentSetup)
|
return _computed(getterOrOptions, debugOptions, isInSSRComponentSetup) as any
|
||||||
if (__DEV__) {
|
|
||||||
const i = getCurrentInstance()
|
|
||||||
if (i && i.appContext.config.warnRecursiveComputed) {
|
|
||||||
;(c as unknown as ComputedRefImpl<any>)._warnRecursive = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return c as any
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,12 +140,6 @@ export interface GenericAppConfig {
|
||||||
trace: string,
|
trace: string,
|
||||||
) => void
|
) => void
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO document for 3.5
|
|
||||||
* Enable warnings for computed getters that recursively trigger itself.
|
|
||||||
*/
|
|
||||||
warnRecursiveComputed?: boolean
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to throw unhandled errors in production.
|
* Whether to throw unhandled errors in production.
|
||||||
* Default is `false` to avoid crashing on any error (and only logs it)
|
* Default is `false` to avoid crashing on any error (and only logs it)
|
||||||
|
|
|
@ -666,7 +666,12 @@ export function guardReactiveProps(
|
||||||
props: (Data & VNodeProps) | null,
|
props: (Data & VNodeProps) | null,
|
||||||
): (Data & VNodeProps) | null {
|
): (Data & VNodeProps) | null {
|
||||||
if (!props) return null
|
if (!props) return null
|
||||||
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props
|
return isProxy(props) ||
|
||||||
|
isInternalObject(props) ||
|
||||||
|
// handling for vapor props
|
||||||
|
props.__vapor
|
||||||
|
? extend({}, props)
|
||||||
|
: props
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cloneVNode<T, U>(
|
export function cloneVNode<T, U>(
|
||||||
|
|
|
@ -172,6 +172,7 @@ export function getPropsProxyHandlers(
|
||||||
|
|
||||||
export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
|
export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
|
||||||
if (key === '$') return
|
if (key === '$') return
|
||||||
|
if (key === '__vapor') return true
|
||||||
// need special merging behavior for class & style
|
// need special merging behavior for class & style
|
||||||
const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
|
const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
|
||||||
const dynamicSources = rawProps.$
|
const dynamicSources = rawProps.$
|
||||||
|
|
|
@ -163,7 +163,12 @@ export function shouldSetAsAttr(tagName: string, key: string): boolean {
|
||||||
// them as attributes.
|
// them as attributes.
|
||||||
// Note that `contentEditable` doesn't have this problem: its DOM
|
// Note that `contentEditable` doesn't have this problem: its DOM
|
||||||
// property is also enumerated string values.
|
// property is also enumerated string values.
|
||||||
if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
|
if (
|
||||||
|
key === 'spellcheck' ||
|
||||||
|
key === 'draggable' ||
|
||||||
|
key === 'translate' ||
|
||||||
|
key === 'autocorrect'
|
||||||
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1064
pnpm-lock.yaml
1064
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -3,8 +3,8 @@ packages:
|
||||||
- 'packages-private/*'
|
- 'packages-private/*'
|
||||||
|
|
||||||
catalog:
|
catalog:
|
||||||
'@babel/parser': ^7.26.10
|
'@babel/parser': ^7.27.0
|
||||||
'@babel/types': ^7.26.10
|
'@babel/types': ^7.27.0
|
||||||
'estree-walker': ^2.0.2
|
'estree-walker': ^2.0.2
|
||||||
'vite': ^6.1.0
|
'vite': ^6.1.0
|
||||||
'@vitejs/plugin-vue': https://pkg.pr.new/@vitejs/plugin-vue@c156992
|
'@vitejs/plugin-vue': https://pkg.pr.new/@vitejs/plugin-vue@c156992
|
||||||
|
|
Loading…
Reference in New Issue