Skip to content

Releases: reactjs/react-docgen

v3.0.0-beta2

17 Mar 17:36
Compare
Choose a tag to compare
v3.0.0-beta2 Pre-release
Pre-release

Upgrade babylon to v7.0-beta.4 ( #165 )


You can install this release via

npm install react-docgen@next
# or
yarn add react-docgen@next

v3.0.0-beta1

17 Mar 17:29
Compare
Choose a tag to compare
v3.0.0-beta1 Pre-release
Pre-release

While this a new major version, there shouldn't be any breaking changes. We switched to babylon v7(beta) ( #158 ) internally, which supports most flow type annotations. It is published as a prerelease so you can test it on your codebase first.

Other changes:

  • The proptypes package is recognized as proptypes definition provider ( #163 ).

You can install this release via

npm install react-docgen@next
# or
yarn add react-docgen@next

v2.13.0

22 Dec 00:50
Compare
Choose a tag to compare

New / changed

  • Ignore __mocks__ directories by default (#135) (@aitherios)
  • Recognized functions that call React.cloneElement as stateless components (#138) (@khankuan)

Fixes

  • Infinite loop issue with MemberExpressions inside stateless components ( #136, #139, #143 ) (@tchon, @danez)
  • Crash when a SpreadProperty is used in shape propTypes (#145) (@Arktes)

Internal changes

v2.12.1

21 Oct 20:39
Compare
Choose a tag to compare

Fixed

  • Fixed an issue where props without default value would be reported as having computed default values. This only affected stateless components. Reported by @arunoda in #131 and fixed by @CompuIves in #132.

v2.12.0

20 Oct 18:51
Compare
Choose a tag to compare

New

  • Support for objectOf prop type (86b167f) (reported as #74)
  • Treat default arguments as default props in stateless components ( #108, @CompuIves)

Improved

  • When passing an unknown value to shape(...), react-docgen will now report that value as computed.

    Example: shape(Child.propTypes)
    Before:

    "type": {
      "name": "shape",
      "value": "unkown"
    }

    Now:

    "type": {
      "name": "shape",
      "value": "Child.propTypes",
      "computed": true
    }

    (eb0edaa) (reported as #87)

  • Resolve static values passed to oneOf. Examples:

    React.PropTypes.oneOf([TYPES.FOO, TYPES.BAR]);
    // or:
    var TYPES = ["FOO", "BAR"];
    React.PropTypes.oneOf(TYPES);
    // or:
    var TYPES = ["A", "B"];
    var MORE = [...TYPES, "C"];
    React.PropTypes.oneOf(MORE);

    (#122, @ZauberNerd)

Fixed

  • Fixed an issue with the output of react-docgen being truncated when piping to another command (#127, @mmeineke)

v2.11.0

05 Oct 17:57
Compare
Choose a tag to compare

New

Detect exported components passed to HOCs

Until now, react-docgen didn’t find components that are passed to a higher order component (HOC):

function MyComponent() { /* ... */ }
export default hoc(MyComponent);

The workaround was to change the resolver to find all component definitions in the file, something that is not always desirable.

With #124, @rtsao extended the default resolver to be able to handle these cases.

Fixes

  • findAllExportedComponentDefinitions can now be selected in the CLI.
    (reported as issue #119)

  • The static variable resolution process was fixed to consider assignments to variables. The following example didn’t work before and works now:

    var Component;
    Component = React.createClass(...);
    module.exports = Component;

    (reported as issue #58)

  • The display name handler now takes displayName getters in class definitions into account:

    class Component extends React.Component {
      static get displayName() {
        return 'Name';
      }
    }

    (reported as issue #61)

Internal improvements

To guard ourselves better against regressions, we are using jest’s snapshot tests to test component definitions that are reported as broken.

v2.10.0

25 Aug 16:18
Compare
Choose a tag to compare

New

  • New findAllExportedComponentDefinitions resolver. As the name suggests, it finds all exported component definitions. This complements the resolvers for finding all component definitions and the default exported definition ( #114, @ZauberNerd )
  • New CLI option: -e, --exclude PATTERN, allows you to skip files that match the provided pattern ( #102, @wallaroo )

Fixed / improved

  • Currently resolve namespace imports to their module ( #109, @ZauberNerd )
  • Resolve MemberExpressions (such as propTypes of a stateless component) to the correct object ( #111, @ZauberNerd )
  • Handle intersection and union flow types for prop types definitions. Intersection types are supported, union types are silently ignored. Before react-docgen would throw an error. ( #118, @danez )
  • If a default prop value references an imported value, the value of the prop will now be the variable name ( #99 , @nathanmarks )
  • The jsdoc type declarations @param {x|y} and @param {*} now correctly resolve to their equivalent flow type declarations (union and mixed). ( #95 , @dickeylth )

Thanks to everyone who contributed, this is great!

v2.9.1

22 Jun 16:41
Compare
Choose a tag to compare

Fixed

v2.9.0

21 Jun 17:55
Compare
Choose a tag to compare

New: Type aliases and optional method parameter flag

@caabernathy added new information to method parameters ( #83 ). If the parameter has a flow type, the name of the type is no also included. I.e. if the type definition is:

export type StatusBarStyle = $Enum<{
     ...
}

the docs for a parameter of that type will include alias: "StatusBarStyle".

In addition the docs now include an optional field indicating whether the parameter is optional or nor.

v2.8.2

10 Apr 05:31
Compare
Choose a tag to compare

Fix/Improvement

  • Better handling of method parameters ( #72 )