Skip to content

Commit e9042e0

Browse files
authored
Merge branch 'main' into types/defineComponent-options
2 parents 9e2f228 + 32e53bf commit e9042e0

File tree

73 files changed

+1012
-311
lines changed

Some content is hidden

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

73 files changed

+1012
-311
lines changed

Diff for: CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
## [3.2.33](https://github.com/vuejs/core/compare/v3.2.32...v3.2.33) (2022-04-14)
2+
3+
4+
### Bug Fixes
5+
6+
* **compat:** copy additional properties for functions bound via globalProperties ([#4873](https://github.com/vuejs/core/issues/4873)) ([1612971](https://github.com/vuejs/core/commit/16129714714e19c5c6bfbd05c439ff68bcac00b9)), closes [#4403](https://github.com/vuejs/core/issues/4403)
7+
* **compiler-sfc:** handle type modifier in import specifiers ([#5498](https://github.com/vuejs/core/issues/5498)) ([8e29ef6](https://github.com/vuejs/core/commit/8e29ef6019d1b9d9c8f67b4ebba0223b8e0f914c))
8+
* **custom-elements:** work with async component + slots ([#4657](https://github.com/vuejs/core/issues/4657)) ([f4d2c9f](https://github.com/vuejs/core/commit/f4d2c9fc6afea827a081c1eeab78ce5c0cc620ca)), closes [#4639](https://github.com/vuejs/core/issues/4639)
9+
* **reactivity-transform:** should not rewrite catch param ([#5711](https://github.com/vuejs/core/issues/5711)) ([1f14f19](https://github.com/vuejs/core/commit/1f14f194396bf9296a1046d3f680d6d318cd0e40)), closes [#5709](https://github.com/vuejs/core/issues/5709)
10+
* **reactivity:** fix ref tracking of self-stopping effects ([154233a](https://github.com/vuejs/core/commit/154233abdb19b8330bbc1ff0d3e007f2558cd81c)), closes [#5707](https://github.com/vuejs/core/issues/5707)
11+
* **runtime-core:** ensure custom events are not emitted anymore after unmount. ([#5679](https://github.com/vuejs/core/issues/5679)) ([71c9536](https://github.com/vuejs/core/commit/71c953662528c4f0be68e7b412585c6809794528)), closes [#5674](https://github.com/vuejs/core/issues/5674)
12+
* **runtime-core:** fix use of non-existent-in-prod internal property in defineProperty trap ([f641c4b](https://github.com/vuejs/core/commit/f641c4b2289dfdbbbea87538e36fa35f2a115ddc)), closes [#5710](https://github.com/vuejs/core/issues/5710)
13+
* **runtime-dom:** catch more cases of DOM property setting error ([#5552](https://github.com/vuejs/core/issues/5552)) ([fa1d14c](https://github.com/vuejs/core/commit/fa1d14c2c82a70743ed837ee91c8966373aa8142)), closes [#5545](https://github.com/vuejs/core/issues/5545)
14+
* **runtime-dom:** patch translate as an attr ([#5485](https://github.com/vuejs/core/issues/5485)) ([2c09969](https://github.com/vuejs/core/commit/2c09969b1316b88f9a60406ce7c49cf1110bc400)), closes [#5462](https://github.com/vuejs/core/issues/5462)
15+
* **runtime-dom:** properly handle style properties with undefined values ([#5348](https://github.com/vuejs/core/issues/5348)) ([85af139](https://github.com/vuejs/core/commit/85af1398637ee91c6ebabb73bf42250320311e19)), closes [#5322](https://github.com/vuejs/core/issues/5322)
16+
* **ssr:** avoid rendering reserved internal keys in output ([#5564](https://github.com/vuejs/core/issues/5564)) ([cc238cd](https://github.com/vuejs/core/commit/cc238cdb8e9e90b700c22dfb0530d395e60c9836)), closes [#5563](https://github.com/vuejs/core/issues/5563)
17+
* **transition:** fix broken leave transition on dev root fragment ([#5268](https://github.com/vuejs/core/issues/5268)) ([767d212](https://github.com/vuejs/core/commit/767d212d20a9a488d183610d048ba131bbfd067e))
18+
* **transition:** handle transition for v-if branches with comment ([62eba63](https://github.com/vuejs/core/commit/62eba63172414ae0aa895d4b1927c7889c398f2f)), closes [#5675](https://github.com/vuejs/core/issues/5675)
19+
20+
21+
22+
## [3.2.32](https://github.com/vuejs/core/compare/v3.2.31...v3.2.32) (2022-04-12)
23+
24+
25+
### Bug Fixes
26+
27+
* **devtools:** perf: use high-resolution time ([1070f12](https://github.com/vuejs/core/commit/1070f127a78bfe7da6fe550cc272ef11a1f434a0))
28+
* **reactivity:** fix currentScope loss when running detached effect scope ([#5575](https://github.com/vuejs/core/issues/5575)) ([0a301d4](https://github.com/vuejs/core/commit/0a301d4dabd667526cbcd96e88b50741b519a812))
29+
* **runtime-core/template-ref:** named ref in v-for regression fix ([#5118](https://github.com/vuejs/core/issues/5118)) ([cee1eaf](https://github.com/vuejs/core/commit/cee1eafb4d2d5df901c9536ac59c321be72598b5)), closes [#5116](https://github.com/vuejs/core/issues/5116) [#5447](https://github.com/vuejs/core/issues/5447) [#5525](https://github.com/vuejs/core/issues/5525)
30+
* **runtime-core:** allow spying on proxy methods regression ([#5417](https://github.com/vuejs/core/issues/5417)) ([1574edd](https://github.com/vuejs/core/commit/1574edd490bd5cc0a213bc9f48ff41a1dc43ab22)), closes [#5415](https://github.com/vuejs/core/issues/5415) [#4216](https://github.com/vuejs/core/issues/4216)
31+
* **runtime-core:** Avoid mutating original options object in createApp ([#4840](https://github.com/vuejs/core/issues/4840)) ([d121a9b](https://github.com/vuejs/core/commit/d121a9bc7e7af59adb2d2803954cfeee95b35270)), closes [#4398](https://github.com/vuejs/core/issues/4398)
32+
* **runtime-core:** ensure custom directive instance properly exposes properties on closed instances. ([#5022](https://github.com/vuejs/core/issues/5022)) ([f44087e](https://github.com/vuejs/core/commit/f44087e171282cb77f1e23d86516a527e4c5804b)), closes [#5018](https://github.com/vuejs/core/issues/5018)
33+
* **runtime-core:** fix event listener as dynamicProp is added erroneously to props ([#5517](https://github.com/vuejs/core/issues/5517)) ([8eceabd](https://github.com/vuejs/core/commit/8eceabd14ebab2ba6523f920134b02fdf21e0a1c)), closes [#5520](https://github.com/vuejs/core/issues/5520)
34+
* **transition:** ensure flattened transition group children inherit parent keys ([4311ddd](https://github.com/vuejs/core/commit/4311dddfa72b405b20f469f8f219ec3027972f55)), closes [#4718](https://github.com/vuejs/core/issues/4718) [#5360](https://github.com/vuejs/core/issues/5360) [#5392](https://github.com/vuejs/core/issues/5392)
35+
36+
37+
138
## [3.2.31](https://github.com/vuejs/core/compare/v3.2.30...v3.2.31) (2022-02-12)
239

340

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Please follow the documentation at [vuejs.org](https://vuejs.org/)!
99
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/core/blob/main/BACKERS.md). If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).
1010

1111
<p align="center">
12-
<a target="_blank" href="https://vuejs.org/sponsor/">
12+
<a target="_blank" href="https://vuejs.org/sponsor/#current-sponsors">
1313
<img alt="sponsors" src="https://sponsors.vuejs.org/sponsors.svg">
1414
</a>
1515
</p>

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"scripts": {
55
"dev": "node scripts/dev.js",
66
"build": "node scripts/build.js",
@@ -67,7 +67,7 @@
6767
"conventional-changelog-cli": "^2.0.31",
6868
"csstype": "^3.0.3",
6969
"enquirer": "^2.3.2",
70-
"esbuild": "^0.14.11",
70+
"esbuild": "^0.14.35",
7171
"eslint": "^7.7.0",
7272
"execa": "^4.0.2",
7373
"fs-extra": "^9.0.1",
@@ -91,7 +91,7 @@
9191
"ts-jest": "^27.0.5",
9292
"tslib": "^2.3.1",
9393
"typescript": "^4.2.2",
94-
"vite": "^2.7.12",
94+
"vite": "^2.9.0",
9595
"vue": "workspace:*",
9696
"yorkie": "^2.0.0"
9797
}

Diff for: packages/compiler-core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
3232
},
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
3434
"dependencies": {
35-
"@vue/shared": "3.2.31",
35+
"@vue/shared": "3.2.33",
3636
"@babel/parser": "^7.16.4",
3737
"estree-walker": "^2.0.2",
3838
"source-map": "^0.6.1"

Diff for: packages/compiler-dom/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-dom",
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"description": "@vue/compiler-dom",
55
"main": "index.js",
66
"module": "dist/compiler-dom.esm-bundler.js",
@@ -37,7 +37,7 @@
3737
},
3838
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
3939
"dependencies": {
40-
"@vue/shared": "3.2.31",
41-
"@vue/compiler-core": "3.2.31"
40+
"@vue/shared": "3.2.33",
41+
"@vue/compiler-core": "3.2.33"
4242
}
4343
}

Diff for: packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

+16
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,22 @@ return { }
13511351
})"
13521352
`;
13531353

1354+
exports[`SFC compile <script setup> with TypeScript import type 1`] = `
1355+
"import { defineComponent as _defineComponent } from 'vue'
1356+
import type { Foo } from './main.ts'
1357+
import { type Bar, Baz } from './main.ts'
1358+
1359+
export default /*#__PURE__*/_defineComponent({
1360+
setup(__props, { expose }) {
1361+
expose();
1362+
1363+
1364+
return { Baz }
1365+
}
1366+
1367+
})"
1368+
`;
1369+
13541370
exports[`SFC compile <script setup> with TypeScript runtime Enum 1`] = `
13551371
"import { defineComponent as _defineComponent } from 'vue'
13561372
enum Foo { A = 123 }

Diff for: packages/compiler-sfc/__tests__/compileScript.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,17 @@ const emit = defineEmits(['a', 'b'])
11031103
Foo: BindingTypes.SETUP_CONST
11041104
})
11051105
})
1106+
1107+
test('import type', () => {
1108+
const { content } = compile(
1109+
`<script setup lang="ts">
1110+
import type { Foo } from './main.ts'
1111+
import { type Bar, Baz } from './main.ts'
1112+
</script>`
1113+
)
1114+
expect(content).toMatch(`return { Baz }`)
1115+
assertCode(content)
1116+
})
11061117
})
11071118

11081119
describe('async/await detection', () => {

Diff for: packages/compiler-sfc/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"module": "dist/compiler-sfc.esm-browser.js",
@@ -33,11 +33,11 @@
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
3434
"dependencies": {
3535
"@babel/parser": "^7.16.4",
36-
"@vue/compiler-core": "3.2.31",
37-
"@vue/compiler-dom": "3.2.31",
38-
"@vue/compiler-ssr": "3.2.31",
39-
"@vue/reactivity-transform": "3.2.31",
40-
"@vue/shared": "3.2.31",
36+
"@vue/compiler-core": "3.2.33",
37+
"@vue/compiler-dom": "3.2.33",
38+
"@vue/compiler-ssr": "3.2.33",
39+
"@vue/reactivity-transform": "3.2.33",
40+
"@vue/shared": "3.2.33",
4141
"estree-walker": "^2.0.2",
4242
"magic-string": "^0.25.7",
4343
"source-map": "^0.6.1",

Diff for: packages/compiler-sfc/src/compileScript.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,9 @@ export function compileScript(
802802
node.source.value,
803803
specifier.local.name,
804804
imported,
805-
node.importKind === 'type',
805+
node.importKind === 'type' ||
806+
(specifier.type === 'ImportSpecifier' &&
807+
specifier.importKind === 'type'),
806808
false
807809
)
808810
}
@@ -979,7 +981,9 @@ export function compileScript(
979981
source,
980982
local,
981983
imported,
982-
node.importKind === 'type',
984+
node.importKind === 'type' ||
985+
(specifier.type === 'ImportSpecifier' &&
986+
specifier.importKind === 'type'),
983987
true
984988
)
985989
}

Diff for: packages/compiler-ssr/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-ssr",
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"description": "@vue/compiler-ssr",
55
"main": "dist/compiler-ssr.cjs.js",
66
"types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,7 @@
2828
},
2929
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
3030
"dependencies": {
31-
"@vue/shared": "3.2.31",
32-
"@vue/compiler-dom": "3.2.31"
31+
"@vue/shared": "3.2.33",
32+
"@vue/compiler-dom": "3.2.33"
3333
}
3434
}

Diff for: packages/reactivity-transform/__tests__/__snapshots__/reactivityTransform.spec.ts.snap

+5
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ exports[`should not rewrite scope variable 1`] = `
216216
console.log(d.value)
217217
console.log(e)
218218
}
219+
let err = _ref(null)
220+
try {
221+
} catch (err) {
222+
console.log(err)
223+
}
219224
"
220225
`;
221226

Diff for: packages/reactivity-transform/__tests__/reactivityTransform.spec.ts

+6
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,18 @@ test('should not rewrite scope variable', () => {
222222
console.log(d)
223223
console.log(e)
224224
}
225+
let err = $ref(null)
226+
try {
227+
} catch (err) {
228+
console.log(err)
229+
}
225230
`)
226231
expect(code).toMatch('console.log(a)')
227232
expect(code).toMatch('console.log(b.value)')
228233
expect(code).toMatch('console.log(c)')
229234
expect(code).toMatch('console.log(d.value)')
230235
expect(code).toMatch('console.log(e)')
236+
expect(code).toMatch('console.log(err)')
231237
assertCode(code)
232238
})
233239

Diff for: packages/reactivity-transform/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/reactivity-transform",
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"description": "@vue/reactivity-transform",
55
"main": "dist/reactivity-transform.cjs.js",
66
"files": [
@@ -29,8 +29,8 @@
2929
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
3030
"dependencies": {
3131
"@babel/parser": "^7.16.4",
32-
"@vue/compiler-core": "3.2.31",
33-
"@vue/shared": "3.2.31",
32+
"@vue/compiler-core": "3.2.33",
33+
"@vue/shared": "3.2.33",
3434
"estree-walker": "^2.0.2",
3535
"magic-string": "^0.25.7"
3636
},

Diff for: packages/reactivity-transform/src/reactivityTransform.ts

+10
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,16 @@ export function transformAST(
566566
return
567567
}
568568

569+
// catch param
570+
if (node.type === 'CatchClause') {
571+
scopeStack.push((currentScope = {}))
572+
if (node.param && node.param.type === 'Identifier') {
573+
registerBinding(node.param)
574+
}
575+
walkScope(node.body)
576+
return
577+
}
578+
569579
// non-function block scopes
570580
if (node.type === 'BlockStatement' && !isFunctionType(parent!)) {
571581
scopeStack.push((currentScope = {}))

Diff for: packages/reactivity/__tests__/computed.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,23 @@ describe('reactivity/computed', () => {
170170
expect(dummy).toBe(-1)
171171
})
172172

173+
// #5720
174+
it('should invalidate before non-computed effects', () => {
175+
let plusOneValues: number[] = []
176+
const n = ref(0)
177+
const plusOne = computed(() => n.value + 1)
178+
effect(() => {
179+
n.value
180+
plusOneValues.push(plusOne.value)
181+
})
182+
// access plusOne, causing it to be non-dirty
183+
plusOne.value
184+
// mutate n
185+
n.value++
186+
// on the 2nd run, plusOne.value should have already updated.
187+
expect(plusOneValues).toMatchObject([1, 2, 2])
188+
})
189+
173190
it('should warn if trying to set a readonly computed', () => {
174191
const n = ref(1)
175192
const plusOne = computed(() => n.value + 1)

Diff for: packages/reactivity/__tests__/effect.spec.ts

+21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ref,
23
reactive,
34
effect,
45
stop,
@@ -801,6 +802,26 @@ describe('reactivity/effect', () => {
801802
expect(dummy).toBe(3)
802803
})
803804

805+
// #5707
806+
// when an effect completes its run, it should clear the tracking bits of
807+
// its tracked deps. However, if the effect stops itself, the deps list is
808+
// emptied so their bits are never cleared.
809+
it('edge case: self-stopping effect tracking ref', () => {
810+
const c = ref(true)
811+
const runner = effect(() => {
812+
// reference ref
813+
if (!c.value) {
814+
// stop itself while running
815+
stop(runner)
816+
}
817+
})
818+
// trigger run
819+
c.value = !c.value
820+
// should clear bits
821+
expect((c as any).dep.w).toBe(0)
822+
expect((c as any).dep.n).toBe(0)
823+
})
824+
804825
it('events: onStop', () => {
805826
const onStop = jest.fn()
806827
const runner = effect(() => {}, {

Diff for: packages/reactivity/__tests__/effectScope.spec.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
onScopeDispose,
77
computed,
88
ref,
9-
ComputedRef
9+
ComputedRef,
10+
getCurrentScope
1011
} from '../src'
1112

1213
describe('reactivity/effect/scope', () => {
@@ -263,4 +264,17 @@ describe('reactivity/effect/scope', () => {
263264
expect(watchSpy).toHaveBeenCalledTimes(1)
264265
expect(watchEffectSpy).toHaveBeenCalledTimes(2)
265266
})
267+
268+
it('getCurrentScope() stays valid when running a detached nested EffectScope', () => {
269+
const parentScope = new EffectScope()
270+
271+
parentScope.run(() => {
272+
const currentScope = getCurrentScope()
273+
expect(currentScope).toBeDefined()
274+
const detachedScope = new EffectScope(true)
275+
detachedScope.run(() => {})
276+
277+
expect(getCurrentScope()).toBe(currentScope)
278+
})
279+
})
266280
})

Diff for: packages/reactivity/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/reactivity",
3-
"version": "3.2.31",
3+
"version": "3.2.33",
44
"description": "@vue/reactivity",
55
"main": "index.js",
66
"module": "dist/reactivity.esm-bundler.js",
@@ -36,6 +36,6 @@
3636
},
3737
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
3838
"dependencies": {
39-
"@vue/shared": "3.2.31"
39+
"@vue/shared": "3.2.33"
4040
}
4141
}

0 commit comments

Comments
 (0)