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
refactor(css/parser): new approach #6224
Conversation
@@ -2,7 +2,7 @@ | |||
"type": "Stylesheet", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes expected, because now we output list of component values when we can't parser (as in spec) and now we follow spec
"raw": "color" | ||
} | ||
} | ||
"prelude": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected too due the reason above (only @media
isside qualified rule can be written in this style), here we have:
@media print {
color: teal;
main {
color: orange;
}
}
So browser see it as:
@media print {
/* In `[]` it is prelude */
[color: teal;
main] {
color: orange;
}
}
dcfb7d8
to
8482d44
Compare
Tests passed + fix many cases with invalid AST (and invalid span) + more tests (no regressions), WIP on perf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- swc_css_parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
Description:
New CSS parser approach
BREAKING CHANGE:
No, but AST was improved in some cases
Related issue (if exists):
By spec we should get
ComponentValue
and parse list of components values, but it is more slow than using tokens, so under the hood our parser uses only token, but if we can't apply required grammar we convert tokens to lost of component values to be align with spec