UNPKG

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