Skip to content

Commit 9cb6590

Browse files
committed
clean up extract jsx in bsb config
1 parent c627462 commit 9cb6590

File tree

10 files changed

+1054
-2041
lines changed

10 files changed

+1054
-2041
lines changed

jscomp/bsb/bsb_config_parse.ml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -145,62 +145,52 @@ let extract_reason_react_jsx (map : json_map) =
145145
|> ignore;
146146
!default
147147

148-
let extract_jsx_version (map : json_map) =
149-
let default : Bsb_config_types.jsx_version option ref = ref None in
148+
let extract_jsx (map : json_map) =
149+
let version : Bsb_config_types.jsx_version option ref = ref None in
150+
let module_ : Bsb_config_types.jsx_module option ref = ref None in
151+
let mode : Bsb_config_types.jsx_mode option ref = ref None in
150152
map
151153
|? ( Bsb_build_schemas.jsx,
152154
`Obj
153155
(fun m ->
154156
match m.?(Bsb_build_schemas.jsx_version) with
155157
| Some (Flo { loc; flo }) -> (
156158
match flo with
157-
| "3" -> default := Some Jsx_v3
158-
| "4" -> default := Some Jsx_v4
159+
| "3" -> version := Some Jsx_v3
160+
| "4" -> version := Some Jsx_v4
159161
| _ -> Bsb_exception.errorf ~loc "Unsupported jsx-version %s" flo
160162
)
161163
| Some x ->
162164
Bsb_exception.config_error x
163165
"Unexpected input (expect a version number) for jsx-version"
164166
| 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
171167
|? ( Bsb_build_schemas.jsx,
172168
`Obj
173169
(fun m ->
174170
match m.?(Bsb_build_schemas.jsx_module) with
175171
| Some (Str { loc; str }) -> (
176172
match str with
177-
| "react" -> default := Some React
173+
| "react" -> module_ := Some React
178174
| _ -> Bsb_exception.errorf ~loc "Unsupported jsx-module %s" str)
179175
| Some x ->
180176
Bsb_exception.config_error x
181177
"Unexpected input (jsx module name) for jsx-mode"
182178
| None -> ()) )
183-
|> ignore;
184-
!default
185-
186-
let extract_jsx_mode (map : json_map) =
187-
let default : Bsb_config_types.jsx_mode option ref = ref None in
188-
map
189179
|? ( Bsb_build_schemas.jsx,
190180
`Obj
191181
(fun m ->
192182
match m.?(Bsb_build_schemas.jsx_mode) with
193183
| Some (Str { loc; str }) -> (
194184
match str with
195-
| "classic" -> default := Some Classic
196-
| "automatic" -> default := Some Automatic
185+
| "classic" -> mode := Some Classic
186+
| "automatic" -> mode := Some Automatic
197187
| _ -> Bsb_exception.errorf ~loc "Unsupported jsx-mode %s" str)
198188
| Some x ->
199189
Bsb_exception.config_error x
200190
"Unexpected input (expect classic or automatic) for jsx-mode"
201191
| None -> ()) )
202192
|> ignore;
203-
!default
193+
(!version, !module_, !mode)
204194

205195
let extract_warning (map : json_map) =
206196
match map.?(Bsb_build_schemas.warnings) with
@@ -349,9 +339,7 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
349339
.path)
350340
in
351341
let reason_react_jsx = extract_reason_react_jsx 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
342+
let jsx_version, jsx_module, jsx_mode = extract_jsx map in
355343
let bs_dependencies =
356344
extract_dependencies map per_proj_dir Bsb_build_schemas.bs_dependencies
357345
in

jscomp/main/builtin_cmi_datasets.ml

Lines changed: 246 additions & 1618 deletions
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(* 246acbc2f78afa1b74c882b88c92c83b *)
1+
(* c580b0f7861d00c8d2ff5be58cd1266c *)
22
let module_names : string array = Obj.magic (
33
"Js" (* 23 *),
44
"Arg" (* 217 *),

jscomp/others/release.ninja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ o others/jsx.cmi others/jsx.cmj : cc others/jsx.ml | others/belt_internals.cmi o
6363
o others/jsxDOM.cmi others/jsxDOM.cmj : cc others/jsxDOM.ml | others/belt_internals.cmi others/js.cmi others/jsx.cmj others/jsxDOMStyle.cmj others/jsxEvent.cmj $bsc
6464
o others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj : cc others/jsxDOMStyle.ml | others/belt_internals.cmi others/js.cmi $bsc
6565
o others/jsxEvent.cmi others/jsxEvent.cmj : cc others/jsxEvent.ml | others/belt_internals.cmi others/js.cmi $bsc
66-
o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/jsx.cmi others/jsx.cmj others/jsxDOM.cmi others/jsxDOM.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxEvent.cmi others/jsxEvent.cmj
66+
o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/jsx.cmi others/jsx.cmj others/jsxDOM.cmi others/jsxDOM.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxEvent.cmi others/jsxEvent.cmj
6767
o others/belt_Array.cmj : cc_cmi others/belt_Array.ml | others/belt.cmi others/belt_Array.cmi others/belt_internals.cmi others/js.cmi others/js.cmj others/js_math.cmj $bsc js_pkg
6868
o others/belt_Array.cmi : cc others/belt_Array.mli | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg
6969
o others/belt_Float.cmj : cc_cmi others/belt_Float.ml | others/belt.cmi others/belt_Float.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg

lib/4.06.1/rescript.ml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10388,62 +10388,52 @@ let extract_reason_react_jsx (map : json_map) =
1038810388
|> ignore;
1038910389
!default
1039010390

10391-
let extract_jsx_version (map : json_map) =
10392-
let default : Bsb_config_types.jsx_version option ref = ref None in
10391+
let extract_jsx (map : json_map) =
10392+
let version : Bsb_config_types.jsx_version option ref = ref None in
10393+
let module_ : Bsb_config_types.jsx_module option ref = ref None in
10394+
let mode : Bsb_config_types.jsx_mode option ref = ref None in
1039310395
map
1039410396
|? ( Bsb_build_schemas.jsx,
1039510397
`Obj
1039610398
(fun m ->
1039710399
match m.?(Bsb_build_schemas.jsx_version) with
1039810400
| Some (Flo { loc; flo }) -> (
1039910401
match flo with
10400-
| "3" -> default := Some Jsx_v3
10401-
| "4" -> default := Some Jsx_v4
10402+
| "3" -> version := Some Jsx_v3
10403+
| "4" -> version := Some Jsx_v4
1040210404
| _ -> Bsb_exception.errorf ~loc "Unsupported jsx-version %s" flo
1040310405
)
1040410406
| Some x ->
1040510407
Bsb_exception.config_error x
1040610408
"Unexpected input (expect a version number) for jsx-version"
1040710409
| None -> ()) )
10408-
|> ignore;
10409-
!default
10410-
10411-
let extract_jsx_module (map : json_map) =
10412-
let default : Bsb_config_types.jsx_module option ref = ref None in
10413-
map
1041410410
|? ( Bsb_build_schemas.jsx,
1041510411
`Obj
1041610412
(fun m ->
1041710413
match m.?(Bsb_build_schemas.jsx_module) with
1041810414
| Some (Str { loc; str }) -> (
1041910415
match str with
10420-
| "react" -> default := Some React
10416+
| "react" -> module_ := Some React
1042110417
| _ -> Bsb_exception.errorf ~loc "Unsupported jsx-module %s" str)
1042210418
| Some x ->
1042310419
Bsb_exception.config_error x
1042410420
"Unexpected input (jsx module name) for jsx-mode"
1042510421
| None -> ()) )
10426-
|> ignore;
10427-
!default
10428-
10429-
let extract_jsx_mode (map : json_map) =
10430-
let default : Bsb_config_types.jsx_mode option ref = ref None in
10431-
map
1043210422
|? ( Bsb_build_schemas.jsx,
1043310423
`Obj
1043410424
(fun m ->
1043510425
match m.?(Bsb_build_schemas.jsx_mode) with
1043610426
| Some (Str { loc; str }) -> (
1043710427
match str with
10438-
| "classic" -> default := Some Classic
10439-
| "automatic" -> default := Some Automatic
10428+
| "classic" -> mode := Some Classic
10429+
| "automatic" -> mode := Some Automatic
1044010430
| _ -> Bsb_exception.errorf ~loc "Unsupported jsx-mode %s" str)
1044110431
| Some x ->
1044210432
Bsb_exception.config_error x
1044310433
"Unexpected input (expect classic or automatic) for jsx-mode"
1044410434
| None -> ()) )
1044510435
|> ignore;
10446-
!default
10436+
(!version, !module_, !mode)
1044710437

1044810438
let extract_warning (map : json_map) =
1044910439
match map.?(Bsb_build_schemas.warnings) with
@@ -10592,9 +10582,7 @@ let interpret_json ~(package_kind : Bsb_package_kind.t) ~(per_proj_dir : string)
1059210582
.path)
1059310583
in
1059410584
let reason_react_jsx = extract_reason_react_jsx map in
10595-
let jsx_version = extract_jsx_version map in
10596-
let jsx_module = extract_jsx_module map in
10597-
let jsx_mode = extract_jsx_mode map in
10585+
let jsx_version, jsx_module, jsx_mode = extract_jsx map in
1059810586
let bs_dependencies =
1059910587
extract_dependencies map per_proj_dir Bsb_build_schemas.bs_dependencies
1060010588
in

0 commit comments

Comments
 (0)