Skip to content

Commit f231b9c

Browse files
authored
Merge branch 'main' into bwsy/fix/CSSVarsUndefined
2 parents 99de288 + a95e612 commit f231b9c

File tree

129 files changed

+602
-286
lines changed

Some content is hidden

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

129 files changed

+602
-286
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
## [3.3.4](https://github.com/vuejs/core/compare/v3.3.3...v3.3.4) (2023-05-18)
2+
3+
4+
### Bug Fixes
5+
6+
* **build:** ensure correct typing for node esm ([d621d4c](https://github.com/vuejs/core/commit/d621d4c646b2d7b190fbd44ad1fd04512b3de300))
7+
* **build:** fix __DEV__ flag replacement edge case ([8b7c04b](https://github.com/vuejs/core/commit/8b7c04b18f73aad9a08dd57eba90101b5b2aef28)), closes [#8353](https://github.com/vuejs/core/issues/8353)
8+
* **compiler-sfc:** handle imported types from default exports ([5aec717](https://github.com/vuejs/core/commit/5aec717a2402652306085f58432ba3ab91848a74)), closes [#8355](https://github.com/vuejs/core/issues/8355)
9+
10+
11+
12+
## [3.3.3](https://github.com/vuejs/core/compare/v3.3.2...v3.3.3) (2023-05-18)
13+
14+
15+
### Bug Fixes
16+
17+
* avoid regex s flag for old browsers ([91f1c62](https://github.com/vuejs/core/commit/91f1c62e6384a8b09f90e7e43b8d347901e529a0)), closes [#8316](https://github.com/vuejs/core/issues/8316)
18+
* **build:** fix dev flag replacement in esm-builder builds ([#8314](https://github.com/vuejs/core/issues/8314)) ([003836f](https://github.com/vuejs/core/commit/003836f90e1f00ebd04b77ec07ccfa4e649a2ff4)), closes [#8312](https://github.com/vuejs/core/issues/8312)
19+
* **compiler-sfc:** don't hoist regexp literial ([#8300](https://github.com/vuejs/core/issues/8300)) ([8ec73a3](https://github.com/vuejs/core/commit/8ec73a3aea7a52e9479f107ae5737761166ddae6))
20+
* **compiler-sfc:** fix props destructing default value type checking with unresolved type ([#8340](https://github.com/vuejs/core/issues/8340)) ([f69dbab](https://github.com/vuejs/core/commit/f69dbabf8794426c3e9ed33ae77dd8ce655eafd2)), closes [#8326](https://github.com/vuejs/core/issues/8326)
21+
* **compiler-sfc:** fix type import from path aliased vue file ([fab9c72](https://github.com/vuejs/core/commit/fab9c727805c6186c490f99023e8cf5401b0b5a9)), closes [#8348](https://github.com/vuejs/core/issues/8348)
22+
* **compiler-sfc:** handle ts files with relative imports with .js extension ([b36addd](https://github.com/vuejs/core/commit/b36addd3bde07467e9ff5641bd1c2bdc3085944c)), closes [#8339](https://github.com/vuejs/core/issues/8339)
23+
* **compiler-sfc:** parses correctly when inline mode is off ([#8337](https://github.com/vuejs/core/issues/8337)) ([ecbd42a](https://github.com/vuejs/core/commit/ecbd42a1444e3c599e464dec002e43d548d99669)), closes [#6088](https://github.com/vuejs/core/issues/6088)
24+
* **compiler-sfc:** support defineEmits type reference with unions ([#8299](https://github.com/vuejs/core/issues/8299)) ([b133e0f](https://github.com/vuejs/core/commit/b133e0fd97b0b4fabbb43151c19031b8fb47c05b)), closes [#7943](https://github.com/vuejs/core/issues/7943)
25+
* **types:** support generic usage with withDefaults + defineProps ([#8335](https://github.com/vuejs/core/issues/8335)) ([216f269](https://github.com/vuejs/core/commit/216f26995b63c2df26ca0f39f390fe8d59cdabfa)), closes [#8310](https://github.com/vuejs/core/issues/8310) [#8331](https://github.com/vuejs/core/issues/8331) [#8325](https://github.com/vuejs/core/issues/8325)
26+
27+
28+
129
## [3.3.2](https://github.com/vuejs/core/compare/v3.3.1...v3.3.2) (2023-05-12)
230

331

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.2",
3+
"version": "3.3.4",
44
"packageManager": "[email protected]",
55
"type": "module",
66
"scripts": {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { ParserOptions } from '../src/options'
32
import { baseParse, TextModes } from '../src/parse'
43
import { ErrorCodes } from '../src/errors'

packages/compiler-core/__tests__/transform.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { baseParse } from '../src/parse'
32
import { transform, NodeTransform } from '../src/transform'
43
import {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
CompilerOptions,
43
baseParse as parse,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
CompilerOptions,
43
baseParse as parse,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { baseParse as parse } from '../../src/parse'
32
import { transform } from '../../src/transform'
43
import { transformIf } from '../../src/transforms/vIf'

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { baseParse as parse } from '../../src/parse'
32
import { transform } from '../../src/transform'
43
import { transformIf } from '../../src/transforms/vIf'

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
CompilerOptions,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
CompilerOptions,
43
baseParse as parse,

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.2",
3+
"version": "3.3.4",
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.2",
36+
"@vue/shared": "3.3.4",
3737
"estree-walker": "^2.0.2",
3838
"source-map-js": "^1.0.2"
3939
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
} from '../babelUtils'
2626
import { advancePositionWithClone, isSimpleIdentifier } from '../utils'
2727
import {
28-
isGloballyWhitelisted,
28+
isGloballyAllowed,
2929
makeMap,
3030
hasOwn,
3131
isString,
@@ -225,7 +225,7 @@ export function processExpression(
225225

226226
if (isSimpleIdentifier(rawExp)) {
227227
const isScopeVarReference = context.identifiers[rawExp]
228-
const isAllowedGlobal = isGloballyWhitelisted(rawExp)
228+
const isAllowedGlobal = isGloballyAllowed(rawExp)
229229
const isLiteral = isLiteralWhitelisted(rawExp)
230230
if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
231231
// const bindings exposed from setup can be skipped for patching but
@@ -358,7 +358,7 @@ export function processExpression(
358358

359359
function canPrefix(id: Identifier) {
360360
// skip whitelisted globals
361-
if (isGloballyWhitelisted(id.name)) {
361+
if (isGloballyAllowed(id.name)) {
362362
return false
363363
}
364364
// special case for webpack compilation

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import { compile } from '../../src'
32

43
describe('Transition multi children warnings', () => {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { vi } from 'vitest'
21
import {
32
baseParse as parse,
43
transform,

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.2",
3+
"version": "3.3.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/core/tree/main/packages/compiler-dom#readme",
3939
"dependencies": {
40-
"@vue/shared": "3.3.2",
41-
"@vue/compiler-core": "3.3.2"
40+
"@vue/shared": "3.3.4",
41+
"@vue/compiler-core": "3.3.4"
4242
}
4343
}

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,25 @@ describe('SFC compile <script setup>', () => {
804804
expect(content).toMatch(`"--${mockId}-count": (count.value)`)
805805
assertCode(content)
806806
})
807+
808+
test('the v-for wrapped in parentheses can be correctly parsed & inline is false', () => {
809+
expect(() =>
810+
compile(
811+
`
812+
<script setup lang="ts">
813+
import { ref } from 'vue'
814+
const stacks = ref([])
815+
</script>
816+
<template>
817+
<div v-for="({ file: efile }) of stacks"></div>
818+
</template>
819+
`,
820+
{
821+
inlineTemplate: false
822+
}
823+
)
824+
).not.toThrowError()
825+
})
807826
})
808827

809828
describe('with TypeScript', () => {

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ export default /*#__PURE__*/_defineComponent({
191191
192192
193193
194+
return { emit }
195+
}
196+
197+
})"
198+
`;
199+
200+
exports[`defineEmits > w/ type (type references in union) 1`] = `
201+
"import { defineComponent as _defineComponent } from 'vue'
202+
type BaseEmit = \\"change\\"
203+
type Emit = \\"some\\" | \\"emit\\" | BaseEmit
204+
205+
export default /*#__PURE__*/_defineComponent({
206+
emits: [\\"some\\", \\"emit\\", \\"change\\", \\"another\\"],
207+
setup(__props, { expose: __expose, emit }) {
208+
__expose();
209+
210+
211+
194212
return { emit }
195213
}
196214

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ exports[`sfc hoist static > should hoist literal value 1`] = `
3737
const nil = null
3838
const bigint = 100n
3939
const template = \`str\`
40-
const regex = /.*/g
4140
4241
export default {
4342
setup(__props) {
@@ -124,6 +123,8 @@ exports[`sfc hoist static > should not hoist a variable 1`] = `
124123
125124
let KEY1 = 'default value'
126125
var KEY2 = 123
126+
const regex = /.*/g
127+
const undef = undefined
127128
128129
return () => {}
129130
}

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,23 @@ const emit = defineEmits(['a', 'b'])
179179
assertCode(content)
180180
})
181181

182+
// #7943
183+
test('w/ type (type references in union)', () => {
184+
const { content } = compile(`
185+
<script setup lang="ts">
186+
type BaseEmit = "change"
187+
type Emit = "some" | "emit" | BaseEmit
188+
const emit = defineEmits<{
189+
(e: Emit): void;
190+
(e: "another", val: string): void;
191+
}>();
192+
</script>
193+
`)
194+
195+
expect(content).toMatch(`emits: ["some", "emit", "change", "another"]`)
196+
assertCode(content)
197+
})
198+
182199
describe('errors', () => {
183200
test('w/ both type and non-type args', () => {
184201
expect(() => {

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ describe('sfc hoist static', () => {
1919
const nil = null
2020
const bigint = 100n
2121
const template = \`str\`
22-
const regex = /.*/g
2322
`.trim()
2423
const { content, bindings } = compile(`
2524
<script setup>
@@ -35,8 +34,7 @@ describe('sfc hoist static', () => {
3534
boolean: BindingTypes.LITERAL_CONST,
3635
nil: BindingTypes.LITERAL_CONST,
3736
bigint: BindingTypes.LITERAL_CONST,
38-
template: BindingTypes.LITERAL_CONST,
39-
regex: BindingTypes.LITERAL_CONST
37+
template: BindingTypes.LITERAL_CONST
4038
})
4139
assertCode(content)
4240
})
@@ -90,6 +88,8 @@ describe('sfc hoist static', () => {
9088
const code = `
9189
let KEY1 = 'default value'
9290
var KEY2 = 123
91+
const regex = /.*/g
92+
const undef = undefined
9393
`.trim()
9494
const { content, bindings } = compile(`
9595
<script setup>
@@ -98,7 +98,9 @@ describe('sfc hoist static', () => {
9898
`)
9999
expect(bindings).toStrictEqual({
100100
KEY1: BindingTypes.SETUP_LET,
101-
KEY2: BindingTypes.SETUP_LET
101+
KEY2: BindingTypes.SETUP_LET,
102+
regex: BindingTypes.SETUP_CONST,
103+
undef: BindingTypes.SETUP_MAYBE_REF
102104
})
103105
expect(content).toMatch(`setup(__props) {\n\n ${code}`)
104106
assertCode(content)

0 commit comments

Comments
 (0)