Releases: reactjs/react-docgen
v2.6.1
v2.6.0
New: --resolver
CLI option
The --resolver
lets you specify from the CLI which resolver* to use. It can either be the name of a built-in resolver or a path to a JavaScript module that exports a resolver function:
react-docgen --resolver findExportedComponentDefinition ./path/to/component.js
# same as
react-docgen ./path/to/component.js
react-docgen --resolver findAllComponentDefinitions ./path/to/component.js
react-docgen --resolver ./path/to/custom/resolver.js ./path/to/component.js
* Resolvers contain the logic to find React component definitions in the JavaScript files.
v2.5.0
New
- Better support for React Native ( #44 )
Fixes
-
Variables used for
propTypes
anddefaultProps
, e.g.MyClass.defaultProps = defaultProps;
are now properly resolved for
class
and stateless components. Thanks to @oliviertassinari for reporting this issue! ( #45, #46 )
v2.4.0
New
Support for stateless/funtional components (React v0.14)
Since React v0.14, components can be defined as simple functions:
function SimpleComponent(props) {
return <div>{this.props.soSimple}</div>
}
Thanks to @iamdustan, react-docgen
is now able to detect these components as well. The findExportedComponentDefinition
and findAllComponentDefinitions
have been updated accordingly.
A function is considered to be a stateless React component if we can determine that it returns a JSX element or the result of a React.createElement
call. As always, there are limits to what can be achieved with static analysis, so it might not detect every possible case (but maybe your component is too complex then anways? ;) ).
v2.3.1
Fixes
The propTypeCompositionHandler
was not part of the default handlers and therefore the generated documentation didn't contain information about composition.
v2.3.0
Improved
- Now parses code that uses do expressions or function bindings (#32).
v2.2.0
(I wasn't sure whether this should be considered to be a bug fix or new feature, but I went with new feature instead)
New
v2.1.1
v2.1.0
New
-
"Short" docblocks are now recognized (#20, d3a3f3f):
/** Short docblock */
-
Docblocks on shape fields are now added to the output (#21, f5415ce):
React.PropTypes.shape({ /** * Field description */ field: React.PropTypes.string });
produces
{ name: 'shape', value: { field: { name: 'string', description: 'Field description', } }