Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(transformer): support Targets::from_query method #5336

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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