Skip to content

Optimize zero value and update major version#192

Merged
owjs3901 merged 2 commits intomainfrom
optimize-zero
May 19, 2025
Merged

Optimize zero value and update major version#192
owjs3901 merged 2 commits intomainfrom
optimize-zero

Conversation

@owjs3901
Copy link
Contributor

Optimize Zero value

Example

0px -> 0
0% -> 0
0px 0% -> 0 0

@changeset-bot
Copy link

changeset-bot bot commented May 19, 2025

🦋 Changeset detected

Latest commit: 14d6912

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@devup-ui/webpack-plugin Major
@devup-ui/wasm Major
@devup-ui/next-plugin Major
@devup-ui/vite-plugin Major
@devup-ui/react Major

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
Copy link

codecov bot commented May 19, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/extractor/src/gen_style.rs 55.55% 8 Missing ⚠️
libs/extractor/src/gen_class_name.rs 63.63% 4 Missing ⚠️
libs/extractor/src/visit.rs 73.33% 4 Missing ⚠️
Files with missing lines Coverage Δ
libs/css/src/lib.rs 96.61% <100.00%> (+0.04%) ⬆️
libs/extractor/src/lib.rs 100.00% <ø> (ø)
packages/react/src/hooks/use-theme.ts 100.00% <100.00%> (ø)
libs/extractor/src/gen_class_name.rs 72.04% <63.63%> (-1.25%) ⬇️
libs/extractor/src/visit.rs 84.10% <73.33%> (-0.52%) ⬇️
libs/extractor/src/gen_style.rs 61.62% <55.55%> (-0.28%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@owjs3901 owjs3901 merged commit 178da84 into main May 19, 2025
1 of 2 checks passed
@owjs3901 owjs3901 deleted the optimize-zero branch May 19, 2025 11:43
@owjs3901 owjs3901 requested a review from Copilot May 19, 2025 11:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes CSS zero values by stripping unit suffixes and bumps major versions for various packages.

  • Introduces a ZERO_RE regex in optimize_value to collapse 0px, 0%, etc., into 0
  • Adds comprehensive tests for optimize_value and sheet_to_classname
  • Updates dependency versions across package.json and Cargo.toml files

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 , 0px become , 0 and retain a space (translate(0, 0)) instead of translate(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());

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.

1 participant