Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 597eae4

Browse files
committed
Merge remote-tracking branch 'upstream/minor'
2 parents 9d3abcf + 317b783 commit 597eae4

File tree

105 files changed

+3424
-890
lines changed

Some content is hidden

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

105 files changed

+3424
-890
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,28 @@ jobs:
6060

6161
- name: Run type declaration tests
6262
run: pnpm run test-dts
63+
64+
# benchmarks:
65+
# runs-on: ubuntu-latest
66+
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
67+
# env:
68+
# PUPPETEER_SKIP_DOWNLOAD: 'true'
69+
# steps:
70+
# - uses: actions/checkout@v4
71+
72+
# - name: Install pnpm
73+
# uses: pnpm/action-setup@v2
74+
75+
# - name: Install Node.js
76+
# uses: actions/setup-node@v4
77+
# with:
78+
# node-version-file: '.node-version'
79+
# cache: 'pnpm'
80+
81+
# - run: pnpm install
82+
83+
# - name: Run benchmarks
84+
# uses: CodSpeedHQ/action@v2
85+
# with:
86+
# run: pnpm vitest bench --run
87+
# token: ${{ secrets.CODSPEED_TOKEN }}

CHANGELOG.md

Lines changed: 76 additions & 44 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"version": "0.0.0-vapor",
4-
"packageManager": "pnpm@8.11.0",
4+
"packageManager": "pnpm@8.12.0",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js vue vue-vapor",
@@ -22,6 +22,7 @@
2222
"test-dts": "run-s build-dts test-dts-only",
2323
"test-dts-only": "tsc -p ./packages/dts-test/tsconfig.test.json",
2424
"test-coverage": "vitest -c vitest.unit.config.ts --coverage",
25+
"test-bench": "vitest bench",
2526
"release": "node scripts/release.js",
2627
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
2728
"dev-esm": "node scripts/dev.js -if esm-bundler-runtime",
@@ -61,6 +62,7 @@
6162
"devDependencies": {
6263
"@babel/parser": "^7.23.5",
6364
"@babel/types": "^7.23.5",
65+
"@codspeed/vitest-plugin": "^2.3.1",
6466
"@rollup/plugin-alias": "^5.0.1",
6567
"@rollup/plugin-commonjs": "^25.0.7",
6668
"@rollup/plugin-json": "^6.0.1",
@@ -69,33 +71,33 @@
6971
"@rollup/plugin-terser": "^0.4.4",
7072
"@types/hash-sum": "^1.0.2",
7173
"@types/minimist": "^1.2.5",
72-
"@types/node": "^20.10.3",
74+
"@types/node": "^20.10.4",
7375
"@types/semver": "^7.5.5",
74-
"@typescript-eslint/parser": "^6.13.0",
75-
"@vitest/coverage-istanbul": "^0.34.6",
76+
"@typescript-eslint/parser": "^6.13.2",
77+
"@vitest/coverage-istanbul": "^1.0.4",
7678
"@vue/consolidate": "0.17.3",
7779
"conventional-changelog-cli": "^4.1.0",
7880
"enquirer": "^2.4.1",
7981
"esbuild": "^0.19.5",
8082
"esbuild-plugin-polyfill-node": "^0.3.0",
81-
"eslint": "^8.54.0",
83+
"eslint": "^8.55.0",
8284
"eslint-define-config": "^1.24.1",
8385
"eslint-plugin-jest": "^27.6.0",
8486
"estree-walker": "^2.0.2",
8587
"execa": "^8.0.1",
86-
"jsdom": "^22.1.0",
87-
"lint-staged": "^15.1.0",
88+
"jsdom": "^23.0.1",
89+
"lint-staged": "^15.2.0",
8890
"lodash": "^4.17.21",
8991
"magic-string": "^0.30.5",
9092
"markdown-table": "^3.0.3",
91-
"marked": "^9.1.6",
93+
"marked": "^11.0.1",
9294
"minimist": "^1.2.8",
9395
"npm-run-all": "^4.1.5",
9496
"picocolors": "^1.0.0",
95-
"prettier": "^3.1.0",
97+
"prettier": "^3.1.1",
9698
"pretty-bytes": "^6.1.1",
9799
"pug": "^3.0.2",
98-
"puppeteer": "~21.5.2",
100+
"puppeteer": "~21.6.0",
99101
"rimraf": "^5.0.5",
100102
"rollup": "^4.1.4",
101103
"rollup-plugin-dts": "^6.1.0",
@@ -109,7 +111,7 @@
109111
"tslib": "^2.6.2",
110112
"tsx": "^4.6.2",
111113
"typescript": "^5.2.2",
112-
"vite": "^5.0.0",
113-
"vitest": "^1.0.0"
114+
"vite": "^5.0.5",
115+
"vitest": "^1.0.4"
114116
}
115117
}

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,26 @@ describe('compiler: transform', () => {
201201
expect((ast as any).children[1].props[0].exp.content).toBe(`_hoisted_2`)
202202
})
203203

