-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: add server middleware support #13430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9f48a7b
feat: add middleware support
dummdidumm ea1f841
build + preview
dummdidumm 93d5536
pass URL separately which is normalized, extract logic
dummdidumm b5985fe
reorganize, make call-middleware usable for adapters
dummdidumm 2a1153a
vercel adapter
dummdidumm 9a01290
tweak
dummdidumm 484864a
adapter netlify
dummdidumm df7c138
tweak
dummdidumm e9ab049
adapter cloudflare
dummdidumm a2aecbd
lockfile
dummdidumm e66a161
adapter-node
dummdidumm d15a013
docs
dummdidumm dfd3829
only check for middleware support if it's actually used
dummdidumm f153c3f
Merge remote-tracking branch 'origin/main' into sveltekit-middleware
dummdidumm 4b1824d
lint/fix
dummdidumm 000f022
matcher support for vercel
dummdidumm f51ca7f
allow middleware to influence when it matches in dev
dummdidumm f6a5a3a
make sure adapter node middleware runs for prerendered/static files, too
dummdidumm 6316e61
run on static assets for cloudflare/netlify
dummdidumm 63c1b7d
doc tweaks
dummdidumm 47b6bc6
fix
dummdidumm 39861c6
fix
dummdidumm f1163d8
tests
dummdidumm 18e6230
fixes
dummdidumm faed1cc
Merge branch 'main' into sveltekit-middleware
elliott-with-the-longest-name-on-github 1e10353
chore: Add experimental flag to middleware (#13458)
elliott-with-the-longest-name-on-github af2eed3
make it a unit test instead
dummdidumm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export function middleware() {} | ||
|
||
/** @param {Request} request */ | ||
export function call_middleware(request) { | ||
return { | ||
request, | ||
did_reroute: false, | ||
request_headers: new Headers(), | ||
response_headers: new Headers(), | ||
add_response_headers: () => {} | ||
}; | ||
} |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda feel like we should move to
src/hooks/middleware.js
so that in 3.0 we could potentially move tosrc/hooks/handle.js
,src/hooks/reroute.js
, etc. -- would make selectively deploying a hook to edge easier... 🤔