-
-
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.
feat: Move
hooks.{js|ts}
init to Server.init
instead of `Server.r…
…espond` (#6179) * feat: Move hooks.js initialization into Server.init * fix: Server type * feat: Await Server.init in adapters * feat: Await server.init in preview * fix: Init server during prerender * feat: Init hooks when dev mode starts instead of on first request * fix: Prerendering, but better * feat: Test env vars in prerender * fix: Remove console.log * fix: Import in hooks.js of basics test app * changeset * Update packages/adapter-netlify/src/serverless.js Co-authored-by: Rich Harris <[email protected]> * Update packages/kit/src/vite/build/build_server.js Co-authored-by: Rich Harris <[email protected]> * feat: Enable top-level await in `adapter-node` * feat: Add warning comment for future devs * fix: Init env prior to hooks * fix: Remove dear Rich * fix: Apparently didn't like my tsconfig * fix: Move env and hooks initialization later * move user_hooks init back from whence it came Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Rich Harris <[email protected]>
- Loading branch information
1 parent
349dc2d
commit 64449a7
Showing
19 changed files
with
90 additions
and
19 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,10 @@ | ||
--- | ||
'@sveltejs/adapter-cloudflare': patch | ||
'@sveltejs/adapter-cloudflare-workers': patch | ||
'@sveltejs/adapter-netlify': patch | ||
'@sveltejs/adapter-node': patch | ||
'@sveltejs/adapter-vercel': patch | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
[feat] Moved hooks.js initialization from Server.respond into Server.init |
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PRIVATE_STATIC="accessible to server-side code/replaced at build time" | ||
PRIVATE_DYNAMIC="accessible to server-side code/evaluated at run time" | ||
|
||
PUBLIC_STATIC="accessible anywhere/replaced at build time" | ||
PUBLIC_DYNAMIC="accessible anywhere/evaluated at run time" |
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 @@ | ||
!.env |
9 changes: 9 additions & 0 deletions
9
packages/kit/test/prerendering/basics/src/routes/env/+page.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 { PRIVATE_STATIC } from '$env/static/private'; | ||
import { env } from '$env/dynamic/private'; | ||
|
||
export function load() { | ||
return { | ||
PRIVATE_STATIC, | ||
PRIVATE_DYNAMIC: env.PRIVATE_DYNAMIC | ||
}; | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/kit/test/prerendering/basics/src/routes/env/+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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
import { PUBLIC_STATIC } from '$env/static/public'; | ||
import { env } from '$env/dynamic/public'; | ||
/** @type {import('./$types').PageData} */ | ||
export let data; | ||
</script> | ||
|
||
<p id="static-private">PRIVATE_STATIC: {data.PRIVATE_STATIC}</p> | ||
<p id="dynamic-private">PRIVATE_DYNAMIC: {data.PRIVATE_DYNAMIC}</p> | ||
|
||
<p id="static-public">PUBLIC_STATIC: {PUBLIC_STATIC}</p> | ||
<p id="dynamic-public">PUBLIC_DYNAMIC: {env.PUBLIC_DYNAMIC}</p> |
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