chore: merge the server request state into one object - #16605
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/4699641c2525b57373fa13d8d30d9d62828a2f07Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
|
7c3b5a5 to
ca1d01c
Compare
|
Unfortunately this'll need a rebase now that #16600 is closed |
b5e528f to
270c2ae
Compare
5306ce1 to
7ad276a
Compare
| depth: 0, | ||
| handleValidationError: hooks.handleValidationError, | ||
| tracing: { | ||
| record_span |
There was a problem hiding this comment.
occurs to me that we never reassign this, we could probably just import record_span in all the places we need to call it — not for this PR, but an easy follow-up
There was a problem hiding this comment.
I tested this. sequence is the only place left, and it can't import it: hooks is externalized in SSR, so otel.js throws on the unreplaced SVELTEKIT_SERVER_TRACING_ENABLED define. Trying to see if i can find something clever
Co-authored-by: Rich Harris <hello@rich-harris.dev>
#16675) Follow-up to #16605 (comment), using the #16658 treatment so it works from `sequence`. On top of #16605.
…he server runtime (#16871) `options` is already a single module-level object: `runtime/server/index.js` imports it from `<sveltekit:generated>/server.js` and `Server.init` writes `hooks` onto it, so every `Server` in a process shares it. It was also passed through 17 parameter positions, from `internal_respond` down to `static_error_page`, plus the `RemoteInternals.run` callback. It now sits in `runtime/server/internal.js` next to `manifest` and `read_implementation`, and `hooks` gets its own `set_hooks()` there, so `options` is immutable build data once `set_options` has run. `set_options` is called at module scope rather than in the constructor, so it lands before prerendering evaluates the user's remote modules, which happens before any `Server` is constructed. `fetch.js` renames its destructured set-cookie `options` to `cookie_options`, which would otherwise shadow the import. Follow-up to #16605 (comment). Part of #16519.
Part of #16519, doing the unification suggested in #16507 (comment). One request state object, forked for
event.fetchsub-requests. This also makes thestate.prerendering-in-dev idea from #16507 workable, since there's no second carrier to desync from anymore.