@@ -183,32 +183,32 @@ export default class JsExecutor {
183
183
}
184
184
if ( targetPlatform === TargetPlatforms . COMPOSE_WASM ) {
185
185
186
- const skikoExports = fetch ( API_URLS . SKIKO_VERSION ( ) , {
186
+ const skikoStdlib = fetch ( API_URLS . RESOURCE_VERSIONS ( ) , {
187
187
method : 'GET'
188
- } ) . then ( response => response . text ( ) )
189
- . then ( version =>
190
- fetch ( API_URLS . SKIKO_MJS ( version ) , {
188
+ } ) . then ( response => response . json ( ) )
189
+ . then ( versions => {
190
+ const skikoVersion = versions [ "skiko" ] ;
191
+
192
+ const skikoExports = fetch ( API_URLS . SKIKO_MJS ( skikoVersion ) , {
191
193
method : 'GET' ,
192
194
headers : {
193
195
'Content-Type' : 'text/javascript' ,
194
196
}
195
197
} ) . then ( script => script . text ( ) )
196
198
. then ( script => script . replace (
197
199
"new URL(\"skiko.wasm\",import.meta.url).href" ,
198
- `'${ API_URLS . SKIKO_WASM ( version ) } '`
200
+ `'${ API_URLS . SKIKO_WASM ( skikoVersion ) } '`
199
201
) )
200
202
. then ( skikoCode =>
201
203
executeJs (
202
204
this . iframe . contentWindow ,
203
205
skikoCode ,
204
206
) )
205
- . then ( skikoExports => fixedSkikoExports ( skikoExports ) ) )
207
+ . then ( skikoExports => fixedSkikoExports ( skikoExports ) )
206
208
207
- const stdlibExports = fetch ( API_URLS . STDLIB_HASH ( ) , {
208
- method : 'GET'
209
- } ) . then ( response => response . text ( ) )
210
- . then ( hash =>
211
- fetch ( API_URLS . STDLIB_MJS ( hash ) , {
209
+ const stdlibVersion = versions [ "stdlib" ] ;
210
+
211
+ const stdlibExports = fetch ( API_URLS . STDLIB_MJS ( stdlibVersion ) , {
212
212
method : 'GET' ,
213
213
headers : {
214
214
'Content-Type' : 'text/javascript' ,
@@ -217,7 +217,7 @@ export default class JsExecutor {
217
217
. then ( script =>
218
218
// necessary to load stdlib.wasm before its initialization to parallelize
219
219
// language=JavaScript
220
- ( `const stdlibWasm = fetch('${ API_URLS . STDLIB_WASM ( hash ) } ');\n` + script ) . replace (
220
+ ( `const stdlibWasm = fetch('${ API_URLS . STDLIB_WASM ( stdlibVersion ) } ');\n` + script ) . replace (
221
221
"fetch(new URL('./stdlib_master.wasm',import.meta.url).href)" ,
222
222
"stdlibWasm"
223
223
) . replace (
@@ -230,9 +230,11 @@ export default class JsExecutor {
230
230
stdlibCode ,
231
231
)
232
232
)
233
- )
234
233
235
- this . stdlibExports = Promise . all ( [ skikoExports , stdlibExports ] )
234
+ return Promise . all ( [ skikoExports , stdlibExports ] )
235
+ } )
236
+
237
+ this . stdlibExports = skikoStdlib
236
238
. then ( async ( [ skikoExportsResult , stdlibExportsResult ] ) => {
237
239
return [
238
240
await stdlibExportsResult . instantiate ( {
0 commit comments