# NextJSDetector

**Kind:** Class

**Source:** [`atloria-monorepo/packages/doc-automation/src/v2/stages/stage-01-parse/detectors/nextjs-detector.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/packages/doc-automation/src/v2/stages/stage-01-parse/detectors/nextjs-detector.ts#L64)

Next.js Detector

## Methods

| Method | Signature | Returns |
|---|---|---|
| `detectPages` | `detectPages(entities: Entity[])` | `DetectedNextJSPage[]` |
| `detectAPIRoutes` | `detectAPIRoutes(entities: Entity[])` | `DetectedNextJSAPIRoute[]` |
| `getPageSummary` | `getPageSummary(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)`.
