Skip to content

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

Merged
merged 2 commits into from
Jul 3, 2025

Conversation

ahabhgk
Copy link
Contributor

@ahabhgk ahabhgk commented Jul 3, 2025

Summary

fix #10881

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Jul 3, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 2e73290
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/686641e34387d30008209fa7
😎 Deploy Preview https://deploy-preview-10897--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the release: feature release: feature related release(mr only) label Jul 3, 2025
@ahabhgk ahabhgk enabled auto-merge (squash) July 3, 2025 08:40
@ahabhgk ahabhgk requested a review from chenjiahan July 3, 2025 08:41
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Jul 3, 2025
Copy link
Contributor

github-actions bot commented Jul 3, 2025

📝 Benchmark detail: Open

Name Base (2025-07-03 0932978) Current Change
10000_big_production-mode_disable-minimize + exec 33.8 s ± 650 ms 34.6 s ± 249 ms +2.43 %
10000_development-mode + exec 1.88 s ± 31 ms 1.85 s ± 15 ms -1.84 %
10000_development-mode_hmr + exec 698 ms ± 5.3 ms 685 ms ± 9 ms -1.95 %
10000_production-mode + exec 1.92 s ± 42 ms 1.91 s ± 22 ms -0.26 %
10000_production-mode_persistent-cold + exec 2.07 s ± 56 ms 2.08 s ± 26 ms +0.20 %
10000_production-mode_persistent-hot + exec 1.46 s ± 31 ms 1.5 s ± 36 ms +2.44 %
arco-pro_development-mode + exec 1.8 s ± 50 ms 1.81 s ± 15 ms +0.47 %
arco-pro_development-mode_hmr + exec 371 ms ± 2.1 ms 371 ms ± 0.17 ms +0.04 %
arco-pro_production-mode + exec 3.27 s ± 49 ms 3.34 s ± 99 ms +2.04 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.41 s ± 105 ms 3.46 s ± 164 ms +1.47 %
arco-pro_production-mode_persistent-cold + exec 3.37 s ± 138 ms 3.42 s ± 91 ms +1.41 %
arco-pro_production-mode_persistent-hot + exec 2.09 s ± 55 ms 2.13 s ± 40 ms +1.87 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.34 s ± 97 ms 3.43 s ± 301 ms +2.71 %
large-dyn-imports_development-mode + exec 2.1 s ± 50 ms 2.08 s ± 31 ms -0.64 %
large-dyn-imports_production-mode + exec 2.05 s ± 13 ms 2.08 s ± 19 ms +1.02 %
threejs_development-mode_10x + exec 1.45 s ± 15 ms 1.47 s ± 80 ms +1.52 %
threejs_development-mode_10x_hmr + exec 824 ms ± 12 ms 824 ms ± 13 ms -0.05 %
threejs_production-mode_10x + exec 4.61 s ± 198 ms 4.65 s ± 42 ms +0.71 %
threejs_production-mode_10x_persistent-cold + exec 4.76 s ± 270 ms 4.82 s ± 362 ms +1.33 %
threejs_production-mode_10x_persistent-hot + exec 4.18 s ± 85 ms 4.21 s ± 43 ms +0.76 %
10000_big_production-mode_disable-minimize + rss memory 9627 MiB ± 93.1 MiB 9648 MiB ± 40.8 MiB +0.22 %
10000_development-mode + rss memory 689 MiB ± 20.4 MiB 712 MiB ± 22.1 MiB +3.35 %
10000_development-mode_hmr + rss memory 820 MiB ± 56.8 MiB 852 MiB ± 24.1 MiB +3.99 %
10000_production-mode + rss memory 650 MiB ± 11.7 MiB 707 MiB ± 42.5 MiB +8.83 %
10000_production-mode_persistent-cold + rss memory 776 MiB ± 29.3 MiB 813 MiB ± 19 MiB +4.76 %
10000_production-mode_persistent-hot + rss memory 759 MiB ± 49.4 MiB 777 MiB ± 30.4 MiB +2.35 %
arco-pro_development-mode + rss memory 600 MiB ± 55.2 MiB 594 MiB ± 51.5 MiB -1.16 %
arco-pro_development-mode_hmr + rss memory 507 MiB ± 19.5 MiB 516 MiB ± 16.3 MiB +1.64 %
arco-pro_production-mode + rss memory 692 MiB ± 52.3 MiB 701 MiB ± 41.2 MiB +1.39 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 718 MiB ± 28.9 MiB 709 MiB ± 135 MiB -1.27 %
arco-pro_production-mode_persistent-cold + rss memory 800 MiB ± 47.8 MiB 788 MiB ± 84 MiB -1.54 %
arco-pro_production-mode_persistent-hot + rss memory 678 MiB ± 50.8 MiB 681 MiB ± 68.3 MiB +0.50 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 707 MiB ± 47.2 MiB 707 MiB ± 83.8 MiB -0.04 %
large-dyn-imports_development-mode + rss memory 716 MiB ± 4.72 MiB 720 MiB ± 4.57 MiB +0.49 %
large-dyn-imports_production-mode + rss memory 636 MiB ± 3.66 MiB 640 MiB ± 12.4 MiB +0.59 %
threejs_development-mode_10x + rss memory 621 MiB ± 18.5 MiB 642 MiB ± 19.4 MiB +3.44 %
threejs_development-mode_10x_hmr + rss memory 782 MiB ± 23.8 MiB 794 MiB ± 45.1 MiB +1.63 %
threejs_production-mode_10x + rss memory 849 MiB ± 171 MiB 860 MiB ± 185 MiB +1.26 %
threejs_production-mode_10x_persistent-cold + rss memory 835 MiB ± 16.1 MiB 847 MiB ± 39.8 MiB +1.48 %
threejs_production-mode_10x_persistent-hot + rss memory 707 MiB ± 48.2 MiB 732 MiB ± 24.9 MiB +3.57 %

Copy link
Contributor

github-actions bot commented Jul 3, 2025

📦 Binary Size-limit

Comparing binary size with Commit: perf: parallel create map assets (#10894) by harpsealjs

❌ Size increased by 2.75KB from 59.80MB to 59.80MB (⬆️0.00%)

@chenjiahan chenjiahan requested a review from Copilot July 3, 2025 08:57
Copy link
Contributor

@Copilot Copilot AI left a 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 and render_template logic to parse and emit Base64 digests
  • Adds test fixtures for CSS localIdentName and pulls in rspack_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 on Cow<str> may not compile since Cow doesn't have a map method. Consider slicing &str directly or converting to owned string before truncation.
          let content = content.map(|s| s[..hash_len(s, len)].into());

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

Awesome 👍

Copy link

codspeed-hq bot commented Jul 3, 2025

CodSpeed Performance Report

Merging #10897 will not alter performance

Comparing fix-css-ident-base-64 (2e73290) with main (98b815e)

🎉 Hooray! codspeed-node just leveled up to 4.0.1!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 16 untouched benchmarks

@ahabhgk ahabhgk merged commit c24c686 into main Jul 3, 2025
70 of 72 checks passed
@ahabhgk ahabhgk deleted the fix-css-ident-base-64 branch July 3, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Starting from v1.2.8, localIdentName cannot be rendered correctly
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy