Skip to content

VueParser

reference
1 min readUpdated

Kind: Class

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

Vue Parser

Pure TypeScript class that parses Vue Single File Components. No NestJS dependencies required.

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

  • VueParser stops the work with an early return when !this.canParse(filePath).
  • VueParser stops the work with an early return when !fileContent.trim().
  • VueParser stops the work with an early return when !parseVue.
  • VueParser stops the work with an early return when !scriptContent && !hasTemplate.
  • VueParser stops the work with an early return when !scriptContent.trim().
  • VueParser stops the work with an early return when !hasVueRouter.

When something fails

  • VueParser handles failure in 7 places: it logs it and continues in 4, turns it into a return value in 2, 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