Skip to content

Commit 334e72e

Browse files
committed
Merge remote-tracking branch 'upstream/minor'
2 parents 868c429 + f8eba75 commit 334e72e

File tree

70 files changed

+1537
-795
lines changed

Some content is hidden

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

70 files changed

+1537
-795
lines changed

.github/commit-convention.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Messages must be matched by the following regex:
88

9-
``` js
9+
```regexp
1010
/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,50}/
1111
```
1212

.github/workflows/size-data.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,3 @@ jobs:
5252
with:
5353
name: size-data
5454
path: temp/size
55-
56-
- name: Save PR number
57-
if: ${{ github.event_name == 'pull_request' }}
58-
run: echo ${{ github.event.number }} > ./pr.txt
59-
60-
- uses: actions/upload-artifact@v4
61-
if: ${{ github.event_name == 'pull_request' }}
62-
with:
63-
name: pr-number
64-
path: pr.txt
65-
- name: Size report
66-
if: ${{ github.event_name == 'push' }}
67-
run: pnpm tsx scripts/size-report.ts

.github/workflows/size-report.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ jobs:
3535
- name: Install dependencies
3636
run: pnpm install
3737

38-
- name: Download PR number
39-
uses: dawidd6/action-download-artifact@v3
40-
with:
41-
name: pr-number
42-
run_id: ${{ github.event.workflow_run.id }}
43-
path: /tmp/pr-number
44-
45-
- name: Read PR Number
46-
id: pr-number
47-
uses: juliangruber/read-file-action@v1
48-
with:
49-
path: /tmp/pr-number/pr.txt
50-
5138
- name: Download Size Data
5239
uses: dawidd6/action-download-artifact@v3
5340
with:
@@ -78,7 +65,6 @@ jobs:
7865
uses: actions-cool/maintain-one-comment@v3
7966
with:
8067
token: ${{ secrets.GITHUB_TOKEN }}
81-
number: ${{ steps.pr-number.outputs.content }}
8268
body: |
8369
${{ steps.size-report.outputs.content }}
8470
<!-- VUE_CORE_SIZE -->

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## [3.4.27](https://github.com/vuejs/core/compare/v3.4.26...v3.4.27) (2024-05-06)
2+
3+
4+
### Bug Fixes
5+
6+
* **compat:** include legacy scoped slots ([#10868](https://github.com/vuejs/core/issues/10868)) ([8366126](https://github.com/vuejs/core/commit/83661264a4ced3cb2ff6800904a86dd9e82bbfe2)), closes [#8869](https://github.com/vuejs/core/issues/8869)
7+
* **compiler-core:** add support for arrow aysnc function with unbracketed ([#5789](https://github.com/vuejs/core/issues/5789)) ([ca7d421](https://github.com/vuejs/core/commit/ca7d421e8775f6813f8943d32ab485e0c542f98b)), closes [#5788](https://github.com/vuejs/core/issues/5788)
8+
* **compiler-dom:** restrict createStaticVNode usage with option elements ([#10846](https://github.com/vuejs/core/issues/10846)) ([0e3d617](https://github.com/vuejs/core/commit/0e3d6178b02d0386d779720ae2cc4eac1d1ec990)), closes [#6568](https://github.com/vuejs/core/issues/6568) [#7434](https://github.com/vuejs/core/issues/7434)
9+
* **compiler-sfc:** handle keyof operator ([#10874](https://github.com/vuejs/core/issues/10874)) ([10d34a5](https://github.com/vuejs/core/commit/10d34a5624775f20437ccad074a97270ef74c3fb)), closes [#10871](https://github.com/vuejs/core/issues/10871)
10+
* **hydration:** handle edge case of style mismatch without style attribute ([f2c1412](https://github.com/vuejs/core/commit/f2c1412e46a8fad3e13403bfa78335c4f704f21c)), closes [#10786](https://github.com/vuejs/core/issues/10786)
11+
12+
13+
114
# [3.5.0-alpha.2](https://github.com/vuejs/core/compare/v3.4.26...v3.5.0-alpha.2) (2024-05-04)
215

316

eslint.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export default tseslint.config(
4545
message:
4646
'Our output target is ES2016, so async/await syntax should be avoided.',
4747
},
48+
{
49+
selector: 'ChainExpression',
50+
message:
51+
'Our output target is ES2016, and optional chaining results in ' +
52+
'verbose helpers and should be avoided.',
53+
},
4854
],
4955
'sort-imports': ['error', { ignoreDeclarationSort: true }],
5056

@@ -138,7 +144,7 @@ export default tseslint.config(
138144
{
139145
files: [
140146
'eslint.config.js',
141-
'rollup.config.js',
147+
'rollup*.config.js',
142148
'scripts/**',
143149
'./*.{js,ts}',
144150
'packages/*/*.js',

package.json

Lines changed: 20 additions & 20 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": "pnpm@9.0.6",
4+
"packageManager": "pnpm@9.1.2",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js vue vue-vapor",
@@ -59,59 +59,59 @@
5959
"node": ">=18.12.0"
6060
},
6161
"devDependencies": {
62-
"@babel/parser": "^7.24.4",
63-
"@babel/types": "^7.24.0",
62+
"@babel/parser": "^7.24.6",
63+
"@babel/types": "^7.24.6",
6464
"@codspeed/vitest-plugin": "^3.1.0",
6565
"@rollup/plugin-alias": "^5.1.0",
66-
"@rollup/plugin-commonjs": "^25.0.7",
66+
"@rollup/plugin-commonjs": "^25.0.8",
6767
"@rollup/plugin-json": "^6.1.0",
6868
"@rollup/plugin-node-resolve": "^15.2.3",
6969
"@rollup/plugin-replace": "5.0.4",
7070
"@rollup/plugin-terser": "^0.4.4",
7171
"@types/hash-sum": "^1.0.2",
7272
"@types/minimist": "^1.2.5",
73-
"@types/node": "^20.12.7",
73+
"@types/node": "^20.12.12",
7474
"@types/semver": "^7.5.8",
7575
"@vitest/coverage-istanbul": "^1.5.2",
7676
"@vitest/ui": "^1.5.2",
7777
"@vue/consolidate": "1.0.0",
7878
"conventional-changelog-cli": "^4.1.0",
7979
"enquirer": "^2.4.1",
80-
"esbuild": "^0.20.2",
80+
"esbuild": "^0.21.4",
8181
"esbuild-plugin-polyfill-node": "^0.3.0",
82-
"eslint": "^9.1.1",
83-
"eslint-plugin-import-x": "^0.5.0",
82+
"eslint": "^9.3.0",
83+
"eslint-plugin-import-x": "^0.5.1",
8484
"eslint-plugin-vitest": "^0.5.4",
8585
"estree-walker": "^2.0.2",
8686
"execa": "^8.0.1",
8787
"jsdom": "^24.0.0",
88-
"lint-staged": "^15.2.2",
88+
"lint-staged": "^15.2.5",
8989
"lodash": "^4.17.21",
9090
"magic-string": "^0.30.10",
9191
"markdown-table": "^3.0.3",
9292
"marked": "^12.0.2",
9393
"minimist": "^1.2.8",
94-
"npm-run-all2": "^6.1.2",
95-
"picocolors": "^1.0.0",
94+
"npm-run-all2": "^6.2.0",
95+
"picocolors": "^1.0.1",
9696
"prettier": "^3.2.5",
9797
"pretty-bytes": "^6.1.1",
98-
"pug": "^3.0.2",
98+
"pug": "^3.0.3",
9999
"puppeteer": "~22.7.1",
100-
"rimraf": "^5.0.5",
101-
"rollup": "^4.17.1",
102-
"rollup-plugin-dts": "^6.1.0",
100+
"rimraf": "^5.0.7",
101+
"rollup": "^4.18.0",
102+
"rollup-plugin-dts": "^6.1.1",
103103
"rollup-plugin-esbuild": "^6.1.1",
104104
"rollup-plugin-polyfill-node": "^0.13.0",
105-
"semver": "^7.6.0",
105+
"semver": "^7.6.2",
106106
"serve": "^14.2.3",
107107
"simple-git-hooks": "^2.11.1",
108-
"terser": "^5.30.4",
108+
"terser": "^5.31.0",
109109
"todomvc-app-css": "^2.4.3",
110110
"tslib": "^2.6.2",
111-
"tsx": "^4.7.3",
111+
"tsx": "^4.11.0",
112112
"typescript": "~5.4.5",
113-
"typescript-eslint": "^7.7.1",
114-
"vite": "^5.2.10",
113+
"typescript-eslint": "^7.10.0",
114+
"vite": "^5.2.11",
115115
"vitest": "^1.5.2"
116116
},
117117
"pnpm": {

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,18 @@ describe('compiler: element transform', () => {
12841284
})
12851285
})
12861286

1287+
test('<math> should be forced into blocks', () => {
1288+
const ast = parse(`<div><math/></div>`)
1289+
transform(ast, {
1290+
nodeTransforms: [transformElement],
1291+
})
1292+
expect((ast as any).children[0].children[0].codegenNode).toMatchObject({
1293+
type: NodeTypes.VNODE_CALL,
1294+
tag: `"math"`,
1295+
isBlock: true,
1296+
})
1297+
})
1298+
12871299
test('force block for runtime custom directive w/ children', () => {
12881300
const { node } = parseWithElementTransform(`<div v-foo>hello</div>`)
12891301
expect(node.isBlock).toBe(true)

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,23 @@ describe('compiler: transform v-on', () => {
286286
})
287287
})
288288

289+
test('should NOT wrap as function if expression is already function expression (async)', () => {
290+
const { node } = parseWithVOn(
291+
`<div @click="async $event => await foo($event)"/>`,
292+
)
293+
expect((node.codegenNode as VNodeCall).props).toMatchObject({
294+
properties: [
295+
{
296+
key: { content: `onClick` },
297+
value: {
298+
type: NodeTypes.SIMPLE_EXPRESSION,
299+
content: `async $event => await foo($event)`,
300+
},
301+
},
302+
],
303+
})
304+
})
305+
289306
test('should NOT wrap as function if expression is already function expression (with newlines)', () => {
290307
const { node } = parseWithVOn(
291308
`<div @click="
@@ -630,6 +647,39 @@ describe('compiler: transform v-on', () => {
630647
})
631648
})
632649

