Conversation
Replace stripLineComments + sanitizeCSS with single-pass preprocessCSS. Paren-depth tracking protects // inside any function call (url, calc, image-set, etc.) without maintaining a function name list. sanitizeBraces collapsed from two loops to one with imbalanced flag. Fix escape detection: isEscaped() counts consecutive backslashes instead of single-lookback check. Exported for reuse by stylisPluginRSC. stylisPluginRSC: merge findAdjacentCombinators into expandAdjacentSibling (one loop instead of two + intermediate array). Use shared isEscaped().
Brace-depth scan for at-rule/selector skip now covers both prop and
value ranges. Old code started depth=1 and scanned only the value,
double-counting the first {. Declarations after @supports and other
nested at-rule blocks are now correctly recovered.
Fix keyframes object CSS ':hover' → '&:hover' (was producing descendant selector instead of pseudo-class). Move orphaned flatten test inside its describe block. Correct 5 stale/wrong test names. Add single-attrs mutation edge case documenting needsCopy behavior.
Extract bench() and COLORS to bench-utils.ts, replacing 4 copies of the bench function and 3 copies of the COLORS array. Add preprocessCSS isolated + full-pipeline benchmark at 5 CSS scale levels.
|
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.
Summary
stripLineComments+sanitizeCSSwith single-passpreprocessCSS. General paren-depth tracking protects//inside any function call (url, calc, image-set, etc.) without maintaining a function name list. -0.28kB gzip production bundle (8.49→8.21kB).parseCSSDeclarationsbrace-depth off-by-one (native): declarations after@supportsand other nested at-rule blocks were silently lost due to double-counting the first{.isEscapeddetection: single-lookbackcharCodeAt(i-1) !== BACKSLASHfails on\\"(escaped backslash + closing quote). NewisEscaped()counts consecutive backslashes, exported and shared bypreprocessCSSandstylisPluginRSC.findAdjacentCombinatorsintoexpandAdjacentSibling(one loop, no intermediate array).:hover→&:hover, added single-attrs mutation edge case test.bench()utility andCOLORSarray, newpreprocessCSSisolated + pipeline benchmark.