Skip to content

Next.js: extract page routes (app/page.tsx, pages/*.tsx) #3

Description

@jorgeraad

The Next.js extractor in src/extractors/nextjs.ts currently scans app/**/route.{ts,js} (App Router APIs) and pages/api/**/* (Pages Router APIs) only. It never scans app/**/page.tsx or pages/**/*.tsx — so user-visible page routes are missing from extraction output.

Extend the extractor to additionally walk:

  • app/**/page.{tsx,jsx,js,ts} — App Router pages
  • pages/**/*.{tsx,jsx,js,ts} excluding pages/api/ and special files (_app, _document, _error, _middleware)

Emit each as { method: "GET", handler: "Page", kind: "page" }. URL paths derive from the file's position in the directory tree; Pages Router needs /index segment normalization (e.g. pages/about/index.tsx/about, pages/index.tsx/).

Layout files (layout.tsx, template.tsx, loading.tsx, error.tsx, not-found.tsx, default.tsx) explicitly excluded — they're compositional shells, not routes.

Depends on #2 (the kind field).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions