Skip to content

Commit

Permalink
Merge c6c6bb4 into 743f775
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkirsz committed Nov 28, 2022
2 parents 743f775 + c6c6bb4 commit 7fd1790
Show file tree
Hide file tree
Showing 14 changed files with 604 additions and 388 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/next-dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fs_extra = "1.2.0"
lazy_static = "1.4.0"
once_cell = "1.13.0"
parking_lot = "0.12.1"
rand = "0.8.5"
regex = "1.6.0"
tempfile = "3.3.0"
test-generator = "0.3.0"
Expand Down
11 changes: 6 additions & 5 deletions crates/next-dev/benches/bundlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use self::{
vite::Vite,
webpack::Webpack,
};
use crate::util::env::read_env;

mod nextjs;
mod parcel;
Expand Down Expand Up @@ -59,16 +60,16 @@ pub trait Bundler {
}

pub fn get_bundlers() -> Vec<Box<dyn Bundler>> {
let config = std::env::var("TURBOPACK_BENCH_BUNDLERS").ok();
let config: String = read_env("TURBOPACK_BENCH_BUNDLERS", String::from("turbopack")).unwrap();
let mut turbopack = false;
let mut others = false;
match config.as_deref() {
Some("all") => {
match config.as_ref() {
"all" => {
turbopack = true;
others = true
}
Some("others") => others = true,
None | Some("") => {
"others" => others = true,
"turbopack" => {
turbopack = true;
}
_ => panic!("Invalid value for TURBOPACK_BENCH_BUNDLERS"),
Expand Down
10 changes: 4 additions & 6 deletions crates/next-dev/benches/bundlers/vite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,17 @@ impl Bundler for Vite {
} else {
"Vite SSR"
}
} else if self.swc {
"Vite SWC CSR"
} else {
if self.swc {
"Vite SWC CSR"
} else {
"Vite CSR"
}
"Vite CSR"
}
}

fn prepare(&self, install_dir: &Path) -> Result<()> {
let mut packages = vec![NpmPackage::new("vite", "^3.2.4")];
if self.swc {
packages.push(NpmPackage::new("vite-plugin-swc-react-refresh", "^2.2.0"));
packages.push(NpmPackage::new("vite-plugin-swc-react-refresh", "^2.2.1"));
} else {
packages.push(NpmPackage::new("@vitejs/plugin-react", "^2.2.0"));
};
Expand Down
1 change: 1 addition & 0 deletions crates/next-dev/benches/bundlers/webpack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl Bundler for Webpack {
&[
NpmPackage::new("@pmmmwh/react-refresh-webpack-plugin", "^0.5.7"),
NpmPackage::new("@swc/core", "^1.2.249"),
NpmPackage::new("@swc/helpers", "^0.4.13"),
NpmPackage::new("react-refresh", "^0.14.0"),
NpmPackage::new("swc-loader", "^0.2.3"),
NpmPackage::new("webpack", "^5.75.0"),
Expand Down
Loading

0 comments on commit 7fd1790

Please sign in to comment.