@@ -145,42 +145,59 @@ let extract_reason_react_jsx (map : json_map) =
145145 |> ignore;
146146 ! default
147147
148- let extract_react_jsx (map : json_map ) =
149- let default : Bsb_config_types.react_jsx option ref = ref None in
148+ let extract_jsx_version (map : json_map ) =
149+ let default : Bsb_config_types.jsx_version option ref = ref None in
150150 map
151- |? ( Bsb_build_schemas. react ,
151+ |? ( Bsb_build_schemas. jsx ,
152152 `Obj
153153 (fun m ->
154154 match m.?(Bsb_build_schemas. jsx_version) with
155155 | Some (Flo { loc; flo } ) -> (
156156 match flo with
157157 | "3" -> default := Some Jsx_v3
158158 | "4" -> default := Some Jsx_v4
159- | _ -> Bsb_exception. errorf ~loc " Unsupported react-jsx %s" flo)
159+ | _ -> Bsb_exception. errorf ~loc " Unsupported jsx-version %s" flo
160+ )
161+ | Some x ->
162+ Bsb_exception. config_error x
163+ " Unexpected input (expect a version number) for jsx-version"
164+ | None -> () ) )
165+ |> ignore;
166+ ! default
167+
168+ let extract_jsx_module (map : json_map ) =
169+ let default : Bsb_config_types.jsx_module option ref = ref None in
170+ map
171+ |? ( Bsb_build_schemas. jsx,
172+ `Obj
173+ (fun m ->
174+ match m.?(Bsb_build_schemas. jsx_module) with
175+ | Some (Str { loc; str } ) -> (
176+ match str with
177+ | "react" -> default := Some React
178+ | _ -> Bsb_exception. errorf ~loc " Unsupported jsx-module %s" str)
160179 | Some x ->
161180 Bsb_exception. config_error x
162- " Unexpected input (expect a version number ) for jsx"
181+ " Unexpected input (jsx module name ) for jsx-mode "
163182 | None -> () ) )
164183 |> ignore;
165184 ! default
166185
167- let extract_react_runtime (map : json_map ) =
168- let default : Bsb_config_types.react_runtime option ref = ref None in
186+ let extract_jsx_mode (map : json_map ) =
187+ let default : Bsb_config_types.jsx_mode option ref = ref None in
169188 map
170- |? ( Bsb_build_schemas. react ,
189+ |? ( Bsb_build_schemas. jsx ,
171190 `Obj
172191 (fun m ->
173- match m.?(Bsb_build_schemas. react_runtime ) with
192+ match m.?(Bsb_build_schemas. jsx_mode ) with
174193 | Some (Str { loc; str } ) -> (
175194 match str with
176195 | "classic" -> default := Some Classic
177196 | "automatic" -> default := Some Automatic
178- | _ ->
179- Bsb_exception. errorf ~loc " Unsupported react-runtime %s" str)
197+ | _ -> Bsb_exception. errorf ~loc " Unsupported jsx-mode %s" str)
180198 | Some x ->
181199 Bsb_exception. config_error x
182- " Unexpected input (expect classic or automatic) for \
183- react-runtime"
200+ " Unexpected input (expect classic or automatic) for jsx-mode"
184201 | None -> () ) )
185202 |> ignore;
186203 ! default
@@ -332,8 +349,9 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
332349 .path)
333350 in
334351 let reason_react_jsx = extract_reason_react_jsx map in
335- let react_jsx = extract_react_jsx map in
336- let react_runtime = extract_react_runtime map in
352+ let jsx_version = extract_jsx_version map in
353+ let jsx_module = extract_jsx_module map in
354+ let jsx_mode = extract_jsx_mode map in
337355 let bs_dependencies =
338356 extract_dependencies map per_proj_dir Bsb_build_schemas. bs_dependencies
339357 in
@@ -390,8 +408,9 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
390408 generate_merlin =
391409 extract_boolean map Bsb_build_schemas. generate_merlin false ;
392410 reason_react_jsx;
393- react_jsx;
394- react_runtime;
411+ jsx_version;
412+ jsx_module;
413+ jsx_mode;
395414 generators = extract_generators map;
396415 cut_generators;
397416 }
0 commit comments