import { SourceFile } from '#ast' ; import { Language } from '#language/language' ; import { CrossTypeHost } from './host' ; import { LanguagePackage } from './language-package' ; import { NullableJsonValue } from '@crosstype/common' ; export interface ParserFunction { /**
     * Parse sourceText
     */ < O extends Parser . OptionsBase , H extends Parser . HooksBase > ( sourceText , options ? , hooks ? , host ? ) : SourceFile [ ] ; /**
     * Parse files (from array of file paths)
     */ < O extends Parser . OptionsBase , H extends Parser . HooksBase > ( fileNames , options ? , hooks ? , host ? ) : SourceFile [ ] ; /**
     * Parse files (object of { [filename]: sourceText })
     */ < O extends Parser . OptionsBase , H extends Parser . HooksBase > ( files , options ? , hooks ? , host ? ) : SourceFile [ ] ; /**
     * Parse files in package file
     */ < O extends Parser . OptionsBase , H extends Parser . HooksBase > ( packageFile , options ? , hooks ? , host ? ) : SourceFile [ ] ; } export type Parser < T extends ParserFunction = ParserFunction > = T & { pkg : LanguagePackage ; } ; export namespace Parser { type ParserOptionsValue = NullableJsonValue | undefined ; export interface OptionsBase { /**
         * Root directory for project files (defaults to cwd)
         */ rootDir : string ; [ p ] : ParserOptionsValue ; } export interface HooksBase { [ key ] : NullableJsonValue ; } export type AvailableLanguages = Language . ParserLanguages ; export type AvailableOptions = { [ K in AvailableLanguages [ 'shortName' ] ] : Language . GetLanguage < K > [ 'ParseOptions' ] ; } ; export type AvailableHooks = { [ K in AvailableLanguages [ 'shortName' ] ] : Language . GetLanguage < K > [ 'ParseHooks' ] ; } ; }