@@ -61,6 +61,7 @@ pub struct Opts {
6161 long,
6262 short = 'I' ,
6363 conflicts_with = "compatibility" ,
64+ conflicts_with = "no-compatibility" ,
6465 conflicts_with = "compat"
6566 )
6667 ) ]
@@ -72,15 +73,12 @@ pub struct Opts {
7273 /// component import specifiers to JS import specifiers.
7374 #[ cfg_attr( feature = "clap" , arg( long) , clap( value_parser = maps_str_to_map) ) ]
7475 pub map : Option < HashMap < String , String > > ,
75- /// Enables all compat flags: --nodejs-compat, -- tla-compat.
76+ /// Enables all compat flags: --tla-compat.
7677 #[ cfg_attr( feature = "clap" , arg( long, short = 'c' ) ) ]
7778 pub compat : bool ,
78- /// Enables compatibility in Node.js without a fetch global.
79- #[ cfg_attr(
80- feature = "clap" ,
81- arg( long, group = "compatibility" , conflicts_with = "compat" )
82- ) ]
83- pub nodejs_compat : bool ,
79+ /// Disables compatibility in Node.js without a fetch global.
80+ #[ cfg_attr( feature = "clap" , arg( long, group = "no-compatibility" ) ) ]
81+ pub no_nodejs_compat : bool ,
8482 /// Enables compatibility for JS environments without top-level await support
8583 /// via an async $init promise export to wait for instead.
8684 #[ cfg_attr( feature = "clap" , arg( long, group = "compatibility" ) ) ]
@@ -108,7 +106,6 @@ impl Opts {
108106 let mut gen = Js :: default ( ) ;
109107 gen. opts = self ;
110108 if gen. opts . compat {
111- gen. opts . nodejs_compat = true ;
112109 gen. opts . tla_compat = true ;
113110 }
114111 Ok ( Box :: new ( gen) )
@@ -569,7 +566,7 @@ impl Js {
569566 " ) ,
570567
571568 Intrinsic :: LoadWasm => match self . opts . load {
572- Load :: Fetch => if self . opts . nodejs_compat {
569+ Load :: Fetch => if ! self . opts . no_nodejs_compat {
573570 self . src . js_intrinsics ( "
574571 const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
575572 let _fs;
@@ -586,7 +583,7 @@ impl Js {
586583 const loadWasm = url => fetch(url).then(WebAssembly.compileStreaming);
587584 " )
588585 } ,
589- Load :: Base64 => if self . opts . nodejs_compat {
586+ Load :: Base64 => if ! self . opts . no_nodejs_compat {
590587 self . src . js_intrinsics ( "
591588 const loadWasm = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0)));
592589 " )
0 commit comments