Include preset modules (#11083)

* Prepare preset-env and compat-data for preset-modules

* Add transform-edge-default-parameters from preset-modules

* AUtomatically generate data from compat-table

* Add compat data for other plugins

* Updates after rebase

* Add more bugfixes to preset-env

* Update tests

* Add bugfix/transform-safari-for-shadowing

* Fix build script

* bugfix/transform-safari-block-shadowing

* Fix flow

* Include changes from 7127330f02b423d9cb0555b3d2a24dbccbc149b5

* Fix check-compat-data
This commit is contained in:
Nicolò Ribaudo 2020-03-17 00:36:29 +01:00 committed by GitHub
parent f6c7bf36ce
commit a11855e586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
83 changed files with 1499 additions and 347 deletions

View File

@ -14,6 +14,7 @@ codemods/*/src
lib/file.js
lib/parser.js
lib/third-party-libs.js.flow
lib/preset-modules.js.flow
packages/babel-types/lib/index.js.flow
[options]

View File

@ -0,0 +1,18 @@
declare module "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class" {
declare module.exports: Function;
}
declare module "@babel/preset-modules/lib/plugins/transform-edge-default-parameters" {
declare module.exports: Function;
}
declare module "@babel/preset-modules/lib/plugins/transform-edge-function-name" {
declare module.exports: Function;
}
declare module "@babel/preset-modules/lib/plugins/transform-tagged-template-caching" {
declare module.exports: Function;
}
declare module "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing" {
declare module.exports: Function;
}
declare module "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing" {
declare module.exports: Function;
}

View File

@ -1,3 +1,18 @@
{
"transform-regenerator": []
"transform-async-to-generator": [
"bugfix/transform-async-arrows-in-class"
],
"transform-parameters": [
"bugfix/transform-edge-default-parameters"
],
"transform-function-name": [
"bugfix/transform-edge-function-name"
],
"transform-block-scoping": [
"bugfix/transform-safari-block-shadowing",
"bugfix/transform-safari-for-shadowing"
],
"transform-template-literals": [
"bugfix/transform-tagged-template-caching"
]
}

View File

@ -0,0 +1,125 @@
{
"transform-async-to-generator": {
"chrome": "55",
"edge": "15",
"firefox": "52",
"safari": "10.1",
"node": "7.6",
"ios": "10.3",
"samsung": "6",
"opera": "42",
"electron": "1.6"
},
"bugfix/transform-async-arrows-in-class": {
"chrome": "55",
"edge": "15",
"firefox": "52",
"safari": "11",
"node": "7.6",
"ios": "11",
"samsung": "6",
"opera": "42",
"electron": "1.6"
},
"transform-parameters": {
"chrome": "49",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"bugfix/transform-edge-default-parameters": {
"chrome": "49",
"edge": "18",
"firefox": "52",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"transform-function-name": {
"chrome": "51",
"edge": "14",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"opera": "38",
"electron": "1.2"
},
"bugfix/transform-edge-function-name": {
"chrome": "51",
"edge": "79",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"opera": "38",
"electron": "1.2"
},
"transform-block-scoping": {
"chrome": "49",
"edge": "14",
"firefox": "51",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"bugfix/transform-safari-block-shadowing": {
"chrome": "49",
"edge": "12",
"firefox": "44",
"safari": "11",
"node": "6",
"ie": "11",
"ios": "11",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"bugfix/transform-safari-for-shadowing": {
"chrome": "49",
"edge": "12",
"firefox": "4",
"safari": "11",
"node": "6",
"ie": "11",
"ios": "11",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"transform-template-literals": {
"chrome": "41",
"edge": "13",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "3.4",
"opera": "28",
"electron": "0.24"
},
"bugfix/transform-tagged-template-caching": {
"chrome": "41",
"edge": "12",
"firefox": "34",
"safari": "13",
"node": "4",
"ios": "13",
"samsung": "3.4",
"opera": "28",
"electron": "0.24"
}
}

View File

@ -13,10 +13,11 @@
"./native-modules": "./data/native-modules.json",
"./corejs2-built-ins": "./data/corejs2-built-ins.json",
"./corejs3-shipped-proposals": "./data/corejs3-shipped-proposals",
"./overlapping-plugins": "./data/overlapping-plugins.json"
"./overlapping-plugins": "./data/overlapping-plugins.json",
"./plugin-bugfixes": "./data/plugin-bugfixes.json"
},
"scripts": {
"build-data": "./scripts/download-compat-table.sh; node ./scripts/build-data.js; node ./scripts/build-modules-support.js; node ./scripts/build-overlapping-plugins.js; node ./scripts/build-corejs3-proposals.js"
"build-data": "./scripts/download-compat-table.sh; node ./scripts/build-data.js; node ./scripts/build-modules-support.js; node ./scripts/build-bugfixes-targets.js"
},
"keywords": [
"babel",

View File

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/plugin-bugfixes.json");

View File

@ -0,0 +1,77 @@
"use strict";
// NOTE: This script must be run _after_ build-data.js
const path = require("path");
const {
getLowestImplementedVersion,
environments,
addOperaAndElectron,
writeFile,
} = require("./utils-build-data");
const data = require("./data/plugin-bugfixes");
const pluginFeatures = require("./data/plugin-features");
const generatedTargets = {};
const overlappingPlugins = {};
const allReplacedFeatures = {};
const has = Function.call.bind(Object.hasOwnProperty);
for (const [plugin, { replaces, features }] of Object.entries(data)) {
if (!has(overlappingPlugins, replaces)) {
overlappingPlugins[replaces] = [];
generatedTargets[replaces] = {};
allReplacedFeatures[replaces] = [];
}
generatedTargets[plugin] = {};
allReplacedFeatures[replaces].push(...features);
overlappingPlugins[replaces].push(plugin);
for (const env of environments) {
const supportedWithBugfix = getLowestImplementedVersion({ features }, env);
if (supportedWithBugfix) {
generatedTargets[plugin][env] = supportedWithBugfix;
}
}
}
for (const [replaced, features] of Object.entries(allReplacedFeatures)) {
let replacedFeatures = pluginFeatures[replaced];
if (!Array.isArray(replacedFeatures)) {
replacedFeatures = replacedFeatures.features;
}
for (const env of environments) {
const stillNotSupported = getLowestImplementedVersion(
{ features: replacedFeatures },
env,
name => features.some(feat => name.includes(feat))
);
if (stillNotSupported) {
generatedTargets[replaced][env] = stillNotSupported;
}
}
}
for (const plugin of Object.values(generatedTargets)) {
addOperaAndElectron(plugin);
}
for (const [filename, data] of [
["plugin-bugfixes", generatedTargets],
["overlapping-plugins", overlappingPlugins],
]) {
const dataPath = path.join(__dirname, `../data/${filename}.json`);
if (!writeFile(data, dataPath, filename)) {
process.exitCode = 1;
break;
}
}

View File

@ -1,293 +1,8 @@
"use strict";
const fs = require("fs");
const path = require("path");
const semver = require("semver");
const flattenDeep = require("lodash/flattenDeep");
const mapValues = require("lodash/mapValues");
const pickBy = require("lodash/pickBy");
const { unreleasedLabels } = require("@babel/helper-compilation-targets");
const electronToChromiumVersions = require("electron-to-chromium").versions;
const electronToChromiumKeys = Object.keys(
electronToChromiumVersions
).reverse();
const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => {
all[electronToChromiumVersions[electron]] = +electron;
return all;
}, {});
const chromiumToElectronVersions = Object.keys(chromiumToElectronMap);
const findClosestElectronVersion = targetVersion => {
const chromiumVersionsLength = chromiumToElectronVersions.length;
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
if (targetVersion > maxChromium) return null;
const closestChrome = chromiumToElectronVersions.find(
version => targetVersion <= version
);
return chromiumToElectronMap[closestChrome];
};
const chromiumToElectron = chromium =>
chromiumToElectronMap[chromium] || findClosestElectronVersion(chromium);
const renameTests = (tests, getName, category) =>
tests.map(test =>
Object.assign({}, test, { name: getName(test.name), category })
);
// The following is adapted from compat-table:
// https://github.com/kangax/compat-table/blob/gh-pages/build.js
//
// It parses and interpolates data so environments that "equal" other
// environments (node4 and chrome45), as well as familial relationships (edge
// and ie11) can be handled properly.
const envs = require("../build/compat-table/environments");
const byTestSuite = suite => browser => {
return Array.isArray(browser.test_suites)
? browser.test_suites.indexOf(suite) > -1
: true;
};
const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce(
(result, source) => {
const data = require(`../build/compat-table/data-${source}`);
data.browsers = pickBy(envs, byTestSuite(source));
result.push(data);
return result;
},
[]
);
const interpolateAllResults = (rawBrowsers, tests) => {
const interpolateResults = res => {
let browser;
let prevBrowser;
let result;
let prevResult;
let prevBid;
for (const bid in rawBrowsers) {
// For browsers that are essentially equal to other browsers,
// copy over the results.
browser = rawBrowsers[bid];
if (browser.equals && res[bid] === undefined) {
result = res[browser.equals];
res[bid] =
browser.ignore_flagged && result === "flagged" ? false : result;
// For each browser, check if the previous browser has the same
// browser full name (e.g. Firefox) or family name (e.g. Chakra) as this one.
} else if (
prevBrowser &&
(prevBrowser.full.replace(/,.+$/, "") ===
browser.full.replace(/,.+$/, "") ||
(browser.family !== undefined &&
prevBrowser.family === browser.family))
) {
// For each test, check if the previous browser has a result
// that this browser lacks.
result = res[bid];
prevResult = res[prevBid];
if (prevResult !== undefined && result === undefined) {
res[bid] = prevResult;
}
}
prevBrowser = browser;
prevBid = bid;
}
};
// Now print the results.
tests.forEach(function(t) {
// Calculate the result totals for tests which consist solely of subtests.
if ("subtests" in t) {
t.subtests.forEach(function(e) {
interpolateResults(e.res);
});
} else {
interpolateResults(t.res);
}
});
};
compatSources.forEach(({ browsers, tests }) =>
interpolateAllResults(browsers, tests)
);
// End of compat-table code adaptation
const environments = [
"chrome",
"opera",
"edge",
"firefox",
"safari",
"node",
"ie",
"android",
"ios",
"phantom",
"samsung",
];
const compatibilityTests = flattenDeep(
compatSources.map(data =>
data.tests.map(test => {
return test.subtests
? [
test,
renameTests(
test.subtests,
name => test.name + " / " + name,
test.category
),
]
: test;
})
)
);
const getLowestImplementedVersion = ({ features }, env) => {
const tests = compatibilityTests
.filter(test => {
return (
features.indexOf(test.name) >= 0 ||
// for features === ["DataView"]
// it covers "DataView (Int8)" and "DataView (UInt8)"
(features.length === 1 && test.name.indexOf(features[0]) === 0)
);
})
.reduce((result, test) => {
if (!test.subtests) {
result.push({
name: test.name,
res: test.res,
});
} else {
test.subtests.forEach(subtest =>
result.push({
name: `${test.name}/${subtest.name}`,
res: subtest.res,
})
);
}
return result;
}, []);
const unreleasedLabelForEnv = unreleasedLabels[env];
const envTests = tests.map(({ res: test }, i) => {
const reportedVersions = Object.keys(test)
.filter(t => t.startsWith(env))
.map(t => {
const version = t.replace(/_/g, ".").replace(env, "");
return {
version,
semver: semver.coerce(version) || version,
// Babel assumes strict mode
implements: tests[i].res[t] === true || tests[i].res[t] === "strict",
};
})
// version must be label from the unreleasedLabels (like tp) or number.
.filter(
version =>
unreleasedLabelForEnv === version.version ||
!isNaN(parseFloat(version.version))
)
// Sort in desc order, with unreleasedLabelForEnv coming last.
.sort(({ semver: av }, { semver: bv }) => {
if (av === unreleasedLabelForEnv) return -1;
if (bv === unreleasedLabelForEnv) return 1;
if (semver.gt(av, bv)) return -1;
if (semver.gt(bv, av)) return 1;
return 0;
});
// Find the lowest version such that all higher versions implement it.
// Eg, given { chrome70: true, chrome60: false, chrome50: true }, the
// lowest version is chrome70, not chrome50.
let lowest = null;
for (const version of reportedVersions) {
if (!version.implements) {
break;
}
lowest = version;
}
return lowest;
});
const envFiltered = envTests.filter(t => t);
if (envTests.length > envFiltered.length || envTests.length === 0) {
// envTests.forEach((test, i) => {
// if (!test) {
// // print unsupported features
// if (env === 'node') {
// console.log(`ENV(${env}): ${tests[i].name}`);
// }
// }
// });
return null;
}
return envFiltered.reduce((a, b) => {
if (a.semver === unreleasedLabelForEnv) return a;
if (b.semver === unreleasedLabelForEnv) return b;
return semver.lt(a.semver, b.semver) ? b : a;
});
};
const generateData = (environments, features) => {
return mapValues(features, options => {
if (!options.features) {
options = {
features: [options],
};
}
const plugin = {};
environments.forEach(env => {
const version = getLowestImplementedVersion(options, env);
if (version !== null) {
const versionString = version.version;
// NOTE(bng): A number of environments in compat-table changed to
// include a trailing zero (node10 -> node10_0), so for now stripping
// it to be consistent
plugin[env] = versionString.endsWith(".0")
? versionString.slice(0, -2)
: versionString;
}
});
if (plugin.chrome) {
// add opera
if (plugin.chrome >= 28) {
plugin.opera = (plugin.chrome - 13).toString();
} else if (!plugin.opera) {
if (plugin.chrome <= 23) {
plugin.opera = "15";
} else if (plugin.chrome <= 27) {
plugin.opera = "16";
}
}
// add electron
const electronVersion = chromiumToElectron(plugin.chrome);
if (electronVersion) {
plugin.electron = electronVersion.toString();
}
}
return plugin;
});
};
const { generateData, environments, writeFile } = require("./utils-build-data");
for (const target of ["plugin", "corejs2-built-in"]) {
const newData = generateData(
@ -296,20 +11,8 @@ for (const target of ["plugin", "corejs2-built-in"]) {
);
const dataPath = path.join(__dirname, `../data/${target}s.json`);
const stringified = JSON.stringify(newData, null, 2) + "\n";
if (process.env.CHECK_COMPAT_DATA) {
const currentData = fs.readFileSync(dataPath, "utf8");
// Compare as JSON strings to also check keys ordering
if (currentData !== stringified) {
console.error(
"The newly generated plugin/built-in data does not match the current " +
"files. Re-run `make build-compat-data`."
);
if (!writeFile(newData, dataPath, target)) {
process.exitCode = 1;
break;
}
} else {
fs.writeFileSync(dataPath, stringified);
}
}

View File

@ -1,15 +0,0 @@
"use strict";
const fs = require("fs");
const overlappingPlugins = require("./data/overlapping-plugins");
fs.writeFileSync(
__dirname + "/../data/overlapping-plugins.json",
JSON.stringify(overlappingPlugins, replacer, 2)
);
function replacer(key, val) {
if (val instanceof Set) return Array.from(val);
if (val instanceof Map) return Object.fromEntries(val);
return val;
}

View File

@ -1,16 +0,0 @@
"use strict";
module.exports = new Map();
// async -> regenerator is better than async -> generator -> regenerator
ifIncluded("transform-regenerator")
// Temporarly disabled: https://github.com/babel/babel/issues/10678
// .isUnnecessary("transform-async-to-generator");
function ifIncluded(name) {
const set = new Set();
module.exports.set(name, set);
return {
isUnnecessary(name) { set.add(name); return this; },
};
}

View File

@ -0,0 +1,38 @@
/* eslint sort-keys: "error" */
module.exports = {
"bugfix/transform-async-arrows-in-class": {
features: ["async functions / async arrow functions in methods, classes"],
replaces: "transform-async-to-generator",
},
"bugfix/transform-edge-default-parameters": {
features: [
"destructuring, parameters / shorthand defaults, arrow function",
],
replaces: "transform-parameters",
},
"bugfix/transform-edge-function-name": {
features: ['function "name" property / variables (function)'],
replaces: "transform-function-name",
},
"bugfix/transform-safari-block-shadowing": {
features: [
"const / scope shadow resolution",
"const / scope shadow resolution (strict mode)",
"let / scope shadow resolution",
"let / scope shadow resolution (strict mode)",
],
replaces: "transform-block-scoping",
},
"bugfix/transform-safari-for-shadowing": {
features: [
"let / for-in loop binding shadowing parameter",
"let / for-in loop binding shadowing parameter (strict mode)",
],
replaces: "transform-block-scoping",
},
"bugfix/transform-tagged-template-caching": {
features: ["template literals / TemplateStrings permanent caching"],
replaces: "transform-template-literals",
},
};

View File

@ -0,0 +1,318 @@
"use strict";
const fs = require("fs");
const semver = require("semver");
const flattenDeep = require("lodash/flattenDeep");
const mapValues = require("lodash/mapValues");
const pickBy = require("lodash/pickBy");
const { unreleasedLabels } = require("@babel/helper-compilation-targets");
const electronToChromiumVersions = require("electron-to-chromium").versions;
const electronToChromiumKeys = Object.keys(
electronToChromiumVersions
).reverse();
const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => {
all[electronToChromiumVersions[electron]] = +electron;
return all;
}, {});
chromiumToElectronMap["0"] = "0";
const chromiumToElectronVersions = Object.keys(chromiumToElectronMap);
const findClosestElectronVersion = targetVersion => {
const chromiumVersionsLength = chromiumToElectronVersions.length;
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
if (targetVersion > maxChromium) return null;
const closestChrome = chromiumToElectronVersions.find(
version => targetVersion <= version
);
return chromiumToElectronMap[closestChrome];
};
exports.chromiumToElectron = chromium =>
chromiumToElectronMap[chromium] || findClosestElectronVersion(chromium);
const renameTests = (tests, getName, category) =>
tests.map(test =>
Object.assign({}, test, { name: getName(test.name), category })
);
// The following is adapted from compat-table:
// https://github.com/kangax/compat-table/blob/gh-pages/build.js
//
// It parses and interpolates data so environments that "equal" other
// environments (node4 and chrome45), as well as familial relationships (edge
// and ie11) can be handled properly.
const envs = require("../build/compat-table/environments");
const byTestSuite = suite => browser => {
return Array.isArray(browser.test_suites)
? browser.test_suites.indexOf(suite) > -1
: true;
};
const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce(
(result, source) => {
const data = require(`../build/compat-table/data-${source}`);
data.browsers = pickBy(envs, byTestSuite(source));
result.push(data);
return result;
},
[]
);
const interpolateAllResults = (rawBrowsers, tests) => {
const interpolateResults = res => {
let browser;
let prevBrowser;
let result;
let prevResult;
let prevBid;
for (const bid in rawBrowsers) {
// For browsers that are essentially equal to other browsers,
// copy over the results.
browser = rawBrowsers[bid];
if (browser.equals && res[bid] === undefined) {
result = res[browser.equals];
res[bid] =
browser.ignore_flagged && result === "flagged" ? false : result;
// For each browser, check if the previous browser has the same
// browser full name (e.g. Firefox) or family name (e.g. Chakra) as this one.
} else if (
prevBrowser &&
(prevBrowser.full.replace(/,.+$/, "") ===
browser.full.replace(/,.+$/, "") ||
(browser.family !== undefined &&
prevBrowser.family === browser.family))
) {
// For each test, check if the previous browser has a result
// that this browser lacks.
result = res[bid];
prevResult = res[prevBid];
if (prevResult !== undefined && result === undefined) {
res[bid] = prevResult;
}
}
prevBrowser = browser;
prevBid = bid;
}
};
// Now print the results.
tests.forEach(function(t) {
// Calculate the result totals for tests which consist solely of subtests.
if ("subtests" in t) {
t.subtests.forEach(function(e) {
interpolateResults(e.res);
});
} else {
interpolateResults(t.res);
}
});
};
compatSources.forEach(({ browsers, tests }) =>
interpolateAllResults(browsers, tests)
);
// End of compat-table code adaptation
exports.environments = [
"chrome",
"opera",
"edge",
"firefox",
"safari",
"node",
"ie",
"android",
"ios",
"phantom",
"samsung",
];
const compatibilityTests = flattenDeep(
compatSources.map(data =>
data.tests.map(test => {
return test.subtests
? [
test,
renameTests(
test.subtests,
name => test.name + " / " + name,
test.category
),
]
: test;
})
)
);
exports.getLowestImplementedVersion = (
{ features },
env,
exclude = () => false
) => {
const tests = compatibilityTests
.filter(test => {
return (
(features.indexOf(test.name) >= 0 ||
// for features === ["DataView"]
// it covers "DataView (Int8)" and "DataView (UInt8)"
(features.length === 1 && test.name.indexOf(features[0]) === 0)) &&
!exclude(test.name)
);
})
.reduce((result, test) => {
if (!test.subtests) {
result.push({
name: test.name,
res: test.res,
});
} else {
test.subtests.forEach(subtest => {
if (!exclude(`${test.name} / ${subtest.name}`)) {
result.push({
name: `${test.name} /${subtest.name}`,
res: subtest.res,
});
}
});
}
return result;
}, []);
const unreleasedLabelForEnv = unreleasedLabels[env];
const envTests = tests.map(({ res: test }, i) => {
const reportedVersions = Object.keys(test)
.filter(t => t.startsWith(env))
.map(t => {
const version = t.replace(/_/g, ".").replace(env, "");
return {
version,
semver: semver.coerce(version) || version,
// Babel assumes strict mode
implements: tests[i].res[t] === true || tests[i].res[t] === "strict",
};
})
// version must be label from the unreleasedLabels (like tp) or number.
.filter(
version =>
unreleasedLabelForEnv === version.version ||
!isNaN(parseFloat(version.version))
)
// Sort in desc order, with unreleasedLabelForEnv coming last.
.sort(({ semver: av }, { semver: bv }) => {
if (av === unreleasedLabelForEnv) return -1;
if (bv === unreleasedLabelForEnv) return 1;
if (semver.gt(av, bv)) return -1;
if (semver.gt(bv, av)) return 1;
return 0;
});
// Find the lowest version such that all higher versions implement it.
// Eg, given { chrome70: true, chrome60: false, chrome50: true }, the
// lowest version is chrome70, not chrome50.
let lowest = null;
for (const version of reportedVersions) {
if (!version.implements) {
break;
}
lowest = version;
}
return lowest;
});
const envFiltered = envTests.filter(t => t);
if (envTests.length > envFiltered.length || envTests.length === 0) {
// envTests.forEach((test, i) => {
// if (!test) {
// // print unsupported features
// if (env === 'node') {
// console.log(`ENV(${env}): ${tests[i].name}`);
// }
// }
// });
return null;
}
const result = envFiltered.reduce((a, b) => {
if (a.semver === unreleasedLabelForEnv) return a;
if (b.semver === unreleasedLabelForEnv) return b;
return semver.lt(a.semver, b.semver) ? b : a;
});
if (result.version.endsWith(".0")) {
// NOTE(bng): A number of environments in compat-table changed to
// include a trailing zero (node10 -> node10_0), so for now stripping
// it to be consistent
return result.version.slice(0, -2);
}
return result.version;
};
exports.addOperaAndElectron = plugin => {
if (plugin.chrome) {
// add opera
if (plugin.chrome >= 28) {
plugin.opera = (plugin.chrome - 13).toString();
} else if (!plugin.opera) {
if (plugin.chrome <= 23) {
plugin.opera = "15";
} else if (plugin.chrome <= 27) {
plugin.opera = "16";
}
}
// add electron
const electronVersion = exports.chromiumToElectron(plugin.chrome);
if (electronVersion) {
plugin.electron = electronVersion.toString();
}
}
};
exports.generateData = (environments, features) => {
return mapValues(features, options => {
if (!options.features) {
options = {
features: [options],
};
}
const plugin = {};
environments.forEach(env => {
const version = exports.getLowestImplementedVersion(options, env);
if (version) plugin[env] = version;
});
exports.addOperaAndElectron(plugin);
return plugin;
});
};
exports.writeFile = function(data, dataPath, name) {
const stringified = JSON.stringify(data, null, 2) + "\n";
if (process.env.CHECK_COMPAT_DATA) {
const currentData = fs.readFileSync(dataPath, "utf8");
// Compare as JSON strings to also check keys ordering
if (currentData !== stringified) {
console.error(
`The newly generated ${name} data does not match the current ` +
"files. Re-run `make build-compat-data`."
);
return false;
}
} else {
fs.writeFileSync(dataPath, stringified);
}
return true;
};

