Skip to content

Commit bffb1b2

Browse files
authored
Merge branch 'vuejs:main' into fix-5847
2 parents 8c750a9 + 4902354 commit bffb1b2

File tree

107 files changed

+5431
-4325
lines changed

Some content is hidden

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

107 files changed

+5431
-4325
lines changed

.github/contributing.md

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
4747
- Consider the performance / size impact of the changes, and whether the bug being fixes justifies the cost. If the bug being fixed is a very niche edge case, we should try to minimize the size / perf cost to make it worthwhile.
4848

4949
- Is the code perf-sensitive (e.g. in "hot paths" like component updates or the vdom patch function?)
50+
5051
- If the branch is dev-only, performance is less of a concern.
5152

5253
- Check how much extra bundle size the change introduces.
@@ -77,6 +78,8 @@ A high level overview of tools used:
7778

7879
**The examples below will be using the `nr` command from the [ni](https://github.com/antfu/ni) package.** You can also use plain `npm run`, but you will need to pass all additional arguments after the command after an extra `--`. For example, `nr build runtime --all` is equivalent to `npm run build -- runtime --all`.
7980

81+
The `run-s` and `run-p` commands found in some scripts are from [npm-run-all](https://github.com/mysticatea/npm-run-all) for orchestrating multiple scripts. `run-s` means "run in sequence" while `run-p` means "run in parallel".
82+
8083
### `nr build`
8184

8285
The `build` script builds all public packages (packages without `private: true` in their `package.json`).
@@ -152,9 +155,17 @@ $ nr dev
152155

153156
- The `dev` script supports the `-i` flag for inlining all deps. This is useful when debugging `esm-bundler` builds which externalizes deps by default.
154157

158+
### `nr dev-sfc`
159+
160+
Shortcut for starting the SFC Playground in local dev mode. This provides the fastest feedback loop when debugging issues that can be reproduced in the SFC Playground.
161+
162+
### `nr dev-esm`
163+
164+
Builds and watches `vue/dist/vue-runtime.esm-bundler.js` with all deps inlined using esbuild. This is useful when debugging the ESM build in a reproductions that require real build setups: link `packages/vue` globally, then link it into the project being debugged.
165+
155166
### `nr dev-compiler`
156167

157-
The `dev-compiler` script builds, watches and serves the [Template Explorer](https://github.com/vuejs/core/tree/main/packages/template-explorer) at `http://localhost:5000`. This is extremely useful when working on the compiler.
168+
The `dev-compiler` script builds, watches and serves the [Template Explorer](https://github.com/vuejs/core/tree/main/packages/template-explorer) at `http://localhost:5000`. This is useful when working on pure compiler issues.
158169

159170
### `nr test`
160171

@@ -222,27 +233,29 @@ This is made possible via several configurations:
222233

223234
### Package Dependencies
224235

225-
```
226-
+---------------------+
227-
| |
228-
| @vue/compiler-sfc |
229-
| |
230-
+-----+--------+------+
231-
| |
232-
v v
233-
+---------------------+ +----------------------+
234-
| | | |
235-
+------------>| @vue/compiler-dom +--->| @vue/compiler-core |
236-
| | | | |
237-
+----+----+ +---------------------+ +----------------------+
238-
| |
239-
| vue |
240-
| |
241-
+----+----+ +---------------------+ +----------------------+ +-------------------+
242-
| | | | | | |
243-
+------------>| @vue/runtime-dom +--->| @vue/runtime-core +--->| @vue/reactivity |
244-
| | | | | |
245-
+---------------------+ +----------------------+ +-------------------+
236+
```mermaid
237+
flowchart LR
238+
compiler-sfc["@vue/compiler-sfc"]
239+
compiler-dom["@vue/compiler-dom"]
240+
compiler-core["@vue/compiler-core"]
241+
vue["vue"]
242+
runtime-dom["@vue/runtime-dom"]
243+
runtime-core["@vue/runtime-core"]
244+
reactivity["@vue/reactivity"]
245+
246+
subgraph "Runtime Packages"
247+
runtime-dom --> runtime-core
248+
runtime-core --> reactivity
249+
end
250+
251+
subgraph "Compiler Packages"
252+
compiler-sfc --> compiler-core
253+
compiler-sfc --> compiler-dom
254+
compiler-dom --> compiler-core
255+
end
256+
257+
vue ---> compiler-dom
258+
vue --> runtime-dom
246259
```
247260

248261
There are some rules to follow when importing across package boundaries:

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
node-version: 18
2626
cache: 'pnpm'
2727

28-
- run: pnpm install
28+
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
2929

3030
- name: Run unit tests
3131
run: pnpm run test-unit
@@ -35,6 +35,12 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v3
3737

38+
- name: Setup cache for Chromium binary
39+
uses: actions/cache@v3
40+
with:
41+
path: ~/.cache/puppeteer/chrome
42+
key: chromium-${{ hashFiles('pnpm-lock.yaml') }}
43+
3844
- name: Install pnpm
3945
uses: pnpm/action-setup@v2
4046

@@ -63,13 +69,13 @@ jobs:
6369
node-version: 18
6470
cache: 'pnpm'
6571

66-
- run: pnpm install
72+
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
6773

6874
- name: Run eslint
6975
run: pnpm run lint
7076

7177
# - name: Run prettier
72-
# run: pnpm run format-check
78+
# run: pnpm run format-check
7379

7480
- name: Run type declaration tests
7581
run: pnpm run test-dts
@@ -90,7 +96,7 @@ jobs:
9096
node-version: 18
9197
cache: 'pnpm'
9298

93-
- run: pnpm install
99+
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
94100
- run: pnpm run size
95101

96102
# - name: Check build size

BACKERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h1 align="center">Sponsors &amp; Backers</h1>
22

3-
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of the awesome sponsors and backers listed in this file. If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).
3+
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of the awesome sponsors and backers listed in this file. If you'd like to join them, please consider [ sponsoring Vue's development](https://vuejs.org/sponsor/).
44

55
<p align="center">
66
<a target="_blank" href="https://sponsors.vuejs.org/backers.svg">

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Please follow the documentation at [vuejs.org](https://vuejs.org/)!
66

77
## Sponsors
88

9-
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/core/blob/main/BACKERS.md). If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).
9+
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/core/blob/main/BACKERS.md). If you'd like to join them, please consider [ sponsoring Vue's development](https://vuejs.org/sponsor/).
1010

1111
<p align="center">
1212
<h3 align="center">Special Sponsor</h3>

jest.config.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ module.exports = {
22
testEnvironment: 'jsdom',
33
preset: 'ts-jest',
44
setupFilesAfterEnv: ['./scripts/setupJestEnv.ts'],
5+
transform: {
6+
'^.+\\.tsx?$': [
7+
'ts-jest',
8+
{
9+
tsconfig: {
10+
target: 'esnext',
11+
sourceMap: true
12+
}
13+
}
14+
]
15+
},
516
globals: {
617
__DEV__: true,
718
__TEST__: true,
@@ -15,13 +26,7 @@ module.exports = {
1526
__FEATURE_OPTIONS_API__: true,
1627
__FEATURE_SUSPENSE__: true,
1728
__FEATURE_PROD_DEVTOOLS__: false,
18-
__COMPAT__: true,
19-
'ts-jest': {
20-
tsconfig: {
21-
target: 'esnext',
22-
sourceMap: true
23-
}
24-
}
29+
__COMPAT__: true
2530
},
2631
coverageDirectory: 'coverage',
2732
coverageReporters: ['html', 'lcov', 'text'],

package.json

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@
2121
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
2222
"dev-esm": "node scripts/dev.js -if esm-bundler-runtime",
2323
"dev-compiler": "run-p \"dev template-explorer\" serve",
24-
"dev-sfc": "run-p \"dev compiler-sfc -f esm-browser\" \"dev vue -if esm-bundler-runtime\" \"dev server-renderer -if esm-bundler\" serve-sfc-playground",
25-
"serve-sfc-playground": "vite packages/sfc-playground --host",
24+
"dev-sfc": "run-s dev-sfc-prepare dev-sfc-run",
25+
"dev-sfc-prepare": "node scripts/pre-dev-sfc.js || npm run build-compiler-cjs",
26+
"dev-sfc-serve": "vite packages/sfc-playground --host",
27+
"dev-sfc-run": "run-p \"dev compiler-sfc -f esm-browser\" \"dev vue -if esm-bundler-runtime\" \"dev server-renderer -if esm-bundler\" dev-sfc-serve",
2628
"serve": "serve",
2729
"open": "open http://localhost:5000/packages/template-explorer/local.html",
28-
"prebuild-sfc-playground": "node scripts/build.js compiler reactivity-transform shared -af cjs && node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime && node scripts/build.js compiler-sfc server-renderer -f esm-browser",
29-
"build-sfc-playground": "cd packages/sfc-playground && npm run build",
30+
"build-sfc-playground": "run-s build-compiler-cjs build-runtime-esm build-ssr-esm build-sfc-playground-self",
31+
"build-compiler-cjs": "node scripts/build.js compiler reactivity-transform shared -af cjs",
32+
"build-runtime-esm": "node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime",
33+
"build-ssr-esm": "node scripts/build.js compiler-sfc server-renderer -f esm-browser",
34+
"build-sfc-playground-self": "cd packages/sfc-playground && npm run build",
3035
"preinstall": "node ./scripts/preinstall.js",
3136
"postinstall": "simple-git-hooks"
3237
},
@@ -51,15 +56,16 @@
5156
"@babel/types": "^7.12.0",
5257
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
5358
"@microsoft/api-extractor": "~7.20.0",
54-
"@rollup/plugin-commonjs": "^18.0.0",
55-
"@rollup/plugin-json": "^4.0.0",
56-
"@rollup/plugin-node-resolve": "^11.2.1",
57-
"@rollup/plugin-replace": "^2.3.4",
59+
"@rollup/plugin-commonjs": "^23.0.2",
60+
"@rollup/plugin-json": "^5.0.1",
61+
"@rollup/plugin-node-resolve": "^15.0.1",
62+
"@rollup/plugin-replace": "^5.0.1",
63+
"@rollup/plugin-terser": "^0.1.0",
5864
"@types/hash-sum": "^1.0.0",
59-
"@types/jest": "^27.0.1",
65+
"@types/jest": "^29.2.2",
6066
"@types/node": "^16.4.7",
61-
"@types/puppeteer": "^5.0.0",
6267
"@typescript-eslint/parser": "^5.23.0",
68+
"@vue/consolidate": "0.17.3",
6369
"@vue/reactivity": "workspace:*",
6470
"@vue/runtime-core": "workspace:*",
6571
"@vue/runtime-dom": "workspace:*",
@@ -68,31 +74,32 @@
6874
"conventional-changelog-cli": "^2.0.31",
6975
"csstype": "^3.0.3",
7076
"enquirer": "^2.3.2",
71-
"esbuild": "^0.14.35",
77+
"esbuild": "^0.15.13",
7278
"eslint": "^7.7.0",
7379
"eslint-plugin-jest": "26.1.5",
7480
"execa": "^4.0.2",
7581
"fs-extra": "^9.0.1",
76-
"jest": "^27.1.0",
82+
"jest": "^29.3.1",
83+
"jest-environment-jsdom": "^29.3.1",
7784
"lint-staged": "^10.2.10",
7885
"lodash": "^4.17.15",
7986
"marked": "^4.0.10",
8087
"minimist": "^1.2.0",
8188
"npm-run-all": "^4.1.5",
8289
"prettier": "^2.7.1",
83-
"puppeteer": "^10.0.0",
84-
"rollup": "~2.38.5",
90+
"pug": "^3.0.1",
91+
"puppeteer": "^19.2.2",
92+
"rollup": "~3.2.3",
8593
"rollup-plugin-node-builtins": "^2.1.2",
8694
"rollup-plugin-node-globals": "^1.4.0",
87-
"rollup-plugin-polyfill-node": "^0.6.2",
88-
"rollup-plugin-terser": "^7.0.2",
89-
"rollup-plugin-typescript2": "^0.27.2",
95+
"rollup-plugin-polyfill-node": "^0.11.0",
96+
"rollup-plugin-typescript2": "^0.34.1",
9097
"semver": "^7.3.2",
9198
"serve": "^12.0.0",
92-
"terser": "^5.15.1",
9399
"simple-git-hooks": "^2.8.1",
100+
"terser": "^5.15.1",
94101
"todomvc-app-css": "^2.3.0",
95-
"ts-jest": "^27.0.5",
102+
"ts-jest": "^29.0.3",
96103
"tslib": "^2.4.0",
97104
"typescript": "^4.8.0",
98105
"vite": "^3.0.0",

packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ exports[`compiler: codegen Element (callExpression + objectExpression + Template
4848
"
4949
return function render(_ctx, _cache) {
5050
with (_ctx) {
51-
return _createElementVNode(\\"div\\", {
52-
id: \\"foo\\",
51+
return _createElementVNode("div", {
52+
id: "foo",
5353
[prop]: bar,
5454
[foo + bar]: bar
5555
}, [
56-
_createElementVNode(\\"p\\", { \\"some-key\\": \\"foo\\" })
56+
_createElementVNode("p", { "some-key": "foo" })
5757
], 16)
5858
}
5959
}"
@@ -63,12 +63,12 @@ exports[`compiler: codegen assets + temps 1`] = `
6363
"
6464
return function render(_ctx, _cache) {
6565
with (_ctx) {
66-
const _component_Foo = _resolveComponent(\\"Foo\\")
67-
const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
68-
const _component_barbaz = _resolveComponent(\\"barbaz\\")
69-
const _component_Qux = _resolveComponent(\\"Qux\\", true)
70-
const _directive_my_dir_0 = _resolveDirective(\\"my_dir_0\\")
71-
const _directive_my_dir_1 = _resolveDirective(\\"my_dir_1\\")
66+
const _component_Foo = _resolveComponent("Foo")
67+
const _component_bar_baz = _resolveComponent("bar-baz")
68+
const _component_barbaz = _resolveComponent("barbaz")
69+
const _component_Qux = _resolveComponent("Qux", true)
70+
const _directive_my_dir_0 = _resolveDirective("my_dir_0")
71+
const _directive_my_dir_1 = _resolveDirective("my_dir_1")
7272
let _temp0, _temp1, _temp2
7373
7474
return null
@@ -80,7 +80,7 @@ exports[`compiler: codegen comment 1`] = `
8080
"
8181
return function render(_ctx, _cache) {
8282
with (_ctx) {
83-
return _createCommentVNode(\\"foo\\")
83+
return _createCommentVNode("foo")
8484
}
8585
}"
8686
`;
@@ -135,7 +135,7 @@ return function render(_ctx, _cache) {
135135
exports[`compiler: codegen hoists 1`] = `
136136
"
137137
const _hoisted_1 = hello
138-
const _hoisted_2 = { id: \\"foo\\" }
138+
const _hoisted_2 = { id: "foo" }
139139
140140
return function render(_ctx, _cache) {
141141
with (_ctx) {
@@ -165,15 +165,15 @@ return function render(_ctx, _cache) {
165165
`;
166166

167167
exports[`compiler: codegen module mode preamble 1`] = `
168-
"import { createVNode as _createVNode, resolveDirective as _resolveDirective } from \\"vue\\"
168+
"import { createVNode as _createVNode, resolveDirective as _resolveDirective } from "vue"
169169
170170
export function render(_ctx, _cache) {
171171
return null
172172
}"
173173
`;
174174

175175
exports[`compiler: codegen module mode preamble w/ optimizeImports: true 1`] = `
176-
"import { createVNode, resolveDirective } from \\"vue\\"
176+
"import { createVNode, resolveDirective } from "vue"
177177
178178
// Binding optimization for webpack code-split
179179
const _createVNode = createVNode, _resolveDirective = resolveDirective
@@ -187,7 +187,7 @@ exports[`compiler: codegen static text 1`] = `
187187
"
188188
return function render(_ctx, _cache) {
189189
with (_ctx) {
190-
return \\"hello\\"
190+
return "hello"
191191
}
192192
}"
193193
`;

0 commit comments

Comments
 (0)