@@ -44,7 +44,9 @@ function getReactNativeMinorVersion(): number {
44
44
export function getMetroTransformer (
45
45
reactNativeMinorVersion : number = getReactNativeMinorVersion ( ) ,
46
46
) : MetroTransformer {
47
- if ( reactNativeMinorVersion >= 52 ) {
47
+ if ( reactNativeMinorVersion >= 56 ) {
48
+ return require ( "metro/src/reactNativeTransformer" )
49
+ } else if ( reactNativeMinorVersion >= 52 ) {
48
50
return require ( "metro/src/transformer" )
49
51
} else if ( reactNativeMinorVersion >= 0.47 ) {
50
52
return require ( "metro-bundler/src/transformer" )
@@ -74,20 +76,20 @@ export function maybeTransformMetroResult(
74
76
} )
75
77
76
78
const mapConsumer = new SourceMapConsumer ( map as any ) // upstream types are wrong
77
- ; ( traverse as any ) . cheap ( ast , ( node : Node ) => {
78
- if ( node . loc ) {
79
- const originalStart = mapConsumer . originalPositionFor ( node . loc . start )
80
- if ( originalStart . line ) {
81
- node . loc . start . line = originalStart . line
82
- node . loc . start . column = originalStart . column
83
- }
84
- const originalEnd = mapConsumer . originalPositionFor ( node . loc . end )
85
- if ( originalEnd . line ) {
86
- node . loc . end . line = originalEnd . line
87
- node . loc . end . column = originalEnd . column
79
+ ; ( traverse as any ) . cheap ( ast , ( node : Node ) => {
80
+ if ( node . loc ) {
81
+ const originalStart = mapConsumer . originalPositionFor ( node . loc . start )
82
+ if ( originalStart . line ) {
83
+ node . loc . start . line = originalStart . line
84
+ node . loc . start . column = originalStart . column
85
+ }
86
+ const originalEnd = mapConsumer . originalPositionFor ( node . loc . end )
87
+ if ( originalEnd . line ) {
88
+ node . loc . end . line = originalEnd . line
89
+ node . loc . end . column = originalEnd . column
90
+ }
88
91
}
89
- }
90
- } )
92
+ } )
91
93
92
94
return { ast }
93
95
} else if ( Array . isArray ( upstreamResult . map ) ) {
0 commit comments