fix(oxc_transformer_plugins): replace_global_define plugin postfix_wildcard should only match one property#13307
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
postfix_wildcard should only match one property
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the replace_global_defines functionality where postfix wildcards were incorrectly matching multiple nested properties instead of just one. The fix ensures that when a postfix wildcard pattern is used, it only replaces the first matching property segment rather than consuming all subsequent properties.
Key changes:
- Updated the matching logic to track wildcard status and limit postfix wildcard matching to one property
- Modified test expectation to reflect the corrected behavior where nested properties after a wildcard match are preserved
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/oxc_transformer_plugins/src/replace_global_defines.rs |
Implements wildcard status tracking to prevent over-matching in postfix wildcard scenarios |
crates/oxc_transformer_plugins/tests/integrations/replace_global_defines.rs |
Updates test expectation to verify the corrected postfix wildcard behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13307 will not alter performanceComparing Summary
Footnotes |
56c4c7d to
658821b
Compare
Merge activity
|
658821b to
45e0cd9
Compare

Closed #13262