@@ -44,11 +44,11 @@ let extract_package_name_and_namespace (map : json_map) : string * string option
44
44
=
45
45
let package_name =
46
46
match map.?(Bsb_build_schemas. name) with
47
- | Some (Str { str = "_" } as config ) ->
48
- Bsb_exception. config_error config " _ is a reserved package name"
47
+ | Some (Str { str = "_" } as manifest ) ->
48
+ Bsb_exception. manifest_error manifest " _ is a reserved package name"
49
49
| Some (Str { str = name } ) -> name
50
- | Some config ->
51
- Bsb_exception. config_error config " name expect a string field"
50
+ | Some manifest ->
51
+ Bsb_exception. manifest_error manifest " name expect a string field"
52
52
| None -> Bsb_exception. invalid_spec " field name is required"
53
53
in
54
54
let namespace =
@@ -59,8 +59,8 @@ let extract_package_name_and_namespace (map : json_map) : string * string option
59
59
| Some (Str { str } ) ->
60
60
(* TODO : check the validity of namespace *)
61
61
Some (Ext_namespace. namespace_of_package_name str)
62
- | Some x ->
63
- Bsb_exception. config_error x " namespace field expects string or boolean"
62
+ | Some manifest ->
63
+ Bsb_exception. manifest_error manifest " namespace field expects string or boolean"
64
64
in
65
65
(package_name, namespace)
66
66
@@ -89,33 +89,33 @@ let check_stdlib (map : json_map) : bool =
89
89
| None | Some _ -> true
90
90
91
91
let extract_gentype_config (map : json_map ) : Bsb_config_types.gentype_config =
92
- match map.?(Bsb_build_schemas. gentypeconfig ) with
92
+ match map.?(Bsb_build_schemas. gentype ) with
93
93
| None -> false
94
94
| Some (Obj _ ) -> true
95
- | Some config ->
96
- Bsb_exception. config_error config " gentypeconfig expect an object"
95
+ | Some manifest ->
96
+ Bsb_exception. manifest_error manifest " gentypeconfig expect an object"
97
97
98
98
let extract_uncurried (map : json_map ) : bool =
99
99
match map.?(Bsb_build_schemas. uncurried) with
100
100
| None -> true
101
101
| Some (True _ ) -> true
102
102
| Some (False _ ) -> false
103
- | Some config ->
104
- Bsb_exception. config_error config " uncurried expects one of: true, false."
103
+ | Some manifest ->
104
+ Bsb_exception. manifest_error manifest " uncurried expects one of: true, false."
105
105
106
106
let extract_string (map : json_map ) (field : string ) cb =
107
107
match map.?(field) with
108
108
| None -> None
109
109
| Some (Str { str } ) -> cb str
110
- | Some config -> Bsb_exception. config_error config (field ^ " expect a string" )
110
+ | Some manifest -> Bsb_exception. manifest_error manifest (field ^ " expect a string" )
111
111
112
112
let extract_boolean (map : json_map ) (field : string ) (default : bool ) : bool =
113
113
match map.?(field) with
114
114
| None -> default
115
115
| Some (True _ ) -> true
116
116
| Some (False _ ) -> false
117
- | Some config ->
118
- Bsb_exception. config_error config (field ^ " expect a boolean" )
117
+ | Some manifest ->
118
+ Bsb_exception. manifest_error manifest (field ^ " expect a boolean" )
119
119
120
120
let extract_reason_react_jsx (map : json_map ) =
121
121
let default : Bsb_config_types.reason_react_jsx option ref = ref None in
@@ -130,7 +130,7 @@ let extract_reason_react_jsx (map : json_map) =
130
130
| _ -> Bsb_exception. errorf ~loc " Unsupported jsx version %s" flo
131
131
)
132
132
| Some x ->
133
- Bsb_exception. config_error x
133
+ Bsb_exception. manifest_error x
134
134
" Unexpected input (expect a version number) for jsx, note \
135
135
boolean is no longer allowed"
136
136
| None -> () ) )
@@ -141,14 +141,14 @@ let extract_warning (map : json_map) =
141
141
match map.?(Bsb_build_schemas. warnings) with
142
142
| None -> Bsb_warning. use_default
143
143
| Some (Obj { map } ) -> Bsb_warning. from_map map
144
- | Some config -> Bsb_exception. config_error config " expect an object"
144
+ | Some manifest -> Bsb_exception. manifest_error manifest " expect an object"
145
145
146
146
let extract_ignored_dirs (map : json_map ) : Set_string.t =
147
147
match map.?(Bsb_build_schemas. ignored_dirs) with
148
148
| None -> Set_string. empty
149
149
| Some (Arr { content } ) ->
150
150
Set_string. of_list (Bsb_build_util. get_list_string content)
151
- | Some config -> Bsb_exception. config_error config " expect an array of string"
151
+ | Some manifest -> Bsb_exception. manifest_error manifest " expect an array of string"
152
152
153
153
let extract_generators (map : json_map ) =
154
154
let generators = ref Map_string. empty in
@@ -169,8 +169,8 @@ let extract_generators (map : json_map) =
169
169
{| generators exepect format like { " name" : " cppo" , " command" : " cppo $in -o $out" } | }
170
170
)
171
171
| _ -> acc)
172
- | Some config ->
173
- Bsb_exception. config_error config
172
+ | Some manifest ->
173
+ Bsb_exception. manifest_error manifest
174
174
(Bsb_build_schemas. generators ^ " expect an array field" ));
175
175
! generators
176
176
@@ -181,14 +181,14 @@ let extract_dependencies (map : json_map) cwd (field : string) :
181
181
| Some (Arr { content = s } ) ->
182
182
Ext_list. map (Bsb_build_util. get_list_string s) (fun s ->
183
183
resolve_package cwd (Bsb_pkg_types. string_as_package s))
184
- | Some config -> Bsb_exception. config_error config (field ^ " expect an array" )
184
+ | Some manifest -> Bsb_exception. manifest_error manifest (field ^ " expect an array" )
185
185
186
186
(* return an empty array if not found *)
187
187
let extract_string_list (map : json_map ) (field : string ) : string list =
188
188
match map.?(field) with
189
189
| None -> []
190
190
| Some (Arr { content = s } ) -> Bsb_build_util. get_list_string s
191
- | Some config -> Bsb_exception. config_error config (field ^ " expect an array" )
191
+ | Some manifest -> Bsb_exception. manifest_error manifest (field ^ " expect an array" )
192
192
193
193
let extract_ppx (map : json_map ) (field : string ) ~(cwd : string ) :
194
194
Bsb_config_types. ppx list =
@@ -209,12 +209,12 @@ let extract_ppx (map : json_map) (field : string) ~(cwd : string) :
209
209
| Arr { content } -> (
210
210
let xs = Bsb_build_util. get_list_string content in
211
211
match xs with
212
- | [] -> Bsb_exception. config_error x " empty array is not allowed"
212
+ | [] -> Bsb_exception. manifest_error x " empty array is not allowed"
213
213
| name :: args -> { Bsb_config_types. name = resolve name; args })
214
- | config ->
215
- Bsb_exception. config_error config
214
+ | manifest ->
215
+ Bsb_exception. manifest_error manifest
216
216
(field ^ " expect each item to be either string or array" ))
217
- | Some config -> Bsb_exception. config_error config (field ^ " expect an array" )
217
+ | Some manifest -> Bsb_exception. manifest_error manifest (field ^ " expect an array" )
218
218
219
219
let extract_js_post_build (map : json_map ) cwd : string option =
220
220
let js_post_build_cmd = ref None in
0 commit comments