Skip to content

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

Draft
brenelz wants to merge 3 commits 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 3 commits 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: 67dbebe

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

brenelz and others added 2 commits July 25, 2026 20:11
Follow-up to 35a0f34. SolidStartServerFileRouter existed only to add two
things `@solidjs/file-routes` now takes as config, so config/fs-router.ts
goes away entirely:

- `httpMethods: true` replaces the GET/POST export handling
- `components: start.ssr` replaces the `dataOnly` flag

The client build inputs go with it. Start was reconstructing the plugin's
own `src?pick=a&pick=b` ids to seed rollup's input; `buildInputs` has the
plugin contribute them from the ids it owns.

server/routes.ts drops `defineRoutes` for the `pageRoutes` view the
delivery adapter now serves — same nesting and `(group)` stripping, done
once at build time rather than three times at runtime — and drops its
`@ts-expect-error` now that the virtual module ships types.

Net -134 lines; start no longer implements any file-routing machinery.
Parity with the previous implementation was verified against the
experiments fixture: identical manifests (both SSR modes), identical page
tree, identical build inputs. 32 tests pass, tsc clean, and the basic
fixture builds, serves and hot-reloads route additions.

Still blocked on @solidjs/file-routes being published; validated with a
local link.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The package moved out of solid-router into its own repo, dropping the
Solid scope it never earned. Import sites and the dependency follow it;
no behavior changes. 32 tests pass, tsc clean.

Still unpublished, so the dependency is still unresolvable without a local
link.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@birkskyum birkskyum added the 3.x label Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants