feat: serve static assets from the build manifest - #16908
Open
Nic-Polumeyv wants to merge 3 commits into
Open
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/050fcd534fe0a32060ddd510cb3feefae15abdbcOpen in |
🦋 Changeset detectedLatest commit: 050fcd5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Nic-Polumeyv
force-pushed
the
manifest-static-assets
branch
2 times, most recently
from
August 22, 2026 19:29
d59c710 to
81ea893
Compare
Nic-Polumeyv
force-pushed
the
manifest-static-assets
branch
from
August 22, 2026 19:31
81ea893 to
1192a76
Compare
Nic-Polumeyv
marked this pull request as ready for review
August 22, 2026 19:50
Key the prerendered table by the exact paths kit prerendered, which removes the prerendered set and the request-time gate that filtered out unreachable alias keys. The manifest now ships one string per prerendered page instead of four. Fold create_asset_map into serve_static and resolve content types once at boot instead of per request.
An unhandled read stream error (a file deleted from the build output, EMFILE) crashed the process. Headers are already sent by then, so drop the connection.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16565, fixes #11766.
Serving static assets from build manifest is 10 to 20% faster than sirv on a local loopback benchmark, winning all eight comparisons across two interleaved rounds of plain, brotli, icon, and extensionless-alias requests at 20 concurrent keep-alive connections.
Currently, the static file server re-derives at request time what the build already computed.
adapter-nodenow writes two tables into the emitted manifest, one per mount, mapping every servable pathname (including precomputedfoo.html/foo/index.htmlaliases in sirv's resolution order) to its file, size, content-hash ETag and compressed-variant sizes/hashes. Serving (src/static.js) is a map lookup and a stream,Varyis sent exactly when a variant exists (which retiresuncompressed_extensionsand the over-send #16566 had to work around), and the range handling is RFC 7233 (bytes=0-0returned the whole file under sirv,bytes=-3was off by one — the former is the probe HTML5 video and PDF.js use).sirv,@polka/urland their transitivemrmime/totalistdrop out of the adapter, along with the 27kB sirv chunk in the build output.manifest.mimeTypesis now also seeded from client output extensions (same mechanism as the prerendered seeding from #16564), since.js/.css/imported-asset types previously came from sirv's bundled mrmime.Deliberate behavior changes: ETags are content hashes instead of mtime-derived (stable across rebuilds of identical files),
Last-Modifiedis no longer sent (deploy processes reset mtimes, and the ETag supersedes it),Accept-Rangesis always advertised, and files with unknown extensions omitContent-Typeinstead of sending an empty one. Base-path key construction follows the same${base}composition the oldasset_dirused, but no adapter-node test app exercises a base path - that's a pre-existing coverage hole.Sits on #16907; only the last commit is new.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.