@@ -43,14 +43,17 @@ let bad_module_format_message_exn ~loc format =
4343 of: %s or %s"
4444 format Literals. esmodule Literals. commonjs
4545
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+
4653let supported_format (x : string ) loc : Ext_module_system.t =
4754 let _ =
4855 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
5457 (Printf. sprintf " Option \" %s\" is deprecated. Use \" %s\" instead." x
5558 Literals. esmodule)
5659 in
@@ -196,10 +199,14 @@ let list_dirs_by (package_specs : t) (f : string -> unit) =
196199type json_map = Ext_json_types .t Map_string .t
197200
198201let 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
199203 match map.?(Bsb_build_schemas. suffix) with
200204 | 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;
203210 Bsb_exception. config_error config
204211 (" invalid suffix \" " ^ str ^ " \" . The suffix and may contain letters, digits, \" -\" , \" _\" and \" .\" and must end with .js, .mjs or .cjs." )
205212 | Some config ->
0 commit comments