View File

@ -64,6 +64,7 @@
"@babel/plugin-transform-template-literals": "^7.8.3",
"@babel/plugin-transform-typeof-symbol": "^7.8.4",
"@babel/plugin-transform-unicode-regex": "^7.8.3",
"@babel/preset-modules": "^0.1.3",
"@babel/types": "^7.8.7",
"browserslist": "^4.8.5",
"core-js-compat": "^3.6.2",

View File

@ -51,7 +51,20 @@ import transformTemplateLiterals from "@babel/plugin-transform-template-literals
import transformTypeofSymbol from "@babel/plugin-transform-typeof-symbol";
import transformUnicodeRegex from "@babel/plugin-transform-unicode-regex";
import bugfixAsyncArrowsInClass from "@babel/preset-modules/lib/plugins/transform-async-arrows-in-class";
import bugfixEdgeDefaultParameters from "@babel/preset-modules/lib/plugins/transform-edge-default-parameters";
import bugfixEdgeFunctionName from "@babel/preset-modules/lib/plugins/transform-edge-function-name";
import bugfixTaggedTemplateCaching from "@babel/preset-modules/lib/plugins/transform-tagged-template-caching";
import bugfixSafariBlockShadowing from "@babel/preset-modules/lib/plugins/transform-safari-block-shadowing";
import bugfixSafariForShadowing from "@babel/preset-modules/lib/plugins/transform-safari-for-shadowing";
export default {
"bugfix/transform-async-arrows-in-class": bugfixAsyncArrowsInClass,
"bugfix/transform-edge-default-parameters": bugfixEdgeDefaultParameters,
"bugfix/transform-edge-function-name": bugfixEdgeFunctionName,
"bugfix/transform-safari-block-shadowing": bugfixSafariBlockShadowing,
"bugfix/transform-safari-for-shadowing": bugfixSafariForShadowing,
"bugfix/transform-tagged-template-caching": bugfixTaggedTemplateCaching,
"proposal-async-generator-functions": proposalAsyncGeneratorFunctions,
"proposal-dynamic-import": proposalDynamicImport,
"proposal-json-strings": proposalJsonStrings,

View File

@ -6,8 +6,11 @@ import getOptionSpecificExcludesFor from "./get-option-specific-excludes";
import { removeUnnecessaryItems } from "./filter-items";
import moduleTransformations from "./module-transformations";
import normalizeOptions from "./normalize-options";
import pluginList from "./plugins-compat-data";
import { proposalPlugins, pluginSyntaxMap } from "../data/shipped-proposals";
import {
plugins as pluginsList,
pluginsBugfixes as pluginsBugfixesList,
} from "./plugins-compat-data";
import overlappingPlugins from "@babel/compat-data/overlapping-plugins";
import addCoreJS2UsagePlugin from "./polyfills/corejs2/usage-plugin";
@ -37,10 +40,29 @@ export function isPluginRequired(targets: Targets, support: Targets) {
});
}
const pluginListWithoutProposals = filterStageFromList(
pluginList,
const pluginLists = {
withProposals: {
withoutBugfixes: pluginsList,
withBugfixes: Object.assign({}, pluginsList, pluginsBugfixesList),
},
withoutProposals: {
withoutBugfixes: filterStageFromList(pluginsList, proposalPlugins),
withBugfixes: filterStageFromList(
Object.assign({}, pluginsList, pluginsBugfixesList),
proposalPlugins,
);
),
},
};
function getPluginList(proposals: boolean, bugfixes: boolean) {
if (proposals) {
if (bugfixes) return pluginLists.withProposals.withBugfixes;
else return pluginLists.withProposals.withoutBugfixes;
} else {
if (bugfixes) return pluginLists.withoutProposals.withBugfixes;
else return pluginLists.withoutProposals.withoutBugfixes;
}
}
const getPlugin = (pluginName: string) => {
const plugin = availablePlugins[pluginName];
@ -191,6 +213,7 @@ export default declare((api, opts) => {
api.assertVersion(7);
const {
bugfixes,
configPath,
debug,
exclude: optionsExclude,
@ -251,7 +274,7 @@ export default declare((api, opts) => {
});
const pluginNames = filterItems(
shippedProposals ? pluginList : pluginListWithoutProposals,
getPluginList(shippedProposals, bugfixes),
include.plugins,
exclude.plugins,
transformTargets,
@ -288,7 +311,7 @@ export default declare((api, opts) => {
console.log(`\nUsing modules transform: ${modules.toString()}`);
console.log("\nUsing plugins:");
pluginNames.forEach(pluginName => {
logPluginOrPolyfill(pluginName, targets, pluginList);
logPluginOrPolyfill(pluginName, targets, pluginsList);
});
if (!useBuiltIns) {

View File

@ -4,7 +4,7 @@ import findSuggestion from "levenary";
import invariant from "invariant";
import { coerce, SemVer } from "semver";
import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins";
import pluginsList from "./plugins-compat-data";
import { plugins as pluginsList } from "./plugins-compat-data";
import moduleTransformations from "./module-transformations";
import { TopLevelOptions, ModulesOption, UseBuiltInsOption } from "./options";
import { defaultWebIncludes } from "./polyfills/corejs2/get-platform-specific-default";
@ -274,6 +274,11 @@ export default function normalizeOptions(opts: Options) {
);
return {
bugfixes: validateBoolOption(
TopLevelOptions.bugfixes,
opts.bugfixes,
false,
),
configPath: validateConfigPathOption(opts.configPath),
corejs,
debug: validateBoolOption(TopLevelOptions.debug, opts.debug, false),

View File

@ -1,6 +1,7 @@
// @flow
export const TopLevelOptions = {
bugfixes: "bugfixes",
configPath: "configPath",
corejs: "corejs",
debug: "debug",

View File

@ -1,13 +1,22 @@
// @flow
import plugins from "@babel/compat-data/plugins";
import bugfixPlugins from "@babel/compat-data/plugin-bugfixes";
import availablePlugins from "./available-plugins";
const filtered = {};
const pluginsFiltered = {};
const bugfixPluginsFiltered = {};
for (const plugin of Object.keys(plugins)) {
if (Object.hasOwnProperty.call(availablePlugins, plugin)) {
filtered[plugin] = plugins[plugin];
pluginsFiltered[plugin] = plugins[plugin];
}
}
export { filtered as default };
for (const plugin of Object.keys(bugfixPlugins)) {
if (Object.hasOwnProperty.call(availablePlugins, plugin)) {
bugfixPluginsFiltered[plugin] = bugfixPlugins[plugin];
}
}
export { pluginsFiltered as plugins, bugfixPluginsFiltered as pluginsBugfixes };

View File

@ -20,6 +20,7 @@ export type PluginListItem = string | RegExp;
export type PluginListOption = Array<PluginListItem>;
export type Options = {
bugfixes: boolean,
configPath: string,
corejs: CorejsOption,
debug: boolean,

View File

@ -0,0 +1,8 @@
// Edge
({ x = 2 }) => {};
// Safari
{
let x;
{ let x; }
}

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": false,
"targets": {
"esmodules": true
}
}]
]
}

View File

@ -0,0 +1,14 @@
// Edge
(_ref) => {
var {
x = 2
} = _ref;
}; // Safari
{
var x;
{
var _x;
}
}

View File

@ -0,0 +1,36 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"android": "61",
"chrome": "61",
"edge": "16",
"firefox": "60",
"ios": "10.3",
"opera": "48",
"safari": "10.1",
"samsung": "8.2"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-optional-chaining { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-json-strings { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-optional-catch-binding { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-async-generator-functions { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" }
transform-dotall-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-unicode-property-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
transform-named-capturing-groups-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
transform-async-to-generator { "ios":"10.3", "safari":"10.1" }
transform-template-literals { "ios":"10.3", "safari":"10.1" }
transform-function-name { "edge":"16" }
transform-unicode-regex { "ios":"10.3", "safari":"10.1" }
transform-parameters { "edge":"16" }
transform-block-scoping { "ios":"10.3", "safari":"10.1" }
transform-modules-commonjs { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-dynamic-import { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,8 @@
// Edge
({ x = 2 }) => {};
// Safari
{
let x;
{ let x; }
}

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"esmodules": true
}
}]
]
}

View File

@ -0,0 +1,12 @@
// Edge
({
x: _x = 2
}) => {}; // Safari
{
let x;
{
let _x2;
}
}

View File

@ -0,0 +1,37 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"android": "61",
"chrome": "61",
"edge": "16",
"firefox": "60",
"ios": "10.3",
"opera": "48",
"safari": "10.1",
"samsung": "8.2"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-optional-chaining { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-json-strings { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-optional-catch-binding { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-async-generator-functions { "android":"61", "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" }
transform-dotall-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-unicode-property-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
transform-named-capturing-groups-regex { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
transform-unicode-regex { "ios":"10.3", "safari":"10.1" }
bugfix/transform-async-arrows-in-class { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
bugfix/transform-edge-default-parameters { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
bugfix/transform-edge-function-name { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
bugfix/transform-safari-block-shadowing { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
bugfix/transform-safari-for-shadowing { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
bugfix/transform-tagged-template-caching { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
transform-modules-commonjs { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
proposal-dynamic-import { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,13 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"chrome": "40"
},
"exclude": ["transform-destructuring", "transform-arrow-functions"]
}]
]
}

View File

@ -0,0 +1,5 @@
(_ref) => {
var {
x = 2
} = _ref;
};

View File

@ -0,0 +1,42 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "40"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "chrome":"40" }
proposal-optional-chaining { "chrome":"40" }
proposal-json-strings { "chrome":"40" }
proposal-optional-catch-binding { "chrome":"40" }
proposal-async-generator-functions { "chrome":"40" }
proposal-object-rest-spread { "chrome":"40" }
transform-dotall-regex { "chrome":"40" }
proposal-unicode-property-regex { "chrome":"40" }
transform-named-capturing-groups-regex { "chrome":"40" }
transform-async-to-generator { "chrome":"40" }
transform-exponentiation-operator { "chrome":"40" }
transform-template-literals { "chrome":"40" }
transform-literals { "chrome":"40" }
transform-function-name { "chrome":"40" }
transform-block-scoped-functions { "chrome":"40" }
transform-classes { "chrome":"40" }
transform-object-super { "chrome":"40" }
transform-shorthand-properties { "chrome":"40" }
transform-duplicate-keys { "chrome":"40" }
transform-computed-properties { "chrome":"40" }
transform-for-of { "chrome":"40" }
transform-sticky-regex { "chrome":"40" }
transform-unicode-regex { "chrome":"40" }
transform-spread { "chrome":"40" }
transform-parameters { "chrome":"40" }
transform-block-scoping { "chrome":"40" }
transform-new-target { "chrome":"40" }
transform-regenerator { "chrome":"40" }
transform-modules-commonjs { "chrome":"40" }
proposal-dynamic-import { "chrome":"40" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"chrome": "70"
}
}]
]
}

View File

@ -0,0 +1,3 @@
({
x = 2
}) => {};

View File

@ -0,0 +1,20 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "70"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "chrome":"70" }
proposal-optional-chaining { "chrome":"70" }
syntax-json-strings { "chrome":"70" }
syntax-optional-catch-binding { "chrome":"70" }
syntax-async-generators { "chrome":"70" }
syntax-object-rest-spread { "chrome":"70" }
transform-modules-commonjs { "chrome":"70" }
proposal-dynamic-import { "chrome":"70" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"edge": "14"
}
}]
]
}

View File

@ -0,0 +1,4 @@
(_ref) => {
let _ref$x = _ref.x,
x = _ref$x === void 0 ? 2 : _ref$x;
};

View File

@ -0,0 +1,28 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "14"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"14" }
proposal-optional-chaining { "edge":"14" }
proposal-json-strings { "edge":"14" }
proposal-optional-catch-binding { "edge":"14" }
proposal-async-generator-functions { "edge":"14" }
proposal-object-rest-spread { "edge":"14" }
transform-dotall-regex { "edge":"14" }
proposal-unicode-property-regex { "edge":"14" }
transform-named-capturing-groups-regex { "edge":"14" }
transform-async-to-generator { "edge":"14" }
transform-for-of { "edge":"14" }
transform-parameters { "edge":"14" }
transform-destructuring { "edge":"14" }
bugfix/transform-edge-function-name { "edge":"14" }
transform-modules-commonjs { "edge":"14" }
proposal-dynamic-import { "edge":"14" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,13 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"edge": "15"
},
"exclude": ["transform-destructuring", "transform-arrow-functions"]
}]
]
}

