diff --git a/Cargo.lock b/Cargo.lock index 36ba53e4e98e..e322efeadd10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,15 +372,15 @@ dependencies = [ [[package]] name = "browserslist-rs" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33066f72a558361eeb1077b0aff0f1dce1ac75bdc20b38a642f155f767b2824" +checksum = "4f2557836820eed97f79071bb3294b2640e71e0bc4301336a210a1b8b4947c15" dependencies = [ "ahash 0.8.7", "anyhow", "chrono", "either", - "itertools", + "itertools 0.12.0", "nom", "once_cell", "quote", @@ -872,7 +872,7 @@ dependencies = [ "clap 4.4.18", "criterion-plot", "is-terminal", - "itertools", + "itertools 0.10.5", "num-traits", "once_cell", "oorandom", @@ -893,7 +893,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] @@ -1883,6 +1883,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" diff --git a/crates/preset_env_base/Cargo.toml b/crates/preset_env_base/Cargo.toml index 1ae4129c92b8..ecf26054f6cd 100644 --- a/crates/preset_env_base/Cargo.toml +++ b/crates/preset_env_base/Cargo.toml @@ -13,7 +13,7 @@ bench = false [dependencies] ahash = "0.8.5" anyhow = "1" -browserslist-rs = "0.13.0" +browserslist-rs = "0.14.0" dashmap = "5.4.0" once_cell = "1.18.0" semver = { version = "1.0.17", features = ["serde"] } diff --git a/crates/swc_atoms/Cargo.toml b/crates/swc_atoms/Cargo.toml index bd45a774df61..973d7e37c222 100644 --- a/crates/swc_atoms/Cargo.toml +++ b/crates/swc_atoms/Cargo.toml @@ -18,7 +18,7 @@ rkyv-impl = ["__rkyv", "rkyv", "bytecheck"] [dependencies] # bytecheck version should be in sync with rkyv version. Do not bump individually. bytecheck = { version = "0.6.10", optional = true } -hstr = "0.2.5" +hstr = "0.2.7" once_cell = "1" rkyv = { package = "rkyv", version = "=0.7.42", optional = true, features = [ "strict", diff --git a/crates/swc_css_prefixer/tests/fixture/autofill/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/autofill/output.defaults-not-ie-11.css index 8e1dac1b33ff..aae1785d0108 100644 --- a/crates/swc_css_prefixer/tests/fixture/autofill/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/autofill/output.defaults-not-ie-11.css @@ -1,3 +1,6 @@ +input:-webkit-autofill { + border: 3px solid blue; +} input:autofill { border: 3px solid blue; } diff --git a/crates/swc_css_prefixer/tests/fixture/file-selector-button/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/file-selector-button/output.defaults-not-ie-11.css index 9e77af342362..848f622dad38 100644 --- a/crates/swc_css_prefixer/tests/fixture/file-selector-button/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/file-selector-button/output.defaults-not-ie-11.css @@ -1,6 +1,12 @@ +input[type=file]::-webkit-file-upload-button { + border: 2px solid #6c5ce7; +} input[type=file]::file-selector-button { border: 2px solid #6c5ce7; } +input[type=file]::-webkit-file-upload-button:hover { + border: 2px solid #00cec9; +} input[type=file]::file-selector-button:hover { border: 2px solid #00cec9; } diff --git a/crates/swc_css_prefixer/tests/fixture/grouping-rule/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/grouping-rule/output.defaults-not-ie-11.css index 1838539c2366..0ed99ab0fde8 100644 --- a/crates/swc_css_prefixer/tests/fixture/grouping-rule/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/grouping-rule/output.defaults-not-ie-11.css @@ -5,6 +5,13 @@ .b, .c::selection, .d:read-only, +.e::-webkit-input-placeholder { + color: yellow; +} +.a, +.b, +.c::selection, +.d:read-only, .e::placeholder { color: yellow; } diff --git a/crates/swc_css_prefixer/tests/fixture/nested/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/nested/output.defaults-not-ie-11.css index d28acbadc608..02d7c26c2a41 100644 --- a/crates/swc_css_prefixer/tests/fixture/nested/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/nested/output.defaults-not-ie-11.css @@ -20,11 +20,17 @@ } } .test { + &.class::-webkit-input-placeholder { + color: red; + } &.class::placeholder { color: red; } } .test { + &.class::-webkit-input-placeholder { + appearance: auto; + } &.class::placeholder { appearance: auto; } @@ -53,6 +59,9 @@ } .test { appearance: auto; + &.class::-webkit-input-placeholder { + appearance: auto; + } &.class::placeholder { appearance: auto; } @@ -62,6 +71,9 @@ } @media (orientation: landscape) { .test { + &.class::-webkit-input-placeholder { + appearance: auto; + } &.class::placeholder { appearance: auto; } diff --git a/crates/swc_css_prefixer/tests/fixture/placeholder/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/placeholder/output.defaults-not-ie-11.css index 5d608f42b43b..8e5edef2f4e7 100644 --- a/crates/swc_css_prefixer/tests/fixture/placeholder/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/placeholder/output.defaults-not-ie-11.css @@ -1,7 +1,10 @@ +input::-webkit-input-placeholder { + color: red; +} input::placeholder { color: red; } -input::placeholder, +input::-webkit-input-placeholder, #fs-toggle:-webkit-full-screen { color: red; } @@ -9,10 +12,17 @@ input::placeholder, #fs-toggle:fullscreen { color: red; } +input::-webkit-input-placeholder { + -webkit-backdrop-filter: blur(2px); + backdrop-filter: blur(2px); +} input::placeholder { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); } +input.appearance::-webkit-input-placeholder { + appearance: none; +} input.appearance::placeholder { appearance: none; } diff --git a/crates/swc_css_prefixer/tests/fixture/resolution/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/resolution/output.defaults-not-ie-11.css index b409a11191a9..26f737e16763 100644 --- a/crates/swc_css_prefixer/tests/fixture/resolution/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/resolution/output.defaults-not-ie-11.css @@ -1,79 +1,82 @@ -@import url('styles.css') screen and (min-resolution: 2dppx), screen and (-webkit-min-device-pixel-ratio: 2); +@import url('styles.css') screen and (min-resolution: 2dppx); @import url("styles.css") supports(display: flex) screen and (max-width: 400px); @import url("styles.css") supports(not (display: flex)) screen and (max-width: 400px); -@import url('styles.css') supports(display: flex) screen and (min-resolution: 2dppx), screen and (-webkit-min-device-pixel-ratio: 2); -@media (min-resolution: 2dppx), (min-resolution: 192dpi), (-webkit-min-device-pixel-ratio: 2), (-webkit-min-device-pixel-ratio: 2) { +@import url('styles.css') supports(display: flex) screen and (min-resolution: 2dppx); +@media (min-resolution: 2dppx), (min-resolution: 192dpi) { .class { color: red; } } -@media (min-resolution: 2.5dppx), (-webkit-min-device-pixel-ratio: 2.5) { +@media (min-resolution: 2.5dppx) { .class { color: red; } } -@media (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5) { +@media (min-resolution: 144dpi) { .class { color: red; } } -@media (min-resolution: 2x), (-webkit-min-device-pixel-ratio: 2) { +@media (min-resolution: 2x) { .class { color: red; } } -@media (min-resolution: 120dpi), (-webkit-min-device-pixel-ratio: 1.25) { +@media (min-resolution: 120dpi) { .class { color: red; } } -@media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) { +@media (min-resolution: 2dppx) { .class { color: red; } } -@media only screen and (min-resolution: 124.8dpi), only screen and (-webkit-min-device-pixel-ratio: 1.3) { +@media only screen and (min-resolution: 124.8dpi) { .class { color: red; } } -@media (min-resolution: 113.38dpcm), (-webkit-min-device-pixel-ratio: 3) { +@media (min-resolution: 113.38dpcm) { .class { color: red; } } +::-webkit-input-placeholder { + color: gray; +} ::placeholder { color: gray; } .image { background-image: url(image@1x.png); } -@media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) { +@media (min-resolution: 2dppx) { .image { background-image: url(image@2x.png); } } -@media (min-resolution: 33dpi), (-webkit-min-device-pixel-ratio: 0.34) { +@media (min-resolution: 33dpi) { .class { color: red; } } -@media (min-resolution: 0dpi), (-webkit-min-device-pixel-ratio: 0) { +@media (min-resolution: 0dpi) { .class { color: red; } } -@media (min-resolution: 2dppx), (min-resolution: 192dpi), (-webkit-min-device-pixel-ratio: 2), (-webkit-min-device-pixel-ratio: 2) {} -@media (min-resolution: 2.5dppx), (-webkit-min-device-pixel-ratio: 2.5) {} -@media (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5) {} -@media (min-resolution: 2x), (-webkit-min-device-pixel-ratio: 2) {} -@media (min-resolution: 120dpi), (-webkit-min-device-pixel-ratio: 1.25) {} -@media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) {} -@media only screen and (min-resolution: 124.8dpi), only screen and (-webkit-min-device-pixel-ratio: 1.3) {} -@media (min-resolution: 113.38dpcm), (-webkit-min-device-pixel-ratio: 3) {} +@media (min-resolution: 2dppx), (min-resolution: 192dpi) {} +@media (min-resolution: 2.5dppx) {} +@media (min-resolution: 144dpi) {} +@media (min-resolution: 2x) {} +@media (min-resolution: 120dpi) {} +@media (min-resolution: 2dppx) {} +@media only screen and (min-resolution: 124.8dpi) {} +@media (min-resolution: 113.38dpcm) {} @media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (min-resolution: 2dppx) {} @media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2) {} -@media (min-resolution: 113.38DPCM), (-webkit-min-device-pixel-ratio: 113.38) { +@media (min-resolution: 113.38DPCM) { .class { color: red; } diff --git a/crates/swc_css_prefixer/tests/fixture/text-emphasis/output.defaults-not-ie-11.css b/crates/swc_css_prefixer/tests/fixture/text-emphasis/output.defaults-not-ie-11.css index 7a1cd9378bbd..b8ebe6e2b441 100644 --- a/crates/swc_css_prefixer/tests/fixture/text-emphasis/output.defaults-not-ie-11.css +++ b/crates/swc_css_prefixer/tests/fixture/text-emphasis/output.defaults-not-ie-11.css @@ -1,4 +1,5 @@ .class { + -webkit-text-emphasis: none; text-emphasis: none; } .class { @@ -6,23 +7,30 @@ -webkit-text-emphasis: filled red; } .class { + -webkit-text-emphasis-position: left; text-emphasis-position: left; } .class { + -webkit-text-emphasis-style: circle; text-emphasis-style: circle; } .class { + -webkit-text-emphasis-color: red; text-emphasis-color: red; } a { + -webkit-text-emphasis-position: over left; text-emphasis-position: over left; } em { + -webkit-text-emphasis-position: under right; text-emphasis-position: under right; } .reverse { + -webkit-text-emphasis-position: left over; text-emphasis-position: left over; } .wrong { + -webkit-text-emphasis-position: over; text-emphasis-position: over; } diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-with/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-with/output.mjs index a57bdad9311b..887ef860f138 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-with/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-with/output.mjs @@ -1,5 +1,5 @@ import "core-js/modules/es7.string.pad-end.js"; import "core-js/modules/es7.string.pad-start.js"; -for (const { padStart } of foo){ +for (const { padStart } of foo){ console.log("b".padEnd(5)); } diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-without/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-without/output.mjs index 791a5c86a88b..5fe8e9b5b998 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-without/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-for-of-destructure-without/output.mjs @@ -1,3 +1,3 @@ -for (const { a } of foo){ +for (const { a } of foo){ console.log(a); } diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-instance-methods-native-support/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-instance-methods-native-support/output.mjs index e4f020617927..ca568b760f59 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-instance-methods-native-support/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-instance-methods-native-support/output.mjs @@ -8,4 +8,4 @@ d.fill.bind(); e.padStart.apply(); f.padEnd.call(); String.prototype.startsWith.call; -var { codePointAt , endsWith } = k; +var { codePointAt, endsWith } = k; diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-native-support/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-native-support/output.mjs index c3e7e9f60731..90d5ebb0ee75 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-native-support/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs2/usage-native-support/output.mjs @@ -18,4 +18,4 @@ function H(WeakMap) { var asdf = "copyWithin"; i[asdf]; j[`copyWithin`]; -var { [asdf]: _a } = k; +var { [asdf]: _a } = k; diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-with/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-with/output.mjs index fbec2f5dbcba..44f5e81e3b4e 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-with/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-with/output.mjs @@ -1,6 +1,6 @@ import "core-js/modules/es.array.iterator.js"; import "core-js/modules/es.string.pad-end.js"; import "core-js/modules/es.string.pad-start.js"; -for (const { padStart } of foo){ +for (const { padStart } of foo){ console.log("b".padEnd(5)); } diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-without/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-without/output.mjs index 791a5c86a88b..5fe8e9b5b998 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-without/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-for-of-destructure-without/output.mjs @@ -1,3 +1,3 @@ -for (const { a } of foo){ +for (const { a } of foo){ console.log(a); } diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-instance-methods-native-support/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-instance-methods-native-support/output.mjs index edbfd19f6d81..b09a2705f65f 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-instance-methods-native-support/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-instance-methods-native-support/output.mjs @@ -7,4 +7,4 @@ d.fill.bind(); e.padStart.apply(); f.padEnd.call(); String.prototype.startsWith.call; -var { codePointAt , endsWith } = k; +var { codePointAt, endsWith } = k; diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-native-support/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-native-support/output.mjs index e531ae772899..fcd8da9e14a0 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-native-support/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-native-support/output.mjs @@ -17,7 +17,7 @@ function H(WeakMap) { var asdf = "copyWithin"; i[asdf]; j[`copyWithin`]; -var { [asdf]: _a } = k; +var { [asdf]: _a } = k; const foo = new Promise((resolve)=>{ resolve(new Map()); }); diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods-native-support/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods-native-support/output.mjs index f1bc3cf57618..44061f938949 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods-native-support/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods-native-support/output.mjs @@ -1,4 +1,4 @@ Object.keys(foo); const getOwnPropertySymbols = Object.getOwnPropertySymbols; -const { assign } = Object; +const { assign } = Object; "defineProperty" in Object; diff --git a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods/output.mjs b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods/output.mjs index e28cd5f498e8..2527f2f4c83e 100644 --- a/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods/output.mjs +++ b/crates/swc_ecma_preset_env/tests/fixtures/corejs3/usage-static-methods/output.mjs @@ -4,5 +4,5 @@ import "core-js/modules/es.object.keys.js"; import "core-js/modules/es.symbol.js"; Object.keys(foo); var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var { assign } = Object; +var { assign } = Object; "defineProperty" in Object;