@@ -52,8 +52,8 @@ function loadJsonFile(jsonFilename) {
52
52
}
53
53
54
54
// only used with RN >= 52
55
- async function sourceMapAstInPlace ( tsMap , babelAst ) {
56
- const tsConsumer = await new SourceMapConsumer ( tsMap )
55
+ function sourceMapAstInPlace ( tsMap , babelAst ) {
56
+ const tsConsumer = new SourceMapConsumer ( tsMap )
57
57
traverse . default . cheap ( babelAst , node => {
58
58
if ( node . loc ) {
59
59
const originalStart = tsConsumer . originalPositionFor ( node . loc . start )
@@ -70,8 +70,8 @@ async function sourceMapAstInPlace(tsMap, babelAst) {
70
70
} )
71
71
}
72
72
73
- async function composeRawSourceMap ( tsMap , babelMap ) {
74
- const tsConsumer = await new SourceMapConsumer ( tsMap )
73
+ function composeRawSourceMap ( tsMap , babelMap ) {
74
+ const tsConsumer = new SourceMapConsumer ( tsMap )
75
75
const composedMap = [ ]
76
76
babelMap . forEach (
77
77
( [ generatedLine , generatedColumn , originalLine , originalColumn , name ] ) => {
@@ -104,15 +104,9 @@ async function composeRawSourceMap(tsMap, babelMap) {
104
104
return composedMap
105
105
}
106
106
107
- async function composeSourceMaps (
108
- tsMap ,
109
- babelMap ,
110
- tsFileName ,
111
- tsContent ,
112
- babelCode
113
- ) {
114
- const tsConsumer = await new SourceMapConsumer ( tsMap )
115
- const babelConsumer = await new SourceMapConsumer ( babelMap )
107
+ function composeSourceMaps ( tsMap , babelMap , tsFileName , tsContent , babelCode ) {
108
+ const tsConsumer = new SourceMapConsumer ( tsMap )
109
+ const babelConsumer = new SourceMapConsumer ( babelMap )
116
110
const map = new SourceMapGenerator ( )
117
111
map . setSourceContent ( tsFileName , tsContent )
118
112
babelConsumer . eachMapping (
@@ -204,7 +198,7 @@ module.exports.getCacheKey = function() {
204
198
return key . digest ( 'hex' )
205
199
}
206
200
207
- module . exports . transform = async function ( src , filename , options ) {
201
+ module . exports . transform = function ( src , filename , options ) {
208
202
if ( typeof src === 'object' ) {
209
203
// handle RN >= 0.46
210
204
; ( { src, filename, options } = src )
@@ -244,23 +238,18 @@ module.exports.transform = async function(src, filename, options) {
244
238
}
245
239
}
246
240
247
- const babelCompileResult = await Promise . resolve (
248
- upstreamTransformer . transform ( {
249
- src : tsCompileResult . outputText ,
250
- filename,
251
- options,
252
- } )
253
- )
241
+ const babelCompileResult = upstreamTransformer . transform ( {
242
+ src : tsCompileResult . outputText ,
243
+ filename,
244
+ options,
245
+ } )
254
246
255
247
if ( reactNativeMinorVersion >= 52 ) {
256
- await sourceMapAstInPlace (
257
- tsCompileResult . sourceMapText ,
258
- babelCompileResult . ast
259
- )
248
+ sourceMapAstInPlace ( tsCompileResult . sourceMapText , babelCompileResult . ast )
260
249
return babelCompileResult
261
250
}
262
251
263
- const composedMap = await ( Array . isArray ( babelCompileResult . map )
252
+ const composedMap = Array . isArray ( babelCompileResult . map )
264
253
? composeRawSourceMap (
265
254
tsCompileResult . sourceMapText ,
266
255
babelCompileResult . map
@@ -271,7 +260,7 @@ module.exports.transform = async function(src, filename, options) {
271
260
filename ,
272
261
src ,
273
262
babelCompileResult . code
274
- ) )
263
+ )
275
264
276
265
return Object . assign ( { } , babelCompileResult , {
277
266
map : composedMap ,
0 commit comments