-
-
Notifications
You must be signed in to change notification settings - Fork 759
feat: support base64 hash digest for css local ident name #10897
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
Conversation
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 Benchmark detail: Open
|
📦 Binary Size-limit
❌ Size increased by 2.75KB from 59.80MB to 59.80MB (⬆️0.00%) |
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.
Pull Request Overview
This PR introduces support for specifying a Base64-encoded hash digest (e.g. [hash:base64:8]
) for CSS local identifiers and file placeholders.
- Updates documentation (English and Chinese) to describe the new
base64
digest syntax - Extends
replace_all_placeholder_impl
andrender_template
logic to parse and emit Base64 digests - Adds test fixtures for CSS
localIdentName
and pulls inrspack_base64
as a new dependency
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
website/docs/zh/config/output.mdx | Documented [hash:base64:8] syntax in Chinese docs |
website/docs/en/config/output.mdx | Documented [hash:base64:8] syntax in English docs |
packages/rspack-test-tools/tests/configCases/css/local-ident-name/rspack.config.js | Configured localIdentName to include Base64 hash |
packages/rspack-test-tools/tests/configCases/css/local-ident-name/index.module.css | Sample CSS class for test |
packages/rspack-test-tools/tests/configCases/css/local-ident-name/index.js | Assertion for generated class name including Base64 digest |
crates/rspack_core/src/utils/hash.rs | Enhanced placeholder parser to recognize base64 prefix |
crates/rspack_core/src/options/filename.rs | Updated placeholder rendering to Base64-encode when requested |
crates/rspack_core/Cargo.toml | Added rspack_base64 dependency |
Comments suppressed due to low confidence (1)
crates/rspack_core/src/options/filename.rs:281
- Calling
.map
onCow<str>
may not compile sinceCow
doesn't have amap
method. Consider slicing&str
directly or converting to owned string before truncation.
let content = content.map(|s| s[..hash_len(s, len)].into());
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.
Awesome 👍
CodSpeed Performance ReportMerging #10897 will not alter performanceComparing 🎉 Hooray!
|
Summary
fix #10881
Related links
Checklist