Upgrade react-docgen to use new babylon parser

Reviewed By: mkonicek

Differential Revision: D4855504

fbshipit-source-id: 30c2d956242be5e8f01eb4ebc7e7afd77a72cd36
This commit is contained in:
Eric Vicenti 2017-04-11 12:25:33 -07:00 committed by Facebook Github Bot
parent b7d873b1a0
commit 7da07fa9f3
2 changed files with 10 additions and 1 deletions

View File

@ -24,7 +24,7 @@
"mkdirp": "^0.5.1",
"optimist": "0.6.0",
"react": "~0.13.0",
"react-docgen": "^2.9.0",
"react-docgen": "3.0.0-beta2",
"react-page-middleware": "0.4.1",
"remove-markdown": "^0.1.0",
"request": "^2.69.0",

View File

@ -286,6 +286,15 @@ function getViewPropTypes() {
// The alternative would be to duplicate more of the parsing logic here.
function viewPropTypesConversionHandler(documentation, astPath) {
const builders = recast.types.builders;
// This is broken because babylon@7 and estree introduced SpreadElement, and ast-types has not been updated to support it
// (we are broken by react-docgen broken by recast broken by ast-types)
astPath.get('properties').value.forEach(n => {
if (n.type === 'SpreadElement') {
n.type = 'SpreadProperty';
}
});
const FauxView = builders.classDeclaration(
builders.identifier('View'),
builders.classBody(