docs: add composing-by-nesting section, fix stale claims - #26
Merged
Conversation
commit: |
spydon
approved these changes
Aug 12, 2026
johnstonmatt
approved these changes
Aug 12, 2026
johnstonmatt
left a comment
Collaborator
There was a problem hiding this comment.
awesome! the recommendation to re-export the FetchHandler type was a nice touch 🔥
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.
A docs-emphasis change, plus accuracy fixes found while verifying it. No behavior changes.
Composing by nesting (new README section)
Every middleware takes the next handler directly, as
withFoo(config, handler), so composition works withoutpipeline.FetchHandleris a type, so a consumer composing only middleware from packages that re-export it imports nothing from@supabase/middlewareand never lists it inpackage.json. The README never said this. #21 (shipped in 0.3.0) removed the last technical reason to keep nesting quiet.pipelinestays the lead composition story. The lede and all existing examples are untouched.skills/supabase-middleware/SKILL.mdnow names both forms and tells agents not to rewrite one into the other.Accuracy fixes
Found by checking doc claims in the touched areas against source and tests:
satisfies FetchHandlerfails typecheck in consumer handlers if nesting depth >2 #21 sentences said the anchor is what makes the handler see upstream keys. Since fix:satisfies FetchHandlerfails typecheck in consumer handlers if nesting depth >2 #21,ctxaccumulates unannotated at any depth (pinned by theunannotated:test insrc/core/define-middleware.test.ts); the anchor buys collision detection and thefetch-export check. The §4 sample manifest depended on^0.1.0, a range matching no published version; now^0.3.0. Softened "the prerequisite can never become a lie": an untypedexport default { fetch: … }is unchecked, so it compiles and throws on first request.req.formData()is buffered like every other reader; only the rawreq.bodystream bypasses the cache. Addedpipeline/Entryto the root-exports list.{ ... }fragments and must not be written to disk verbatim.