Skip to content

ReactParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/frontend/react.parser.ts

React Parser - Pure class implementation (no NestJS dependencies)

Works for both CLI (static) mode and cloud mode.

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
namestring
versionstring
supportedPatternsstring[]

Where it refuses work

  • ReactParser stops the work with an early return when !t.isJSXAttribute(attr), in 4 places.
  • ReactParser stops the work with an early return when !attrName, in 4 places.
  • ReactParser stops the work with an early return when !name, in 3 places.
  • ReactParser stops the work with an early return when !/^[A-Z]/.test(name), in 2 places.
  • ReactParser stops the work with an early return when !label, in 2 places.
  • ReactParser stops the work with an early return when !this.canParse(filePath).

When something fails

  • ReactParser handles failure in 2 places: it turns it into a return value in all 2.

Was this page helpful?

Download as PDF