UNPKG

1.76 kBTypeScriptView Raw
1import CJSImportProcessor from "../CJSImportProcessor";
2import { Options } from "../index";
3import NameManager from "../NameManager";
4import TokenProcessor from "../TokenProcessor";
5import { JSXPragmaInfo } from "../util/getJSXPragmaInfo";
6import RootTransformer from "./RootTransformer";
7import Transformer from "./Transformer";
8export default class JSXTransformer extends Transformer {
9 readonly rootTransformer: RootTransformer;
10 readonly tokens: TokenProcessor;
11 readonly importProcessor: CJSImportProcessor | null;
12 readonly nameManager: NameManager;
13 readonly options: Options;
14 lastLineNumber: number;
15 lastIndex: number;
16 filenameVarName: string | null;
17 readonly jsxPragmaInfo: JSXPragmaInfo;
18 constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, importProcessor: CJSImportProcessor | null, nameManager: NameManager, options: Options);
19 process(): boolean;
20 getPrefixCode(): string;
21 /**
22 * Lazily calculate line numbers to avoid unneeded work. We assume this is always called in
23 * increasing order by index.
24 */
25 getLineNumberForIndex(index: number): number;
26 getFilenameVarName(): string;
27 processProps(firstTokenStart: number): void;
28 processPropKeyName(): void;
29 processStringPropValue(): void;
30 /**
31 * Process the first part of a tag, before any props.
32 */
33 processTagIntro(): void;
34 processChildren(): void;
35 processChildTextElement(): void;
36 processJSXTag(): void;
37}
38/**
39 * Spec for identifiers: https://tc39.github.io/ecma262/#prod-IdentifierStart.
40 *
41 * Really only treat anything starting with a-z as tag names. `_`, `$`, `é`
42 * should be treated as copmonent names
43 */
44export declare function startsWithLowerCase(s: string): boolean;