View File

@ -0,0 +1,3 @@
({
x: _x = 2
}) => {};

View File

@ -0,0 +1,25 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "15"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"15" }
proposal-optional-chaining { "edge":"15" }
proposal-json-strings { "edge":"15" }
proposal-optional-catch-binding { "edge":"15" }
proposal-async-generator-functions { "edge":"15" }
proposal-object-rest-spread { "edge":"15" }
transform-dotall-regex { "edge":"15" }
proposal-unicode-property-regex { "edge":"15" }
transform-named-capturing-groups-regex { "edge":"15" }
bugfix/transform-edge-default-parameters { "edge":"15" }
bugfix/transform-edge-function-name { "edge":"15" }
transform-modules-commonjs { "edge":"15" }
proposal-dynamic-import { "edge":"15" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": false,
"targets": {
"edge": "17"
}
}]
]
}

View File

@ -0,0 +1,5 @@
(_ref) => {
let {
x = 2
} = _ref;
};

View File

@ -0,0 +1,25 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "17"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"17" }
proposal-optional-chaining { "edge":"17" }
proposal-json-strings { "edge":"17" }
proposal-optional-catch-binding { "edge":"17" }
proposal-async-generator-functions { "edge":"17" }
proposal-object-rest-spread { "edge":"17" }
transform-dotall-regex { "edge":"17" }
proposal-unicode-property-regex { "edge":"17" }
transform-named-capturing-groups-regex { "edge":"17" }
transform-function-name { "edge":"17" }
transform-parameters { "edge":"17" }
transform-modules-commonjs { "edge":"17" }
proposal-dynamic-import { "edge":"17" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"edge": "17"
}
}]
]
}

