@@ -4,6 +4,11 @@ let wrapReactApp = code =>
44 window.reactRoot.render(React.createElement(App.make, {}));
55})();`
66
7+ let capitalizeFirstLetter = string => {
8+ let firstLetter = string -> String .charAt (0 )-> String .toUpperCase
9+ ` ${firstLetter}${string-> String.sliceToEnd(~start= 1)}`
10+ }
11+
712@react.component
813let make = (~compilerState : CompilerManagerHook .state , ~clearLogs , ~runOutput ) => {
914 let (validReact , setValidReact ) = React .useState (() => false )
@@ -18,7 +23,34 @@ let make = (~compilerState: CompilerManagerHook.state, ~clearLogs, ~runOutput) =
1823 let {entryPointExists , code , imports } = PlaygroundValidator .validate (ast )
1924 let imports = imports -> Dict .mapValues (path => {
2025 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 )
2254 })
2355
2456 entryPointExists
0 commit comments