@@ -36,7 +36,7 @@ const {
3636
3737import type { TransformResultDependency } from 'metro/src/DeltaBundler' ;
3838import type { DynamicRequiresBehavior } from '../ModuleGraph/worker/collectDependencies' ;
39- import type { Ast } from '@babel/core' ;
39+ import type { Ast , BabelSourceMap } from '@babel/core' ;
4040import type { Plugins as BabelPlugins } from 'babel-core' ;
4141import type { MetroSourceMapSegmentTuple } from 'metro-source-map' ;
4242
@@ -69,9 +69,11 @@ export type BabelTransformer = {|
6969 getCacheKey ?: ( ) => string ,
7070| } ;
7171
72- export type MinifyOptions = {
73- filename ?: string ,
74- reserved ?: $ReadOnlyArray < string > ,
72+ export type MinifierOptions = {
73+ code : string ,
74+ map : ?BabelSourceMap ,
75+ filename : string ,
76+ reserved : $ReadOnlyArray < string > ,
7577} ;
7678
7779export type Type = 'script' | 'module' | 'asset' ;
@@ -314,7 +316,7 @@ class JsTransformer {
314316 result . code ,
315317 sourceCode ,
316318 map ,
317- { reserved} ,
319+ reserved ,
318320 ) ) ;
319321 }
320322
@@ -326,7 +328,7 @@ class JsTransformer {
326328 code : string ,
327329 source : string ,
328330 map : Array < MetroSourceMapSegmentTuple > ,
329- options ?: MinifyOptions = { } ,
331+ reserved ?: $ReadOnlyArray < string > = [ ] ,
330332 ) : Promise < {
331333 code: string ,
332334 map : Array < MetroSourceMapSegmentTuple > ,
@@ -338,7 +340,12 @@ class JsTransformer {
338340 const minify = getMinifier ( this . _config . minifierPath ) ;
339341
340342 try {
341- const minified = minify ( code , sourceMap , filename , options ) ;
343+ const minified = minify ( {
344+ code,
345+ map : sourceMap ,
346+ filename,
347+ reserved,
348+ } ) ;
342349
343350 return {
344351 code : minified . code ,
0 commit comments