-
-
Notifications
You must be signed in to change notification settings - Fork 746
refactor: rename some class and static variables #12145
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 canceled.
|
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 refactors naming across the rspack codebase to improve consistency by removing "webpack" prefixes and replacing them with more generic or rspack-specific names. The main focus is on renaming classes, constants, and static variables to better reflect their purpose or to align with rspack branding.
Key Changes
- Renamed runtime globals from
SYSTEM_CONTEXTtoAPI_SYSTEM_CONTEXT - Renamed module/file from
export_webpack_requiretoexport_require - Renamed expression name constants from
IMPORT_META_WEBPACK_*to more concise names - Renamed magic comment infrastructure from
webpack_commenttomagic_comment - Renamed dependency types and templates from
WebpackIsIncludedtoIsIncluded - Renamed various API-related constants to use
API_prefix consistently
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_plugin_runtime/src/runtime_plugin.rs | Updated reference to API_SYSTEM_CONTEXT runtime global |
| crates/rspack_plugin_runtime/src/runtime_module/system_context.rs | Updated runtime global reference in code generation |
| crates/rspack_plugin_runtime/src/runtime_module/mod.rs | Renamed module and export from export_webpack_require to export_require |
| crates/rspack_plugin_runtime/src/runtime_module/export_require.rs | Renamed struct and constant identifiers |
| crates/rspack_plugin_runtime/src/module_chunk_loading.rs | Updated import and usage of renamed runtime module |
| crates/rspack_plugin_runtime/src/lib.rs | Updated public export of renamed constant |
| crates/rspack_plugin_rstest/src/import_dependency.rs | Renamed constant from WEBPACK_REQUIRE_IMPORT_ACTUAL to REQUIRE_IMPORT_ACTUAL |
| crates/rspack_plugin_lazy_compilation/src/plugin.rs | Renamed regex static from WEBPACK_DEV_SERVER_CLIENT_RE to DEV_SERVER_CLIENT_RE |
| crates/rspack_plugin_javascript/src/visitors/dependency/util.rs | Renamed expression name constants to remove redundant "webpack" prefix |
| crates/rspack_plugin_javascript/src/visitors/dependency/parser/mod.rs | Updated plugin name from WebpackIsIncludedPlugin to IsIncludedPlugin |
| crates/rspack_plugin_javascript/src/plugin/mod.rs | Renamed variables from webpack_exports_* to rspack_exports_* |
| crates/rspack_plugin_javascript/src/plugin/impl_plugin_for_js_plugin.rs | Updated dependency template imports and registrations |
| crates/rspack_plugin_javascript/src/parser_plugin/worker_plugin.rs | Updated magic comment extraction function name and method calls |
| crates/rspack_plugin_javascript/src/parser_plugin/url_plugin.rs | Updated magic comment imports and usage |
| crates/rspack_plugin_javascript/src/parser_plugin/mod.rs | Renamed plugin module and exports from webpack_included_plugin to is_included_plugin |
| crates/rspack_plugin_javascript/src/parser_plugin/is_included_plugin.rs | Renamed plugin struct and constant |
| crates/rspack_plugin_javascript/src/parser_plugin/import_parser_plugin.rs | Updated magic comment function calls and simplified method names |
| crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs | Renamed method and updated expression name constants |
| crates/rspack_plugin_javascript/src/parser_plugin/import_meta_context_dependency_parser_plugin.rs | Updated expression name constant references |
| crates/rspack_plugin_javascript/src/parser_plugin/hot_module_replacement_plugin.rs | Updated expression name constant references |
| crates/rspack_plugin_javascript/src/parser_plugin/exports_info_api_plugin.rs | Renamed constant from WEBPACK_EXPORTS_INFO to EXPORTS_INFO |
| crates/rspack_plugin_javascript/src/parser_plugin/esm_export_dependency_parser_plugin.rs | Updated tag constant reference |
| crates/rspack_plugin_javascript/src/parser_plugin/esm_detection_parser_plugin.rs | Renamed enum variants from WebpackExports/WebpackModule to RspackExports/RspackModule |
| crates/rspack_plugin_javascript/src/parser_plugin/define_plugin/utils.rs | Renamed regex and identifier constants |
| crates/rspack_plugin_javascript/src/parser_plugin/const/mod.rs | Renamed resource fragment/query constants |
| crates/rspack_plugin_javascript/src/parser_plugin/compatibility_plugin.rs | Renamed nested identifier tag constant |
| crates/rspack_plugin_javascript/src/parser_plugin/common_js_imports_parse_plugin.rs | Updated magic comment function calls and method name |
| crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs | Renamed all API-related constants to use API_ prefix |
| crates/rspack_plugin_javascript/src/magic_comment.rs | Renamed from webpack_comment.rs, updated all types and functions |
| crates/rspack_plugin_javascript/src/lib.rs | Renamed module from webpack_comment to magic_comment |
| crates/rspack_plugin_javascript/src/dependency/is_included_dependency.rs | Renamed dependency and template types |
| crates/rspack_plugin_esm_library/src/render.rs | Updated constant import reference |
| crates/rspack_core/src/runtime_globals.rs | Renamed runtime global constant and its name mapping |
| crates/rspack_core/src/normal_module_factory.rs | Renamed function from match_webpack_ext to match_ext |
| crates/rspack_core/src/module.rs | Renamed enum variants from WebpackModule/WebpackExports to RspackModule/RspackExports |
| crates/rspack_core/src/dependency/dependency_type.rs | Renamed dependency type variant and its display string |
| crates/rspack_core/src/context_module.rs | Renamed chunk name placeholder constants |
| crates/rspack_binding_api/src/source.rs | Renamed function from to_webpack_map to to_map |
| crates/rspack_binding_api/src/runtime.rs | Updated runtime global declaration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ecd0cba to
458ec96
Compare
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
Copilot reviewed 35 out of 35 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
crates/rspack_plugin_javascript/src/parser_plugin/is_included_plugin.rs:11
- The constant name
IS_INCLUDEDwas renamed fromWEBPACK_IS_INCLUDED, but the value still contains "webpack":"__webpack_is_included__". For consistency with the renaming effort, consider either:
- Updating the value to remove the "webpack" reference (e.g.,
"__is_included__"), or - Reverting the constant name to
WEBPACK_IS_INCLUDEDto match the value.
This inconsistency could cause confusion between the constant name and its value.
crates/rspack_plugin_runtime/src/runtime_module/export_require.rs:9
- The runtime module identifier still uses the old path "webpack/runtime/export_webpack_require". Since the module was renamed to
ExportRequireRuntimeModuleand the constant toEXPORT_REQUIRE_RUNTIME_MODULE_ID, the identifier path should likely be updated to "webpack/runtime/export_require" for consistency. This could affect module resolution or caching if the identifier is used as a key.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Binary Size-limit
❌ Size increased by 4.75KB from 48.09MB to 48.09MB (⬆️0.01%) |
CodSpeed Performance ReportMerging #12145 will not alter performanceComparing Summary
|
Summary
Rename some class and static variables, remove
webpackin them.Related links
Checklist