@@ -222,6 +222,7 @@ pub type GenTypeConfig = serde_json::Value;
222222pub enum DeprecationWarning {
223223 BsDependencies ,
224224 BsDevDependencies ,
225+ BscFlags ,
225226}
226227
227228/// # bsconfig.json representation
@@ -247,14 +248,15 @@ pub struct Config {
247248 // Deprecated field: overwrites dev_dependencies
248249 #[ serde( rename = "bs-dev-dependencies" ) ]
249250 bs_dev_dependencies : Option < Vec < String > > ,
250- // Holds all deprecation warnings for the config struct
251- #[ serde( skip) ]
252- deprecation_warnings : Vec < DeprecationWarning > ,
253-
254251 #[ serde( rename = "ppx-flags" ) ]
255252 pub ppx_flags : Option < Vec < OneOrMore < String > > > ,
256- #[ serde( rename = "bsc-flags" , alias = "compiler-flags" ) ]
257- pub bsc_flags : Option < Vec < OneOrMore < String > > > ,
253+
254+ #[ serde( rename = "compiler-flags" ) ]
255+ pub compiler_flags : Option < Vec < OneOrMore < String > > > ,
256+ // Deprecated field: overwrites compiler_flags
257+ #[ serde( rename = "bsc-flags" ) ]
258+ bsc_flags : Option < Vec < OneOrMore < String > > > ,
259+
258260 pub namespace : Option < NamespaceConfig > ,
259261 pub jsx : Option < JsxSpecs > ,
260262 #[ serde( rename = "gentypeconfig" ) ]
@@ -265,6 +267,10 @@ pub struct Config {
265267 // this is a new feature of rewatch, and it's not part of the bsconfig.json spec
266268 #[ serde( rename = "allowed-dependents" ) ]
267269 pub allowed_dependents : Option < Vec < String > > ,
270+
271+ // Holds all deprecation warnings for the config struct
272+ #[ serde( skip) ]
273+ deprecation_warnings : Vec < DeprecationWarning > ,
268274}
269275
270276/// This flattens string flags
@@ -588,6 +594,10 @@ impl Config {
588594 ) ;
589595 }
590596
597+ if self . compiler_flags . is_some ( ) && self . bsc_flags . is_some ( ) {
598+ bail ! ( "compiler-flags and bsc-flags are mutually exclusive. Please use 'compiler-flags'" ) ;
599+ }
600+
591601 if self . bs_dependencies . is_some ( ) {
592602 self . dependencies = self . bs_dependencies . take ( ) ;
593603 self . deprecation_warnings . push ( DeprecationWarning :: BsDependencies ) ;
@@ -597,6 +607,10 @@ impl Config {
597607 self . deprecation_warnings
598608 . push ( DeprecationWarning :: BsDevDependencies ) ;
599609 }
610+ if self . bsc_flags . is_some ( ) {
611+ self . compiler_flags = self . bsc_flags . take ( ) ;
612+ self . deprecation_warnings . push ( DeprecationWarning :: BscFlags ) ;
613+ }
600614
601615 Ok ( ( ) )
602616 }
@@ -629,6 +643,7 @@ pub mod tests {
629643 bs_dependencies : None ,
630644 bs_dev_dependencies : None ,
631645 ppx_flags : None ,
646+ compiler_flags : None ,
632647 bsc_flags : None ,
633648 namespace : None ,
634649 jsx : None ,
0 commit comments