See dist/README.md for more details on dist files.
flow: 包含类型声明，用的是 Flow. 这些声明都是全局加载的，所以你会看到它们在源码中类型注释的使用。
src: contains the source code, obviously. The codebase is written in ES2015 with Flow type annotations.
compiler: contains code for the template-to-render-function compiler.
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.
core: contains universal, platform-agnostic runtime code.
The Vue 2.0 core is platform-agnostic - which means code inside
observer: contains code related to the reactivity system.
vdom: contains code related to vdom element creation and patching.
instance: contains Vue instance constructor and prototype methods.
global-api: as the name suggests.
components: universal abstract components. Currently
keep-aliveis the only one.
server: contains code related to server-side rendering.
platforms: contains platform-specific code.
Entry files for dist builds are located in their respective platform directory.
Each platform module contains three parts:
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
platforms/web/runtime/modules/class.js- which is imported in
entries/web-runtime.jsand used to create the browser-specific vdom patching function.
sfc: contains single-file component (
*.vuefiles) parsing logic. This is used in the
shared: contains utilities shared across the entire codebase.