@storybook/react-docgen-typescript-plugin
Advanced tools
Comparing version 1.0.6--canary.9.630821.0 to 1.0.6--canary.9.0c3f3b7.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getIdentifier = void 0; | ||
// From: https://github.com/styleguidist/react-docgen-typescript/blob/287e7012843cb26fed8f4bd8ee24e462c25a1414/src/parser.ts#L308-L317 | ||
const defaultComponentTypes = [ | ||
"__function", | ||
"StatelessComponent", | ||
"Stateless", | ||
"StyledComponentClass", | ||
"StyledComponent", | ||
"FunctionComponent", | ||
"ForwardRefExoticComponent", | ||
"MemoExoticComponent", | ||
]; | ||
function getIdentifier(d) { | ||
var _a; | ||
const name = (_a = d.expression) === null || _a === void 0 ? void 0 : _a.getName(); | ||
return ["default", "__function"].includes(name) || !name | ||
// In those cases, react-docgen-typescript can not find a runtime name because a default export is used. | ||
// We fall back to the displayName, although this doesn't work for every case. | ||
// | ||
// It works in cases where the file name matches the variable name used for the default export: | ||
// | ||
// src/component/MyComponent.tsx | ||
// const MyComponent: React.FC<Props> = (props) => <></>; | ||
// export default MyComponent; | ||
return ["default", ...defaultComponentTypes].includes(name) || !name | ||
? d.displayName | ||
@@ -9,0 +28,0 @@ : name; |
{ | ||
"name": "@storybook/react-docgen-typescript-plugin", | ||
"version": "1.0.6--canary.9.630821.0", | ||
"version": "1.0.6--canary.9.0c3f3b7.0", | ||
"description": "A webpack plugin to inject react typescript docgen information.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
67020
735