Target branch: code-graph-preview
Dependency
The TypeScript and JavaScript extractors are already available on code-graph-preview. No language-extractor issue blocks this resolver.
Goal
Add a bounded Next.js resolver for App Router route handlers. The first version should translate file-based route modules into route nodes and connect exported HTTP handler functions without attempting to model the full Next.js routing system.
Scope
- Detect Next.js through
next in dependencies or dev dependencies.
- Recognize
app/**/route.ts and app/**/route.js, including projects using src/app/.
- Recognize exported
GET, POST, PUT, PATCH, DELETE, OPTIONS, and HEAD handler functions.
- Derive a route path from the directory containing the route file.
- Preserve dynamic segment text such as
[id] in the first version.
- Emit one
route node per exported HTTP handler and a reference to that handler function.
- Resolve each route to the corresponding same-file function when unambiguous.
Required changes
- Add
src/graph/resolution/frameworks/nextjs.ts implementing FrameworkResolver.
- Register and export it from
src/graph/resolution/frameworks/index.ts.
- Add minimal App Router fixtures for TypeScript and JavaScript.
- Add focused detection, path derivation, extraction, resolution, and ambiguity tests.
Acceptance criteria
Out of scope
- Pages Router API routes.
- Route groups, parallel routes, intercepting routes, rewrites, redirects, or middleware.
- React Server Components, server actions, page components, or layouts.
- Runtime Next.js configuration evaluation.
- Changes to the TypeScript/JavaScript extractors or graph core.
Contributor references
Contributor workflow
git switch code-graph-preview
git pull
git switch -c feat/nextjs-app-router-resolver
Open the pull request with base branch code-graph-preview.
Dependency
The TypeScript and JavaScript extractors are already available on
code-graph-preview. No language-extractor issue blocks this resolver.Goal
Add a bounded Next.js resolver for App Router route handlers. The first version should translate file-based route modules into route nodes and connect exported HTTP handler functions without attempting to model the full Next.js routing system.
Scope
nextin dependencies or dev dependencies.app/**/route.tsandapp/**/route.js, including projects usingsrc/app/.GET,POST,PUT,PATCH,DELETE,OPTIONS, andHEADhandler functions.[id]in the first version.routenode per exported HTTP handler and a reference to that handler function.Required changes
src/graph/resolution/frameworks/nextjs.tsimplementingFrameworkResolver.src/graph/resolution/frameworks/index.ts.Acceptance criteria
app/andsrc/app/roots are covered.npm run typecheck,npm test, andnpm run buildpass.Out of scope
Contributor references
src/graph/resolution/frameworks/express.tssrc/graph/__tests__/resolver-express.test.tsContributor workflow
Open the pull request with base branch
code-graph-preview.