Skip to content

Commit 649a1ee

Browse files
authored
Merge branch 'master' into types/maintain_type_from_markraw
2 parents cb8a25b + f1f5230 commit 649a1ee

File tree

30 files changed

+569
-397
lines changed

30 files changed

+569
-397
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# [3.1.0-beta.4](https://github.com/vuejs/vue-next/compare/v3.1.0-beta.3...v3.1.0-beta.4) (2021-05-24)
2+
3+
4+
### Bug Fixes
5+
6+
* **compat:** avoid accidentally delete the modelValue prop ([#3772](https://github.com/vuejs/vue-next/issues/3772)) ([4f17be7](https://github.com/vuejs/vue-next/commit/4f17be7b1ce4872ded085a36b95c1897d8c1f299))
7+
* **compat:** enum coercion warning ([#3755](https://github.com/vuejs/vue-next/issues/3755)) ([f01aadf](https://github.com/vuejs/vue-next/commit/f01aadf2a16a7bef422eb039d7b157bef9ad32fc))
8+
* **compiler-core:** fix whitespace management for slots with whitespace: 'preserve' ([#3767](https://github.com/vuejs/vue-next/issues/3767)) ([47da921](https://github.com/vuejs/vue-next/commit/47da92146c9fb3fa6b1e250e064ca49b74d815e4)), closes [#3766](https://github.com/vuejs/vue-next/issues/3766)
9+
* **compiler-dom:** comments in the v-if branchs should be ignored when used in Transition ([#3622](https://github.com/vuejs/vue-next/issues/3622)) ([7c74feb](https://github.com/vuejs/vue-next/commit/7c74feb3dc6beae7ff3ad22193be3b5a0f4d8aac)), closes [#3619](https://github.com/vuejs/vue-next/issues/3619)
10+
* **compiler-sfc:** support tsx in setup script ([#3825](https://github.com/vuejs/vue-next/issues/3825)) ([01e8ba8](https://github.com/vuejs/vue-next/commit/01e8ba8f873afe3857a23fb68b44fdc057e31781)), closes [#3808](https://github.com/vuejs/vue-next/issues/3808)
11+
* **compiler-ssr:** disable hoisting in compiler-ssr ([3ef1fcc](https://github.com/vuejs/vue-next/commit/3ef1fcc8590da186664197a0a82e7856011c1693)), closes [#3536](https://github.com/vuejs/vue-next/issues/3536)
12+
* **devtools:** send update to component owning the slot ([1355ee2](https://github.com/vuejs/vue-next/commit/1355ee27a65d466bfe8f3a7ba99aa2213e25bc50))
13+
* **runtime-core:** avoid double-setting props when casting ([0255be2](https://github.com/vuejs/vue-next/commit/0255be2f4b3581bfdf4af9368dcd6c1a27a5ee03)), closes [#3371](https://github.com/vuejs/vue-next/issues/3371) [#3384](https://github.com/vuejs/vue-next/issues/3384)
14+
* **runtime-core:** avoid the proxy object polluting the slots of the internal instance ([#3698](https://github.com/vuejs/vue-next/issues/3698)) ([4ce0df6](https://github.com/vuejs/vue-next/commit/4ce0df6ef1a31ee45402e61e01777e3836b2c223)), closes [#3695](https://github.com/vuejs/vue-next/issues/3695)
15+
* **types:** declared prop keys should always exist in `props` argument ([#3726](https://github.com/vuejs/vue-next/issues/3726)) ([9b160b9](https://github.com/vuejs/vue-next/commit/9b160b940555abb6b6ce722fddbd9649ee196f7b))
16+
* **types/reactivity:** error TS4058 caused by `RefSymbol` ([#2548](https://github.com/vuejs/vue-next/issues/2548)) ([90aa835](https://github.com/vuejs/vue-next/commit/90aa8358129f25826bfc4c234325c1442aef8d55))
17+
18+
19+
### Features
20+
21+
* **devtools:** performance events ([f7c54ca](https://github.com/vuejs/vue-next/commit/f7c54caeb1dac69a26b79c98409e9633a7fe4bd3))
22+
23+
24+
125
# [3.1.0-beta.3](https://github.com/vuejs/vue-next/compare/v3.1.0-beta.2...v3.1.0-beta.3) (2021-05-12)
226

327

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
44
"workspaces": [
55
"packages/*"
66
],

packages/compiler-core/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-core",
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
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/vue-next/tree/master/packages/compiler-core#readme",
3434
"dependencies": {
35-
"@vue/shared": "3.1.0-beta.3",
35+
"@vue/shared": "3.1.0-beta.4",
3636
"@babel/parser": "^7.12.0",
3737
"@babel/types": "^7.12.0",
3838
"estree-walker": "^2.0.1",

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
OPEN_BLOCK,
3535
CREATE_VNODE
3636
} from '../runtimeHelpers'
37-
import { injectProp, findDir, findProp } from '../utils'
37+
import { injectProp, findDir, findProp, isBuiltInType } from '../utils'
3838
import { PatchFlags, PatchFlagNames } from '@vue/shared'
3939

4040
export const transformIf = createStructuralDirectiveTransform(
@@ -146,7 +146,16 @@ export function processIf(
146146
// move the node to the if node's branches
147147
context.removeNode()
148148
const branch = createIfBranch(node, dir)
149-
if (__DEV__ && comments.length) {
149+
if (
150+
__DEV__ &&
151+
comments.length &&
152+
// #3619 ignore comments if the v-if is direct child of <transition>
153+
!(
154+
context.parent &&
155+
context.parent.type === NodeTypes.ELEMENT &&
156+
isBuiltInType(context.parent.tag, 'transition')
157+
)
158+
) {
150159
branch.children = [...comments, ...branch.children]
151160
}
152161

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`the v-if/else-if/else branchs in Transition should ignore comments 1`] = `
4+
"const _Vue = Vue
5+
6+
return function render(_ctx, _cache) {
7+
with (_ctx) {
8+
const { openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, createVNode: _createVNode, Fragment: _Fragment, Transition: _Transition, withCtx: _withCtx } = _Vue
9+
10+
return (_openBlock(), _createBlock(_Transition, null, {
11+
default: _withCtx(() => [
12+
a
13+
? (_openBlock(), _createBlock(\\"div\\", { key: 0 }, \\"hey\\"))
14+
: b
15+
? (_openBlock(), _createBlock(\\"div\\", { key: 1 }, \\"hey\\"))
16+
: (_openBlock(), _createBlock(\\"div\\", { key: 2 }, [
17+
c
18+
? (_openBlock(), _createBlock(\\"p\\", { key: 0 }))
19+
: (_openBlock(), _createBlock(_Fragment, { key: 1 }, [
20+
_createCommentVNode(\\" this should not be ignored \\"),
21+
_createVNode(\\"p\\")
22+
], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))
23+
]))
24+
]),
25+
_: 1 /* STABLE */
26+
}))
27+
}
28+
}"
29+
`;

packages/compiler-dom/__tests__/transforms/warnTransitionChildren.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,21 @@ describe('compiler warnings', () => {
138138
})
139139
})
140140
})
141+
142+
test('the v-if/else-if/else branchs in Transition should ignore comments', () => {
143+
expect(
144+
compile(`
145+
<transition>
146+
<div v-if="a">hey</div>
147+
<!-- this should be ignored -->
148+
<div v-else-if="b">hey</div>
149+
<!-- this should be ignored -->
150+
<div v-else>
151+
<p v-if="c"/>
152+
<!-- this should not be ignored -->
153+
<p v-else/>
154+
</div>
155+
</transition>
156+
`).code
157+
).toMatchSnapshot()
158+
})

packages/compiler-dom/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-dom",
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
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/vue-next/tree/master/packages/compiler-dom#readme",
3939
"dependencies": {
40-
"@vue/shared": "3.1.0-beta.3",
41-
"@vue/compiler-core": "3.1.0-beta.3"
40+
"@vue/shared": "3.1.0-beta.4",
41+
"@vue/compiler-core": "3.1.0-beta.4"
4242
}
4343
}

packages/compiler-sfc/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"types": "dist/compiler-sfc.d.ts",
@@ -31,15 +31,15 @@
3131
},
3232
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
3333
"peerDependencies": {
34-
"vue": "3.1.0-beta.3"
34+
"vue": "3.1.0-beta.4"
3535
},
3636
"dependencies": {
3737
"@babel/parser": "^7.13.9",
3838
"@babel/types": "^7.13.0",
39-
"@vue/compiler-core": "3.1.0-beta.3",
40-
"@vue/compiler-dom": "3.1.0-beta.3",
41-
"@vue/compiler-ssr": "3.1.0-beta.3",
42-
"@vue/shared": "3.1.0-beta.3",
39+
"@vue/compiler-core": "3.1.0-beta.4",
40+
"@vue/compiler-dom": "3.1.0-beta.4",
41+
"@vue/compiler-ssr": "3.1.0-beta.4",
42+
"@vue/shared": "3.1.0-beta.4",
4343
"consolidate": "^0.16.0",
4444
"estree-walker": "^2.0.1",
4545
"hash-sum": "^2.0.0",

packages/compiler-sfc/src/compileScript.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ export function compileScript(
101101
sfc.template && sfc.template.attrs['inherit-attrs'] === 'false'
102102
const scriptLang = script && script.lang
103103
const scriptSetupLang = scriptSetup && scriptSetup.lang
104-
const isTS = scriptLang === 'ts' || scriptSetupLang === 'ts'
104+
const isTS =
105+
scriptLang === 'ts' ||
106+
scriptLang === 'tsx' ||
107+
scriptSetupLang === 'ts' ||
108+
scriptSetupLang === 'tsx'
105109
const plugins: ParserPlugin[] = [...babelParserDefaultPlugins, 'jsx']
106110
if (options.babelParserPlugins) plugins.push(...options.babelParserPlugins)
107111
if (isTS) plugins.push('typescript', 'decorators-legacy')
@@ -110,7 +114,7 @@ export function compileScript(
110114
if (!script) {
111115
throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`)
112116
}
113-
if (scriptLang && scriptLang !== 'ts') {
117+
if (scriptLang && !isTS && scriptLang !== 'jsx') {
114118
// do not process non js/ts script blocks
115119
return script
116120
}
@@ -156,7 +160,7 @@ export function compileScript(
156160
)
157161
}
158162

159-
if (scriptSetupLang && scriptSetupLang !== 'ts') {
163+
if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
160164
// do not process non js/ts script blocks
161165
return scriptSetup
162166
}

packages/compiler-ssr/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-ssr",
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
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/vue-next/tree/master/packages/compiler-ssr#readme",
3030
"dependencies": {
31-
"@vue/shared": "3.1.0-beta.3",
32-
"@vue/compiler-dom": "3.1.0-beta.3"
31+
"@vue/shared": "3.1.0-beta.4",
32+
"@vue/compiler-dom": "3.1.0-beta.4"
3333
}
3434
}

packages/compiler-ssr/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function compile(
5151

5252
transform(ast, {
5353
...options,
54+
hoistStatic: false,
5455
nodeTransforms: [
5556
ssrTransformIf,
5657
ssrTransformFor,

packages/reactivity/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/reactivity",
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
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/vue-next/tree/master/packages/reactivity#readme",
3838
"dependencies": {
39-
"@vue/shared": "3.1.0-beta.3"
39+
"@vue/shared": "3.1.0-beta.4"
4040
}
4141
}

packages/reactivity/src/ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isArray, isObject, hasChanged } from '@vue/shared'
44
import { reactive, isProxy, toRaw, isReactive } from './reactive'
55
import { CollectionTypes } from './collectionHandlers'
66

7-
declare const RefSymbol: unique symbol
7+
export declare const RefSymbol: unique symbol
88
export declare const RAW_SYMBOL: unique symbol
99

1010
export interface Ref<T = any> {

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

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
provide,
1313
inject,
1414
watch,
15-
toRefs
15+
toRefs,
16+
SetupContext
1617
} from '@vue/runtime-test'
1718
import { render as domRender, nextTick } from 'vue'
1819

@@ -508,4 +509,51 @@ describe('component props', () => {
508509
await nextTick()
509510
expect(changeSpy).toHaveBeenCalledTimes(1)
510511
})
512+
513+
// #3371
514+
test(`avoid double-setting props when casting`, async () => {
515+
const Parent = {
516+
setup(props: any, { slots }: SetupContext) {
517+
const childProps = ref()
518+
const registerChildProps = (props: any) => {
519+
childProps.value = props
520+
}
521+
provide('register', registerChildProps)
522+
523+
return () => {
524+
// access the child component's props
525+
childProps.value && childProps.value.foo
526+
return slots.default!()
527+
}
528+
}
529+
}
530+
531+
const Child = {
532+
props: {
533+
foo: {
534+
type: Boolean,
535+
required: false
536+
}
537+
},
538+
setup(props: { foo: boolean }) {
539+
const register = inject('register') as any
540+
// 1. change the reactivity data of the parent component
541+
// 2. register its own props to the parent component
542+
register(props)
543+
544+
return () => 'foo'
545+
}
546+
}
547+
548+
const App = {
549+
setup() {
550+
return () => h(Parent, () => h(Child as any, { foo: '' }, () => null))
551+
}
552+
}
553+
554+
const root = nodeOps.createElement('div')
555+
render(h(App), root)
556+
await nextTick()
557+
expect(serializeInner(root)).toBe(`foo`)
558+
})
511559
})

packages/runtime-core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/runtime-core",
3-
"version": "3.1.0-beta.3",
3+
"version": "3.1.0-beta.4",
44
"description": "@vue/runtime-core",
55
"main": "index.js",
66
"module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
3232
},
3333
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
3434
"dependencies": {
35-
"@vue/shared": "3.1.0-beta.3",
36-
"@vue/reactivity": "3.1.0-beta.3"
35+
"@vue/shared": "3.1.0-beta.4",
36+
"@vue/reactivity": "3.1.0-beta.4"
3737
}
3838
}

0 commit comments

Comments
 (0)