@@ -209,6 +209,25 @@ let[@inline] string_optional_set s : Bsc_args.spec =
209209let [@ inline] unit_call s : Bsc_args. spec = Unit (Unit_call s)
210210let [@ inline] string_list_add s : Bsc_args. spec = String (String_list_add s)
211211
212+ let parse_source_map value =
213+ Js_config. source_map :=
214+ match String. lowercase_ascii value with
215+ | "linked" -> Linked
216+ | "inline" -> Inline
217+ | "hidden" -> Hidden
218+ | "false" | "none" -> No_source_map
219+ | value ->
220+ Bsc_args. bad_arg
221+ (" Unsupported sourceMap value: " ^ value
222+ ^ " . Expected linked, inline, hidden, false, or none" )
223+
224+ let parse_bool_ref target value =
225+ target :=
226+ match String. lowercase_ascii value with
227+ | "true" -> true
228+ | "false" -> false
229+ | value -> Bsc_args. bad_arg (" Expected true or false, got: " ^ value)
230+
212231(* mostly common used to list in the beginning to make search fast
213232*)
214233let command_line_flags : (string * Bsc_args.spec * string) array =
@@ -259,6 +278,15 @@ let command_line_flags : (string * Bsc_args.spec * string) array =
259278 string_call ignore,
260279 " *internal* Set jsx mode, this is no longer used and is a no-op." );
261280 (" -bs-jsx-preserve" , set Js_config. jsx_preserve, " *internal* Preserve jsx" );
281+ ( " -bs-source-map" ,
282+ string_call parse_source_map,
283+ " *internal* Configure source map output" );
284+ ( " -bs-source-map-sources-content" ,
285+ string_call (parse_bool_ref Js_config. source_map_sources_content),
286+ " *internal* Include original source text in source maps" );
287+ ( " -bs-source-map-root" ,
288+ string_call (fun value -> Js_config. source_map_root := value),
289+ " *internal* Set sourceRoot in source maps" );
262290 ( " -bs-package-output" ,
263291 string_call Js_packages_state. update_npm_package_path,
264292 " *internal* Set npm-output-path: [opt_module]:path, for example: \
0 commit comments