Add Rust-based transformer/packager/optimizer for HTML and SVG#10090
Merged
devongovett merged 31 commits intov2from Apr 27, 2025
Merged
Add Rust-based transformer/packager/optimizer for HTML and SVG#10090devongovett merged 31 commits intov2from
devongovett merged 31 commits intov2from
Conversation
# Conflicts: # packages/configs/default/package.json # packages/core/integration-tests/test/html.js # packages/packagers/html/package.json # packages/packagers/svg/package.json # packages/transformers/html/package.json # packages/transformers/svg/package.json
noahbald
reviewed
Apr 3, 2025
There was a problem hiding this comment.
I'm currently working on copying the arenas you have here into oxvg. I've raised a draft in case you have any particulars you'd like to comment in.
noahbald/oxvg#123
Member
Author
There was a problem hiding this comment.
thanks! I did end up needing to duplicate a bunch of that still unfortunately. I need to store a few other things in the AST, namely line numbers, and some HTML-specific things. Not sure there's a way to avoid that though.
# Conflicts: # packages/configs/default/package.json # packages/packagers/html/package.json # packages/packagers/svg/package.json # packages/transformers/html/package.json # packages/transformers/svg/package.json
# Conflicts: # Cargo.lock # packages/transformers/js/core/Cargo.toml
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.
Closes #10080, closes #10135
This replaces the posthtml-based transformer/packager/optimizer with a Rust-based one powered by html5ever, the HTML parser from Servo. For SVG optimization, it uses oxvg, an SVGO replacement written in Rust which uses Lightning CSS for CSS optimization.
Aside from being faster, this also reduces the number of npm dependencies to install, some of which haven't been maintained very much over the last few years.