-
-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support compilation.modules[i].blocks (#7460)
* feat: module dto * DependenciesBlockDTO * feat: DependenciesBlockDTO * feat: DependenciesBlock and Dependency in js side * chore: update api md * fix: js lint * fix: cargo lint wrong * fix: test case
- Loading branch information
Showing
12 changed files
with
376 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/configCases/compilation/modules/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import("./a"); |
30 changes: 30 additions & 0 deletions
30
packages/rspack-test-tools/tests/configCases/compilation/modules/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const rspack = require("@rspack/core"); | ||
|
||
const PLUGIN_NAME = "plugin"; | ||
|
||
class Plugin { | ||
/** | ||
* @param {import("@rspack/core").Compiler} compiler | ||
*/ | ||
apply(compiler) { | ||
compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => { | ||
compilation.hooks.processAssets.tap( | ||
{ | ||
name: PLUGIN_NAME, | ||
stage: rspack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS, | ||
}, | ||
() => { | ||
const module = Array.from(compilation.modules).find(module => module.rawRequest === "./index.js"); | ||
const block = module.blocks[0]; | ||
expect(block.dependencies[0].request).toBe("./a"); | ||
} | ||
) | ||
}); | ||
} | ||
} | ||
|
||
/**@type {import("@rspack/core").Configuration}*/ | ||
module.exports = { | ||
entry: "./index.js", | ||
plugins: [new Plugin()] | ||
}; |
Oops, something went wrong.
ccd6ee8
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.
📝 Ran ecosystem CI: Open
ccd6ee8
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.
📝 Benchmark detail: Open