-
-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: chunk graph get module hash (#9242)
- Loading branch information
Showing
11 changed files
with
89 additions
and
21 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
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.
27 changes: 27 additions & 0 deletions
27
packages/rspack-test-tools/tests/configCases/chunk-graph/get-module-hash/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,27 @@ | ||
class Plugin { | ||
apply(compiler) { | ||
compiler.hooks.compilation.tap("Test", compilation => { | ||
compilation.hooks.processAssets.tap("Test", () => { | ||
const module = Array.from(compilation.modules)[0]; | ||
const moduleHash = compilation.chunkGraph.getModuleHash(module, "main"); | ||
expect(moduleHash).toBeTruthy(); | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
/** @type {import("@rspack/core").Configuration} */ | ||
module.exports = { | ||
target: "web", | ||
node: false, | ||
entry: { | ||
main: "./index.js" | ||
}, | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
optimization: { | ||
sideEffects: false | ||
}, | ||
plugins: [new Plugin()] | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export type RuntimeSpec = string | Set<string> | undefined; | ||
|
||
export function toJsRuntimeSpec( | ||
runtime: RuntimeSpec | ||
): string | string[] | undefined { | ||
if (runtime instanceof Set) { | ||
return Array.from(runtime); | ||
} | ||
return runtime; | ||
} |
c1e945f
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
c1e945f
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.
📝 Ecosystem CI detail: Open