@@ -630,30 +630,33 @@ impl MoonBitComponent {
630
630
let mut wasm = std:: fs:: read ( & module_wasm)
631
631
. context ( format ! ( "Failed to read module WASM from {module_wasm}" ) ) ?;
632
632
633
- wit_component:: embed_component_metadata ( & mut wasm, resolve, * world, StringEncoding :: UTF16 ) ?;
633
+ wit_component:: embed_component_metadata ( & mut wasm, resolve, * world, StringEncoding :: UTF16 )
634
+ . context ( "Embedding component metadata" ) ?;
634
635
635
- std:: fs:: write ( self . module_with_embed_wasm ( ) , wasm) ?;
636
+ std:: fs:: write ( self . module_with_embed_wasm ( ) , wasm)
637
+ . context ( "Writing WASM with embedded metadata" ) ?;
636
638
637
639
Ok ( ( ) )
638
640
}
639
641
640
642
fn create_component ( & self , target : & Utf8Path ) -> anyhow:: Result < ( ) > {
641
643
info ! ( "Creating the final WASM component at {target}" ) ;
642
644
643
- let wasm = std:: fs:: read ( self . module_with_embed_wasm ( ) ) ?;
645
+ let wasm = std:: fs:: read ( self . module_with_embed_wasm ( ) )
646
+ . context ( "Reading WASM with embedded metadata" ) ?;
644
647
let mut encoder = ComponentEncoder :: default ( )
645
648
. validate ( true )
646
649
. reject_legacy_names ( false )
647
650
. merge_imports_based_on_semver ( true )
648
651
. realloc_via_memory_grow ( false )
649
652
. module ( & wasm) ?;
650
653
651
- let component = encoder. encode ( ) ?;
654
+ let component = encoder. encode ( ) . context ( "Encoding WASM component" ) ?;
652
655
653
656
if let Some ( parent) = target. parent ( ) {
654
- std:: fs:: create_dir_all ( parent) ?;
657
+ std:: fs:: create_dir_all ( parent) . context ( "Creating directory for WASM component" ) ?;
655
658
}
656
- std:: fs:: write ( target, component) ?;
659
+ std:: fs:: write ( target, component) . context ( "Writing WASM component" ) ?;
657
660
658
661
Ok ( ( ) )
659
662
}
0 commit comments