@@ -13,7 +13,7 @@ use rayon::prelude::*;
13
13
use relative_path:: RelativePath ;
14
14
use swc_core:: {
15
15
base:: {
16
- config:: { Config , ConfigFile , Options } ,
16
+ config:: { ConfigFile , Options , SourceMapsConfig } ,
17
17
try_with_handler, Compiler , HandlerOpts , TransformOutput ,
18
18
} ,
19
19
common:: {
@@ -266,28 +266,32 @@ struct InputContext {
266
266
#[ swc_trace]
267
267
impl CompileOptions {
268
268
fn build_transform_options ( & self , file_path : & Option < & Path > ) -> anyhow:: Result < Options > {
269
- let base_options = Options :: default ( ) ;
270
- let base_config = Config :: default ( ) ;
271
-
272
269
let config_file = self . config_file . as_ref ( ) . map ( |config_file_path| {
273
270
ConfigFile :: Str ( config_file_path. to_string_lossy ( ) . to_string ( ) )
274
271
} ) ;
275
272
276
- let mut ret = Options {
277
- config : Config { ..base_config } ,
273
+ let mut options = Options {
278
274
config_file,
279
- ..base_options
275
+ ..Options :: default ( )
280
276
} ;
281
277
282
278
if let Some ( file_path) = * file_path {
283
- ret . filename = file_path. to_str ( ) . unwrap_or_default ( ) . to_owned ( ) ;
279
+ options . filename = file_path. to_str ( ) . unwrap_or_default ( ) . to_owned ( ) ;
284
280
}
285
281
286
282
if let Some ( env_name) = & self . env_name {
287
- ret. env_name = env_name. to_string ( ) ;
283
+ options. env_name = env_name. to_string ( ) ;
284
+ }
285
+
286
+ if let Some ( source_maps) = & self . source_maps {
287
+ options. source_maps = Some ( match source_maps. as_str ( ) {
288
+ "false" => SourceMapsConfig :: Bool ( false ) ,
289
+ "true" => SourceMapsConfig :: Bool ( true ) ,
290
+ value => SourceMapsConfig :: Str ( value. to_string ( ) ) ,
291
+ } ) ;
288
292
}
289
293
290
- Ok ( ret )
294
+ Ok ( options )
291
295
}
292
296
293
297
/// Create canonical list of inputs to be processed across stdin / single
0 commit comments