feat: support custom source map implemetation#1289
Draft
intellild wants to merge 3 commits into
Draft
Conversation
intellild
force-pushed
the
codex/perf-minify
branch
from
June 29, 2026 07:51
4555289 to
f20d60e
Compare
Member
|
Sounds like a good idea. I'll look more in depth soon. |
Author
|
@devongovett Should we maintain rust API compatibility across the 1.0.0 beta releases? |
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
This refactors CSS printing so
ToCssdepends on a sealed printer trait instead of the concretePrinter<W, S>type. It also splits source map writing behindcustom_sourcemap, while keeping the existingsourcemapfeature backed by Parcel source maps for current users.Why
Bundlers such as Rspack already have their own source map representation. Previously, they had to generate a Parcel source map from Lightning CSS output and then translate it back into their own source map type.
With this change, those consumers can provide a custom source map writer directly.
This has two benefits:
In Rspack CI, this reduced the binary by about 400 KB:
https://github.com/web-infra-dev/rspack/actions/runs/28227945651/job/83627257783?pr=14581
Release builds are estimated to save around 300 KB.
Compatibility
The default
sourcemapfeature still uses Parcel source maps, so existing Lightning CSS users should keep the same public behavior.Consumers that want to avoid the built-in Parcel implementation can enable
custom_sourcemapand provide their own writer.Validation
Checked the library with and without custom source maps, including no-default-feature and serde-only configurations.