Skip to content

Commit e79ad7d

Browse files
committed
Merge branch 'main' into feat/app-effect-scope
# Conflicts: # packages/runtime-core/__tests__/apiCreateApp.spec.ts
2 parents ce6dbfa + f66a75e commit e79ad7d

File tree

141 files changed

+4829
-2951
lines changed

Some content is hidden

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

141 files changed

+4829
-2951
lines changed

.eslintrc.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
plugins: ['jest', 'import', '@typescript-eslint'],
2020
rules: {
2121
'no-debugger': 'error',
22+
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
2223
// most of the codebase are expected to be env agnostic
2324
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
2425

@@ -58,6 +59,7 @@ module.exports = {
5859
{
5960
files: ['**/__tests__/**', 'packages/dts-test/**'],
6061
rules: {
62+
'no-console': 'off',
6163
'no-restricted-globals': 'off',
6264
'no-restricted-syntax': 'off',
6365
'jest/no-disabled-tests': 'error',
@@ -92,6 +94,7 @@ module.exports = {
9294
rules: {
9395
'no-restricted-globals': ['error', ...NodeGlobals],
9496
'no-restricted-syntax': ['error', banConstEnum],
97+
'no-console': 'off',
9598
},
9699
},
97100
// JavaScript files
@@ -113,6 +116,7 @@ module.exports = {
113116
rules: {
114117
'no-restricted-globals': 'off',
115118
'no-restricted-syntax': ['error', banConstEnum],
119+
'no-console': 'off',
116120
},
117121
},
118122
// Import nodejs modules in compiler-sfc

.github/renovate.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,13 @@
4646

4747
// ESM only
4848
'estree-walker',
49+
50+
// pinned
51+
// https://github.com/vuejs/core/issues/10300#issuecomment-1940855364
52+
'lru-cache',
53+
54+
// pinned
55+
// https://github.com/vuejs/core/commit/a012e39b373f1b6918e5c89856e8f902e1bfa14d
56+
'@rollup/plugin-replace',
4957
],
5058
}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- uses: actions/checkout@v4
6666

6767
- name: Setup cache for Chromium binary
68-
uses: actions/cache@v3
68+
uses: actions/cache@v4
6969
with:
7070
path: ~/.cache/puppeteer
7171
key: chromium-${{ hashFiles('pnpm-lock.yaml') }}

.github/workflows/size-data.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- run: pnpm run size
3737

3838
- name: Upload Size Data
39-
uses: actions/upload-artifact@v3
39+
uses: actions/upload-artifact@v4
4040
with:
4141
name: size-data
4242
path: temp/size
@@ -45,7 +45,7 @@ jobs:
4545
if: ${{github.event_name == 'pull_request'}}
4646
run: echo ${{ github.event.number }} > ./pr.txt
4747

48-
- uses: actions/upload-artifact@v3
48+
- uses: actions/upload-artifact@v4
4949
if: ${{github.event_name == 'pull_request'}}
5050
with:
5151
name: pr-number

.github/workflows/size-report.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: pnpm install
3737

3838
- name: Download PR number
39-
uses: dawidd6/action-download-artifact@v2
39+
uses: dawidd6/action-download-artifact@v3
4040
with:
4141
name: pr-number
4242
run_id: ${{ github.event.workflow_run.id }}
@@ -48,14 +48,14 @@ jobs:
4848
path: ./pr.txt
4949

5050
- name: Download Size Data
51-
uses: dawidd6/action-download-artifact@v2
51+
uses: dawidd6/action-download-artifact@v3
5252
with:
5353
name: size-data
5454
run_id: ${{ github.event.workflow_run.id }}
5555
path: temp/size
5656

5757
- name: Download Previous Size Data
58-
uses: dawidd6/action-download-artifact@v2
58+
uses: dawidd6/action-download-artifact@v3
5959
with:
6060
branch: main
6161
workflow: size-data.yml

CHANGELOG.md

Lines changed: 281 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018-present, Yuxi (Evan) You
3+
Copyright (c) 2018-present, Yuxi (Evan) You and Vue contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

changelogs/CHANGELOG-3.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ may cause build issues in projects still using TS 3.x.
773773
- **types:** adjust type exports for manual render function and tooling usage ([e4dc03a](https://github.com/vuejs/core/commit/e4dc03a8b17d5e9f167de6a62a645878ac7ef3e2)), closes [#1329](https://github.com/vuejs/core/issues/1329)
774774
- **types:** mixins/extends support in TypeScript ([#626](https://github.com/vuejs/core/issues/626)) ([d3c436a](https://github.com/vuejs/core/commit/d3c436ae2e66b75b7f2ed574dadda3f0e1fdce73))
775775
- **types:** support typing directive value via generic argument ([#1007](https://github.com/vuejs/core/issues/1007)) ([419b86d](https://github.com/vuejs/core/commit/419b86d1908f2a0521e6a7eafcbee764e9ee59a0)), closes [#998](https://github.com/vuejs/core/issues/998)
776-
- **types:** update to Typescript 3.9 ([#1106](https://github.com/vuejs/core/issues/1106)) ([97dedeb](https://github.com/vuejs/core/commit/97dedebd8097116a16209664a1ca38392b964da3))
776+
- **types:** update to TypeScript 3.9 ([#1106](https://github.com/vuejs/core/issues/1106)) ([97dedeb](https://github.com/vuejs/core/commit/97dedebd8097116a16209664a1ca38392b964da3))
777777

778778
### Performance Improvements
779779

package.json

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
3-
"version": "3.4.0",
4-
"packageManager": "pnpm@8.12.1",
3+
"version": "3.4.21",
4+
"packageManager": "pnpm@8.15.4",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -59,60 +59,60 @@
5959
"node": ">=18.12.0"
6060
},
6161
"devDependencies": {
62-
"@babel/parser": "^7.23.6",
63-
"@babel/types": "^7.23.6",
62+
"@babel/parser": "^7.23.9",
63+
"@babel/types": "^7.23.9",
6464
"@codspeed/vitest-plugin": "^2.3.1",
65-
"@rollup/plugin-alias": "^5.0.1",
65+
"@rollup/plugin-alias": "^5.1.0",
6666
"@rollup/plugin-commonjs": "^25.0.7",
67-
"@rollup/plugin-json": "^6.0.1",
67+
"@rollup/plugin-json": "^6.1.0",
6868
"@rollup/plugin-node-resolve": "^15.2.3",
69-
"@rollup/plugin-replace": "^5.0.4",
69+
"@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.10.5",
74-
"@types/semver": "^7.5.5",
75-
"@typescript-eslint/eslint-plugin": "^6.16.0",
76-
"@typescript-eslint/parser": "^6.15.0",
77-
"@vitest/coverage-istanbul": "^1.1.0",
78-
"@vue/consolidate": "0.17.3",
73+
"@types/node": "^20.11.20",
74+
"@types/semver": "^7.5.8",
75+
"@typescript-eslint/eslint-plugin": "^7.0.2",
76+
"@typescript-eslint/parser": "^7.0.2",
77+
"@vitest/coverage-istanbul": "^1.3.1",
78+
"@vue/consolidate": "1.0.0",
7979
"conventional-changelog-cli": "^4.1.0",
8080
"enquirer": "^2.4.1",
81-
"esbuild": "^0.19.5",
81+
"esbuild": "^0.20.1",
8282
"esbuild-plugin-polyfill-node": "^0.3.0",
83-
"eslint": "^8.56.0",
84-
"eslint-define-config": "^1.24.1",
83+
"eslint": "^8.57.0",
84+
"eslint-define-config": "^2.1.0",
8585
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
86-
"eslint-plugin-jest": "^27.6.0",
86+
"eslint-plugin-jest": "^27.9.0",
8787
"estree-walker": "^2.0.2",
8888
"execa": "^8.0.1",
89-
"jsdom": "^23.0.1",
90-
"lint-staged": "^15.2.0",
89+
"jsdom": "^24.0.0",
90+
"lint-staged": "^15.2.2",
9191
"lodash": "^4.17.21",
92-
"magic-string": "^0.30.5",
92+
"magic-string": "^0.30.7",
9393
"markdown-table": "^3.0.3",
94-
"marked": "^11.1.0",
94+
"marked": "^12.0.0",
9595
"minimist": "^1.2.8",
96-
"npm-run-all": "^4.1.5",
96+
"npm-run-all2": "^6.1.2",
9797
"picocolors": "^1.0.0",
98-
"prettier": "^3.1.1",
98+
"prettier": "^3.2.5",
9999
"pretty-bytes": "^6.1.1",
100100
"pug": "^3.0.2",
101-
"puppeteer": "~21.6.1",
101+
"puppeteer": "~22.2.0",
102102
"rimraf": "^5.0.5",
103-
"rollup": "^4.1.4",
103+
"rollup": "^4.12.0",
104104
"rollup-plugin-dts": "^6.1.0",
105-
"rollup-plugin-esbuild": "^6.1.0",
106-
"rollup-plugin-polyfill-node": "^0.12.0",
107-
"semver": "^7.5.4",
105+
"rollup-plugin-esbuild": "^6.1.1",
106+
"rollup-plugin-polyfill-node": "^0.13.0",
107+
"semver": "^7.6.0",
108108
"serve": "^14.2.1",
109109
"simple-git-hooks": "^2.9.0",
110-
"terser": "^5.22.0",
110+
"terser": "^5.28.1",
111111
"todomvc-app-css": "^2.4.3",
112112
"tslib": "^2.6.2",
113-
"tsx": "^4.7.0",
113+
"tsx": "^4.7.1",
114114
"typescript": "^5.2.2",
115-
"vite": "^5.0.5",
116-
"vitest": "^1.1.0"
115+
"vite": "^5.1.4",
116+
"vitest": "^1.3.1"
117117
}
118118
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,20 @@ describe('compiler: transform <slot> outlets', () => {
389389
},
390390
})
391391
})
392+
393+
test('dynamically named slot outlet with v-bind shorthand', () => {
394+
const ast = parseWithSlots(`<slot :name />`)
395+
expect((ast.children[0] as ElementNode).codegenNode).toMatchObject({
396+
type: NodeTypes.JS_CALL_EXPRESSION,
397+
callee: RENDER_SLOT,
398+
arguments: [
399+
`$slots`,
400+
{
401+
type: NodeTypes.SIMPLE_EXPRESSION,
402+
content: `name`,
403+
isStatic: false,
404+
},
405+
],
406+
})
407+
})
392408
})

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,4 +408,22 @@ describe('compiler: transform v-bind', () => {
408408
},
409409
})
410410
})
411+
412+
test('error on invalid argument for same-name shorthand', () => {
413+
const onError = vi.fn()
414+
parseWithVBind(`<div v-bind:[arg] />`, { onError })
415+
expect(onError.mock.calls[0][0]).toMatchObject({
416+
code: ErrorCodes.X_V_BIND_INVALID_SAME_NAME_ARGUMENT,
417+
loc: {
418+
start: {
419+
line: 1,
420+
column: 13,
421+
},
422+
end: {
423+
line: 1,
424+
column: 18,
425+
},
426+
},
427+
})
428+
})
411429
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ describe('compiler: transform v-on', () => {
271271
})
272272
})
273273

274-
test('should NOT wrap as function if expression is already function expression (with Typescript)', () => {
274+
test('should NOT wrap as function if expression is already function expression (with TypeScript)', () => {
275275
const { node } = parseWithVOn(`<div @click="(e: any): any => foo(e)"/>`)
276276
expect((node.codegenNode as VNodeCall).props).toMatchObject({
277277
properties: [

packages/compiler-core/package.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.4.0",
3+
"version": "3.4.21",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",
@@ -9,6 +9,20 @@
99
"index.js",
1010
"dist"
1111
],
12+
"exports": {
13+
".": {
14+
"types": "./dist/compiler-core.d.ts",
15+
"node": {
16+
"production": "./dist/compiler-core.cjs.prod.js",
17+
"development": "./dist/compiler-core.cjs.js",
18+
"default": "./index.js"
19+
},
20+
"module": "./dist/compiler-core.esm-bundler.js",
21+
"import": "./dist/compiler-core.esm-bundler.js",
22+
"require": "./index.js"
23+
},
24+
"./*": "./*"
25+
},
1226
"buildOptions": {
1327
"name": "VueCompilerCore",
1428
"compat": true,
@@ -32,13 +46,13 @@
3246
},
3347
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
3448
"dependencies": {
35-
"@babel/parser": "^7.23.6",
49+
"@babel/parser": "^7.23.9",
3650
"@vue/shared": "workspace:*",
3751
"entities": "^4.5.0",
3852
"estree-walker": "^2.0.2",
3953
"source-map-js": "^1.0.2"
4054
},
4155
"devDependencies": {
42-
"@babel/types": "^7.23.6"
56+
"@babel/types": "^7.23.9"
4357
}
4458
}

packages/compiler-core/src/babelUtils.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function walkIdentifiers(
5050
}
5151
} else if (
5252
node.type === 'ObjectProperty' &&
53-
parent!.type === 'ObjectPattern'
53+
parent?.type === 'ObjectPattern'
5454
) {
5555
// mark property in destructure pattern
5656
;(node as any).inPattern = true
@@ -146,6 +146,19 @@ export function isInDestructureAssignment(
146146
return false
147147
}
148148

149+
export function isInNewExpression(parentStack: Node[]): boolean {
150+
let i = parentStack.length
151+
while (i--) {
152+
const p = parentStack[i]
153+
if (p.type === 'NewExpression') {
154+
return true
155+
} else if (p.type !== 'MemberExpression') {
156+
break
157+
}
158+
}
159+
return false
160+
}
161+
149162
export function walkFunctionParams(
150163
node: Function,
151164
onIdent: (id: Identifier) => void,

packages/compiler-core/src/errors.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function createCompilerError<T extends number>(
3030
const msg =
3131
__DEV__ || !__BROWSER__
3232
? (messages || errorMessages)[code] + (additionalMessage || ``)
33-
: `https://vuejs.org/errors/#compiler-${code}`
33+
: `https://vuejs.org/error-reference/#compiler-${code}`
3434
const error = new SyntaxError(String(msg)) as InferCompilerError<T>
3535
error.code = code
3636
error.loc = loc
@@ -98,6 +98,10 @@ export enum ErrorCodes {
9898
X_SCOPE_ID_NOT_SUPPORTED,
9999
X_VNODE_HOOKS,
100100

101+
// placed here to preserve order for the current minor
102+
// TODO adjust order in 3.5
103+
X_V_BIND_INVALID_SAME_NAME_ARGUMENT,
104+
101105
// Special value for higher-order compilers to pick up the last code
102106
// to avoid collision of error codes. This should always be kept as the last
103107
// item.
@@ -156,6 +160,7 @@ export const errorMessages: Record<ErrorCodes, string> = {
156160
[ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION]: `v-for has invalid expression.`,
157161
[ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT]: `<template v-for> key should be placed on the <template> tag.`,
158162
[ErrorCodes.X_V_BIND_NO_EXPRESSION]: `v-bind is missing expression.`,
163+
[ErrorCodes.X_V_BIND_INVALID_SAME_NAME_ARGUMENT]: `v-bind with same-name shorthand only allows static argument.`,
159164
[ErrorCodes.X_V_ON_NO_EXPRESSION]: `v-on is missing expression.`,
160165
[ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET]: `Unexpected custom directive on <slot> outlet.`,
161166
[ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE]:

packages/compiler-core/src/parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ function onCloseTag(el: ElementNode, end: number, isImplied = false) {
692692
}
693693

694694
if (
695+
!tokenizer.inSFCRoot &&
695696
isCompatEnabled(
696697
CompilerDeprecationTypes.COMPILER_NATIVE_TEMPLATE,
697698
currentOptions,

0 commit comments

Comments
 (0)