204+
test('context.filename and selfName', () => {
205+
const ast = baseParse(`<div />`)
206+
207+
const calls: any[] = []
208+
const plugin: NodeTransform = (node, context) => {
209+
calls.push({ ...context })
210+
}
211+
212+
transform(ast, {
213+
filename: '/the/fileName.vue',
214+
nodeTransforms: [plugin]
215+
})
216+
217+
expect(calls.length).toBe(2)
218+
expect(calls[1]).toMatchObject({
219+
filename: '/the/fileName.vue',
220+
selfName: 'FileName'
221+
})
222+
})
223+
204224
test('onError option', () => {
205225
const ast = baseParse(`<div/>`)
206226
const loc = ast.children[0].loc

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.4.0-alpha.4",
3+
"version": "3.4.0-beta.3",
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,3 +441,11 @@ export const TS_NODE_TYPES = [
441441
'TSInstantiationExpression', // foo<string>
442442
'TSSatisfiesExpression' // foo satisfies T
443443
]
444+
445+
export function unwrapTSNode(node: Node): Node {
446+
if (TS_NODE_TYPES.includes(node.type)) {
447+
return unwrapTSNode((node as any).expression)
448+
} else {
449+
return node
450+
}
451+
}

packages/compiler-core/src/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ export enum ErrorCodes {
9090
X_V_MODEL_ON_PROPS,
9191
X_INVALID_EXPRESSION,
9292
X_KEEP_ALIVE_INVALID_CHILDREN,
93-
X_VNODE_HOOKS,
9493

9594
// generic errors
9695
X_PREFIX_ID_NOT_SUPPORTED,
9796
X_MODULE_MODE_NOT_SUPPORTED,
9897
X_CACHE_HANDLER_NOT_SUPPORTED,
9998
X_SCOPE_ID_NOT_SUPPORTED,
99+
X_VNODE_HOOKS,
100100

101101
// Special value for higher-order compilers to pick up the last code
102102
// to avoid collision of error codes. This should always be kept as the last
@@ -173,7 +173,7 @@ export const errorMessages: Record<ErrorCodes, string> = {
173173
[ErrorCodes.X_V_MODEL_ON_PROPS]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
174174
[ErrorCodes.X_INVALID_EXPRESSION]: `Error parsing JavaScript expression: `,
175175
[ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN]: `<KeepAlive> expects exactly one child component.`,
176-
[ErrorCodes.X_VNODE_HOOKS]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
176+
[ErrorCodes.X_VNODE_HOOKS]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
177177

178178
// generic errors
179179
[ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED]: `"prefixIdentifiers" option is not supported in this build of compiler.`,

packages/compiler-core/src/transform.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ export interface ImportItem {
8383
}
8484

8585
export interface TransformContext
86-
extends Required<
87-
Omit<TransformOptions, 'filename' | keyof CompilerCompatOptions>
88-
>,
86+
extends Required<Omit<TransformOptions, keyof CompilerCompatOptions>>,
8987
CompilerCompatOptions {
9088
selfName: string | null
9189
root: RootNode
@@ -153,6 +151,7 @@ export function createTransformContext(
153151
const nameMatch = filename.replace(/\?.*$/, '').match(/([^/\\]+)\.\w+$/)
154152
const context: TransformContext = {
155153
// options
154+
filename,
156155
selfName: nameMatch && capitalize(camelize(nameMatch[1])),
157156
prefixIdentifiers,
158157
hoistStatic,

packages/compiler-core/src/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { isString, isObject, NOOP } from '@vue/shared'
4040
import { PropsExpression } from './transforms/transformElement'
4141
import { parseExpression } from '@babel/parser'
4242
import { Expression } from '@babel/types'
43+
import { unwrapTSNode } from './babelUtils'
4344

4445
export const isStaticExp = (p: JSChildNode): p is SimpleExpressionNode =>
4546
p.type === NodeTypes.SIMPLE_EXPRESSION && p.isStatic
@@ -164,9 +165,7 @@ export const isMemberExpressionNode = __BROWSER__
164165
let ret: Expression = parseExpression(path, {
165166
plugins: options.expressionPlugins
166167
})
167-
if (ret.type === 'TSAsExpression' || ret.type === 'TSTypeAssertion') {
168-
ret = ret.expression
169-
}
168+
ret = unwrapTSNode(ret) as Expression
170169
return (
171170
ret.type === 'MemberExpression' ||
172171
ret.type === 'OptionalMemberExpression' ||

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

0 commit comments

Comments
 (0)