Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact: build #923

Merged
merged 48 commits into from
Mar 12, 2024
Merged

refact: build #923

merged 48 commits into from
Mar 12, 2024

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Feb 29, 2024

Merge 到此 PR 的 PR(需要在 Changelog 里提及):

修改点:

1、重构了 build 部分,涉及部分数据结构调整,所以对非 build 部分也有改动
2、新增了几个模块,file、visitors
3、重写了几个模块,ast_2、build_2、load_2、parse_2、transform_2、analyze_deps_2
4、删除了几个模块,task
5、模块说明
1)ast_2 是通用模块,负责 ast 的一生,传入 file,然后就可以做 parse、transform、analyze_deps 和 generate
2)file 包含文件相关的所有信息
3)load_2、parse_2、transform_2、analyze_deps_2 是 ast 在 build 阶段的生命周期,基于 ast_2,同时加入 build 相关的逻辑和需求
4)resolve 我放到 analyze_deps_2 内部做了
5)visitors 和 folders 统一放 visotors 下,不区分 transform 和 transform_in_generate
6、重构 build_2,简化逻辑,650+ 行 > 250+ 行
7、把大量 plugin 功能内置,减少复杂度
8、optimize_package_imports 先下掉,等调整后重新上,现在和 build 和 module 模块耦合,增加了复杂度
9、重构 plugins/runtime,手动提供,不走编译,无需依赖 @swc_helpers,减少复杂性
...

TODO:

  • 继续完善代码,之前为了先跑起来,注释掉了不少功能
  • 删除不必要的文件
  • 调整 ModuleInfo 结构,不少信息在 file 里就能获取了
  • 重构 update.rs,build 相关逻辑收敛到 build.rs 里
  • 把 transformers 调整到 visitors 下(不一定全部放这个 pr)
  • 验证性能变化,确保不劣化(yuyanAssets 提升几百毫秒)
  • 模块名的 _2 去掉,替换原模块
  • merge master,解决冲突
  • 确保用例通过
  • 更新 CONTRIBUTIND.md

@sorrycc sorrycc changed the title wip: refact/build refact: build Mar 11, 2024
* fix: let async imports bundled into separate chunks

* fix: e2e javascript.require-dynamic
* refactor: minimum tokio thread pool

* refact: use a static rayon thread pool

* refact: import style

* refact: code style

* refact: import style
@sorrycc sorrycc merged commit ba09dae into master Mar 12, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the refact/build branch March 12, 2024 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants