Skip to content

Commit 5ae7414

Browse files
committed
Merge remote-tracking branch 'github/master' into changing_unwrap_ref
# Conflicts: # packages/reactivity/src/ref.ts # packages/runtime-core/__tests__/apiTemplateRef.spec.ts # packages/runtime-core/src/apiWatch.ts
2 parents 9edc4fa + 8444078 commit 5ae7414

File tree

339 files changed

+26611
-8931
lines changed

Some content is hidden

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

339 files changed

+26611
-8931
lines changed

.circleci/config.yml

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,63 @@
11
version: 2
2-
jobs:
3-
build:
4-
docker:
5-
- image: vuejs/ci
62

7-
working_directory: ~/repo
3+
defaults: &defaults
4+
docker:
5+
- image: vuejs/ci
6+
7+
step_restore_cache: &restore_cache
8+
restore_cache:
9+
keys:
10+
- v1-dependencies-{{ checksum "yarn.lock" }}-1
11+
- v1-dependencies-
12+
13+
step_install_deps: &install_deps
14+
run:
15+
name: Install Dependencies
16+
command: yarn --frozen-lockfile
17+
18+
step_save_cache: &save_cache
19+
save_cache:
20+
paths:
21+
- node_modules
22+
- packages/compiler-core/node_modules
23+
- packages/compiler-sfc/node_modules
24+
- packages/vue/node_modules
25+
- ~/.cache/yarn
26+
key: v1-dependencies-{{ checksum "yarn.lock" }}-1
827

28+
jobs:
29+
test:
30+
<<: *defaults
931
steps:
1032
- checkout
33+
- *restore_cache
34+
- *install_deps
35+
- *save_cache
36+
- run: yarn ls-lint
37+
- run: yarn test --ci --runInBand
38+
39+
test-dts:
40+
<<: *defaults
41+
steps:
42+
- checkout
43+
- *restore_cache
44+
- *install_deps
45+
- *save_cache
46+
- run: yarn test-dts
1147

12-
- restore_cache:
13-
keys:
14-
- v1-dependencies-{{ checksum "yarn.lock" }}
15-
- v1-dependencies-
16-
17-
- run:
18-
name: Install Dependencies
19-
command: yarn --frozen-lockfile
20-
21-
- save_cache:
22-
paths:
23-
- node_modules
24-
- ~/.cache/yarn
25-
key: v1-dependencies-{{ checksum "yarn.lock" }}
26-
27-
- run:
28-
name: Run Tests
29-
command: yarn test --ci --runInBand
30-
31-
- run:
32-
name: Test d.ts
33-
command: yarn test-dts
34-
35-
- run:
36-
name: Check size
37-
command: yarn size
48+
check-size:
49+
<<: *defaults
50+
steps:
51+
- checkout
52+
- *restore_cache
53+
- *install_deps
54+
- *save_cache
55+
- run: yarn size
56+
57+
workflows:
58+
version: 2
59+
ci:
60+
jobs:
61+
- test
62+
- test-dts
63+
- check-size

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
open_collective: vuejs
2+
patreon: evanyou

.github/contributing.md

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
1919
- Checkout a topic branch from a base branch, e.g. `master`, and merge back against that branch.
2020

2121
- If adding a new feature:
22+
2223
- Add accompanying test case.
2324
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.
2425

