feat: improve rs plugin and js hooks #855
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RFC 是 #836 。做了一些改动,先提 pr 了。还会有后续其他改动。
1、rs plugin 新增 build_start 和 generate_end 两个 hook
2、js plugin 通过同一个 rs plugin 管理
3、js plugin 新增 buildStart
4、js plugin 修改 onBuildComplete 为 generateEnd,参数不变,但 build 时也会执行
5、js plugin 删除 onCompileLess,通过 load 来实现
6、js plugin 新增 load,入参是 path,返回
Promise<{ content: string, type: 'css'|'javascript' }>
7、js plugin 修改 on_generate_file 为 _on_generate_file,因为目前只在 bundless 场景下使用,还没想好怎么对三方用户公开使用,先用私有的方式
8、tsfn.rs 里写地比较丑和重复,后续会用宏来重写下部分函数