File tree Expand file tree Collapse file tree 5 files changed +23
-7
lines changed Expand file tree Collapse file tree 5 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -896,7 +896,7 @@ module Settings = {
896896
897897 let open_modules = switch readyState .selected .apiVersion {
898898 | V1 | V2 | V3 | UnknownVersion (_ ) => None
899- | V4 =>
899+ | V4 | V5 =>
900900 readyState .selected .libraries -> Array .some (el => el === "@rescript/core" )
901901 ? Some (["RescriptCore" ])
902902 : None
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ module Version = {
3737 | V2
3838 | V3
3939 | V4
40+ | V5
4041 | UnknownVersion (string )
4142
4243 // Helps finding the right API version
@@ -59,6 +60,7 @@ module Version = {
5960 | list {"2" } => V2
6061 | list {"3" } => V3
6162 | list {"4" } => V4
63+ | list {"5" } => V5
6264 | _ => UnknownVersion (apiVersion )
6365 }
6466
@@ -68,6 +70,7 @@ module Version = {
6870 | V2 => "2.0"
6971 | V3 => "3.0"
7072 | V4 => "4.0"
73+ | V5 => "5.0"
7174 | UnknownVersion (version ) => version
7275 }
7376
@@ -76,7 +79,7 @@ module Version = {
7679 let availableLanguages = t =>
7780 switch t {
7881 | V1 => [Lang .Reason , Res ]
79- | V2 | V3 | V4 => [Lang .Res ]
82+ | V2 | V3 | V4 | V5 => [Lang .Res ]
8083 | UnknownVersion (_ ) => [Res ]
8184 }
8285}
@@ -405,7 +408,14 @@ module Compiler = {
405408 ConversionResult .decode (~fromLang = Reason , ~toLang = Reason , json )
406409 }
407410
408- @get @scope ("ocaml" ) external ocamlVersion : t => string = "version"
411+ @get external ocaml : t => option <dict <string >> = "ocaml"
412+
413+ let ocamlVersion = (t : t ): option <string > => {
414+ switch ocaml (t ) {
415+ | Some (ocaml ) => ocaml -> Dict .get ("version" )
416+ | None => None
417+ }
418+ }
409419
410420 @send @scope ("ocaml" )
411421 external ocamlCompile : (t , string ) => JSON .t = "compile"
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ module Version: {
2525 | V2
2626 | V3
2727 | V4
28+ | V5
2829 | UnknownVersion (string )
2930
3031 // Helps finding the right API version
@@ -188,7 +189,7 @@ module Compiler: {
188189 /*
189190 * OCaml compiler actions (Note: no pretty print available for OCaml)
190191 */
191- let ocamlVersion : t => string
192+ let ocamlVersion : t => option < string >
192193 let ocamlCompile : (t , string ) => CompilationResult .t
193194
194195 /*
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ let getLibrariesForVersion = (~version: Semver.t): array<string> => {
147147let getOpenModules = (~apiVersion : Version .t , ~libraries : array <string >): option <array <string >> =>
148148 switch apiVersion {
149149 | V1 | V2 | V3 | UnknownVersion (_ ) => None
150- | V4 => libraries -> Array .some (el => el === "@rescript/core" ) ? Some (["RescriptCore" ]) : None
150+ | V4 | V5 => libraries -> Array .some (el => el === "@rescript/core" ) ? Some (["RescriptCore" ]) : None
151151 }
152152
153153/*
@@ -207,7 +207,7 @@ type selected = {
207207 id : Semver .t , // The id used for loading the compiler bundle (ideally should be the same as compilerVersion)
208208 apiVersion : Version .t , // The playground API version in use
209209 compilerVersion : string ,
210- ocamlVersion : string ,
210+ ocamlVersion : option < string > ,
211211 libraries : array <string >,
212212 config : Config .t ,
213213 instance : Compiler .t ,
@@ -510,6 +510,11 @@ let useCompilerManager = (
510510 )
511511 | Lang .Res => instance -> Compiler .resCompile (code )
512512 }
513+ | V5 =>
514+ switch lang {
515+ | Lang .Res => instance -> Compiler .resCompile (code )
516+ | _ => CompilationResult .UnexpectedError (` Can't handle with lang: ${lang-> Lang.toString}` )
517+ }
513518 | UnknownVersion (version ) =>
514519 CompilationResult .UnexpectedError (
515520 ` Can't handle result of compiler API version "${version}"` ,
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ type selected = {
2828 id : Semver .t , // The id used for loading the compiler bundle (ideally should be the same as compilerVersion)
2929 apiVersion : Version .t , // The playground API version in use
3030 compilerVersion : string ,
31- ocamlVersion : string ,
31+ ocamlVersion : option < string > ,
3232 libraries : array <string >,
3333 config : Config .t ,
3434 instance : Compiler .t ,
You can’t perform that action at this time.
0 commit comments