View File

@ -0,0 +1,3 @@
({
x: _x = 2
}) => {};

View File

@ -0,0 +1,25 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "17"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"17" }
proposal-optional-chaining { "edge":"17" }
proposal-json-strings { "edge":"17" }
proposal-optional-catch-binding { "edge":"17" }
proposal-async-generator-functions { "edge":"17" }
proposal-object-rest-spread { "edge":"17" }
transform-dotall-regex { "edge":"17" }
proposal-unicode-property-regex { "edge":"17" }
transform-named-capturing-groups-regex { "edge":"17" }
bugfix/transform-edge-default-parameters { "edge":"17" }
bugfix/transform-edge-function-name { "edge":"17" }
transform-modules-commonjs { "edge":"17" }
proposal-dynamic-import { "edge":"17" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1 @@
({ x = 2 }) => {};

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"edge": "18"
}
}]
]
}

View File

@ -0,0 +1,3 @@
({
x = 2
}) => {};

View File

@ -0,0 +1,24 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "18"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"18" }
proposal-optional-chaining { "edge":"18" }
proposal-json-strings { "edge":"18" }
proposal-optional-catch-binding { "edge":"18" }
proposal-async-generator-functions { "edge":"18" }
proposal-object-rest-spread { "edge":"18" }
transform-dotall-regex { "edge":"18" }
proposal-unicode-property-regex { "edge":"18" }
transform-named-capturing-groups-regex { "edge":"18" }
bugfix/transform-edge-function-name { "edge":"18" }
transform-modules-commonjs { "edge":"18" }
proposal-dynamic-import { "edge":"18" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,2 @@
var a = function() {};
({ obj: function() {} });

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": false,
"targets": {
"edge": "14"
}
}]
]
}

