chore(rust): bump toolchain to 1.93.0#2147
Conversation
Also fix clippy warnings and refresh generated web-core-wasm .d.ts outputs.
|
📝 WalkthroughWalkthroughThe pull request combines Rust code refactoring across multiple SWC plugin crates to eliminate unsafe Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes The SWC plugin changes are homogeneous and straightforward, but the WASM bindings reorganization across six files involves extensive public API surface changes, function signature modifications, and requires careful verification of backward compatibility and wasm-bindgen conventions. Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/react/transform/crates/swc_plugin_inject/napi.rs (1)
31-44: Guard against short arrays to avoid panics.Indexing
v[1]/v[2]can panic on malformed input, which is possible across the N-API boundary. Validatev.len()per variant and returnInvalidArgwhen insufficient data is provided.🛠️ Suggested fix
- if let Ok(v) = array_val { - return match v[0].as_str() { - "expr" => Ok(InjectAs::Expr(v[1].clone())), - "importDefault" => Ok(InjectAs::ImportDefault(v[1].clone())), - "importStarAs" => Ok(InjectAs::ImportStarAs(v[1].clone())), - "importNamed" => Ok(InjectAs::ImportNamed(v[1].clone(), v[2].clone())), + if let Ok(v) = array_val { + let err = || { + Err(napi::bindgen_prelude::error!( + napi::bindgen_prelude::Status::InvalidArg, + "value does not match any variant of enum `{}`", + "InjectAs" + )) + }; + if v.is_empty() { + return err(); + } + return match v[0].as_str() { + "expr" if v.len() >= 2 => Ok(InjectAs::Expr(v[1].clone())), + "importDefault" if v.len() >= 2 => Ok(InjectAs::ImportDefault(v[1].clone())), + "importStarAs" if v.len() >= 2 => Ok(InjectAs::ImportStarAs(v[1].clone())), + "importNamed" if v.len() >= 3 => Ok(InjectAs::ImportNamed(v[1].clone(), v[2].clone())), - _ => Err(napi::bindgen_prelude::error!( - napi::bindgen_prelude::Status::InvalidArg, - "value does not match any variant of enum `{}`", - "InjectAs" - )), + _ => err(), }; }
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance
Comparing Footnotes
|
Web Explorer#7382 Bundle Size — 382.04KiB (-0.7%).4191d68(current) vs 43fc7e7 main#7379(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch colinaaa:chore/rust-1.93.0 Project dashboard Generated by RelativeCI Documentation Report issue |
Also fix clippy warnings and refresh generated web-core-wasm .d.ts outputs.
Summary by CodeRabbit
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist