Skip to content

Commit 7cd7050

Browse files
committed
Merge remote-tracking branch 'upstream/minor'
2 parents 133d494 + b295cdf commit 7cd7050

Some content is hidden

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

45 files changed

+1133
-370
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
# [3.5.0-alpha.2](https://github.com/vuejs/core/compare/v3.4.26...v3.5.0-alpha.2) (2024-05-04)
2+
3+
4+
### Bug Fixes
5+
6+
* **types:** fix app.component() typing with inline defineComponent ([908f70a](https://github.com/vuejs/core/commit/908f70adc06038d1ea253d96f4024367f4a7545d)), closes [#10843](https://github.com/vuejs/core/issues/10843)
7+
* **types:** fix compat with generated types that rely on CreateComponentPublicInstance ([c146186](https://github.com/vuejs/core/commit/c146186396d0c1a65423b8c9a21251c5a6467336)), closes [#10842](https://github.com/vuejs/core/issues/10842)
8+
* **types:** props in defineOptions type should be optional ([124c4ca](https://github.com/vuejs/core/commit/124c4cac833a28ae9bc8edc576c1d0c7c41f5985)), closes [#10841](https://github.com/vuejs/core/issues/10841)
9+
10+
11+
### Features
12+
13+
* **runtime-core:** add app.onUnmount() for registering cleanup functions ([#4619](https://github.com/vuejs/core/issues/4619)) ([582a3a3](https://github.com/vuejs/core/commit/582a3a382b1adda565bac576b913a88d9e8d7a9e)), closes [#4516](https://github.com/vuejs/core/issues/4516)
14+
15+
16+
17+
## [3.4.26](https://github.com/vuejs/core/compare/v3.4.25...v3.4.26) (2024-04-29)
18+
19+
20+
### Bug Fixes
21+
22+
* **compiler-core:** fix bail constant for globals ([fefce06](https://github.com/vuejs/core/commit/fefce06b41e3b75de3d748dc6399628ec5056e78))
23+
* **compiler-core:** remove unnecessary constant bail check ([09b4df8](https://github.com/vuejs/core/commit/09b4df809e59ef5f4bc91acfc56dc8f82a8e243a)), closes [#10807](https://github.com/vuejs/core/issues/10807)
24+
* **runtime-core:** attrs should be readonly in functional components ([#10767](https://github.com/vuejs/core/issues/10767)) ([e8fd644](https://github.com/vuejs/core/commit/e8fd6446d14a6899e5e8ab1ee394d90088e01844))
25+
* **runtime-core:** ensure slot compiler marker writable ([#10825](https://github.com/vuejs/core/issues/10825)) ([9c2de62](https://github.com/vuejs/core/commit/9c2de6244cd44bc5fbfd82b5850c710ce725044f)), closes [#10818](https://github.com/vuejs/core/issues/10818)
26+
* **runtime-core:** properly handle inherit transition during clone VNode ([#10809](https://github.com/vuejs/core/issues/10809)) ([638a79f](https://github.com/vuejs/core/commit/638a79f64a7e184f2a2c65e21d764703f4bda561)), closes [#3716](https://github.com/vuejs/core/issues/3716) [#10497](https://github.com/vuejs/core/issues/10497) [#4091](https://github.com/vuejs/core/issues/4091)
27+
* **Transition:** re-fix [#10620](https://github.com/vuejs/core/issues/10620) ([#10832](https://github.com/vuejs/core/issues/10832)) ([accf839](https://github.com/vuejs/core/commit/accf8396ae1c9dd49759ba0546483f1d2c70c9bc)), closes [#10632](https://github.com/vuejs/core/issues/10632) [#10827](https://github.com/vuejs/core/issues/10827)
28+
29+
30+
131
# [3.5.0-alpha.1](https://github.com/vuejs/core/compare/v3.4.25...v3.5.0-alpha.1) (2024-04-29)
232

333

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"version": "3.0.0-vapor",
4-
"packageManager": "[email protected].5",
4+
"packageManager": "[email protected].6",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js vue vue-vapor",
@@ -72,16 +72,16 @@
7272
"@types/minimist": "^1.2.5",
7373
"@types/node": "^20.12.7",
7474
"@types/semver": "^7.5.8",
75-
"@vitest/coverage-istanbul": "^1.5.0",
76-
"@vitest/ui": "^1.5.0",
75+
"@vitest/coverage-istanbul": "^1.5.2",
76+
"@vitest/ui": "^1.5.2",
7777
"@vue/consolidate": "1.0.0",
7878
"conventional-changelog-cli": "^4.1.0",
7979
"enquirer": "^2.4.1",
8080
"esbuild": "^0.20.2",
8181
"esbuild-plugin-polyfill-node": "^0.3.0",
82-
"eslint": "^9.0.0",
82+
"eslint": "^9.1.1",
8383
"eslint-plugin-import-x": "^0.5.0",
84-
"eslint-plugin-vitest": "^0.5.3",
84+
"eslint-plugin-vitest": "^0.5.4",
8585
"estree-walker": "^2.0.2",
8686
"execa": "^8.0.1",
8787
"jsdom": "^24.0.0",
@@ -96,23 +96,23 @@
9696
"prettier": "^3.2.5",
9797
"pretty-bytes": "^6.1.1",
9898
"pug": "^3.0.2",
99-
"puppeteer": "~22.6.5",
99+
"puppeteer": "~22.7.1",
100100
"rimraf": "^5.0.5",
101-
"rollup": "^4.16.1",
101+
"rollup": "^4.17.1",
102102
"rollup-plugin-dts": "^6.1.0",
103103
"rollup-plugin-esbuild": "^6.1.1",
104104
"rollup-plugin-polyfill-node": "^0.13.0",
105105
"semver": "^7.6.0",
106-
"serve": "^14.2.1",
106+
"serve": "^14.2.3",
107107
"simple-git-hooks": "^2.11.1",
108-
"terser": "^5.30.3",
108+
"terser": "^5.30.4",
109109
"todomvc-app-css": "^2.4.3",
110110
"tslib": "^2.6.2",
111-
"tsx": "^4.7.2",
111+
"tsx": "^4.7.3",
112112
"typescript": "~5.4.5",
113-
"typescript-eslint": "^7.6.0",
113+
"typescript-eslint": "^7.7.1",
114114
"vite": "^5.2.10",
115-
"vitest": "^1.5.0"
115+
"vitest": "^1.5.2"
116116
},
117117
"pnpm": {
118118
"peerDependencyRules": {

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,31 @@ describe('compiler: expression transform', () => {
421421
})
422422
})
423423

424+
// #10807
425+
test('should not bail constant on strings w/ ()', () => {
426+
const node = parseWithExpressionTransform(
427+
`{{ { foo: 'ok()' } }}`,
428+
) as InterpolationNode
429+
expect(node.content).toMatchObject({
430+
constType: ConstantTypes.CAN_STRINGIFY,
431+
})
432+
})
433+
434+
test('should bail constant for global identifiers w/ new or call expressions', () => {
435+
const node = parseWithExpressionTransform(
436+
`{{ new Date().getFullYear() }}`,
437+
) as InterpolationNode
438+
expect(node.content).toMatchObject({
439+
children: [
440+
'new ',
441+
{ constType: ConstantTypes.NOT_CONSTANT },
442+
'().',
443+
{ constType: ConstantTypes.NOT_CONSTANT },
444+
'()',
445+
],
446+
})
447+
})
448+
424449
describe('ES Proposals support', () => {
425450
test('bigInt', () => {
426451
const node = parseWithExpressionTransform(

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

packages/compiler-core/src/babelUtils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import type {
1010
} from '@babel/types'
1111
import { walk } from 'estree-walker'
1212

13+
/**
14+
* Return value indicates whether the AST walked can be a constant
15+
*/
1316
export function walkIdentifiers(
1417
root: Node,
1518
onIdentifier: (

packages/compiler-core/src/parser.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const tokenizer = new Tokenizer(stack, {
179179
const name = currentOpenTag!.tag
180180
currentOpenTag!.isSelfClosing = true
181181
endOpenTag(end)
182-
if (stack[0]?.tag === name) {
182+
if (stack[0] && stack[0].tag === name) {
183183
onCloseTag(stack.shift()!, end)
184184
}
185185
},
@@ -587,14 +587,14 @@ function endOpenTag(end: number) {
587587

588588
function onText(content: string, start: number, end: number) {
589589
if (__BROWSER__) {
590-
const tag = stack[0]?.tag
590+
const tag = stack[0] && stack[0].tag
591591
if (tag !== 'script' && tag !== 'style' && content.includes('&')) {
592592
content = currentOptions.decodeEntities!(content, false)
593593
}
594594
}
595595
const parent = stack[0] || currentRoot
596596
const lastNode = parent.children[parent.children.length - 1]
597-
if (lastNode?.type === NodeTypes.TEXT) {
597+
if (lastNode && lastNode.type === NodeTypes.TEXT) {
598598
// merge
599599
lastNode.content += content
600600
setLocEnd(lastNode.loc, end)
@@ -771,7 +771,8 @@ function isComponent({ tag, props }: ElementNode): boolean {
771771
tag === 'component' ||
772772
isUpperCase(tag.charCodeAt(0)) ||
773773
isCoreComponent(tag) ||
774-
currentOptions.isBuiltInComponent?.(tag) ||
774+
(currentOptions.isBuiltInComponent &&
775+
currentOptions.isBuiltInComponent(tag)) ||
775776
(currentOptions.isNativeTag && !currentOptions.isNativeTag(tag))
776777
) {
777778
return true
@@ -828,8 +829,8 @@ function condenseWhitespace(
828829
if (node.type === NodeTypes.TEXT) {
829830
if (!inPre) {
830831
if (isAllWhitespace(node.content)) {
831-
const prev = nodes[i - 1]?.type
832-
const next = nodes[i + 1]?.type
832+
const prev = nodes[i - 1] && nodes[i - 1].type
833+
const next = nodes[i + 1] && nodes[i + 1].type
833834
// Remove if:
834835
// - the whitespace is the first or last node, or:
835836
// - (condense mode) the whitespace is between two comments, or:
@@ -1063,7 +1064,7 @@ export function baseParse(input: string, options?: ParserOptions): RootNode {
10631064
currentOptions.ns === Namespaces.SVG ||
10641065
currentOptions.ns === Namespaces.MATH_ML
10651066

1066-
const delimiters = options?.delimiters
1067+
const delimiters = options && options.delimiters
10671068
if (delimiters) {
10681069
tokenizer.delimiterOpen = toCharCodes(delimiters[0])
10691070
tokenizer.delimiterClose = toCharCodes(delimiters[1])

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ export const isLiteralWhitelisted = /*#__PURE__*/ makeMap(
4848
'true,false,null,this',
4949
)
5050

51-
// a heuristic safeguard to bail constant expressions on presence of
52-
// likely function invocation and member access
53-
const constantBailRE = /\w\s*\(|\.[^\d]/
54-
5551
export const transformExpression: NodeTransform = (node, context) => {
5652
if (node.type === NodeTypes.INTERPOLATION) {
5753
node.content = processExpression(
@@ -228,8 +224,6 @@ export function processExpression(
228224

229225
// fast path if expression is a simple identifier.
230226
const rawExp = node.content
231-
// bail constant on parens (function invocation) and dot (member access)
232-
const bailConstant = constantBailRE.test(rawExp)
233227

234228
let ast = node.ast
235229

@@ -319,7 +313,12 @@ export function processExpression(
319313
} else {
320314
// The identifier is considered constant unless it's pointing to a
321315
// local scope variable (a v-for alias, or a v-slot prop)
322-
if (!(needPrefix && isLocal) && !bailConstant) {
316+
if (
317+
!(needPrefix && isLocal) &&
318+
parent.type !== 'CallExpression' &&
319+
parent.type !== 'NewExpression' &&
320+
parent.type !== 'MemberExpression'
321+
) {
323322
;(node as QualifiedId).isConstant = true
324323
}
325324
// also generate sub-expressions for other identifiers for better
@@ -373,9 +372,7 @@ export function processExpression(
373372
ret.ast = ast
374373
} else {
375374
ret = node
376-
ret.constType = bailConstant
377-
? ConstantTypes.NOT_CONSTANT
378-
: ConstantTypes.CAN_STRINGIFY
375+
ret.constType = ConstantTypes.CAN_STRINGIFY
379376
}
380377
ret.identifiers = Object.keys(knownIds)
381378
return ret

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

packages/compiler-sfc/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-sfc",
3-
"version": "3.5.0-alpha.1",
3+
"version": "3.5.0-alpha.2",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"module": "dist/compiler-sfc.esm-browser.js",

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

packages/dts-test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Tests TypeScript types to ensure the types remain as expected.
44

55
- This directory is included in the root `tsconfig.json`, where package imports are aliased to `src` directories, so in IDEs and the `pnpm check` script the types are validated against source code.
66

7-
- When running `tsc` with `packages/dts-test/tsconfig.test.json`, packages are resolved using normal `node` resolution, so the types are validated against actual **built** types. This requires the types to be built first via `pnpm build-types`.
7+
- When running `tsc` with `packages/dts-test/tsconfig.test.json`, packages are resolved using normal `node` resolution, so the types are validated against actual **built** types. This requires the types to be built first via `pnpm build-dts`.

0 commit comments

Comments
 (0)