@@ -25,6 +25,7 @@ const isWindows = platform === 'win32';
2525const DEBUG_BINDINGS = false ;
2626const DEBUG_CALLS = false ;
2727const DEBUG_BUILD = false ;
28+ const DEBUG_BINARY = false ;
2829
2930function maybeWindowsPath ( path ) {
3031 if ( ! path ) return path ;
@@ -61,13 +62,13 @@ export async function componentize(jsSource, witWorld, opts) {
6162 }
6263
6364 let guestImports = [ ] ;
64- jsImports . map ( ( k ) => {
65- guestImports . push ( k . n ) ;
65+ jsImports . map ( ( { t , n } ) => {
66+ if ( typeof n === 'string' && ( t === 1 || t === 2 ) ) guestImports . push ( n ) ;
6667 } ) ;
6768
6869 let guestExports = [ ] ;
6970 jsExports . map ( ( k ) => {
70- guestExports . push ( k . n ) ;
71+ if ( k . n ) guestExports . push ( k . n ) ;
7172 } ) ;
7273
7374 // we never disable a feature that is already in the target world usage
@@ -132,6 +133,7 @@ export async function componentize(jsSource, witWorld, opts) {
132133 let source = '' ,
133134 curIdx = 0 ;
134135 for ( const jsImpt of jsImports ) {
136+ if ( jsImpt . t !== 1 && jsImpt . t !== 2 ) continue ;
135137 const specifier = jsSource . slice ( jsImpt . s , jsImpt . e ) ;
136138 source += jsSource . slice ( curIdx , jsImpt . s ) ;
137139 source += `./${ specifier . replace ( ':' , '__' ) . replace ( '/' , '$' ) } .js` ;
@@ -384,6 +386,10 @@ export async function componentize(jsSource, witWorld, opts) {
384386 worldName
385387 ) ;
386388
389+ if ( DEBUG_BINARY ) {
390+ await writeFile ( 'binary.wasm' , finalBin ) ;
391+ }
392+
387393 const component = await metadataAdd (
388394 await componentNew (
389395 finalBin ,
0 commit comments