View File

@ -0,0 +1,5 @@
var a = function a() {};
({
obj: function obj() {}
});

View File

@ -0,0 +1,28 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "14"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"14" }
proposal-optional-chaining { "edge":"14" }
proposal-json-strings { "edge":"14" }
proposal-optional-catch-binding { "edge":"14" }
proposal-async-generator-functions { "edge":"14" }
proposal-object-rest-spread { "edge":"14" }
transform-dotall-regex { "edge":"14" }
proposal-unicode-property-regex { "edge":"14" }
transform-named-capturing-groups-regex { "edge":"14" }
transform-async-to-generator { "edge":"14" }
transform-function-name { "edge":"14" }
transform-for-of { "edge":"14" }
transform-parameters { "edge":"14" }
transform-destructuring { "edge":"14" }
transform-modules-commonjs { "edge":"14" }
proposal-dynamic-import { "edge":"14" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,2 @@
var a = function() {};
({ obj: function() {} });

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"edge": "14"
}
}]
]
}

View File

@ -0,0 +1,5 @@
var a = function a() {};
({
obj: function () {}
});

View File

@ -0,0 +1,28 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "14"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"14" }
proposal-optional-chaining { "edge":"14" }
proposal-json-strings { "edge":"14" }
proposal-optional-catch-binding { "edge":"14" }
proposal-async-generator-functions { "edge":"14" }
proposal-object-rest-spread { "edge":"14" }
transform-dotall-regex { "edge":"14" }
proposal-unicode-property-regex { "edge":"14" }
transform-named-capturing-groups-regex { "edge":"14" }
transform-async-to-generator { "edge":"14" }
transform-for-of { "edge":"14" }
transform-parameters { "edge":"14" }
transform-destructuring { "edge":"14" }
bugfix/transform-edge-function-name { "edge":"14" }
transform-modules-commonjs { "edge":"14" }
proposal-dynamic-import { "edge":"14" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,2 @@
var a = function() {};
({ obj: function() {} });

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"edge": "15"
}
}]
]
}

