@@ -54,7 +54,7 @@ type t =
5454 { common : Jsoo_cmdline.Arg .t
5555 ; (* compile option *)
5656 profile : Driver .profile option
57- ; source_map : ( string option * Source_map.Standard .t ) option
57+ ; source_map : Source_map.Encoding_spec .t option
5858 ; runtime_files : string list
5959 ; no_runtime : bool
6060 ; include_runtime : bool
@@ -158,6 +158,10 @@ let options =
158158 let doc = " Do not inline sources in source map." in
159159 Arg. (value & flag & info [ " source-map-no-source" ] ~doc )
160160 in
161+ let sourcemap_empty =
162+ let doc = " Always generate empty source maps." in
163+ Arg. (value & flag & info [ " empty-sourcemap" ; " empty-source-map" ] ~doc )
164+ in
161165 let sourcemap_root =
162166 let doc = " root dir for source map." in
163167 Arg. (value & opt (some string ) None & info [ " source-map-root" ] ~doc )
@@ -296,6 +300,7 @@ let options =
296300 sourcemap
297301 sourcemap_inline_in_js
298302 sourcemap_don't_inline_content
303+ sourcemap_empty
299304 sourcemap_root
300305 target_env
301306 output_file
@@ -330,12 +335,19 @@ let options =
330335 | `Name file , _ -> Some file, Some (chop_extension file ^ " .map" )
331336 | `Stdout , _ -> None , None
332337 in
333- Some
334- ( sm_output_file
335- , { (Source_map.Standard. empty ~inline_source_content ) with
336- file
337- ; sourceroot = sourcemap_root
338- } )
338+ let source_map =
339+ { (Source_map.Standard. empty ~inline_source_content ) with
340+ file
341+ ; sourceroot = sourcemap_root
342+ }
343+ in
344+ let spec =
345+ { Source_map.Encoding_spec. output_file = sm_output_file
346+ ; source_map
347+ ; keep_empty = sourcemap_empty
348+ }
349+ in
350+ Some spec
339351 else None
340352 in
341353 let params : (string * string) list = List. flatten set_param in
@@ -391,6 +403,7 @@ let options =
391403 $ sourcemap
392404 $ sourcemap_inline_in_js
393405 $ sourcemap_don't_inline_content
406+ $ sourcemap_empty
394407 $ sourcemap_root
395408 $ target_env
396409 $ output_file
@@ -437,6 +450,10 @@ let options_runtime_only =
437450 let doc = " Do not inline sources in source map." in
438451 Arg. (value & flag & info [ " source-map-no-source" ] ~doc )
439452 in
453+ let sourcemap_empty =
454+ let doc = " Always generate empty source maps." in
455+ Arg. (value & flag & info [ " empty-sourcemap" ; " empty-source-map" ] ~doc )
456+ in
440457 let sourcemap_root =
441458 let doc = " root dir for source map." in
442459 Arg. (value & opt (some string ) None & info [ " source-map-root" ] ~doc )
@@ -548,6 +565,7 @@ let options_runtime_only =
548565 sourcemap
549566 sourcemap_inline_in_js
550567 sourcemap_don't_inline_content
568+ sourcemap_empty
551569 sourcemap_root
552570 target_env
553571 output_file
@@ -570,12 +588,19 @@ let options_runtime_only =
570588 | `Name file , _ -> Some file, Some (chop_extension file ^ " .map" )
571589 | `Stdout , _ -> None , None
572590 in
573- Some
574- ( sm_output_file
575- , { (Source_map.Standard. empty ~inline_source_content ) with
576- file
577- ; sourceroot = sourcemap_root
578- } )
591+ let source_map =
592+ { (Source_map.Standard. empty ~inline_source_content ) with
593+ file
594+ ; sourceroot = sourcemap_root
595+ }
596+ in
597+ let spec =
598+ { Source_map.Encoding_spec. output_file = sm_output_file
599+ ; source_map
600+ ; keep_empty = sourcemap_empty
601+ }
602+ in
603+ Some spec
579604 else None
580605 in
581606 let params : (string * string) list = List. flatten set_param in
@@ -626,6 +651,7 @@ let options_runtime_only =
626651 $ sourcemap
627652 $ sourcemap_inline_in_js
628653 $ sourcemap_don't_inline_content
654+ $ sourcemap_empty
629655 $ sourcemap_root
630656 $ target_env
631657 $ output_file
0 commit comments