From d80b02a4dd773e3fd59f440df28085dae13d2c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 31 Aug 2018 16:25:15 +0200 Subject: [PATCH] Undo breaking change --- .../util/missing-plugin-helper.js | 35 +++++++++++++++++++ .../src/index.js | 7 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/packages/babel-core/src/transformation/util/missing-plugin-helper.js b/packages/babel-core/src/transformation/util/missing-plugin-helper.js index 679427bde996..0024a77efc6d 100644 --- a/packages/babel-core/src/transformation/util/missing-plugin-helper.js +++ b/packages/babel-core/src/transformation/util/missing-plugin-helper.js @@ -173,6 +173,41 @@ const pluginNameMap = { url: "https://git.io/vb4Sm", }, }, + + // TODO: This plugins are now supported by default by @babel/parser: they can + // be removed from this list. Althought emoving them isn't a breaking change, + // its better to keep the nice error message for users using old versions of + // the parser. They can be removed in Babel 8. + asyncGenerators: { + syntax: { + name: "@babel/plugin-syntax-async-generators", + url: "https://git.io/vb4SY", + }, + transform: { + name: "@babel/plugin-proposal-async-generator-functions", + url: "https://git.io/vb4yp", + }, + }, + objectRestSpread: { + syntax: { + name: "@babel/plugin-syntax-object-rest-spread", + url: "https://git.io/vb4y5", + }, + transform: { + name: "@babel/plugin-proposal-object-rest-spread", + url: "https://git.io/vb4Ss", + }, + }, + optionalCatchBinding: { + syntax: { + name: "@babel/plugin-syntax-optional-catch-binding", + url: "https://git.io/vb4Sn", + }, + transform: { + name: "@babel/plugin-proposal-optional-catch-binding", + url: "https://git.io/vb4SI", + }, + }, }; const getNameURLCombination = ({ name, url }) => `${name} (${url})`; diff --git a/packages/babel-plugin-syntax-typescript/src/index.js b/packages/babel-plugin-syntax-typescript/src/index.js index 24df037d07eb..3986ca4aafd5 100644 --- a/packages/babel-plugin-syntax-typescript/src/index.js +++ b/packages/babel-plugin-syntax-typescript/src/index.js @@ -29,7 +29,12 @@ export default declare((api, { isTSX }) => { // in TS depends on the extensions, and is purely dependent on 'isTSX'. removePlugin(plugins, "jsx"); - parserOpts.plugins.push("typescript", "classProperties"); + parserOpts.plugins.push( + "typescript", + "classProperties", + // TODO: This is enabled by default now, remove in Babel 8 + "objectRestSpread", + ); if (isTSX) { parserOpts.plugins.push("jsx");