babel-plugin-react-docgen
Advanced tools
Comparing version 4.2.0 to 4.2.1
# ChangeLog | ||
### v4.2.1 | ||
13-10-2020 | ||
Bug fixes: | ||
- Fixed support for optional chaining #92 | ||
### v4.2.0 | ||
@@ -4,0 +12,0 @@ |
@@ -10,6 +10,4 @@ "use strict"; | ||
var _recast = _interopRequireDefault(require("recast")); | ||
var _astTypes = require("ast-types"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
/* | ||
@@ -34,3 +32,2 @@ * Copyright (c) 2015, Facebook, Inc. | ||
resolveToValue = _reactDocgen.utils.resolveToValue; | ||
var types = _recast["default"].types.namedTypes; | ||
@@ -40,13 +37,13 @@ function actualNameHandler(documentation, path) { | ||
// function / class is the displayName | ||
if (types.ClassDeclaration.check(path.node) || types.FunctionDeclaration.check(path.node)) { | ||
if (_astTypes.namedTypes.ClassDeclaration.check(path.node) || _astTypes.namedTypes.FunctionDeclaration.check(path.node)) { | ||
documentation.set('actualName', getNameOrValue(path.get('id'))); | ||
} else if (types.ArrowFunctionExpression.check(path.node) || types.FunctionExpression.check(path.node) || // React.forwardRef | ||
types.CallExpression.check(path.node)) { | ||
if (types.VariableDeclarator.check(path.parentPath.node)) { | ||
} else if (_astTypes.namedTypes.ArrowFunctionExpression.check(path.node) || _astTypes.namedTypes.FunctionExpression.check(path.node) || // React.forwardRef | ||
_astTypes.namedTypes.CallExpression.check(path.node)) { | ||
if (_astTypes.namedTypes.VariableDeclarator.check(path.parentPath.node)) { | ||
documentation.set('actualName', getNameOrValue(path.parentPath.get('id'))); | ||
} else if (types.AssignmentExpression.check(path.parentPath.node)) { | ||
} else if (_astTypes.namedTypes.AssignmentExpression.check(path.parentPath.node)) { | ||
documentation.set('actualName', getNameOrValue(path.parentPath.get('left'))); | ||
} | ||
} else if ( // React.createClass() or createReactClass() | ||
types.CallExpression.check(path.parentPath.node) && types.VariableDeclarator.check(path.parentPath.parentPath.parentPath.node)) { | ||
_astTypes.namedTypes.CallExpression.check(path.parentPath.node) && _astTypes.namedTypes.VariableDeclarator.check(path.parentPath.parentPath.parentPath.node)) { | ||
documentation.set('actualName', getNameOrValue(path.parentPath.parentPath.parentPath.get('id'))); | ||
@@ -62,7 +59,7 @@ } else { | ||
if (types.FunctionExpression.check(displayNamePath.node)) { | ||
if (_astTypes.namedTypes.FunctionExpression.check(displayNamePath.node)) { | ||
displayNamePath = resolveFunctionDefinitionToReturnValue(displayNamePath); | ||
} | ||
if (!displayNamePath || !types.Literal.check(displayNamePath.node)) { | ||
if (!displayNamePath || !_astTypes.namedTypes.Literal.check(displayNamePath.node)) { | ||
return; | ||
@@ -69,0 +66,0 @@ } |
{ | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"name": "babel-plugin-react-docgen", | ||
@@ -19,2 +19,3 @@ "description": "Babel plugin to add react-docgen info into your code", | ||
"@babel/plugin-proposal-class-properties": "^7.5.5", | ||
"@babel/plugin-proposal-optional-chaining": "^7.11.0", | ||
"@babel/preset-env": "^7.6.3", | ||
@@ -41,7 +42,7 @@ "@babel/preset-flow": "^7.0.0", | ||
"dependencies": { | ||
"ast-types": "^0.14.2", | ||
"lodash": "^4.17.15", | ||
"react-docgen": "^5.0.0", | ||
"recast": "^0.14.7" | ||
"react-docgen": "^5.0.0" | ||
}, | ||
"license": "MIT" | ||
} |
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
25731
11
235
+ Addedast-types@^0.14.2
- Removedrecast@^0.14.7
- Removedast-types@0.11.3(transitive)
- Removedesprima@4.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedrecast@0.14.7(transitive)
- Removedsource-map@0.6.1(transitive)