refactor: remove dependency parent module identifier #3024
Merged
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)
Summary
make_failed_module
to avoid dependencies passing through & refactor some logic of rebuild to implement the first work.馃 Generated by Copilot at c13d60d
This pull request refactors the dependency system in the
rspack_core
package to simplify the dependency representation and the compilation logic. It removes theparent_module_identifier
field and methods from various dependency structs, and uses the module graph to store and track the parent modules of dependencies. It also introduces a new typeBuildDependency
, which is a tuple of(DependencyId, Option<ModuleIdentifier>)
, and uses it to handle dependencies that need to be rebuilt. It updates thecompile
method of theCompilation
struct and the related methods of theCompiler
andHmr
structs to accept and processBuildDependency
values. It also adds a.changeset
file to document the changes for thechangesets
tool.Walkthrough
馃 Generated by Copilot at c13d60d
rspack_core
package to store the parent module identifier of each dependency in the module graph, instead of in the dependency itself (link)SetupMakeParam::ForceBuildDeps
variant to take aHashSet<BuildDependency>
instead of aHashSet<DependencyId>
, whereBuildDependency
is a new type alias for a tuple of(DependencyId, Option<ModuleIdentifier>)
(link)Compilation
struct:make_failed_module
andmake_failed_dependencies
, which areHashSet
s ofModuleIdentifier
andBuildDependency
, respectively, and are used to store the modules and dependencies that failed to build during the compilation (link, link)compile
method of theCompilation
struct to use the new fields and parameters, and to handle the module creation and error handling for each dependency that needs to be rebuilt (link, link, link, link, link, link, link, link, link)handle_hmr
method of theHmr
struct to convert thedeps
variable into aHashSet<BuildDependency>
and pass it to thecompile
method of theCompilation
struct (link)build
method of theCompiler
struct to convert thedeps
variable into aHashSet<BuildDependency>
and pass it to thecompile
method of theCompilation
struct (link)dependencies
field from theAddTaskResult
,FactorizeTask
,BuildTask
, andBuildTaskResult
structs, and theModuleReused
andModuleAdded
variants, in thequeue.rs
file, since they are no longer needed (link, link, link, link, link, link)parent_module_identifier
field and methods from theCommonJsRequireContextDependency
,EsmDynamicImportDependency
, andImportContextDependency
structs, and theparent_module_identifier
method from theConstDependency
,ContextElementDependency
, andEntryDependency
structs, in thedependency
module, since they are no longer needed (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)DynEq
andDynHash
imports from themod.rs
file in thedependency
module, since they are no longer required by theDependency
andModuleDependency
traits (link)