From 7a63059b65c573f5b1f0a3e5b8a600333f2de1de Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Fri, 1 Dec 2023 10:01:07 +0800 Subject: [PATCH] alway write compression file --- crates/cli/src/compile/front.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/cli/src/compile/front.rs b/crates/cli/src/compile/front.rs index 9616177..051718d 100644 --- a/crates/cli/src/compile/front.rs +++ b/crates/cli/src/compile/front.rs @@ -105,21 +105,21 @@ async fn bindgen(proj: &Project) -> Result> { _ => {} } let data = fs::read(&wasm_file.dest).await?; - - let br_file = File::create(format!("{}.br", wasm_file.dest.as_str()))?; - let mut br_writer = CompressorWriter::new( - br_file, - 32 * 1024, // 32 KiB buffer - 11, // BROTLI_PARAM_QUALITY - 22, // BROTLI_PARAM_LGWIN - ); - br_writer.write_all(&data)?; - - let zstd_data = zstd::encode_all(&*data, 21)?; - let mut zstd_file = File::create(format!("{}.zst", wasm_file.dest.as_str()))?; - zstd_file.write_all(&zstd_data)?; } + let br_file = File::create(format!("{}.br", wasm_file.dest.as_str()))?; + let mut br_writer = CompressorWriter::new( + br_file, + 32 * 1024, // 32 KiB buffer + 11, // BROTLI_PARAM_QUALITY + 22, // BROTLI_PARAM_LGWIN + ); + br_writer.write_all(&data)?; + + let zstd_data = zstd::encode_all(&*data, 21)?; + let mut zstd_file = File::create(format!("{}.zst", wasm_file.dest.as_str()))?; + zstd_file.write_all(&zstd_data)?; + let mut js_changed = false; js_changed |= write_snippets(proj, bindgen.snippets()).await?;