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: frontmatter & api hmr bug when enable mfsu #959

Merged
merged 7 commits into from
Nov 24, 2021

Conversation

PeachScript
Copy link
Member

@PeachScript PeachScript commented Nov 24, 2021

🤔 这个变动的性质是?/ What is the nature of this change?

  • 新特性提交 / New feature
  • bug 修复 / Fix bug
  • 样式优化 / Style optimization
  • 代码风格优化 / Code style optimization
  • 性能优化 / Performance optimization
  • 构建优化 / Build optimization
  • 网站、文档、Demo 改进 / Website, documentation, demo improvements
  • 重构代码或样式 / Refactor code or style
  • 测试相关 / Test related
  • 其他 / Other

🔗 相关 Issue / Related Issue

Close #795
Close #841
Close #917

💡 需求背景和解决方案 / Background or solution

优化临时文件访问和 theme context 初始化方案,确保 MFSU 开启后 FrontMatter 及 API 能正常热更新,主要改动点:

  1. 临时生成 .umi/dumi/layout.jsx 用于配合 theme/layout 做 context 初始化,theme/layout 不直接依赖 @@/dumi/config
  2. @@/dumi/demos@@/dumi/apis 都挪进 theme context 中,内层组件统一走 context 访问数据

改动后可确保 dumi 主题包及 preset-dumi 的 theme 模块不会依赖 .umi/dumi 下的临时文件,可以正常、安全地被 MFSU 预编译。

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English Fix FrontMatter & API HMR bug when enable MFSU
🇨🇳 Chinese 修复 MFSU 开启后 FrontMatter 及 API 无法热更新的问题

@github-actions
Copy link

github-actions bot commented Nov 24, 2021

🎊 PR Preview has been successfully built and deployed to https://dumi-preview-pr-959.surge.sh

@github-actions
Copy link

github-actions bot commented Nov 24, 2021

🎊 PR Mobile Preview has been successfully built and deployed to https://dumi-mobile-preview-pr-959.surge.sh

@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #959 (0bf0cea) into master (60a781a) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #959      +/-   ##
==========================================
+ Coverage   94.70%   94.74%   +0.04%     
==========================================
  Files         117      117              
  Lines        2853     2857       +4     
  Branches      971      972       +1     
==========================================
+ Hits         2702     2707       +5     
+ Misses        147      146       -1     
  Partials        4        4              
Impacted Files Coverage Δ
...ges/preset-dumi/src/plugins/features/demo/index.ts 100.00% <ø> (ø)
packages/preset-dumi/src/routes/getRouteConfig.ts 89.18% <ø> (ø)
packages/preset-dumi/src/transformer/remark/api.ts 94.64% <ø> (+1.66%) ⬆️
packages/theme-mobile/src/layouts/index.tsx 100.00% <ø> (ø)
packages/preset-dumi/src/loader/index.ts 100.00% <100.00%> (ø)
...ackages/preset-dumi/src/plugins/features/routes.ts 100.00% <100.00%> (ø)
packages/preset-dumi/src/plugins/features/theme.ts 100.00% <100.00%> (ø)
packages/preset-dumi/src/theme/hooks/useApiData.ts 100.00% <100.00%> (ø)
packages/preset-dumi/src/theme/layout.tsx 87.30% <100.00%> (+0.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60a781a...0bf0cea. Read the comment docs.

@PeachScript PeachScript merged commit 804af48 into master Nov 24, 2021
@PeachScript PeachScript deleted the hotfix/config-api-mfsu branch November 24, 2021 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant