Skip to content

Commit a6d0e05

Browse files
committed
update project structure guide (close vuejs#5465)
1 parent 914879f commit a6d0e05

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/CONTRIBUTING.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,16 @@ The default test script will do the following: lint with ESLint -> type check wi
7373

7474
## Project Structure
7575

76-
- **`build`**: contains build-related configuration files. In most cases you don't need to touch them.
76+
- **`build`**: contains build-related configuration files. In most cases you don't need to touch them. However, it would be helpful to familiarize yourself with the following files:
77+
78+
- `build/alias.js`: module import aliases used across all source code and tests.
79+
80+
- `build/config.js`: contains the build configurations for all files found in `dist/`. Check this file if you want to find out the entry source file for a dist file.
7781

7882
- **`dist`**: contains built files for distribution. Note this directory is only updated when a release happens; they do not reflect the latest changes in development branches.
7983

84+
See [dist/README.md](https://github.com/vuejs/vue/blob/dev/dist/README.md) for more details on dist files.
85+
8086
- **`flow`**: contains type declarations for [Flow](https://flowtype.org/). These declarations are loaded **globally** and you will see them used in type annotations in normal source code.
8187

8288
- **`packages`**: contains `vue-server-renderer` and `vue-template-compiler`, which are distributed as separate NPM packages. They are automatically generated from the source code and always have the same version with the main `vue` package.
@@ -85,16 +91,6 @@ The default test script will do the following: lint with ESLint -> type check wi
8591

8692
- **`src`**: contains the source code, obviously. The codebase is written in ES2015 with [Flow](https://flowtype.org/) type annotations.
8793

88-
- **`entries`**: contains entries for different builds and packages.
89-
90-
- **`web-runtime`**: the entry for `dist/vue.common.js`, a.k.a the runtime-only build. It does not include the template to render function compiler, so it does not support the `template` option. **This is set as the `main` field in `package.json` so it is the default export when you import Vue as an NPM package.**
91-
92-
- **`web-runtime-with-compiler`**: the entry for `dist/vue.js`, a.k.a the standalone build. It includes the template to render function compiler. To use this build from the NPM packages, do `import Vue from 'vue/dist/vue'`, or alias `vue` to `vue/dist/vue` in your build tool configuration.
93-
94-
- **`web-compiler.js`**: the entry for the `vue-template-compiler` NPM package.
95-
96-
- **`web-server-renderer.js`**: the entry for the `vue-server-renderer` NPM package.
97-
9894
- **`compiler`**: contains code for the template-to-render-function compiler.
9995

10096
The compiler consists of a parser (converts template strings to element ASTs), an optimizer (detects static trees for vdom render optimization), and a code generator (generate render function code from element ASTs). Note the codegen directly generates code strings from the element AST - it's done this way for smaller code size because the compiler is shipped to the browser in the standalone build.
@@ -117,6 +113,8 @@ The default test script will do the following: lint with ESLint -> type check wi
117113

118114
- **`platforms`**: contains platform-specific code.
119115

116+
Entry files for dist builds are located in their respective platform directory.
117+
120118
Each platform module contains three parts: `compiler`, `runtime` and `server`, corresponding to the three directories above. Each part contains platform-specific modules/utilities which are then imported and injected to the core counterparts in platform-specific entry files. For example, the code implementing the logic behind `v-bind:class` is in `platforms/web/runtime/modules/class.js` - which is imported in `entries/web-runtime.js` and used to create the browser-specific vdom patching function.
121119

122120
- **`sfc`**: contains single-file component (`*.vue` files) parsing logic. This is used in the `vue-template-compiler` package.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy