2525
2626(* * Browser is not set via command line only for internal use *)
2727
28+ type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
29+ type jsx_module = React
30+ type jsx_mode = Classic | Automatic
31+
2832let no_version_header = ref false
2933let cross_module_inline = ref false
3034let diagnose = ref false
3135
3236let get_diagnose () =
3337 ! diagnose
3438
35- # 34 " common/js_config.pp.ml"
39+ # 38 " common/js_config.pp.ml"
3640 || Sys. getenv_opt " RES_DEBUG_FILE" <> None
3741
38- # 37 " common/js_config.pp.ml"
42+ # 41 " common/js_config.pp.ml"
3943(* let (//) = Filename.concat *)
4044
4145(* let get_packages_info () = !packages_info *)
@@ -51,15 +55,41 @@ let cmi_only = ref false
5155let cmj_only = ref false
5256let force_cmi = ref false
5357let force_cmj = ref false
54- let jsx_version = ref ( - 1 )
55- let jsx_module = ref " react "
56- let jsx_mode = ref " classic "
58+ let jsx_version = ref NotSelected
59+ let jsx_module = ref React
60+ let jsx_mode = ref Classic
5761let js_stdout = ref true
5862let all_module_aliases = ref false
5963let no_stdlib = ref false
6064let no_export = ref false
6165let as_ppx = ref false
6266
67+ let int_of_jsx_version = function
68+ | Jsx_v3 -> 3
69+ | Jsx_v4 -> 4
70+ | NotSelected -> - 1
71+
72+ let string_of_jsx_module = function
73+ | React -> " react"
74+
75+ let string_of_jsx_mode = function
76+ | Classic -> " classic"
77+ | Automatic -> " automatic"
78+
79+ let jsx_version_of_int = function
80+ | 3 -> Jsx_v3
81+ | 4 -> Jsx_v4
82+ | _ -> NotSelected
83+
84+ let jsx_module_of_string = function
85+ | "react" -> React
86+ | _ -> React
87+
88+ let jsx_mode_of_string = function
89+ | "classic" -> Classic
90+ | "automatic" -> Automatic
91+ | _ -> Classic
92+
6393(* option to config `@rescript/std`*)
6494let customize_runtime : string option ref = ref None
6595let as_pp = ref false
0 commit comments