refactor: rebase file-system routing onto @solidjs/file-routes#2227
Draft
brenelz wants to merge 3 commits into
Draft
refactor: rebase file-system routing onto @solidjs/file-routes#2227brenelz wants to merge 3 commits into
brenelz wants to merge 3 commits into
Conversation
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>
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Draft / blocked on
@solidjs/file-routespublishing — 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-routespackage, leaving Start with only its server conventions. +39 / −1,344 lines.Deleted (
src/config/fs-routes/, ~1,250 lines)router.ts(scanner / manifest) →BaseFileSystemRouterfrom@solidjs/file-routesindex.ts(virtual module serializer) →fileRoutes()from@solidjs/file-routes/vitefs-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 pluginrouter.spec.ts/tree-shake.spec.ts→ already live in@solidjs/file-routes' test suiteKept (Start's server conventions)
SolidStartServerFileRouternowextends PageFileSystemRouter, adding only theGET/POST/etc. export analysis,$HEADfallback, and thedataOnlyflagSolidStartClientFileRouteris the shared page convention, re-exportedserver/routes.ts(API matching), middleware, SSR<FileRoutes>— unchangedWiring changes
config/index.tscomposesfileRoutes({ routers })keyed by Vite environment; theglobalThis.ROUTERShand-off is now a plain local referencesolid-start:routes→ the neutralsolid:file-routes(internal only)Validation
Against a local
file:link to@solidjs/file-routes(built from solidjs/solid-router#572):tsc --noEmitcleanpackages/starttests pass🤖 Generated with Claude Code