Skip to content

Commit 838f1ba

Browse files
authored
Merge branch 'main' into optimize-reactive-judgment
2 parents a210af1 + 89de26c commit 838f1ba

File tree

29 files changed

+621
-544
lines changed

29 files changed

+621
-544
lines changed

.github/renovate.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@
5050
// pinned
5151
// https://github.com/vuejs/core/issues/10300#issuecomment-1940855364
5252
'lru-cache',
53+
54+
// pinned
55+
// https://github.com/vuejs/core/commit/a012e39b373f1b6918e5c89856e8f902e1bfa14d
56+
'@rollup/plugin-replace',
5357
],
5458
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [3.4.20](https://github.com/vuejs/core/compare/v3.4.19...v3.4.20) (2024-02-26)
2+
3+
4+
### Bug Fixes
5+
6+
* **parser:** should not treat uppercase components as special tags ([e0e0253](https://github.com/vuejs/core/commit/e0e02535cdea1aeb1cfaff0d61d4b2555e555c36)), closes [#10395](https://github.com/vuejs/core/issues/10395)
7+
* **runtime-dom:** avoid always resetting nullish option value ([ff130c4](https://github.com/vuejs/core/commit/ff130c470204086edaa093fb8fdc1247c69cba69)), closes [#10396](https://github.com/vuejs/core/issues/10396)
8+
* **runtime-dom:** fix nested v-show priority regression ([364f890](https://github.com/vuejs/core/commit/364f8902c8657faec7c3a4d70a5b2c856567e92d)), closes [#10338](https://github.com/vuejs/core/issues/10338)
9+
* **runtime-dom:** v-bind style should clear previous css string value ([#10373](https://github.com/vuejs/core/issues/10373)) ([e2d3235](https://github.com/vuejs/core/commit/e2d323538e71d404e729148fd19a08bbc2e3da9b)), closes [#10352](https://github.com/vuejs/core/issues/10352)
10+
* **suspense:** handle suspense switching with nested suspense ([#10184](https://github.com/vuejs/core/issues/10184)) ([0f3da05](https://github.com/vuejs/core/commit/0f3da05ea201761529bb95594df1e2cee20b7107)), closes [#10098](https://github.com/vuejs/core/issues/10098)
11+
* **types:** better typing for direct setup signature of defineComponent ([#10357](https://github.com/vuejs/core/issues/10357)) ([eadce5b](https://github.com/vuejs/core/commit/eadce5b75356656fd2209ebdb406d34823c961b7)), closes [#8604](https://github.com/vuejs/core/issues/8604) [#8855](https://github.com/vuejs/core/issues/8855)
12+
13+
14+
115
## [3.4.19](https://github.com/vuejs/core/compare/v3.4.18...v3.4.19) (2024-02-13)
216

317

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
3-
"version": "3.4.19",
4-
"packageManager": "[email protected].1",
3+
"version": "3.4.20",
4+
"packageManager": "[email protected].4",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -70,49 +70,49 @@
7070
"@rollup/plugin-terser": "^0.4.4",
7171
"@types/hash-sum": "^1.0.2",
7272
"@types/minimist": "^1.2.5",
73-
"@types/node": "^20.11.16",
74-
"@types/semver": "^7.5.6",
75-
"@typescript-eslint/eslint-plugin": "^6.18.1",
76-
"@typescript-eslint/parser": "^6.18.1",
77-
"@vitest/coverage-istanbul": "^1.2.2",
73+
"@types/node": "^20.11.20",
74+
"@types/semver": "^7.5.8",
75+
"@typescript-eslint/eslint-plugin": "^7.0.2",
76+
"@typescript-eslint/parser": "^7.0.2",
77+
"@vitest/coverage-istanbul": "^1.3.1",
7878
"@vue/consolidate": "1.0.0",
7979
"conventional-changelog-cli": "^4.1.0",
8080
"enquirer": "^2.4.1",
81-
"esbuild": "^0.20.0",
81+
"esbuild": "^0.20.1",
8282
"esbuild-plugin-polyfill-node": "^0.3.0",
83-
"eslint": "^8.56.0",
84-
"eslint-define-config": "^1.24.1",
83+
"eslint": "^8.57.0",
84+
"eslint-define-config": "^2.1.0",
8585
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
86-
"eslint-plugin-jest": "^27.6.3",
86+
"eslint-plugin-jest": "^27.9.0",
8787
"estree-walker": "^2.0.2",
8888
"execa": "^8.0.1",
89-
"jsdom": "^23.2.0",
90-
"lint-staged": "^15.2.0",
89+
"jsdom": "^24.0.0",
90+
"lint-staged": "^15.2.2",
9191
"lodash": "^4.17.21",
92-
"magic-string": "^0.30.6",
92+
"magic-string": "^0.30.7",
9393
"markdown-table": "^3.0.3",
94-
"marked": "^11.2.0",
94+
"marked": "^12.0.0",
9595
"minimist": "^1.2.8",
9696
"npm-run-all2": "^6.1.2",
9797
"picocolors": "^1.0.0",
98-
"prettier": "^3.2.2",
98+
"prettier": "^3.2.5",
9999
"pretty-bytes": "^6.1.1",
100100
"pug": "^3.0.2",
101-
"puppeteer": "~21.11.0",
101+
"puppeteer": "~22.2.0",
102102
"rimraf": "^5.0.5",
103-
"rollup": "4.9.2",
103+
"rollup": "^4.12.0",
104104
"rollup-plugin-dts": "^6.1.0",
105105
"rollup-plugin-esbuild": "^6.1.1",
106106
"rollup-plugin-polyfill-node": "^0.13.0",
107-
"semver": "^7.5.4",
107+
"semver": "^7.6.0",
108108
"serve": "^14.2.1",
109109
"simple-git-hooks": "^2.9.0",
110-
"terser": "^5.27.0",
110+
"terser": "^5.28.1",
111111
"todomvc-app-css": "^2.4.3",
112112
"tslib": "^2.6.2",
113-
"tsx": "^4.7.0",
113+
"tsx": "^4.7.1",
114114
"typescript": "^5.2.2",
115-
"vite": "^5.0.12",
116-
"vitest": "^1.2.2"
115+
"vite": "^5.1.4",
116+
"vitest": "^1.3.1"
117117
}
118118
}

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

packages/compiler-core/src/tokenizer.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,11 @@ export default class Tokenizer {
553553
// HTML mode
554554
// - <script>, <style> RAWTEXT
555555
// - <title>, <textarea> RCDATA
556-
const lower = c | 0x20
557-
if (lower === 116 /* t */) {
556+
if (c === 116 /* t */) {
558557
this.state = State.BeforeSpecialT
559558
} else {
560559
this.state =
561-
lower === 115 /* s */ ? State.BeforeSpecialS : State.InTagName
560+
c === 115 /* s */ ? State.BeforeSpecialS : State.InTagName
562561
}
563562
} else {
564563
this.state = State.InTagName
@@ -862,21 +861,19 @@ export default class Tokenizer {
862861
}
863862
}
864863
private stateBeforeSpecialS(c: number): void {
865-
const lower = c | 0x20
866-
if (lower === Sequences.ScriptEnd[3]) {
864+
if (c === Sequences.ScriptEnd[3]) {
867865
this.startSpecial(Sequences.ScriptEnd, 4)
868-
} else if (lower === Sequences.StyleEnd[3]) {
866+
} else if (c === Sequences.StyleEnd[3]) {
869867
this.startSpecial(Sequences.StyleEnd, 4)
870868
} else {
871869
this.state = State.InTagName
872870
this.stateInTagName(c) // Consume the token again
873871
}
874872
}
875873
private stateBeforeSpecialT(c: number): void {
876-
const lower = c | 0x20
877-
if (lower === Sequences.TitleEnd[3]) {
874+
if (c === Sequences.TitleEnd[3]) {
878875
this.startSpecial(Sequences.TitleEnd, 4)
879-
} else if (lower === Sequences.TextareaEnd[3]) {
876+
} else if (c === Sequences.TextareaEnd[3]) {
880877
this.startSpecial(Sequences.TextareaEnd, 4)
881878
} else {
882879
this.state = State.InTagName

packages/compiler-dom/__tests__/parse.spec.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('DOM parser', () => {
2020
)
2121
const element = ast.children[0] as ElementNode
2222
const text = element.children[0] as TextNode
23-
23+
expect(element.children.length).toBe(1)
2424
expect(text).toStrictEqual({
2525
type: NodeTypes.TEXT,
2626
content: 'some<div>text</div>and<!--comment-->',
@@ -32,6 +32,20 @@ describe('DOM parser', () => {
3232
})
3333
})
3434

35+
test('should not treat Uppercase component as special tag', () => {
36+
const ast = parse(
37+
'<TextArea>some<div>text</div>and<!--comment--></TextArea>',
38+
parserOptions,
39+
)
40+
const element = ast.children[0] as ElementNode
41+
expect(element.children.map(n => n.type)).toMatchObject([
42+
NodeTypes.TEXT,
43+
NodeTypes.ELEMENT,
44+
NodeTypes.TEXT,
45+
NodeTypes.COMMENT,
46+
])
47+
})
48+
3549
test('textarea handles entities', () => {
3650
const ast = parse('<textarea>&amp;</textarea>', parserOptions)
3751
const element = ast.children[0] as ElementNode

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

packages/compiler-sfc/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.4.19",
3+
"version": "3.4.20",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"module": "dist/compiler-sfc.esm-browser.js",
@@ -48,8 +48,8 @@
4848
"@vue/compiler-ssr": "workspace:*",
4949
"@vue/shared": "workspace:*",
5050
"estree-walker": "^2.0.2",
51-
"magic-string": "^0.30.6",
52-
"postcss": "^8.4.33",
51+
"magic-string": "^0.30.7",
52+
"postcss": "^8.4.35",
5353
"source-map-js": "^1.0.2"
5454
},
5555
"devDependencies": {
@@ -62,6 +62,6 @@
6262
"postcss-modules": "^6.0.0",
6363
"postcss-selector-parser": "^6.0.15",
6464
"pug": "^3.0.2",
65-
"sass": "^1.70.0"
65+
"sass": "^1.71.1"
6666
}
6767
}

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.19",
3+
"version": "3.4.20",
44
"description": "@vue/compiler-ssr",
55
"main": "dist/compiler-ssr.cjs.js",
66
"types": "dist/compiler-ssr.d.ts",

packages/reactivity/__tests__/gc.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe.skipIf(!global.gc)('reactivity/gc', () => {
2121
// #9233
2222
it('should release computed cache', async () => {
2323
const src = ref<{} | undefined>({})
24+
// @ts-expect-error ES2021 API
2425
const srcRef = new WeakRef(src.value!)
2526

2627
let c: ComputedRef | undefined = computed(() => src.value)

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

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,8 @@ describe('api: options', () => {
790790
data() {},
791791
}
792792
defineComponent({
793-
// @ts-expect-error edge case after #7963, unlikely to happen in practice
794793
// since the user will want to type the mixins themselves.
795794
mixins: [defineComponent(MixinA), defineComponent(MixinB)],
796-
// @ts-expect-error
797795
data() {},
798796
})
799797
})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
} from '@vue/runtime-dom'
2727
import { type SSRContext, renderToString } from '@vue/server-renderer'
2828
import { PatchFlags } from '@vue/shared'
29-
import { vShowOldKey } from '../../runtime-dom/src/directives/vShow'
29+
import { vShowOriginalDisplay } from '../../runtime-dom/src/directives/vShow'
3030

3131
function mountWithHydration(html: string, render: () => any) {
3232
const container = document.createElement('div')
@@ -1252,7 +1252,7 @@ describe('SSR hydration', () => {
12521252
foo
12531253
</div>
12541254
`)
1255-
expect((container.firstChild as any)[vShowOldKey]).toBe('')
1255+
expect((container.firstChild as any)[vShowOriginalDisplay]).toBe('')
12561256
expect(vnode.el).toBe(container.firstChild)
12571257
expect(`mismatch`).not.toHaveBeenWarned()
12581258
})

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

packages/runtime-core/src/apiDefineComponent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export type DefineComponent<
8989
> &
9090
PP
9191

92-
type DirectSetupComponent<
92+
export type DefineSetupFnComponent<
9393
P extends Record<string, any>,
9494
E extends EmitsOptions = {},
9595
S extends SlotsType = SlotsType,
@@ -135,7 +135,7 @@ export function defineComponent<
135135
emits?: E | EE[]
136136
slots?: S
137137
},
138-
): DirectSetupComponent<Props, E, S>
138+
): DefineSetupFnComponent<Props, E, S>
139139
export function defineComponent<
140140
Props extends Record<string, any>,
141141
E extends EmitsOptions = {},
@@ -151,7 +151,7 @@ export function defineComponent<
151151
emits?: E | EE[]
152152
slots?: S
153153
},
154-
): DirectSetupComponent<Props, E, S>
154+
): DefineSetupFnComponent<Props, E, S>
155155

156156
// overload 2: object format with no props
157157
// (uses user defined props interface)

packages/runtime-core/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ export type {
250250
AllowedComponentProps,
251251
ComponentInstance,
252252
} from './component'
253-
export type { DefineComponent, PublicProps } from './apiDefineComponent'
253+
export type {
254+
DefineComponent,
255+
DefineSetupFnComponent,
256+
PublicProps,
257+
} from './apiDefineComponent'
254258
export type {
255259
ComponentOptions,
256260
ComponentOptionsMixin,

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.19",
3+
"version": "3.4.20",
44
"description": "@vue/runtime-dom",
55
"main": "index.js",
66
"module": "dist/runtime-dom.esm-bundler.js",

packages/runtime-dom/src/directives/vShow.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import type { ObjectDirective } from '@vue/runtime-core'
22

3-
export const vShowOldKey = Symbol('_vod')
3+
export const vShowOriginalDisplay = Symbol('_vod')
4+
export const vShowHidden = Symbol('_vsh')
45

5-
interface VShowElement extends HTMLElement {
6+
export interface VShowElement extends HTMLElement {
67
// _vod = vue original display
7-
[vShowOldKey]: string
8+
[vShowOriginalDisplay]: string
9+
[vShowHidden]: boolean
810
}
911

1012
export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
1113
beforeMount(el, { value }, { transition }) {
12-
el[vShowOldKey] = el.style.display === 'none' ? '' : el.style.display
14+
el[vShowOriginalDisplay] =
15+
el.style.display === 'none' ? '' : el.style.display
1316
if (transition && value) {
1417
transition.beforeEnter(el)
1518
} else {
@@ -22,11 +25,7 @@ export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
2225
}
2326
},
2427
updated(el, { value, oldValue }, { transition }) {
25-
if (
26-
!value === !oldValue &&
27-
(el.style.display === el[vShowOldKey] || !value)
28-
)
29-
return
28+
if (!value === !oldValue) return
3029
if (transition) {
3130
if (value) {
3231
transition.beforeEnter(el)
@@ -51,7 +50,8 @@ if (__DEV__) {
5150
}
5251

5352
function setDisplay(el: VShowElement, value: unknown): void {
54-
el.style.display = value ? el[vShowOldKey] : 'none'
53+
el.style.display = value ? el[vShowOriginalDisplay] : 'none'
54+
el[vShowHidden] = !value
5555
}
5656

5757
// SSR vnode transforms, only used when user includes client-oriented render

0 commit comments

Comments
 (0)