From 7da07fa9f3a763e8abd9b26bd24df48560b77734 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Tue, 11 Apr 2017 12:25:33 -0700 Subject: [PATCH] Upgrade react-docgen to use new babylon parser Reviewed By: mkonicek Differential Revision: D4855504 fbshipit-source-id: 30c2d956242be5e8f01eb4ebc7e7afd77a72cd36 --- website/package.json | 2 +- website/server/extractDocs.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/website/package.json b/website/package.json index 840186050..afab3d1bc 100644 --- a/website/package.json +++ b/website/package.json @@ -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", diff --git a/website/server/extractDocs.js b/website/server/extractDocs.js index 0dcce20e3..a6f0258b5 100644 --- a/website/server/extractDocs.js +++ b/website/server/extractDocs.js @@ -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(