react-docgen
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -16,2 +16,3 @@ /* | ||
exports.propTypeHandler = require('./propTypeHandler'); | ||
exports.propTypeCompositionHandler = require('./propTypeCompositionHandler'); | ||
exports.propDocBlockHandler = require('./propDocBlockHandler'); |
@@ -25,2 +25,3 @@ /* | ||
var printValue = require('../utils/printValue'); | ||
var propTypeCompositionHandler = require('./propTypeCompositionHandler'); | ||
var recast = require('recast'); | ||
@@ -71,3 +72,3 @@ var resolveToModule = require('../utils/resolveToModule'); | ||
function amendPropTypes(documentation, path) { | ||
function amendPropTypes(documentation, path, componentPath) { | ||
path.get('properties').each(function(propertyPath) { | ||
@@ -96,4 +97,5 @@ switch (propertyPath.node.type) { | ||
break; | ||
case types.MemberExpression.name: | ||
amendComposes(documentation, resolvedValuePath); | ||
default: | ||
// for backwards compatibility | ||
propTypeCompositionHandler(documentation, componentPath); | ||
break; | ||
@@ -112,15 +114,15 @@ } | ||
propTypesPath = resolveToValue(propTypesPath); | ||
if (!propTypesPath || !types.ObjectExpression.check(propTypesPath.node)) { | ||
if (!propTypesPath) { | ||
return; | ||
} | ||
if (!types.ObjectExpression.check(propTypesPath.node)) { | ||
// maybe composition | ||
// for backwards compatibility | ||
propTypeCompositionHandler(documentation, path); | ||
return; | ||
} | ||
switch (propTypesPath.node.type) { | ||
case types.ObjectExpression.name: | ||
amendPropTypes(documentation, propTypesPath); | ||
break; | ||
case types.MemberExpression.name: | ||
amendComposes(documentation, propTypesPath); | ||
} | ||
amendPropTypes(documentation, propTypesPath, path); | ||
} | ||
module.exports = propTypeHandler; |
@@ -58,2 +58,3 @@ /* | ||
parse: defaultParse, | ||
defaultHandlers:defaultHandlers, | ||
handlers:handlers, | ||
@@ -60,0 +61,0 @@ resolver:resolver, |
{ | ||
"name": "react-docgen", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "A CLI and toolkit to extract information from React components for documentation generation.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,2 +0,2 @@ | ||
# react-docgen | ||
# react-docgen [![Build Status](https://travis-ci.org/reactjs/react-docgen.svg?branch=master)](https://travis-ci.org/reactjs/react-docgen) | ||
@@ -3,0 +3,0 @@ `react-docgen` is a CLI and toolbox to help extracting information from React components, and generate documentation from it. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63038
41
1553