Repository navigation
feat(layout): lean asset registration script - #74
Merged
Merged
Conversation
- drop originalUrl from the serialized asset: the primary URL is always publicPath + path, the runtime derives it (dedup key, first attempt, event detail) - build the document.write recovery tags in the browser from the same asset list instead of embedding the pre-rendered tags as a string Every asset URL was written three times into the registration script (list, recovery string, preload link); now once. On Cloud Console's head (6 CSS + 16 JS) the registration block goes from 8.3 KB to 2.6 KB raw (985 B to 881 B gzipped). Loader behaviour is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
DanilaBeseda
self-requested a review
October 21, 2026 10:38
DanilaBeseda
approved these changes
Oct 21, 2026
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.
What
Follow-up to #72. The registration script repeated every asset URL three times: in the asset list (
originalUrl), in the pre-rendereddocument.writerecovery string, and (unavoidably) in the preload link. Now it is written once.originalUrlis gone from the serialized asset. It was alwayspublicPath + pathby construction (createScriptAsset/createStyleAssetonly manage URLs underpublicPath), so the runtime derives it: for the dedup key, for the first attempt, and forapp-layout:asset-load-error(detail.originalUrlis unchanged for consumers).<link rel="stylesheet">/<script defer>withcrossoriginandnonce), instead of embedding the pre-rendered tags as a second copy.&and"in URLs are escaped,</script>is split.Before / after on real head (6 CSS + 16 JS):
Mostly a readability win in the emitted HTML; the wire gain is ~100 B per page.
What does not change
runtime.tsonly replaces threeasset.originalUrlreads withpublicPath + path.publicPathFallbacksthe output is byte-for-byte the same.Assetis internal (not exported);serializeAssetRegistrations(assets, publicPath)replaces(assets, originalHtml).Tests
serialization.test.ts: recovery now asserted on the rebuilt tags (stylesheet, script withcrossorigin+nonce, script withoutcrossorigin,&escaping); existing bootstrap-failure cases updated to the rebuilt form.render.test.ts/runtime.test.ts: adjusted for the new asset shape.tsc, eslint, 43/43.🤖 Generated with Claude Code