Skip to content

Commit

Permalink
Undo breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Nov 4, 2018
1 parent 2a3e65a commit d80b02a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Expand Up @@ -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})`;
Expand Down
7 changes: 6 additions & 1 deletion packages/babel-plugin-syntax-typescript/src/index.js
Expand Up @@ -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");
Expand Down

0 comments on commit d80b02a

Please sign in to comment.