@@ -4,6 +4,11 @@ let wrapReactApp = code =>
4
4
window.reactRoot.render(React.createElement(App.make, {}));
5
5
})();`
6
6
7
+ let capitalizeFirstLetter = string => {
8
+ let firstLetter = string -> String .charAt (0 )-> String .toUpperCase
9
+ ` ${firstLetter}${string-> String.sliceToEnd(~start= 1)}`
10
+ }
11
+
7
12
@react.component
8
13
let make = (~compilerState : CompilerManagerHook .state , ~clearLogs , ~runOutput ) => {
9
14
let (validReact , setValidReact ) = React .useState (() => false )
@@ -18,7 +23,34 @@ let make = (~compilerState: CompilerManagerHook.state, ~clearLogs, ~runOutput) =
18
23
let {entryPointExists , code , imports } = PlaygroundValidator .validate (ast )
19
24
let imports = imports -> Dict .mapValues (path => {
20
25
let filename = path -> String .sliceToEnd (~start = 9 ) // the part after "./stdlib/"
21
- CompilerManagerHook .CdnMeta .getStdlibRuntimeUrl (selected .id , filename )
26
+ let filename = switch selected .id {
27
+ | {major : 12 , minor : 0 , patch : 0 , preRelease : Some (Alpha (alpha ))} if alpha < 8 =>
28
+ let filename = if filename -> String .startsWith ("core__" ) {
29
+ filename -> String .sliceToEnd (~start = 6 )
30
+ } else {
31
+ filename
32
+ }
33
+ capitalizeFirstLetter (filename )
34
+ | {major } if major < 12 && filename -> String .startsWith ("core__" ) =>
35
+ capitalizeFirstLetter (filename )
36
+ | _ => filename
37
+ }
38
+ let compilerVersion = switch selected .id {
39
+ | {major : 12 , minor : 0 , patch : 0 , preRelease : Some (Alpha (alpha ))} if alpha < 8 => {
40
+ Semver .major : 12 ,
41
+ minor : 0 ,
42
+ patch : 0 ,
43
+ preRelease : Some (Alpha (8 )),
44
+ }
45
+ | {major , minor } if (major === 11 && minor < 2 ) || major < 11 => {
46
+ major : 11 ,
47
+ minor : 2 ,
48
+ patch : 0 ,
49
+ preRelease : Some (Beta (1 )),
50
+ }
51
+ | version => version
52
+ }
53
+ CompilerManagerHook .CdnMeta .getStdlibRuntimeUrl (compilerVersion , filename )
22
54
})
23
55
24
56
entryPointExists
0 commit comments