Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

react-docgen

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-docgen - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

45

dist/utils/resolveToValue.js

@@ -16,4 +16,30 @@ /*

var types = require('recast').types.namedTypes;
var $__0=
require('recast').types,NodePath=$__0.NodePath,builders=$__0.builders,types=$__0.namedTypes;
function buildMemberExpressionFromPattern(path ) {
var node = path.node;
if (types.Property.check(node)) {
var objPath = buildMemberExpressionFromPattern(path.parent);
if (objPath) {
return new NodePath(
builders.memberExpression(
objPath.node,
node.key,
types.Literal.check(node.key)
),
objPath
);
}
} else if (types.ObjectPattern.check(node)) {
return buildMemberExpressionFromPattern(path.parent);
} else if (types.VariableDeclarator.check(node)) {
return path.get('init');
}
return null;
}
/**

@@ -36,7 +62,18 @@ * If the path is an identifier, it is resolved in the scope chain.

if (bindings.length > 0) {
var parentPath = scope.getBindings()[node.name][0].parent;
var resultPath = scope.getBindings()[node.name][0];
var parentPath = resultPath.parent;
if (types.VariableDeclarator.check(parentPath.node)) {
parentPath = parentPath.get('init');
resultPath = parentPath.get('init');
} else if (types.Property.check(parentPath.node)) {
// must be inside a pattern
var memberExpressionPath = buildMemberExpressionFromPattern(
parentPath
);
if (memberExpressionPath) {
return memberExpressionPath;
}
}
return resolveToValue(parentPath);
return resultPath.node !== path.node ?
resolveToValue(resultPath) :
path;
}

@@ -43,0 +80,0 @@ }

2

package.json
{
"name": "react-docgen",
"version": "1.1.0",
"version": "1.2.0",
"description": "A CLI and toolkit to extract information from React components for documentation generation.",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc