-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(vercel): streaming #8879
Merged
Merged
feat(vercel): streaming #8879
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8e49b35
feat(vercel): streaming
lilnasy fbc595b
add test
lilnasy 441ae06
add changeset
lilnasy 3a03091
add docs
lilnasy 463f157
fix unrelated test that never ran until this PR for some reason
lilnasy fe28750
Apply suggestions from code review
lilnasy d23967a
enabled without configuration
lilnasy b05a2ec
major -> minor
lilnasy 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 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,7 @@ | ||
--- | ||
'@astrojs/vercel': minor | ||
--- | ||
|
||
The Vercel adapter now streams responses! | ||
|
||
This brings better performance to your visitors by showing them content as it is rendered. The browser can also start loading the required stylesheets and scripts much sooner, which ultimately results in faster full page loads. | ||
This file contains 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
7 changes: 7 additions & 0 deletions
7
packages/integrations/vercel/test/fixtures/streaming/astro.config.mjs
This file contains 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,7 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import vercel from '@astrojs/vercel/serverless'; | ||
|
||
export default defineConfig({ | ||
output: "server", | ||
adapter: vercel() | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/integrations/vercel/test/fixtures/streaming/package.json
This file contains 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,10 @@ | ||
{ | ||
"name": "@test/vercel-streaming", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"@astrojs/vercel": "workspace:*", | ||
"astro": "workspace:*" | ||
} | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
packages/integrations/vercel/test/fixtures/streaming/src/pages/one.astro
This file contains 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,8 @@ | ||
<html> | ||
<head> | ||
<title>One</title> | ||
</head> | ||
<body> | ||
<h1>One</h1> | ||
</body> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
packages/integrations/vercel/test/fixtures/streaming/src/pages/two.astro
This file contains 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,8 @@ | ||
<html> | ||
<head> | ||
<title>Two</title> | ||
</head> | ||
<body> | ||
<h1>Two</h1> | ||
</body> | ||
</html> |
This file contains 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 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,21 @@ | ||
import { loadFixture } from './test-utils.js'; | ||
import { expect } from 'chai'; | ||
|
||
describe('maxDuration', () => { | ||
/** @type {import('./test-utils.js').Fixture} */ | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/streaming/', | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
it('makes it to vercel function configuration', async () => { | ||
const vcConfig = JSON.parse( | ||
await fixture.readFile('../.vercel/output/functions/render.func/.vc-config.json') | ||
); | ||
expect(vcConfig).to.deep.include({ supportsResponseStreaming: true }); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Up to you! Since there are warnings involved with streaming, it couldn't hurt to send to the new docs. BUT, since this doesn't break anything, not really needed anymore. (Was added when I was afraid that enabling this changed the Response headers behaviour)
NOTE: Depending on how quickly this merges, I have a PR that would add the anchor link above but currently the URL is only
#streaming
. If this is to merge soon, I can pre-emptively update existing docs to that link now, even before the new page is published.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.
Withdrawing this suggestion! With that docs page about to change, it's maybe a little too disruptive at this exact moment.