Skip to content

Commit 83895e7

Browse files
authored
Merge branch 'vuejs:main' into fix/nested-transitiongroup
2 parents 29a1647 + fc4bbf9 commit 83895e7

File tree

72 files changed

+1690
-688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1690
-688
lines changed

.github/renovate.json5

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3-
extends: ['config:base', 'schedule:weekly', 'group:allNonMajor'],
3+
extends: ['config:recommended', 'schedule:weekly', 'group:allNonMajor'],
44
labels: ['dependencies'],
55
ignorePaths: ['**/__tests__/**'],
66
rangeStrategy: 'bump',
77
packageRules: [
88
{
9-
depTypeList: ['peerDependencies'],
9+
matchDepTypes: ['peerDependencies'],
1010
enabled: false,
1111
},
1212
{
1313
groupName: 'test',
14-
matchPackageNames: ['vitest', 'jsdom', 'puppeteer'],
15-
matchPackagePrefixes: ['@vitest'],
14+
matchPackageNames: ['vitest', 'jsdom', 'puppeteer', '@vitest{/,}**'],
1615
},
1716
{
1817
groupName: 'playground',
@@ -23,18 +22,28 @@
2322
},
2423
{
2524
groupName: 'compiler',
26-
matchPackageNames: ['magic-string'],
27-
matchPackagePrefixes: ['@babel', 'postcss'],
25+
matchPackageNames: ['magic-string', '@babel{/,}**', 'postcss{/,}**'],
2826
},
2927
{
3028
groupName: 'build',
31-
matchPackageNames: ['vite', '@swc/core'],
32-
matchPackagePrefixes: ['rollup', 'esbuild', '@rollup', '@vitejs'],
29+
matchPackageNames: [
30+
'vite',
31+
'@swc/core',
32+
'rollup{/,}**',
33+
'esbuild{/,}**',
34+
'@rollup{/,}**',
35+
'@vitejs{/,}**',
36+
],
3337
},
3438
{
3539
groupName: 'lint',
36-
matchPackageNames: ['simple-git-hooks', 'lint-staged'],
37-
matchPackagePrefixes: ['typescript-eslint', 'eslint', 'prettier'],
40+
matchPackageNames: [
41+
'simple-git-hooks',
42+
'lint-staged',
43+
'typescript-eslint{/,}**',
44+
'eslint{/,}**',
45+
'prettier{/,}**',
46+
],
3847
},
3948
],
4049
ignoreDeps: [

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
},
1414
"[json]": {
1515
"editor.defaultFormatter": "esbenp.prettier-vscode"
16-
}
16+
},
17+
"editor.formatOnSave": true
1718
}

