umijs / father

NPM package development tool
MIT License
2.12k stars 273 forks source link

fix: bundless cache maybe broken if has dts error #725

Closed PeachScript closed 11 months ago

PeachScript commented 11 months ago

修复 bundless 的持久缓存可能损坏导致下一次构建直接报错的问题

原因是写缓存的操作是异步进行的,会出现在内容还未完全写入文件系统的时候就遇到 dts error 进程退出,导致缓存内容不可用;解决方案是 bundless loader 处理文件时,等缓存完全写入后再 resolve,这样 dts 始终作为 loader 的后置逻辑执行,即便异常终止也不会影响 loader 缓存的有效性

cc @hualigushi

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (b13bc23) 94.42% compared to head (bce9518) 94.43%. Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #725 +/- ## ======================================= Coverage 94.42% 94.43% ======================================= Files 55 55 Lines 1561 1562 +1 Branches 351 373 +22 ======================================= + Hits 1474 1475 +1 + Misses 87 82 -5 - Partials 0 5 +5 ``` | [Files](https://app.codecov.io/gh/umijs/father/pull/725?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=umijs) | Coverage Δ | | |---|---|---| | [src/builder/bundless/loaders/index.ts](https://app.codecov.io/gh/umijs/father/pull/725?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=umijs#diff-c3JjL2J1aWxkZXIvYnVuZGxlc3MvbG9hZGVycy9pbmRleC50cw==) | `80.95% <100.00%> (ø)` | | | [src/doctor/parser.ts](https://app.codecov.io/gh/umijs/father/pull/725?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=umijs#diff-c3JjL2RvY3Rvci9wYXJzZXIudHM=) | `100.00% <100.00%> (ø)` | | | [src/utils.ts](https://app.codecov.io/gh/umijs/father/pull/725?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=umijs#diff-c3JjL3V0aWxzLnRz) | `98.75% <100.00%> (+0.01%)` | :arrow_up: | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/umijs/father/pull/725/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=umijs)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.