in src/handlers/defaultPropsHandler.ts [57:90]
function getDefaultPropsPath(
componentDefinition: NodePath,
importer: Importer,
): NodePath | null {
let defaultPropsPath = getMemberValuePath(
componentDefinition,
'defaultProps',
importer,
);
if (!defaultPropsPath) {
return null;
}
defaultPropsPath = resolveToValue(defaultPropsPath, importer);
if (!defaultPropsPath) {
return null;
}
if (
t.FunctionExpression.check(defaultPropsPath.node) ||
t.FunctionDeclaration.check(defaultPropsPath.node)
) {
// Find the value that is returned from the function and process it if it is
// an object literal.
const returnValue = resolveFunctionDefinitionToReturnValue(
defaultPropsPath,
importer,
);
if (returnValue && t.ObjectExpression.check(returnValue.node)) {
defaultPropsPath = returnValue;
}
}
return defaultPropsPath;
}