Skip to content

Commit

Permalink
docs: ✏️ 更新 taro 文章
Browse files Browse the repository at this point in the history
  • Loading branch information
ruochuan12 committed Dec 28, 2024
1 parent d7d9a4c commit 79bdc88
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
- [Taro 源码揭秘 - 7. Taro.request 和请求响应拦截器是如何实现的?](https://ruochuan12.github.io/taro/request/)
- [Taro 源码揭秘:8. Taro 是如何使用 webpack 打包构建小程序的](https://ruochuan12.github.io/taro/webpack5-runner/)
- [Taro 源码揭秘:9. Taro 是如何生成 webpack 配置进行构建小程序的?](https://ruochuan12.github.io/taro/webpack5-runner/)

- [Taro 源码揭秘:10. Taro 到底是怎样转换成小程序文件的?](https://ruochuan12.github.io/taro/mini-plugin/)

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion docs/taro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ TODOs
- [Taro 源码揭秘:7. Taro.request 和请求响应拦截器是如何实现的?](../taro/request/)
- [Taro 源码揭秘:8. Taro 是如何使用 webpack 打包构建小程序的?](../taro/webpack5/)
- [Taro 源码揭秘:9. Taro 是如何生成 webpack 配置进行构建小程序的?](../taro/webpack5-runner/)
- [Taro 源码揭秘:10. Taro 小程序](../taro/mini-plugin/)
- [Taro 源码揭秘:10. Taro 到底是怎样转换成小程序文件的?](../taro/mini-plugin/)
71 changes: 1 addition & 70 deletions docs/taro/mini-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,76 +232,7 @@ tap 是监听注册事件、call 是执行事件
插件入口 apply 函数的执行过程如下图所示:
有个大概印象即可,后文继续看具体代码实现。

```mermaid
graph TD
A[TaroMiniPlugin webpack 插件 apply 方法] --> B[初始化上下文和入口文件]
B --> C{解构配置选项}
C --> D[注册 run 钩子]
C --> E[注册 watchRun 钩子]
C --> F[注册 make 钩子]
C --> G[注册 compilation 钩子]
C --> H[注册 afterEmit 钩子]
C --> I[应用 TaroNormalModulesPlugin]
C --> J{newBlended 模式}
J --> K[添加加载块插件]
D --> L[执行 run 方法]
L --> M[应用 TaroLoadChunksPlugin]
E --> N[获取已修改文件]
N --> O{文件有变更}
O --> P[设置 isWatch 为 true]
E --> Q[执行 run 方法]
Q --> R{loadChunksPlugin 是否存在}
R --> S[应用 TaroLoadChunksPlugin]
F --> T[处理依赖项]
T --> U[编译独立页面]
T --> V[添加依赖项到 compilation]
V --> W[调用 onCompilerMake 回调]
G --> X[设置依赖工厂]
G --> Y[插入 Taro Loader]
G --> Z[注册 processAssets 钩子]
Z --> AA[生成独立分包文件]
Z --> AB[生成小程序文件]
Z --> AC[优化小程序文件]
Z --> AD[调用 modifyBuildAssets 回调]
H --> AE[添加 tabbar 文件到依赖中]
style A fill:#f9f,stroke:#333,stroke-width:4px
style B fill:#bbf,stroke:#333,stroke-width:2px
style C fill:#bbf,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#333,stroke-width:2px
style E fill:#bbf,stroke:#333,stroke-width:2px
style F fill:#bbf,stroke:#333,stroke-width:2px
style G fill:#bbf,stroke:#333,stroke-width:2px
style H fill:#bbf,stroke:#333,stroke-width:2px
style I fill:#bbf,stroke:#333,stroke-width:2px
style J fill:#bbf,stroke:#333,stroke-width:2px
style K fill:#bbf,stroke:#333,stroke-width:2px
style L fill:#bbf,stroke:#333,stroke-width:2px
style M fill:#bbf,stroke:#333,stroke-width:2px
style N fill:#bbf,stroke:#333,stroke-width:2px
style O fill:#bbf,stroke:#333,stroke-width:2px
style P fill:#bbf,stroke:#333,stroke-width:2px
style Q fill:#bbf,stroke:#333,stroke-width:2px
style R fill:#bbf,stroke:#333,stroke-width:2px
style S fill:#bbf,stroke:#333,stroke-width:2px
style T fill:#bbf,stroke:#333,stroke-width:2px
style U fill:#bbf,stroke:#333,stroke-width:2px
style V fill:#bbf,stroke:#333,stroke-width:2px
style W fill:#bbf,stroke:#333,stroke-width:2px
style X fill:#bbf,stroke:#333,stroke-width:2px
style Y fill:#bbf,stroke:#333,stroke-width:2px
style Z fill:#bbf,stroke:#333,stroke-width:2px
style AA fill:#bbf,stroke:#333,stroke-width:2px
style AB fill:#bbf,stroke:#333,stroke-width:2px
style AC fill:#bbf,stroke:#333,stroke-width:2px
style AD fill:#bbf,stroke:#333,stroke-width:2px
style AE fill:#bbf,stroke:#333,stroke-width:2px
```
![TaroMiniPlugin webpack 插件 apply 方法](./images/apply.svg)

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

Expand Down
Binary file removed docs/taro/mini-plugin/image.png
Binary file not shown.
1 change: 1 addition & 0 deletions docs/taro/mini-plugin/images/apply.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 79bdc88

Please sign in to comment.