react-docgen
react-docgen copied to clipboard
feature request. Allow to analyze reexported components
AnyComponent.jsx
import * as React from 'react';
export default class AnyComponent extends React.Component {
anyMethod(){
//..
}
render(){
return (<div></div>)
}
}
Test.jsx
export {AnyComponent} from './AnyComponent';
react-docgen Test.jsx
throws exception "No suitable component definition found"
But should analysis content of AnyComponent.jsx.
What do you think about it?
react-docgen doesn't implement any dependency resolution, so it doesn't know how to load ./AnyComponent
or even what it is.
The problem is that we have a different module system at Facebook, so a solution to this problem would require a way to specify how modules are resolved (maybe parts of jest can be reused). I don't think I have time to look into this, but if somebody else wants to, I'm happy to help.
@fkling I wouldn't mind investigating this. Do you have any pointers/examples that could help me to kickstart this
@fkling can https://www.npmjs.com/package/babel-plugin-preval/ help with that?
@fkling solution here https://github.com/alfa-laboratory/library-utils/blob/master/react-doc/create-resolver.js
to use it:
1) npm i library-utils
// import
2) const reactDoc = require('library-utils/react-doc');
// pass file path
console.log(reactDoc(filePath));