-
-
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: hybrid output #6991
Merged
+669
−173
Merged
feat: hybrid output #6991
Changes from 53 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
99c3bfa
update config schema
MoustaphaDev e4c614d
adapt default route `prerender` value
MoustaphaDev 1b05568
adapt error message for hybrid output
MoustaphaDev e9408cf
core hybrid output support
MoustaphaDev ba0c6cd
add JSDocs for hybrid output
MoustaphaDev 06a8f69
dev server hybrid output support
MoustaphaDev 6d509b5
defer hybrid output check
MoustaphaDev 2d7263e
update endpoint request warning
MoustaphaDev 96cffb7
support `output=hybrid` in integrations
MoustaphaDev 70c60c9
put constant variable out of for loop
MoustaphaDev 3a4541d
revert: reapply back ssr plugin in ssr mode
MoustaphaDev 2788683
change `prerender` option default
MoustaphaDev 157c4e0
apply `prerender` by default in hybrid mode
MoustaphaDev 0fa2ded
simplfy conditional
MoustaphaDev 459b9d3
Merge branch 'main' of https://github.com/withastro/astro into mk-fea…
MoustaphaDev b3c6e24
update config schema
MoustaphaDev 21f7a41
add `isHybridOutput` helper
MoustaphaDev f18245c
more readable prerender condition
MoustaphaDev 3496afa
set default prerender value if no export is found
MoustaphaDev cc4fd2d
Merge branch 'main' of https://github.com/withastro/astro into mk-fea…
MoustaphaDev b44a926
only add `pagesVirtualModuleId` ro rollup input in `output=static`
MoustaphaDev b756753
don't export vite plugin
MoustaphaDev 0b14c61
remove unneeded check
MoustaphaDev aaa9896
don't prerender when it shouldn't
MoustaphaDev ef2ffb1
extract fallback `prerender` meta
MoustaphaDev 7ca73e8
pass missing argument to function
MoustaphaDev 8a64125
test: update cloudflare integration tests
MoustaphaDev e941ad7
test: update tests of vercel integration
MoustaphaDev 5e54411
test: update tests of node integration
MoustaphaDev 5f7c217
test: update tests of netlify func integration
MoustaphaDev 7ba6bcb
test: update tests of netlify edge integration
MoustaphaDev e2c582a
Merge branch 'main' of https://github.com/withastro/astro into mk-fea…
MoustaphaDev 5efc41e
throw when `hybrid` mode is malconfigured
MoustaphaDev f104d5d
Merge branch 'main' of https://github.com/withastro/astro into mk-fea…
MoustaphaDev fb02e34
update node integraiton `output` warning
MoustaphaDev 109fd60
test(WIP): skip node prerendering tests for now
MoustaphaDev 2b9a37e
remove non-existant import
MoustaphaDev 0e82f30
Merge branch 'main' of https://github.com/withastro/astro into mk-fea…
MoustaphaDev fa2f92c
test: bring back prerendering tests
MoustaphaDev 0478cea
remove outdated comments
MoustaphaDev ae079eb
test: refactor test to support windows paths
MoustaphaDev 79fdfd6
remove outdated comments
MoustaphaDev cdb5816
apply sarah review
MoustaphaDev b818f79
docs: `experiment.hybridOutput` jsodcs
MoustaphaDev d5bf324
test: prevent import from being cached
MoustaphaDev a1f1558
refactor: extract hybrid output check to function
MoustaphaDev bada941
add `hybrid` to output warning in adapter hooks
MoustaphaDev 091e9c8
chore: changeset
MoustaphaDev 037efbc
add `.js` extension to import
MoustaphaDev e6bd737
chore: use spaces instead of tabs for gh formating
MoustaphaDev e595d21
Merge branch 'main' of https://github.com/withastro/astro into mk-fea…
MoustaphaDev c408482
resolve merge conflict
MoustaphaDev 3f340a3
chore: move test to another file for consitency
MoustaphaDev eb55a43
Merge branch 'main' into mk-feat/output-hybrid
matthewp 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,39 @@ | ||
--- | ||
'astro': minor | ||
'@astrojs/cloudflare': patch | ||
'@astrojs/netlify': patch | ||
'@astrojs/vercel': patch | ||
'@astrojs/image': patch | ||
'@astrojs/deno': patch | ||
'@astrojs/node': patch | ||
--- | ||
|
||
Enable experimental support for hybrid SSR with pre-rendering enabled by default | ||
|
||
__astro.config.mjs__ | ||
```js | ||
import { defineConfig } from 'astro/config'; | ||
export defaultdefineConfig({ | ||
output: 'hybrid', | ||
experimental: { | ||
hybridOutput: true, | ||
}, | ||
}) | ||
``` | ||
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering. | ||
|
||
__src/pages/contact.astro__ | ||
```astro | ||
--- | ||
export const prerender = false | ||
|
||
if (Astro.request.method === 'POST') { | ||
// handle form submission | ||
} | ||
--- | ||
<form method="POST"> | ||
<input type="text" name="name" /> | ||
<input type="email" name="email" /> | ||
<button type="submit">Submit</button> | ||
</form> | ||
``` |
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
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
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 |
---|---|---|
|
@@ -6,12 +6,12 @@ import { eachPageData, hasPrerenderedPages, type BuildInternals } from '../inter | |
import type { AstroBuildPlugin } from '../plugin'; | ||
import type { StaticBuildOptions } from '../types'; | ||
|
||
export function vitePluginPages(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin { | ||
function vitePluginPages(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin { | ||
return { | ||
name: '@astro/plugin-build-pages', | ||
|
||
options(options) { | ||
if (opts.settings.config.output === 'static' || hasPrerenderedPages(internals)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (opts.settings.config.output === 'static') { | ||
return addRollupInput(options, [pagesVirtualModuleId]); | ||
} | ||
}, | ||
|
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
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
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.
Marked these as 'patch' because I updated the warning we get when using these adapters with an unexpected output mode.