sucrase
Version:
Super-fast alternative to Babel for when you can target modern JS runtimes
44 lines (43 loc) • 1.68 kB
TypeScript
import { NameManager } from './NameManager';
import TokenProcessor from './TokenProcessor';
/**
* Class responsible for preprocessing and bookkeeping import and export
* declarations within the file.
*/
export declare class ImportProcessor {
readonly nameManager: NameManager;
readonly tokens: TokenProcessor;
private importInfoByPath;
private importsToReplace;
private identifierReplacements;
private exportBindingsByLocalName;
private interopRequireWildcardName;
private interopRequireDefaultName;
constructor(nameManager: NameManager, tokens: TokenProcessor);
getPrefixCode(): string;
preprocessTokens(): void;
private generateImportReplacements();
private getFreeIdentifierForPath(path);
private preprocessImportAtIndex(index);
private preprocessExportAtIndex(index);
/**
* Walk this export statement just in case it's an export...from statement.
* If it is, combine it into the import info for that path. Otherwise, just
* bail out; it'll be handled later.
*/
private preprocessNamedExportAtIndex(index);
private preprocessExportStarAtIndex(index);
private getNamedImports(index);
/**
* Get a mutable import info object for this path, creating one if it doesn't
* exist yet.
*/
private getImportInfo(path);
/**
* Return the code to use for the import for this path, or the empty string if
* the code has already been "claimed" by a previous import.
*/
claimImportCode(importPath: string): string;
getIdentifierReplacement(identifierName: string): string | null;
resolveExportBinding(assignedName: string): string | null;
}