UNPKG

1.92 kBTypeScriptView Raw
1import type { Options, SucraseContext, Transform } from "../index";
2import { ClassInfo } from "../util/getClassInfo";
3export default class RootTransformer {
4 private transformers;
5 private nameManager;
6 private tokens;
7 private generatedVariables;
8 private isImportsTransformEnabled;
9 private isReactHotLoaderTransformEnabled;
10 private helperManager;
11 constructor(sucraseContext: SucraseContext, transforms: Array<Transform>, enableLegacyBabel5ModuleInterop: boolean, options: Options);
12 transform(): string;
13 processBalancedCode(): void;
14 processToken(): void;
15 /**
16 * Skip past a class with a name and return that name.
17 */
18 processNamedClass(): string;
19 processClass(): void;
20 /**
21 * We want to just handle class fields in all contexts, since TypeScript supports them. Later,
22 * when some JS implementations support class fields, this should be made optional.
23 */
24 processClassBody(classInfo: ClassInfo, className: string | null): void;
25 makeConstructorInitCode(constructorInitializerStatements: Array<string>, instanceInitializerNames: Array<string>, className: string): string;
26 /**
27 * Normally it's ok to simply remove type tokens, but we need to be more careful when dealing with
28 * arrow function return types since they can confuse the parser. In that case, we want to move
29 * the close-paren to the same line as the arrow.
30 *
31 * See https://github.com/alangpierce/sucrase/issues/391 for more details.
32 */
33 processPossibleArrowParamEnd(): boolean;
34 /**
35 * An async arrow function might be of the form:
36 *
37 * async <
38 * T
39 * >() => {}
40 *
41 * in which case, removing the type parameters will cause a syntax error. Detect this case and
42 * move the open-paren earlier.
43 */
44 processPossibleAsyncArrowWithTypeParams(): boolean;
45 processPossibleTypeRange(): boolean;
46}