Commit 32c3d2f
Pass
Summary:
Pull Request resolved: #54967
`unstable_transformProfile` is used by Metro to hint at the appropriate set of Babel transforms for the target engine.
To be effective in `react-native/babel-preset`, it must currently be passed in the preset config.
When the user does not use a custom Babel config, `react-native/metro-babel-transformer` detects that and auto-configures the preset with options from Metro - that's fine.
But if the user has their own Babel config, building on top of `react-native/babel-preset`, the preset for the config is fixed - so `unstable_transformProfile` has no effect.
Ideally, `unstable_transformProfile` should be a function of the target engine - it's totally reasonable for one instance of Metro to build for multiple engines - so this should instead be passed programmatically to the engine by Metro for each transform job.
Babel provides a mechanism to do this efficiently, without reinitialising the preset unnecessarily, via the `caller` API.
This passes `unstable_transformProfile` through `caller`.
Changelog: [Internal]
(This is part of using a more optimised transform profiles for Hermes V1, which is still an experimental opt-in. When we stabilise Hermes V1 in RN, we should stabilise this API)
Reviewed By: vzaidman, huntie
Differential Revision: D82625477
fbshipit-source-id: 76a4d73d192c2deb03bed2064856e526de25f2ecunstable_transformProfile through Babel caller API and fall back to it in @react-native/babel-preset (#54967)1 parent 8f10b33 commit 32c3d2f
3 files changed
+23
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | | - | |
| 53 | + | |
46 | 54 | | |
47 | | - | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
252 | 261 | | |
253 | 262 | | |
254 | 263 | | |
255 | | - | |
| 264 | + | |
256 | 265 | | |
257 | 266 | | |
258 | 267 | | |
259 | | - | |
| 268 | + | |
260 | 269 | | |
261 | 270 | | |
262 | | - | |
| 271 | + | |
263 | 272 | | |
264 | 273 | | |
265 | 274 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
197 | 204 | | |
198 | 205 | | |
199 | 206 | | |
| |||
0 commit comments