diff --git a/crates/cli/src/js.rs b/crates/cli/src/js.rs index c0f47fbf..8f7354a0 100644 --- a/crates/cli/src/js.rs +++ b/crates/cli/src/js.rs @@ -54,13 +54,13 @@ impl JS { bytecode::compile_source(self.source_code.as_bytes()) } - pub fn compress(&self) -> Result> { + pub fn compress(&self, quality: i32) -> Result> { let mut compressed_source_code: Vec = vec![]; enc::BrotliCompress( &mut Cursor::new(&self.source_code.as_bytes()), &mut compressed_source_code, &BrotliEncoderParams { - quality: 11, + quality, ..Default::default() }, )?; diff --git a/crates/cli/src/wasm_generator/transform.rs b/crates/cli/src/wasm_generator/transform.rs index 68023dcb..57af6212 100644 --- a/crates/cli/src/wasm_generator/transform.rs +++ b/crates/cli/src/wasm_generator/transform.rs @@ -13,13 +13,13 @@ pub struct SourceCodeSection { impl SourceCodeSection { pub fn compressed(js: &JS) -> Result { Ok(SourceCodeSection { - source_code: js.compress()?, + source_code: js.compress(11)?, }) } pub fn uncompressed(js: &JS) -> Result { Ok(SourceCodeSection { - source_code: js.as_bytes().to_vec(), + source_code: js.compress(0)?, }) } }