Skip to content

Commit 10119f9

Browse files
committed
docs: add architecture introduction
1 parent 9612282 commit 10119f9

File tree

8 files changed

+44
-8
lines changed

8 files changed

+44
-8
lines changed

docs/.vuepress/configs/navbar/en.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ export const en: NavbarConfig = [
5353
{
5454
text: 'Advanced',
5555
children: [
56-
'/guide/advanced/markdown.md',
57-
'/guide/advanced/theme.md',
56+
'/guide/advanced/architecture.md',
5857
'/guide/advanced/plugin.md',
58+
'/guide/advanced/theme.md',
59+
'/guide/advanced/markdown.md',
5960
],
6061
},
6162
{

docs/.vuepress/configs/navbar/zh.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ export const zh: NavbarConfig = [
5050
{
5151
text: '深入',
5252
children: [
53-
'/zh/guide/advanced/markdown.md',
54-
'/zh/guide/advanced/theme.md',
53+
'/zh/guide/advanced/architecture.md',
5554
'/zh/guide/advanced/plugin.md',
55+
'/zh/guide/advanced/theme.md',
56+
'/zh/guide/advanced/markdown.md',
5657
],
5758
},
5859
{

docs/.vuepress/configs/sidebar/en.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ export const en: SidebarConfig = {
2525
isGroup: true,
2626
text: 'Advanced',
2727
children: [
28-
'/guide/advanced/markdown.md',
29-
'/guide/advanced/theme.md',
28+
'/guide/advanced/architecture.md',
3029
'/guide/advanced/plugin.md',
30+
'/guide/advanced/theme.md',
31+
'/guide/advanced/markdown.md',
3132
],
3233
},
3334
],

docs/.vuepress/configs/sidebar/zh.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ export const zh: SidebarConfig = {
2525
isGroup: true,
2626
text: '深入',
2727
children: [
28-
'/zh/guide/advanced/markdown.md',
29-
'/zh/guide/advanced/theme.md',
28+
'/zh/guide/advanced/architecture.md',
3029
'/zh/guide/advanced/plugin.md',
30+
'/zh/guide/advanced/theme.md',
31+
'/zh/guide/advanced/markdown.md',
3132
],
3233
},
3334
],
Loading
Loading

docs/guide/advanced/architecture.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Architecture
2+
3+
## Overview
4+
5+
![vuepress-architecture-overview](/images/guide/vuepress-architecture-overview.png)
6+
7+
The above figure shows a brief overview of the VuePress architecture:
8+
9+
- Node App will generate temp files, including the layouts, pages, routes, etc.
10+
- Bundler will handle Client App together with the temp files, just like a common Vue SPA.
11+
12+
As a developer, you must be aware of that VuePress has two main parts: **Node App** and **Client App**, which is important when developing plugins and themes:
13+
14+
- The entry file of a plugin or a theme will be loaded in Node App. So you need to use CommonJS format for them.
15+
- Client files will be loaded in Client App, which will be handled by bundler. For example, layouts, components, app setup files, app enhance files, etc. You'd better use ESM format for them.
16+
17+
## Core Process and Hooks
18+
19+
![vuepress-core-process](/images/guide/vuepress-core-process.png)
20+
21+
The above figure shows the core process of VuePress Node App and the hooks of [Plugin API](../../reference/plugin-api.md):
22+
23+
- In the **init** stage:
24+
- Theme and plugins will be loaded. That means all the plugins should be used before initialization.
25+
- Page files will be loaded. As we are using markdown-it to parse the markdown file, the [extendsMarkdown](../../reference/plugin-api.md#extendsmarkdown) hook will be processed before that.
26+
- In the **prepare** stage:
27+
- Temp files will be generated, so all hooks related to client files will be processed here.
28+
- In the **dev / build** stage:
29+
- Bundler will be resolved. The [alias](../../reference/plugin-api.md#alias) and [define](../../reference/plugin-api.md#define) hooks depend on bundler configuration, so they will be processed here.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 架构
2+
3+
> TODO

0 commit comments

Comments
 (0)