File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ export default function(options: $Shape<Options> = {}) {
1919
2020 return {
2121 name : 'rust' ,
22+ options ( opts : any ) {
23+ let external : string [ ] | ( ( id : string ) => boolean ) ;
24+
25+ if ( typeof opts . external === 'function' )
26+ external = id => opts . external ( id ) || id . includes ( 'buffer' ) ;
27+
28+ if ( Array . isArray ( opts . external ) )
29+ external = Array . from ( new Set ( opts . external . concat ( 'buffer' ) ) ) ;
30+
31+ return Object . assign ( { } , opts , { external } ) ;
32+ } ,
2233 async transform ( code : string , id : string ) {
2334 if ( ! extension . test ( id ) ) return ;
2435 if ( ! filter ( id ) ) return ;
@@ -39,7 +50,7 @@ export default function(options: $Shape<Options> = {}) {
3950 return wrap ( wasmCode ) . asWebAssembly . Instance ;
4051 case 'module' :
4152 return wrap ( wasmCode ) . asWebAssembly . Module ;
42- case 'promise' || ' async' :
53+ case 'async' :
4354 return wrap ( wasmCode ) . promiseWebAssembly . Both ;
4455 case 'async-instance' :
4556 return wrap ( wasmCode ) . promiseWebAssembly . Instance ;
You can’t perform that action at this time.
0 commit comments