@@ -43,14 +43,17 @@ let bad_module_format_message_exn ~loc format =
43
43
of: %s or %s"
44
44
format Literals. esmodule Literals. commonjs
45
45
46
+ let deprecated_option ~loc x message =
47
+ let loc_end =
48
+ {loc with Lexing. pos_cnum = loc.Lexing. pos_cnum + String. length x}
49
+ in
50
+ let loc = {Warnings. loc_start = loc; loc_end; loc_ghost = false } in
51
+ Location. deprecated loc message
52
+
46
53
let supported_format (x : string ) loc : Ext_module_system.t =
47
54
let _ =
48
55
if x = Literals. es6 || x = Literals. es6_global then
49
- let loc_end =
50
- {loc with Lexing. pos_cnum = loc.Lexing. pos_cnum + String. length x}
51
- in
52
- let loc = {Warnings. loc_start = loc; loc_end; loc_ghost = false } in
53
- Location. deprecated loc
56
+ deprecated_option ~loc x
54
57
(Printf. sprintf " Option \" %s\" is deprecated. Use \" %s\" instead." x
55
58
Literals. esmodule)
56
59
in
@@ -196,10 +199,14 @@ let list_dirs_by (package_specs : t) (f : string -> unit) =
196
199
type json_map = Ext_json_types .t Map_string .t
197
200
198
201
let extract_js_suffix_exn (map : json_map ) : string =
202
+ let deprecation = " The \" suffix\" option at the top level is deprecated. Move the \" suffix\" setting into each \" package-specs\" entry." in
199
203
match map.?(Bsb_build_schemas. suffix) with
200
204
| None -> Literals. suffix_js
201
- | Some (Str { str = suffix ; _ } ) when validate_js_suffix suffix -> suffix
202
- | Some ((Str {str; _} ) as config ) ->
205
+ | Some (Str { str = suffix ; loc } ) when validate_js_suffix suffix ->
206
+ deprecated_option ~loc Literals. suffix_js deprecation;
207
+ suffix
208
+ | Some ((Str {str; loc} ) as config ) ->
209
+ deprecated_option ~loc Literals. suffix_js deprecation;
203
210
Bsb_exception. config_error config
204
211
(" invalid suffix \" " ^ str ^ " \" . The suffix and may contain letters, digits, \" -\" , \" _\" and \" .\" and must end with .js, .mjs or .cjs." )
205
212
| Some config ->
0 commit comments