.well-known/funding-manifest-urls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://vuejs.org/funding.json

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
## [3.5.13](https://github.com/vuejs/core/compare/v3.5.12...v3.5.13) (2024-11-15)
2+
3+
4+
### Bug Fixes
5+
6+
* **compiler-core:** handle v-memo + v-for with functional key ([#12014](https://github.com/vuejs/core/issues/12014)) ([99009ee](https://github.com/vuejs/core/commit/99009eee0efc238392daba93792d478525b21afa)), closes [#12013](https://github.com/vuejs/core/issues/12013)
7+
* **compiler-dom:** properly stringify template string style ([#12392](https://github.com/vuejs/core/issues/12392)) ([2d78539](https://github.com/vuejs/core/commit/2d78539da35322aea5f821b3cf9b02d006abac72)), closes [#12391](https://github.com/vuejs/core/issues/12391)
8+
* **custom-element:** avoid triggering mutationObserver when relecting props ([352bc88](https://github.com/vuejs/core/commit/352bc88c1bd2fda09c61ab17ea1a5967ffcd7bc0)), closes [#12214](https://github.com/vuejs/core/issues/12214) [#12215](https://github.com/vuejs/core/issues/12215)
9+
* **deps:** update dependency postcss to ^8.4.48 ([#12356](https://github.com/vuejs/core/issues/12356)) ([b5ff930](https://github.com/vuejs/core/commit/b5ff930089985a58c3553977ef999cec2a6708a4))
10+
* **hydration:** the component vnode's el should be updated when a mismatch occurs. ([#12255](https://github.com/vuejs/core/issues/12255)) ([a20a4cb](https://github.com/vuejs/core/commit/a20a4cb36a3e717d1f8f259d0d59f133f508ff0a)), closes [#12253](https://github.com/vuejs/core/issues/12253)
11+
* **reactiivty:** avoid unnecessary watcher effect removal from inactive scope ([2193284](https://github.com/vuejs/core/commit/21932840eae72ffcd357a62ec596aaecc7ec224a)), closes [#5783](https://github.com/vuejs/core/issues/5783) [#5806](https://github.com/vuejs/core/issues/5806)
12+
* **reactivity:** release nested effects/scopes on effect scope stop ([#12373](https://github.com/vuejs/core/issues/12373)) ([bee2f5e](https://github.com/vuejs/core/commit/bee2f5ee62dc0cd04123b737779550726374dd0a)), closes [#12370](https://github.com/vuejs/core/issues/12370)
13+
* **runtime-dom:** set css vars before user onMounted hooks ([2d5c5e2](https://github.com/vuejs/core/commit/2d5c5e25e9b7a56e883674fb434135ac514429b5)), closes [#11533](https://github.com/vuejs/core/issues/11533)
14+
* **runtime-dom:** set css vars on update to handle child forcing reflow in onMount ([#11561](https://github.com/vuejs/core/issues/11561)) ([c4312f9](https://github.com/vuejs/core/commit/c4312f9c715c131a09e552ba46e9beb4b36d55e6))
15+
* **ssr:** avoid updating subtree of async component if it is resolved ([#12363](https://github.com/vuejs/core/issues/12363)) ([da7ad5e](https://github.com/vuejs/core/commit/da7ad5e3d24f3e108401188d909d27a4910da095)), closes [#12362](https://github.com/vuejs/core/issues/12362)
16+
* **ssr:** ensure v-text updates correctly with custom directives in SSR output ([#12311](https://github.com/vuejs/core/issues/12311)) ([1f75d4e](https://github.com/vuejs/core/commit/1f75d4e6dfe18121ebe443cd3e8105d54f727893)), closes [#12309](https://github.com/vuejs/core/issues/12309)
17+
* **ssr:** handle initial selected state for select with v-model + v-for option ([#12399](https://github.com/vuejs/core/issues/12399)) ([4f8d807](https://github.com/vuejs/core/commit/4f8d8078221ee52deed266677a227ad2a6d8dd22)), closes [#12395](https://github.com/vuejs/core/issues/12395)
18+
* **teleport:** handle deferred teleport update before mounted ([#12168](https://github.com/vuejs/core/issues/12168)) ([8bff142](https://github.com/vuejs/core/commit/8bff142f99b646e9dd15897ec75368fbf34f1534)), closes [#12161](https://github.com/vuejs/core/issues/12161)
19+
* **templateRef:** set ref on cached async component which wrapped in KeepAlive ([#12290](https://github.com/vuejs/core/issues/12290)) ([983eb50](https://github.com/vuejs/core/commit/983eb50a17eac76f1bba4394ad0316c62b72191d)), closes [#4999](https://github.com/vuejs/core/issues/4999) [#5004](https://github.com/vuejs/core/issues/5004)
20+
* **test:** update snapshot ([#12169](https://github.com/vuejs/core/issues/12169)) ([828d4a4](https://github.com/vuejs/core/commit/828d4a443919fa2aa4e2e92fbd03a5f04b258eea))
21+
* **Transition:** fix transition memory leak edge case ([#12182](https://github.com/vuejs/core/issues/12182)) ([660132d](https://github.com/vuejs/core/commit/660132df6c6a8c14bf75e593dc47d2fdada30322)), closes [#12181](https://github.com/vuejs/core/issues/12181)
22+
* **transition:** reflow before leave-active class after leave-from ([#12288](https://github.com/vuejs/core/issues/12288)) ([4b479db](https://github.com/vuejs/core/commit/4b479db61d233b054561402ae94ef08550073ea1)), closes [#2593](https://github.com/vuejs/core/issues/2593)
23+
* **types:** defineEmits w/ interface declaration ([#12343](https://github.com/vuejs/core/issues/12343)) ([1022eab](https://github.com/vuejs/core/commit/1022eabaa1aaf8436876f5ec5573cb1e4b3959a6)), closes [#8457](https://github.com/vuejs/core/issues/8457)
24+
* **v-once:** setting hasOnce to current block only when in v-once ([#12374](https://github.com/vuejs/core/issues/12374)) ([37300fc](https://github.com/vuejs/core/commit/37300fc26190a7299efddbf98800ffd96d5cad96)), closes [#12371](https://github.com/vuejs/core/issues/12371)
25+
26+
27+
### Performance Improvements
28+
29+
* **reactivity:** do not track inner key `__v_skip`` ([#11690](https://github.com/vuejs/core/issues/11690)) ([d637bd6](https://github.com/vuejs/core/commit/d637bd6c0164c2883e6eabd3c2f1f8c258dedfb1))
30+
* **runtime-core:** use feature flag for call to resolveMergedOptions ([#12163](https://github.com/vuejs/core/issues/12163)) ([1755ac0](https://github.com/vuejs/core/commit/1755ac0a108ba3486bd8397e56d3bdcd69196594))
31+
32+
33+
134
## [3.5.12](https://github.com/vuejs/core/compare/v3.5.11...v3.5.12) (2024-10-11)
235

336

package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
3-
"version": "3.5.12",
4-
"packageManager": "pnpm@9.12.3",
3+
"version": "3.5.13",
4+
"packageManager": "pnpm@9.13.2",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -22,7 +22,10 @@
2222
"test-dts": "run-s build-dts test-dts-only",
2323
"test-dts-only": "tsc -p packages-private/dts-built-test/tsconfig.json && tsc -p ./packages-private/dts-test/tsconfig.test.json",
2424
"test-coverage": "vitest run --project unit --coverage",
25-
"test-bench": "vitest bench",
25+
"prebench": "node scripts/build.js -pf esm-browser reactivity",
26+
"prebench-compare": "node scripts/build.js -pf esm-browser reactivity",
27+
"bench": "vitest bench --project=unit --outputJson=temp/bench.json",
28+
"bench-compare": "vitest bench --project=unit --compare=temp/bench.json",
2629
"release": "node scripts/release.js",
2730
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
2831
"dev-esm": "node scripts/dev.js -if esm-bundler-runtime",
@@ -66,22 +69,22 @@
6669
"@rollup/plugin-json": "^6.1.0",
6770
"@rollup/plugin-node-resolve": "^15.3.0",
6871
"@rollup/plugin-replace": "5.0.4",
69-
"@swc/core": "^1.7.42",
72+
"@swc/core": "^1.9.2",
7073
"@types/hash-sum": "^1.0.2",
71-
"@types/node": "^22.8.7",
74+
"@types/node": "^22.9.0",
7275
"@types/semver": "^7.5.8",
7376
"@types/serve-handler": "^6.1.4",
74-
"@vitest/coverage-v8": "^2.1.1",
77+
"@vitest/coverage-v8": "^2.1.5",
7578
"@vue/consolidate": "1.0.0",
7679
"conventional-changelog-cli": "^5.0.0",
7780
"enquirer": "^2.4.1",
7881
"esbuild": "^0.24.0",
7982
"esbuild-plugin-polyfill-node": "^0.3.0",
80-
"eslint": "^9.14.0",
81-
"eslint-plugin-import-x": "^4.4.0",
82-
"@vitest/eslint-plugin": "^1.0.1",
83+
"eslint": "^9.15.0",
84+
"eslint-plugin-import-x": "^4.4.2",
85+
"@vitest/eslint-plugin": "^1.1.10",
8386
"estree-walker": "catalog:",
84-
"jsdom": "^25.0.0",
87+
"jsdom": "^25.0.1",
8588
"lint-staged": "^15.2.10",
8689
"lodash": "^4.17.21",
8790
"magic-string": "^0.30.12",
@@ -94,7 +97,7 @@
9497
"pug": "^3.0.3",
9598
"puppeteer": "~23.3.0",
9699
"rimraf": "^6.0.1",
97-
"rollup": "^4.24.3",
100+
"rollup": "^4.27.2",
98101
"rollup-plugin-dts": "^6.1.1",
99102
"rollup-plugin-esbuild": "^6.1.1",
100103
"rollup-plugin-polyfill-node": "^0.13.0",
@@ -105,9 +108,9 @@
105108
"todomvc-app-css": "^2.4.3",
106109
"tslib": "^2.8.1",
107110
"typescript": "~5.6.2",
108-
"typescript-eslint": "^8.12.2",
111+
"typescript-eslint": "^8.14.0",
109112
"vite": "catalog:",
110-
"vitest": "^2.1.1"
113+
"vitest": "^2.1.5"
111114
},
112115
"pnpm": {
113116
"peerDependencyRules": {

packages-private/dts-test/setupHelpers.test-d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,14 @@ describe('defineEmits w/ type declaration', () => {
306306
emit2('baz')
307307
})
308308

309+
describe('defineEmits w/ interface declaration', () => {
310+
interface Emits {
311+
foo: [value: string]
312+
}
313+
const emit = defineEmits<Emits>()
314+
emit('foo', 'hi')
315+
})
316+
309317
describe('defineEmits w/ alt type declaration', () => {
310318
const emit = defineEmits<{
311319
foo: [id: string]

packages-private/sfc-playground/src/Header.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function resetVueVersion() {
4646
4747
async function copyLink(e: MouseEvent) {
4848
if (e.metaKey) {
49+
resetVueVersion()
4950
// hidden logic for going to local debug from play.vuejs.org
5051
window.location.href = 'http://localhost:5173/' + window.location.hash
5152
return

packages-private/sfc-playground/src/download/template/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"vue": "^3.4.0"
1212
},
1313
"devDependencies": {
14-
"@vitejs/plugin-vue": "^5.1.4",
15-
"vite": "^5.4.10"
14+
"@vitejs/plugin-vue": "^5.2.0",
15+
"vite": "^5.4.11"
1616
}
1717
}

packages/compiler-core/__tests__/transforms/__snapshots__/vMemo.spec.ts.snap

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`compiler: v-memo transform > element v-for key expression prefixing + v-memo 1`] = `
4+
"import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, isMemoSame as _isMemoSame, withMemo as _withMemo } from "vue"
5+
6+
export function render(_ctx, _cache) {
7+
return (_openBlock(), _createElementBlock("div", null, [
8+
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.tableData, (data, __, ___, _cached) => {
9+
const _memo = (_ctx.getLetter(data))
10+
if (_cached && _cached.key === _ctx.getId(data) && _isMemoSame(_cached, _memo)) return _cached
11+
const _item = (_openBlock(), _createElementBlock("span", {
12+
key: _ctx.getId(data)
13+
}))
14+
_item.memo = _memo
15+
return _item
16+
}, _cache, 0), 128 /* KEYED_FRAGMENT */))
17+
]))
18+
}"
19+
`;
20+
321
exports[`compiler: v-memo transform > on component 1`] = `
422
"import { resolveComponent as _resolveComponent, createVNode as _createVNode, withMemo as _withMemo, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
523

packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ return function render(_ctx, _cache) {
88
const { setBlockTracking: _setBlockTracking, createElementVNode: _createElementVNode } = _Vue
99
1010
return _cache[0] || (
11-
_setBlockTracking(-1),
11+
_setBlockTracking(-1, true),
1212
(_cache[0] = _createElementVNode("div", { id: foo }, null, 8 /* PROPS */, ["id"])).cacheIndex = 0,
1313
_setBlockTracking(1),
1414
_cache[0]
@@ -28,7 +28,7 @@ return function render(_ctx, _cache) {
2828
2929
return (_openBlock(), _createElementBlock("div", null, [
3030
_cache[0] || (
31-
_setBlockTracking(-1),
31+
_setBlockTracking(-1, true),
3232
(_cache[0] = _createVNode(_component_Comp, { id: foo }, null, 8 /* PROPS */, ["id"])).cacheIndex = 0,
3333
_setBlockTracking(1),
3434
_cache[0]
@@ -47,7 +47,7 @@ return function render(_ctx, _cache) {
4747
4848
return (_openBlock(), _createElementBlock("div", null, [
4949
_cache[0] || (
50-
_setBlockTracking(-1),
50+
_setBlockTracking(-1, true),
5151
(_cache[0] = _createElementVNode("div", { id: foo }, null, 8 /* PROPS */, ["id"])).cacheIndex = 0,
5252
_setBlockTracking(1),
5353
_cache[0]
@@ -66,7 +66,7 @@ return function render(_ctx, _cache) {
6666
6767
return (_openBlock(), _createElementBlock("div", null, [
6868
_cache[0] || (
69-
_setBlockTracking(-1),
69+
_setBlockTracking(-1, true),
7070
(_cache[0] = _renderSlot($slots, "default")).cacheIndex = 0,
7171
_setBlockTracking(1),
7272
_cache[0]
@@ -85,7 +85,7 @@ return function render(_ctx, _cache) {
8585
8686
return (_openBlock(), _createElementBlock("div", null, [
8787
_cache[0] || (
88-
_setBlockTracking(-1),
88+
_setBlockTracking(-1, true),
8989
(_cache[0] = _createElementVNode("div")).cacheIndex = 0,
9090
_setBlockTracking(1),
9191
_cache[0]

packages/compiler-core/__tests__/transforms/vMemo.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,12 @@ describe('compiler: v-memo transform', () => {
5353
),
5454
).toMatchSnapshot()
5555
})
56+
57+
test('element v-for key expression prefixing + v-memo', () => {
58+
expect(
59+
compile(
60+
`<span v-for="data of tableData" :key="getId(data)" v-memo="getLetter(data)"></span>`,
61+
),
62+
).toMatchSnapshot()
63+
})
5664
})

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.5.12",
3+
"version": "3.5.13",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",

packages/compiler-core/src/ast.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ export interface CacheExpression extends Node {
418418
index: number
419419
value: JSChildNode
420420
needPauseTracking: boolean
421+
inVOnce: boolean
421422
needArraySpread: boolean
422423
}
423424

@@ -774,12 +775,14 @@ export function createCacheExpression(
774775
index: number,
775776
value: JSChildNode,
776777
needPauseTracking: boolean = false,
778+
inVOnce: boolean = false,
777779
): CacheExpression {
778780
return {
779781
type: NodeTypes.JS_CACHE_EXPRESSION,
780782
index,
781783
value,
782784
needPauseTracking: needPauseTracking,
785+
inVOnce,
783786
needArraySpread: false,
784787
loc: locStub,
785788
}

packages/compiler-core/src/codegen.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,9 @@ function genCacheExpression(node: CacheExpression, context: CodegenContext) {
10171017
push(`_cache[${node.index}] || (`)
10181018
if (needPauseTracking) {
10191019
indent()
1020-
push(`${helper(SET_BLOCK_TRACKING)}(-1),`)
1020+
push(`${helper(SET_BLOCK_TRACKING)}(-1`)
1021+
if (node.inVOnce) push(`, true`)
1022+
push(`),`)
10211023
newline()
10221024
push(`(`)
10231025
}

packages/compiler-core/src/transform.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export interface TransformContext
116116
addIdentifiers(exp: ExpressionNode | string): void
117117
removeIdentifiers(exp: ExpressionNode | string): void
118118
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode
119-
cache(exp: JSChildNode, isVNode?: boolean): CacheExpression
119+
cache(exp: JSChildNode, isVNode?: boolean, inVOnce?: boolean): CacheExpression
120120
constantCache: WeakMap<TemplateChildNode, ConstantTypes>
121121

122122
// 2.x Compat only
@@ -297,11 +297,12 @@ export function createTransformContext(
297297
identifier.hoisted = exp
298298
return identifier
299299
},
300-
cache(exp, isVNode = false) {
300+
cache(exp, isVNode = false, inVOnce = false) {
301301
const cacheExp = createCacheExpression(
302302
context.cached.length,
303303
exp,
304304
isVNode,
305+
inVOnce,
305306
)
306307
context.cached.push(cacheExp)
307308
return cacheExp

packages/compiler-core/src/transforms/transformExpression.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
isStaticPropertyKey,
2525
walkIdentifiers,
2626
} from '../babelUtils'
27-
import { advancePositionWithClone, isSimpleIdentifier } from '../utils'
27+
import { advancePositionWithClone, findDir, isSimpleIdentifier } from '../utils'
2828
import {
2929
genPropsAccessExp,
3030
hasOwn,
@@ -54,6 +54,7 @@ export const transformExpression: NodeTransform = (node, context) => {
5454
)
5555
} else if (node.type === NodeTypes.ELEMENT) {
5656
// handle directives on element
57+
const memo = findDir(node, 'memo')
5758
for (let i = 0; i < node.props.length; i++) {
5859
const dir = node.props[i]
5960
// do not process for v-on & v-for since they are special handled
@@ -65,7 +66,14 @@ export const transformExpression: NodeTransform = (node, context) => {
6566
if (
6667
exp &&
6768
exp.type === NodeTypes.SIMPLE_EXPRESSION &&
68-
!(dir.name === 'on' && arg)
69+
!(dir.name === 'on' && arg) &&
70+
// key has been processed in transformFor(vMemo + vFor)
71+
!(
72+
memo &&
73+
arg &&
74+
arg.type === NodeTypes.SIMPLE_EXPRESSION &&
75+
arg.content === 'key'
76+
)
6977
) {
7078
dir.exp = processExpression(
7179
exp,

0 commit comments

Comments
 (0)