UNPKG

1.11 kBTypeScriptView Raw
1import CJSImportProcessor from "./CJSImportProcessor";
2import { RawSourceMap } from "./computeSourceMap";
3import { HelperManager } from "./HelperManager";
4import NameManager from "./NameManager";
5import { Scope } from "./parser/tokenizer/state";
6import TokenProcessor from "./TokenProcessor";
7export interface TransformResult {
8 code: string;
9 sourceMap?: RawSourceMap;
10}
11export interface SucraseContext {
12 tokenProcessor: TokenProcessor;
13 scopes: Array<Scope>;
14 nameManager: NameManager;
15 importProcessor: CJSImportProcessor | null;
16 helperManager: HelperManager;
17}
18export declare type Options = import("./Options").Options;
19export declare type SourceMapOptions = import("./Options").SourceMapOptions;
20export declare type Transform = import("./Options").Transform;
21export declare function getVersion(): string;
22export declare function transform(code: string, options: Options): TransformResult;
23/**
24 * Return a string representation of the sucrase tokens, mostly useful for
25 * diagnostic purposes.
26 */
27export declare function getFormattedTokens(code: string, options: Options): string;