fix: should validate options of builtin swc loader#10055
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes the validation logic for options passed to the built‑in swc‑loader. It adjusts the signature and return values of the validate function, adds dedicated swc‑loader validation within the rule set configurations, and updates related tests to verify the behavior.
- Updated the validate function in util/validate.ts to include an optional output flag and adjust its error handling.
- Integrated swc‑loader option validation via new Zod cross‑checker patterns in config/zod.ts.
- Added a new Zod schema for plugin import configuration and corresponding tests.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/util/validate.ts | Modified validate() signature and adjusted error return values for improved swc-loader options validation. |
| packages/rspack/src/config/zod.ts | Introduced swc-loader validation in rule set options with dedicated cross-checker patterns. |
| packages/rspack/src/config/utils.ts | Updated the signature for cross-field validation tests. |
| packages/rspack/src/builtin-loader/swc/pluginImport.ts | Added a new Zod schema for swc-loader plugin import configuration. |
| packages/rspack-test-tools/tests/configCases/builtin-swc-loader/validate/rspack.config.js | Provided a test case to verify the swc-loader options validation. |
| packages/rspack-test-tools/tests/configCases/builtin-swc-loader/validate/errors.js | Defined expected error messages for invalid swc-loader options. |
94dfa3d to
bbcfa80
Compare
CodSpeed Performance ReportMerging #10055 will not alter performanceComparing Summary
|
chenjiahan
left a comment
There was a problem hiding this comment.
Can you run ecosystem CI to see if this PR will break downstream projects
According to the eco-ci result of latest main here, the only difference is rsdoctor which fails because of using |
Summary
fix #8180
Should validate options of
builtin:swc-loaderChecklist