@@ -43,7 +43,7 @@ type t =
4343 { common : Jsoo_cmdline.Arg .t
4444 ; (* compile option *)
4545 profile : Driver .profile option
46- ; source_map : (string option * Source_map .t ) option
46+ ; source_map : (string option * Source_map.Standard . t ) option
4747 ; runtime_files : string list
4848 ; no_runtime : bool
4949 ; include_runtime : bool
@@ -280,6 +280,7 @@ let options =
280280 input_file
281281 js_files
282282 keep_unit_names =
283+ let inline_source_content = not sourcemap_don't_inline_content in
283284 let chop_extension s = try Filename. chop_extension s with Invalid_argument _ -> s in
284285 let runtime_files = js_files in
285286 let fs_external = fs_external || (toplevel && no_cmis) in
@@ -302,19 +303,15 @@ let options =
302303 then
303304 let file, sm_output_file =
304305 match output_file with
305- | `Name file , _ when sourcemap_inline_in_js -> file, None
306- | `Name file , _ -> file, Some (chop_extension file ^ " .map" )
307- | `Stdout , _ -> " STDIN " , None
306+ | `Name file , _ when sourcemap_inline_in_js -> Some file, None
307+ | `Name file , _ -> Some file, Some (chop_extension file ^ " .map" )
308+ | `Stdout , _ -> None , None
308309 in
309310 Some
310311 ( sm_output_file
311- , { Source_map. version = 3
312- ; file
312+ , { ( Source_map.Standard. empty ~inline_source_content ) with
313+ file
313314 ; sourceroot = sourcemap_root
314- ; sources = []
315- ; sources_content = (if sourcemap_don't_inline_content then None else Some [] )
316- ; names = []
317- ; mappings = Source_map.Mappings. empty
318315 } )
319316 else None
320317 in
@@ -519,6 +516,7 @@ let options_runtime_only =
519516 target_env
520517 output_file
521518 js_files =
519+ let inline_source_content = not sourcemap_don't_inline_content in
522520 let chop_extension s = try Filename. chop_extension s with Invalid_argument _ -> s in
523521 let runtime_files = js_files in
524522 let output_file =
@@ -531,19 +529,15 @@ let options_runtime_only =
531529 then
532530 let file, sm_output_file =
533531 match output_file with
534- | `Name file , _ when sourcemap_inline_in_js -> file, None
535- | `Name file , _ -> file, Some (chop_extension file ^ " .map" )
536- | `Stdout , _ -> " STDIN " , None
532+ | `Name file , _ when sourcemap_inline_in_js -> Some file, None
533+ | `Name file , _ -> Some file, Some (chop_extension file ^ " .map" )
534+ | `Stdout , _ -> None , None
537535 in
538536 Some
539537 ( sm_output_file
540- , { Source_map. version = 3
541- ; file
538+ , { ( Source_map.Standard. empty ~inline_source_content ) with
539+ file
542540 ; sourceroot = sourcemap_root
543- ; sources = []
544- ; sources_content = (if sourcemap_don't_inline_content then None else Some [] )
545- ; names = []
546- ; mappings = Source_map.Mappings. empty
547541 } )
548542 else None
549543 in
0 commit comments