From 5bd3e3242c6a768128aea9ac5259e18a11a081e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Wed, 18 Nov 2026 08:31:56 +0000 Subject: [PATCH] fix(core): keep SVG id renaming linear in the page size and within the render size limit (#8147) * test(core): SVG id renaming shares its table, looks up only named ids, caps and charges what it adds * fix(core): SVG id renaming shares one table, caps id prefixes and charges the bytes it adds * test(core): a long namespace is hashed once per mount * fix(core): sanitize and hash each mount's namespace once, before minting its ids * test(core): page goldens carry the regenerated selector alias bundle --- packages/core/src/canary.ts | 2 +- .../__goldens__/pageBuild.preview.html | 30 ++-- .../__goldens__/pageBuild.render.html | 30 ++-- .../compiler/inlineSubCompositions.test.ts | 22 +++ .../src/compiler/inlineSubCompositions.ts | 63 +++++--- .../core/src/compiler/selectorIdTokens.ts | 15 ++ .../src/compiler/svgIdNamespacing.test.ts | 138 +++++++++++++++++- .../core/src/compiler/svgIdNamespacing.ts | 104 +++++++++---- .../generated/svg-selector-aliases-inline.ts | 2 +- 9 files changed, 322 insertions(+), 84 deletions(-) diff --git a/packages/core/src/canary.ts b/packages/core/src/canary.ts index af2dfd8414..83a490f120 100644 --- a/packages/core/src/canary.ts +++ b/packages/core/src/canary.ts @@ -90,7 +90,7 @@ export interface CanaryInput { * to a UTF-8 encoding here first, which is not free in the browser bundle * (`TextEncoder` is fine; `Buffer` is not). */ -function fnv1a32(input: string): number { +export function fnv1a32(input: string): number { let hash = 0x811c9dc5; for (let i = 0; i < input.length; i++) { hash ^= input.charCodeAt(i); diff --git a/packages/core/src/compiler/__goldens__/pageBuild.preview.html b/packages/core/src/compiler/__goldens__/pageBuild.preview.html index 1ad74f87ff..1181fe4da5 100644 --- a/packages/core/src/compiler/__goldens__/pageBuild.preview.html +++ b/packages/core/src/compiler/__goldens__/pageBuild.preview.html @@ -285,7 +285,7 @@ window.__timelines.main = gsap.timeline({ paused: true });