View File

@ -0,0 +1,5 @@
var a = function a() {};
({
obj: function () {}
});

View File

@ -0,0 +1,25 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"edge": "15"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "edge":"15" }
proposal-optional-chaining { "edge":"15" }
proposal-json-strings { "edge":"15" }
proposal-optional-catch-binding { "edge":"15" }
proposal-async-generator-functions { "edge":"15" }
proposal-object-rest-spread { "edge":"15" }
transform-dotall-regex { "edge":"15" }
proposal-unicode-property-regex { "edge":"15" }
transform-named-capturing-groups-regex { "edge":"15" }
bugfix/transform-edge-default-parameters { "edge":"15" }
bugfix/transform-edge-function-name { "edge":"15" }
transform-modules-commonjs { "edge":"15" }
proposal-dynamic-import { "edge":"15" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,8 @@
e => {
for (let e of []);
};
{
let a;
{ let a; }
}

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": false,
"targets": {
"safari": "10"
}
}]
]
}

View File

@ -0,0 +1,12 @@
e => {
for (var _e of []) {
;
}
};
{
var a;
{
var _a;
}
}

View File

@ -0,0 +1,28 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"safari": "10"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "safari":"10" }
proposal-optional-chaining { "safari":"10" }
proposal-json-strings { "safari":"10" }
proposal-optional-catch-binding { "safari":"10" }
proposal-async-generator-functions { "safari":"10" }
proposal-object-rest-spread { "safari":"10" }
transform-dotall-regex { "safari":"10" }
proposal-unicode-property-regex { "safari":"10" }
transform-named-capturing-groups-regex { "safari":"10" }
transform-async-to-generator { "safari":"10" }
transform-exponentiation-operator { "safari":"10" }
transform-template-literals { "safari":"10" }
transform-unicode-regex { "safari":"10" }
transform-block-scoping { "safari":"10" }
transform-modules-commonjs { "safari":"10" }
proposal-dynamic-import { "safari":"10" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,8 @@
e => {
for (let e of []);
};
{
let a;
{ let a; }
}

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"safari": "10"
}
}]
]
}

