import type { ParseResult, TransformOptions } from '@babel/core'; import type { RawSourceMap } from '@rspack/core'; import type { HermesParserOverrides } from './options.js'; interface ReactNativeParser { parse: (src: string, opts: { babel: boolean; flow?: HermesParserOverrides['flow']; reactRuntimeTarget: NonNullable; sourceType: HermesParserOverrides['sourceType'] | null; }) => ParseResult; } export declare function isTypeScriptSource(fileName: string): boolean; export declare function isTSXSource(fileName: string): boolean; /** * Previous loaders pass their source map either serialized or as an object * (e.g. `flow-loader`, Babel), while Babel expects an object. */ export declare function normalizeInputSourceMap(sourceMap: string | RawSourceMap | undefined): TransformOptions['inputSourceMap']; /** * Decides whether a source file needs the React Native parser (hermes-parser or flow-parser). * * Mirrors the React Native preset's parser syntax plugin with its default * `parseLangTypes: 'flow'`, which sends only files carrying an `@flow` pragma to the parser * and leaves everything else to `@babel/parser`. The parser converts its own AST into a Babel * AST, and that conversion is quadratic in the number of sibling nodes, so prebuilt minified * dependencies can take minutes. * * `flow: 'all'` opts every file back into the React Native parser. */ export declare function shouldUseReactNativeParser(src: string, flow?: 'all' | 'detect'): boolean; export declare function loadReactNativeParser(projectRoot?: string | null, providedParserPath?: string): Promise; /** * Parses a Flow source with the project's React Native parser into a Babel AST. * * The parser lowers Flow syntax that has no Babel plugin (e.g. `component` * declarations); enums are left for `babel-plugin-transform-flow-enums` and * type annotations for `@babel/plugin-transform-flow-strip-types`. */ export declare function parseReactNativeSource(src: string, { projectRoot, parserPath, flow, sourceType, overrides, }: { projectRoot: string; parserPath?: string; flow?: HermesParserOverrides['flow']; sourceType?: HermesParserOverrides['sourceType'] | null; overrides?: HermesParserOverrides; }): Promise; export declare function isIgnoredRepackDeepImport(filename: string): boolean; export {};