@@ -44,7 +44,9 @@ function getReactNativeMinorVersion(): number {
4444export function getMetroTransformer (
4545 reactNativeMinorVersion : number = getReactNativeMinorVersion ( ) ,
4646) : MetroTransformer {
47- if ( reactNativeMinorVersion >= 52 ) {
47+ if ( reactNativeMinorVersion >= 56 ) {
48+ return require ( "metro/src/reactNativeTransformer" )
49+ } else if ( reactNativeMinorVersion >= 52 ) {
4850 return require ( "metro/src/transformer" )
4951 } else if ( reactNativeMinorVersion >= 0.47 ) {
5052 return require ( "metro-bundler/src/transformer" )
@@ -74,20 +76,20 @@ export function maybeTransformMetroResult(
7476 } )
7577
7678 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+ }
8891 }
89- }
90- } )
92+ } )
9193
9294 return { ast }
9395 } else if ( Array . isArray ( upstreamResult . map ) ) {
0 commit comments