Skip to content
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: Move hooks.{js|ts} init to Server.init instead of Server.respond #6179

Merged
merged 22 commits into from
Aug 24, 2022
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fa53fbb
feat: Move hooks.js initialization into Server.init
elliott-with-the-longest-name-on-github Aug 23, 2022
02c5764
fix: Server type
elliott-with-the-longest-name-on-github Aug 23, 2022
3bfd40c
feat: Await Server.init in adapters
elliott-with-the-longest-name-on-github Aug 23, 2022
286648a
feat: Await server.init in preview
elliott-with-the-longest-name-on-github Aug 23, 2022
204acb1
fix: Init server during prerender
elliott-with-the-longest-name-on-github Aug 23, 2022
16cdc7b
feat: Init hooks when dev mode starts instead of on first request
elliott-with-the-longest-name-on-github Aug 23, 2022
f8bd413
fix: Prerendering, but better
elliott-with-the-longest-name-on-github Aug 23, 2022
ea9c218
feat: Test env vars in prerender
elliott-with-the-longest-name-on-github Aug 23, 2022
c6a7f6d
fix: Remove console.log
elliott-with-the-longest-name-on-github Aug 23, 2022
7f31360
fix: Import in hooks.js of basics test app
elliott-with-the-longest-name-on-github Aug 23, 2022
3fba16e
changeset
elliott-with-the-longest-name-on-github Aug 23, 2022
2c7e2a8
Update packages/adapter-netlify/src/serverless.js
elliott-with-the-longest-name-on-github Aug 23, 2022
9583fbc
Update packages/kit/src/vite/build/build_server.js
elliott-with-the-longest-name-on-github Aug 23, 2022
6cb779c
feat: Enable top-level await in `adapter-node`
elliott-with-the-longest-name-on-github Aug 23, 2022
8ef2f83
feat: Add warning comment for future devs
elliott-with-the-longest-name-on-github Aug 23, 2022
7afab3e
fix: Init env prior to hooks
elliott-with-the-longest-name-on-github Aug 23, 2022
6131dd3
Merge branch '6147/sejohnson-move-hooks-init' of github.com:sveltejs/…
elliott-with-the-longest-name-on-github Aug 23, 2022
a8c62b2
fix: Remove dear Rich
elliott-with-the-longest-name-on-github Aug 23, 2022
23a9206
Merge branch 'master' into 6147/sejohnson-move-hooks-init
elliott-with-the-longest-name-on-github Aug 23, 2022
580ffd2
fix: Apparently didn't like my tsconfig
elliott-with-the-longest-name-on-github Aug 23, 2022
e9286ad
fix: Move env and hooks initialization later
elliott-with-the-longest-name-on-github Aug 23, 2022
5b9b0db
move user_hooks init back from whence it came
Rich-Harris Aug 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Init hooks when dev mode starts instead of on first request
  • Loading branch information
commit 16cdc7be671c9a414eec997c1b601dd5e578f2bd
10 changes: 5 additions & 5 deletions packages/kit/src/vite/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export async function dev(vite, vite_config, svelte_config, illegal_imports) {

sync.init(svelte_config, vite_config.mode);

/** @type {Partial<import('types').Hooks>} */
const user_hooks = resolve_entry(svelte_config.kit.files.hooks)
? await vite.ssrLoadModule(`/${svelte_config.kit.files.hooks}`)
: {};

elliott-with-the-longest-name-on-github marked this conversation as resolved.
Show resolved Hide resolved
/** @type {import('types').Respond} */
const respond = (await import(`${runtime_prefix}/server/index.js`)).respond;

Expand Down Expand Up @@ -318,11 +323,6 @@ export async function dev(vite, vite_config, svelte_config, illegal_imports) {
);
}

/** @type {Partial<import('types').Hooks>} */
const user_hooks = resolve_entry(svelte_config.kit.files.hooks)
? await vite.ssrLoadModule(`/${svelte_config.kit.files.hooks}`)
: {};

const handle = user_hooks.handle || (({ event, resolve }) => resolve(event));

/** @type {import('types').Hooks} */
Expand Down