Skip to content

Commit 9b17a4c

Browse files
authored
Merge branch 'master' into rewatch-package-name-mismatch
2 parents 08faa3e + d2ef907 commit 9b17a4c

File tree

5 files changed

+4
-62
lines changed

5 files changed

+4
-62
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
- 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
1818

19+
#### :house: Internal
20+
21+
- Remove uncurried handling from rewatch. https://github.com/rescript-lang/rescript/pull/7625
22+
1923
#### :nail_care: Polish
2024

2125
- Add a warning if the name in package.json does not match the name in rescript.json. https://github.com/rescript-lang/rescript/pull/7604

rewatch/src/build/compile.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ pub fn compiler_args(
394394
packages::Namespace::NoNamespace => vec![],
395395
};
396396

397-
let uncurried_args = root_config.get_uncurried_args(version);
398397
let jsx_args = root_config.get_jsx_args();
399398
let jsx_module_args = root_config.get_jsx_module_args();
400399
let jsx_mode_args = root_config.get_jsx_mode_args();
@@ -462,7 +461,6 @@ pub fn compiler_args(
462461
jsx_module_args,
463462
jsx_mode_args,
464463
jsx_preserve_args,
465-
uncurried_args,
466464
bsc_flags.to_owned(),
467465
warning_args,
468466
gentype_arg,

rewatch/src/build/packages.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,6 @@ impl Package {
858858
pub fn get_jsx_preserve_args(&self) -> Vec<String> {
859859
self.config.get_jsx_preserve_args()
860860
}
861-
862-
pub fn get_uncurried_args(&self, version: &str, root_package: &packages::Package) -> Vec<String> {
863-
root_package.config.get_uncurried_args(version)
864-
}
865861
}
866862

867863
fn get_unallowed_dependents(
@@ -990,7 +986,6 @@ mod test {
990986
reason: None,
991987
namespace: None,
992988
jsx: None,
993-
uncurried: None,
994989
gentype_config: None,
995990
namespace_entry: None,
996991
allowed_dependents,

rewatch/src/build/parse.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ pub fn parser_args(
269269
let jsx_module_args = root_config.get_jsx_module_args();
270270
let jsx_mode_args = root_config.get_jsx_mode_args();
271271
let jsx_preserve_args = root_config.get_jsx_preserve_args();
272-
let uncurried_args = root_config.get_uncurried_args(version);
273272
let bsc_flags = config::flatten_flags(&config.bsc_flags);
274273

275274
let file = PathBuf::from("..").join("..").join(file);
@@ -283,7 +282,6 @@ pub fn parser_args(
283282
jsx_module_args,
284283
jsx_mode_args,
285284
jsx_preserve_args,
286-
uncurried_args,
287285
bsc_flags,
288286
vec![
289287
"-absname".to_string(),

rewatch/src/config.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ pub struct Config {
215215
pub reason: Option<Reason>,
216216
pub namespace: Option<NamespaceConfig>,
217217
pub jsx: Option<JsxSpecs>,
218-
pub uncurried: Option<bool>,
219218
#[serde(rename = "gentypeconfig")]
220219
pub gentype_config: Option<GenTypeConfig>,
221220
// 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<Config> {
308307
Ok(parse)
309308
}
310309

311-
fn check_if_rescript11_or_higher(version: &str) -> Result<bool, String> {
312-
version
313-
.split('.')
314-
.next()
315-
.and_then(|s| s.parse::<usize>().ok())
316-
.map_or(
317-
Err("Could not parse version".to_string()),
318-
|major| Ok(major >= 11),
319-
)
320-
}
321-
322310
fn namespace_from_package_name(package_name: &str) -> String {
323311
let len = package_name.len();
324312
let mut buf = String::with_capacity(len);
@@ -445,24 +433,6 @@ impl Config {
445433
}
446434
}
447435

448-
pub fn get_uncurried_args(&self, version: &str) -> Vec<String> {
449-
match check_if_rescript11_or_higher(version) {
450-
Ok(true) => match self.uncurried.to_owned() {
451-
// v11 is always uncurried except iff explicitly set to false in the root rescript.json
452-
Some(false) => vec![],
453-
_ => vec!["-uncurried".to_string()],
454-
},
455-
Ok(false) => vec![],
456-
Err(_) => {
457-
eprintln!(
458-
"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: {}",
459-
version
460-
);
461-
vec![]
462-
}
463-
}
464-
}
465-
466436
pub fn get_gentype_arg(&self) -> Vec<String> {
467437
match &self.gentype_config {
468438
Some(_) => vec!["-bs-gentype".to_string()],
@@ -819,27 +789,4 @@ mod tests {
819789
Some(vec!["@testrepo/main".to_string()])
820790
);
821791
}
822-
823-
#[test]
824-
fn test_check_if_rescript11_or_higher() {
825-
assert_eq!(check_if_rescript11_or_higher("11.0.0"), Ok(true));
826-
assert_eq!(check_if_rescript11_or_higher("11.0.1"), Ok(true));
827-
assert_eq!(check_if_rescript11_or_higher("11.1.0"), Ok(true));
828-
829-
assert_eq!(check_if_rescript11_or_higher("12.0.0"), Ok(true));
830-
831-
assert_eq!(check_if_rescript11_or_higher("10.0.0"), Ok(false));
832-
assert_eq!(check_if_rescript11_or_higher("9.0.0"), Ok(false));
833-
}
834-
835-
#[test]
836-
fn test_check_if_rescript11_or_higher_misc() {
837-
assert_eq!(check_if_rescript11_or_higher("11"), Ok(true));
838-
assert_eq!(check_if_rescript11_or_higher("12.0.0-alpha.4"), Ok(true));
839-
840-
match check_if_rescript11_or_higher("*") {
841-
Ok(_) => unreachable!("Should not parse"),
842-
Err(_) => assert!(true),
843-
}
844-
}
845792
}

0 commit comments

Comments
 (0)