Skip to content

chore: configure the server runtime in one place - #17000

Open
Nic-Polumeyv wants to merge 5 commits into
version-3from
server-boot
Open

chore: configure the server runtime in one place#17000
Nic-Polumeyv wants to merge 5 commits into
version-3from
server-boot

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Kit sets up its server runtime in six places: Server.init, prerender, analyse, dev, preview and the fallback generator. Each calls a different subset of the same module-level setters by hand, in an order four comments explain. The Server class itself holds no state since #16967, its constructor is set_manifest.

configure in the generated server module now owns that order, and init and respond replace the class. The server object adapters get from generateServerInstance is unchanged and still only accepts env and read, so the internal options configure takes (building, prerendering, manifest) are not reachable through it. Server stays as a deprecated shim.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 2, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from c440ed4:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/c440ed4d09147d080bad8db59310929aba65a3c5

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17000

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c440ed4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Advanced

Run ID: 5f249f74-f831-42af-a1ad-b25985db24db

📥 Commits

Reviewing files that changed from the base of the PR and between 4f69920 and c440ed4.

📒 Files selected for processing (2)
  • packages/kit/src/core/adapt/builder.js
  • packages/kit/src/types/internal.d.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • sveltejs/svelte (manual)
  • sveltejs/vite-plugin-svelte (manual)
  • vitejs/vite (manual)

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The server lifecycle now uses module-level configure, init, respond, and create_server APIs. Build, prerender, fallback, analysis, development, preview, generated modules, type declarations, and migration documentation use the new API surface.

Changes

Server lifecycle migration

Layer / File(s) Summary
Server contracts and generated configuration Server module types define configure, init, respond, and create_server. The generated module applies runtime options and adapts read results to runtime streams.
Runtime lifecycle and request handling The runtime provides shared initialization and response functions. create_server returns bound handlers, while Server delegates to the new implementation.
Build and postbuild server integration Build and postbuild paths configure and initialize the module-level server, then call respond for requests.
Vite adapter integration and instrumentation Development, preview, and test instrumentation paths use the exported lifecycle functions instead of constructing Server instances. The changeset and migration documentation describe the deprecated Server class.

Sequence Diagram(s)

sequenceDiagram
  participant ViteAdapter
  participant GeneratedServer
  participant RuntimeServer
  ViteAdapter->>GeneratedServer: init manifest, environment, assets, and read
  GeneratedServer->>RuntimeServer: configure runtime state
  ViteAdapter->>GeneratedServer: respond request
  GeneratedServer->>RuntimeServer: respond request
Loading

Merge Risk: ⚪ Minimal · up to c440e

This change centralizes server lifecycle setup and updates generated server creation to use the new factory API. No concrete current-head behavior, compatibility, or deployment risk remains identified.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required chore: prefix and accurately describes the central server runtime configuration change.
Backward Compatibility Impact Disclosure ✅ Passed No breaking public interface change is introduced by this PR. The public @sveltejs/kit Server interface and ServerInitOptions are unchanged, and Server remains exported as a deprecated compati…
Full details: Backward Compatibility Impact Disclosure

Explanation

No breaking public interface change is introduced by this PR. The public @sveltejs/kit Server interface and ServerInitOptions are unchanged, and Server remains exported as a deprecated compatibility shim. Builder.generateServerInstance still produces a server object with init and respond; the removed setter exports are from the generated internal server module, which is not a package export. No public request/response fields, defaults, or config keys changed. The patch changeset is therefore sufficient.


Comment @coderabbitai help to get the list of available commands.

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as draft September 2, 2026 05:07
@Nic-Polumeyv
Nic-Polumeyv marked this pull request as ready for review September 2, 2026 14:25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one nit to look at before we merge

Comment thread packages/kit/src/core/postbuild/prerender.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants