aboutsummaryrefslogtreecommitdiff
path: root/website/scripts/patch-starlight-llms.mjs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-09-01 14:48:45 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-09-01 14:48:45 +0300
commit8a6d697308162874a236c84aac0b0f8c7ac01f83 (patch)
treeed7dc7e8c6f50d66bde721fae78576aede929f66 /website/scripts/patch-starlight-llms.mjs
parentb54a78aa510b87d1e3b56c619b72eaeb59e4a2a1 (diff)
refactor: separate website presentation from runtime
Diffstat (limited to 'website/scripts/patch-starlight-llms.mjs')
-rw-r--r--website/scripts/patch-starlight-llms.mjs54
1 files changed, 0 insertions, 54 deletions
diff --git a/website/scripts/patch-starlight-llms.mjs b/website/scripts/patch-starlight-llms.mjs
deleted file mode 100644
index 3582b6f6..00000000
--- a/website/scripts/patch-starlight-llms.mjs
+++ /dev/null
@@ -1,54 +0,0 @@
-import { readFile, writeFile } from 'node:fs/promises';
-import { resolve } from 'node:path';
-
-await patchFullBundleExclusions();
-await disablePluginIndexRoute();
-
-async function patchFullBundleExclusions() {
- const path = resolve('node_modules/starlight-llms-txt/llms-full.txt.ts');
- const original = await readFile(path, 'utf8');
- const importLine =
- "import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context';";
- const excludeLine = '\t\texclude: starlightLllmsTxtContext.exclude,';
-
- if (original.includes(importLine) && original.includes(excludeLine)) return;
-
- const withImport = original.replace(
- "import { generateLlmsTxt } from './generator';",
- `${importLine}\nimport { generateLlmsTxt } from './generator';`,
- );
- const patched = withImport.replace(
- '\t\tdescription: `This is the full developer documentation for ${getSiteTitle()}`,',
- '\t\tdescription: `This is the full developer documentation for ${getSiteTitle()}`,\n' +
- excludeLine,
- );
-
- if (patched === original || !patched.includes(importLine) || !patched.includes(excludeLine)) {
- throw new Error(
- 'starlight-llms-txt changed: update the stable-only llms-full compatibility patch',
- );
- }
-
- await writeFile(path, patched, 'utf8');
-}
-
-async function disablePluginIndexRoute() {
- const path = resolve('node_modules/starlight-llms-txt/index.ts');
- const original = await readFile(path, 'utf8');
- const marker =
- '\t\t\t\t\t\t\t// Herdr publishes channel-aware raw-source indexes from website/public.';
- if (original.includes(marker)) return;
-
- const route = `\t\t\t\t\t\t\tinjectRoute({
-\t\t\t\t\t\t\t\tentrypoint: new URL('./llms.txt.ts', import.meta.url),
-\t\t\t\t\t\t\t\tpattern: '/llms.txt',
-\t\t\t\t\t\t\t});`;
- const patched = original.replace(route, marker);
- if (patched === original || !patched.includes(marker)) {
- throw new Error(
- 'starlight-llms-txt changed: update the custom llms.txt index compatibility patch',
- );
- }
-
- await writeFile(path, patched, 'utf8');
-}