Skip to content

feat(framework): partition error pages in route scanner and codegen #104

@qantrepreneur

Description

@qantrepreneur

This was generated by AI during triage.

Parent

What to build

Update the route scanner and codegen to recognize error page files and separate them from regular routes.

Error page convention: A route file whose basename (minus extension) is a 3-digit HTTP status code in the 4xx–5xx range (e.g., 404.tsx, 500.tsx). Files like 200.tsx or 301.tsx remain regular routes. Error pages live in src/routes/ alongside regular routes — no new directory.

Route scanner (route-scanner.ts): scanRoutes should return error page entries separately from regular route entries. Error pages must not appear in the regular routes array.

Codegen (routes.gen.ts): The generated manifest should emit error pages as a separate export:

export const errorPages = {
  404: () => import("./routes/404"),
  500: () => import("./routes/500"),
};

Type codegen (framework.gen.d.ts): No new type registry needed — error pages already get type checking through defineErrorPage + TemplateRegistry.

Acceptance criteria

  • Route scanner identifies error page files by 3-digit 4xx–5xx basename convention
  • scanRoutes excludes error pages from the regular routes array
  • Error pages returned as a separate data structure from the scanner
  • Codegen emits errorPages export in routes.gen.ts with lazy imports keyed by status code
  • Regular routes no longer include error page patterns (e.g., /404 is gone from the routes array)
  • Files with non-error numeric names (e.g., 200.tsx, 42.tsx) remain regular routes
  • Existing tests updated, new tests for the partitioning logic

Blocked by

None — can start immediately.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestready-for-reviewPR is up, CI green, needs human review

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