From cbbe595e6da64537a6d45b3c08908e8f4010f0aa Mon Sep 17 00:00:00 2001
From: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Date: Wed, 18 Nov 2026 17:23:13 -0600
Subject: [PATCH 1/5] Move repeated inline page scripts, styles, and icons into
shared assets
- Load the AppHost preference and WCP consent bootstraps as blocking,
hashed /_astro/ scripts instead of inlining them in every page.
- Bundle the Footer and OsAwareTabs scripts; OsAwareTabs now renders a
marker read by a shared module.
- Emit all JavaScript as files (no inline module scripts) and set
build.inlineStylesheets to 'never'.
- Render the sidebar caret and page-action external icon via CSS masks
(Starlight / starlight-page-actions patches).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---
src/frontend/astro.config.mjs | 9 +
src/frontend/eslint.config.mjs | 10 +
.../patches/@astrojs__starlight@0.41.3.patch | 51 +-
.../starlight-page-actions@0.7.0.patch | 43 +-
src/frontend/src/components/OsAwareTabs.astro | 69 +--
.../src/components/starlight/Footer.astro | 318 ++++++------
.../src/components/starlight/Head.astro | 485 +-----------------
.../src/scripts/apphost-preferences.inline.js | 135 +++++
src/frontend/src/scripts/os-aware-tabs.ts | 78 +++
.../src/scripts/wcp-consent.inline.js | 346 +++++++++++++
.../unit/custom-components.vitest.test.ts | 13 +-
.../navigation-preferences.vitest.test.ts | 16 +-
12 files changed, 850 insertions(+), 723 deletions(-)
create mode 100644 src/frontend/src/scripts/apphost-preferences.inline.js
create mode 100644 src/frontend/src/scripts/os-aware-tabs.ts
create mode 100644 src/frontend/src/scripts/wcp-consent.inline.js
diff --git a/src/frontend/astro.config.mjs b/src/frontend/astro.config.mjs
index c4b5f17828..c22ce219d9 100644
--- a/src/frontend/astro.config.mjs
+++ b/src/frontend/astro.config.mjs
@@ -66,6 +66,12 @@ export default defineConfig({
cacheDir: './node_modules/.astro',
...(outDir ? { outDir } : {}),
vite: {
+ build: {
+ // Astro inlines processed }
+ initOsAwareTabs();
+ document.addEventListener('astro:page-load', initOsAwareTabs);
+
diff --git a/src/frontend/src/components/starlight/Footer.astro b/src/frontend/src/components/starlight/Footer.astro
index 64e546c548..9c55b81575 100644
--- a/src/frontend/src/components/starlight/Footer.astro
+++ b/src/frontend/src/components/starlight/Footer.astro
@@ -383,12 +383,13 @@ const commit = (import.meta.env.PUBLIC_GIT_COMMIT_ID || import.meta.env.GIT_COMM
}
-
+ document.querySelectorAll('a[href]').forEach((a) => {
+ if (a.hasAttribute('data-brand-license')) return;
+ try {
+ const url = new URL(a.getAttribute('href') ?? '', window.location.origin);
+ if (!/^https?:$/.test(url.protocol)) return;
-
diff --git a/src/frontend/src/components/starlight/Head.astro b/src/frontend/src/components/starlight/Head.astro
index a56cafaece..726e842316 100644
--- a/src/frontend/src/components/starlight/Head.astro
+++ b/src/frontend/src/components/starlight/Head.astro
@@ -10,6 +10,8 @@ import SiteTour from '../SiteTour.astro';
import { getStructuredData } from '@utils/structured-data';
import { getOgMetadata } from '@utils/page-metadata';
import { deploymentMetadata } from '@utils/deployment-metadata';
+import appHostPreferencesScriptUrl from '@scripts/apphost-preferences.inline.js?url';
+import wcpConsentScriptUrl from '@scripts/wcp-consent.inline.js?url';
// The Poppins weights that text in the first viewport renders with. The same files back the
// @font-face rules in site.css, so these resolve to the already-emitted assets.
@@ -98,139 +100,7 @@ function computeSourceUrl() {
{structuredData && }
-
+
-
+
');
+ expect(head).not.toContain('var appHostLangLabels');
+});
function root() {
const attributes = new Map();
From 70073ea32ea1d7bd9f1486ad3d6d477bec1827d3 Mon Sep 17 00:00:00 2001
From: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Date: Wed, 18 Nov 2026 17:42:54 -0600
Subject: [PATCH 2/5] Serve repeated Starlight icons from a shared SVG sprite
Redirect every import of Starlight's Icon component to a wrapper that
references common icons (site chrome, sidebar topics, socials, pickers,
asides) from a hashed /_astro/ sprite via