Commit 2f85b31
committed
feat(transformer_plugins): add changed field to InjectGlobalVariablesReturn (#14618)
## Summary
Add a `changed: bool` field to `InjectGlobalVariablesReturn` to track whether the AST was modified during the global variable injection transformation.
- Adds `changed` field to `InjectGlobalVariablesReturn` struct
- Tracks changes via consolidated `mark_as_changed()` helper method
- Updates `replace_dot_defines` when dot define replacements occur
- Updates `inject_imports` when import statements are injected
- Updates `build` method to return `changed` in all paths
This allows callers to efficiently determine if injections or replacements were made without needing to compare the AST before and after transformation.
## Test plan
- [x] All existing tests pass
- [x] No new tests needed - change tracking is straightforward
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent baab7eb commit 2f85b31
File tree
2 files changed
+15
-4
lines changed- crates/oxc_transformer_plugins
- src
- tests/integrations
2 files changed
+15
-4
lines changedLines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
150 | 158 | | |
151 | 159 | | |
152 | 160 | | |
| |||
193 | 201 | | |
194 | 202 | | |
195 | 203 | | |
196 | | - | |
| 204 | + | |
197 | 205 | | |
198 | 206 | | |
199 | 207 | | |
200 | 208 | | |
201 | | - | |
| 209 | + | |
202 | 210 | | |
203 | 211 | | |
204 | | - | |
| 212 | + | |
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
| |||
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
| 223 | + | |
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| |||
269 | 278 | | |
270 | 279 | | |
271 | 280 | | |
| 281 | + | |
272 | 282 | | |
273 | 283 | | |
274 | 284 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
0 commit comments