chore: make fsRoutes dir and adapter required, add next-adapter convenience module#125
Merged
Merged
Conversation
The experimental `fsRoutes` plugin option previously defaulted `dir` to `"./src/pages"` and `adapter` to the built-in `nextRoutes()` convention. Require both fields so users are explicit about the routes directory and the file-name convention rather than relying on opinionated defaults. - Make `dir` and `adapter` required in `FsRoutesConfig` - Drop the default resolution in the plugin and always wire the adapter import into the synthesized entries module - Add explicit `adapter` modules to the example and e2e fixture - Update API and File-System Routing docs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019KZaV9B4HmtACBqoPdL8qK
Now that `fsRoutes.adapter` is required, provide a bundled module that
`export default`s `nextRoutes()` so users can opt into the built-in
Next.js-like convention without writing their own re-export file:
fsRoutes: { adapter: "@funstack/static/fs-routes/next", ... }
- Add the `src/fs-routes/next.ts` entry and `./fs-routes/next` package export
- Let `fsRoutes.adapter` accept a bare module specifier (a package import),
not just a path resolved against the Vite root
- Use the convenience module in the example and e2e fixture
- Update API and File-System Routing docs
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019KZaV9B4HmtACBqoPdL8qK
…t-adapter Rename the bundled adapter module from `@funstack/static/fs-routes/next` to `@funstack/static/fs-routes/next-adapter` for a clearer name. - Rename src/fs-routes/next.ts -> next-adapter.ts and the package export - Update the example, e2e fixture, and docs to the new specifier Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019KZaV9B4HmtACBqoPdL8qK
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.
Summary
Tightens the experimental
fsRoutesplugin option so users are explicit rather than relying on opinionated defaults, and adds a bundled convenience adapter so opting into the built-in convention stays a one-liner.This is a breaking change to the (experimental)
fsRoutesAPI — not yet covered by semantic versioning.Changes
fsRoutes.dirandfsRoutes.adapterrequired. Both previously had opinionated defaults (dir→"./src/pages",adapter→ the built-innextRoutes()); they must now be specified.rootwas already required.@funstack/static/fs-routes/next-adapterconvenience module. A bundled module thatexport defaultsnextRoutes(), so users can pointadapterat it to use the built-in Next.js-like convention without writing their own re-export file.adapter. The option now resolves either a bare package import (like@funstack/static/fs-routes/next-adapter) or a path relative to the Vite root, instead of alwayspath.resolve-ing against the root.Usage after this change:
Commits
chore: make fsRoutes dir and adapter requiredfeat: add @funstack/static/fs-routes/next convenience adapter modulerefactor: rename convenience module to @funstack/static/fs-routes/next-adapterTest plan
pnpm build— emitsdist/fs-routes/next-adapter.{mjs,d.mts}pnpm typecheckcleanpnpm test:run— 51 unit tests passpnpm lint/pnpm format:checkclean🤖 Generated with Claude Code
https://claude.ai/code/session_019KZaV9B4HmtACBqoPdL8qK
Generated by Claude Code