Optimize zero value and update major version#192
Merged
Conversation
🦋 Changeset detectedLatest commit: 14d6912 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAttention: Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes CSS zero values by stripping unit suffixes and bumps major versions for various packages.
- Introduces a
ZERO_REregex inoptimize_valueto collapse0px,0%, etc., into0 - Adds comprehensive tests for
optimize_valueandsheet_to_classname - Updates dependency versions across
package.jsonandCargo.tomlfiles
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/hooks/use-theme.ts | Added theme to effect dependencies |
| libs/css/src/lib.rs | Added ZERO_RE regex & unit-stripping logic |
| libs/css/src/lib.rs | Added tests for zero-value optimization |
| .changeset/upset-teeth-buy.md | Updated changeset to bump major versions |
Various package.json & Cargo.toml |
Bumped package and dev-dependency versions |
| libs/extractor/src/{visit,gen_*.rs,lib.rs} | Swapped literal allocations to use ast_builder.atom |
Comments suppressed due to low confidence (1)
libs/css/src/lib.rs:356
- ZERO_RE doesn’t consume whitespace after commas, so patterns like
, 0pxbecome, 0and retain a space (translate(0, 0)) instead oftranslate(0,0). Update the regex to include optional whitespace after commas (e.g.,r"(^|\s|\(|,)\s*-?0(...)")) so the space is removed during replacement.
static ZERO_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(^|\s|\(|,)-?0(px|em|rem|vh|vw|%|dvh|dvw)").unwrap());
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Optimize Zero value
Example