Merge remote-tracking branch 'sebdion/fix-13126-setMinimumBrowserVersions' into Seb-Dionfix-13126-setMinimumBrowserVersions

# Conflicts:
#	packages/modern-browsers/modern.js
This commit is contained in:
Nacho Codoñer
2025-03-04 17:37:31 +01:00
7 changed files with 36 additions and 25 deletions

View File

@@ -2935,6 +2935,7 @@ N/A
setMinimumBrowserVersions({
chrome: 49,
firefox: 45,
firefoxIOS: 100,
edge: 12,
ie: Infinity, // Sorry, IE11.
mobile_safari: [9, 2], // 9.2.0+

View File

@@ -4651,6 +4651,7 @@ N/A
setMinimumBrowserVersions({
chrome: 49,
firefox: 45,
firefoxIOS: 100,
edge: 12,
ie: Infinity, // Sorry, IE11.
mobile_safari: [9, 2], // 9.2.0+

3
package-lock.json generated
View File

@@ -28,7 +28,7 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.8.6",
"prettier": "^2.8.8",
"typescript": "^5.4.5"
}
},
@@ -4260,6 +4260,7 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin-prettier.js"
},

View File

@@ -32,7 +32,7 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.8.6",
"prettier": "^2.8.8",
"typescript": "^5.4.5"
},
"jshintConfig": {

View File

@@ -9,6 +9,7 @@ setMinimumBrowserVersions({
// (pre-Edge) from the modern classification. #9818 #9839
ie: 12,
firefox: 45,
firefoxIOS: 100,
mobileSafari: 10,
opera: 38,
safari: 10,

View File

@@ -12,6 +12,7 @@ setMinimumBrowserVersions({
chrome: 42,
edge: 14,
firefox: 39,
firefoxIOS: 100,
mobile_safari: [10, 3],
opera: 29,
safari: [10, 1],

View File

@@ -6,9 +6,9 @@ const hasOwn = Object.prototype.hasOwnProperty;
const browserAliases = {
chrome: [
// chromeMobile*, per https://github.com/meteor/meteor/pull/9793,
'chromeMobile',
'chromeMobileIOS',
'chromeMobileWebView',
"chromeMobile",
"chromeMobileIOS",
"chromeMobileWebView",
// The major version number of Chromium and Headless Chrome track with the
// releases of Chrome Dev, Canary and Stable, so we should be okay to
@@ -18,8 +18,8 @@ const browserAliases = {
// Chromium is particularly important to list here since, unlike macOS
// builds, Linux builds list Chromium in the userAgent along with Chrome:
// e.g. Chromium/70.0.3538.77 Chrome/70.0.3538.77
'chromium',
'headlesschrome',
"chromium",
"headlesschrome",
],
edge: [
@@ -32,14 +32,14 @@ const browserAliases = {
'edgeMobile'
],
firefox: ['firefoxMobile'],
firefox: ["firefoxMobile"],
// The webapp package converts browser names to camel case, so
// mobile_safari and mobileSafari should be synonymous.
mobile_safari: ['mobileSafari', 'mobileSafariUI', 'mobileSafariUI/WKWebView'],
mobile_safari: ["mobileSafari", "mobileSafariUI", "mobileSafariUI/WKWebView"],
// Embedded WebViews on iPads will be reported as Apple Mail
safari: ['appleMail'],
safari: ["appleMail"],
};
/**
@@ -86,7 +86,7 @@ function applyAliases(versions) {
*/
function isModern(browser) {
const lowerCaseName =
browser && typeof browser.name === 'string' && browser.name.toLowerCase();
browser && typeof browser.name === "string" && browser.name.toLowerCase();
if (!lowerCaseName) {
return false;
}
@@ -137,7 +137,7 @@ function setMinimumBrowserVersions(versions, source) {
minimumVersions[lowerCaseName] = {
version: copy(version),
source: source || getCaller('setMinimumBrowserVersions'),
source: source || getCaller("setMinimumBrowserVersions"),
};
}
}
@@ -145,7 +145,7 @@ function setMinimumBrowserVersions(versions, source) {
function getCaller(calleeName) {
const error = new Error();
Error.captureStackTrace(error);
const lines = error.stack.split('\n');
const lines = error.stack.split("\n");
let caller;
lines.some((line, i) => {
if (line.indexOf(calleeName) >= 0) {
@@ -162,7 +162,9 @@ function getCaller(calleeName) {
* @locus server
* @return {object}
*/
function getMinimumBrowserVersions() { return minimumVersions; }
function getMinimumBrowserVersions() {
return minimumVersions;
}
Object.assign(exports, {
isModern,
@@ -174,17 +176,17 @@ Object.assign(exports, {
* @return {string}
*/
calculateHashOfMinimumVersions() {
const { createHash } = require('crypto');
return createHash('sha1')
const { createHash } = require("crypto");
return createHash("sha1")
.update(JSON.stringify(minimumVersions))
.digest('hex');
.digest("hex");
},
});
// For making defensive copies of [major, minor, ...] version arrays, so
// they don't change unexpectedly.
function copy(version) {
if (typeof version === 'number') {
if (typeof version === "number") {
return version;
}
@@ -200,8 +202,8 @@ function greaterThanOrEqualTo(a, b) {
}
function greaterThan(a, b) {
const as = typeof a === 'number' ? [a] : a;
const bs = typeof b === 'number' ? [b] : b;
const as = typeof a === "number" ? [a] : a;
const bs = typeof b === "number" ? [b] : b;
const maxLen = Math.max(as.length, bs.length);
for (let i = 0; i < maxLen; ++i) {
@@ -221,7 +223,7 @@ function greaterThan(a, b) {
}
function makeSource(feature) {
return module.id + ' (' + feature + ')';
return module.id + " (" + feature + ")";
}
setMinimumBrowserVersions(
@@ -229,6 +231,7 @@ setMinimumBrowserVersions(
chrome: 49,
edge: 12,
firefox: 45,
firefoxIOS: 100,
mobileSafari: [9, 2],
opera: 36,
safari: 9,
@@ -236,7 +239,7 @@ setMinimumBrowserVersions(
// https://github.com/Kilian/electron-to-chromium/blob/master/full-versions.js
electron: 1,
},
makeSource('classes')
makeSource("classes")
);
setMinimumBrowserVersions(
@@ -244,6 +247,7 @@ setMinimumBrowserVersions(
chrome: 39,
edge: 13,
firefox: 26,
firefoxIOS: 100,
mobileSafari: 10,
opera: 26,
safari: 10,
@@ -251,7 +255,7 @@ setMinimumBrowserVersions(
phantomjs: Infinity,
electron: [0, 20],
},
makeSource('generator functions')
makeSource("generator functions")
);
setMinimumBrowserVersions(
@@ -259,12 +263,13 @@ setMinimumBrowserVersions(
chrome: 41,
edge: 13,
firefox: 34,
firefoxIOS: 100,
mobileSafari: [9, 2],
opera: 29,
safari: [9, 1],
electron: [0, 24],
},
makeSource('template literals')
makeSource("template literals")
);
setMinimumBrowserVersions(
@@ -272,10 +277,11 @@ setMinimumBrowserVersions(
chrome: 38,
edge: 12,
firefox: 36,
firefoxIOS: 100,
mobileSafari: 9,
opera: 25,
safari: 9,
electron: [0, 20],
},
makeSource('symbols')
makeSource("symbols")
);