-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[breaking] Prerendering overhaul (#6392)
- Loading branch information
1 parent
9592539
commit 863a546
Showing
34 changed files
with
287 additions
and
116 deletions.
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,5 @@ | ||
--- | ||
'@sveltejs/adapter-static': patch | ||
--- | ||
|
||
[breaking] require all routes to be prerenderable when not using fallback option |
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,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
[breaking] add `prerender = 'auto'` option, and extend `prerender` option to endpoints |
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
5 changes: 5 additions & 0 deletions
5
packages/adapter-static/test/apps/prerendered/src/routes/+page.js
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,5 @@ | ||
/** @type {import('./$types').PageLoad} */ | ||
export async function load({ fetch }) { | ||
const res = await fetch('/endpoint/implicit.json'); | ||
return await res.json(); | ||
} |
8 changes: 7 additions & 1 deletion
8
packages/adapter-static/test/apps/prerendered/src/routes/+page.svelte
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 |
---|---|---|
@@ -1 +1,7 @@ | ||
<h1>This page was prerendered</h1> | ||
<script> | ||
/** @type {import('./$types').PageData} */ | ||
export let data; | ||
</script> | ||
|
||
<h1>This page was prerendered</h1> | ||
<p>answer: {data.answer}</p> |
8 changes: 8 additions & 0 deletions
8
packages/adapter-static/test/apps/prerendered/src/routes/endpoint/explicit.json/+server.js
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 @@ | ||
import { json } from '@sveltejs/kit'; | ||
|
||
export const prerender = true; | ||
|
||
/** @type {import('./$types').RequestHandler} */ | ||
export function GET() { | ||
return json({ answer: 42 }); | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/adapter-static/test/apps/prerendered/src/routes/endpoint/implicit.json/+server.js
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,9 @@ | ||
import { json } from '@sveltejs/kit'; | ||
|
||
// no export const prerender here, it should be prerendered by virtue | ||
// of being fetched from a prerendered page | ||
|
||
/** @type {import('./$types').RequestHandler} */ | ||
export function GET() { | ||
return json({ answer: 42 }); | ||
} |
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
Oops, something went wrong.