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(variant-group): hmr in vite #3741

Merged
merged 11 commits into from May 13, 2024
Merged

fix(variant-group): hmr in vite #3741

merged 11 commits into from May 13, 2024

Conversation

Simon-He95
Copy link
Contributor

close: #3518

@Simon-He95 Simon-He95 requested a review from antfu as a code owner April 18, 2024 04:04
Copy link

netlify bot commented Apr 18, 2024

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit 092a62f
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/66429f2b1d668700088a153b
😎 Deploy Preview https://deploy-preview-3741--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antfu
Copy link
Member

antfu commented Apr 18, 2024

I am not sure about it - can you explain a bit more about the problem and why this would be helpful?

@Simon-He95
Copy link
Contributor Author

I am not sure about it - can you explain a bit more about the problem and why this would be helpful?
The affectedModules themselves collect all the ids that need to be updated, but our HMR needs to filter these ids based on the clientImportedModules that depend on them, which should enable on-demand updates

@Simon-He95
Copy link
Contributor Author

Morning, @antfu
I have a question, should we only hot update the current file, or the current file and its sub-files? If it is the current file, there is no need to add ctx.affectedModules.add(id) to the transformerVariantGroup. If necessary, it should Filter all changed pages based on dependencies on the current page

@Simon-He95
Copy link
Contributor Author

I feel that there is no need to add ctx.affectedModules.add(id) in transformerVariantGroup, because if you modify the hasChanged file, this plug-in will be used. If you do not modify the hasChanged file, it will also trigger the style update of uno.css.

@@ -40,7 +40,7 @@ export async function applyTransformers(
}

if (code !== original) {
ctx.affectedModules.add(id)
// ctx.affectedModules.add(id)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this line of code is not needed. It will cause additional updates. For example, I modified file a, but multiple files may be added to the change list for the first time. Modification of file a will cause hot updates of all files. uno.css is also updated multiple times. If the a file changes, you should only need to initiate the hot update of the a file and the hot update of uno.css.

@antfu
Copy link
Member

antfu commented May 13, 2024

I am still not convinced - but I am ok have it and to experiments a bit

@antfu antfu merged commit 22ff261 into unocss:main May 13, 2024
8 of 9 checks passed
ramackersjp added a commit to ramackersjp/Piped that referenced this pull request May 20, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@unocss/eslint-config](https://togithub.com/unocss/unocss/tree/main/packages/eslint-config#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/eslint-config))
| [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2feslint-config/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2feslint-config/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2feslint-config/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2feslint-config/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2feslint-config/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/preset-icons](https://togithub.com/unocss/unocss/tree/main/packages/preset-icons#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/preset-icons))
| [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2fpreset-icons/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2fpreset-icons/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2fpreset-icons/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2fpreset-icons/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2fpreset-icons/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/preset-uno](https://togithub.com/unocss/unocss/tree/main/packages/preset-uno#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/preset-uno))
| [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2fpreset-uno/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2fpreset-uno/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2fpreset-uno/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2fpreset-uno/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2fpreset-uno/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/preset-web-fonts](https://togithub.com/unocss/unocss/tree/main/packages/preset-web-fonts#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/preset-web-fonts))
| [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2fpreset-web-fonts/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2fpreset-web-fonts/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2fpreset-web-fonts/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2fpreset-web-fonts/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2fpreset-web-fonts/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@unocss/reset](https://togithub.com/unocss/unocss) | [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2freset/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2freset/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2freset/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2freset/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2freset/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/transformer-directives](https://togithub.com/unocss/unocss/tree/main/packages/transformer-directives#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/transformer-directives))
| [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2ftransformer-directives/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2ftransformer-directives/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2ftransformer-directives/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2ftransformer-directives/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2ftransformer-directives/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/transformer-variant-group](https://togithub.com/unocss/unocss/tree/main/packages/transformer-variant-group#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/transformer-variant-group))
| [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/@unocss%2ftransformer-variant-group/0.60.2/0.60.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2ftransformer-variant-group/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2ftransformer-variant-group/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2ftransformer-variant-group/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2ftransformer-variant-group/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [unocss](https://togithub.com/unocss/unocss) | [`0.60.2` ->
`0.60.3`](https://renovatebot.com/diffs/npm/unocss/0.60.2/0.60.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/unocss/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/unocss/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/unocss/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/unocss/0.60.2/0.60.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>unocss/unocss (@&#8203;unocss/eslint-config)</summary>

### [`v0.60.3`](https://togithub.com/unocss/unocss/releases/tag/v0.60.3)

[Compare
Source](https://togithub.com/unocss/unocss/compare/v0.60.2...v0.60.3)

#####    🚀 Features

- **preset-mini**: `text-align` utility  -  by
[@&#8203;UltraCakeBakery](https://togithub.com/UltraCakeBakery),
**Chris** and [@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3796
[<samp>(5f2a8)</samp>](https://togithub.com/unocss/unocss/commit/5f2a8999)
- **transformer-directives**: Add removeComments  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3799
[<samp>(a9ab8)</samp>](https://togithub.com/unocss/unocss/commit/a9ab8693)

#####    🐞 Bug Fixes

- Enable regex eslint rule, optimize regexes  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3801
[<samp>(882cc)</samp>](https://togithub.com/unocss/unocss/commit/882cc694)
- **cli**: Extractors not working  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) in
[unocss/unocss#3803
[<samp>(398c1)</samp>](https://togithub.com/unocss/unocss/commit/398c15ab)
- **preset-mini**: DirectionSize size cause error when size is undefined
 -  by [@&#8203;Simon-He95](https://togithub.com/Simon-He95) in
[unocss/unocss#3809
[<samp>(c19ab)</samp>](https://togithub.com/unocss/unocss/commit/c19ab689)
- **shared-integration**: GetCssEscaperForJsContent replace conflict  - 
by [@&#8203;Simon-He95](https://togithub.com/Simon-He95) in
[unocss/unocss#3797
[<samp>(dd013)</samp>](https://togithub.com/unocss/unocss/commit/dd0139bf)
- **transformers**: Try improve hmr in vite  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3741
[<samp>(22ff2)</samp>](https://togithub.com/unocss/unocss/commit/22ff2616)
- **vite**: Warn when `unocss:global:build:bundle` has no CSS
placeholder  -  by [@&#8203;Simon-He95](https://togithub.com/Simon-He95)
in
[unocss/unocss#3802
[<samp>(210a2)</samp>](https://togithub.com/unocss/unocss/commit/210a22b3)

#####    🏎 Performance

- **preset-mini**: Improve performance of `resolveBreakpoints`  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(05d90)</samp>](https://togithub.com/unocss/unocss/commit/05d9043d)

#####     [View changes on
GitHub](https://togithub.com/unocss/unocss/compare/v0.60.2...v0.60.3)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ramackersjp/Piped).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
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.

vue2/3 keep-alive + transformerVariantGroup hmr error
2 participants