2526
- If fixing bug:
27+
2628
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
2729
- Provide a detailed description of the bug in the PR. Live demo preferred.
2830
- Add appropriate test coverage if applicable. You can check the coverage of your code addition by running `yarn test --coverage`.
@@ -41,7 +43,7 @@ You will need [Node.js](http://nodejs.org) **version 10+**, and [Yarn](https://y
4143

4244
After cloning the repo, run:
4345

44-
``` bash
46+
```bash
4547
$ yarn # install the dependencies of the project
4648
```
4749

@@ -60,46 +62,72 @@ The `build` script builds all public packages (packages without `private: true`
6062

6163
Packages to build can be specified with fuzzy matching:
6264

63-
``` bash
65+
```bash
6466
# build runtime-core only
6567
yarn build runtime-core
6668

6769
# build all packages matching "runtime"
6870
yarn build runtime --all
6971
```
7072

73+
#### Build Formats
74+
7175
By default, each package will be built in multiple distribution formats as specified in the `buildOptions.formats` field in its `package.json`. These can be overwritten via the `-f` flag. The following formats are supported:
7276

73-
- **`global`**: for direct use via `<script>` in the browser. The global variable exposed is specified via the `buildOptions.name` field in a package's `package.json`.
74-
- **`esm-bundler`**: for use with bundlers like `webpack`, `rollup` and `parcel`.
75-
- **`esm`**: for usage via native ES modules imports (in browser via `<script type="module">`, or via Node.js native ES modules support in the future)
76-
- **`cjs`**: for use in Node.js via `require()`.
77+
- **`global`**:
78+
79+
- For direct use via `<script>` in the browser. The global variable exposed is specified via the `buildOptions.name` field in a package's `package.json`.
80+
- Note: global builds are not [UMD](https://github.com/umdjs/umd) builds. Instead they are built as [IIFEs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
81+
82+
- **`esm-bundler`**:
83+
84+
- Leaves prod/dev branches with `process.env.NODE_ENV` guards (to be replaced by bundler)
85+
- Does not ship a minified build (to be done together with the rest of the code after bundling)
86+
- For use with bundlers like `webpack`, `rollup` and `parcel`.
87+
- Imports dependencies (e.g. `@vue/runtime-core`, `@vue/runtime-compiler`)
88+
- Imported dependencies are also `esm-bundler` builds and will in turn import their dependencies (e.g. `@vue/runtime-core` imports `@vue/reactivity`)
89+
- This means you **can** install/import these deps without ending up with different instances of these dependencies
90+
91+
- **`esm`**:
92+
93+
- For usage via native ES modules imports (in browser via `<script type="module">`, or via Node.js native ES modules support in the future)
94+
- Inlines all dependencies - i.e. it's a single ES module with no imports from other files
95+
- This means you **must** import everything from this file and this file only to ensure you are getting the same instance of code.
96+
- Hard-coded prod/dev branches, and the prod build is pre-minified (you will have to use different paths/aliases for dev/prod)
97+
98+
- **`cjs`**:
99+
- For use in Node.js server-side rendering via `require()`.
100+
- The dev/prod files are pre-built, but are dynamically required based on `process.env.NODE_ENV` in `index.js`, which is the default entry when you do `require('vue')`.
77101

78102
For example, to build `runtime-core` with the global build only:
79103

80-
``` bash
104+
```bash
81105
yarn build runtime-core -f global
82106
```
83107

84108
Multiple formats can be specified as a comma-separated list:
85109

86-
``` bash
110+
```bash
87111
yarn build runtime-core -f esm,cjs
88112
```
89113

114+
#### Build with Source Maps
115+
116+
Use the `--sourcemap` or `-s` flag to build with source maps. Note this will make the build much slower.
117+
90118
#### Build with Type Declarations
91119

92-
The `--types` flag will generate type declarations during the build and in addition:
120+
The `--types` or `-t` flag will generate type declarations during the build and in addition:
93121

94-
- Roll the declarations into a single `.dts` file for each package;
122+
- Roll the declarations into a single `.d.ts` file for each package;
95123
- Generate an API report in `<projectRoot>/temp/<packageName>.api.md`. This report contains potential warnings emitted by [api-extractor](https://api-extractor.com/).
96-
- Generate an API model json in `<projectRoot>/temp/<packageName>.api.md`. This file can be used to generate a Markdown version of the exported APIs.
124+
- Generate an API model json in `<projectRoot>/temp/<packageName>.api.json`. This file can be used to generate a Markdown version of the exported APIs.
97125

98126
### `yarn dev`
99127

100128
The `dev` script bundles a target package (default: `vue`) in a specified format (default: `global`) in dev mode and watches for changes. This is useful when you want to load up a build in an HTML page for quick debugging:
101129

102-
``` bash
130+
```bash
103131
$ yarn dev
104132

105133
> rollup v1.19.4
@@ -110,11 +138,13 @@ $ yarn dev
110138

111139
- The `dev` script supports specifying build format via the `-f` flag just like the `build` script.
112140

141+
- The `dev` script also supports the `-s` flag for generating source maps, but it will make rebuilds slower.
142+
113143
### `yarn test`
114144

115145
The `yarn test` script simply calls the `jest` binary, so all [Jest CLI Options](https://jestjs.io/docs/en/cli) can be used. Some examples:
116146

117-
``` bash
147+
```bash
118148
# run all tests
119149
$ yarn test
120150

@@ -149,32 +179,33 @@ This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) set
149179

150180
- `compiler-dom`: Compiler with additional plugins specifically targeting the browser.
151181

182+
- `compiler-ssr`: Compiler that produces render functions optimized for server-side rendering.
183+
152184
- `template-explorer`: A development tool for debugging compiler output. You can run `yarn dev template-explorer` and open its `index.html` to get a repl of template compilation based on current source code.
153185

154186
A [live version](https://vue-next-template-explorer.netlify.com) of the template explorer is also available, which can be used for providing reproductions for compiler bugs. You can also pick the deployment for a specific commit from the [deploy logs](https://app.netlify.com/sites/vue-next-template-explorer/deploys).
155187

156-
- `shared`: **Private.** Platform-agnostic internal utilities shared across multiple packages. This package is private and not published.
188+
- `shared`: Internal utilities shared across multiple packages (especially environment-agnostic utils used by both runtime and compiler packages).
157189

158190
- `vue`: The public facing "full build" which includes both the runtime AND the compiler.
159191

160192
### Importing Packages
161193

162194
The packages can import each other directly using their package names. Note that when importing a package, the name listed in its `package.json` should be used. Most of the time the `@vue/` prefix is needed:
163195

164-
``` js
196+
```js
165197
import { h } from '@vue/runtime-core'
166198
```
167199

168200
This is made possible via several configurations:
169201

170202
- For TypeScript, `compilerOptions.path` in `tsconfig.json`
171-
- For Jest, `moduleNameMapping` in `jest.config.js`
203+
- For Jest, `moduleNameMapper` in `jest.config.js`
172204
- For plain Node.js, they are linked using [Yarn Workspaces](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/).
173205

174206
### Package Dependencies
175207

176208
```
177-
178209
+---------------------+
179210
| |
180211
| @vue/compiler-sfc |

.github/issue-template.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
IMPORTANT: Please use the following link to create a new issue:
3+
4+
https://new-issue.vuejs.org/?repo=vuejs/vue-next
5+
6+
If your issue was not created using the app above, it will be closed immediately.
7+
8+
中文用户请注意:
9+
请使用上面的链接来创建新的 issue。如果不是用上述工具创建的 issue 会被自动关闭。
10+
-->
11+
12+
<!--
13+
Love vuejs? Please consider supporting us via Patreon or OpenCollective:
14+
👉 https://www.patreon.com/evanyou
15+
👉 https://opencollective.com/vuejs/donate
16+
-->

.ls-lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ls:
2+
packages/*/{src,__tests__}:
3+
.js: kebab-case
4+
.ts: camelCase | PascalCase
5+
.d.ts: camelCase
6+
.spec.ts: camelCase | PascalCase
7+
.mock.ts: camelCase

0 commit comments

Comments
 (0)