Skip to content

Fix(Extractor): $name:value classes dropped by needExclude regex - #416

Closed
0Miles wants to merge 1 commit into
master-co:rcfrom
0Miles:fix/337-extractor-variable-classes
Closed

0Miles wants to merge 1 commit into
master-co:rcfrom
0Miles:fix/337-extractor-variable-classes

Conversation

@0Miles

@0Miles 0Miles commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Closes #337.

Summary

Static extraction silently dropped classes like `$test:$(test-color)`. The lead-character regex in `needExclude` (`^[\w\-()]+:\S+`) didn't include `$`, so any class starting with `$` failed every alternative and was treated as not-a-class.

Changes

  • `packages/extractor/src/functions/extract-latent-classes.ts` — single regex change: `[\w\-()]` → `[$\w\-()]` in the keep-alternation
  • New `tests/issue-337-variable-class.test.ts` — 3 cases (HTML class attr, JS `classList.add`, standalone)

Testing

  • 3/3 new tests pass; all 9 extractor test files still pass
  • Blast radius is one character in one regex, only affects what `needExclude` keeps vs drops

@vercel

vercel Bot commented Apr 30, 2026

Copy link
Copy Markdown

@0Miles is attempting to deploy a commit to the Aoyue Team on Vercel.

A member of the Team first needs to authorize it.

@0Miles 0Miles changed the title fix(extractor): allow $name:value classes through needExclude regex, resolve #337 Fix(Extractor): $name:value classes dropped by needExclude regex Apr 30, 2026
Static extraction silently dropped classes like $test:$(test-color).
The lead-character regex in needExclude (^[\w\-()]+:\S+) didn't
include $, so any class starting with $ failed every alternative and
was treated as not-a-class.

- One-character regex change: [\w\-()] → [$\w\-()]
- 3 regression tests (HTML class attr / JS classList.add / standalone)

Closes master-co#337
@0Miles
0Miles force-pushed the fix/337-extractor-variable-classes branch from 4db8a2c to 12d2ce9 Compare April 30, 2026 19:02
@1aron 1aron closed this in aca6c57 May 3, 2026
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.

🐞 Static extraction misses generating variables and related classes

1 participant