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
relate to #4381
Support
RuntimePlugin.getCompilationHooks
to modify the code which createscript
andlink
tags. Just likemainTemplate.jsonpScript/linkPrefetch/linkPreload
in webpackThis pull request introduces significant enhancements to the
rspack
project, primarily focusing on integrating new runtime plugin functionalities. The changes include adding new dependencies, expanding existing modules to support the new runtime plugins, and updating relevant hooks and structures to accommodate these additions.Enhancements to Runtime Plugin Functionality:
New Dependencies:
dashmap
andpollster
tocrates/rspack_plugin_runtime/Cargo.toml
to support the new runtime plugin functionalities.New Runtime Plugin Hooks and Data Structures:
crates/rspack_plugin_runtime/src/drive.rs
forCreateScriptData
,LinkPreloadData
, andLinkPrefetchData
.crates/rspack_binding_values/src/runtime.rs
to include newJsCreateScriptData
,JsLinkPreloadData
, andJsLinkPrefetchData
structures.Integration with Existing Plugins:
crates/node_binding/src/plugins/interceptor.rs
to register and handle new runtime plugin taps, includingRuntimePluginCreateScript
,RuntimePluginLinkPreload
, andRuntimePluginLinkPrefetch
. [1] [2]crates/node_binding/src/plugins/mod.rs
to integrate the new runtime plugin hooks into the compilation process. [1] [2]Runtime Module Enhancements:
crates/rspack_plugin_runtime/src/runtime_module/jsonp_chunk_loading.rs
to utilize the new runtime plugin hooks forlink_prefetch
andlink_preload
functionalities, ensuring that the appropriate scripts are created and linked during the chunk loading process. [1] [2]These changes collectively improve the extensibility and functionality of the
rspack
runtime environment, allowing for more sophisticated script handling and loading strategies.Checklist