-
-
Notifications
You must be signed in to change notification settings - Fork 746
perf: replace node:assert with explicit error checks #11928
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
Conversation
✅ Deploy Preview for rspack canceled.
|
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.
Pull Request Overview
This PR removes node:assert usage across the codebase and replaces assertions with explicit runtime checks that throw descriptive errors.
- Replace assert(...) with explicit if checks and throw new Error(...) in multiple modules
- Remove assert imports and (in one case) reposition a constant declaration after imports
- Minor string/grammar tweaks in error messages
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/util/fs.ts | Replaces an assertion in rmrf with a runtime type check; adjusts iteration over directory entries. |
| packages/rspack/src/rspackOptionsApply.ts | Replaces assertions with explicit checks for required options; updates error messages. |
| packages/rspack/src/rspack.ts | Adds explicit check for options.context and throws a descriptive error. |
| packages/rspack/src/loader-runner/index.ts | Removes assert and enforces invariants in setters; moves LOADER_PROCESS_NAME after imports. |
| packages/rspack/src/lib/EntryOptionPlugin.ts | Replaces assertion with explicit error for desc.import presence. |
| packages/rspack/src/config/defaults.ts | Replaces assertion with explicit error for non-nil target. |
| packages/rspack/src/config/adapter.ts | Replaces assertions with explicit errors for tsConfig type and module.defaultRules presence; validates node options. |
| packages/rspack/src/builtin-plugin/SplitChunksPlugin.ts | Replaces assertion with explicit error when rawOptions is undefined. |
| packages/rspack/src/Watching.ts | Replaces assertion with explicit error when compilation is missing. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📦 Binary Size-limit
🙈 Size remains the same at 47.73MB |
CodSpeed Performance ReportMerging #11928 will not alter performanceComparing Summary
|
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Summary
Remove
node:assertand replace all assertions with explicit error checks that throw descriptive errors.Checklist