-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
feat: add buildModule hook #3466
feat: add buildModule hook #3466
Conversation
You can ping me as soon as you finish this PR or have any questions. |
@h-a-n-a thank you, actually I'm facing a problem there. One of the things that I need there is Can you please point me what I’m missing there? The only thing I need is just an |
a006f49
to
ed3ac17
Compare
ed3ac17
to
ba5afa8
Compare
@h-a-n-a it is ready for review |
Related issue (if exists)
#3158
Summary
🤖 Generated by Copilot at a006f49
This pull request adds a new hook
buildModule
to the compiler that allows plugins to customize the building of JavaScript modules. It implements the hook in both the Rust and the JavaScript layer of the compiler and adds a test case to verify its functionality. It also refactors some code related to theJsModule
struct and theHook
enum.Walkthrough
🤖 Generated by Copilot at a006f49
buildModule
hook to theHook
enum and theFrom<&str>
implementation forHook
incrates/node_binding/src/hook.rs
(link,link)build_module
field to theJsHooks
struct and a newbuild_module_tsfn
field to thePlugin
struct incrates/node_binding/src/plugins/mod.rs
(link,link)build_module
method to thePlugin
struct and thePluginDriver
trait implementation forPlugin
incrates/node_binding/src/plugins/mod.rs
(link,link)build_module_tsfn
field in thePlugin
constructor and destructor incrates/node_binding/src/plugins/mod.rs
(link,link)JsModule
struct definition fromcrates/node_binding/src/js_values/module.rs
tocrates/node_binding/src/hook.rs
and remove the unusedoriginal_source
field (link,link)identifier
method to theJsModule
struct incrates/node_binding/src/hook.rs
(link)build_module
method in thePluginDriver
trait implementation forPluginDriverImpl
incrates/rspack_core/src/plugin/plugin_driver.rs
(link)buildModule
field to theCompilation
class and initialize it with a newSyncHook
instance inpackages/rspack/src/compilation.ts
(link,link)identifier
method from theJsModule
class inpackages/rspack/src/compilation.ts
(link)buildModule
method to thehooks
object and thehookMap
object in theCompiler
class inpackages/rspack/src/compiler.ts
(link,link)buildModule
method to theCompiler
class inpackages/rspack/src/compiler.ts
that calls thebuildModule
hook and updates the disabled hooks state (link)buildModule
hook inpackages/rspack/tests/configCases/hooks/build-module
directory, consisting ofa.js
,index.js
, andwebpack.config.js
files (link,link,link)