@@ -145,42 +145,59 @@ let extract_reason_react_jsx (map : json_map) =
145
145
|> ignore;
146
146
! default
147
147
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
150
150
map
151
- |? ( Bsb_build_schemas. react ,
151
+ |? ( Bsb_build_schemas. jsx ,
152
152
`Obj
153
153
(fun m ->
154
154
match m.?(Bsb_build_schemas. jsx_version) with
155
155
| Some (Flo { loc; flo } ) -> (
156
156
match flo with
157
157
| "3" -> default := Some Jsx_v3
158
158
| "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)
160
179
| Some x ->
161
180
Bsb_exception. config_error x
162
- " Unexpected input (expect a version number ) for jsx"
181
+ " Unexpected input (jsx module name ) for jsx-mode "
163
182
| None -> () ) )
164
183
|> ignore;
165
184
! default
166
185
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
169
188
map
170
- |? ( Bsb_build_schemas. react ,
189
+ |? ( Bsb_build_schemas. jsx ,
171
190
`Obj
172
191
(fun m ->
173
- match m.?(Bsb_build_schemas. react_runtime ) with
192
+ match m.?(Bsb_build_schemas. jsx_mode ) with
174
193
| Some (Str { loc; str } ) -> (
175
194
match str with
176
195
| "classic" -> default := Some Classic
177
196
| "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)
180
198
| Some x ->
181
199
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"
184
201
| None -> () ) )
185
202
|> ignore;
186
203
! default
@@ -332,8 +349,9 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
332
349
.path)
333
350
in
334
351
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
337
355
let bs_dependencies =
338
356
extract_dependencies map per_proj_dir Bsb_build_schemas. bs_dependencies
339
357
in
@@ -390,8 +408,9 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
390
408
generate_merlin =
391
409
extract_boolean map Bsb_build_schemas. generate_merlin false ;
392
410
reason_react_jsx;
393
- react_jsx;
394
- react_runtime;
411
+ jsx_version;
412
+ jsx_module;
413
+ jsx_mode;
395
414
generators = extract_generators map;
396
415
cut_generators;
397
416
}
0 commit comments