@@ -11,6 +11,22 @@ let makePathsForModule ~projectFilesAndPaths ~dependenciesFilesAndPaths =
1111 Hashtbl. replace pathsForModule modName paths);
1212 pathsForModule
1313
14+ let getReScriptVersion () =
15+ (* TODO: Include patch stuff when needed *)
16+ let defaultVersion = (10 , 1 ) in
17+ try
18+ let value = Sys. getenv " RESCRIPT_VERSION" in
19+ let version =
20+ match value |> String. split_on_char '.' with
21+ | major :: minor :: _rest -> (
22+ match (int_of_string_opt major, int_of_string_opt minor) with
23+ | Some major , Some minor -> (major, minor)
24+ | _ -> defaultVersion)
25+ | _ -> defaultVersion
26+ in
27+ version
28+ with Not_found -> defaultVersion
29+
1430let newBsPackage ~rootPath =
1531 let rescriptJson = Filename. concat rootPath " rescript.json" in
1632 let bsconfigJson = Filename. concat rootPath " bsconfig.json" in
@@ -27,9 +43,12 @@ let newBsPackage ~rootPath =
2743 | Some libBs ->
2844 Some
2945 (let namespace = FindFiles. getNamespace config in
46+ let rescriptVersion = getReScriptVersion () in
3047 let uncurried =
3148 let ns = config |> Json. get " uncurried" in
32- Option. bind ns Json. bool
49+ match (rescriptVersion, ns) with
50+ | (major , _ ), None when major > = 11 -> Some true
51+ | _ , ns -> Option. bind ns Json. bool
3352 in
3453 let uncurried = uncurried = Some true in
3554 let sourceDirectories =
@@ -93,6 +112,7 @@ let newBsPackage ~rootPath =
93112 (" Opens from ReScript config file: "
94113 ^ (opens |> List. map pathToString |> String. concat " " ));
95114 {
115+ rescriptVersion;
96116 rootPath;
97117 projectFiles =
98118 projectFilesAndPaths |> List. map fst |> FileSet. of_list;
0 commit comments