Skip to content

ParserOrchestrator

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/orchestrator/parser-orchestrator.ts

ParserOrchestrator - Coordinates multiple parsers for project-wide parsing

Methods

MethodSignatureReturns
initializeinitialize(parserConfig: ParserConfig)Promise<void>
registerParserregisterParser(parser: IParser, priority: undefined)void
unregisterParserunregisterParser(name: string)boolean
getParsergetParser(name: string)`IParser
getRegisteredParsersgetRegisteredParsers()string[]
findParserForFilefindParserForFile(filePath: string)`string
findAllParsersForFilefindAllParsersForFile(filePath: string)string[]
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFileWithParserparseFileWithParser(parserName: string, filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: string[], onProgress: ProgressCallback)Promise<ParseResult[]>
parseProjectparseProject(config: ParseProjectConfig, onProgress: ProgressCallback)Promise<ProjectParseResult>
clearCacheclearCache()void
getCacheStatsgetCacheStats(){ entries: number; size: number }
destroydestroy()Promise<void>

Where it refuses work

  • ParserOrchestrator stops the work with an early return when this.initialized.
  • ParserOrchestrator stops the work with an early return when registration.parser.canParse(filePath).
  • ParserOrchestrator stops the work with an early return when first.entities?.length.
  • ParserOrchestrator stops the work with an early return when next.entities?.length.
  • ParserOrchestrator stops the work with an early return when !parserName.
  • ParserOrchestrator stops the work with an early return when cached.

When something fails

  • ParserOrchestrator handles failure in 4 places: it turns it into a return value in 3, and discards it silently in 1. A failure discarded silently leaves no trace for whoever debugs this later.

Was this page helpful?

Download as PDF