Skip to content

Fix debarrel handling for Next.js route index files - #34

Merged
alexbit-codemod merged 1 commit into
mainfrom
fix/nextjs-routes
May 20, 2026
Merged

Fix debarrel handling for Next.js route index files#34
alexbit-codemod merged 1 commit into
mainfrom
fix/nextjs-routes

Conversation

@mohebifar

Copy link
Copy Markdown
Member

Summary

  • tighten isPureBarrel so an index file is only considered a barrel when its exports are direct local re-exports or import-then-reexport of local imports
  • skip renaming Next.js Pages API route index files, since Next discovers those by filesystem path even when they delegate to another handler
  • add regression fixtures for pages/api/**/index.ts routes with re-exported and locally declared handlers

Verification

  • pnpm --filter debarrel check-types
  • pnpm --filter debarrel test (95 passed)

…te index files and improve pure-barrel detection
@mohebifar
mohebifar requested a review from alexbit-codemod May 20, 2026 03:24
@alexbit-codemod
alexbit-codemod merged commit dc095e5 into main May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants