Skip to content

Commit

Permalink
feat: remove and_qq, and_uc, baidu, and kaios from generated browsers…
Browse files Browse the repository at this point in the history
…lists, as the data for these browsers are lacking and harms feature detection otherwise
  • Loading branch information
wessberg committed Aug 30, 2024
1 parent 553c111 commit ac24451
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/browserslist-generator/browserslist-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@ const TYPED_ARRAY_BASE_DATA_CORRECTIONS_INPUT: CaniuseBrowserCorrection = {
ios_saf: rangeCorrection("safari", CaniuseSupportKind.AVAILABLE, `5`),
ie: rangeCorrection("ie", CaniuseSupportKind.AVAILABLE, `11`),
op_mini: rangeCorrection("op_mini", CaniuseSupportKind.AVAILABLE, `all`),
bb: rangeCorrection("bb", CaniuseSupportKind.AVAILABLE, `10`),
and_uc: rangeCorrection("and_uc", CaniuseSupportKind.AVAILABLE, `11.8`),
and_qq: rangeCorrection("and_qq", CaniuseSupportKind.AVAILABLE, `1.2`),
baidu: rangeCorrection("baidu", CaniuseSupportKind.AVAILABLE, `7.12`)
bb: rangeCorrection("bb", CaniuseSupportKind.AVAILABLE, `10`)
/* eslint-enable @typescript-eslint/naming-convention */
};

Expand Down Expand Up @@ -463,7 +460,7 @@ export function normalizeBrowserslist(browserslist: string | string[]): string[]
// to make sure comparsions won't fail
const inputBrowserslist = Array.isArray(browserslist) ? browserslist : [browserslist];

for (const browser of ["and_ff", "and_chr", "and_uc", "and_qq", "baidu", "op_mini"] as const) {
for (const browser of ["and_ff", "and_chr", "op_mini"] as const) {
const versions = getSortedBrowserVersions(browser);
for (const entry of inputBrowserslist) {
if (!entry.startsWith(browser)) continue;
Expand Down Expand Up @@ -645,11 +642,19 @@ export function browsersWithoutSupportForFeatures(...args: [BrowsersWithSupportO

/**
* Returns true if the given browser should be ignored. The data reported from Caniuse is a bit lacking.
* For example, only the latest version of and_ff, and_qq, and_uc and baidu is reported, and since
* For example, only the latest version of and_ff is reported, and since
* android went to use Chromium for the WebView, it has only reported the latest Chromium version
*/
function shouldIgnoreBrowser(browser: CaniuseBrowser, version: string): boolean {
return (
// The data for the QQ browser is severely lacking and unreliable
browser === "and_qq" ||
// The data for the UC browser is severely lacking and unreliable
browser === "and_uc" ||
// The data for the Baidu browser is severely lacking and unreliable
browser === "baidu" ||
// The data for the KaiOS browser is severely lacking and unreliable
browser === "kaios" ||
(browser === "android" && gt(coerceToString(browser, version), coerceToString(browser, "4.4.4"))) ||
(browser === "op_mob" && gt(coerceToString(browser, version), coerceToString(browser, "12.1")))
);
Expand Down Expand Up @@ -823,11 +828,12 @@ function getMdnFeatureSupport(feature: string): CaniuseStatsNormalized {
and_chr: formatBrowser("chrome_android", "and_chr"),
chrome: formatBrowser("chrome", "chrome"),
and_ff: formatBrowser("firefox_android", "and_ff"),
android: formatBrowser("webview_android", "android"),
bb: {},
and_qq: {},
and_uc: {},
android: formatBrowser("webview_android", "android"),
kaios: {},
baidu: {},
bb: {},
edge: formatBrowser("edge", "edge"),
samsung: formatBrowser("samsunginternet_android", "samsung"),
ie: formatBrowser("ie", "ie"),
Expand Down Expand Up @@ -1582,6 +1588,7 @@ function getCaniuseVersionForUseragentVersion(
case "samsung":
case "and_qq":
case "baidu":
case "kaios":
// These may always contain minor versions
return buildSemverVersion(major, minor);

Expand Down
1 change: 1 addition & 0 deletions src/browserslist-generator/i-caniuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type CaniuseBrowser =
| "and_uc"
| "android"
| "baidu"
| "kaios"
| "bb"
| "chrome"
| "edge"
Expand Down

0 comments on commit ac24451

Please sign in to comment.