@@ -140,21 +140,22 @@ pub enum NamespaceConfig {
140140 String ( String ) ,
141141}
142142
143- #[ derive( Deserialize , Debug , Clone ) ]
143+ #[ derive( Deserialize , Debug , Clone , Eq , PartialEq ) ]
144+ #[ serde( rename_all = "camelCase" ) ]
144145pub enum JsxMode {
145- #[ serde( rename = "classic" ) ]
146146 Classic ,
147- #[ serde( rename = "automatic" ) ]
148147 Automatic ,
149148}
150149
151- #[ derive( Deserialize , Debug , Clone ) ]
150+ #[ derive( Deserialize , Debug , Clone , Eq , PartialEq ) ]
151+ #[ serde( rename_all = "camelCase" ) ]
152+ #[ serde( untagged) ]
152153pub enum JsxModule {
153- #[ serde( rename = "react" ) ]
154154 React ,
155+ Other ( String ) ,
155156}
156157
157- #[ derive( Deserialize , Debug , Clone ) ]
158+ #[ derive( Deserialize , Debug , Clone , Eq , PartialEq ) ]
158159pub struct JsxSpecs {
159160 pub version : Option < i32 > ,
160161 pub module : Option < JsxModule > ,
@@ -376,6 +377,9 @@ impl Config {
376377 Some ( JsxModule :: React ) => {
377378 vec ! [ "-bs-jsx-module" . to_string( ) , "react" . to_string( ) ]
378379 }
380+ Some ( JsxModule :: Other ( module) ) => {
381+ vec ! [ "-bs-jsx-module" . to_string( ) , module]
382+ }
379383 None => vec ! [ ] ,
380384 } ,
381385 _ => vec ! [ ] ,
@@ -476,7 +480,7 @@ mod tests {
476480 "# ;
477481
478482 let config = serde_json:: from_str :: < Config > ( json) . unwrap ( ) ;
479- if let OneOrMore :: Single ( source) = config. sources {
483+ if let Some ( OneOrMore :: Single ( source) ) = config. sources {
480484 let source = source. to_qualified_without_children ( None ) ;
481485 assert_eq ! ( source. type_, Some ( String :: from( "dev" ) ) ) ;
482486 } else {
@@ -507,6 +511,35 @@ mod tests {
507511 assert_eq ! ( config. get_gentype_arg( ) , vec![ "-bs-gentype" . to_string( ) ] ) ;
508512 }
509513
514+ #[ test]
515+ fn test_other_jsx_module ( ) {
516+ let json = r#"
517+ {
518+ "name": "my-monorepo",
519+ "sources": [ { "dir": "src/", "subdirs": true } ],
520+ "package-specs": [ { "module": "es6", "in-source": true } ],
521+ "suffix": ".mjs",
522+ "pinned-dependencies": [ "@teamwalnut/app" ],
523+ "bs-dependencies": [ "@teamwalnut/app" ],
524+ "jsx": {
525+ "module": "Voby.JSX"
526+ }
527+ }
528+ "# ;
529+
530+ let config = serde_json:: from_str :: < Config > ( json) . unwrap ( ) ;
531+ assert ! ( config. jsx. is_some( ) ) ;
532+ assert_eq ! (
533+ config. jsx. unwrap( ) ,
534+ JsxSpecs {
535+ version: None ,
536+ module: Some ( JsxModule :: Other ( String :: from( "Voby.JSX" ) ) ) ,
537+ mode: None ,
538+ v3_dependencies: None ,
539+ } ,
540+ ) ;
541+ }
542+
510543 #[ test]
511544 fn test_check_if_rescript11_or_higher ( ) {
512545 assert_eq ! ( check_if_rescript11_or_higher( "11.0.0" ) , Ok ( true ) ) ;
0 commit comments