Skip to content

Commit

Permalink
ci(benchmark/transformer): enable all >= es7 plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Aug 30, 2024
1 parent 06015e2 commit ec30b59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions crates/oxc_transformer/src/react/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ impl ReactOptions {
}
}
}

pub fn with_refresh(&mut self, refresh: Option<ReactRefreshOptions>) -> &mut Self {
self.refresh = refresh;
self
}
}

#[derive(Debug, Clone, Deserialize)]
Expand Down
9 changes: 7 additions & 2 deletions tasks/benchmark/benches/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use oxc_parser::{Parser, ParserReturn};
use oxc_semantic::SemanticBuilder;
use oxc_span::SourceType;
use oxc_tasks_common::TestFiles;
use oxc_transformer::{EnvOptions, Targets, TransformOptions, Transformer};
use oxc_transformer::{EnvOptions, ReactRefreshOptions, Targets, TransformOptions, Transformer};

fn bench_transformer(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("transformer");
Expand Down Expand Up @@ -46,8 +46,13 @@ fn bench_transformer(criterion: &mut Criterion) {
targets: Targets::new_with_query("chrome 51"),
..Default::default()
};
let transform_options =
let mut transform_options =
TransformOptions::from_preset_env(&env_options).unwrap();

// Enable React related plugins
transform_options.react.development = true;
transform_options.react.with_refresh(Some(ReactRefreshOptions::default()));

let ret = Transformer::new(
&allocator,
Path::new(&file.file_name),
Expand Down

0 comments on commit ec30b59

Please sign in to comment.