Upgrade react-docgen to use new babylon parser
Reviewed By: mkonicek Differential Revision: D4855504 fbshipit-source-id: 30c2d956242be5e8f01eb4ebc7e7afd77a72cd36
This commit is contained in:
parent
b7d873b1a0
commit
7da07fa9f3
|
@ -24,7 +24,7 @@
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"optimist": "0.6.0",
|
"optimist": "0.6.0",
|
||||||
"react": "~0.13.0",
|
"react": "~0.13.0",
|
||||||
"react-docgen": "^2.9.0",
|
"react-docgen": "3.0.0-beta2",
|
||||||
"react-page-middleware": "0.4.1",
|
"react-page-middleware": "0.4.1",
|
||||||
"remove-markdown": "^0.1.0",
|
"remove-markdown": "^0.1.0",
|
||||||
"request": "^2.69.0",
|
"request": "^2.69.0",
|
||||||
|
|
|
@ -286,6 +286,15 @@ function getViewPropTypes() {
|
||||||
// The alternative would be to duplicate more of the parsing logic here.
|
// The alternative would be to duplicate more of the parsing logic here.
|
||||||
function viewPropTypesConversionHandler(documentation, astPath) {
|
function viewPropTypesConversionHandler(documentation, astPath) {
|
||||||
const builders = recast.types.builders;
|
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(
|
const FauxView = builders.classDeclaration(
|
||||||
builders.identifier('View'),
|
builders.identifier('View'),
|
||||||
builders.classBody(
|
builders.classBody(
|
||||||
|
|
Loading…
Reference in New Issue