sucrase
Version:
Super-fast alternative to Babel for when you can target modern JS runtimes
29 lines (28 loc) • 1.29 kB
TypeScript
import { Options } from "../index";
import NameManager from "../NameManager";
import TokenProcessor from "../TokenProcessor";
import ReactHotLoaderTransformer from "./ReactHotLoaderTransformer";
import Transformer from "./Transformer";
/**
* Class for editing import statements when we are keeping the code as ESM. We still need to remove
* type-only imports in TypeScript and Flow.
*/
export default class ESMImportTransformer extends Transformer {
readonly tokens: TokenProcessor;
readonly nameManager: NameManager;
readonly reactHotLoaderTransformer: ReactHotLoaderTransformer | null;
readonly isTypeScriptTransformEnabled: boolean;
private nonTypeIdentifiers;
constructor(tokens: TokenProcessor, nameManager: NameManager, reactHotLoaderTransformer: ReactHotLoaderTransformer | null, isTypeScriptTransformEnabled: boolean, options: Options);
process(): boolean;
private processImport;
/**
* Remove type bindings from this import, leaving the rest of the import intact.
*
* Return true if this import was ONLY types, and thus is eligible for removal. This will bail out
* of the replacement operation, so we can return early here.
*/
private removeTypeBindings;
private isTypeName;
private processExportDefault;
}