diff --git a/CHANGELOG.md b/CHANGELOG.md index de6f499274..050efd5c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ - Add experimental command to `rescript-tools` for formatting all ReScript code blocks in markdown. Either in a markdown file directly, or inside of docstrings in ReScript code. https://github.com/rescript-lang/rescript/pull/7598 +#### :house: Internal + +- Remove uncurried handling from rewatch. https://github.com/rescript-lang/rescript/pull/7625 + # 12.0.0-alpha.15 #### :boom: Breaking Change diff --git a/rewatch/src/build/compile.rs b/rewatch/src/build/compile.rs index 8a472e7d85..5ee1ff9425 100644 --- a/rewatch/src/build/compile.rs +++ b/rewatch/src/build/compile.rs @@ -394,7 +394,6 @@ pub fn compiler_args( packages::Namespace::NoNamespace => vec![], }; - let uncurried_args = root_config.get_uncurried_args(version); let jsx_args = root_config.get_jsx_args(); let jsx_module_args = root_config.get_jsx_module_args(); let jsx_mode_args = root_config.get_jsx_mode_args(); @@ -462,7 +461,6 @@ pub fn compiler_args( jsx_module_args, jsx_mode_args, jsx_preserve_args, - uncurried_args, bsc_flags.to_owned(), warning_args, gentype_arg, diff --git a/rewatch/src/build/packages.rs b/rewatch/src/build/packages.rs index 064383c3b7..bd30d2576f 100644 --- a/rewatch/src/build/packages.rs +++ b/rewatch/src/build/packages.rs @@ -847,10 +847,6 @@ impl Package { pub fn get_jsx_preserve_args(&self) -> Vec { self.config.get_jsx_preserve_args() } - - pub fn get_uncurried_args(&self, version: &str, root_package: &packages::Package) -> Vec { - root_package.config.get_uncurried_args(version) - } } fn get_unallowed_dependents( @@ -979,7 +975,6 @@ mod test { reason: None, namespace: None, jsx: None, - uncurried: None, gentype_config: None, namespace_entry: None, allowed_dependents, diff --git a/rewatch/src/build/parse.rs b/rewatch/src/build/parse.rs index 079434b13b..65ea9b771b 100644 --- a/rewatch/src/build/parse.rs +++ b/rewatch/src/build/parse.rs @@ -269,7 +269,6 @@ pub fn parser_args( let jsx_module_args = root_config.get_jsx_module_args(); let jsx_mode_args = root_config.get_jsx_mode_args(); let jsx_preserve_args = root_config.get_jsx_preserve_args(); - let uncurried_args = root_config.get_uncurried_args(version); let bsc_flags = config::flatten_flags(&config.bsc_flags); let file = PathBuf::from("..").join("..").join(file); @@ -283,7 +282,6 @@ pub fn parser_args( jsx_module_args, jsx_mode_args, jsx_preserve_args, - uncurried_args, bsc_flags, vec![ "-absname".to_string(), diff --git a/rewatch/src/config.rs b/rewatch/src/config.rs index 2592509b4b..31044e65b3 100644 --- a/rewatch/src/config.rs +++ b/rewatch/src/config.rs @@ -215,7 +215,6 @@ pub struct Config { pub reason: Option, pub namespace: Option, pub jsx: Option, - pub uncurried: Option, #[serde(rename = "gentypeconfig")] pub gentype_config: Option, // this is a new feature of rewatch, and it's not part of the bsconfig.json spec @@ -308,17 +307,6 @@ pub fn read(path: &Path) -> Result { Ok(parse) } -fn check_if_rescript11_or_higher(version: &str) -> Result { - version - .split('.') - .next() - .and_then(|s| s.parse::().ok()) - .map_or( - Err("Could not parse version".to_string()), - |major| Ok(major >= 11), - ) -} - fn namespace_from_package_name(package_name: &str) -> String { let len = package_name.len(); let mut buf = String::with_capacity(len); @@ -445,24 +433,6 @@ impl Config { } } - pub fn get_uncurried_args(&self, version: &str) -> Vec { - match check_if_rescript11_or_higher(version) { - Ok(true) => match self.uncurried.to_owned() { - // v11 is always uncurried except iff explicitly set to false in the root rescript.json - Some(false) => vec![], - _ => vec!["-uncurried".to_string()], - }, - Ok(false) => vec![], - Err(_) => { - eprintln!( - "Could not establish Rescript Version number for uncurried mode. Defaulting to Rescript < 11, disabling uncurried mode. Please specify an exact version if you need > 11 and default uncurried mode. Version: {}", - version - ); - vec![] - } - } - } - pub fn get_gentype_arg(&self) -> Vec { match &self.gentype_config { Some(_) => vec!["-bs-gentype".to_string()], @@ -819,27 +789,4 @@ mod tests { Some(vec!["@testrepo/main".to_string()]) ); } - - #[test] - fn test_check_if_rescript11_or_higher() { - assert_eq!(check_if_rescript11_or_higher("11.0.0"), Ok(true)); - assert_eq!(check_if_rescript11_or_higher("11.0.1"), Ok(true)); - assert_eq!(check_if_rescript11_or_higher("11.1.0"), Ok(true)); - - assert_eq!(check_if_rescript11_or_higher("12.0.0"), Ok(true)); - - assert_eq!(check_if_rescript11_or_higher("10.0.0"), Ok(false)); - assert_eq!(check_if_rescript11_or_higher("9.0.0"), Ok(false)); - } - - #[test] - fn test_check_if_rescript11_or_higher_misc() { - assert_eq!(check_if_rescript11_or_higher("11"), Ok(true)); - assert_eq!(check_if_rescript11_or_higher("12.0.0-alpha.4"), Ok(true)); - - match check_if_rescript11_or_higher("*") { - Ok(_) => unreachable!("Should not parse"), - Err(_) => assert!(true), - } - } }