feat: Add support for assigning numbers in beforeModuleIds hook#13222
feat: Add support for assigning numbers in beforeModuleIds hook#13222hamlim wants to merge 4 commits intoweb-infra-dev:mainfrom
beforeModuleIds hook#13222Conversation
beforeModuleIds hook
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dbab8476c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #[napi(object)] | ||
| pub struct JsBeforeModuleIdsResult { | ||
| pub assignments: HashMap<String, String>, | ||
| pub assignments: HashMap<String, Either<String, u32>>, |
There was a problem hiding this comment.
Avoid truncating numeric module IDs to uint32
beforeModuleIds now accepts number from JS, but this binding narrows every numeric assignment to u32. That means values outside the unsigned 32-bit integer domain (for example negative IDs, fractional IDs, or IDs larger than 2^32 - 1) cannot round-trip and will be rewritten by the conversion layer instead of preserving the value the plugin set. This changes behavior from the previous string-based path and can silently produce incorrect module IDs in stats/output for those plugins.
Useful? React with 👍 / 👎.
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
This is a follow on change from this previous PR: #12809 which added support for assigning string values in the
beforeModuleIdshook, this PR extends that to support assigning numbers as well.This was highlighted in this PR comment here: #12809 (comment) as an enhancement to the existing logic.
Related links
Previous PR: #12809
Checklist