From 480c4c07614de5f40b84706452f85efa853c243a Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Mon, 2 Nov 2020 19:08:06 +0300 Subject: [PATCH] fix: more --- cspell.json | 1 + lib/config/browserslistTargetHandler.js | 56 +++++++++++++++---- .../target-browserslist.unittest.js.snap | 24 ++++---- 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/cspell.json b/cspell.json index 7c54bb495..9055c063f 100644 --- a/cspell.json +++ b/cspell.json @@ -182,6 +182,7 @@ "onconnect", "nwjs", "redeclaration", + "kaios", "webassemblyjs", "fsevents", diff --git a/lib/config/browserslistTargetHandler.js b/lib/config/browserslistTargetHandler.js index 1ad44677f..930892637 100644 --- a/lib/config/browserslistTargetHandler.js +++ b/lib/config/browserslistTargetHandler.js @@ -103,27 +103,32 @@ const resolve = browsers => { const anyBrowser = browsers.some(b => /^(?!node)/.test(b)); const browserProperty = !anyBrowser ? false : anyNode ? null : true; const nodeProperty = !anyNode ? false : anyBrowser ? null : true; + // Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features const es6DynamicImport = rawChecker({ chrome: 63, and_chr: 63, edge: 79, firefox: 67, and_ff: 67, - // ie: Not supported, + // ie: Not supported opera: 50, op_mob: 46, safari: [11, 1], ios_saf: [11, 3], - samsung: [8, 0], + samsung: [8, 2], android: 63, + and_qq: [10, 4], + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 node: [13, 14] }); return { const: rawChecker({ - chrome: 21, - and_chr: 25, + chrome: 49, + and_chr: 49, edge: 12, // Prior to Firefox 13, const is implemented, but re-assignment is not failing. // Prior to Firefox 46, a TypeError was thrown on redeclaration instead of a SyntaxError. @@ -131,13 +136,18 @@ const resolve = browsers => { and_ff: 36, // Not supported in for-in and for-of loops // ie: Not supported - opera: 9, - op_mob: [10, 1], - safari: [5, 1], - ios_saf: 6, + opera: 36, + op_mob: 36, + safari: [10, 0], + ios_saf: [10, 0], // Before 5.0 supported correctly in strict mode, otherwise supported without block scope samsung: [5, 0], android: 37, + and_qq: [10, 4], + // Supported correctly in strict mode, otherwise supported without block scope + // baidu: Not supported + and_uc: [12, 12], + kaios: [2, 5], node: [6, 0] }), arrowFunction: rawChecker({ @@ -155,6 +165,10 @@ const resolve = browsers => { ios_saf: 10, samsung: [5, 0], android: 45, + and_qq: [10, 4], + baidu: [7, 12], + and_uc: [12, 12], + kaios: [2, 5], node: [6, 0] }), forOf: rawChecker({ @@ -171,6 +185,10 @@ const resolve = browsers => { ios_saf: 7, samsung: [3, 0], android: 38, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support node: [0, 12] }), destructuring: rawChecker({ @@ -186,6 +204,10 @@ const resolve = browsers => { ios_saf: 8, samsung: [5, 0], android: 49, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support node: [6, 0] }), bigIntLiteral: rawChecker({ @@ -199,8 +221,12 @@ const resolve = browsers => { op_mob: 48, safari: 14, ios_saf: 14, - samsung: [9, 0], + samsung: [9, 2], android: 67, + // and_qq: Not supported + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported node: [10, 4] }), // Support syntax `import` and `export` and no limitations and bugs on Node.js @@ -217,10 +243,14 @@ const resolve = browsers => { safari: [10, 1], ios_saf: [10, 3], samsung: [8, 0], + android: 61, + and_qq: [10, 4], + // baidu: Not supported + // and_uc: Not supported + // kaios: Not supported // Since Node.js 13.14.0 no warning about usage, but it was added 8.5.0 with some limitations and it was improved in 12.0.0 and 13.2.0 node: [13, 14] }), - // browserslistChecker("es6-module") && rawChecker({ node: [12, 17] }), dynamicImport: es6DynamicImport, dynamicImportInWorker: es6DynamicImport && !anyNode, @@ -237,8 +267,12 @@ const resolve = browsers => { op_mob: 50, safari: [12, 1], ios_saf: [12, 2], - samsung: [10, 0], + samsung: [10, 1], android: 71, + // and_qq: Unknown support + // baidu: Unknown support + // and_uc: Unknown support + // kaios: Unknown support node: [12, 0] }), diff --git a/test/__snapshots__/target-browserslist.unittest.js.snap b/test/__snapshots__/target-browserslist.unittest.js.snap index fec18f8ae..5ad5ef483 100644 --- a/test/__snapshots__/target-browserslist.unittest.js.snap +++ b/test/__snapshots__/target-browserslist.unittest.js.snap @@ -56,14 +56,14 @@ Object { exports[`browserslist target ["and_qq 10.4"] 1`] = ` Object { - "arrowFunction": false, + "arrowFunction": true, "bigIntLiteral": false, "browser": true, - "const": false, + "const": true, "destructuring": false, "document": true, - "dynamicImport": false, - "dynamicImportInWorker": false, + "dynamicImport": true, + "dynamicImportInWorker": true, "electron": false, "fetchWasm": true, "forOf": false, @@ -71,7 +71,7 @@ Object { "globalThis": false, "importScripts": false, "importScriptsInWorker": true, - "module": false, + "module": true, "node": false, "nodeBuiltins": false, "nwjs": false, @@ -83,10 +83,10 @@ Object { exports[`browserslist target ["and_uc 12.12"] 1`] = ` Object { - "arrowFunction": false, + "arrowFunction": true, "bigIntLiteral": false, "browser": true, - "const": false, + "const": true, "destructuring": false, "document": true, "dynamicImport": false, @@ -206,7 +206,7 @@ Object { "globalThis": true, "importScripts": false, "importScriptsInWorker": true, - "module": false, + "module": true, "node": false, "nodeBuiltins": false, "nwjs": false, @@ -218,7 +218,7 @@ Object { exports[`browserslist target ["baidu 7.12"] 1`] = ` Object { - "arrowFunction": false, + "arrowFunction": true, "bigIntLiteral": false, "browser": true, "const": false, @@ -488,10 +488,10 @@ Object { exports[`browserslist target ["kaios 2.5"] 1`] = ` Object { - "arrowFunction": false, + "arrowFunction": true, "bigIntLiteral": false, "browser": true, - "const": false, + "const": true, "destructuring": false, "document": true, "dynamicImport": false, @@ -734,7 +734,7 @@ Object { "arrowFunction": true, "bigIntLiteral": false, "browser": true, - "const": true, + "const": false, "destructuring": true, "document": true, "dynamicImport": false,