Skip to content

fix(oxc_transformer_plugins): replace_global_define plugin postfix_wildcard should only match one property#13307

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-26-fix_replace_global_define_postfix_wildcard_should_only_match_one_property
Aug 26, 2025
Merged

fix(oxc_transformer_plugins): replace_global_define plugin postfix_wildcard should only match one property#13307
graphite-app[bot] merged 1 commit intomainfrom
08-26-fix_replace_global_define_postfix_wildcard_should_only_match_one_property

Conversation

@IWANABETHATGUY
Copy link
Contributor

@IWANABETHATGUY IWANABETHATGUY commented Aug 26, 2025

Closed #13262

Copy link
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 26, 2025 05:57
Copilot AI review requested due to automatic review settings August 26, 2025 05:57
@IWANABETHATGUY IWANABETHATGUY changed the title fix: replace_global_define postfix_wildcard should only match one property fix(oxc_transformer_plugins): replace_global_define plugin postfix_wildcard should only match one property Aug 26, 2025
Copy link
Contributor

Copilot AI left a 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 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.

@github-actions github-actions bot added the C-bug Category - Bug label Aug 26, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 26, 2025

CodSpeed Instrumentation Performance Report

Merging #13307 will not alter performance

Comparing 08-26-fix_replace_global_define_postfix_wildcard_should_only_match_one_property (45e0cd9) with main (9abb7b7)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on main (45e0cd9) during the generation of this report, so 9abb7b7 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@IWANABETHATGUY IWANABETHATGUY force-pushed the 08-26-fix_replace_global_define_postfix_wildcard_should_only_match_one_property branch from 56c4c7d to 658821b Compare August 26, 2025 06:06
@IWANABETHATGUY IWANABETHATGUY added the 0-merge Merge with Graphite Merge Queue label Aug 26, 2025
Copy link
Contributor Author

IWANABETHATGUY commented Aug 26, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 08-26-fix_replace_global_define_postfix_wildcard_should_only_match_one_property branch from 658821b to 45e0cd9 Compare August 26, 2025 07:18
@graphite-app graphite-app bot merged commit 45e0cd9 into main Aug 26, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 08-26-fix_replace_global_define_postfix_wildcard_should_only_match_one_property branch August 26, 2025 07:23
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transformer: define: { 'import.meta.env.*': 'undefined' } replaces import.meta.env.n.e.s.t.e.d as void 0

3 participants