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

fix: dts lost in re-compilation if save file with same content #691

Merged
merged 2 commits into from
Aug 8, 2023

Conversation

PeachScript
Copy link
Member

@PeachScript PeachScript commented Aug 8, 2023

修复存在持久缓存已存在且重复保存某个文件但不修改内容时,.d.ts 不会生成的问题,另外修改 .tsbuildinfo 文件的位置强行让存量项目的 tsc 缓存失效实现缓存重建。

原因是 tsc 的 incremental 模式不会生成未变更的文件,father 使用持久缓存补齐这些文件,但缓存 key 不是依据内容哈希而是文件修改时间,所以在文件重复保存时,tsc 认为文件没有变更(应该是以哈希判断?)所以不会生成,father 又从持久缓存中找不到(以时间戳查找)对应内容无法补齐文件,最终导致 .d.ts 丢失。

解法是 father 对 .d.ts 的缓存 key 改为内容哈希,确保重复保存时也能命中。

Close #669

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (8aa2415) 93.80% compared to head (38733e5) 93.81%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #691      +/-   ##
==========================================
+ Coverage   93.80%   93.81%   +0.01%     
==========================================
  Files          54       54              
  Lines        1534     1537       +3     
  Branches      345      365      +20     
==========================================
+ Hits         1439     1442       +3     
+ Misses         95       90       -5     
- Partials        0        5       +5     
Files Changed Coverage Δ
src/builder/bundless/dts/index.ts 91.89% <100.00%> (+0.11%) ⬆️
src/builder/utils.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PeachScript PeachScript merged commit ba85ed9 into master Aug 8, 2023
9 checks passed
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.

father生成.d.ts文件的时候,时灵时不灵
1 participant