Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update compat-data sources #15726

Merged
merged 4 commits into from Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -89,9 +89,9 @@
],
"resolutions": {
"browserslist": "npm:4.21.5",
"caniuse-lite": "npm:1.0.30001460",
"core-js-compat": "npm:3.29.0",
"electron-to-chromium": "npm:1.4.320",
"caniuse-lite": "npm:1.0.30001508",
"core-js-compat": "npm:3.31.0",
"electron-to-chromium": "npm:1.4.441",
"glob-watcher/chokidar": "npm:^3.4.0",
"@types/babel__core": "link:./nope",
"@types/babel__traverse": "link:./nope",
Expand Down
13 changes: 8 additions & 5 deletions packages/babel-compat-data/data/plugins.json
Expand Up @@ -2,7 +2,8 @@
"transform-unicode-sets-regex": {
"chrome": "112",
"opera": "98",
"edge": "112"
"edge": "112",
"electron": "24.0"
},
"transform-class-static-block": {
"chrome": "94",
Expand Down Expand Up @@ -669,26 +670,28 @@
},
"transform-export-namespace-from": {
"chrome": "72",
"and_chr": "72",
"deno": "1.0",
"edge": "79",
"firefox": "80",
"and_ff": "80",
"node": "13.2",
"opera": "60",
"op_mob": "51",
"safari": "14.1",
"ios": "14.5",
"samsung": "11.0",
"android": "72",
"electron": "5.0"
},
"proposal-export-namespace-from": {
"chrome": "72",
"and_chr": "72",
"deno": "1.0",
"edge": "79",
"firefox": "80",
"and_ff": "80",
"node": "13.2",
"opera": "60",
"op_mob": "51",
"safari": "14.1",
"ios": "14.5",
"samsung": "11.0",
"android": "72",
"electron": "5.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-compat-data/package.json
Expand Up @@ -43,9 +43,9 @@
"compat-data"
],
"devDependencies": {
"@mdn/browser-compat-data": "^4.0.10",
"core-js-compat": "^3.30.2",
"electron-to-chromium": "^1.4.248"
"@mdn/browser-compat-data": "^5.3.0",
"core-js-compat": "^3.31.0",
"electron-to-chromium": "^1.4.441"
},
"engines": {
"node": ">=6.9.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-compat-data/scripts/build-data.js
Expand Up @@ -25,7 +25,8 @@ for (const target of ["plugin", "corejs2-built-in"]) {
if (target === "plugin") {
// add export-namespace-from from @mdn/browser-compat-data
const exportNamespaceFromCompatData = generateModuleSupport(
compatData.statements.export.namespace
compatData.statements.export.namespace,
true
);
// the node.js compat data is 12.0, the first node version ships `export *` behind a flag
// here we overwrite to 13.2 which is the first unflagged version
Expand Down
43 changes: 30 additions & 13 deletions packages/babel-compat-data/scripts/build-modules-support.js
Expand Up @@ -4,15 +4,27 @@ const compatData = require("@mdn/browser-compat-data").javascript;
const { addElectronSupportFromChromium } = require("./chromium-to-electron");
const { writeFile, babel7Only } = require("./utils-build-data");

// Map mdn-browser-compat-data to browserslist browser names
const browserNameMap = {
chrome_android: "and_chr",
firefox_android: "and_ff",
safari_ios: "ios",
nodejs: "node",
webview_android: "android",
opera_android: "op_mob",
samsunginternet_android: "samsung",
const browserNameMaps = {
// Map @mdn/browser-compat-data to browserslist browser names
toBrowserslist: {
chrome_android: "and_chr",
firefox_android: "and_ff",
safari_ios: "ios",
nodejs: "node",
webview_android: "android",
opera_android: "op_mob",
samsunginternet_android: "samsung",
},
// Map @mdn/browser-compat-data to kangax/compat-table engine names
toCompatTable: {
chrome_android: "chrome",
firefox_android: "firefox",
safari_ios: "ios",
nodejs: "node",
webview_android: "android",
opera_android: "op_mob",
samsunginternet_android: "samsung",
},
};

const browserSupportMap = {
Expand All @@ -31,14 +43,17 @@ function browserVersion(browser, version_added) {
return version_added;
}

function generateModuleSupport(source) {
function generateModuleSupport(source, toCompatTable) {
const stats = source.__compat.support;
const allowedBrowsers = {};
const browserNameMap = toCompatTable
? browserNameMaps.toCompatTable
: browserNameMaps.toBrowserslist;

Object.keys(stats).forEach(browser => {
const browserName = browserNameMap[browser] || browser;
// todo: remove this when we support deno
if (browserName === "deno") return;
// todo: remove this when we support oculus
if (browserName === "oculus") return;
let browserSupport = stats[browserSupportMap[browserName] || browser];
if (Array.isArray(browserSupport)) {
browserSupport = browserSupport[0]; // The first item is the most progressive support
Expand All @@ -60,7 +75,9 @@ function generateModuleSupport(source) {
}

const dataPath = path.join(__dirname, "../data/native-modules.json");
const processed = generateModuleSupport(compatData.statements.export);
const processed = generateModuleSupport(compatData.statements.export, false);
// todo: restore deno support when browserslist recognizes deno
delete processed.deno;
babel7Only(() => {
if (processed.ios) {
processed.ios_saf = processed.ios;
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-env/package.json
Expand Up @@ -94,7 +94,7 @@
"babel-plugin-polyfill-corejs2": "^0.4.3",
"babel-plugin-polyfill-corejs3": "^0.8.1",
"babel-plugin-polyfill-regenerator": "^0.5.0",
"core-js-compat": "^3.30.2",
"core-js-compat": "^3.31.0",
"semver": "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0"
},
"peerDependencies": {
Expand Down
Expand Up @@ -33,7 +33,7 @@ Using plugins:
transform-unicode-property-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-named-capturing-groups-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
bugfix/transform-async-arrows-in-class { ios < 11, safari < 11 }
bugfix/transform-edge-default-parameters { edge < 18 }
bugfix/transform-edge-function-name { edge < 79 }
Expand Down
Expand Up @@ -38,7 +38,7 @@ Using plugins:
transform-function-name { edge < 79 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-block-scoping { ios < 11, safari < 11 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
Expand Down
Expand Up @@ -38,7 +38,7 @@ Using plugins:
transform-function-name { edge < 79 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-block-scoping { ios < 11, safari < 11 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
Expand Down
Expand Up @@ -33,7 +33,7 @@ Using plugins:
transform-unicode-property-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-named-capturing-groups-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
bugfix/transform-async-arrows-in-class { ios < 11, safari < 11 }
bugfix/transform-edge-default-parameters { edge < 18 }
bugfix/transform-edge-function-name { edge < 79 }
Expand Down
Expand Up @@ -30,7 +30,7 @@ Using plugins:
transform-template-literals { safari < 13 }
transform-unicode-regex { safari < 12 }
transform-block-scoping { safari < 11 }
transform-export-namespace-from { safari }
transform-export-namespace-from { safari < 14.1 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
Expand Down
Expand Up @@ -27,7 +27,7 @@ Using plugins:
transform-async-to-generator { safari < 10.1 }
transform-exponentiation-operator { safari < 10.1 }
transform-unicode-regex { safari < 12 }
transform-export-namespace-from { safari }
transform-export-namespace-from { safari < 14.1 }
bugfix/transform-safari-block-shadowing { safari < 11 }
bugfix/transform-safari-for-shadowing { safari < 11 }
bugfix/transform-safari-id-destructuring-collision-in-function-expression { safari }
Expand Down
Expand Up @@ -25,7 +25,7 @@ Using plugins:
transform-unicode-property-regex { safari < 11.1 }
transform-named-capturing-groups-regex { safari < 11.1 }
transform-unicode-regex { safari < 12 }
transform-export-namespace-from { safari }
transform-export-namespace-from { safari < 14.1 }
bugfix/transform-safari-id-destructuring-collision-in-function-expression { safari }
bugfix/transform-tagged-template-caching { safari < 13 }
transform-modules-commonjs
Expand Down
Expand Up @@ -38,7 +38,7 @@ Using plugins:
transform-block-scoping { safari < 10 }
transform-new-target { safari < 10 }
transform-regenerator { safari < 10 }
transform-export-namespace-from { safari }
transform-export-namespace-from { safari < 14.1 }
bugfix/transform-tagged-template-caching { safari < 13 }
transform-modules-commonjs
transform-dynamic-import
Expand Down
Expand Up @@ -19,10 +19,10 @@ Using plugins:
syntax-optional-catch-binding
syntax-async-generators
syntax-object-rest-spread
transform-export-namespace-from { safari }
bugfix/transform-safari-id-destructuring-collision-in-function-expression { safari }
transform-modules-commonjs
transform-dynamic-import
transform-export-namespace-from { }
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -20,9 +20,9 @@ Using plugins:
transform-parameters { safari }
syntax-async-generators
syntax-object-rest-spread
transform-export-namespace-from { safari }
transform-modules-commonjs
transform-dynamic-import
transform-export-namespace-from { }
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -38,7 +38,7 @@ Using plugins:
transform-function-name { edge < 79 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-block-scoping { ios < 11, safari < 11 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
syntax-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option
Expand Down
Expand Up @@ -33,7 +33,7 @@ Using plugins:
transform-unicode-property-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-named-capturing-groups-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
bugfix/transform-async-arrows-in-class { ios < 11, safari < 11 }
bugfix/transform-edge-default-parameters { edge < 18 }
bugfix/transform-edge-function-name { edge < 79 }
Expand Down
Expand Up @@ -38,7 +38,7 @@ Using plugins:
transform-function-name { edge < 79 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-block-scoping { ios < 11, safari < 11 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
syntax-dynamic-import
syntax-import-meta
corejs3: `DEBUG` option
Expand Down
Expand Up @@ -33,7 +33,7 @@ Using plugins:
transform-unicode-property-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-named-capturing-groups-regex { android, chrome < 64, edge < 79, firefox < 78, ios < 11.3, opera < 51, safari < 11.1, samsung < 9 }
transform-unicode-regex { ios < 12, safari < 12 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios < 14.5, opera < 60, safari < 14.1, samsung < 11.0 }
bugfix/transform-async-arrows-in-class { ios < 11, safari < 11 }
bugfix/transform-edge-default-parameters { edge < 18 }
bugfix/transform-edge-function-name { edge < 79 }
Expand Down
Expand Up @@ -2,24 +2,23 @@

Using targets:
{
"android": "109",
"chrome": "108",
"edge": "109",
"android": "113",
"chrome": "109",
"edge": "112",
"firefox": "102",
"ios": "14.5",
"opera": "94",
"ios": "15.6",
"opera": "98",
"safari": "15.6",
"samsung": "19"
"samsung": "20"
}

Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge < 112, firefox, ios, opera < 98, safari, samsung }
transform-unicode-sets-regex { chrome < 112, firefox, ios, safari, samsung }
transform-class-static-block { ios, safari }
transform-private-property-in-object { ios < 15 }
syntax-private-property-in-object
syntax-class-properties
transform-private-methods { ios < 15 }
syntax-numeric-separator
syntax-nullish-coalescing-operator
syntax-optional-chaining
Expand All @@ -28,9 +27,9 @@ Using plugins:
transform-parameters { ios, safari }
syntax-async-generators
syntax-object-rest-spread
transform-export-namespace-from { ios, safari }
transform-modules-commonjs
transform-dynamic-import
transform-export-namespace-from { }
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -2,24 +2,23 @@

Using targets:
{
"android": "109",
"chrome": "108",
"edge": "109",
"android": "113",
"chrome": "109",
"edge": "112",
"firefox": "102",
"ios": "14.5",
"opera": "94",
"ios": "15.6",
"opera": "98",
"safari": "15.6",
"samsung": "19"
"samsung": "20"
}

Using modules transform: auto

Using plugins:
transform-unicode-sets-regex { android, chrome < 112, edge < 112, firefox, ios, opera < 98, safari, samsung }
transform-unicode-sets-regex { chrome < 112, firefox, ios, safari, samsung }
transform-class-static-block { ios, safari }
transform-private-property-in-object { ios < 15 }
syntax-private-property-in-object
syntax-class-properties
transform-private-methods { ios < 15 }
syntax-numeric-separator
syntax-nullish-coalescing-operator
syntax-optional-chaining
Expand All @@ -28,9 +27,9 @@ Using plugins:
transform-parameters { ios, safari }
syntax-async-generators
syntax-object-rest-spread
transform-export-namespace-from { ios, safari }
transform-modules-commonjs
transform-dynamic-import
transform-export-namespace-from { }
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.