Skip to content

NextJSDetector

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/packages/doc-automation/src/v2/stages/stage-01-parse/detectors/nextjs-detector.ts

Next.js Detector

Methods

MethodSignatureReturns
detectPagesdetectPages(entities: Entity[])DetectedNextJSPage[]
detectAPIRoutesdetectAPIRoutes(entities: Entity[])DetectedNextJSAPIRoute[]
getPageSummarygetPageSummary(page: DetectedNextJSPage)string

Where it refuses work

  • NextJSDetector stops the work with an early return when /\/app\/.*\/page\.(tsx?|jsx?)$/.test(lowerPath).
  • NextJSDetector stops the work with an early return when /\/pages\/(?!api\/|_).*\.(tsx?|jsx?)$/.test(lowerPath).
  • NextJSDetector stops the work with an early return when /\/app\/api\/.*\/route\.(ts|js)$/.test(lowerPath).
  • NextJSDetector stops the work with an early return when /\/pages\/api\/.*\.(ts|js)$/.test(lowerPath).
  • NextJSDetector stops the work with an early return when methods.length === 0.
  • NextJSDetector stops the work with an early return when /['"]use client['"]/.test(code).

Was this page helpful?

Download as PDF