From d04857bd35460070c412e9856782a0a77b1d6403 Mon Sep 17 00:00:00 2001 From: Dunqing <29533304+Dunqing@users.noreply.github.com> Date: Fri, 30 Aug 2024 09:30:16 +0000 Subject: [PATCH] feat(transformer): support `Targets::from_query` method (#5336) --- crates/oxc_transformer/src/env/targets/query.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/oxc_transformer/src/env/targets/query.rs b/crates/oxc_transformer/src/env/targets/query.rs index 21d29915fba95..d1ecef5fc79b3 100644 --- a/crates/oxc_transformer/src/env/targets/query.rs +++ b/crates/oxc_transformer/src/env/targets/query.rs @@ -29,6 +29,13 @@ impl Default for Targets { } impl Targets { + /// Create a `Targets` from a browserslist query. + /// + /// The usage refer to the [browserslist](https://github.com/browserslist/browserslist?tab=readme-ov-file#queries) documentation. + pub fn from_query(query: &str) -> Self { + Targets::Query(Query::Single(query.into())) + } + /// Parse the query and return the parsed Versions. /// /// # Errors