Compile classes when spread is unsupported (#13075)

This commit is contained in:
Nicolò Ribaudo
2021-03-31 16:42:52 +02:00
committed by GitHub
parent 3e174e9cbd
commit d563773723
6 changed files with 40 additions and 5 deletions

View File

@@ -72,7 +72,14 @@ const es2015 = {
],
},
"transform-spread": {
features: ["spread syntax for iterable objects"],
features: [
"spread syntax for iterable objects",
// We need to compile classes when spread is not supported, because
// we cannot compile super(...args) without also rewriting the
// "super" handling. There is a bugfix that makes it better.
"class",
"super",
],
},
"transform-destructuring": {
features: ["destructuring, assignment", "destructuring, declarations"],

View File

@@ -88,7 +88,10 @@ exports.getLowestImplementedVersion = (
};
exports.generateData = (environments, features) => {
return Object.values(features).map(options => {
const data = {};
// eslint-disable-next-line prefer-const
for (let [key, options] of Object.entries(features)) {
if (!options.features) {
options = {
features: [options],
@@ -103,8 +106,10 @@ exports.generateData = (environments, features) => {
});
addElectronSupportFromChromium(plugin);
return plugin;
});
data[key] = plugin;
}
return data;
};
exports.writeFile = function (data, dataPath, name) {