chore(preset-env): Update browserslist-rs (#8614)

This commit is contained in:
Donny/강동윤 2024-02-07 12:52:42 +09:00 committed by GitHub
parent 927b14a2e4
commit e5585e99f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 63 additions and 3 deletions

5
Cargo.lock generated
View File

@ -372,14 +372,15 @@ dependencies = [
[[package]]
name = "browserslist-rs"
version = "0.14.0"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f2557836820eed97f79071bb3294b2640e71e0bc4301336a210a1b8b4947c15"
checksum = "405bbd46590a441abe5db3e5c8af005aa42e640803fecb51912703e93e4ce8d3"
dependencies = [
"ahash 0.8.7",
"anyhow",
"chrono",
"either",
"indexmap 2.1.0",
"itertools 0.12.0",
"nom",
"once_cell",

View File

@ -13,7 +13,7 @@ bench = false
[dependencies]
ahash = "0.8.5"
anyhow = "1"
browserslist-rs = "0.14.0"
browserslist-rs = "0.15.0"
dashmap = "5.4.0"
once_cell = "1.18.0"
semver = { version = "1.0.17", features = ["serde"] }

View File

@ -72,6 +72,21 @@ pub struct BrowserData<T: Default> {
pub bun: T,
}
impl<T> BrowserData<T>
where
T: Default,
{
pub fn insert(&mut self, k: &str, v: T) -> T {
for (key, value) in self.iter_mut() {
if k == key {
return std::mem::replace(value, v);
}
}
panic!("unknown key: {}", k)
}
}
/// A map of browser names to data for feature support in browser.
///
/// This type mainly stores `minimum version for each browsers with support for

View File

@ -121,6 +121,22 @@ pub fn targets_to_versions(v: Option<Targets>) -> Result<Versions, Error> {
}
}
let mut result = Versions::default();
for (k, v) in map.iter() {
match v {
QueryOrVersion::Query(q) => {
let v = q.exec().context("failed to run query")?;
for (k, v) in v {
result.insert(k, v);
}
}
QueryOrVersion::Version(v) => {
result.insert(k, Some(*v));
}
}
}
unimplemented!("Targets: {:?}", map)
}
_ => unimplemented!("Option<Targets>: {:?}", v),

View File

@ -0,0 +1,23 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"loose": false,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true,
"env": {
"targets": "ios_saf 14",
"coreJs": "3.21",
"mode": "usage"
}
}

View File

@ -0,0 +1,3 @@
// Doesn't matter
console.log(Promise.resolve)
console.log(globalThis)

View File

@ -0,0 +1,2 @@
console.log(Promise.resolve);
console.log(globalThis);