UNPKG

1.29 kBTypeScriptView Raw
1import { Options } from "../index";
2import NameManager from "../NameManager";
3import TokenProcessor from "../TokenProcessor";
4import ReactHotLoaderTransformer from "./ReactHotLoaderTransformer";
5import Transformer from "./Transformer";
6/**
7 * Class for editing import statements when we are keeping the code as ESM. We still need to remove
8 * type-only imports in TypeScript and Flow.
9 */
10export default class ESMImportTransformer extends Transformer {
11 readonly tokens: TokenProcessor;
12 readonly nameManager: NameManager;
13 readonly reactHotLoaderTransformer: ReactHotLoaderTransformer | null;
14 readonly isTypeScriptTransformEnabled: boolean;
15 private nonTypeIdentifiers;
16 constructor(tokens: TokenProcessor, nameManager: NameManager, reactHotLoaderTransformer: ReactHotLoaderTransformer | null, isTypeScriptTransformEnabled: boolean, options: Options);
17 process(): boolean;
18 private processImport;
19 /**
20 * Remove type bindings from this import, leaving the rest of the import intact.
21 *
22 * Return true if this import was ONLY types, and thus is eligible for removal. This will bail out
23 * of the replacement operation, so we can return early here.
24 */
25 private removeTypeBindings;
26 private isTypeName;
27 private processExportDefault;
28}