UNPKG

1.23 kBTypeScriptView Raw
1import type CJSImportProcessor from "../CJSImportProcessor";
2import type { Options } from "../index";
3import type TokenProcessor from "../TokenProcessor";
4import type RootTransformer from "./RootTransformer";
5import Transformer from "./Transformer";
6/**
7 * Implementation of babel-plugin-transform-react-display-name, which adds a
8 * display name to usages of React.createClass and createReactClass.
9 */
10export default class ReactDisplayNameTransformer extends Transformer {
11 readonly rootTransformer: RootTransformer;
12 readonly tokens: TokenProcessor;
13 readonly importProcessor: CJSImportProcessor | null;
14 readonly options: Options;
15 constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, importProcessor: CJSImportProcessor | null, options: Options);
16 process(): boolean;
17 /**
18 * This is called with the token position at the open-paren.
19 */
20 private tryProcessCreateClassCall;
21 private findDisplayName;
22 private getDisplayNameFromFilename;
23 /**
24 * We only want to add a display name when this is a function call containing
25 * one argument, which is an object literal without `displayName` as an
26 * existing key.
27 */
28 private classNeedsDisplayName;
29}