import { ParserOptions } from "@babel/core"; import { ExtractorType, ExtractedMessage, ExtractorCtx } from "@lingui/conf"; import { ParserPlugin } from "@babel/parser"; export declare const babelRe: RegExp; /** * @public * * Low level function used in default Lingui extractor. * This function setup source maps and lingui plugins needed for * extraction process but leaving `parserOptions` up to userland implementation. * * * @example * ```ts * const extractor: ExtractorType = { * ... * async extract(filename, code, onMessageExtracted, ctx) { * return extractFromFileWithBabel(filename, code, onMessageExtracted, ctx, { * // https://babeljs.io/docs/babel-parser#plugins * plugins: [ * "decorators-legacy", * "typescript", * "jsx", * ], * }) * }, * } * ``` */ export declare function extractFromFileWithBabel(filename: string, code: string, onMessageExtracted: (msg: ExtractedMessage) => void, ctx: ExtractorCtx, parserOpts: ParserOptions, skipMacroPlugin?: boolean): Promise; export declare function getBabelParserOptions(filename: string, parserOptions: BabelExtractorOptions["parserOptions"]): ParserPlugin[]; export type BabelExtractorOptions = { parserOptions?: { /** * default false * * By default, standard decorators (Stage3) are applied for TS files * Enable this if you want to use TypesScript's experimental decorators. */ tsExperimentalDecorators?: boolean; /** * Enable if you use flow. This will apply Flow syntax to js files */ flow?: boolean; }; }; export declare function createBabelExtractor(options?: BabelExtractorOptions): ExtractorType; export declare const babelExtractor: ExtractorType; export default babelExtractor;