Skip to content

Commit 79bdc88

Browse files
committed
docs: ✏️ 更新 taro 文章
1 parent d7d9a4c commit 79bdc88

File tree

6 files changed

+5
-72
lines changed

6 files changed

+5
-72
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
- [Taro 源码揭秘 - 7. Taro.request 和请求响应拦截器是如何实现的?](https://ruochuan12.github.io/taro/request/)
4242
- [Taro 源码揭秘:8. Taro 是如何使用 webpack 打包构建小程序的](https://ruochuan12.github.io/taro/webpack5-runner/)
4343
- [Taro 源码揭秘:9. Taro 是如何生成 webpack 配置进行构建小程序的?](https://ruochuan12.github.io/taro/webpack5-runner/)
44-
44+
- [Taro 源码揭秘:10. Taro 到底是怎样转换成小程序文件的?](https://ruochuan12.github.io/taro/mini-plugin/)
4545

4646
**vant 组件库源码分析系列:**
4747

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
- [Taro 源码揭秘 - 7. Taro.request 和请求响应拦截器是如何实现的?](../taro/request/)
6767
- [Taro 源码揭秘:8. Taro 是如何使用 webpack 打包构建小程序的](../taro/webpack5-runner/)
6868
- [Taro 源码揭秘:9. Taro 是如何生成 webpack 配置进行构建小程序的?](../taro/webpack5-runner/)
69+
- [Taro 源码揭秘:10. Taro 到底是怎样转换成小程序文件的?](../taro/mini-plugin/)
6970

7071
**vant 组件库源码分析系列:**
7172

docs/taro/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ TODOs
1111
- [Taro 源码揭秘:7. Taro.request 和请求响应拦截器是如何实现的?](../taro/request/)
1212
- [Taro 源码揭秘:8. Taro 是如何使用 webpack 打包构建小程序的?](../taro/webpack5/)
1313
- [Taro 源码揭秘:9. Taro 是如何生成 webpack 配置进行构建小程序的?](../taro/webpack5-runner/)
14-
- [Taro 源码揭秘:10. Taro 小程序](../taro/mini-plugin/)
14+
- [Taro 源码揭秘:10. Taro 到底是怎样转换成小程序文件的?](../taro/mini-plugin/)

docs/taro/mini-plugin/README.md

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -232,76 +232,7 @@ tap 是监听注册事件、call 是执行事件
232232
插件入口 apply 函数的执行过程如下图所示:
233233
有个大概印象即可,后文继续看具体代码实现。
234234

235-
```mermaid
236-
graph TD
237-
A[TaroMiniPlugin webpack 插件 apply 方法] --> B[初始化上下文和入口文件]
238-
B --> C{解构配置选项}
239-
C --> D[注册 run 钩子]
240-
C --> E[注册 watchRun 钩子]
241-
C --> F[注册 make 钩子]
242-
C --> G[注册 compilation 钩子]
243-
C --> H[注册 afterEmit 钩子]
244-
C --> I[应用 TaroNormalModulesPlugin]
245-
C --> J{newBlended 模式}
246-
J --> K[添加加载块插件]
247-
248-
D --> L[执行 run 方法]
249-
L --> M[应用 TaroLoadChunksPlugin]
250-
251-
E --> N[获取已修改文件]
252-
N --> O{文件有变更}
253-
O --> P[设置 isWatch 为 true]
254-
E --> Q[执行 run 方法]
255-
Q --> R{loadChunksPlugin 是否存在}
256-
R --> S[应用 TaroLoadChunksPlugin]
257-
258-
F --> T[处理依赖项]
259-
T --> U[编译独立页面]
260-
T --> V[添加依赖项到 compilation]
261-
V --> W[调用 onCompilerMake 回调]
262-
263-
G --> X[设置依赖工厂]
264-
G --> Y[插入 Taro Loader]
265-
G --> Z[注册 processAssets 钩子]
266-
Z --> AA[生成独立分包文件]
267-
Z --> AB[生成小程序文件]
268-
Z --> AC[优化小程序文件]
269-
Z --> AD[调用 modifyBuildAssets 回调]
270-
271-
H --> AE[添加 tabbar 文件到依赖中]
272-
273-
style A fill:#f9f,stroke:#333,stroke-width:4px
274-
style B fill:#bbf,stroke:#333,stroke-width:2px
275-
style C fill:#bbf,stroke:#333,stroke-width:2px
276-
style D fill:#bbf,stroke:#333,stroke-width:2px
277-
style E fill:#bbf,stroke:#333,stroke-width:2px
278-
style F fill:#bbf,stroke:#333,stroke-width:2px
279-
style G fill:#bbf,stroke:#333,stroke-width:2px
280-
style H fill:#bbf,stroke:#333,stroke-width:2px
281-
style I fill:#bbf,stroke:#333,stroke-width:2px
282-
style J fill:#bbf,stroke:#333,stroke-width:2px
283-
style K fill:#bbf,stroke:#333,stroke-width:2px
284-
style L fill:#bbf,stroke:#333,stroke-width:2px
285-
style M fill:#bbf,stroke:#333,stroke-width:2px
286-
style N fill:#bbf,stroke:#333,stroke-width:2px
287-
style O fill:#bbf,stroke:#333,stroke-width:2px
288-
style P fill:#bbf,stroke:#333,stroke-width:2px
289-
style Q fill:#bbf,stroke:#333,stroke-width:2px
290-
style R fill:#bbf,stroke:#333,stroke-width:2px
291-
style S fill:#bbf,stroke:#333,stroke-width:2px
292-
style T fill:#bbf,stroke:#333,stroke-width:2px
293-
style U fill:#bbf,stroke:#333,stroke-width:2px
294-
style V fill:#bbf,stroke:#333,stroke-width:2px
295-
style W fill:#bbf,stroke:#333,stroke-width:2px
296-
style X fill:#bbf,stroke:#333,stroke-width:2px
297-
style Y fill:#bbf,stroke:#333,stroke-width:2px
298-
style Z fill:#bbf,stroke:#333,stroke-width:2px
299-
style AA fill:#bbf,stroke:#333,stroke-width:2px
300-
style AB fill:#bbf,stroke:#333,stroke-width:2px
301-
style AC fill:#bbf,stroke:#333,stroke-width:2px
302-
style AD fill:#bbf,stroke:#333,stroke-width:2px
303-
style AE fill:#bbf,stroke:#333,stroke-width:2px
304-
```
235+
![TaroMiniPlugin webpack 插件 apply 方法](./images/apply.svg)
305236

306237
## 4. 注册 compiler.hooks.run 钩子
307238

docs/taro/mini-plugin/image.png

-110 KB
Binary file not shown.

docs/taro/mini-plugin/images/apply.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)