650+
test('inline async arrow function with no bracket expression handler', () => {
651+
const { root, node } = parseWithVOn(
652+
`<div v-on:click="async e => await foo(e)" />`,
653+
{
654+
prefixIdentifiers: true,
655+
cacheHandlers: true,
656+
},
657+
)
658+
659+
expect(root.cached).toBe(1)
660+
const vnodeCall = node.codegenNode as VNodeCall
661+
// should not treat cached handler as dynamicProp, so no flags
662+
expect(vnodeCall.patchFlag).toBeUndefined()
663+
expect(
664+
(vnodeCall.props as ObjectExpression).properties[0].value,
665+
).toMatchObject({
666+
type: NodeTypes.JS_CACHE_EXPRESSION,
667+
index: 0,
668+
value: {
669+
type: NodeTypes.COMPOUND_EXPRESSION,
670+
children: [
671+
`async `,
672+
{ content: `e` },
673+
` => await `,
674+
{ content: `_ctx.foo` },
675+
`(`,
676+
{ content: `e` },
677+
`)`,
678+
],
679+
},
680+
})
681+
})
682+
633683
test('inline async function expression handler', () => {
634684
const { root, node } = parseWithVOn(
635685
`<div v-on:click="async function () { await foo() } " />`,

packages/compiler-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
},
4747
"homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-core#readme",
4848
"dependencies": {
49-
"@babel/parser": "^7.24.4",
49+
"@babel/parser": "^7.24.6",
5050
"@vue/shared": "workspace:*",
5151
"entities": "^4.5.0",
5252
"estree-walker": "^2.0.2",
5353
"source-map-js": "^1.2.0"
5454
},
5555
"devDependencies": {
56-
"@babel/types": "^7.24.0"
56+
"@babel/types": "^7.24.6"
5757
}
5858
}

packages/compiler-core/src/ast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ export interface ForRenderListExpression extends CallExpression {
578578
}
579579

580580
export interface ForIteratorExpression extends FunctionExpression {
581-
returns: BlockCodegenNode
581+
returns?: BlockCodegenNode
582582
}
583583

584584
// AST Utilities ---------------------------------------------------------------

packages/compiler-core/src/babelUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export function walkIdentifiers(
5353
}
5454
} else if (
5555
node.type === 'ObjectProperty' &&
56+
// eslint-disable-next-line no-restricted-syntax
5657
parent?.type === 'ObjectPattern'
5758
) {
5859
// mark property in destructure pattern
@@ -407,6 +408,7 @@ function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean {
407408
// no: export { NODE as foo } from "foo";
408409
case 'ExportSpecifier':
409410
// @ts-expect-error
411+
// eslint-disable-next-line no-restricted-syntax
410412
if (grandparent?.source) {
411413
return false
412414
}

packages/compiler-core/src/compat/transformFilter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ function parseFilter(node: SimpleExpressionNode, context: TransformContext) {
168168
expression = wrapFilter(expression, filters[i], context)
169169
}
170170
node.content = expression
171+
// reset ast since the content is replaced
172+
node.ast = undefined
171173
}
172174
}
173175

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ export function getConstantType(
174174
if (
175175
codegenNode.isBlock &&
176176
node.tag !== 'svg' &&
177-
node.tag !== 'foreignObject'
177+
node.tag !== 'foreignObject' &&
178+
node.tag !== 'math'
178179
) {
179180
return ConstantTypes.NOT_CONSTANT
180181
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const transformElement: NodeTransform = (node, context) => {
117117
// updates inside get proper isSVG flag at runtime. (#639, #643)
118118
// This is technically web-specific, but splitting the logic out of core
119119
// leads to too much unnecessary complexity.
120-
(tag === 'svg' || tag === 'foreignObject'))
120+
(tag === 'svg' || tag === 'foreignObject' || tag === 'math'))
121121

122122
// props
123123
if (props.length > 0) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { hasScopeRef, isMemberExpression } from '../utils'
1717
import { TO_HANDLER_KEY } from '../runtimeHelpers'
1818

1919
export const fnExpRE =
20-
/^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/
20+
/^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/
2121

2222
export interface VOnDirectiveNode extends DirectiveNode {
2323
// v-on without arg is handled directly in ./transformElements.ts due to it affecting

packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`stringify static html > should bail for <option> elements with number values 1`] = `
4+
"const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
5+
6+
const _hoisted_1 = /*#__PURE__*/_createElementVNode("select", null, [
7+
/*#__PURE__*/_createElementVNode("option", { value: 1 }),
8+
/*#__PURE__*/_createElementVNode("option", { value: 1 }),
9+
/*#__PURE__*/_createElementVNode("option", { value: 1 }),
10+
/*#__PURE__*/_createElementVNode("option", { value: 1 }),
11+
/*#__PURE__*/_createElementVNode("option", { value: 1 })
12+
], -1 /* HOISTED */)
13+
const _hoisted_2 = [
14+
_hoisted_1
15+
]
16+
17+
return function render(_ctx, _cache) {
18+
return (_openBlock(), _createElementBlock("div", null, _hoisted_2))
19+
}"
20+
`;
21+
322
exports[`stringify static html > should bail on bindings that are hoisted but not stringifiable 1`] = `
423
"const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
524
@@ -20,6 +39,19 @@ return function render(_ctx, _cache) {
2039
}"
2140
`;
2241
42+
exports[`stringify static html > should work for <option> elements with string values 1`] = `
43+
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
44+
45+
const _hoisted_1 = /*#__PURE__*/_createStaticVNode("<select><option value=\\"1\\"></option><option value=\\"1\\"></option><option value=\\"1\\"></option><option value=\\"1\\"></option><option value=\\"1\\"></option></select>", 1)
46+
const _hoisted_2 = [
47+
_hoisted_1
48+
]
49+
50+
return function render(_ctx, _cache) {
51+
return (_openBlock(), _createElementBlock("div", null, _hoisted_2))
52+
}"
53+
`;
54+
2355
exports[`stringify static html > should work with bindings that are non-static but stringifiable 1`] = `
2456
"const { createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue
2557

0 commit comments

Comments
 (0)