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
|
||||
flowchart LR
|
||||
vue["vue"]
|
||||
compiler-sfc["@vue/compiler-sfc"]
|
||||
compiler-dom["@vue/compiler-dom"]
|
||||
compiler-vapor["@vue/compiler-vapor"]
|
||||
compiler-core["@vue/compiler-core"]
|
||||
vue["vue"]
|
||||
runtime-dom["@vue/runtime-dom"]
|
||||
runtime-vapor["@vue/runtime-vapor"]
|
||||
runtime-core["@vue/runtime-core"]
|
||||
reactivity["@vue/reactivity"]
|
||||
|
||||
subgraph "Runtime Packages"
|
||||
runtime-dom --> runtime-core
|
||||
runtime-vapor --> runtime-core
|
||||
runtime-core --> reactivity
|
||||
end
|
||||
|
||||
subgraph "Compiler Packages"
|
||||
compiler-sfc --> compiler-core
|
||||
compiler-sfc --> compiler-dom
|
||||
compiler-sfc --> compiler-vapor
|
||||
compiler-dom --> compiler-core
|
||||
compiler-vapor --> compiler-core
|
||||
end
|
||||
|
||||
vue --> compiler-sfc
|
||||
vue ---> compiler-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:
|
||||
|
|
|
@ -34,7 +34,7 @@ Please make sure to respect issue requirements and use [the new issue helper](ht
|
|||
|
||||
## Stay In Touch
|
||||
|
||||
- [Twitter](https://twitter.com/vuejs)
|
||||
- [X](https://x.com/vuejs)
|
||||
- [Blog](https://blog.vuejs.org/)
|
||||
- [Job Board](https://vuejobs.com/?ref=vuejs)
|
||||
|
||||
|
|
16
package.json
16
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"version": "3.5.13",
|
||||
"packageManager": "pnpm@10.6.5",
|
||||
"packageManager": "pnpm@10.7.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "node scripts/dev.js",
|
||||
|
@ -69,10 +69,10 @@
|
|||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-replace": "5.0.4",
|
||||
"@swc/core": "^1.11.12",
|
||||
"@swc/core": "^1.11.13",
|
||||
"@types/hash-sum": "^1.0.2",
|
||||
"@types/node": "^22.13.13",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/node": "^22.13.14",
|
||||
"@types/semver": "^7.7.0",
|
||||
"@types/serve-handler": "^6.1.4",
|
||||
"@vitest/ui": "^3.0.2",
|
||||
"@vitest/coverage-v8": "^3.0.9",
|
||||
|
@ -80,10 +80,10 @@
|
|||
"@vue/consolidate": "1.0.0",
|
||||
"conventional-changelog-cli": "^5.0.0",
|
||||
"enquirer": "^2.4.1",
|
||||
"esbuild": "^0.25.1",
|
||||
"esbuild": "^0.25.2",
|
||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||
"eslint": "^9.23.0",
|
||||
"eslint-plugin-import-x": "^4.9.1",
|
||||
"eslint-plugin-import-x": "^4.9.4",
|
||||
"estree-walker": "catalog:",
|
||||
"jsdom": "^26.0.0",
|
||||
"lint-staged": "^15.5.0",
|
||||
|
@ -98,7 +98,7 @@
|
|||
"pug": "^3.0.3",
|
||||
"puppeteer": "~24.4.0",
|
||||
"rimraf": "^6.0.1",
|
||||
"rollup": "^4.37.0",
|
||||
"rollup": "^4.38.0",
|
||||
"rollup-plugin-dts": "^6.2.1",
|
||||
"rollup-plugin-esbuild": "^6.2.1",
|
||||
"rollup-plugin-polyfill-node": "^0.13.0",
|
||||
|
@ -109,7 +109,7 @@
|
|||
"todomvc-app-css": "^2.4.3",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "~5.6.2",
|
||||
"typescript-eslint": "^8.27.0",
|
||||
"typescript-eslint": "^8.28.0",
|
||||
"vite": "catalog:",
|
||||
"vitest": "^3.0.9"
|
||||
},
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@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
|
||||
</button>
|
||||
<div class="vdom-slot-in-vapor-default">
|
||||
#default: <slot :foo="slotProp" />
|
||||
#default:
|
||||
<slot :foo="slotProp" />
|
||||
</div>
|
||||
<div class="vdom-slot-in-vapor-test">
|
||||
#test: <slot name="test">fallback content</slot>
|
||||
|
@ -40,7 +41,7 @@ const slotProp = ref('slot prop')
|
|||
>
|
||||
Toggle default slot to vdom
|
||||
</button>
|
||||
<VdomComp :msg="msg">
|
||||
<VdomComp :msg="msg" class="foo">
|
||||
<template #default="{ foo }" v-if="passSlot">
|
||||
<div>slot prop: {{ foo }}</div>
|
||||
<div>component prop: {{ msg }}</div>
|
||||
|
|
|
@ -388,7 +388,7 @@ const tokenizer = new Tokenizer(stack, {
|
|||
CompilerDeprecationTypes.COMPILER_V_BIND_SYNC,
|
||||
currentOptions,
|
||||
currentProp.loc,
|
||||
currentProp.rawName,
|
||||
currentProp.arg!.loc.source,
|
||||
)
|
||||
) {
|
||||
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`] = `
|
||||
"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)
|
||||
|
|
|
@ -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', () => {
|
||||
const { code, ir } = compileWithVFor(
|
||||
'<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
|
||||
onTrigger?: (event: DebuggerEvent) => void
|
||||
|
||||
/**
|
||||
* Dev only
|
||||
* @internal
|
||||
*/
|
||||
_warnRecursive?: boolean
|
||||
|
||||
constructor(
|
||||
public fn: ComputedGetter<T>,
|
||||
private readonly setter: ComputedSetter<T> | undefined,
|
||||
|
|
|
@ -1,17 +1,10 @@
|
|||
import { type ComputedRefImpl, computed as _computed } from '@vue/reactivity'
|
||||
import { getCurrentInstance, isInSSRComponentSetup } from './component'
|
||||
import { computed as _computed } from '@vue/reactivity'
|
||||
import { isInSSRComponentSetup } from './component'
|
||||
|
||||
export const computed: typeof _computed = (
|
||||
getterOrOptions: any,
|
||||
debugOptions?: any,
|
||||
) => {
|
||||
// @ts-expect-error
|
||||
const c = _computed(getterOrOptions, debugOptions, isInSSRComponentSetup)
|
||||
if (__DEV__) {
|
||||
const i = getCurrentInstance()
|
||||
if (i && i.appContext.config.warnRecursiveComputed) {
|
||||
;(c as unknown as ComputedRefImpl<any>)._warnRecursive = true
|
||||
}
|
||||
}
|
||||
return c as any
|
||||
return _computed(getterOrOptions, debugOptions, isInSSRComponentSetup) as any
|
||||
}
|
||||
|
|
|
@ -140,12 +140,6 @@ export interface GenericAppConfig {
|
|||
trace: string,
|
||||
) => void
|
||||
|
||||
/**
|
||||
* TODO document for 3.5
|
||||
* Enable warnings for computed getters that recursively trigger itself.
|
||||
*/
|
||||
warnRecursiveComputed?: boolean
|
||||
|
||||
/**
|
||||
* Whether to throw unhandled errors in production.
|
||||
* Default is `false` to avoid crashing on any error (and only logs it)
|
||||
|
|
|
@ -666,7 +666,12 @@ export function guardReactiveProps(
|
|||
props: (Data & VNodeProps) | null,
|
||||
): (Data & VNodeProps) | 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>(
|
||||
|
|
|
@ -172,6 +172,7 @@ export function getPropsProxyHandlers(
|
|||
|
||||
export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
|
||||
if (key === '$') return
|
||||
if (key === '__vapor') return true
|
||||
// need special merging behavior for class & style
|
||||
const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
|
||||
const dynamicSources = rawProps.$
|
||||
|
|
|
@ -163,7 +163,12 @@ export function shouldSetAsAttr(tagName: string, key: string): boolean {
|
|||
// them as attributes.
|
||||
// Note that `contentEditable` doesn't have this problem: its DOM
|
||||
// property is also enumerated string values.
|
||||
if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
|
||||
if (
|
||||
key === 'spellcheck' ||
|
||||
key === 'draggable' ||
|
||||
key === 'translate' ||
|
||||
key === 'autocorrect'
|
||||
) {
|
||||
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/*'
|
||||
|
||||
catalog:
|
||||
'@babel/parser': ^7.26.10
|
||||
'@babel/types': ^7.26.10
|
||||
'@babel/parser': ^7.27.0
|
||||
'@babel/types': ^7.27.0
|
||||
'estree-walker': ^2.0.2
|
||||
'vite': ^6.1.0
|
||||
'@vitejs/plugin-vue': https://pkg.pr.new/@vitejs/plugin-vue@c156992
|
||||
|
|
Loading…
Reference in New Issue