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

@storybook/react-docgen-typescript-plugin

Package Overview
Dependencies
Maintainers
30
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/react-docgen-typescript-plugin - npm Package Compare versions

Comparing version 1.0.6--canary.9.630821.0 to 1.0.6--canary.9.0c3f3b7.0

21

dist/getIdentifier.js
"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;

2

package.json
{
"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

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