mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
chore(preset-env): Update browserslist-rs
(#8614)
This commit is contained in:
parent
927b14a2e4
commit
e5585e99f1
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -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",
|
||||
|
@ -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"] }
|
||||
|
@ -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
|
||||
|
@ -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),
|
||||
|
23
crates/swc/tests/fixture/issues-8xxx/8492/input/.swcrc
Normal file
23
crates/swc/tests/fixture/issues-8xxx/8492/input/.swcrc
Normal 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"
|
||||
}
|
||||
}
|
3
crates/swc/tests/fixture/issues-8xxx/8492/input/1.js
Normal file
3
crates/swc/tests/fixture/issues-8xxx/8492/input/1.js
Normal file
@ -0,0 +1,3 @@
|
||||
// Doesn't matter
|
||||
console.log(Promise.resolve)
|
||||
console.log(globalThis)
|
2
crates/swc/tests/fixture/issues-8xxx/8492/output/1.js
Normal file
2
crates/swc/tests/fixture/issues-8xxx/8492/output/1.js
Normal file
@ -0,0 +1,2 @@
|
||||
console.log(Promise.resolve);
|
||||
console.log(globalThis);
|
Loading…
Reference in New Issue
Block a user