Skip to content

Commit 88f2f05

Browse files
authored
Merge branch 'main' into bwsy/feat/CEChildStyle
2 parents 1630c38 + a374d7e commit 88f2f05

File tree

32 files changed

+292
-97
lines changed

32 files changed

+292
-97
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [3.3.2](https://github.com/vuejs/core/compare/v3.3.1...v3.3.2) (2023-05-12)
2+
3+
4+
### Bug Fixes
5+
6+
* **compiler-core:** treat floating point numbers as constants ([8dc8cf8](https://github.com/vuejs/core/commit/8dc8cf852bf8057aa5c4b5670f09e8c28a168b73)), closes [#8295](https://github.com/vuejs/core/issues/8295)
7+
* **compiler-dom:** do not throw in production on side effect tags ([c454b9d](https://github.com/vuejs/core/commit/c454b9d7f431d57abedb7184d1e4059914c4463f)), closes [#8287](https://github.com/vuejs/core/issues/8287) [#8292](https://github.com/vuejs/core/issues/8292)
8+
* **compiler-sfc:** fix regression on props destructure when transform is not enabled ([f25bd37](https://github.com/vuejs/core/commit/f25bd37c6707fde19d164d90a38de41168941f4b)), closes [#8289](https://github.com/vuejs/core/issues/8289)
9+
* **compiler-sfc:** handle prop keys that need escaping ([#7803](https://github.com/vuejs/core/issues/7803)) ([690ef29](https://github.com/vuejs/core/commit/690ef296357c7fc09f66ba9408df548e117f686f)), closes [#8291](https://github.com/vuejs/core/issues/8291)
10+
* **compiler-sfc:** properly parse d.ts files when resolving types ([aa1e77d](https://github.com/vuejs/core/commit/aa1e77d532b951ea5d3a5e26214a8b0c9c02fb6f)), closes [#8285](https://github.com/vuejs/core/issues/8285)
11+
* **compiler-sfc:** raise specific warning for failed extends and allow ignoring extends ([8235072](https://github.com/vuejs/core/commit/82350721a408e1f552c613c05971439d6c218d87)), closes [#8286](https://github.com/vuejs/core/issues/8286)
12+
13+
14+
115
## [3.3.1](https://github.com/vuejs/core/compare/v3.3.0...v3.3.1) (2023-05-11)
216

317

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.3.1",
3+
"version": "3.3.2",
44
"packageManager": "pnpm@8.4.0",
55
"type": "module",
66
"scripts": {

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.3.1",
3+
"version": "3.3.2",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",
@@ -33,7 +33,7 @@
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
3434
"dependencies": {
3535
"@babel/parser": "^7.21.3",
36-
"@vue/shared": "3.3.1",
36+
"@vue/shared": "3.3.2",
3737
"estree-walker": "^2.0.2",
3838
"source-map-js": "^1.0.2"
3939
},

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.3.1",
3+
"version": "3.3.2",
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.3.1",
41-
"@vue/compiler-core": "3.3.1"
40+
"@vue/shared": "3.3.2",
41+
"@vue/compiler-core": "3.3.2"
4242
}
4343
}

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ return { props }
3838
})"
3939
`;
4040

41+
exports[`defineProps > destructure without enabling reactive destructure 1`] = `
42+
"import { defineComponent as _defineComponent } from 'vue'
43+
44+
export default /*#__PURE__*/_defineComponent({
45+
props: {
46+
foo: { type: null, required: true }
47+
},
48+
setup(__props: any, { expose: __expose }) {
49+
__expose();
50+
51+
const { foo } = __props;
52+
53+
54+
55+
return { }
56+
}
57+
58+
})"
59+
`;
60+
4161
exports[`defineProps > w/ TS assertion 1`] = `
4262
"import { defineComponent as _defineComponent } from 'vue'
4363

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,44 @@ return () => {}
9797
}"
9898
`;
9999

100+
exports[`sfc reactive props destructure > default values w/ runtime declaration & key is string 1`] = `
101+
"import { mergeDefaults as _mergeDefaults } from 'vue'
102+
103+
export default {
104+
props: _mergeDefaults(['foo', 'foo:bar'], {
105+
foo: 1,
106+
\\"foo:bar\\": 'foo-bar'
107+
}),
108+
setup(__props) {
109+
110+
111+
112+
return () => {}
113+
}
114+
115+
}"
116+
`;
117+
118+
exports[`sfc reactive props destructure > default values w/ type declaration & key is string 1`] = `
119+
"import { defineComponent as _defineComponent } from 'vue'
120+
121+
export default /*#__PURE__*/_defineComponent({
122+
props: {
123+
foo: { type: Number, required: true, default: 1 },
124+
bar: { type: Number, required: true, default: 2 },
125+
\\"foo:bar\\": { type: String, required: true, default: 'foo-bar' },
126+
\\"onUpdate:modelValue\\": { type: Function, required: true }
127+
},
128+
setup(__props: any) {
129+
130+
131+
132+
return () => {}
133+
}
134+
135+
})"
136+
`;
137+
100138
exports[`sfc reactive props destructure > default values w/ type declaration 1`] = `
101139
"import { defineComponent as _defineComponent } from 'vue'
102140

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,19 @@ const props = defineProps({ foo: String })
586586
})
587587
})
588588

589+
// #8289
590+
test('destructure without enabling reactive destructure', () => {
591+
const { content } = compile(
592+
`<script setup lang="ts">
593+
const { foo } = defineProps<{
594+
foo: Foo
595+
}>()
596+
</script>`
597+
)
598+
expect(content).toMatch(`const { foo } = __props`)
599+
assertCode(content)
600+
})
601+
589602
describe('errors', () => {
590603
test('w/ both type and non-type args', () => {
591604
expect(() => {

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,28 @@ describe('sfc reactive props destructure', () => {
106106
})`)
107107
assertCode(content)
108108
})
109+
test('default values w/ runtime declaration & key is string', () => {
110+
const { content, bindings } = compile(`
111+
<script setup>
112+
const { foo = 1, 'foo:bar': fooBar = 'foo-bar' } = defineProps(['foo', 'foo:bar'])
113+
</script>
114+
`)
115+
expect(bindings).toStrictEqual({
116+
__propsAliases: {
117+
fooBar: 'foo:bar'
118+
},
119+
foo: BindingTypes.PROPS,
120+
'foo:bar': BindingTypes.PROPS,
121+
fooBar: BindingTypes.PROPS_ALIASED
122+
})
123+
124+
expect(content).toMatch(`
125+
props: _mergeDefaults(['foo', 'foo:bar'], {
126+
foo: 1,
127+
"foo:bar": 'foo-bar'
128+
}),`)
129+
assertCode(content)
130+
})
109131

110132
test('default values w/ type declaration', () => {
111133
const { content } = compile(`
@@ -123,6 +145,37 @@ describe('sfc reactive props destructure', () => {
123145
assertCode(content)
124146
})
125147

148+
test('default values w/ type declaration & key is string', () => {
149+
const { content, bindings } = compile(`
150+
<script setup lang="ts">
151+
const { foo = 1, bar = 2, 'foo:bar': fooBar = 'foo-bar' } = defineProps<{
152+
"foo": number // double-quoted string
153+
'bar': number // single-quoted string
154+
'foo:bar': string // single-quoted string containing symbols
155+
"onUpdate:modelValue": (val: number) => void // double-quoted string containing symbols
156+
}>()
157+
</script>
158+
`)
159+
expect(bindings).toStrictEqual({
160+
__propsAliases: {
161+
fooBar: 'foo:bar'
162+
},
163+
foo: BindingTypes.PROPS,
164+
bar: BindingTypes.PROPS,
165+
'foo:bar': BindingTypes.PROPS,
166+
fooBar: BindingTypes.PROPS_ALIASED,
167+
'onUpdate:modelValue': BindingTypes.PROPS
168+
})
169+
expect(content).toMatch(`
170+
props: {
171+
foo: { type: Number, required: true, default: 1 },
172+
bar: { type: Number, required: true, default: 2 },
173+
"foo:bar": { type: String, required: true, default: 'foo-bar' },
174+
"onUpdate:modelValue": { type: Function, required: true }
175+
},`)
176+
assertCode(content)
177+
})
178+
126179
test('default values w/ type declaration, prod mode', () => {
127180
const { content } = compile(
128181
`

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,35 @@ describe('resolveType', () => {
755755
`)
756756
).not.toThrow()
757757
})
758+
759+
test('error against failed extends', () => {
760+
expect(() =>
761+
resolve(`
762+
import type Base from 'unknown'
763+
interface Props extends Base {}
764+
defineProps<Props>()
765+
`)
766+
).toThrow(`@vue-ignore`)
767+
})
768+
769+
test('allow ignoring failed extends', () => {
770+
let res: any
771+
772+
expect(
773+
() =>
774+
(res = resolve(`
775+
import type Base from 'unknown'
776+
interface Props extends /*@vue-ignore*/ Base {
777+
foo: string
778+
}
779+
defineProps<Props>()
780+
`))
781+
).not.toThrow(`@vue-ignore`)
782+
783+
expect(res.props).toStrictEqual({
784+
foo: ['String']
785+
})
786+
})
758787
})
759788
})
760789

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.3.1",
3+
"version": "3.3.2",
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.20.15",
36-
"@vue/compiler-core": "3.3.1",
37-
"@vue/compiler-dom": "3.3.1",
38-
"@vue/compiler-ssr": "3.3.1",
39-
"@vue/reactivity-transform": "3.3.1",
40-
"@vue/shared": "3.3.1",
36+
"@vue/compiler-core": "3.3.2",
37+
"@vue/compiler-dom": "3.3.2",
38+
"@vue/compiler-ssr": "3.3.2",
39+
"@vue/reactivity-transform": "3.3.2",
40+
"@vue/shared": "3.3.2",
4141
"estree-walker": "^2.0.2",
4242
"magic-string": "^0.30.0",
4343
"postcss": "^8.1.10",

0 commit comments

Comments
 (0)