@@ -356,7 +356,12 @@ export async function componentize(
356
356
}
357
357
358
358
/// Process output of check init, throwing if necessary
359
- handleCheckInitOutput ( check_init ( ) , initializerPath , workDir , getStderr ) ;
359
+ await handleCheckInitOutput (
360
+ check_init ( ) ,
361
+ initializerPath ,
362
+ workDir ,
363
+ getStderr ,
364
+ ) ;
360
365
361
366
// After wizening, stub out the wasi imports depending on what features are enabled
362
367
const finalBin = stubWasi (
@@ -558,7 +563,7 @@ async function initWasm(bin) {
558
563
* @param {string } workDir
559
564
* @param {() => string } getStderr - A function that resolves to the stderr output of check init
560
565
*/
561
- function handleCheckInitOutput (
566
+ async function handleCheckInitOutput (
562
567
status ,
563
568
initializerPath ,
564
569
workDir ,
@@ -586,41 +591,4 @@ function handleCheckInitOutput(
586
591
}
587
592
throw new Error ( msg ) ;
588
593
}
589
-
590
- // after wizening, stub out the wasi imports depending on what features are enabled
591
- const finalBin = stubWasi (
592
- bin ,
593
- features ,
594
- witWorld ,
595
- maybeWindowsPath ( witPath ) ,
596
- worldName ,
597
- ) ;
598
-
599
- if ( debugBindings ) {
600
- await writeFile ( 'binary.wasm' , finalBin ) ;
601
- }
602
-
603
- const component = await metadataAdd (
604
- await componentNew (
605
- finalBin ,
606
- Object . entries ( {
607
- wasi_snapshot_preview1 : await readFile ( preview2Adapter ) ,
608
- } ) ,
609
- false ,
610
- ) ,
611
- Object . entries ( {
612
- language : [ [ 'JavaScript' , '' ] ] ,
613
- 'processed-by' : [ [ 'ComponentizeJS' , version ] ] ,
614
- } ) ,
615
- ) ;
616
-
617
- // convert CABI import conventions to ESM import conventions
618
- imports = imports . map ( ( [ specifier , impt ] ) =>
619
- specifier === '$root' ? [ impt , 'default' ] : [ specifier , impt ] ,
620
- ) ;
621
-
622
- return {
623
- component,
624
- imports,
625
- } ;
626
594
}
0 commit comments