View File

@ -0,0 +1,10 @@
e => {
for (let _e of []);
};
{
let a;
{
let _a;
}
}

View File

@ -0,0 +1,29 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"safari": "10"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "safari":"10" }
proposal-optional-chaining { "safari":"10" }
proposal-json-strings { "safari":"10" }
proposal-optional-catch-binding { "safari":"10" }
proposal-async-generator-functions { "safari":"10" }
proposal-object-rest-spread { "safari":"10" }
transform-dotall-regex { "safari":"10" }
proposal-unicode-property-regex { "safari":"10" }
transform-named-capturing-groups-regex { "safari":"10" }
transform-async-to-generator { "safari":"10" }
transform-exponentiation-operator { "safari":"10" }
transform-unicode-regex { "safari":"10" }
bugfix/transform-safari-block-shadowing { "safari":"10" }
bugfix/transform-safari-for-shadowing { "safari":"10" }
bugfix/transform-tagged-template-caching { "safari":"10" }
transform-modules-commonjs { "safari":"10" }
proposal-dynamic-import { "safari":"10" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,8 @@
e => {
for (let e of []);
};
{
let a;
{ let a; }
}

View File

@ -0,0 +1,12 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"safari": "11"
}
}]
]
}

View File

@ -0,0 +1,10 @@
e => {
for (let e of []);
};
{
let a;
{
let a;
}
}

