@@ -356,7 +356,12 @@ export async function componentize(
356356 }
357357
358358 /// Process output of check init, throwing if necessary
359- handleCheckInitOutput ( check_init ( ) , initializerPath , workDir , getStderr ) ;
359+ await handleCheckInitOutputn (
360+ check_init ( ) ,
361+ initializerPath ,
362+ workDir ,
363+ getStderr ,
364+ ) ;
360365
361366 // After wizening, stub out the wasi imports depending on what features are enabled
362367 const finalBin = stubWasi (
@@ -558,7 +563,7 @@ async function initWasm(bin) {
558563 * @param {string } workDir
559564 * @param {() => string } getStderr - A function that resolves to the stderr output of check init
560565 */
561- function handleCheckInitOutput (
566+ async function handleCheckInitOutput (
562567 status ,
563568 initializerPath ,
564569 workDir ,
@@ -586,41 +591,4 @@ function handleCheckInitOutput(
586591 }
587592 throw new Error ( msg ) ;
588593 }
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- } ;
626594}
0 commit comments