Skip to content

Commit

Permalink
feat(transformer): support Targets::from_query method (#5336)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Aug 30, 2024
1 parent 3d4a64c commit d04857b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/oxc_transformer/src/env/targets/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d04857b

Please sign in to comment.