Skip to content

refactor: rebase file-system routing onto @solidjs/file-routes#2227

Draft
brenelz wants to merge 1 commit into
solidjs:upgrade-to-solid-2-betafrom
brenelz:file-routes-migration
Draft

refactor: rebase file-system routing onto @solidjs/file-routes#2227
brenelz wants to merge 1 commit into
solidjs:upgrade-to-solid-2-betafrom
brenelz:file-routes-migration

Conversation

@brenelz

@brenelz brenelz commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Note

Draft / blocked on @solidjs/file-routes publishing — companion to solidjs/solid-router#572, implementing the split refined by @ryansolid in solidjs/solid-router#571. Once that PR merges and a release cuts, this needs a lockfile regen and can leave draft.

What this does

Deletes Start's fs-routing machinery in favor of the router-neutral @solidjs/file-routes package, leaving Start with only its server conventions. +39 / −1,344 lines.

Deleted (src/config/fs-routes/, ~1,250 lines)

  • router.ts (scanner / manifest) → BaseFileSystemRouter from @solidjs/file-routes
  • index.ts (virtual module serializer) → fileRoutes() from @solidjs/file-routes/vite
  • fs-watcher.ts → the plugin's watcher (with a fix: routes are pre-built before the reloader attaches, so the initial scan no longer invalidates the virtual module mid-load)
  • tree-shake.ts → identical port in the plugin
  • router.spec.ts / tree-shake.spec.ts → already live in @solidjs/file-routes' test suite

Kept (Start's server conventions)

  • SolidStartServerFileRouter now extends PageFileSystemRouter, adding only the GET/POST/etc. export analysis, $HEAD fallback, and the dataOnly flag
  • SolidStartClientFileRouter is the shared page convention, re-exported
  • server/routes.ts (API matching), middleware, SSR <FileRoutes> — unchanged

Wiring changes

  • config/index.ts composes fileRoutes({ routers }) keyed by Vite environment; the globalThis.ROUTERS hand-off is now a plain local reference
  • Virtual module id: solid-start:routes → the neutral solid:file-routes (internal only)

Validation

Against a local file: link to @solidjs/file-routes (built from solidjs/solid-router#572):

  • tsc --noEmit clean
  • all 32 remaining packages/start tests pass
  • behavior-identical route manifests: the scanner, conventions, serializer and tree-shake are line-for-line ports of the code this deletes

🤖 Generated with Claude Code

Deletes the fs-routing machinery (scanner, export analysis, virtual
module serializer, watcher, tree-shake — ~1,250 lines with specs) in
favor of the router-neutral @solidjs/file-routes package extracted in
solidjs/solid-router#572, per the architecture in
solidjs/solid-router#571.

Start keeps only its server conventions: SolidStartServerFileRouter now
extends PageFileSystemRouter, adding the GET/POST/etc. export handling
and the dataOnly flag. SolidStartClientFileRouter is the shared page
convention re-exported. The config composes fileRoutes({ routers }) from
@solidjs/file-routes/vite, and the virtual module id becomes the neutral
solid:file-routes.

Blocked on @solidjs/file-routes being published; the deleted specs
already live in that package's test suite. Validated with a local file:
link: tsc clean, 32/32 remaining tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 35a0f34

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

1 participant