Skip to content

NextjsParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/frontend-parser/src/parsers/nextjs.parser.ts

Extends: ReactParser

Methods

MethodSignatureReturns
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>

Properties

PropertyType
namestring
versionstring
supportedPatternsstring[]

Where it refuses work

  • NextjsParser stops the work with an early return when this.isRouteHandler(filePath).
  • NextjsParser stops the work with an early return when !content.trim().
  • NextjsParser stops the work with an early return when route === '/'.
  • NextjsParser stops the work with an early return when /\/app\/page\.(tsx|jsx|ts|js)$/.test(filePath).
  • NextjsParser stops the work with an early return when route === 'index'.
  • NextjsParser stops the work with an early return when match.

When something fails

  • NextjsParser handles failure in 2 places: it turns it into a return value in 1, 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