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.
Related issue (if exists)
#3158
Summary
Adds the afterCompile hook needed for ProgressPlugin.
🤖 Generated by Copilot at 5f4b7af
This pull request adds a new
finishMake
hook to the rspack compiler and its node binding. The hook allows plugins to run custom functions after the modules and dependencies are created. The pull request also adds a custom plugin example and a test case that use the hook to remove the hash from the output filenames. The pull request modifies several files in thecrates
andpackages
folders to implement and expose the hook.Walkthrough
🤖 Generated by Copilot at 5f4b7af
FinishMake
to the enumHook
that represents the types of hooks for plugins (link)from_str
function that converts a string to aHook
variant for theFinishMake
case (link)finish_make
to the structHooks
that holds the JavaScript functions registered as hooks by plugins (link)finish_make_tsfn
to the structPlugin
that wraps thefinish_make
JavaScript function in a threadsafe function (link)finish_make
to the structPlugin
that calls thefinish_make_tsfn
with the current compilation (link)finish_make
JavaScript function to the list of arguments for thenew
function of the structPlugin
(link)finish_make_tsfn
field with thejs_fn_into_theadsafe_fn!
macro in thenew
function of the structPlugin
(link)finish_make_tsfn
field to the return value of thenew
function of the structPlugin
(link)compile
method of the structCompiler
incrates/rspack_core/src/compiler/mod.rs
that calls thefinish_make
method of theplugin_driver
after themake
method and before theafter_compile
method (link)finish_make
to the traitPluginAPI
that takes a mutable reference to aCompilation
and returns aResult<()>
(link)finish_make
to the structPluginDriver
that iterates over the plugins and calls theirfinish_make
methods with the current compilation (link)examples/basic/rspack.config.js
that contains a custom plugin classRemoveHashPlugin
that demonstrates the usage of thefinishMake
hook (link)plugins
to theconfig
object inexamples/basic/rspack.config.js
that contains an instance of theRemoveHashPlugin
class (link)finishMake
to the classCompiler
inpackages/rspack/src/compiler.ts
that is an instance of thetapable.AsyncSeriesHook
class that represents thefinishMake
hook (link)finishMake
property with a new instance of thetapable.AsyncSeriesHook
class in the constructor of the classCompiler
inpackages/rspack/src/compiler.ts
(link)finishMake
to the object that is returned by thegetHooks
method of the classCompiler
inpackages/rspack/src/compiler.ts
that is assigned the value of the#finishMake
private method of the class (link)finishMake
to the object that is passed to thecreateCompiler
function inpackages/rspack/src/compiler.ts
that is assigned the value of thefinishMake
property of thehooks
object (link)#finishMake
to the classCompiler
inpackages/rspack/src/compiler.ts
that calls thefinishMake
hook with the current compilation and updates the list of disabled hooks (link)packages/rspack/tests/configCases/hooks/compilation-hooks/a.js
that contains a simple export statement and is used as a dependency by theindex.js
file in the same folder (link)packages/rspack/tests/configCases/hooks/compilation-hooks/index.js
that contains a simple import statement and a test case that verifies thefinishMake
hook (link)packages/rspack/tests/configCases/hooks/compilation-hooks/webpack.config.js
that contains the configuration options for the test case that verifies thefinishMake
hook (link)