Skip to content

refactor: processing more string concatenation in runtime template part 1#12225

Merged
LingyuCoder merged 3 commits intomainfrom
refactor/runtime-template-1
Nov 18, 2025
Merged

refactor: processing more string concatenation in runtime template part 1#12225
LingyuCoder merged 3 commits intomainfrom
refactor/runtime-template-1

Conversation

@LingyuCoder
Copy link
Copy Markdown
Contributor

Summary

Should process all string concatenation in runtime templates of runtime modules and avoid processing them in rust dead code.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 18, 2025 07:02
@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Nov 18, 2025
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 18, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 0a720a3
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/691c1ea8df7b2b0008bfd5ec

@LingyuCoder LingyuCoder changed the title refactor: processing more string concatenation in runtime template refactor: processing more string concatenation in runtime template part 1 Nov 18, 2025
Copy link
Copy Markdown
Contributor

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 refactors runtime module template processing by moving string concatenation logic from Rust code into EJS runtime templates. This improves maintainability by centralizing template logic and avoiding dead code in Rust.

Key changes:

  • Refactored multiple runtime modules to use template variables instead of Rust string concatenation
  • Adopted underscore-prefixed naming convention for template variables
  • Moved conditional logic into EJS templates using <% if %> blocks
  • Updated test snapshots to reflect changes in generated runtime code

Reviewed Changes

Copilot reviewed 44 out of 46 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/rspack-test/statsOutputCases/* Updated snapshot hashes reflecting changed runtime output
tests/rspack-test/statsAPICases/*.js Modified tests to normalize dynamic size values for consistency
crates/rspack_plugin_runtime/src/runtime_module/runtime/*.ejs Refactored templates to handle string concatenation and conditional logic
crates/rspack_plugin_runtime/src/runtime_module/*.rs Simplified Rust code by passing boolean/string flags instead of pre-concatenated strings
crates/rspack_plugin_runtime/src/runtime_module/runtime/make_namespace_object.js Removed dead code file
Comments suppressed due to low confidence (1)

crates/rspack_plugin_runtime/src/runtime_module/load_script.rs:1

  • [nitpick] The import cow_utils::CowUtils is removed but this appears to be intentional as part of the refactoring away from string manipulation in Rust code. Ensure that this dependency can be removed from Cargo.toml if it's no longer used elsewhere in the crate.
use std::ptr::NonNull;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 0a720a3 to fix: swc-loader should not respect .swcrc (#12222) by CPunisher

🎉 Size decreased by 5.50KB from 47.48MB to 47.47MB (⬇️0.01%)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 18, 2025

CodSpeed Performance Report

Merging #12225 will not alter performance

Comparing refactor/runtime-template-1 (0a720a3) with main (2f78a97)

Summary

✅ 17 untouched

@LingyuCoder LingyuCoder enabled auto-merge (squash) November 18, 2025 08:27
@LingyuCoder LingyuCoder merged commit 3875176 into main Nov 18, 2025
47 checks passed
@LingyuCoder LingyuCoder deleted the refactor/runtime-template-1 branch November 18, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: refactor team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants