Skip to content

Commit

Permalink
Add gzip support
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Dec 7, 2023
1 parent 7cae012 commit 1932d73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ lightningcss = { version = "1.0.0-alpha.51", features = ["browserslist"] }
log = "0.4"
# not using notify 5.0 because it uses Crossbeam which has an issue with tokio
notify = "4"
once_cell ={ workspace = true }
once_cell = { workspace = true }
reqwest = { version = "0.11", features = ["blocking", "__tls", "default-tls", "native-tls-crate", "json"], default-features = false }
salvo = { workspace = true, features = ["websocket"] }
seahash = "4.1"
Expand Down
5 changes: 5 additions & 0 deletions crates/cli/src/compile/front.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::sync::Arc;

use brotli::CompressorWriter;
use camino::{Utf8Path, Utf8PathBuf};
use flate2::write::GzEncoder;
use tokio::process::Child;
use tokio::{process::Command, sync::broadcast, task::JoinHandle};
use wasm_bindgen_cli_support::Bindgen;
Expand Down Expand Up @@ -120,6 +121,10 @@ async fn bindgen(proj: &Project) -> Result<Outcome<Product>> {
let mut zstd_file = File::create(format!("{}.zst", wasm_file.dest.as_str()))?;
zstd_file.write_all(&zstd_data)?;

let gzip_file = File::create(format!("{}.gz", wasm_file.dest.as_str()))?;
let mut gzip_encoder = GzEncoder::new(gzip_file, flate2::Compression::best());
gzip_encoder.write_all(&data)?;

let mut js_changed = false;

js_changed |= write_snippets(proj, bindgen.snippets()).await?;
Expand Down
1 change: 0 additions & 1 deletion crates/routing/src/router.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::cell::RefCell;
use std::fmt::{self, Formatter};
use std::rc::Rc;

Expand Down

0 comments on commit 1932d73

Please sign in to comment.