Skip to content

TypeScriptSymbolParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/typescript-symbol.parser.ts

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • TypeScriptSymbolParser stops the work with an early return when !/\.(tsx?|mjs|cjs|js)$/.test(filePath).
  • TypeScriptSymbolParser stops the work with an early return when /\.(d|spec|test|stories)\.(tsx?|mjs|cjs|js)$/.test(filePath).
  • TypeScriptSymbolParser stops the work with an early return when /\.min\.js$/.test(filePath).
  • TypeScriptSymbolParser stops the work with an early return when /(^|\/)(__tests__|__mocks__|node_modules|dist|build|coverage|vendor)\//.test(filePath).
  • TypeScriptSymbolParser stops the work with an early return when !fileContent.trim().
  • TypeScriptSymbolParser stops the work with an early return when !this.isExported(stmt) && !cjsEligible.

When something fails

  • TypeScriptSymbolParser handles failure in 2 places: it logs it and continues in 1, and turns it into a return value in 1.

Was this page helpful?

Download as PDF