Skip to content

Conversation

devongovett
Copy link
Member

@devongovett devongovett commented Feb 16, 2025

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.

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

@noahbald noahbald Apr 3, 2025

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

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
@devongovett devongovett marked this pull request as ready for review April 27, 2025 18:00
@devongovett devongovett merged commit c7929bf into v2 Apr 27, 2025
16 of 17 checks passed
@devongovett devongovett deleted the html-rs branch April 27, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants