Skip to content

Commit 178b2a1

Browse files
authored
Merge branch 'main' into fix-mathml-tag
2 parents 6b9f3b7 + b2b5f57 commit 178b2a1

File tree

28 files changed

+339
-599
lines changed

28 files changed

+339
-599
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## [3.4.27](https://github.com/vuejs/core/compare/v3.4.26...v3.4.27) (2024-05-06)
2+
3+
4+
### Bug Fixes
5+
6+
* **compat:** include legacy scoped slots ([#10868](https://github.com/vuejs/core/issues/10868)) ([8366126](https://github.com/vuejs/core/commit/83661264a4ced3cb2ff6800904a86dd9e82bbfe2)), closes [#8869](https://github.com/vuejs/core/issues/8869)
7+
* **compiler-core:** add support for arrow aysnc function with unbracketed ([#5789](https://github.com/vuejs/core/issues/5789)) ([ca7d421](https://github.com/vuejs/core/commit/ca7d421e8775f6813f8943d32ab485e0c542f98b)), closes [#5788](https://github.com/vuejs/core/issues/5788)
8+
* **compiler-dom:** restrict createStaticVNode usage with option elements ([#10846](https://github.com/vuejs/core/issues/10846)) ([0e3d617](https://github.com/vuejs/core/commit/0e3d6178b02d0386d779720ae2cc4eac1d1ec990)), closes [#6568](https://github.com/vuejs/core/issues/6568) [#7434](https://github.com/vuejs/core/issues/7434)
9+
* **compiler-sfc:** handle keyof operator ([#10874](https://github.com/vuejs/core/issues/10874)) ([10d34a5](https://github.com/vuejs/core/commit/10d34a5624775f20437ccad074a97270ef74c3fb)), closes [#10871](https://github.com/vuejs/core/issues/10871)
10+
* **hydration:** handle edge case of style mismatch without style attribute ([f2c1412](https://github.com/vuejs/core/commit/f2c1412e46a8fad3e13403bfa78335c4f704f21c)), closes [#10786](https://github.com/vuejs/core/issues/10786)
11+
12+
13+
114
## [3.4.26](https://github.com/vuejs/core/compare/v3.4.25...v3.4.26) (2024-04-29)
215

316

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
3-
"version": "3.4.26",
4-
"packageManager": "pnpm@9.0.6",
3+
"version": "3.4.27",
4+
"packageManager": "pnpm@9.1.0",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -70,7 +70,7 @@
7070
"@rollup/plugin-terser": "^0.4.4",
7171
"@types/hash-sum": "^1.0.2",
7272
"@types/minimist": "^1.2.5",
73-
"@types/node": "^20.12.7",
73+
"@types/node": "^20.12.10",
7474
"@types/semver": "^7.5.8",
7575
"@vitest/coverage-istanbul": "^1.5.2",
7676
"@vue/consolidate": "1.0.0",
@@ -97,20 +97,20 @@
9797
"pug": "^3.0.2",
9898
"puppeteer": "~22.7.1",
9999
"rimraf": "^5.0.5",
100-
"rollup": "^4.17.1",
100+
"rollup": "^4.17.2",
101101
"rollup-plugin-dts": "^6.1.0",
102102
"rollup-plugin-esbuild": "^6.1.1",
103103
"rollup-plugin-polyfill-node": "^0.13.0",
104104
"semver": "^7.6.0",
105105
"serve": "^14.2.3",
106106
"simple-git-hooks": "^2.11.1",
107-
"terser": "^5.30.4",
107+
"terser": "^5.31.0",
108108
"todomvc-app-css": "^2.4.3",
109109
"tslib": "^2.6.2",
110-
"tsx": "^4.7.3",
110+
"tsx": "^4.9.3",
111111
"typescript": "~5.4.5",
112112
"typescript-eslint": "^7.7.1",
113-
"vite": "^5.2.10",
113+
"vite": "^5.2.11",
114114
"vitest": "^1.5.2"
115115
},
116116
"pnpm": {

packages/compiler-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",

packages/compiler-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-dom",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/compiler-dom",
55
"main": "index.js",
66
"module": "dist/compiler-dom.esm-bundler.js",

packages/compiler-sfc/__tests__/compileScript/__snapshots__/definePropsDestructure.spec.ts.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,19 @@ return () => {}
304304
305305
}"
306306
`;
307+
308+
exports[`sfc reactive props destructure > rest spread non-inline 1`] = `
309+
"import { createPropsRestProxy as _createPropsRestProxy } from 'vue'
310+
311+
export default {
312+
props: ['foo', 'bar'],
313+
setup(__props, { expose: __expose }) {
314+
__expose();
315+
316+
const rest = _createPropsRestProxy(__props, ["foo"])
317+
318+
return { rest }
319+
}
320+
321+
}"
322+
`;

packages/compiler-sfc/__tests__/compileScript/definePropsDestructure.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,27 @@ describe('sfc reactive props destructure', () => {
265265
})
266266
})
267267

268+
test('rest spread non-inline', () => {
269+
const { content, bindings } = compile(
270+
`
271+
<script setup>
272+
const { foo, ...rest } = defineProps(['foo', 'bar'])
273+
</script>
274+
<template>{{ rest.bar }}</template>
275+
`,
276+
{ inlineTemplate: false },
277+
)
278+
expect(content).toMatch(
279+
`const rest = _createPropsRestProxy(__props, ["foo"])`,
280+
)
281+
assertCode(content)
282+
expect(bindings).toStrictEqual({
283+
foo: BindingTypes.PROPS,
284+
bar: BindingTypes.PROPS,
285+
rest: BindingTypes.SETUP_REACTIVE_CONST,
286+
})
287+
})
288+
268289
// #6960
269290
test('computed static key', () => {
270291
const { content, bindings } = compile(`

packages/compiler-sfc/__tests__/compileScript/resolveType.spec.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,42 @@ describe('resolveType', () => {
447447
})
448448
})
449449

450+
test('keyof', () => {
451+
const files = {
452+
'/foo.ts': `export type IMP = { ${1}: 1 };`,
453+
}
454+
455+
const { props } = resolve(
456+
`
457+
import { IMP } from './foo'
458+
interface Foo { foo: 1, ${1}: 1 }
459+
type Bar = { bar: 1 }
460+
declare const obj: Bar
461+
declare const set: Set<any>
462+
declare const arr: Array<any>
463+
464+
defineProps<{
465+
imp: keyof IMP,
466+
foo: keyof Foo,
467+
bar: keyof Bar,
468+
obj: keyof typeof obj,
469+
set: keyof typeof set,
470+
arr: keyof typeof arr
471+
}>()
472+
`,
473+
files,
474+
)
475+
476+
expect(props).toStrictEqual({
477+
imp: ['Number'],
478+
foo: ['String', 'Number'],
479+
bar: ['String'],
480+
obj: ['String'],
481+
set: ['String'],
482+
arr: ['String', 'Number'],
483+
})
484+
})
485+
450486
test('ExtractPropTypes (element-plus)', () => {
451487
const { props, raw } = resolve(
452488
`

packages/compiler-sfc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"module": "dist/compiler-sfc.esm-browser.js",
@@ -62,6 +62,6 @@
6262
"postcss-modules": "^6.0.0",
6363
"postcss-selector-parser": "^6.0.16",
6464
"pug": "^3.0.2",
65-
"sass": "^1.75.0"
65+
"sass": "^1.76.0"
6666
}
6767
}

packages/compiler-sfc/src/compileScript.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,14 @@ export function compileScript(
523523
)
524524
}
525525

526-
// defineProps / defineEmits
526+
// defineProps
527527
const isDefineProps = processDefineProps(ctx, init, decl.id)
528+
if (ctx.propsDestructureRestId) {
529+
setupBindings[ctx.propsDestructureRestId] =
530+
BindingTypes.SETUP_REACTIVE_CONST
531+
}
532+
533+
// defineEmits
528534
const isDefineEmits =
529535
!isDefineProps && processDefineEmits(ctx, init, decl.id)
530536
!isDefineEmits &&

packages/compiler-sfc/src/script/resolveType.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ export function inferRuntimeType(
14481448
ctx: TypeResolveContext,
14491449
node: Node & MaybeWithScope,
14501450
scope = node._ownerScope || ctxToScope(ctx),
1451+
isKeyOf = false,
14511452
): string[] {
14521453
try {
14531454
switch (node.type) {
@@ -1467,8 +1468,18 @@ export function inferRuntimeType(
14671468
const types = new Set<string>()
14681469
const members =
14691470
node.type === 'TSTypeLiteral' ? node.members : node.body.body
1471+
14701472
for (const m of members) {
1471-
if (
1473+
if (isKeyOf) {
1474+
if (
1475+
m.type === 'TSPropertySignature' &&
1476+
m.key.type === 'NumericLiteral'
1477+
) {
1478+
types.add('Number')
1479+
} else {
1480+
types.add('String')
1481+
}
1482+
} else if (
14721483
m.type === 'TSCallSignatureDeclaration' ||
14731484
m.type === 'TSConstructSignatureDeclaration'
14741485
) {
@@ -1477,6 +1488,7 @@ export function inferRuntimeType(
14771488
types.add('Object')
14781489
}
14791490
}
1491+
14801492
return types.size ? Array.from(types) : ['Object']
14811493
}
14821494
case 'TSPropertySignature':
@@ -1512,9 +1524,22 @@ export function inferRuntimeType(
15121524
case 'TSTypeReference': {
15131525
const resolved = resolveTypeReference(ctx, node, scope)
15141526
if (resolved) {
1515-
return inferRuntimeType(ctx, resolved, resolved._ownerScope)
1527+
return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf)
15161528
}
1529+
15171530
if (node.typeName.type === 'Identifier') {
1531+
if (isKeyOf) {
1532+
switch (node.typeName.name) {
1533+
case 'String':
1534+
case 'Array':
1535+
case 'ArrayLike':
1536+
case 'ReadonlyArray':
1537+
return ['String', 'Number']
1538+
default:
1539+
return ['String']
1540+
}
1541+
}
1542+
15181543
switch (node.typeName.name) {
15191544
case 'Array':
15201545
case 'Function':
@@ -1634,15 +1659,20 @@ export function inferRuntimeType(
16341659
// typeof only support identifier in local scope
16351660
const matched = scope.declares[id.name]
16361661
if (matched) {
1637-
return inferRuntimeType(ctx, matched, matched._ownerScope)
1662+
return inferRuntimeType(ctx, matched, matched._ownerScope, isKeyOf)
16381663
}
16391664
}
16401665
break
16411666
}
16421667

16431668
// e.g. readonly
16441669
case 'TSTypeOperator': {
1645-
return inferRuntimeType(ctx, node.typeAnnotation, scope)
1670+
return inferRuntimeType(
1671+
ctx,
1672+
node.typeAnnotation,
1673+
scope,
1674+
node.operator === 'keyof',
1675+
)
16461676
}
16471677
}
16481678
} catch (e) {

packages/compiler-ssr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-ssr",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/compiler-ssr",
55
"main": "dist/compiler-ssr.cjs.js",
66
"types": "dist/compiler-ssr.d.ts",

packages/dts-test/defineComponent.test-d.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ describe('should work when props type is incompatible with setup returned type '
15011501

15021502
describe('withKeys and withModifiers as pro', () => {
15031503
const onKeydown = withKeys(e => {}, [''])
1504-
const onClick = withModifiers(e => {}, [''])
1504+
const onClick = withModifiers(e => {}, [])
15051505
;<input onKeydown={onKeydown} onClick={onClick} />
15061506
})
15071507

packages/reactivity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/reactivity",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/reactivity",
55
"main": "index.js",
66
"module": "dist/reactivity.esm-bundler.js",

packages/runtime-core/__tests__/hydration.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,13 @@ describe('SSR hydration', () => {
15271527
expect(`Hydration style mismatch`).toHaveBeenWarnedTimes(1)
15281528
})
15291529

1530+
test('style mismatch when no style attribute is present', () => {
1531+
mountWithHydration(`<div></div>`, () =>
1532+
h('div', { style: { color: 'red' } }),
1533+
)
1534+
expect(`Hydration style mismatch`).toHaveBeenWarnedTimes(1)
1535+
})
1536+
15301537
test('style mismatch w/ v-show', () => {
15311538
mountWithHydration(`<div style="color:red;display:none"></div>`, () =>
15321539
withDirectives(createVNode('div', { style: 'color: red' }, ''), [

packages/runtime-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/runtime-core",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/runtime-core",
55
"main": "index.js",
66
"module": "dist/runtime-core.esm-bundler.js",

packages/runtime-core/src/compat/instance.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ import {
3636
legacyresolveScopedSlots,
3737
} from './renderHelpers'
3838
import { resolveFilter } from '../helpers/resolveAssets'
39-
import type { InternalSlots, Slots } from '../componentSlots'
40-
import type { ContextualRenderFn } from '../componentRenderContext'
39+
import type { Slots } from '../componentSlots'
4140
import { resolveMergedOptions } from '../componentOptions'
4241

4342
export type LegacyPublicInstance = ComponentPublicInstance &
@@ -106,14 +105,7 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
106105

107106
$scopedSlots: i => {
108107
assertCompatEnabled(DeprecationTypes.INSTANCE_SCOPED_SLOTS, i)
109-
const res: InternalSlots = {}
110-
for (const key in i.slots) {
111-
const fn = i.slots[key]!
112-
if (!(fn as ContextualRenderFn)._ns /* non-scoped slot */) {
113-
res[key] = fn
114-
}
115-
}
116-
return res
108+
return __DEV__ ? shallowReadonly(i.slots) : i.slots
117109
},
118110

119111
$on: i => on.bind(null, i),

packages/runtime-core/src/hydration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ function propHasMismatch(
727727
): boolean {
728728
let mismatchType: string | undefined
729729
let mismatchKey: string | undefined
730-
let actual: any
731-
let expected: any
730+
let actual: string | boolean | null | undefined
731+
let expected: string | boolean | null | undefined
732732
if (key === 'class') {
733733
// classes might be in different order, but that doesn't affect cascade
734734
// so we just need to check if the class lists contain the same classes.
@@ -739,7 +739,7 @@ function propHasMismatch(
739739
}
740740
} else if (key === 'style') {
741741
// style might be in different order, but that doesn't affect cascade
742-
actual = el.getAttribute('style')
742+
actual = el.getAttribute('style') || ''
743743
expected = isString(clientValue)
744744
? clientValue
745745
: stringifyStyle(normalizeStyle(clientValue))

packages/runtime-dom/__tests__/directives/vOn.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('runtime-dom: v-on directive', () => {
4343
})
4444

4545
test('it should support key modifiers and system modifiers', () => {
46-
const keyNames = ['ctrl', 'shift', 'meta', 'alt']
46+
const keyNames = ['ctrl', 'shift', 'meta', 'alt'] as const
4747

4848
keyNames.forEach(keyName => {
4949
const el = document.createElement('div')

packages/runtime-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/runtime-dom",
3-
"version": "3.4.26",
3+
"version": "3.4.27",
44
"description": "@vue/runtime-dom",
55
"main": "index.js",
66
"module": "dist/runtime-dom.esm-bundler.js",

0 commit comments

Comments
 (0)