View File

@ -0,0 +1,25 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"safari": "11"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "safari":"11" }
proposal-optional-chaining { "safari":"11" }
proposal-json-strings { "safari":"11" }
proposal-optional-catch-binding { "safari":"11" }
proposal-async-generator-functions { "safari":"11" }
proposal-object-rest-spread { "safari":"11" }
transform-dotall-regex { "safari":"11" }
proposal-unicode-property-regex { "safari":"11" }
transform-named-capturing-groups-regex { "safari":"11" }
transform-unicode-regex { "safari":"11" }
bugfix/transform-tagged-template-caching { "safari":"11" }
transform-modules-commonjs { "safari":"11" }
proposal-dynamic-import { "safari":"11" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.

View File

@ -0,0 +1,8 @@
e => {
for (let e of []);
};
{
let a;
{ let a; }
}

View File

@ -0,0 +1,13 @@
{
"validateLogs": true,
"presets": [
["env", {
"debug": true,
"bugfixes": true,
"targets": {
"safari": "9"
},
"exclude": ["transform-for-of", "transform-arrow-functions"]
}]
]
}

View File

@ -0,0 +1,12 @@
e => {
for (var _e of []) {
;
}
};
{
var a;
{
var _a;
}
}

View File

@ -0,0 +1,38 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"safari": "9"
}
Using modules transform: auto
Using plugins:
proposal-nullish-coalescing-operator { "safari":"9" }
proposal-optional-chaining { "safari":"9" }
proposal-json-strings { "safari":"9" }
proposal-optional-catch-binding { "safari":"9" }
proposal-async-generator-functions { "safari":"9" }
proposal-object-rest-spread { "safari":"9" }
transform-dotall-regex { "safari":"9" }
proposal-unicode-property-regex { "safari":"9" }
transform-named-capturing-groups-regex { "safari":"9" }
transform-async-to-generator { "safari":"9" }
transform-exponentiation-operator { "safari":"9" }
transform-function-name { "safari":"9" }
transform-block-scoped-functions { "safari":"9" }
transform-classes { "safari":"9" }
transform-object-super { "safari":"9" }
transform-sticky-regex { "safari":"9" }
transform-unicode-regex { "safari":"9" }
transform-spread { "safari":"9" }
transform-parameters { "safari":"9" }
transform-destructuring { "safari":"9" }
transform-block-scoping { "safari":"9" }
transform-new-target { "safari":"9" }
transform-regenerator { "safari":"9" }
bugfix/transform-tagged-template-caching { "safari":"9" }
transform-modules-commonjs { "safari":"9" }
proposal-dynamic-import { "safari":"9" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.