@@ -33,7 +33,7 @@ let resolve_package cwd package_name =
33
33
package_install_path = x // Bsb_config. lib_ocaml
34
34
}
35
35
36
- type json_map = Ext_json_types .t String_map .t
36
+ type json_map = Ext_json_types .t Map_string .t
37
37
(* Key is the path *)
38
38
let (|?) m (key , cb ) =
39
39
m |> Ext_json. test key cb
@@ -71,7 +71,7 @@ let extract_main_entries (map :json_map) =
71
71
| _ -> failwith " Unrecognized object inside array 'entries' field." )
72
72
field in
73
73
let entries = ref Bsb_default. main_entries in
74
- begin match String_map . find_opt map Bsb_build_schemas. entries with
74
+ begin match Map_string . find_opt map Bsb_build_schemas. entries with
75
75
| Some (Arr {content = s } ) -> entries := extract_entries s
76
76
| _ -> ()
77
77
end ; ! entries
@@ -85,7 +85,7 @@ let package_specs_from_bsconfig () =
85
85
begin match json with
86
86
| Obj {map} ->
87
87
begin
88
- match String_map . find_opt map Bsb_build_schemas. package_specs with
88
+ match Map_string . find_opt map Bsb_build_schemas. package_specs with
89
89
| Some x ->
90
90
Bsb_package_specs. from_json x
91
91
| None ->
@@ -104,7 +104,7 @@ let package_specs_from_bsconfig () =
104
104
let extract_package_name_and_namespace
105
105
(map : json_map ) : string * string option =
106
106
let package_name =
107
- match String_map . find_opt map Bsb_build_schemas. name with
107
+ match Map_string . find_opt map Bsb_build_schemas. name with
108
108
109
109
| Some (Str { str = " _" } as config)
110
110
->
@@ -119,7 +119,7 @@ let extract_package_name_and_namespace
119
119
" field name is required"
120
120
in
121
121
let namespace =
122
- match String_map . find_opt map Bsb_build_schemas. namespace with
122
+ match Map_string . find_opt map Bsb_build_schemas. namespace with
123
123
| None
124
124
| Some (False _)
125
125
-> None
@@ -142,7 +142,7 @@ let extract_package_name_and_namespace
142
142
(kinda check npm upgrade)
143
143
*)
144
144
let check_version_exit (map : json_map ) stdlib_path =
145
- match String_map . find_exn map Bsb_build_schemas. version with
145
+ match Map_string . find_exn map Bsb_build_schemas. version with
146
146
| Str {str } ->
147
147
if str <> Bs_version. version then
148
148
begin
@@ -158,7 +158,7 @@ let check_version_exit (map : json_map) stdlib_path =
158
158
| _ -> assert false
159
159
160
160
let check_stdlib (map : json_map ) cwd (* built_in_package*) =
161
- match String_map . find_opt map Bsb_build_schemas. use_stdlib with
161
+ match Map_string . find_opt map Bsb_build_schemas. use_stdlib with
162
162
| Some (False _ ) -> None
163
163
| None
164
164
| Some _ ->
@@ -180,7 +180,7 @@ let check_stdlib (map : json_map) cwd (*built_in_package*) =
180
180
181
181
end
182
182
let extract_bs_suffix_exn (map : json_map ) =
183
- match String_map . find_opt map Bsb_build_schemas. suffix with
183
+ match Map_string . find_opt map Bsb_build_schemas. suffix with
184
184
| None -> false
185
185
| Some (Str {str} as config ) ->
186
186
if str = Literals. suffix_js then false
@@ -193,11 +193,11 @@ let extract_bs_suffix_exn (map : json_map) =
193
193
194
194
let extract_gentype_config (map : json_map ) cwd
195
195
: Bsb_config_types.gentype_config option =
196
- match String_map . find_opt map Bsb_build_schemas. gentypeconfig with
196
+ match Map_string . find_opt map Bsb_build_schemas. gentypeconfig with
197
197
| None -> None
198
198
| Some (Obj {map = obj } ) ->
199
199
Some { path =
200
- match String_map . find_opt obj Bsb_build_schemas. path with
200
+ match Map_string . find_opt obj Bsb_build_schemas. path with
201
201
| None ->
202
202
(Bsb_build_util. resolve_bsb_magic_file
203
203
~cwd ~desc: " gentype.exe"
@@ -215,7 +215,7 @@ let extract_gentype_config (map : json_map) cwd
215
215
config " gentypeconfig expect an object"
216
216
217
217
let extract_refmt (map : json_map ) cwd : Bsb_config_types.refmt =
218
- match String_map . find_opt map Bsb_build_schemas. refmt with
218
+ match Map_string . find_opt map Bsb_build_schemas. refmt with
219
219
| Some (Flo {flo} as config ) ->
220
220
begin match flo with
221
221
| "3" -> Bsb_config_types. Refmt_v3
@@ -232,14 +232,14 @@ let extract_refmt (map : json_map) cwd : Bsb_config_types.refmt =
232
232
Refmt_none
233
233
234
234
let extract_string (map : json_map ) (field : string ) cb =
235
- match String_map . find_opt map field with
235
+ match Map_string . find_opt map field with
236
236
| None -> None
237
237
| Some (Str{str} ) -> cb str
238
238
| Some config ->
239
239
Bsb_exception. config_error config (field ^ " expect a string" )
240
240
241
241
let extract_boolean (map : json_map ) (field : string ) (default : bool ) : bool =
242
- match String_map . find_opt map field with
242
+ match Map_string . find_opt map field with
243
243
| None -> default
244
244
| Some (True _ ) -> true
245
245
| Some (False _ ) -> false
@@ -250,7 +250,7 @@ let extract_reason_react_jsx (map : json_map) =
250
250
let default : Bsb_config_types.reason_react_jsx option ref = ref None in
251
251
map
252
252
|? (Bsb_build_schemas. reason, `Obj begin fun m ->
253
- match String_map . find_opt m Bsb_build_schemas. react_jsx with
253
+ match Map_string . find_opt m Bsb_build_schemas. react_jsx with
254
254
| Some (Flo{loc; flo} ) ->
255
255
begin match flo with
256
256
| "2" ->
@@ -267,32 +267,32 @@ let extract_reason_react_jsx (map : json_map) =
267
267
! default
268
268
269
269
let extract_warning (map : json_map ) =
270
- match String_map . find_opt map Bsb_build_schemas. warnings with
270
+ match Map_string . find_opt map Bsb_build_schemas. warnings with
271
271
| None -> None
272
272
| Some (Obj {map } ) -> Bsb_warning. from_map map
273
273
| Some config -> Bsb_exception. config_error config " expect an object"
274
274
275
275
let extract_ignored_dirs (map : json_map ) =
276
- match String_map . find_opt map Bsb_build_schemas. ignored_dirs with
277
- | None -> String_set . empty
276
+ match Map_string . find_opt map Bsb_build_schemas. ignored_dirs with
277
+ | None -> Set_string . empty
278
278
| Some (Arr {content} ) ->
279
- String_set . of_list (Bsb_build_util. get_list_string content)
279
+ Set_string . of_list (Bsb_build_util. get_list_string content)
280
280
| Some config ->
281
281
Bsb_exception. config_error config " expect an array of string"
282
282
283
283
let extract_generators (map : json_map ) =
284
- let generators = ref String_map . empty in
285
- (match String_map . find_opt map Bsb_build_schemas. generators with
284
+ let generators = ref Map_string . empty in
285
+ (match Map_string . find_opt map Bsb_build_schemas. generators with
286
286
| None -> ()
287
287
| Some (Arr {content = s } ) ->
288
288
generators :=
289
- Ext_array. fold_left s String_map . empty (fun acc json ->
289
+ Ext_array. fold_left s Map_string . empty (fun acc json ->
290
290
match json with
291
291
| Obj {map = m ; loc} ->
292
- begin match String_map . find_opt m Bsb_build_schemas. name,
293
- String_map . find_opt m Bsb_build_schemas. command with
292
+ begin match Map_string . find_opt m Bsb_build_schemas. name,
293
+ Map_string . find_opt m Bsb_build_schemas. command with
294
294
| Some (Str {str = name } ), Some ( Str {str = command } ) ->
295
- String_map . add acc name command
295
+ Map_string . add acc name command
296
296
| _ , _ ->
297
297
Bsb_exception. errorf ~loc {| generators exepect format like { " name" : " cppo" , " command" : " cppo $in -o $out" } | }
298
298
end
@@ -305,7 +305,7 @@ let extract_generators (map : json_map) =
305
305
306
306
let extract_dependencies (map : json_map ) cwd (field : string )
307
307
: Bsb_config_types.dependencies =
308
- match String_map . find_opt map field with
308
+ match Map_string . find_opt map field with
309
309
| None -> []
310
310
| Some (Arr ({content = s } )) ->
311
311
Ext_list. map (Bsb_build_util. get_list_string s) (fun s -> resolve_package cwd (Bsb_pkg_types. string_as_package s))
@@ -315,7 +315,7 @@ let extract_dependencies (map : json_map) cwd (field : string )
315
315
316
316
(* return an empty array if not found *)
317
317
let extract_string_list (map : json_map ) (field : string ) : string list =
318
- match String_map . find_opt map field with
318
+ match Map_string . find_opt map field with
319
319
| None -> []
320
320
| Some (Arr {content = s } ) ->
321
321
Bsb_build_util. get_list_string s
@@ -326,7 +326,7 @@ let extract_ppx
326
326
(map : json_map )
327
327
(field : string )
328
328
~(cwd : string ) : Bsb_config_types.ppx list =
329
- match String_map . find_opt map field with
329
+ match Map_string . find_opt map field with
330
330
| None -> []
331
331
| Some (Arr {content } ) ->
332
332
let resolve s =
@@ -406,7 +406,7 @@ let interpret_json
406
406
(* The default situation is empty *)
407
407
let built_in_package = check_stdlib map per_proj_dir in
408
408
let package_specs =
409
- match String_map . find_opt map Bsb_build_schemas. package_specs with
409
+ match Map_string . find_opt map Bsb_build_schemas. package_specs with
410
410
| Some x ->
411
411
Bsb_package_specs. from_json x
412
412
| None -> Bsb_package_specs. default_package_specs
@@ -425,7 +425,7 @@ let interpret_json
425
425
if toplevel then
426
426
extract_dependencies map per_proj_dir Bsb_build_schemas. bs_dev_dependencies
427
427
else [] in
428
- begin match String_map . find_opt map Bsb_build_schemas. sources with
428
+ begin match Map_string . find_opt map Bsb_build_schemas. sources with
429
429
| Some sources ->
430
430
let cut_generators =
431
431
extract_boolean map Bsb_build_schemas. cut_generators false in
@@ -465,7 +465,7 @@ let interpret_json
465
465
| None -> package_specs
466
466
| Some x -> x );
467
467
file_groups = groups;
468
- files_to_install = String_hash_set . create 96 ;
468
+ files_to_install = Hash_set_string . create 96 ;
469
469
built_in_dependency = built_in_package;
470
470
generate_merlin =
471
471
extract_boolean map Bsb_build_schemas. generate_merlin true ;
0 commit comments